|
@@ -18,39 +18,39 @@ b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this
|
|
|
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.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
|
|
|
THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
|
|
|
THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
|
|
|
-THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);r=o.dot(b);s=q.add(a,m.copy(b).multiplyScalar(r));return t=c.distanceTo(s)}function d(a,b,c,d){o.sub(d,b);q.sub(c,b);m.sub(a,b);u=o.dot(o);x=o.dot(q);v=o.dot(m);A=q.dot(q);D=q.dot(m);E=1/(u*A-x*x);C=(A*v-x*D)*E;F=(u*D-x*v)*E;return 0<=C&&0<=F&&1>C+F}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=[];for(b=0,
|
|
|
-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,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){for(var b,m=[],o=0,q=a.children.length;o<q;o++)Array.prototype.push.apply(m,this.intersectObject(a.children[o]));if(a instanceof THREE.Particle){o=
|
|
|
-c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return m;var r,j=a.geometry,s=j.vertices,t;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(o=0,q=j.faces.length;o<q;o++)if(b=j.faces[o],i.copy(this.origin),l.copy(this.direction),
|
|
|
-t=a.matrixWorld,k=t.multiplyVector3(k.copy(b.centroid)).subSelf(i),r=k.dot(l),!(0>=r)&&(e=t.multiplyVector3(e.copy(s[b.a].position)),f=t.multiplyVector3(f.copy(s[b.b].position)),g=t.multiplyVector3(g.copy(s[b.c].position)),b instanceof THREE.Face4&&(h=t.multiplyVector3(h.copy(s[b.d].position))),p=a.matrixRotationWorld.multiplyVector3(p.copy(b.normal)),r=l.dot(p),a.doubleSided||(a.flipSided?0<r:0>r)))if(r=p.dot(k.sub(e,i))/r,n.add(i,l.multiplyScalar(r)),b instanceof THREE.Face3)d(n,e,f,g)&&(b={distance:i.distanceTo(n),
|
|
|
-point:n.clone(),face:b,object:a},m.push(b));else if(b instanceof THREE.Face4&&(d(n,e,f,h)||d(n,f,g,h)))b={distance:i.distanceTo(n),point:n.clone(),face:b,object:a},m.push(b)}return m};var o=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,r,s,t,u,x,v,A,D,E,C,F};
|
|
|
+THREE.Ray=function(a,b){function c(a,b,c){n.sub(c,a);r=n.dot(b);s=q.add(a,m.copy(b).multiplyScalar(r));return t=c.distanceTo(s)}function d(a,b,c,d){n.sub(d,b);q.sub(c,b);m.sub(a,b);u=n.dot(n);x=n.dot(q);w=n.dot(m);A=q.dot(q);D=q.dot(m);B=1/(u*A-x*x);C=(A*w-x*D)*B;G=(u*D-x*w)*B;return 0<=C&&0<=G&&1>C+G}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=[];for(b=0,
|
|
|
+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,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,p=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){for(var b,m=[],n=0,q=a.children.length;n<q;n++)Array.prototype.push.apply(m,this.intersectObject(a.children[n]));if(a instanceof THREE.Particle){n=
|
|
|
+c(this.origin,this.direction,a.matrixWorld.getPosition());if(n>a.scale.x)return[];b={distance:n,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){n=c(this.origin,this.direction,a.matrixWorld.getPosition());if(n>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return m;var j,r,s=a.geometry,t=s.vertices,y;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(n=0,q=s.faces.length;n<q;n++)if(b=s.faces[n],i.copy(this.origin),l.copy(this.direction),
|
|
|
+y=a.matrixWorld,k=y.multiplyVector3(k.copy(b.centroid)).subSelf(i),p=a.matrixRotationWorld.multiplyVector3(p.copy(b.normal)),j=l.dot(p),!(1.0E-4>Math.abs(j))&&(r=p.dot(k)/j,!(0>r)&&(a.doubleSided||(a.flipSided?0<j:0>j))))if(o.add(i,l.multiplyScalar(r)),b instanceof THREE.Face3)e=y.multiplyVector3(e.copy(t[b.a].position)),f=y.multiplyVector3(f.copy(t[b.b].position)),g=y.multiplyVector3(g.copy(t[b.c].position)),d(o,e,f,g)&&(b={distance:i.distanceTo(o),point:o.clone(),face:b,object:a},m.push(b));else if(b instanceof
|
|
|
+THREE.Face4&&(e=y.multiplyVector3(e.copy(t[b.a].position)),f=y.multiplyVector3(f.copy(t[b.b].position)),g=y.multiplyVector3(g.copy(t[b.c].position)),h=y.multiplyVector3(h.copy(t[b.d].position)),d(o,e,f,h)||d(o,f,g,h)))b={distance:i.distanceTo(o),point:o.clone(),face:b,object:a},m.push(b)}return m};var n=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,r,s,t,u,x,w,A,D,B,C,G};
|
|
|
THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,k,p){h=!1;b=f;c=g;d=k;e=p;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
|
|
|
-function(f,g,k,p,n,o){h?(h=!1,b=f<k?f<n?f:n:k<n?k:n,c=g<p?g<o?g:o:p<o?p:o,d=f>k?f>n?f:n:k>n?k:n,e=g>p?g>o?g:o:p>o?p:o):(b=f<k?f<n?f<b?f:b:n<b?n:b:k<n?k<b?k:b:n<b?n:b,c=g<p?g<o?g<c?g:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c,d=f>k?f>n?f>d?f:d:n>d?n:d:k>n?k>d?k:d:n>d?n:d,e=g>p?g>o?g>e?g:e:o>e?o:e:p>o?p>e?p:e:o>e?o:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
|
|
|
+function(f,g,k,p,o,n){h?(h=!1,b=f<k?f<o?f:o:k<o?k:o,c=g<p?g<n?g:n:p<n?p:n,d=f>k?f>o?f:o:k>o?k:o,e=g>p?g>n?g:n:p>n?p:n):(b=f<k?f<o?f<b?f:b:o<b?o:b:k<o?k<b?k:b:o<b?o:b,c=g<p?g<n?g<c?g:c:n<c?n:c:p<n?p<c?p:c:n<c?n:c,d=f>k?f>o?f>d?f:d:o>d?o:d:k>o?k>d?k:d:o>d?o:d,e=g>p?g>n?g>e?g:e:n>e?n:e:p>n?p>e?p:e:n>e?n:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
|
|
|
f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
|
|
|
THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};THREE.Matrix3=function(){this.m=[]};
|
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
|
-THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,l,k,p,n,o,q,m){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,l||0,void 0!==k?k:1,p||0,n||0,o||0,q||0,void 0!==m?m:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,l,k,p,n,o,q,m){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=i;this.n32=l;this.n33=k;this.n34=p;this.n41=n;this.n42=o;this.n43=q;this.n44=m;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,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,p=a.n32,n=a.n33,o=a.n34,q=a.n41,m=a.n42,r=a.n43,
|
|
|
-s=a.n44,t=b.n11,u=b.n12,x=b.n13,v=b.n14,A=b.n21,D=b.n22,E=b.n23,C=b.n24,F=b.n31,K=b.n32,L=b.n33,R=b.n34,N=b.n41,P=b.n42,B=b.n43,j=b.n44;this.n11=c*t+d*A+e*F+f*N;this.n12=c*u+d*D+e*K+f*P;this.n13=c*x+d*E+e*L+f*B;this.n14=c*v+d*C+e*R+f*j;this.n21=g*t+h*A+i*F+l*N;this.n22=g*u+h*D+i*K+l*P;this.n23=g*x+h*E+i*L+l*B;this.n24=g*v+h*C+i*R+l*j;this.n31=k*t+p*A+n*F+o*N;this.n32=k*u+p*D+n*K+o*P;this.n33=k*x+p*E+n*L+o*B;this.n34=k*v+p*C+n*R+o*j;this.n41=q*t+m*A+r*F+s*N;this.n42=q*u+m*D+r*K+s*P;this.n43=q*x+m*
|
|
|
-E+r*L+s*B;this.n44=q*v+m*C+r*R+s*j;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*=
|
|
|
+THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,l,k,p,o,n,q,m){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,l||0,void 0!==k?k:1,p||0,o||0,n||0,q||0,void 0!==m?m:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,l,k,p,o,n,q,m){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=i;this.n32=l;this.n33=k;this.n34=p;this.n41=o;this.n42=n;this.n43=q;this.n44=m;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,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,p=a.n32,o=a.n33,n=a.n34,q=a.n41,m=a.n42,r=a.n43,
|
|
|
+s=a.n44,t=b.n11,u=b.n12,x=b.n13,w=b.n14,A=b.n21,D=b.n22,B=b.n23,C=b.n24,G=b.n31,K=b.n32,L=b.n33,T=b.n34,M=b.n41,E=b.n42,j=b.n43,Q=b.n44;this.n11=c*t+d*A+e*G+f*M;this.n12=c*u+d*D+e*K+f*E;this.n13=c*x+d*B+e*L+f*j;this.n14=c*w+d*C+e*T+f*Q;this.n21=g*t+h*A+i*G+l*M;this.n22=g*u+h*D+i*K+l*E;this.n23=g*x+h*B+i*L+l*j;this.n24=g*w+h*C+i*T+l*Q;this.n31=k*t+p*A+o*G+n*M;this.n32=k*u+p*D+o*K+n*E;this.n33=k*x+p*B+o*L+n*j;this.n34=k*w+p*C+o*T+n*Q;this.n41=q*t+m*A+r*G+s*M;this.n42=q*u+m*D+r*K+s*E;this.n43=q*x+m*
|
|
|
+B+r*L+s*j;this.n44=q*w+m*C+r*T+s*Q;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,f=this.n22,g=this.n23,h=this.n24,i=this.n31,l=this.n32,k=this.n33,p=this.n34,n=this.n41,o=this.n42,q=this.n43,m=this.n44;return d*g*l*n-c*h*l*n-d*f*k*n+b*h*k*n+c*f*p*n-b*g*p*n-d*g*i*o+c*h*i*o+d*e*k*o-a*h*k*o-c*e*p*o+a*g*p*o+d*f*i*q-b*h*i*q-d*e*l*q+a*h*l*q+b*e*p*q-a*f*p*q-c*f*i*m+b*g*i*m+c*e*l*m-a*g*l*m-b*e*k*m+a*f*k*m},transpose:function(){var a;
|
|
|
+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,f=this.n22,g=this.n23,h=this.n24,i=this.n31,l=this.n32,k=this.n33,p=this.n34,o=this.n41,n=this.n42,q=this.n43,m=this.n44;return d*g*l*o-c*h*l*o-d*f*k*o+b*h*k*o+c*f*p*o-b*g*p*o-d*g*i*n+c*h*i*n+d*e*k*n-a*h*k*n-c*e*p*n+a*g*p*n+d*f*i*q-b*h*i*q-d*e*l*q+a*h*l*q+b*e*p*q-a*f*p*q-c*f*i*m+b*g*i*m+c*e*l*m-a*g*l*m-b*e*k*m+a*f*k*m},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.n34=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,f=a.x,g=a.y,h=a.z,i=e*f,l=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,l*g+c,l*h-d*f,0,i*h-d*g,l*h+d*f,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,f=a.n21,g=a.n22,h=a.n23,i=a.n24,l=a.n31,k=a.n32,p=a.n33,n=a.n34,o=a.n41,q=a.n42,m=a.n43,r=a.n44;this.n11=h*n*q-i*p*q+i*k*m-g*n*m-h*k*r+g*p*r;this.n12=e*p*q-d*n*q-e*k*m+c*n*m+d*k*r-c*p*r;this.n13=d*i*q-e*h*q+e*g*m-c*i*m-d*g*r+c*h*r;this.n14=e*h*k-d*i*k-e*g*p+c*i*p+d*g*n-c*h*n;this.n21=i*p*o-h*n*o-i*l*m+f*n*m+h*l*r-f*p*r;this.n22=d*n*o-e*p*o+
|
|
|
-e*l*m-b*n*m-d*l*r+b*p*r;this.n23=e*h*o-d*i*o-e*f*m+b*i*m+d*f*r-b*h*r;this.n24=d*i*l-e*h*l+e*f*p-b*i*p-d*f*n+b*h*n;this.n31=g*n*o-i*k*o+i*l*q-f*n*q-g*l*r+f*k*r;this.n32=e*k*o-c*n*o-e*l*q+b*n*q+c*l*r-b*k*r;this.n33=c*i*o-e*g*o+e*f*q-b*i*q-c*f*r+b*g*r;this.n34=e*g*l-c*i*l-e*f*k+b*i*k+c*f*n-b*g*n;this.n41=h*k*o-g*p*o-h*l*q+f*p*q+g*l*m-f*k*m;this.n42=c*p*o-d*k*o+d*l*q-b*p*q-c*l*m+b*k*m;this.n43=d*g*o-c*h*o-d*f*q+b*h*q+c*f*m-b*g*m;this.n44=c*h*l-d*g*l+d*f*k-b*h*k-c*f*p+b*g*p;this.multiplyScalar(1/a.determinant());
|
|
|
+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,f=a.n21,g=a.n22,h=a.n23,i=a.n24,l=a.n31,k=a.n32,p=a.n33,o=a.n34,n=a.n41,q=a.n42,m=a.n43,r=a.n44;this.n11=h*o*q-i*p*q+i*k*m-g*o*m-h*k*r+g*p*r;this.n12=e*p*q-d*o*q-e*k*m+c*o*m+d*k*r-c*p*r;this.n13=d*i*q-e*h*q+e*g*m-c*i*m-d*g*r+c*h*r;this.n14=e*h*k-d*i*k-e*g*p+c*i*p+d*g*o-c*h*o;this.n21=i*p*n-h*o*n-i*l*m+f*o*m+h*l*r-f*p*r;this.n22=d*o*n-e*p*n+
|
|
|
+e*l*m-b*o*m-d*l*r+b*p*r;this.n23=e*h*n-d*i*n-e*f*m+b*i*m+d*f*r-b*h*r;this.n24=d*i*l-e*h*l+e*f*p-b*i*p-d*f*o+b*h*o;this.n31=g*o*n-i*k*n+i*l*q-f*o*q-g*l*r+f*k*r;this.n32=e*k*n-c*o*n-e*l*q+b*o*q+c*l*r-b*k*r;this.n33=c*i*n-e*g*n+e*f*q-b*i*q-c*f*r+b*g*r;this.n34=e*g*l-c*i*l-e*f*k+b*i*k+c*f*o-b*g*o;this.n41=h*k*n-g*p*n-h*l*q+f*p*q+g*l*m-f*k*m;this.n42=c*p*n-d*k*n+d*l*q-b*p*q-c*l*m+b*k*m;this.n43=d*g*n-c*h*n-d*f*q+b*h*q+c*f*m-b*g*m;this.n44=c*h*l-d*g*l+d*f*k-b*h*k-c*f*p+b*g*p;this.multiplyScalar(1/a.determinant());
|
|
|
return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=g*h,l=g*e,k=d*h,p=d*e;this.n11=i+p*c;this.n12=k*c-l;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=l*c-k;this.n32=p+i*c;this.n33=f*g;break;case "ZXY":i=g*h;l=g*e;k=d*h;p=d*e;this.n11=i-p*c;this.n12=-f*e;this.n13=k+l*c;this.n21=l+k*c;this.n22=f*h;this.n23=p-i*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":i=
|
|
|
f*h;l=f*e;k=c*h;p=c*e;this.n11=g*h;this.n12=k*d-l;this.n13=i*d+p;this.n21=g*e;this.n22=p*d+i;this.n23=l*d-k;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":i=f*g;l=f*d;k=c*g;p=c*d;this.n11=g*h;this.n12=p-i*e;this.n13=k*e+l;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+k;this.n33=i-p*e;break;case "XZY":i=f*g;l=f*d;k=c*g;p=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=i*e+p;this.n22=f*h;this.n23=l*e-k;this.n31=k*e-l;this.n32=c*h;this.n33=p*e+i;break;default:i=f*h,l=f*
|
|
|
e,k=c*h,p=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=l+k*d,this.n22=i-p*d,this.n23=-c*g,this.n31=p-i*d,this.n32=k+l*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,i=b*g,b=b*h,l=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(l+d);this.n12=i-e;this.n13=b+g;this.n21=i+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
|
|
|
a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(this.n13,
|
|
|
this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
|
|
|
return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===
|
|
|
-a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,i=Math.cos(b),l=Math.sin(b),k=1-i,p=c*d*k,n=c*e*k,k=d*e*k,c=c*l,o=d*l,l=e*l,e=f+(1-f)*i,f=p+l,d=n-o,p=p-l,g=g+(1-g)*i,l=k+c,n=n+o,k=k-c,h=h+(1-h)*i,i=this.n11,c=this.n21,o=this.n31,q=this.n41,m=this.n12,r=this.n22,s=this.n32,t=this.n42,u=this.n13,x=this.n23,v=this.n33,A=this.n43;this.n11=e*i+f*m+d*u;this.n21=e*c+f*r+d*x;this.n31=e*o+f*s+d*v;this.n41=e*q+f*t+d*A;this.n12=p*i+g*m+l*u;this.n22=
|
|
|
-p*c+g*r+l*x;this.n32=p*o+g*s+l*v;this.n42=p*q+g*t+l*A;this.n13=n*i+k*m+h*u;this.n23=n*c+k*r+h*x;this.n33=n*o+k*s+h*v;this.n43=n*q+k*t+h*A;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,i=this.n43,l=Math.cos(a),a=Math.sin(a);this.n12=l*b+a*f;this.n22=l*c+a*g;this.n32=l*d+a*h;this.n42=l*e+a*i;this.n13=l*f-a*b;this.n23=l*g-a*c;this.n33=l*h-a*d;this.n43=l*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
|
|
|
+a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,i=Math.cos(b),l=Math.sin(b),k=1-i,p=c*d*k,o=c*e*k,k=d*e*k,c=c*l,n=d*l,l=e*l,e=f+(1-f)*i,f=p+l,d=o-n,p=p-l,g=g+(1-g)*i,l=k+c,o=o+n,k=k-c,h=h+(1-h)*i,i=this.n11,c=this.n21,n=this.n31,q=this.n41,m=this.n12,r=this.n22,s=this.n32,t=this.n42,u=this.n13,x=this.n23,w=this.n33,A=this.n43;this.n11=e*i+f*m+d*u;this.n21=e*c+f*r+d*x;this.n31=e*n+f*s+d*w;this.n41=e*q+f*t+d*A;this.n12=p*i+g*m+l*u;this.n22=
|
|
|
+p*c+g*r+l*x;this.n32=p*n+g*s+l*w;this.n42=p*q+g*t+l*A;this.n13=o*i+k*m+h*u;this.n23=o*c+k*r+h*x;this.n33=o*n+k*s+h*w;this.n43=o*q+k*t+h*A;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,i=this.n43,l=Math.cos(a),a=Math.sin(a);this.n12=l*b+a*f;this.n22=l*c+a*g;this.n32=l*d+a*h;this.n42=l*e+a*i;this.n13=l*f-a*b;this.n23=l*g-a*c;this.n33=l*h-a*d;this.n43=l*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
|
|
|
f=this.n13,g=this.n23,h=this.n33,i=this.n43,l=Math.cos(a),a=Math.sin(a);this.n11=l*b-a*f;this.n21=l*c-a*g;this.n31=l*d-a*h;this.n41=l*e-a*i;this.n13=l*f+a*b;this.n23=l*g+a*c;this.n33=l*h+a*d;this.n43=l*i+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,i=this.n42,l=Math.cos(a),a=Math.sin(a);this.n11=l*b+a*f;this.n21=l*c+a*g;this.n31=l*d+a*h;this.n41=l*e+a*i;this.n12=l*f-a*b;this.n22=l*g-a*c;this.n32=l*h-a*d;this.n42=l*i-a*e;return this},
|
|
|
translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
|
|
|
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*l;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*i;c[6]=a*l;c[7]=a*k;c[8]=a*p;return b};
|
|
@@ -63,16 +63,16 @@ this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;th
|
|
|
a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)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=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=l[i]=l[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,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
|
|
|
-var e,f,g=[],h,i,l=[],k,p,n=[],o,q=[],m,r,s=[],t,u,x=[],v={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,D=new THREE.Vector4,E=new THREE.Matrix4,C=new THREE.Matrix4,F=new THREE.Frustum,K=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);E.multiply(b.projectionMatrix,b.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);E.multiply(b.matrixWorld,
|
|
|
-b.projectionMatrixInverse);E.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){f=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||F.contains(b))?(E.multiplyVector3(A.copy(b.position)),e=a(),e.object=
|
|
|
-b,e.z=A.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(E.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,f){var g=e.near,j=e.far,H,A,y,I,O,T,aa,ga,fa,S,ba,$,ca,ia,La,ja;u=r=o=p=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);E.multiply(e.projectionMatrix,e.matrixWorldInverse);F.setFromMatrix(E);v=this.projectGraph(a,!1);for(a=0,H=v.objects.length;a<H;a++)if(fa=v.objects[a].object,S=fa.matrixWorld,$=fa.material,i=0,fa instanceof THREE.Mesh){ba=fa.geometry;ca=fa.geometry.materials;I=ba.vertices;ia=ba.faces;La=ba.faceVertexUvs;ba=fa.matrixRotationWorld.extractRotation(S);for(A=0,y=I.length;A<y;A++)h=b(),h.positionWorld.copy(I[A].position),S.multiplyVector3(h.positionWorld),
|
|
|
-h.positionScreen.copy(h.positionWorld),E.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<j;for(I=0,A=ia.length;I<A;I++){y=ia[I];if(y instanceof THREE.Face3)if(O=l[y.a],T=l[y.b],aa=l[y.c],O.visible&&T.visible&&aa.visible&&(fa.doubleSided||fa.flipSided!=0>(aa.positionScreen.x-O.positionScreen.x)*(T.positionScreen.y-O.positionScreen.y)-(aa.positionScreen.y-O.positionScreen.y)*(T.positionScreen.x-
|
|
|
-O.positionScreen.x)))ga=n[p]=n[p]||new THREE.RenderableFace3,p++,k=ga,k.v1.copy(O),k.v2.copy(T),k.v3.copy(aa);else continue;else if(y instanceof THREE.Face4)if(O=l[y.a],T=l[y.b],aa=l[y.c],ga=l[y.d],O.visible&&T.visible&&aa.visible&&ga.visible&&(fa.doubleSided||fa.flipSided!=(0>(ga.positionScreen.x-O.positionScreen.x)*(T.positionScreen.y-O.positionScreen.y)-(ga.positionScreen.y-O.positionScreen.y)*(T.positionScreen.x-O.positionScreen.x)||0>(T.positionScreen.x-aa.positionScreen.x)*(ga.positionScreen.y-
|
|
|
-aa.positionScreen.y)-(T.positionScreen.y-aa.positionScreen.y)*(ga.positionScreen.x-aa.positionScreen.x))))ja=q[o]=q[o]||new THREE.RenderableFace4,o++,k=ja,k.v1.copy(O),k.v2.copy(T),k.v3.copy(aa),k.v4.copy(ga);else continue;k.normalWorld.copy(y.normal);ba.multiplyVector3(k.normalWorld);k.centroidWorld.copy(y.centroid);S.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);E.multiplyVector3(k.centroidScreen);aa=y.vertexNormals;for(O=0,T=aa.length;O<T;O++)ga=k.vertexNormalsWorld[O],
|
|
|
-ga.copy(aa[O]),ba.multiplyVector3(ga);for(O=0,T=La.length;O<T;O++)if(ja=La[O][I])for(aa=0,ga=ja.length;aa<ga;aa++)k.uvs[O][aa]=ja[aa];k.material=$;k.faceMaterial=null!==y.materialIndex?ca[y.materialIndex]:null;k.z=k.centroidScreen.z;v.elements.push(k)}}else if(fa instanceof THREE.Line){C.multiply(E,S);I=fa.geometry.vertices;O=b();O.positionScreen.copy(I[0].position);C.multiplyVector4(O.positionScreen);for(A=1,y=I.length;A<y;A++)if(O=b(),O.positionScreen.copy(I[A].position),C.multiplyVector4(O.positionScreen),
|
|
|
-T=l[i-2],K.copy(O.positionScreen),L.copy(T.positionScreen),d(K,L))K.multiplyScalar(1/K.w),L.multiplyScalar(1/L.w),fa=s[r]=s[r]||new THREE.RenderableLine,r++,m=fa,m.v1.positionScreen.copy(K),m.v2.positionScreen.copy(L),m.z=Math.max(K.z,L.z),m.material=$,v.elements.push(m)}for(a=0,H=v.sprites.length;a<H;a++)if(fa=v.sprites[a].object,S=fa.matrixWorld,fa instanceof THREE.Particle&&(D.set(S.n14,S.n24,S.n34,1),E.multiplyVector4(D),D.z/=D.w,0<D.z&&1>D.z))g=x[u]=x[u]||new THREE.RenderableParticle,u++,t=g,
|
|
|
-t.x=D.x/D.w,t.y=D.y/D.w,t.z=D.z,t.rotation=fa.rotation.z,t.scale.x=fa.scale.x*Math.abs(t.x-(D.x+e.projectionMatrix.n11)/(D.w+e.projectionMatrix.n14)),t.scale.y=fa.scale.y*Math.abs(t.y-(D.y+e.projectionMatrix.n22)/(D.w+e.projectionMatrix.n24)),t.material=fa.material,v.elements.push(t);f&&v.elements.sort(c);return v}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,void 0!==d?d:1)};
|
|
|
+var e,f,g=[],h,i,l=[],k,p,o=[],n,q=[],m,r,s=[],t,u,x=[],w={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,D=new THREE.Vector4,B=new THREE.Matrix4,C=new THREE.Matrix4,G=new THREE.Frustum,K=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,
|
|
|
+b.projectionMatrixInverse);B.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){f=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||G.contains(b))?(B.multiplyVector3(A.copy(b.position)),e=a(),e.object=
|
|
|
+b,e.z=A.z,w.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(B.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,w.sprites.push(e)):b instanceof THREE.Light&&w.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,A=e.far,I,R,y,F,P,$,Z,ga,fa,S,aa,ba,ca,ha,Na,ja;u=r=n=p=0;w.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);B.multiply(e.projectionMatrix,e.matrixWorldInverse);G.setFromMatrix(B);w=this.projectGraph(a,!1);for(a=0,I=w.objects.length;a<I;a++)if(fa=w.objects[a].object,S=fa.matrixWorld,ba=fa.material,i=0,fa instanceof THREE.Mesh){aa=fa.geometry;ca=fa.geometry.materials;F=aa.vertices;ha=aa.faces;Na=aa.faceVertexUvs;aa=fa.matrixRotationWorld.extractRotation(S);for(R=0,y=F.length;R<y;R++)h=b(),h.positionWorld.copy(F[R].position),S.multiplyVector3(h.positionWorld),
|
|
|
+h.positionScreen.copy(h.positionWorld),B.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<A;for(F=0,R=ha.length;F<R;F++){y=ha[F];if(y instanceof THREE.Face3)if(P=l[y.a],$=l[y.b],Z=l[y.c],P.visible&&$.visible&&Z.visible&&(fa.doubleSided||fa.flipSided!=0>(Z.positionScreen.x-P.positionScreen.x)*($.positionScreen.y-P.positionScreen.y)-(Z.positionScreen.y-P.positionScreen.y)*($.positionScreen.x-
|
|
|
+P.positionScreen.x)))ga=o[p]=o[p]||new THREE.RenderableFace3,p++,k=ga,k.v1.copy(P),k.v2.copy($),k.v3.copy(Z);else continue;else if(y instanceof THREE.Face4)if(P=l[y.a],$=l[y.b],Z=l[y.c],ga=l[y.d],P.visible&&$.visible&&Z.visible&&ga.visible&&(fa.doubleSided||fa.flipSided!=(0>(ga.positionScreen.x-P.positionScreen.x)*($.positionScreen.y-P.positionScreen.y)-(ga.positionScreen.y-P.positionScreen.y)*($.positionScreen.x-P.positionScreen.x)||0>($.positionScreen.x-Z.positionScreen.x)*(ga.positionScreen.y-
|
|
|
+Z.positionScreen.y)-($.positionScreen.y-Z.positionScreen.y)*(ga.positionScreen.x-Z.positionScreen.x))))ja=q[n]=q[n]||new THREE.RenderableFace4,n++,k=ja,k.v1.copy(P),k.v2.copy($),k.v3.copy(Z),k.v4.copy(ga);else continue;k.normalWorld.copy(y.normal);aa.multiplyVector3(k.normalWorld);k.centroidWorld.copy(y.centroid);S.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);B.multiplyVector3(k.centroidScreen);Z=y.vertexNormals;for(P=0,$=Z.length;P<$;P++)ga=k.vertexNormalsWorld[P],ga.copy(Z[P]),
|
|
|
+aa.multiplyVector3(ga);for(P=0,$=Na.length;P<$;P++)if(ja=Na[P][F])for(Z=0,ga=ja.length;Z<ga;Z++)k.uvs[P][Z]=ja[Z];k.material=ba;k.faceMaterial=null!==y.materialIndex?ca[y.materialIndex]:null;k.z=k.centroidScreen.z;w.elements.push(k)}}else if(fa instanceof THREE.Line){C.multiply(B,S);F=fa.geometry.vertices;P=b();P.positionScreen.copy(F[0].position);C.multiplyVector4(P.positionScreen);for(R=1,y=F.length;R<y;R++)if(P=b(),P.positionScreen.copy(F[R].position),C.multiplyVector4(P.positionScreen),$=l[i-
|
|
|
+2],K.copy(P.positionScreen),L.copy($.positionScreen),d(K,L))K.multiplyScalar(1/K.w),L.multiplyScalar(1/L.w),fa=s[r]=s[r]||new THREE.RenderableLine,r++,m=fa,m.v1.positionScreen.copy(K),m.v2.positionScreen.copy(L),m.z=Math.max(K.z,L.z),m.material=ba,w.elements.push(m)}for(a=0,I=w.sprites.length;a<I;a++)if(fa=w.sprites[a].object,S=fa.matrixWorld,fa instanceof THREE.Particle&&(D.set(S.n14,S.n24,S.n34,1),B.multiplyVector4(D),D.z/=D.w,0<D.z&&1>D.z))g=x[u]=x[u]||new THREE.RenderableParticle,u++,t=g,t.x=
|
|
|
+D.x/D.w,t.y=D.y/D.w,t.z=D.z,t.rotation=fa.rotation.z,t.scale.x=fa.scale.x*Math.abs(t.x-(D.x+e.projectionMatrix.n11)/(D.w+e.projectionMatrix.n14)),t.scale.y=fa.scale.y*Math.abs(t.y-(D.y+e.projectionMatrix.n22)/(D.w+e.projectionMatrix.n24)),t.material=fa.material,w.elements.push(t);f&&w.elements.sort(c);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,void 0!==d?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),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-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=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-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);0===a?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=
|
|
@@ -88,13 +88,13 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
|
|
|
b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.sub(f.position,e.position),h.sub(d.position,e.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,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;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,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));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,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,f,B){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=g[e];p=g[f];n=g[B];o=i.x-h.x;q=l.x-h.x;m=i.y-h.y;r=l.y-h.y;s=i.z-h.z;t=l.z-h.z;u=p.u-k.u;x=n.u-k.u;v=p.v-k.v;A=n.v-k.v;D=1/(u*A-x*v);K.set((A*o-v*q)*D,(A*m-v*r)*D,(A*s-v*t)*D);L.set((u*q-x*o)*D,(u*r-x*m)*D,(u*t-x*s)*D);C[b].addSelf(K);C[c].addSelf(K);C[d].addSelf(K);F[b].addSelf(L);F[c].addSelf(L);F[d].addSelf(L)}var b,c,d,e,f,g,h,i,l,k,p,n,o,q,m,r,s,t,u,x,v,A,D,E,C=[],F=[],K=new THREE.Vector3,L=new THREE.Vector3,
|
|
|
-R=new THREE.Vector3,N=new THREE.Vector3,P=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,F[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var B=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)P.copy(f.vertexNormals[d]),e=f[B[d]],
|
|
|
-E=C[e],R.copy(E),R.subSelf(P.multiplyScalar(P.dot(E))).normalize(),N.cross(f.vertexNormals[d],E),e=N.dot(F[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox?(this.boundingBox.min.copy(a),this.boundingBox.max.copy(a)):this.boundingBox={min:a.clone(),max:a.clone()};for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=
|
|
|
+b,c,d,e,f,j){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=g[e];p=g[f];o=g[j];n=i.x-h.x;q=l.x-h.x;m=i.y-h.y;r=l.y-h.y;s=i.z-h.z;t=l.z-h.z;u=p.u-k.u;x=o.u-k.u;w=p.v-k.v;A=o.v-k.v;D=1/(u*A-x*w);K.set((A*n-w*q)*D,(A*m-w*r)*D,(A*s-w*t)*D);L.set((u*q-x*n)*D,(u*r-x*m)*D,(u*t-x*s)*D);C[b].addSelf(K);C[c].addSelf(K);C[d].addSelf(K);G[b].addSelf(L);G[c].addSelf(L);G[d].addSelf(L)}var b,c,d,e,f,g,h,i,l,k,p,o,n,q,m,r,s,t,u,x,w,A,D,B,C=[],G=[],K=new THREE.Vector3,L=new THREE.Vector3,
|
|
|
+T=new THREE.Vector3,M=new THREE.Vector3,E=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,G[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var j=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)E.copy(f.vertexNormals[d]),e=f[j[d]],
|
|
|
+B=C[e],T.copy(B),T.subSelf(E.multiplyScalar(E.dot(B))).normalize(),M.cross(f.vertexNormals[d],B),e=M.dot(G[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox?(this.boundingBox.min.copy(a),this.boundingBox.max.copy(a)):this.boundingBox={min:a.clone(),max:a.clone()};for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=
|
|
|
this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}},computeBoundingSphere:function(){for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere={radius:b}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*
|
|
|
e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],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;
|
|
|
-THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,l,k,p,n;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;l=this.points[c[0]];k=this.points[c[1]];
|
|
|
-p=this.points[c[2]];n=this.points[c[3]];h=g*g;i=g*h;d.x=b(l.x,k.x,p.x,n.x,g,h,i);d.y=b(l.y,k.y,p.y,n.y,g,h,i);d.z=b(l.z,k.z,p.z,n.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),
|
|
|
+THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,l,k,p,o;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;l=this.points[c[0]];k=this.points[c[1]];
|
|
|
+p=this.points[c[2]];o=this.points[c[3]];h=g*g;i=g*h;d.x=b(l.x,k.x,p.x,o.x,g,h,i);d.y=b(l.y,k.y,p.y,o.y,g,h,i);d.z=b(l.z,k.z,p.z,o.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),
|
|
|
f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,l=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];g=Math.ceil(a*c/l.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
|
|
|
h}};THREE.Edge=function(a,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
|
|
|
THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
|
|
@@ -153,47 +153,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
|
|
|
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
|
|
|
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&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=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
|
|
|
-THREE.DOMRenderer=function(){var a=null,b=new THREE.Projector,c,d,e,f;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var i,l,k,p,n,o,q,m;a=b.projectScene(c,d);for(i=0,l=a.length;i<l;i++)if(n=a[i],n instanceof THREE.RenderableParticle){q=n.x*e+e;m=n.y*f+f;for(k=0,p=n.material.length;k<p;k++)if(o=n.material[k],o instanceof THREE.ParticleDOMMaterial)o=o.domElement,o.style.left=q+"px",o.style.top=m+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(a){function b(a){if(t!=a)m.globalAlpha=t=a}function c(a){if(u!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}u=a}}function d(a){if(x!=a)m.strokeStyle=x=a}function e(a){if(v!=a)m.fillStyle=v=a}var a=a||{},f=this,g,h,i,l=new THREE.Projector,k=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
-p,n,o,q,m=k.getContext("2d"),r=new THREE.Color(0),s=0,t=1,u=0,x=null,v=null,A=null,D=null,E=null,C,F,K,L,R=new THREE.RenderableVertex,N=new THREE.RenderableVertex,P,B,j,H,V,y,I,O,T,aa,ga,fa,S=new THREE.Color,ba=new THREE.Color,$=new THREE.Color,ca=new THREE.Color,ia=new THREE.Color,La=[],ja=[],za,qa,Ga,Fa,ab,gb,Ra,Sa,bb,Wa,Aa=new THREE.Rectangle,Ma=new THREE.Rectangle,xa=new THREE.Rectangle,Sb=!1,Z=new THREE.Color,Q=new THREE.Color,jb=new THREE.Color,Ia=new THREE.Vector3,gc,hc,Lc,cb,ic,uc,a=16;gc=
|
|
|
-document.createElement("canvas");gc.width=gc.height=2;hc=gc.getContext("2d");hc.fillStyle="rgba(0,0,0,1)";hc.fillRect(0,0,2,2);Lc=hc.getImageData(0,0,2,2);cb=Lc.data;ic=document.createElement("canvas");ic.width=ic.height=a;uc=ic.getContext("2d");uc.translate(-a/2,-a/2);uc.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;n=b;o=Math.floor(p/2);q=Math.floor(n/2);k.width=p;k.height=n;Aa.set(-o,
|
|
|
--q,o,q);Ma.set(-o,-q,o,q);t=1;u=0;E=D=A=v=x=null};this.setClearColor=function(a,b){r.copy(a);s=b;Ma.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;Ma.set(-o,-q,o,q)};this.clear=function(){m.setTransform(1,0,0,-1,o,q);Ma.isEmpty()||(Ma.minSelf(Aa),Ma.inflate(2),1>s&&m.clearRect(Math.floor(Ma.getX()),Math.floor(Ma.getY()),Math.floor(Ma.getWidth()),Math.floor(Ma.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
|
|
|
-r.b)+","+s+")"),m.fillRect(Math.floor(Ma.getX()),Math.floor(Ma.getY()),Math.floor(Ma.getWidth()),Math.floor(Ma.getHeight()))),Ma.empty())};this.render=function(a,k){function n(a){var b,c,d,e;Z.setRGB(0,0,0);Q.setRGB(0,0,0);jb.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(Z.r+=e.r,Z.g+=e.g,Z.b+=e.b):d instanceof THREE.DirectionalLight?(Q.r+=e.r,Q.g+=e.g,Q.b+=e.b):d instanceof THREE.PointLight&&(jb.r+=e.r,jb.g+=e.g,jb.b+=e.b)}function p(a,b,c,d){var e,f,
|
|
|
-g,Z,h,j;for(e=0,f=a.length;e<f;e++)g=a[e],Z=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),j=c.dot(h),0>=j||(j*=g.intensity,d.r+=Z.r*j,d.g+=Z.g*j,d.b+=Z.b*j)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),j=c.dot(Ia.sub(h,b).normalize()),0>=j||(j*=0==g.distance?1:1-Math.min(b.distanceTo(h)/g.distance,1),0!=j&&(j*=g.intensity,d.r+=Z.r*j,d.g+=Z.g*j,d.b+=Z.b*j)))}function r(a,f,g){b(g.opacity);c(g.blending);var Z,h,j,i,k,l;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=
|
|
|
-g.map.image,k=i.width>>1,l=i.height>>1,g=f.scale.x*o,j=f.scale.y*q,Z=g*k,h=j*l,xa.set(a.x-Z,a.y-h,a.x+Z,a.y+h),Aa.intersects(xa)&&(m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(g,-j),m.translate(-k,-l),m.drawImage(i,0,0),m.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(Z=f.scale.x*o,h=f.scale.y*q,xa.set(a.x-Z,a.y-h,a.x+Z,a.y+h),Aa.intersects(xa)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(Z,h),g.program(m),
|
|
|
-m.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(A!=a)m.lineWidth=A=a;a=g.linecap;if(D!=a)m.lineCap=D=a;a=g.linejoin;if(E!=a)m.lineJoin=E=a;d(g.color.getContextStyle());m.stroke();xa.inflate(2*g.linewidth)}}function t(a,d,e,g,h,l,Q,m){f.info.render.vertices+=3;f.info.render.faces++;b(m.opacity);c(m.blending);
|
|
|
-P=a.positionScreen.x;B=a.positionScreen.y;j=d.positionScreen.x;H=d.positionScreen.y;V=e.positionScreen.x;y=e.positionScreen.y;x(P,B,j,H,V,y);if(m instanceof THREE.MeshBasicMaterial)if(m.map)m.map.mapping instanceof THREE.UVMapping&&(Fa=Q.uvs[0],Mc(P,B,j,H,V,y,Fa[g].u,Fa[g].v,Fa[h].u,Fa[h].v,Fa[l].u,Fa[l].v,m.map));else if(m.envMap){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,Ia.copy(Q.vertexNormalsWorld[g]),ab=0.5*(Ia.x*a.n11+Ia.y*a.n12+Ia.z*a.n13)+0.5,gb=
|
|
|
-0.5*-(Ia.x*a.n21+Ia.y*a.n22+Ia.z*a.n23)+0.5,Ia.copy(Q.vertexNormalsWorld[h]),Ra=0.5*(Ia.x*a.n11+Ia.y*a.n12+Ia.z*a.n13)+0.5,Sa=0.5*-(Ia.x*a.n21+Ia.y*a.n22+Ia.z*a.n23)+0.5,Ia.copy(Q.vertexNormalsWorld[l]),bb=0.5*(Ia.x*a.n11+Ia.y*a.n12+Ia.z*a.n13)+0.5,Wa=0.5*-(Ia.x*a.n21+Ia.y*a.n22+Ia.z*a.n23)+0.5,Mc(P,B,j,H,V,y,ab,gb,Ra,Sa,bb,Wa,m.envMap)}else m.wireframe?Eb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(m.color);else if(m instanceof THREE.MeshLambertMaterial)m.map&&!m.wireframe&&
|
|
|
-(m.map.mapping instanceof THREE.UVMapping&&(Fa=Q.uvs[0],Mc(P,B,j,H,V,y,Fa[g].u,Fa[g].v,Fa[h].u,Fa[h].v,Fa[l].u,Fa[l].v,m.map)),c(THREE.SubtractiveBlending)),Sb?!m.wireframe&&m.shading==THREE.SmoothShading&&3==Q.vertexNormalsWorld.length?(ba.r=$.r=ca.r=Z.r,ba.g=$.g=ca.g=Z.g,ba.b=$.b=ca.b=Z.b,p(i,Q.v1.positionWorld,Q.vertexNormalsWorld[0],ba),p(i,Q.v2.positionWorld,Q.vertexNormalsWorld[1],$),p(i,Q.v3.positionWorld,Q.vertexNormalsWorld[2],ca),ba.r=Math.max(0,Math.min(m.color.r*ba.r,1)),ba.g=Math.max(0,
|
|
|
-Math.min(m.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(m.color.b*ba.b,1)),$.r=Math.max(0,Math.min(m.color.r*$.r,1)),$.g=Math.max(0,Math.min(m.color.g*$.g,1)),$.b=Math.max(0,Math.min(m.color.b*$.b,1)),ca.r=Math.max(0,Math.min(m.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(m.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(m.color.b*ca.b,1)),ia.r=0.5*($.r+ca.r),ia.g=0.5*($.g+ca.g),ia.b=0.5*($.b+ca.b),Ga=vc(ba,$,ca,ia),Yb(P,B,j,H,V,y,0,0,1,0,0,1,Ga)):(S.r=Z.r,S.g=Z.g,S.b=Z.b,p(i,Q.centroidWorld,Q.normalWorld,S),
|
|
|
-S.r=Math.max(0,Math.min(m.color.r*S.r,1)),S.g=Math.max(0,Math.min(m.color.g*S.g,1)),S.b=Math.max(0,Math.min(m.color.b*S.b,1)),m.wireframe?Eb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(S)):m.wireframe?Eb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(m.color);else if(m instanceof THREE.MeshDepthMaterial)za=k.near,qa=k.far,ba.r=ba.g=ba.b=1-Tb(a.positionScreen.z,za,qa),$.r=$.g=$.b=1-Tb(d.positionScreen.z,za,qa),ca.r=ca.g=ca.b=1-Tb(e.positionScreen.z,za,
|
|
|
-qa),ia.r=0.5*($.r+ca.r),ia.g=0.5*($.g+ca.g),ia.b=0.5*($.b+ca.b),Ga=vc(ba,$,ca,ia),Yb(P,B,j,H,V,y,0,0,1,0,0,1,Ga);else if(m instanceof THREE.MeshNormalMaterial)S.r=Zb(Q.normalWorld.x),S.g=Zb(Q.normalWorld.y),S.b=Zb(Q.normalWorld.z),m.wireframe?Eb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(S)}function u(a,d,e,g,h,l,m,Q,n){f.info.render.vertices+=4;f.info.render.faces++;b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap)t(a,d,g,0,1,3,m,Q,n),t(h,e,l,1,2,3,m,Q,n);else if(P=a.positionScreen.x,
|
|
|
-B=a.positionScreen.y,j=d.positionScreen.x,H=d.positionScreen.y,V=e.positionScreen.x,y=e.positionScreen.y,I=g.positionScreen.x,O=g.positionScreen.y,T=h.positionScreen.x,aa=h.positionScreen.y,ga=l.positionScreen.x,fa=l.positionScreen.y,Q instanceof THREE.MeshBasicMaterial)v(P,B,j,H,V,y,I,O),Q.wireframe?Eb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):zb(Q.color);else if(Q instanceof THREE.MeshLambertMaterial)Sb?!Q.wireframe&&Q.shading==THREE.SmoothShading&&4==m.vertexNormalsWorld.length?
|
|
|
-(ba.r=$.r=ca.r=ia.r=Z.r,ba.g=$.g=ca.g=ia.g=Z.g,ba.b=$.b=ca.b=ia.b=Z.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],ba),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],$),p(i,m.v4.positionWorld,m.vertexNormalsWorld[3],ca),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ia),ba.r=Math.max(0,Math.min(Q.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(Q.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(Q.color.b*ba.b,1)),$.r=Math.max(0,Math.min(Q.color.r*$.r,1)),$.g=Math.max(0,Math.min(Q.color.g*$.g,1)),$.b=Math.max(0,
|
|
|
-Math.min(Q.color.b*$.b,1)),ca.r=Math.max(0,Math.min(Q.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(Q.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(Q.color.b*ca.b,1)),ia.r=Math.max(0,Math.min(Q.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(Q.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(Q.color.b*ia.b,1)),Ga=vc(ba,$,ca,ia),x(P,B,j,H,I,O),Yb(P,B,j,H,I,O,0,0,1,0,0,1,Ga),x(T,aa,V,y,ga,fa),Yb(T,aa,V,y,ga,fa,1,0,1,1,0,1,Ga)):(S.r=Z.r,S.g=Z.g,S.b=Z.b,p(i,m.centroidWorld,m.normalWorld,S),S.r=Math.max(0,Math.min(Q.color.r*
|
|
|
-S.r,1)),S.g=Math.max(0,Math.min(Q.color.g*S.g,1)),S.b=Math.max(0,Math.min(Q.color.b*S.b,1)),v(P,B,j,H,V,y,I,O),Q.wireframe?Eb(S,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):zb(S)):(v(P,B,j,H,V,y,I,O),Q.wireframe?Eb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):zb(Q.color));else if(Q instanceof THREE.MeshNormalMaterial)S.r=Zb(m.normalWorld.x),S.g=Zb(m.normalWorld.y),S.b=Zb(m.normalWorld.z),v(P,B,j,H,V,y,I,O),Q.wireframe?Eb(S,Q.wireframeLinewidth,Q.wireframeLinecap,
|
|
|
-Q.wireframeLinejoin):zb(S);else if(Q instanceof THREE.MeshDepthMaterial)za=k.near,qa=k.far,ba.r=ba.g=ba.b=1-Tb(a.positionScreen.z,za,qa),$.r=$.g=$.b=1-Tb(d.positionScreen.z,za,qa),ca.r=ca.g=ca.b=1-Tb(g.positionScreen.z,za,qa),ia.r=ia.g=ia.b=1-Tb(e.positionScreen.z,za,qa),Ga=vc(ba,$,ca,ia),x(P,B,j,H,I,O),Yb(P,B,j,H,I,O,0,0,1,0,0,1,Ga),x(T,aa,V,y,ga,fa),Yb(T,aa,V,y,ga,fa,1,0,1,1,0,1,Ga)}function x(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function v(a,
|
|
|
-b,c,d,e,f,g,Z){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,Z);m.lineTo(a,b);m.closePath()}function Eb(a,b,c,e){if(A!=b)m.lineWidth=A=b;if(D!=c)m.lineCap=D=c;if(E!=e)m.lineJoin=E=e;d(a.getContextStyle());m.stroke();xa.inflate(2*b)}function zb(a){e(a.getContextStyle());m.fill()}function Mc(a,b,c,d,f,g,Z,h,j,i,Q,l,k){if(0!=k.image.width){if(!0==k.needsUpdate||void 0==La[k.id]){var n=k.wrapS==THREE.RepeatWrapping,p=k.wrapT==THREE.RepeatWrapping;La[k.id]=m.createPattern(k.image,
|
|
|
-n&&p?"repeat":n&&!p?"repeat-x":!n&&p?"repeat-y":"no-repeat");k.needsUpdate=!1}e(La[k.id]);var n=k.offset.x/k.repeat.x,p=k.offset.y/k.repeat.y,jb=k.image.width*k.repeat.x,o=k.image.height*k.repeat.y,Z=(Z+n)*jb,h=(h+p)*o,c=c-a,d=d-b,f=f-a,g=g-b,j=(j+n)*jb-Z,i=(i+p)*o-h,Q=(Q+n)*jb-Z,l=(l+p)*o-h,n=j*l-Q*i;if(0==n){if(void 0===ja[k.id])b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),ja[k.id]=b.getImageData(0,0,k.image.width,
|
|
|
-k.image.height).data;b=ja[k.id];Z=4*(Math.floor(Z)+Math.floor(h)*k.image.width);S.setRGB(b[Z]/255,b[Z+1]/255,b[Z+2]/255);zb(S)}else n=1/n,k=(l*c-i*f)*n,i=(l*d-i*g)*n,c=(j*f-Q*c)*n,d=(j*g-Q*d)*n,a=a-k*Z-c*h,Z=b-i*Z-d*h,m.save(),m.transform(k,i,c,d,a,Z),m.fill(),m.restore()}}function Yb(a,b,c,d,e,f,g,Z,h,j,i,k,Q){var l,n;l=Q.width-1;n=Q.height-1;g*=l;Z*=n;c-=a;d-=b;e-=a;f-=b;h=h*l-g;j=j*n-Z;i=i*l-g;k=k*n-Z;n=1/(h*k-i*j);l=(k*c-j*e)*n;j=(k*d-j*f)*n;c=(h*e-i*c)*n;d=(h*f-i*d)*n;a=a-l*g-c*Z;b=b-j*g-d*Z;
|
|
|
-m.save();m.transform(l,j,c,d,a,b);m.clip();m.drawImage(Q,0,0);m.restore()}function vc(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),Z=~~(255*b.g),b=~~(255*b.b),h=~~(255*c.r),j=~~(255*c.g),c=~~(255*c.b),i=~~(255*d.r),k=~~(255*d.g),d=~~(255*d.b);cb[0]=0>e?0:255<e?255:e;cb[1]=0>f?0:255<f?255:f;cb[2]=0>a?0:255<a?255:a;cb[4]=0>g?0:255<g?255:g;cb[5]=0>Z?0:255<Z?255:Z;cb[6]=0>b?0:255<b?255:b;cb[8]=0>h?0:255<h?255:h;cb[9]=0>j?0:255<j?255:j;cb[10]=0>c?0:255<c?255:c;cb[12]=0>i?0:255<
|
|
|
-i?255:i;cb[13]=0>k?0:255<k?255:k;cb[14]=0>d?0:255<d?255:d;hc.putImageData(Lc,0,0);uc.drawImage(gc,0,0);return ic}function Tb(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Zb(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Fb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xc,Xc,Na,hb;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,q);f.info.render.vertices=0;f.info.render.faces=0;g=l.projectScene(a,k,this.sortElements);h=g.elements;i=
|
|
|
-g.lights;(Sb=0<i.length)&&n(i);for(xc=0,Xc=h.length;xc<Xc;xc++)if(Na=h[xc],hb=Na.material,hb=hb instanceof THREE.MeshFaceMaterial?Na.faceMaterial:hb,!(null==hb||0==hb.opacity)){xa.empty();if(Na instanceof THREE.RenderableParticle)C=Na,C.x*=o,C.y*=q,r(C,Na,hb,a);else if(Na instanceof THREE.RenderableLine)C=Na.v1,F=Na.v2,C.positionScreen.x*=o,C.positionScreen.y*=q,F.positionScreen.x*=o,F.positionScreen.y*=q,xa.addPoint(C.positionScreen.x,C.positionScreen.y),xa.addPoint(F.positionScreen.x,F.positionScreen.y),
|
|
|
-Aa.intersects(xa)&&s(C,F,Na,hb,a);else if(Na instanceof THREE.RenderableFace3)C=Na.v1,F=Na.v2,K=Na.v3,C.positionScreen.x*=o,C.positionScreen.y*=q,F.positionScreen.x*=o,F.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,hb.overdraw&&(Fb(C.positionScreen,F.positionScreen),Fb(F.positionScreen,K.positionScreen),Fb(K.positionScreen,C.positionScreen)),xa.add3Points(C.positionScreen.x,C.positionScreen.y,F.positionScreen.x,F.positionScreen.y,K.positionScreen.x,K.positionScreen.y),Aa.intersects(xa)&&
|
|
|
-t(C,F,K,0,1,2,Na,hb,a);else if(Na instanceof THREE.RenderableFace4)C=Na.v1,F=Na.v2,K=Na.v3,L=Na.v4,C.positionScreen.x*=o,C.positionScreen.y*=q,F.positionScreen.x*=o,F.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,L.positionScreen.x*=o,L.positionScreen.y*=q,R.positionScreen.copy(F.positionScreen),N.positionScreen.copy(L.positionScreen),hb.overdraw&&(Fb(C.positionScreen,F.positionScreen),Fb(F.positionScreen,L.positionScreen),Fb(L.positionScreen,C.positionScreen),Fb(K.positionScreen,
|
|
|
-R.positionScreen),Fb(K.positionScreen,N.positionScreen)),xa.addPoint(C.positionScreen.x,C.positionScreen.y),xa.addPoint(F.positionScreen.x,F.positionScreen.y),xa.addPoint(K.positionScreen.x,K.positionScreen.y),xa.addPoint(L.positionScreen.x,L.positionScreen.y),Aa.intersects(xa)&&u(C,F,K,L,R,N,Na,hb,a);Ma.addRectangle(xa)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,k;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),k=c.dot(i),0>=k||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),k=c.dot(C.sub(i,b).normalize()),0>=k||(k*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=k&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function b(a){null==F[a]&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"path"),0==P&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,n,o,q,m,r,s=new THREE.Rectangle,t=new THREE.Rectangle,u=!1,x=new THREE.Color,v=new THREE.Color,A=new THREE.Color,D=new THREE.Color,E,C=new THREE.Vector3,F=[],K=[],L,R,N,P=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":P=1;break;case "low":P=0}};this.setSize=function(a,b){l=a;k=b;p=l/2;n=k/2;i.setAttribute("viewBox",-p+" "+-n+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);s.set(-p,-n,p,n)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(k,j){var l,C,y,I;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,j,this.sortElements);f=e.elements;
|
|
|
-g=e.lights;N=R=0;if(u=0<g.length){v.setRGB(0,0,0);A.setRGB(0,0,0);D.setRGB(0,0,0);for(l=0,C=g.length;l<C;l++)I=g[l],y=I.color,I instanceof THREE.AmbientLight?(v.r+=y.r,v.g+=y.g,v.b+=y.b):I instanceof THREE.DirectionalLight?(A.r+=y.r,A.g+=y.g,A.b+=y.b):I instanceof THREE.PointLight&&(D.r+=y.r,D.g+=y.g,D.b+=y.b)}for(l=0,C=f.length;l<C;l++)if(y=f[l],I=y.material,I=I instanceof THREE.MeshFaceMaterial?y.faceMaterial:I,!(null==I||0==I.opacity))if(t.empty(),y instanceof THREE.RenderableParticle)o=y,o.x*=
|
|
|
-p,o.y*=-n;else if(y instanceof THREE.RenderableLine){if(o=y.v1,q=y.v2,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t)){y=o;var O=q,T=N++;null==K[T]&&(K[T]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==P&&K[T].setAttribute("shape-rendering","crispEdges"));L=K[T];L.setAttribute("x1",y.positionScreen.x);L.setAttribute("y1",y.positionScreen.y);
|
|
|
-L.setAttribute("x2",O.positionScreen.x);L.setAttribute("y2",O.positionScreen.y);I instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+I.color.getContextStyle()+"; stroke-width: "+I.linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.linecap+"; stroke-linejoin: "+I.linejoin),i.appendChild(L))}}else if(y instanceof THREE.RenderableFace3){if(o=y.v1,q=y.v2,m=y.v3,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=
|
|
|
-p,m.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),s.intersects(t)){var O=o,T=q,aa=m;d.info.render.vertices+=3;d.info.render.faces++;L=b(R++);L.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+"z");I instanceof THREE.MeshBasicMaterial?x.copy(I.color):I instanceof THREE.MeshLambertMaterial?
|
|
|
-u?(x.r=v.r,x.g=v.g,x.b=v.b,a(g,y.centroidWorld,y.normalWorld,x),x.r=Math.max(0,Math.min(I.color.r*x.r,1)),x.g=Math.max(0,Math.min(I.color.g*x.g,1)),x.b=Math.max(0,Math.min(I.color.b*x.b,1))):x.copy(I.color):I instanceof THREE.MeshDepthMaterial?(E=1-I.__2near/(I.__farPlusNear-y.z*I.__farMinusNear),x.setRGB(E,E,E)):I instanceof THREE.MeshNormalMaterial&&x.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));I.wireframe?L.setAttribute("style","fill: none; stroke: "+x.getContextStyle()+"; stroke-width: "+
|
|
|
-I.wireframeLinewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframeLinecap+"; stroke-linejoin: "+I.wireframeLinejoin):L.setAttribute("style","fill: "+x.getContextStyle()+"; fill-opacity: "+I.opacity);i.appendChild(L)}}else if(y instanceof THREE.RenderableFace4&&(o=y.v1,q=y.v2,m=y.v3,r=y.v4,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=p,m.positionScreen.y*=-n,r.positionScreen.x*=p,r.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,
|
|
|
-o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(t))){var O=o,T=q,aa=m,F=r;d.info.render.vertices+=4;d.info.render.faces++;L=b(R++);L.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");I instanceof THREE.MeshBasicMaterial?
|
|
|
-x.copy(I.color):I instanceof THREE.MeshLambertMaterial?u?(x.r=v.r,x.g=v.g,x.b=v.b,a(g,y.centroidWorld,y.normalWorld,x),x.r=Math.max(0,Math.min(I.color.r*x.r,1)),x.g=Math.max(0,Math.min(I.color.g*x.g,1)),x.b=Math.max(0,Math.min(I.color.b*x.b,1))):x.copy(I.color):I instanceof THREE.MeshDepthMaterial?(E=1-I.__2near/(I.__farPlusNear-y.z*I.__farMinusNear),x.setRGB(E,E,E)):I instanceof THREE.MeshNormalMaterial&&x.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));I.wireframe?L.setAttribute("style",
|
|
|
-"fill: none; stroke: "+x.getContextStyle()+"; stroke-width: "+I.wireframeLinewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframeLinecap+"; stroke-linejoin: "+I.wireframeLinejoin):L.setAttribute("style","fill: "+x.getContextStyle()+"; fill-opacity: "+I.opacity);i.appendChild(L)}}};
|
|
|
+THREE.DOMRenderer=function(){var a=null,b=new THREE.Projector,c,d,e,f;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var i,l,k,p,o,n,q,m;a=b.projectScene(c,d);for(i=0,l=a.length;i<l;i++)if(o=a[i],o instanceof THREE.RenderableParticle){q=o.x*e+e;m=o.y*f+f;for(k=0,p=o.material.length;k<p;k++)if(n=o.material[k],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=q+"px",n.style.top=m+"px"}}};
|
|
|
+THREE.CanvasRenderer=function(a){function b(a){if(t!=a)m.globalAlpha=t=a}function c(a){if(u!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}u=a}}function d(a){if(x!=a)m.strokeStyle=x=a}function e(a){if(w!=a)m.fillStyle=w=a}var a=a||{},f=this,g,h,i,l=new THREE.Projector,k=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
+p,o,n,q,m=k.getContext("2d"),r=new THREE.Color(0),s=0,t=1,u=0,x=null,w=null,A=null,D=null,B=null,C,G,K,L,T=new THREE.RenderableVertex,M=new THREE.RenderableVertex,E,j,Q,I,R,y,F,P,$,Z,ga,fa,S=new THREE.Color,aa=new THREE.Color,ba=new THREE.Color,ca=new THREE.Color,ha=new THREE.Color,Na=[],ja=[],za,qa,Ga,Ea,Sa,Ta,Wa,fb,Za,lb,Oa=new THREE.Rectangle,Ka=new THREE.Rectangle,xa=new THREE.Rectangle,Sb=!1,Y=new THREE.Color,O=new THREE.Color,ib=new THREE.Color,Ha=new THREE.Vector3,hc,ic,Mc,bb,jc,vc,a=16;hc=
|
|
|
+document.createElement("canvas");hc.width=hc.height=2;ic=hc.getContext("2d");ic.fillStyle="rgba(0,0,0,1)";ic.fillRect(0,0,2,2);Mc=ic.getImageData(0,0,2,2);bb=Mc.data;jc=document.createElement("canvas");jc.width=jc.height=a;vc=jc.getContext("2d");vc.translate(-a/2,-a/2);vc.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;o=b;n=Math.floor(p/2);q=Math.floor(o/2);k.width=p;k.height=o;Oa.set(-n,
|
|
|
+-q,n,q);Ka.set(-n,-q,n,q);t=1;u=0;B=D=A=w=x=null};this.setClearColor=function(a,b){r.copy(a);s=b;Ka.set(-n,-q,n,q)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;Ka.set(-n,-q,n,q)};this.clear=function(){m.setTransform(1,0,0,-1,n,q);Ka.isEmpty()||(Ka.minSelf(Oa),Ka.inflate(2),1>s&&m.clearRect(Math.floor(Ka.getX()),Math.floor(Ka.getY()),Math.floor(Ka.getWidth()),Math.floor(Ka.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
|
|
|
+r.b)+","+s+")"),m.fillRect(Math.floor(Ka.getX()),Math.floor(Ka.getY()),Math.floor(Ka.getWidth()),Math.floor(Ka.getHeight()))),Ka.empty())};this.render=function(a,k){function o(a){var b,c,d,e;Y.setRGB(0,0,0);O.setRGB(0,0,0);ib.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(Y.r+=e.r,Y.g+=e.g,Y.b+=e.b):d instanceof THREE.DirectionalLight?(O.r+=e.r,O.g+=e.g,O.b+=e.b):d instanceof THREE.PointLight&&(ib.r+=e.r,ib.g+=e.g,ib.b+=e.b)}function p(a,b,c,d){var e,f,
|
|
|
+g,j,h,Y;for(e=0,f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),Y=c.dot(h),0>=Y||(Y*=g.intensity,d.r+=j.r*Y,d.g+=j.g*Y,d.b+=j.b*Y)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),Y=c.dot(Ha.sub(h,b).normalize()),0>=Y||(Y*=0==g.distance?1:1-Math.min(b.distanceTo(h)/g.distance,1),0!=Y&&(Y*=g.intensity,d.r+=j.r*Y,d.g+=j.g*Y,d.b+=j.b*Y)))}function r(a,f,g){b(g.opacity);c(g.blending);var j,h,Y,i,k,l;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=
|
|
|
+g.map.image,k=i.width>>1,l=i.height>>1,g=f.scale.x*n,Y=f.scale.y*q,j=g*k,h=Y*l,xa.set(a.x-j,a.y-h,a.x+j,a.y+h),Oa.intersects(xa)&&(m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(g,-Y),m.translate(-k,-l),m.drawImage(i,0,0),m.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(j=f.scale.x*n,h=f.scale.y*q,xa.set(a.x-j,a.y-h,a.x+j,a.y+h),Oa.intersects(xa)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(j,h),g.program(m),
|
|
|
+m.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(A!=a)m.lineWidth=A=a;a=g.linecap;if(D!=a)m.lineCap=D=a;a=g.linejoin;if(B!=a)m.lineJoin=B=a;d(g.color.getContextStyle());m.stroke();xa.inflate(2*g.linewidth)}}function t(a,d,e,g,h,l,O,m){f.info.render.vertices+=3;f.info.render.faces++;b(m.opacity);c(m.blending);
|
|
|
+E=a.positionScreen.x;j=a.positionScreen.y;Q=d.positionScreen.x;I=d.positionScreen.y;R=e.positionScreen.x;y=e.positionScreen.y;x(E,j,Q,I,R,y);if(m instanceof THREE.MeshBasicMaterial)if(m.map)m.map.mapping instanceof THREE.UVMapping&&(Ea=O.uvs[0],Nc(E,j,Q,I,R,y,Ea[g].u,Ea[g].v,Ea[h].u,Ea[h].v,Ea[l].u,Ea[l].v,m.map));else if(m.envMap){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,Ha.copy(O.vertexNormalsWorld[g]),Sa=0.5*(Ha.x*a.n11+Ha.y*a.n12+Ha.z*a.n13)+0.5,Ta=
|
|
|
+0.5*-(Ha.x*a.n21+Ha.y*a.n22+Ha.z*a.n23)+0.5,Ha.copy(O.vertexNormalsWorld[h]),Wa=0.5*(Ha.x*a.n11+Ha.y*a.n12+Ha.z*a.n13)+0.5,fb=0.5*-(Ha.x*a.n21+Ha.y*a.n22+Ha.z*a.n23)+0.5,Ha.copy(O.vertexNormalsWorld[l]),Za=0.5*(Ha.x*a.n11+Ha.y*a.n12+Ha.z*a.n13)+0.5,lb=0.5*-(Ha.x*a.n21+Ha.y*a.n22+Ha.z*a.n23)+0.5,Nc(E,j,Q,I,R,y,Sa,Ta,Wa,fb,Za,lb,m.envMap)}else m.wireframe?Eb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(m.color);else if(m instanceof THREE.MeshLambertMaterial)m.map&&!m.wireframe&&
|
|
|
+(m.map.mapping instanceof THREE.UVMapping&&(Ea=O.uvs[0],Nc(E,j,Q,I,R,y,Ea[g].u,Ea[g].v,Ea[h].u,Ea[h].v,Ea[l].u,Ea[l].v,m.map)),c(THREE.SubtractiveBlending)),Sb?!m.wireframe&&m.shading==THREE.SmoothShading&&3==O.vertexNormalsWorld.length?(aa.r=ba.r=ca.r=Y.r,aa.g=ba.g=ca.g=Y.g,aa.b=ba.b=ca.b=Y.b,p(i,O.v1.positionWorld,O.vertexNormalsWorld[0],aa),p(i,O.v2.positionWorld,O.vertexNormalsWorld[1],ba),p(i,O.v3.positionWorld,O.vertexNormalsWorld[2],ca),aa.r=Math.max(0,Math.min(m.color.r*aa.r,1)),aa.g=Math.max(0,
|
|
|
+Math.min(m.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(m.color.b*aa.b,1)),ba.r=Math.max(0,Math.min(m.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(m.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(m.color.b*ba.b,1)),ca.r=Math.max(0,Math.min(m.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(m.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(m.color.b*ca.b,1)),ha.r=0.5*(ba.r+ca.r),ha.g=0.5*(ba.g+ca.g),ha.b=0.5*(ba.b+ca.b),Ga=wc(aa,ba,ca,ha),Yb(E,j,Q,I,R,y,0,0,1,0,0,1,Ga)):(S.r=Y.r,S.g=Y.g,S.b=Y.b,p(i,O.centroidWorld,O.normalWorld,
|
|
|
+S),S.r=Math.max(0,Math.min(m.color.r*S.r,1)),S.g=Math.max(0,Math.min(m.color.g*S.g,1)),S.b=Math.max(0,Math.min(m.color.b*S.b,1)),m.wireframe?Eb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(S)):m.wireframe?Eb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(m.color);else if(m instanceof THREE.MeshDepthMaterial)za=k.near,qa=k.far,aa.r=aa.g=aa.b=1-Tb(a.positionScreen.z,za,qa),ba.r=ba.g=ba.b=1-Tb(d.positionScreen.z,za,qa),ca.r=ca.g=ca.b=1-Tb(e.positionScreen.z,
|
|
|
+za,qa),ha.r=0.5*(ba.r+ca.r),ha.g=0.5*(ba.g+ca.g),ha.b=0.5*(ba.b+ca.b),Ga=wc(aa,ba,ca,ha),Yb(E,j,Q,I,R,y,0,0,1,0,0,1,Ga);else if(m instanceof THREE.MeshNormalMaterial)S.r=Zb(O.normalWorld.x),S.g=Zb(O.normalWorld.y),S.b=Zb(O.normalWorld.z),m.wireframe?Eb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(S)}function u(a,d,e,g,h,l,m,O,o){f.info.render.vertices+=4;f.info.render.faces++;b(O.opacity);c(O.blending);if(O.map||O.envMap)t(a,d,g,0,1,3,m,O,o),t(h,e,l,1,2,3,m,O,o);else if(E=a.positionScreen.x,
|
|
|
+j=a.positionScreen.y,Q=d.positionScreen.x,I=d.positionScreen.y,R=e.positionScreen.x,y=e.positionScreen.y,F=g.positionScreen.x,P=g.positionScreen.y,$=h.positionScreen.x,Z=h.positionScreen.y,ga=l.positionScreen.x,fa=l.positionScreen.y,O instanceof THREE.MeshBasicMaterial)w(E,j,Q,I,R,y,F,P),O.wireframe?Eb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):zb(O.color);else if(O instanceof THREE.MeshLambertMaterial)Sb?!O.wireframe&&O.shading==THREE.SmoothShading&&4==m.vertexNormalsWorld.length?
|
|
|
+(aa.r=ba.r=ca.r=ha.r=Y.r,aa.g=ba.g=ca.g=ha.g=Y.g,aa.b=ba.b=ca.b=ha.b=Y.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],aa),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],ba),p(i,m.v4.positionWorld,m.vertexNormalsWorld[3],ca),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ha),aa.r=Math.max(0,Math.min(O.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(O.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(O.color.b*aa.b,1)),ba.r=Math.max(0,Math.min(O.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(O.color.g*ba.g,1)),ba.b=
|
|
|
+Math.max(0,Math.min(O.color.b*ba.b,1)),ca.r=Math.max(0,Math.min(O.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(O.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(O.color.b*ca.b,1)),ha.r=Math.max(0,Math.min(O.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(O.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(O.color.b*ha.b,1)),Ga=wc(aa,ba,ca,ha),x(E,j,Q,I,F,P),Yb(E,j,Q,I,F,P,0,0,1,0,0,1,Ga),x($,Z,R,y,ga,fa),Yb($,Z,R,y,ga,fa,1,0,1,1,0,1,Ga)):(S.r=Y.r,S.g=Y.g,S.b=Y.b,p(i,m.centroidWorld,m.normalWorld,S),S.r=Math.max(0,Math.min(O.color.r*
|
|
|
+S.r,1)),S.g=Math.max(0,Math.min(O.color.g*S.g,1)),S.b=Math.max(0,Math.min(O.color.b*S.b,1)),w(E,j,Q,I,R,y,F,P),O.wireframe?Eb(S,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):zb(S)):(w(E,j,Q,I,R,y,F,P),O.wireframe?Eb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):zb(O.color));else if(O instanceof THREE.MeshNormalMaterial)S.r=Zb(m.normalWorld.x),S.g=Zb(m.normalWorld.y),S.b=Zb(m.normalWorld.z),w(E,j,Q,I,R,y,F,P),O.wireframe?Eb(S,O.wireframeLinewidth,O.wireframeLinecap,
|
|
|
+O.wireframeLinejoin):zb(S);else if(O instanceof THREE.MeshDepthMaterial)za=k.near,qa=k.far,aa.r=aa.g=aa.b=1-Tb(a.positionScreen.z,za,qa),ba.r=ba.g=ba.b=1-Tb(d.positionScreen.z,za,qa),ca.r=ca.g=ca.b=1-Tb(g.positionScreen.z,za,qa),ha.r=ha.g=ha.b=1-Tb(e.positionScreen.z,za,qa),Ga=wc(aa,ba,ca,ha),x(E,j,Q,I,F,P),Yb(E,j,Q,I,F,P,0,0,1,0,0,1,Ga),x($,Z,R,y,ga,fa),Yb($,Z,R,y,ga,fa,1,0,1,1,0,1,Ga)}function x(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function w(a,
|
|
|
+b,c,d,e,f,g,j){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,j);m.lineTo(a,b);m.closePath()}function Eb(a,b,c,e){if(A!=b)m.lineWidth=A=b;if(D!=c)m.lineCap=D=c;if(B!=e)m.lineJoin=B=e;d(a.getContextStyle());m.stroke();xa.inflate(2*b)}function zb(a){e(a.getContextStyle());m.fill()}function Nc(a,b,c,d,f,g,j,h,Y,i,l,O,k){if(0!=k.image.width){if(!0==k.needsUpdate||void 0==Na[k.id]){var o=k.wrapS==THREE.RepeatWrapping,p=k.wrapT==THREE.RepeatWrapping;Na[k.id]=m.createPattern(k.image,
|
|
|
+o&&p?"repeat":o&&!p?"repeat-x":!o&&p?"repeat-y":"no-repeat");k.needsUpdate=!1}e(Na[k.id]);var o=k.offset.x/k.repeat.x,p=k.offset.y/k.repeat.y,n=k.image.width*k.repeat.x,ib=k.image.height*k.repeat.y,j=(j+o)*n,h=(h+p)*ib,c=c-a,d=d-b,f=f-a,g=g-b,Y=(Y+o)*n-j,i=(i+p)*ib-h,l=(l+o)*n-j,O=(O+p)*ib-h,o=Y*O-l*i;if(0==o){if(void 0===ja[k.id])b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),ja[k.id]=b.getImageData(0,0,k.image.width,
|
|
|
+k.image.height).data;b=ja[k.id];j=4*(Math.floor(j)+Math.floor(h)*k.image.width);S.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255);zb(S)}else o=1/o,k=(O*c-i*f)*o,i=(O*d-i*g)*o,c=(Y*f-l*c)*o,d=(Y*g-l*d)*o,a=a-k*j-c*h,j=b-i*j-d*h,m.save(),m.transform(k,i,c,d,a,j),m.fill(),m.restore()}}function Yb(a,b,c,d,e,f,g,j,h,Y,i,k,l){var O,o;O=l.width-1;o=l.height-1;g*=O;j*=o;c-=a;d-=b;e-=a;f-=b;h=h*O-g;Y=Y*o-j;i=i*O-g;k=k*o-j;o=1/(h*k-i*Y);O=(k*c-Y*e)*o;Y=(k*d-Y*f)*o;c=(h*e-i*c)*o;d=(h*f-i*d)*o;a=a-O*g-c*j;b=b-Y*g-d*j;
|
|
|
+m.save();m.transform(O,Y,c,d,a,b);m.clip();m.drawImage(l,0,0);m.restore()}function wc(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),j=~~(255*b.g),b=~~(255*b.b),h=~~(255*c.r),Y=~~(255*c.g),c=~~(255*c.b),i=~~(255*d.r),k=~~(255*d.g),d=~~(255*d.b);bb[0]=0>e?0:255<e?255:e;bb[1]=0>f?0:255<f?255:f;bb[2]=0>a?0:255<a?255:a;bb[4]=0>g?0:255<g?255:g;bb[5]=0>j?0:255<j?255:j;bb[6]=0>b?0:255<b?255:b;bb[8]=0>h?0:255<h?255:h;bb[9]=0>Y?0:255<Y?255:Y;bb[10]=0>c?0:255<c?255:c;bb[12]=0>i?0:255<
|
|
|
+i?255:i;bb[13]=0>k?0:255<k?255:k;bb[14]=0>d?0:255<d?255:d;ic.putImageData(Mc,0,0);vc.drawImage(hc,0,0);return jc}function Tb(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Zb(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Fb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var yc,Yc,La,gb;this.autoClear?this.clear():m.setTransform(1,0,0,-1,n,q);f.info.render.vertices=0;f.info.render.faces=0;g=l.projectScene(a,k,this.sortElements);h=g.elements;i=
|
|
|
+g.lights;(Sb=0<i.length)&&o(i);for(yc=0,Yc=h.length;yc<Yc;yc++)if(La=h[yc],gb=La.material,gb=gb instanceof THREE.MeshFaceMaterial?La.faceMaterial:gb,!(null==gb||0==gb.opacity)){xa.empty();if(La instanceof THREE.RenderableParticle)C=La,C.x*=n,C.y*=q,r(C,La,gb,a);else if(La instanceof THREE.RenderableLine)C=La.v1,G=La.v2,C.positionScreen.x*=n,C.positionScreen.y*=q,G.positionScreen.x*=n,G.positionScreen.y*=q,xa.addPoint(C.positionScreen.x,C.positionScreen.y),xa.addPoint(G.positionScreen.x,G.positionScreen.y),
|
|
|
+Oa.intersects(xa)&&s(C,G,La,gb,a);else if(La instanceof THREE.RenderableFace3)C=La.v1,G=La.v2,K=La.v3,C.positionScreen.x*=n,C.positionScreen.y*=q,G.positionScreen.x*=n,G.positionScreen.y*=q,K.positionScreen.x*=n,K.positionScreen.y*=q,gb.overdraw&&(Fb(C.positionScreen,G.positionScreen),Fb(G.positionScreen,K.positionScreen),Fb(K.positionScreen,C.positionScreen)),xa.add3Points(C.positionScreen.x,C.positionScreen.y,G.positionScreen.x,G.positionScreen.y,K.positionScreen.x,K.positionScreen.y),Oa.intersects(xa)&&
|
|
|
+t(C,G,K,0,1,2,La,gb,a);else if(La instanceof THREE.RenderableFace4)C=La.v1,G=La.v2,K=La.v3,L=La.v4,C.positionScreen.x*=n,C.positionScreen.y*=q,G.positionScreen.x*=n,G.positionScreen.y*=q,K.positionScreen.x*=n,K.positionScreen.y*=q,L.positionScreen.x*=n,L.positionScreen.y*=q,T.positionScreen.copy(G.positionScreen),M.positionScreen.copy(L.positionScreen),gb.overdraw&&(Fb(C.positionScreen,G.positionScreen),Fb(G.positionScreen,L.positionScreen),Fb(L.positionScreen,C.positionScreen),Fb(K.positionScreen,
|
|
|
+T.positionScreen),Fb(K.positionScreen,M.positionScreen)),xa.addPoint(C.positionScreen.x,C.positionScreen.y),xa.addPoint(G.positionScreen.x,G.positionScreen.y),xa.addPoint(K.positionScreen.x,K.positionScreen.y),xa.addPoint(L.positionScreen.x,L.positionScreen.y),Oa.intersects(xa)&&u(C,G,K,L,T,M,La,gb,a);Ka.addRectangle(xa)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,k;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),k=c.dot(i),0>=k||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),k=c.dot(C.sub(i,b).normalize()),0>=k||(k*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=k&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function b(a){null==G[a]&&(G[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"path"),0==E&&G[a].setAttribute("shape-rendering","crispEdges"));return G[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,o,n,q,m,r,s=new THREE.Rectangle,t=new THREE.Rectangle,u=!1,x=new THREE.Color,w=new THREE.Color,A=new THREE.Color,D=new THREE.Color,B,C=new THREE.Vector3,G=[],K=[],L,T,M,E=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":E=1;break;case "low":E=0}};this.setSize=function(a,b){l=a;k=b;p=l/2;o=k/2;i.setAttribute("viewBox",-p+" "+-o+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);s.set(-p,-o,p,o)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(j,k){var l,C,y,F;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(j,k,this.sortElements);f=e.elements;
|
|
|
+g=e.lights;M=T=0;if(u=0<g.length){w.setRGB(0,0,0);A.setRGB(0,0,0);D.setRGB(0,0,0);for(l=0,C=g.length;l<C;l++)F=g[l],y=F.color,F instanceof THREE.AmbientLight?(w.r+=y.r,w.g+=y.g,w.b+=y.b):F instanceof THREE.DirectionalLight?(A.r+=y.r,A.g+=y.g,A.b+=y.b):F instanceof THREE.PointLight&&(D.r+=y.r,D.g+=y.g,D.b+=y.b)}for(l=0,C=f.length;l<C;l++)if(y=f[l],F=y.material,F=F instanceof THREE.MeshFaceMaterial?y.faceMaterial:F,!(null==F||0==F.opacity))if(t.empty(),y instanceof THREE.RenderableParticle)n=y,n.x*=
|
|
|
+p,n.y*=-o;else if(y instanceof THREE.RenderableLine){if(n=y.v1,q=y.v2,n.positionScreen.x*=p,n.positionScreen.y*=-o,q.positionScreen.x*=p,q.positionScreen.y*=-o,t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t)){y=n;var P=q,$=M++;null==K[$]&&(K[$]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==E&&K[$].setAttribute("shape-rendering","crispEdges"));L=K[$];L.setAttribute("x1",y.positionScreen.x);L.setAttribute("y1",y.positionScreen.y);
|
|
|
+L.setAttribute("x2",P.positionScreen.x);L.setAttribute("y2",P.positionScreen.y);F instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+F.color.getContextStyle()+"; stroke-width: "+F.linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.linecap+"; stroke-linejoin: "+F.linejoin),i.appendChild(L))}}else if(y instanceof THREE.RenderableFace3){if(n=y.v1,q=y.v2,m=y.v3,n.positionScreen.x*=p,n.positionScreen.y*=-o,q.positionScreen.x*=p,q.positionScreen.y*=-o,m.positionScreen.x*=
|
|
|
+p,m.positionScreen.y*=-o,t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),s.intersects(t)){var P=n,$=q,Z=m;d.info.render.vertices+=3;d.info.render.faces++;L=b(T++);L.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");F instanceof THREE.MeshBasicMaterial?x.copy(F.color):F instanceof THREE.MeshLambertMaterial?
|
|
|
+u?(x.r=w.r,x.g=w.g,x.b=w.b,a(g,y.centroidWorld,y.normalWorld,x),x.r=Math.max(0,Math.min(F.color.r*x.r,1)),x.g=Math.max(0,Math.min(F.color.g*x.g,1)),x.b=Math.max(0,Math.min(F.color.b*x.b,1))):x.copy(F.color):F instanceof THREE.MeshDepthMaterial?(B=1-F.__2near/(F.__farPlusNear-y.z*F.__farMinusNear),x.setRGB(B,B,B)):F instanceof THREE.MeshNormalMaterial&&x.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));F.wireframe?L.setAttribute("style","fill: none; stroke: "+x.getContextStyle()+"; stroke-width: "+
|
|
|
+F.wireframeLinewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframeLinecap+"; stroke-linejoin: "+F.wireframeLinejoin):L.setAttribute("style","fill: "+x.getContextStyle()+"; fill-opacity: "+F.opacity);i.appendChild(L)}}else if(y instanceof THREE.RenderableFace4&&(n=y.v1,q=y.v2,m=y.v3,r=y.v4,n.positionScreen.x*=p,n.positionScreen.y*=-o,q.positionScreen.x*=p,q.positionScreen.y*=-o,m.positionScreen.x*=p,m.positionScreen.y*=-o,r.positionScreen.x*=p,r.positionScreen.y*=-o,t.addPoint(n.positionScreen.x,
|
|
|
+n.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(t))){var P=n,$=q,Z=m,G=r;d.info.render.vertices+=4;d.info.render.faces++;L=b(T++);L.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+"z");F instanceof THREE.MeshBasicMaterial?
|
|
|
+x.copy(F.color):F instanceof THREE.MeshLambertMaterial?u?(x.r=w.r,x.g=w.g,x.b=w.b,a(g,y.centroidWorld,y.normalWorld,x),x.r=Math.max(0,Math.min(F.color.r*x.r,1)),x.g=Math.max(0,Math.min(F.color.g*x.g,1)),x.b=Math.max(0,Math.min(F.color.b*x.b,1))):x.copy(F.color):F instanceof THREE.MeshDepthMaterial?(B=1-F.__2near/(F.__farPlusNear-y.z*F.__farMinusNear),x.setRGB(B,B,B)):F instanceof THREE.MeshNormalMaterial&&x.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));F.wireframe?L.setAttribute("style",
|
|
|
+"fill: none; stroke: "+x.getContextStyle()+"; stroke-width: "+F.wireframeLinewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframeLinecap+"; stroke-linejoin: "+F.wireframeLinejoin):L.setAttribute("style","fill: "+x.getContextStyle()+"; fill-opacity: "+F.opacity);i.appendChild(L)}}};
|
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
|
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
|
|
@@ -229,121 +229,122 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragme
|
|
|
THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
|
THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
|
|
|
function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
|
|
|
-var i=a.colors,k=i.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){Ra.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Sa.copy(e),Ra.multiplyVector3(Sa),n[d]=[Sa.z,d];n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[n[d][1]].position,f=3*d,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;for(d=0;d<k;d++)f=3*d,e=i[n[d][1]],m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],
|
|
|
-void 0===h.boundTo||"vertices"===h.boundTo)if(f=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)g=n[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],
|
|
|
-h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}else{if(p)for(d=0;d<g;d++)e=h[d].position,f=3*d,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;if(o)for(d=0;d<k;d++)e=i[d],f=3*d,m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)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(3===h.size)if("c"===
|
|
|
-h.type)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(4===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-m,b);if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)V=null,I=O=ba=S=fa=-1,a[d].render(b,c,Fa,ab),V=null,I=O=ba=S=fa=-1}function i(a,b,c,d,e,f,g,h){var j,i,k,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var m=i;m!==b;m+=l)if(j=a[m],j.render){i=j.object;k=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&
|
|
|
-B.setBlending(j.blending);B.setDepthTest(j.depthTest);s(j.depthWrite);t(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}B.setObjectFaces(i);k instanceof THREE.BufferGeometry?B.renderBufferDirect(d,e,f,j,k,i):B.renderBuffer(d,e,f,j,k,i)}}function l(a,b,c,d,e,f,g){for(var h,j,i=0,k=a.length;i<k;i++)if(h=a[i],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&B.setBlending(h.blending);B.setDepthTest(h.depthTest);s(h.depthWrite);t(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}B.renderImmediateObject(c,
|
|
|
-d,e,h,j)}}function k(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,e){d.program||B.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=
|
|
|
-new Float32Array(B.maxMorphTargets);for(var f=0,g=B.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==V&&(j.useProgram(f),V=f,h=!0);if(d.id!==I)I=d.id,h=!0;if(h){j.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray);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){var k,l,m=0,n=0,p=0,o,q,r=bb,s=r.directional.colors,t=r.directional.positions,O=r.point.colors,u=r.point.positions,v=r.point.distances,y=0,C=0,T=q=0;for(c=0,h=b.length;c<h;c++)if(k=b[c],l=k.color,o=k.intensity,q=k.distance,k instanceof THREE.AmbientLight)B.gammaInput?(m+=l.r*l.r,n+=l.g*l.g,p+=l.b*l.b):(m+=l.r,n+=l.g,p+=l.b);else if(k instanceof THREE.DirectionalLight)q=3*y,B.gammaInput?(s[q]=l.r*l.r*o*o,s[q+1]=l.g*l.g*o*o,s[q+2]=l.b*l.b*o*o):(s[q]=
|
|
|
-l.r*o,s[q+1]=l.g*o,s[q+2]=l.b*o),k=k.matrixWorld.getPosition(),l=1/k.length(),t[q]=k.x*l,t[q+1]=k.y*l,t[q+2]=k.z*l,y+=1;else if(k instanceof THREE.SpotLight&&!k.onlyShadow)q=3*y,B.gammaInput?(s[q]=l.r*l.r*o*o,s[q+1]=l.g*l.g*o*o,s[q+2]=l.b*l.b*o*o):(s[q]=l.r*o,s[q+1]=l.g*o,s[q+2]=l.b*o),k=k.matrixWorld.getPosition(),l=1/k.length(),t[q]=k.x*l,t[q+1]=k.y*l,t[q+2]=k.z*l,y+=1;else if(k instanceof THREE.PointLight)T=3*C,B.gammaInput?(O[T]=l.r*l.r*o*o,O[T+1]=l.g*l.g*o*o,O[T+2]=l.b*l.b*o*o):(O[T]=l.r*o,O[T+
|
|
|
-1]=l.g*o,O[T+2]=l.b*o),k=k.matrixWorld.getPosition(),u[T]=k.x,u[T+1]=k.y,u[T+2]=k.z,v[C]=q,C+=1;for(c=3*y,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=O.length;c<h;c++)O[c]=0;r.point.length=C;r.directional.length=y;r.ambient[0]=m;r.ambient[1]=n;r.ambient[2]=p;b=bb;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,B.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=E.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,B.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),
|
|
|
-i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)B.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient,d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);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<B.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=B.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=B.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=B.shadowMapDarkness;i.shadowBias.value=B.shadowMapBias}b=d.uniformsList;for(i=0,c=b.length;i<c;i++)if(n=f.uniforms[b[i][1]])if(h=b[i][0],p=h.type,m=h.value,"i"===p)j.uniform1i(n,m);else if("f"===p)j.uniform1f(n,m);else if("v2"===p)j.uniform2f(n,m.x,m.y);else if("v3"===
|
|
|
-p)j.uniform3f(n,m.x,m.y,m.z);else if("v4"===p)j.uniform4f(n,m.x,m.y,m.z,m.w);else if("c"===p)j.uniform3f(n,m.r,m.g,m.b);else if("fv1"===p)j.uniform1fv(n,m);else if("fv"===p)j.uniform3fv(n,m);else if("v3v"===p){if(!h._array)h._array=new Float32Array(3*m.length);for(p=0,r=m.length;p<r;p++)s=3*p,h._array[s]=m[p].x,h._array[s+1]=m[p].y,h._array[s+2]=m[p].z;j.uniform3fv(n,h._array)}else if("m4"===p){if(!h._array)h._array=new Float32Array(16);m.flattenToArray(h._array);j.uniformMatrix4fv(n,!1,h._array)}else if("m4v"===
|
|
|
-p){if(!h._array)h._array=new Float32Array(16*m.length);for(p=0,r=m.length;p<r;p++)m[p].flattenToArrayOffset(h._array,16*p);j.uniformMatrix4fv(n,!1,h._array)}else if("t"===p){if(j.uniform1i(n,m),n=h.texture)if(n.image instanceof Array&&6===n.image.length){if(h=n,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+m);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);m=[];for(n=0;6>n;n++){p=m;r=n;if(B.autoScaleCubemaps){if(s=
|
|
|
-h.image[n],O=Aa,!(s.width<=O&&s.height<=O))u=Math.max(s.width,s.height),t=Math.floor(s.width*O/u),O=Math.floor(s.height*O/u),u=document.createElement("canvas"),u.width=t,u.height=O,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,O),s=u}else s=h.image[n];p[r]=s}n=m[0];p=0===(n.width&n.width-1)&&0===(n.height&n.height-1);r=D(h.format);s=D(h.type);x(j.TEXTURE_CUBE_MAP,h,p);for(n=0;6>n;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,r,r,s,m[n]);h.generateMipmaps&&p&&j.generateMipmap(j.TEXTURE_CUBE_MAP);
|
|
|
-h.needsUpdate=!1;if(h.onUpdated)h.onUpdated()}else j.activeTexture(j.TEXTURE0+m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(h=n,j.activeTexture(j.TEXTURE0+m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):B.setTexture(n,m)}else if("tv"===p){if(!h._array){h._array=[];for(p=0,r=h.texture.length;p<r;p++)h._array[p]=m+p}j.uniform1iv(n,h._array);for(p=0,r=h.texture.length;p<r;p++)(n=h.texture[p])&&B.setTexture(n,h._array[p])}(d instanceof
|
|
|
-THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition&&j.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(j.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(g.modelViewMatrix,
|
|
|
-!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==g.objectMatrix&&j.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a){ba!==a&&
|
|
|
-(j.depthMask(a),ba=a)}function t(a,b,c){$!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),$=a);if(a&&(ca!==b||ia!==c))j.polygonOffset(b,c),ca=b,ia=c}function u(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(b),null):c}function x(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,
|
|
|
-D(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,D(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,D(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,D(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter)))}function v(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
|
|
|
-j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function A(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
|
|
|
-default:return j.LINEAR}}function D(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
|
|
|
+var i=a.colors,k=i.length,l=a.__vertexArray,m=a.__colorArray,o=a.__sortArray,p=a.__dirtyVertices,n=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){Ta.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Wa.copy(e),Ta.multiplyVector3(Wa),o[d]=[Wa.z,d];o.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[o[d][1]].position,f=3*d,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;for(d=0;d<k;d++)f=3*d,e=i[o[d][1]],m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],
|
|
|
+void 0===h.boundTo||"vertices"===h.boundTo)if(f=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)g=o[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<e;d++)g=o[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=o[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=o[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(4===h.size)for(d=0;d<e;d++)g=o[d][1],g=h.value[g],
|
|
|
+h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}else{if(p)for(d=0;d<g;d++)e=h[d].position,f=3*d,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;if(n)for(d=0;d<k;d++)e=i[d],f=3*d,m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)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(3===h.size)if("c"===
|
|
|
+h.type)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(4===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(n||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
+m,b);if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)I=null,y=F=S=fa=ga=-1,a[d].render(b,c,Ga,Ea),I=null,y=F=S=fa=ga=-1}function i(a,b,c,d,e,f,g,h){var j,i,k,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var m=i;m!==b;m+=l)if(j=a[m],j.render){i=j.object;k=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&
|
|
|
+E.setBlending(j.blending);E.setDepthTest(j.depthTest);E.setDepthWrite(j.depthWrite);s(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}E.setObjectFaces(i);k instanceof THREE.BufferGeometry?E.renderBufferDirect(d,e,f,j,k,i):E.renderBuffer(d,e,f,j,k,i)}}function l(a,b,c,d,e,f,g){for(var h,j,i=0,k=a.length;i<k;i++)if(h=a[i],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&E.setBlending(h.blending);E.setDepthTest(h.depthTest);E.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,
|
|
|
+h.polygonOffsetUnits)}E.renderImmediateObject(c,d,e,h,j)}}function k(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function o(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function n(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,e){d.program||E.initMaterial(d,b,c,e);if(d.morphTargets&&
|
|
|
+!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var f=0,g=E.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==I&&(j.useProgram(f),I=f,h=!0);if(d.id!==y)y=d.id,h=!0;if(h){j.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray);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){var k,l,m=0,o=0,p=0,n,q,r=fb,s=r.directional.colors,t=r.directional.positions,F=r.point.colors,P=r.point.positions,x=r.point.distances,w=0,C=0,B=q=0;for(c=0,h=b.length;c<h;c++)if(k=b[c],l=k.color,n=k.intensity,q=k.distance,k instanceof THREE.AmbientLight)E.gammaInput?(m+=l.r*l.r,o+=l.g*l.g,p+=l.b*l.b):(m+=l.r,o+=l.g,p+=l.b);else if(k instanceof THREE.DirectionalLight)q=3*w,E.gammaInput?(s[q]=l.r*l.r*
|
|
|
+n*n,s[q+1]=l.g*l.g*n*n,s[q+2]=l.b*l.b*n*n):(s[q]=l.r*n,s[q+1]=l.g*n,s[q+2]=l.b*n),k=k.matrixWorld.getPosition(),l=1/k.length(),t[q]=k.x*l,t[q+1]=k.y*l,t[q+2]=k.z*l,w+=1;else if(k instanceof THREE.SpotLight&&!k.onlyShadow)q=3*w,E.gammaInput?(s[q]=l.r*l.r*n*n,s[q+1]=l.g*l.g*n*n,s[q+2]=l.b*l.b*n*n):(s[q]=l.r*n,s[q+1]=l.g*n,s[q+2]=l.b*n),k=k.matrixWorld.getPosition(),l=1/k.length(),t[q]=k.x*l,t[q+1]=k.y*l,t[q+2]=k.z*l,w+=1;else if(k instanceof THREE.PointLight)B=3*C,E.gammaInput?(F[B]=l.r*l.r*n*n,F[B+
|
|
|
+1]=l.g*l.g*n*n,F[B+2]=l.b*l.b*n*n):(F[B]=l.r*n,F[B+1]=l.g*n,F[B+2]=l.b*n),k=k.matrixWorld.getPosition(),P[B]=k.x,P[B+1]=k.y,P[B+2]=k.z,x[C]=q,C+=1;for(c=3*w,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=F.length;c<h;c++)F[c]=0;r.point.length=C;r.directional.length=w;r.ambient[0]=m;r.ambient[1]=o;r.ambient[2]=p;b=fb;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,E.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=D.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=
|
|
|
+d.shininess,E.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)E.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient,d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);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<E.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=E.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=E.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=E.shadowMapDarkness;i.shadowBias.value=E.shadowMapBias}b=d.uniformsList;for(i=0,c=b.length;i<c;i++)if(o=f.uniforms[b[i][1]])if(h=b[i][0],p=h.type,m=h.value,"i"===p)j.uniform1i(o,m);else if("f"===
|
|
|
+p)j.uniform1f(o,m);else if("v2"===p)j.uniform2f(o,m.x,m.y);else if("v3"===p)j.uniform3f(o,m.x,m.y,m.z);else if("v4"===p)j.uniform4f(o,m.x,m.y,m.z,m.w);else if("c"===p)j.uniform3f(o,m.r,m.g,m.b);else if("fv1"===p)j.uniform1fv(o,m);else if("fv"===p)j.uniform3fv(o,m);else if("v3v"===p){if(!h._array)h._array=new Float32Array(3*m.length);for(p=0,r=m.length;p<r;p++)s=3*p,h._array[s]=m[p].x,h._array[s+1]=m[p].y,h._array[s+2]=m[p].z;j.uniform3fv(o,h._array)}else if("m4"===p){if(!h._array)h._array=new Float32Array(16);
|
|
|
+m.flattenToArray(h._array);j.uniformMatrix4fv(o,!1,h._array)}else if("m4v"===p){if(!h._array)h._array=new Float32Array(16*m.length);for(p=0,r=m.length;p<r;p++)m[p].flattenToArrayOffset(h._array,16*p);j.uniformMatrix4fv(o,!1,h._array)}else if("t"===p){if(j.uniform1i(o,m),o=h.texture)if(o.image instanceof Array&&6===o.image.length){if(h=o,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+m);j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
+h.image.__webglTextureCube);m=[];for(o=0;6>o;o++){p=m;r=o;if(E.autoScaleCubemaps){if(s=h.image[o],F=lb,!(s.width<=F&&s.height<=F))P=Math.max(s.width,s.height),t=Math.floor(s.width*F/P),F=Math.floor(s.height*F/P),P=document.createElement("canvas"),P.width=t,P.height=F,P.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,F),s=P}else s=h.image[o];p[r]=s}o=m[0];p=0===(o.width&o.width-1)&&0===(o.height&o.height-1);r=A(h.format);s=A(h.type);u(j.TEXTURE_CUBE_MAP,h,p);for(o=0;6>o;o++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
+o,0,r,r,s,m[o]);h.generateMipmaps&&p&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdated)h.onUpdated()}else j.activeTexture(j.TEXTURE0+m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else o instanceof THREE.WebGLRenderTargetCube?(h=o,j.activeTexture(j.TEXTURE0+m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):E.setTexture(o,m)}else if("tv"===p){if(!h._array){h._array=[];for(p=0,r=h.texture.length;p<r;p++)h._array[p]=m+p}j.uniform1iv(o,h._array);for(p=0,r=h.texture.length;p<
|
|
|
+r;p++)(o=h.texture[p])&&E.setTexture(o,h._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition&&j.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(j.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),
|
|
|
+j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==g.objectMatrix&&j.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);
|
|
|
+c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){aa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),aa=a);if(a&&(ba!==b||ca!==c))j.polygonOffset(b,c),ba=b,ca=c}function t(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(b),null):c}function u(a,b,c){c?(j.texParameteri(a,
|
|
|
+j.TEXTURE_WRAP_S,A(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,A(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,w(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,w(b.minFilter)))}function x(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
|
|
|
+j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function w(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
|
|
|
+default:return j.LINEAR}}function A(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
|
|
|
case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
|
|
|
-var a=a||{},E=void 0!==a.canvas?a.canvas:document.createElement("canvas"),C=void 0!==a.precision?a.precision:"mediump",F=void 0!==a.antialias?a.antialias:!1,K=void 0!==a.stencil?a.stencil:!0,L=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,R=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),N=void 0!==a.clearAlpha?a.clearAlpha:0,P=void 0!==a.maxLights?a.maxLights:4;this.domElement=E;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
|
|
|
+var a=a||{},D=void 0!==a.canvas?a.canvas:document.createElement("canvas"),B=void 0!==a.precision?a.precision:"mediump",C=void 0!==a.antialias?a.antialias:!1,G=void 0!==a.stencil?a.stencil:!0,K=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),T=void 0!==a.clearAlpha?a.clearAlpha:0,M=void 0!==a.maxLights?a.maxLights:4;this.domElement=D;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.shadowMapEnabled=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info=
|
|
|
-{memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var B=this,j,H=[],V=null,y=null,I=-1,O=null,T=0,aa=null,ga=null,fa=null,S=null,ba=null,$=null,ca=null,ia=null,La=null,ja=0,za=0,qa=0,Ga=0,Fa=0,ab=0,gb=new THREE.Frustum,Ra=new THREE.Matrix4,Sa=new THREE.Vector4,bb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=E.getContext("experimental-webgl",{antialias:F,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}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,
|
|
|
-j.ONE_MINUS_SRC_ALPHA);j.clearColor(R.r,R.g,R.b,N);this.context=j;var Wa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.TEXTURE_SIZE);var Aa=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<Wa};this.setSize=function(a,b){E.width=a;E.height=b;this.setViewport(0,0,E.width,E.height)};this.setViewport=function(a,b,c,d){ja=a;za=b;qa=c;Ga=d;j.viewport(ja,za,qa,Ga)};this.setScissor=function(a,b,c,d){j.scissor(a,
|
|
|
-b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){R.setHex(a);N=b;j.clearColor(R.r,R.g,R.b,N)};this.setClearColor=function(a,b){R.copy(a);N=b;j.clearColor(R.r,R.g,R.b,N)};this.getClearColor=function(){return R};this.getClearAlpha=function(){return N};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=
|
|
|
+{memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var E=this,j,Q=[],I=null,R=null,y=-1,F=null,P=0,$=null,Z=null,ga=null,fa=null,S=null,aa=null,ba=null,ca=null,ha=null,Na=0,ja=0,za=0,qa=0,Ga=0,Ea=0,Sa=new THREE.Frustum,Ta=new THREE.Matrix4,Wa=new THREE.Vector4,fb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=D.getContext("experimental-webgl",{antialias:C,stencil:G,
|
|
|
+preserveDrawingBuffer:K})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,
|
|
|
+j.ONE_MINUS_SRC_ALPHA);j.clearColor(L.r,L.g,L.b,T);this.context=j;var Za=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.TEXTURE_SIZE);var lb=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<Za};this.setSize=function(a,b){D.width=a;D.height=b;this.setViewport(0,0,D.width,D.height)};this.setViewport=function(a,b,c,d){Na=a;ja=b;za=c;qa=d;j.viewport(Na,ja,za,qa)};this.setScissor=function(a,b,c,d){j.scissor(a,
|
|
|
+b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){L.setHex(a);T=b;j.clearColor(L.r,L.g,L.b,T)};this.setClearColor=function(a,b){L.copy(a);T=b;j.clearColor(L.r,L.g,L.b,T)};this.getClearColor=function(){return L};this.getClearAlpha=function(){return T};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=
|
|
|
function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.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];j.deleteBuffer(c.__webglVertexBuffer);
|
|
|
j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);
|
|
|
-if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);B.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=
|
|
|
-a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),B.info.memory.textures--};this.updateShadowMap=function(a,b){V=null;I=O=ba=S=fa=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
|
|
|
-a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,k,l,m,n,p=3*a.count;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],f=c[n+2],g=c[n+3],i=c[n+4],l=c[n+5],h=c[n+6],k=c[n+7],m=c[n+8],d=(d+g+h)/3,e=(e+i+k)/3,f=
|
|
|
-(f+l+m)/3,c[n]=d,c[n+1]=e,c[n+2]=f,c[n+3]=d,c[n+4]=e,c[n+5]=f,c[n+6]=d,c[n+7]=e,c[n+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=m(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==O&&(O=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;
|
|
|
+if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);E.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=
|
|
|
+a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),E.info.memory.textures--};this.updateShadowMap=function(a,b){I=null;y=F=S=fa=ga=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
|
|
|
+a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,k,l,m,o,p=3*a.count;for(o=0;o<p;o+=9)c=a.normalArray,d=c[o],e=c[o+1],f=c[o+2],g=c[o+3],i=c[o+4],l=c[o+5],h=c[o+6],k=c[o+7],m=c[o+8],d=(d+g+h)/3,e=(e+i+k)/3,f=
|
|
|
+(f+l+m)/3,c[o]=d,c[o+1]=e,c[o+2]=f,c[o+3]=d,c[o+4]=e,c[o+5]=f,c[o+6]=d,c[o+7]=e,c[o+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=m(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==F&&(F=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;
|
|
|
for(c=f.length;d<c;++d)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer),j.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexNormalBuffer),j.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer),j.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,j.FLOAT,
|
|
|
-!1,0,8*f[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer),j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*f[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,f[d].count,j.UNSIGNED_SHORT,2*f[d].start),B.info.render.calls++,B.info.render.vertices+=f[d].count,B.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,
|
|
|
-b,c,d,e,f){if(0!==d.opacity){var g,h,c=m(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==O&&(O=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],k=-1,l=0;h=f.morphTargetInfluences;var n,p=h.length;g=0;for(-1!==f.morphTargetBase&&(i[f.morphTargetBase]=
|
|
|
-!0);g<d.numSupportedMorphTargets;){for(n=0;n<p;n++)!i[n]&&h[n]>k&&(l=n,k=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=k;i[l]=1;k=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],
|
|
|
+!1,0,8*f[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer),j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*f[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,f[d].count,j.UNSIGNED_SHORT,2*f[d].start),E.info.render.calls++,E.info.render.vertices+=f[d].count,E.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,
|
|
|
+b,c,d,e,f){if(0!==d.opacity){var g,h,c=m(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==F&&(F=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],k=-1,l=0;h=f.morphTargetInfluences;var o,p=h.length;g=0;for(-1!==f.morphTargetBase&&(i[f.morphTargetBase]=
|
|
|
+!0);g<d.numSupportedMorphTargets;){for(o=0;o<p;o++)!i[o]&&h[o]>k&&(l=o,k=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=k;i[l]=1;k=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],
|
|
|
0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0));0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&
|
|
|
(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));0<=b.uv2&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),
|
|
|
-j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==La&&(j.lineWidth(d),La=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
-e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),B.info.render.calls++,B.info.render.vertices+=e.__webglFaceCount,B.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==La&&(j.lineWidth(d),La=d),j.drawArrays(f,0,e.__webglLineCount),B.info.render.calls++):f instanceof
|
|
|
-THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),B.info.render.calls++,B.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),B.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,k,m,n=a.lights,p=a.fog;I=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();
|
|
|
-h(this.renderPluginsPre,a,b);B.info.render.calls=0;B.info.render.vertices=0;B.info.render.faces=0;B.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Ra.multiply(b.projectionMatrix,b.matrixWorldInverse);gb.setFromMatrix(Ra);this.setRenderTarget(c);
|
|
|
-(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;for(d=0,e=m.length;d<e;d++)if(f=m[d],k=f.object,f.render=!1,k.visible&&(!(k instanceof THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||gb.contains(k))){k.matrixWorld.flattenToArray(k._objectMatrixArray);r(k,b);var o=f,q=o.object,O=o.buffer,u=void 0,u=u=void 0,u=q.material;if(u instanceof THREE.MeshFaceMaterial){if(u=O.materialIndex,0<=u)u=q.geometry.materials[u],u.transparent?
|
|
|
-(o.transparent=u,o.opaque=null):(o.opaque=u,o.transparent=null)}else if(u)u.transparent?(o.transparent=u,o.opaque=null):(o.opaque=u,o.transparent=null);f.render=!0;if(this.sortObjects)k.renderDepth?f.z=k.renderDepth:(Sa.copy(k.position),Ra.multiplyVector3(Sa),f.z=Sa.z)}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;for(d=0,e=m.length;d<e;d++)if(f=m[d],k=f.object,k.visible)k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),r(k,b),k=f.object.material,k.transparent?(f.transparent=
|
|
|
-k,f.opaque=null):(f.opaque=k,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),s(a.overrideMaterial.depthWrite),t(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,n,p,!0,a.overrideMaterial),l(a.__webglObjectsImmediate,"",b,n,p,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,n,p,
|
|
|
-!1),l(a.__webglObjectsImmediate,"opaque",b,n,p,!1),i(a.__webglObjects,!1,"transparent",b,n,p,!0),l(a.__webglObjectsImmediate,"transparent",b,n,p,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),
|
|
|
-j.bindTexture(j.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,e){var f=m(a,b,c,d,e);O=-1;B.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,gb):e.render(function(a){B.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,l=void 0,m=void 0;if(!g.__webglInit)if(g.__webglInit=
|
|
|
-!0,g._modelViewMatrix=new THREE.Matrix4,g._normalMatrixArray=new Float32Array(9),g._modelViewMatrixArray=new Float32Array(16),g._objectMatrixArray=new Float32Array(16),g.matrixWorld.flattenToArray(g._objectMatrixArray),g instanceof THREE.Mesh){if(l=g.geometry,l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var r=l,s=void 0,O=void 0,t=void 0,u=void 0,I=void 0,x=void 0,v=void 0,y={},C=r.morphTargets.length;r.geometryGroups={};for(s=0,O=r.faces.length;s<O;s++)t=r.faces[s],u=t.materialIndex,
|
|
|
-x=void 0!==u?u:-1,void 0===y[x]&&(y[x]={hash:x,counter:0}),v=y[x].hash+"_"+y[x].counter,void 0===r.geometryGroups[v]&&(r.geometryGroups[v]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C}),I=t instanceof THREE.Face3?3:4,65535<r.geometryGroups[v].vertices+I&&(y[x].counter+=1,v=y[x].hash+"_"+y[x].counter,void 0===r.geometryGroups[v]&&(r.geometryGroups[v]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C})),t instanceof THREE.Face3?r.geometryGroups[v].faces3.push(s):
|
|
|
-r.geometryGroups[v].faces4.push(s),r.geometryGroups[v].vertices+=I;r.geometryGroupsList=[];var E=void 0;for(E in r.geometryGroups)r.geometryGroups[E].id=T++,r.geometryGroupsList.push(r.geometryGroups[E])}for(i in l.geometryGroups)if(m=l.geometryGroups[i],!m.__webglVertexBuffer){var A=m;A.__webglVertexBuffer=j.createBuffer();A.__webglNormalBuffer=j.createBuffer();A.__webglTangentBuffer=j.createBuffer();A.__webglColorBuffer=j.createBuffer();A.__webglUVBuffer=j.createBuffer();A.__webglUV2Buffer=j.createBuffer();
|
|
|
-A.__webglSkinVertexABuffer=j.createBuffer();A.__webglSkinVertexBBuffer=j.createBuffer();A.__webglSkinIndicesBuffer=j.createBuffer();A.__webglSkinWeightsBuffer=j.createBuffer();A.__webglFaceBuffer=j.createBuffer();A.__webglLineBuffer=j.createBuffer();if(A.numMorphTargets){var D=void 0,H=void 0;A.__webglMorphTargetsBuffers=[];for(D=0,H=A.numMorphTargets;D<H;D++)A.__webglMorphTargetsBuffers.push(j.createBuffer())}B.info.memory.geometries++;var F=m,S=g,aa=S.geometry,K=F.faces3,N=F.faces4,L=3*K.length+
|
|
|
-4*N.length,fa=1*K.length+2*N.length,ba=3*K.length+4*N.length,$=c(S,F),P=e($),ca=d($),R=$.vertexColors?$.vertexColors:!1;F.__vertexArray=new Float32Array(3*L);if(ca)F.__normalArray=new Float32Array(3*L);if(aa.hasTangents)F.__tangentArray=new Float32Array(4*L);if(R)F.__colorArray=new Float32Array(3*L);if(P){if(0<aa.faceUvs.length||0<aa.faceVertexUvs.length)F.__uvArray=new Float32Array(2*L);if(1<aa.faceUvs.length||1<aa.faceVertexUvs.length)F.__uv2Array=new Float32Array(2*L)}if(S.geometry.skinWeights.length&&
|
|
|
-S.geometry.skinIndices.length)F.__skinVertexAArray=new Float32Array(4*L),F.__skinVertexBArray=new Float32Array(4*L),F.__skinIndexArray=new Float32Array(4*L),F.__skinWeightArray=new Float32Array(4*L);F.__faceArray=new Uint16Array(3*fa);F.__lineArray=new Uint16Array(2*ba);if(F.numMorphTargets){F.__morphTargetsArrays=[];for(var ga=0,ia=F.numMorphTargets;ga<ia;ga++)F.__morphTargetsArrays.push(new Float32Array(3*L))}F.__webglFaceCount=3*fa;F.__webglLineCount=2*ba;if($.attributes){if(void 0===F.__webglCustomAttributesList)F.__webglCustomAttributesList=
|
|
|
-[];var V=void 0;for(V in $.attributes){var La=$.attributes[V],ja={},za;for(za in La)ja[za]=La[za];if(!ja.__webglInitialized||ja.createUniqueBuffers){ja.__webglInitialized=!0;var qa=1;"v2"===ja.type?qa=2:"v3"===ja.type?qa=3:"v4"===ja.type?qa=4:"c"===ja.type&&(qa=3);ja.size=qa;ja.array=new Float32Array(L*qa);ja.buffer=j.createBuffer();ja.buffer.belongsToAttribute=V;La.needsUpdate=!0;ja.__original=La}F.__webglCustomAttributesList.push(ja)}}F.__inittedArrays=!0;l.__dirtyVertices=!0;l.__dirtyMorphTargets=
|
|
|
-!0;l.__dirtyElements=!0;l.__dirtyUvs=!0;l.__dirtyNormals=!0;l.__dirtyTangents=!0;l.__dirtyColors=!0}}}else if(g instanceof THREE.Ribbon){if(l=g.geometry,!l.__webglVertexBuffer){var Fa=l;Fa.__webglVertexBuffer=j.createBuffer();Fa.__webglColorBuffer=j.createBuffer();B.info.memory.geometries++;var Ga=l,Aa=Ga.vertices.length;Ga.__vertexArray=new Float32Array(3*Aa);Ga.__colorArray=new Float32Array(3*Aa);Ga.__webglVertexCount=Aa;l.__dirtyVertices=!0;l.__dirtyColors=!0}}else if(g instanceof THREE.Line){if(l=
|
|
|
-g.geometry,!l.__webglVertexBuffer){var Sa=l;Sa.__webglVertexBuffer=j.createBuffer();Sa.__webglColorBuffer=j.createBuffer();B.info.memory.geometries++;var Ra=l,gb=g,ab=Ra.vertices.length;Ra.__vertexArray=new Float32Array(3*ab);Ra.__colorArray=new Float32Array(3*ab);Ra.__webglLineCount=ab;b(Ra,gb);l.__dirtyVertices=!0;l.__dirtyColors=!0}}else if(g instanceof THREE.ParticleSystem&&(l=g.geometry,!l.__webglVertexBuffer)){var bb=l;bb.__webglVertexBuffer=j.createBuffer();bb.__webglColorBuffer=j.createBuffer();
|
|
|
-B.info.geometries++;var Wa=l,jd=g,Nc=Wa.vertices.length;Wa.__vertexArray=new Float32Array(3*Nc);Wa.__colorArray=new Float32Array(3*Nc);Wa.__sortArray=[];Wa.__webglParticleCount=Nc;b(Wa,jd);l.__dirtyVertices=!0;l.__dirtyColors=!0}if(!g.__webglActive){if(g instanceof THREE.Mesh)if(l=g.geometry,l instanceof THREE.BufferGeometry)k(h.__webglObjects,l,g);else for(i in l.geometryGroups)m=l.geometryGroups[i],k(h.__webglObjects,m,g);else g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem?
|
|
|
-(l=g.geometry,k(h.__webglObjects,l,g)):void 0!==THREE.MarchingCubes&&g instanceof THREE.MarchingCubes||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var db=a.__objectsRemoved[0],wc=a;db instanceof THREE.Mesh||db instanceof THREE.ParticleSystem||db instanceof THREE.Ribbon||
|
|
|
-db instanceof THREE.Line?o(wc.__webglObjects,db):db instanceof THREE.Sprite?q(wc.__webglSprites,db):db instanceof THREE.LensFlare?q(wc.__webglFlares,db):(db instanceof THREE.MarchingCubes||db.immediateRenderCallback)&&o(wc.__webglObjectsImmediate,db);db.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Oc=0,kd=a.__webglObjects.length;Oc<kd;Oc++){var kb=a.__webglObjects[Oc].object,ha=kb.geometry,jc=void 0,$b=void 0,Ua=void 0;if(kb instanceof THREE.Mesh)if(ha instanceof THREE.BufferGeometry)ha.__dirtyVertices=
|
|
|
-!1,ha.__dirtyElements=!1,ha.__dirtyUvs=!1,ha.__dirtyNormals=!1,ha.__dirtyColors=!1;else{for(var Pc=0,ld=ha.geometryGroupsList.length;Pc<ld;Pc++)if(jc=ha.geometryGroupsList[Pc],Ua=c(kb,jc),$b=Ua.attributes&&p(Ua),ha.__dirtyVertices||ha.__dirtyMorphTargets||ha.__dirtyElements||ha.__dirtyUvs||ha.__dirtyNormals||ha.__dirtyColors||ha.__dirtyTangents||$b){var da=jc,md=kb,Za=j.DYNAMIC_DRAW,nd=!ha.dynamic,yc=Ua;if(da.__inittedArrays){var Yc=d(yc),Qc=yc.vertexColors?yc.vertexColors:!1,Zc=e(yc),$c=Yc===THREE.SmoothShading,
|
|
|
-G=void 0,U=void 0,ib=void 0,M=void 0,ac=void 0,Gb=void 0,lb=void 0,zc=void 0,Ab=void 0,bc=void 0,cc=void 0,W=void 0,X=void 0,Y=void 0,na=void 0,mb=void 0,nb=void 0,ob=void 0,kc=void 0,pb=void 0,qb=void 0,rb=void 0,lc=void 0,sb=void 0,tb=void 0,ub=void 0,mc=void 0,vb=void 0,wb=void 0,xb=void 0,nc=void 0,Hb=void 0,Ib=void 0,Jb=void 0,Ac=void 0,Kb=void 0,Lb=void 0,Mb=void 0,Bc=void 0,ka=void 0,ad=void 0,Nb=void 0,dc=void 0,ec=void 0,$a=void 0,bd=void 0,Ha=void 0,ya=0,Ea=0,Bb=0,Cb=0,eb=0,Pa=0,oa=0,Qa=
|
|
|
-0,Ba=0,J=0,Ca=0,z=0,Xa=void 0,Ja=da.__vertexArray,oc=da.__uvArray,pc=da.__uv2Array,fb=da.__normalArray,ra=da.__tangentArray,Ka=da.__colorArray,sa=da.__skinVertexAArray,ta=da.__skinVertexBArray,ua=da.__skinIndexArray,va=da.__skinWeightArray,Rc=da.__morphTargetsArrays,Sc=da.__webglCustomAttributesList,w=void 0,yb=da.__faceArray,Ya=da.__lineArray,Ta=md.geometry,od=Ta.__dirtyElements,cd=Ta.__dirtyUvs,pd=Ta.__dirtyNormals,qd=Ta.__dirtyTangents,rd=Ta.__dirtyColors,sd=Ta.__dirtyMorphTargets,Ub=Ta.vertices,
|
|
|
-la=da.faces3,ma=da.faces4,Da=Ta.faces,Tc=Ta.faceVertexUvs[0],Uc=Ta.faceVertexUvs[1],Vb=Ta.skinVerticesA,Wb=Ta.skinVerticesB,Xb=Ta.skinIndices,Ob=Ta.skinWeights,Pb=Ta.morphTargets;if(Ta.__dirtyVertices){for(G=0,U=la.length;G<U;G++)M=Da[la[G]],W=Ub[M.a].position,X=Ub[M.b].position,Y=Ub[M.c].position,Ja[Ea]=W.x,Ja[Ea+1]=W.y,Ja[Ea+2]=W.z,Ja[Ea+3]=X.x,Ja[Ea+4]=X.y,Ja[Ea+5]=X.z,Ja[Ea+6]=Y.x,Ja[Ea+7]=Y.y,Ja[Ea+8]=Y.z,Ea+=9;for(G=0,U=ma.length;G<U;G++)M=Da[ma[G]],W=Ub[M.a].position,X=Ub[M.b].position,Y=Ub[M.c].position,
|
|
|
-na=Ub[M.d].position,Ja[Ea]=W.x,Ja[Ea+1]=W.y,Ja[Ea+2]=W.z,Ja[Ea+3]=X.x,Ja[Ea+4]=X.y,Ja[Ea+5]=X.z,Ja[Ea+6]=Y.x,Ja[Ea+7]=Y.y,Ja[Ea+8]=Y.z,Ja[Ea+9]=na.x,Ja[Ea+10]=na.y,Ja[Ea+11]=na.z,Ea+=12;j.bindBuffer(j.ARRAY_BUFFER,da.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ja,Za)}if(sd)for($a=0,bd=Pb.length;$a<bd;$a++){Ca=0;for(G=0,U=la.length;G<U;G++)M=Da[la[G]],W=Pb[$a].vertices[M.a].position,X=Pb[$a].vertices[M.b].position,Y=Pb[$a].vertices[M.c].position,Ha=Rc[$a],Ha[Ca]=W.x,Ha[Ca+1]=W.y,Ha[Ca+2]=W.z,
|
|
|
-Ha[Ca+3]=X.x,Ha[Ca+4]=X.y,Ha[Ca+5]=X.z,Ha[Ca+6]=Y.x,Ha[Ca+7]=Y.y,Ha[Ca+8]=Y.z,Ca+=9;for(G=0,U=ma.length;G<U;G++)M=Da[ma[G]],W=Pb[$a].vertices[M.a].position,X=Pb[$a].vertices[M.b].position,Y=Pb[$a].vertices[M.c].position,na=Pb[$a].vertices[M.d].position,Ha=Rc[$a],Ha[Ca]=W.x,Ha[Ca+1]=W.y,Ha[Ca+2]=W.z,Ha[Ca+3]=X.x,Ha[Ca+4]=X.y,Ha[Ca+5]=X.z,Ha[Ca+6]=Y.x,Ha[Ca+7]=Y.y,Ha[Ca+8]=Y.z,Ha[Ca+9]=na.x,Ha[Ca+10]=na.y,Ha[Ca+11]=na.z,Ca+=12;j.bindBuffer(j.ARRAY_BUFFER,da.__webglMorphTargetsBuffers[$a]);j.bufferData(j.ARRAY_BUFFER,
|
|
|
-Rc[$a],Za)}if(Ob.length){for(G=0,U=la.length;G<U;G++)M=Da[la[G]],sb=Ob[M.a],tb=Ob[M.b],ub=Ob[M.c],va[J]=sb.x,va[J+1]=sb.y,va[J+2]=sb.z,va[J+3]=sb.w,va[J+4]=tb.x,va[J+5]=tb.y,va[J+6]=tb.z,va[J+7]=tb.w,va[J+8]=ub.x,va[J+9]=ub.y,va[J+10]=ub.z,va[J+11]=ub.w,vb=Xb[M.a],wb=Xb[M.b],xb=Xb[M.c],ua[J]=vb.x,ua[J+1]=vb.y,ua[J+2]=vb.z,ua[J+3]=vb.w,ua[J+4]=wb.x,ua[J+5]=wb.y,ua[J+6]=wb.z,ua[J+7]=wb.w,ua[J+8]=xb.x,ua[J+9]=xb.y,ua[J+10]=xb.z,ua[J+11]=xb.w,Hb=Vb[M.a],Ib=Vb[M.b],Jb=Vb[M.c],sa[J]=Hb.x,sa[J+1]=Hb.y,sa[J+
|
|
|
-2]=Hb.z,sa[J+3]=1,sa[J+4]=Ib.x,sa[J+5]=Ib.y,sa[J+6]=Ib.z,sa[J+7]=1,sa[J+8]=Jb.x,sa[J+9]=Jb.y,sa[J+10]=Jb.z,sa[J+11]=1,Kb=Wb[M.a],Lb=Wb[M.b],Mb=Wb[M.c],ta[J]=Kb.x,ta[J+1]=Kb.y,ta[J+2]=Kb.z,ta[J+3]=1,ta[J+4]=Lb.x,ta[J+5]=Lb.y,ta[J+6]=Lb.z,ta[J+7]=1,ta[J+8]=Mb.x,ta[J+9]=Mb.y,ta[J+10]=Mb.z,ta[J+11]=1,J+=12;for(G=0,U=ma.length;G<U;G++)M=Da[ma[G]],sb=Ob[M.a],tb=Ob[M.b],ub=Ob[M.c],mc=Ob[M.d],va[J]=sb.x,va[J+1]=sb.y,va[J+2]=sb.z,va[J+3]=sb.w,va[J+4]=tb.x,va[J+5]=tb.y,va[J+6]=tb.z,va[J+7]=tb.w,va[J+8]=ub.x,
|
|
|
-va[J+9]=ub.y,va[J+10]=ub.z,va[J+11]=ub.w,va[J+12]=mc.x,va[J+13]=mc.y,va[J+14]=mc.z,va[J+15]=mc.w,vb=Xb[M.a],wb=Xb[M.b],xb=Xb[M.c],nc=Xb[M.d],ua[J]=vb.x,ua[J+1]=vb.y,ua[J+2]=vb.z,ua[J+3]=vb.w,ua[J+4]=wb.x,ua[J+5]=wb.y,ua[J+6]=wb.z,ua[J+7]=wb.w,ua[J+8]=xb.x,ua[J+9]=xb.y,ua[J+10]=xb.z,ua[J+11]=xb.w,ua[J+12]=nc.x,ua[J+13]=nc.y,ua[J+14]=nc.z,ua[J+15]=nc.w,Hb=Vb[M.a],Ib=Vb[M.b],Jb=Vb[M.c],Ac=Vb[M.d],sa[J]=Hb.x,sa[J+1]=Hb.y,sa[J+2]=Hb.z,sa[J+3]=1,sa[J+4]=Ib.x,sa[J+5]=Ib.y,sa[J+6]=Ib.z,sa[J+7]=1,sa[J+8]=
|
|
|
-Jb.x,sa[J+9]=Jb.y,sa[J+10]=Jb.z,sa[J+11]=1,sa[J+12]=Ac.x,sa[J+13]=Ac.y,sa[J+14]=Ac.z,sa[J+15]=1,Kb=Wb[M.a],Lb=Wb[M.b],Mb=Wb[M.c],Bc=Wb[M.d],ta[J]=Kb.x,ta[J+1]=Kb.y,ta[J+2]=Kb.z,ta[J+3]=1,ta[J+4]=Lb.x,ta[J+5]=Lb.y,ta[J+6]=Lb.z,ta[J+7]=1,ta[J+8]=Mb.x,ta[J+9]=Mb.y,ta[J+10]=Mb.z,ta[J+11]=1,ta[J+12]=Bc.x,ta[J+13]=Bc.y,ta[J+14]=Bc.z,ta[J+15]=1,J+=16;0<J&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,sa,Za),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinVertexBBuffer),
|
|
|
-j.bufferData(j.ARRAY_BUFFER,ta,Za),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,ua,Za),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,va,Za))}if(rd&&Qc){for(G=0,U=la.length;G<U;G++)M=Da[la[G]],lb=M.vertexColors,zc=M.color,3===lb.length&&Qc===THREE.VertexColors?(pb=lb[0],qb=lb[1],rb=lb[2]):rb=qb=pb=zc,Ka[Ba]=pb.r,Ka[Ba+1]=pb.g,Ka[Ba+2]=pb.b,Ka[Ba+3]=qb.r,Ka[Ba+4]=qb.g,Ka[Ba+5]=qb.b,Ka[Ba+6]=rb.r,Ka[Ba+7]=rb.g,Ka[Ba+8]=rb.b,
|
|
|
-Ba+=9;for(G=0,U=ma.length;G<U;G++)M=Da[ma[G]],lb=M.vertexColors,zc=M.color,4===lb.length&&Qc===THREE.VertexColors?(pb=lb[0],qb=lb[1],rb=lb[2],lc=lb[3]):lc=rb=qb=pb=zc,Ka[Ba]=pb.r,Ka[Ba+1]=pb.g,Ka[Ba+2]=pb.b,Ka[Ba+3]=qb.r,Ka[Ba+4]=qb.g,Ka[Ba+5]=qb.b,Ka[Ba+6]=rb.r,Ka[Ba+7]=rb.g,Ka[Ba+8]=rb.b,Ka[Ba+9]=lc.r,Ka[Ba+10]=lc.g,Ka[Ba+11]=lc.b,Ba+=12;0<Ba&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Ka,Za))}if(qd&&Ta.hasTangents){for(G=0,U=la.length;G<U;G++)M=Da[la[G]],Ab=
|
|
|
-M.vertexTangents,mb=Ab[0],nb=Ab[1],ob=Ab[2],ra[oa]=mb.x,ra[oa+1]=mb.y,ra[oa+2]=mb.z,ra[oa+3]=mb.w,ra[oa+4]=nb.x,ra[oa+5]=nb.y,ra[oa+6]=nb.z,ra[oa+7]=nb.w,ra[oa+8]=ob.x,ra[oa+9]=ob.y,ra[oa+10]=ob.z,ra[oa+11]=ob.w,oa+=12;for(G=0,U=ma.length;G<U;G++)M=Da[ma[G]],Ab=M.vertexTangents,mb=Ab[0],nb=Ab[1],ob=Ab[2],kc=Ab[3],ra[oa]=mb.x,ra[oa+1]=mb.y,ra[oa+2]=mb.z,ra[oa+3]=mb.w,ra[oa+4]=nb.x,ra[oa+5]=nb.y,ra[oa+6]=nb.z,ra[oa+7]=nb.w,ra[oa+8]=ob.x,ra[oa+9]=ob.y,ra[oa+10]=ob.z,ra[oa+11]=ob.w,ra[oa+12]=kc.x,ra[oa+
|
|
|
-13]=kc.y,ra[oa+14]=kc.z,ra[oa+15]=kc.w,oa+=16;j.bindBuffer(j.ARRAY_BUFFER,da.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ra,Za)}if(pd&&Yc){for(G=0,U=la.length;G<U;G++)if(M=Da[la[G]],ac=M.vertexNormals,Gb=M.normal,3===ac.length&&$c)for(ka=0;3>ka;ka++)Nb=ac[ka],fb[Pa]=Nb.x,fb[Pa+1]=Nb.y,fb[Pa+2]=Nb.z,Pa+=3;else for(ka=0;3>ka;ka++)fb[Pa]=Gb.x,fb[Pa+1]=Gb.y,fb[Pa+2]=Gb.z,Pa+=3;for(G=0,U=ma.length;G<U;G++)if(M=Da[ma[G]],ac=M.vertexNormals,Gb=M.normal,4===ac.length&&$c)for(ka=0;4>ka;ka++)Nb=ac[ka],
|
|
|
-fb[Pa]=Nb.x,fb[Pa+1]=Nb.y,fb[Pa+2]=Nb.z,Pa+=3;else for(ka=0;4>ka;ka++)fb[Pa]=Gb.x,fb[Pa+1]=Gb.y,fb[Pa+2]=Gb.z,Pa+=3;j.bindBuffer(j.ARRAY_BUFFER,da.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,fb,Za)}if(cd&&Tc&&Zc){for(G=0,U=la.length;G<U;G++)if(ib=la[G],M=Da[ib],bc=Tc[ib],void 0!==bc)for(ka=0;3>ka;ka++)dc=bc[ka],oc[Bb]=dc.u,oc[Bb+1]=dc.v,Bb+=2;for(G=0,U=ma.length;G<U;G++)if(ib=ma[G],M=Da[ib],bc=Tc[ib],void 0!==bc)for(ka=0;4>ka;ka++)dc=bc[ka],oc[Bb]=dc.u,oc[Bb+1]=dc.v,Bb+=2;0<Bb&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-da.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,oc,Za))}if(cd&&Uc&&Zc){for(G=0,U=la.length;G<U;G++)if(ib=la[G],M=Da[ib],cc=Uc[ib],void 0!==cc)for(ka=0;3>ka;ka++)ec=cc[ka],pc[Cb]=ec.u,pc[Cb+1]=ec.v,Cb+=2;for(G=0,U=ma.length;G<U;G++)if(ib=ma[G],M=Da[ib],cc=Uc[ib],void 0!==cc)for(ka=0;4>ka;ka++)ec=cc[ka],pc[Cb]=ec.u,pc[Cb+1]=ec.v,Cb+=2;0<Cb&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,pc,Za))}if(od){for(G=0,U=la.length;G<U;G++)M=Da[la[G]],yb[eb]=ya,yb[eb+1]=ya+1,yb[eb+
|
|
|
-2]=ya+2,eb+=3,Ya[Qa]=ya,Ya[Qa+1]=ya+1,Ya[Qa+2]=ya,Ya[Qa+3]=ya+2,Ya[Qa+4]=ya+1,Ya[Qa+5]=ya+2,Qa+=6,ya+=3;for(G=0,U=ma.length;G<U;G++)M=Da[ma[G]],yb[eb]=ya,yb[eb+1]=ya+1,yb[eb+2]=ya+3,yb[eb+3]=ya+1,yb[eb+4]=ya+2,yb[eb+5]=ya+3,eb+=6,Ya[Qa]=ya,Ya[Qa+1]=ya+1,Ya[Qa+2]=ya,Ya[Qa+3]=ya+3,Ya[Qa+4]=ya+1,Ya[Qa+5]=ya+2,Ya[Qa+6]=ya+2,Ya[Qa+7]=ya+3,Qa+=8,ya+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,yb,Za);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.__webglLineBuffer);
|
|
|
-j.bufferData(j.ELEMENT_ARRAY_BUFFER,Ya,Za)}if(Sc)for(ka=0,ad=Sc.length;ka<ad;ka++)if(w=Sc[ka],w.__original.needsUpdate){z=0;if(1===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,U=la.length;G<U;G++)M=Da[la[G]],w.array[z]=w.value[M.a],w.array[z+1]=w.value[M.b],w.array[z+2]=w.value[M.c],z+=3;for(G=0,U=ma.length;G<U;G++)M=Da[ma[G]],w.array[z]=w.value[M.a],w.array[z+1]=w.value[M.b],w.array[z+2]=w.value[M.c],w.array[z+3]=w.value[M.d],z+=4}else{if("faces"===w.boundTo){for(G=0,U=la.length;G<
|
|
|
-U;G++)Xa=w.value[la[G]],w.array[z]=Xa,w.array[z+1]=Xa,w.array[z+2]=Xa,z+=3;for(G=0,U=ma.length;G<U;G++)Xa=w.value[ma[G]],w.array[z]=Xa,w.array[z+1]=Xa,w.array[z+2]=Xa,w.array[z+3]=Xa,z+=4}}else if(2===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,U=la.length;G<U;G++)M=Da[la[G]],W=w.value[M.a],X=w.value[M.b],Y=w.value[M.c],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=X.x,w.array[z+3]=X.y,w.array[z+4]=Y.x,w.array[z+5]=Y.y,z+=6;for(G=0,U=ma.length;G<U;G++)M=Da[ma[G]],W=w.value[M.a],X=
|
|
|
-w.value[M.b],Y=w.value[M.c],na=w.value[M.d],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=X.x,w.array[z+3]=X.y,w.array[z+4]=Y.x,w.array[z+5]=Y.y,w.array[z+6]=na.x,w.array[z+7]=na.y,z+=8}else{if("faces"===w.boundTo){for(G=0,U=la.length;G<U;G++)Y=X=W=Xa=w.value[la[G]],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=X.x,w.array[z+3]=X.y,w.array[z+4]=Y.x,w.array[z+5]=Y.y,z+=6;for(G=0,U=ma.length;G<U;G++)na=Y=X=W=Xa=w.value[ma[G]],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=X.x,w.array[z+3]=X.y,w.array[z+
|
|
|
-4]=Y.x,w.array[z+5]=Y.y,w.array[z+6]=na.x,w.array[z+7]=na.y,z+=8}}else if(3===w.size){var ea;ea="c"===w.type?["r","g","b"]:["x","y","z"];if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,U=la.length;G<U;G++)M=Da[la[G]],W=w.value[M.a],X=w.value[M.b],Y=w.value[M.c],w.array[z]=W[ea[0]],w.array[z+1]=W[ea[1]],w.array[z+2]=W[ea[2]],w.array[z+3]=X[ea[0]],w.array[z+4]=X[ea[1]],w.array[z+5]=X[ea[2]],w.array[z+6]=Y[ea[0]],w.array[z+7]=Y[ea[1]],w.array[z+8]=Y[ea[2]],z+=9;for(G=0,U=ma.length;G<U;G++)M=Da[ma[G]],
|
|
|
-W=w.value[M.a],X=w.value[M.b],Y=w.value[M.c],na=w.value[M.d],w.array[z]=W[ea[0]],w.array[z+1]=W[ea[1]],w.array[z+2]=W[ea[2]],w.array[z+3]=X[ea[0]],w.array[z+4]=X[ea[1]],w.array[z+5]=X[ea[2]],w.array[z+6]=Y[ea[0]],w.array[z+7]=Y[ea[1]],w.array[z+8]=Y[ea[2]],w.array[z+9]=na[ea[0]],w.array[z+10]=na[ea[1]],w.array[z+11]=na[ea[2]],z+=12}else if("faces"===w.boundTo){for(G=0,U=la.length;G<U;G++)Y=X=W=Xa=w.value[la[G]],w.array[z]=W[ea[0]],w.array[z+1]=W[ea[1]],w.array[z+2]=W[ea[2]],w.array[z+3]=X[ea[0]],
|
|
|
-w.array[z+4]=X[ea[1]],w.array[z+5]=X[ea[2]],w.array[z+6]=Y[ea[0]],w.array[z+7]=Y[ea[1]],w.array[z+8]=Y[ea[2]],z+=9;for(G=0,U=ma.length;G<U;G++)na=Y=X=W=Xa=w.value[ma[G]],w.array[z]=W[ea[0]],w.array[z+1]=W[ea[1]],w.array[z+2]=W[ea[2]],w.array[z+3]=X[ea[0]],w.array[z+4]=X[ea[1]],w.array[z+5]=X[ea[2]],w.array[z+6]=Y[ea[0]],w.array[z+7]=Y[ea[1]],w.array[z+8]=Y[ea[2]],w.array[z+9]=na[ea[0]],w.array[z+10]=na[ea[1]],w.array[z+11]=na[ea[2]],z+=12}}else if(4===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=
|
|
|
-0,U=la.length;G<U;G++)M=Da[la[G]],W=w.value[M.a],X=w.value[M.b],Y=w.value[M.c],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=W.z,w.array[z+3]=W.w,w.array[z+4]=X.x,w.array[z+5]=X.y,w.array[z+6]=X.z,w.array[z+7]=X.w,w.array[z+8]=Y.x,w.array[z+9]=Y.y,w.array[z+10]=Y.z,w.array[z+11]=Y.w,z+=12;for(G=0,U=ma.length;G<U;G++)M=Da[ma[G]],W=w.value[M.a],X=w.value[M.b],Y=w.value[M.c],na=w.value[M.d],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=W.z,w.array[z+3]=W.w,w.array[z+4]=X.x,w.array[z+5]=X.y,w.array[z+6]=
|
|
|
-X.z,w.array[z+7]=X.w,w.array[z+8]=Y.x,w.array[z+9]=Y.y,w.array[z+10]=Y.z,w.array[z+11]=Y.w,w.array[z+12]=na.x,w.array[z+13]=na.y,w.array[z+14]=na.z,w.array[z+15]=na.w,z+=16}else if("faces"===w.boundTo){for(G=0,U=la.length;G<U;G++)Y=X=W=Xa=w.value[la[G]],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=W.z,w.array[z+3]=W.w,w.array[z+4]=X.x,w.array[z+5]=X.y,w.array[z+6]=X.z,w.array[z+7]=X.w,w.array[z+8]=Y.x,w.array[z+9]=Y.y,w.array[z+10]=Y.z,w.array[z+11]=Y.w,z+=12;for(G=0,U=ma.length;G<U;G++)na=Y=X=W=
|
|
|
-Xa=w.value[ma[G]],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=W.z,w.array[z+3]=W.w,w.array[z+4]=X.x,w.array[z+5]=X.y,w.array[z+6]=X.z,w.array[z+7]=X.w,w.array[z+8]=Y.x,w.array[z+9]=Y.y,w.array[z+10]=Y.z,w.array[z+11]=Y.w,w.array[z+12]=na.x,w.array[z+13]=na.y,w.array[z+14]=na.z,w.array[z+15]=na.w,z+=16}j.bindBuffer(j.ARRAY_BUFFER,w.buffer);j.bufferData(j.ARRAY_BUFFER,w.array,Za)}nd&&(delete da.__inittedArrays,delete da.__colorArray,delete da.__normalArray,delete da.__tangentArray,delete da.__uvArray,
|
|
|
-delete da.__uv2Array,delete da.__faceArray,delete da.__vertexArray,delete da.__lineArray,delete da.__skinVertexAArray,delete da.__skinVertexBArray,delete da.__skinIndexArray,delete da.__skinWeightArray)}}ha.__dirtyVertices=!1;ha.__dirtyMorphTargets=!1;ha.__dirtyElements=!1;ha.__dirtyUvs=!1;ha.__dirtyNormals=!1;ha.__dirtyColors=!1;ha.__dirtyTangents=!1;Ua.attributes&&n(Ua)}else if(kb instanceof THREE.Ribbon){if(ha.__dirtyVertices||ha.__dirtyColors){var Qb=ha,dd=j.DYNAMIC_DRAW,qc=void 0,rc=void 0,Cc=
|
|
|
-void 0,Rb=void 0,Dc=void 0,ed=Qb.vertices,fd=Qb.colors,td=ed.length,ud=fd.length,Ec=Qb.__vertexArray,Fc=Qb.__colorArray,vd=Qb.__dirtyColors;if(Qb.__dirtyVertices){for(qc=0;qc<td;qc++)Cc=ed[qc].position,Rb=3*qc,Ec[Rb]=Cc.x,Ec[Rb+1]=Cc.y,Ec[Rb+2]=Cc.z;j.bindBuffer(j.ARRAY_BUFFER,Qb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ec,dd)}if(vd){for(rc=0;rc<ud;rc++)Dc=fd[rc],Rb=3*rc,Fc[Rb]=Dc.r,Fc[Rb+1]=Dc.g,Fc[Rb+2]=Dc.b;j.bindBuffer(j.ARRAY_BUFFER,Qb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
-Fc,dd)}}ha.__dirtyVertices=!1;ha.__dirtyColors=!1}else if(kb instanceof THREE.Line){Ua=c(kb,jc);$b=Ua.attributes&&p(Ua);if(ha.__dirtyVertices||ha.__dirtyColors||$b){var Db=ha,Vc=j.DYNAMIC_DRAW,sc=void 0,tc=void 0,Gc=void 0,wa=void 0,Hc=void 0,gd=Db.vertices,hd=Db.colors,wd=gd.length,xd=hd.length,Ic=Db.__vertexArray,Jc=Db.__colorArray,yd=Db.__dirtyColors,Wc=Db.__webglCustomAttributesList,Kc=void 0,id=void 0,Oa=void 0,fc=void 0,Va=void 0,pa=void 0;if(Db.__dirtyVertices){for(sc=0;sc<wd;sc++)Gc=gd[sc].position,
|
|
|
-wa=3*sc,Ic[wa]=Gc.x,Ic[wa+1]=Gc.y,Ic[wa+2]=Gc.z;j.bindBuffer(j.ARRAY_BUFFER,Db.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ic,Vc)}if(yd){for(tc=0;tc<xd;tc++)Hc=hd[tc],wa=3*tc,Jc[wa]=Hc.r,Jc[wa+1]=Hc.g,Jc[wa+2]=Hc.b;j.bindBuffer(j.ARRAY_BUFFER,Db.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Jc,Vc)}if(Wc)for(Kc=0,id=Wc.length;Kc<id;Kc++)if(pa=Wc[Kc],pa.needsUpdate&&(void 0===pa.boundTo||"vertices"===pa.boundTo)){wa=0;fc=pa.value.length;if(1===pa.size)for(Oa=0;Oa<fc;Oa++)pa.array[Oa]=pa.value[Oa];
|
|
|
-else if(2===pa.size)for(Oa=0;Oa<fc;Oa++)Va=pa.value[Oa],pa.array[wa]=Va.x,pa.array[wa+1]=Va.y,wa+=2;else if(3===pa.size)if("c"===pa.type)for(Oa=0;Oa<fc;Oa++)Va=pa.value[Oa],pa.array[wa]=Va.r,pa.array[wa+1]=Va.g,pa.array[wa+2]=Va.b,wa+=3;else for(Oa=0;Oa<fc;Oa++)Va=pa.value[Oa],pa.array[wa]=Va.x,pa.array[wa+1]=Va.y,pa.array[wa+2]=Va.z,wa+=3;else if(4===pa.size)for(Oa=0;Oa<fc;Oa++)Va=pa.value[Oa],pa.array[wa]=Va.x,pa.array[wa+1]=Va.y,pa.array[wa+2]=Va.z,pa.array[wa+3]=Va.w,wa+=4;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-pa.buffer);j.bufferData(j.ARRAY_BUFFER,pa.array,Vc)}}ha.__dirtyVertices=!1;ha.__dirtyColors=!1;Ua.attributes&&n(Ua)}else if(kb instanceof THREE.ParticleSystem)Ua=c(kb,jc),$b=Ua.attributes&&p(Ua),(ha.__dirtyVertices||ha.__dirtyColors||kb.sortParticles||$b)&&f(ha,j.DYNAMIC_DRAW,kb),ha.__dirtyVertices=!1,ha.__dirtyColors=!1,Ua.attributes&&n(Ua)}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof
|
|
|
-THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var l=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(l.uniforms);a.vertexShader=l.vertexShader;a.fragmentShader=l.fragmentShader}var k,m;f=l=0;for(k=0,m=b.length;k<m;k++)e=b[k],e instanceof THREE.SpotLight&&!e.onlyShadow&&f++,e instanceof THREE.DirectionalLight&&
|
|
|
-f++,e instanceof THREE.PointLight&&l++;l+f<=P?k=f:(k=Math.ceil(P*f/(l+f)),l=P-k);e=k;f=l;var n=0;for(l=0,k=b.length;l<k;l++)m=b[l],m instanceof THREE.SpotLight&&m.castShadow&&n++;var p=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var o;a:{k=a.fragmentShader;m=a.vertexShader;var l=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:e,maxPointLights:f,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},q,d=[];i?d.push(i):(d.push(k),d.push(m));for(q in c)d.push(q),d.push(c[q]);i=d.join();for(q=0,d=H.length;q<d;q++)if(H[q].code===i){o=H[q].program;break a}q=j.createProgram();
|
|
|
-d=[0<Wa?"#define VERTEX_TEXTURES":"",B.gammaInput?"#define GAMMA_INPUT":"",B.gammaOutput?"#define GAMMA_OUTPUT":"",B.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.wrapAround?"#define WRAP_AROUND":"",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");
|
|
|
-e=["precision "+C+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",B.gammaInput?"#define GAMMA_INPUT":"",B.gammaOutput?"#define GAMMA_OUTPUT":"",B.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.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(q,u("fragment",
|
|
|
-e+k));j.attachShader(q,u("vertex",d+m));j.linkProgram(q);j.getProgramParameter(q,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,cameraInverseMatrix,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in l)d.push(r);r=d;for(d=0,l=r.length;d<l;d++)k=r[d],q.uniforms[k]=
|
|
|
-j.getUniformLocation(q,k);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(o in b)d.push(o);o=d;for(r=0,b=o.length;r<b;r++)c=o[r],q.attributes[c]=j.getAttribLocation(q,c);q.id=H.length;H.push({program:q,code:i});B.info.memory.programs=H.length;o=q}a.program=o;o=a.program.attributes;0<=o.position&&j.enableVertexAttribArray(o.position);0<=o.color&&j.enableVertexAttribArray(o.color);0<=o.normal&&
|
|
|
-j.enableVertexAttribArray(o.normal);0<=o.tangent&&j.enableVertexAttribArray(o.tangent);a.skinning&&0<=o.skinVertexA&&0<=o.skinVertexB&&0<=o.skinIndex&&0<=o.skinWeight&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==o[h]&&0<=o[h]&&j.enableVertexAttribArray(o[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)r=
|
|
|
-"morphTarget"+h,0<=o[r]&&(j.enableVertexAttribArray(o[r]),a.numSupportedMorphTargets++);a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?j.frontFace(j.CCW):j.frontFace(j.CW),"back"===a?j.cullFace(j.BACK):"front"===a?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if(aa!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),
|
|
|
-aa=a.doubleSided;if(ga!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ga=a.flipSided};this.setDepthTest=function(a){S!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),S=a)};this.setBlending=function(a){if(a!==fa){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);
|
|
|
-j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}fa=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),B.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=D(a.format),f=D(a.type);x(j.TEXTURE_2D,
|
|
|
-a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=
|
|
|
-!0;a.__webglTexture=j.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=D(a.format),e=D(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);x(j.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,0,d,e,null);var f=a,g=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,
|
|
|
-a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,g,f.__webglTexture,0);v(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),x(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),v(a.__webglRenderbuffer,
|
|
|
-a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=qa,a=Ga,e=ja,c=za);b!==y&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(e,c,d,a),y=b);Fa=d;ab=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
|
+j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ha&&(j.lineWidth(d),ha=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
+e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),E.info.render.calls++,E.info.render.vertices+=e.__webglFaceCount,E.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ha&&(j.lineWidth(d),ha=d),j.drawArrays(f,0,e.__webglLineCount),E.info.render.calls++):f instanceof
|
|
|
+THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),E.info.render.calls++,E.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),E.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,k,m,o=a.lights,p=a.fog;y=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();
|
|
|
+h(this.renderPluginsPre,a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;E.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Ta.multiply(b.projectionMatrix,b.matrixWorldInverse);Sa.setFromMatrix(Ta);this.setRenderTarget(c);
|
|
|
+(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;for(d=0,e=m.length;d<e;d++)if(f=m[d],k=f.object,f.render=!1,k.visible&&(!(k instanceof THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||Sa.contains(k))){k.matrixWorld.flattenToArray(k._objectMatrixArray);r(k,b);var n=f,q=n.object,F=n.buffer,t=void 0,t=t=void 0,t=q.material;if(t instanceof THREE.MeshFaceMaterial){if(t=F.materialIndex,0<=t)t=q.geometry.materials[t],t.transparent?
|
|
|
+(n.transparent=t,n.opaque=null):(n.opaque=t,n.transparent=null)}else if(t)t.transparent?(n.transparent=t,n.opaque=null):(n.opaque=t,n.transparent=null);f.render=!0;if(this.sortObjects)k.renderDepth?f.z=k.renderDepth:(Wa.copy(k.position),Ta.multiplyVector3(Wa),f.z=Wa.z)}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;for(d=0,e=m.length;d<e;d++)if(f=m[d],k=f.object,k.visible)k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),r(k,b),k=f.object.material,k.transparent?(f.transparent=
|
|
|
+k,f.opaque=null):(f.opaque=k,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,o,p,!0,a.overrideMaterial),l(a.__webglObjectsImmediate,"",b,o,p,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,
|
|
|
+"opaque",b,o,p,!1),l(a.__webglObjectsImmediate,"opaque",b,o,p,!1),i(a.__webglObjects,!1,"transparent",b,o,p,!0),l(a.__webglObjectsImmediate,"transparent",b,o,p,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),
|
|
|
+j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var f=m(a,b,c,d,e);F=-1;E.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Sa):e.render(function(a){E.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=
|
|
|
+a.__objectsAdded[0],h=a,i=void 0,l=void 0,m=void 0;if(!g.__webglInit)if(g.__webglInit=!0,g._modelViewMatrix=new THREE.Matrix4,g._normalMatrixArray=new Float32Array(9),g._modelViewMatrixArray=new Float32Array(16),g._objectMatrixArray=new Float32Array(16),g.matrixWorld.flattenToArray(g._objectMatrixArray),g instanceof THREE.Mesh){if(l=g.geometry,l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var r=l,s=void 0,t=void 0,F=void 0,w=void 0,y=void 0,x=void 0,u=void 0,B={},C=r.morphTargets.length;
|
|
|
+r.geometryGroups={};for(s=0,t=r.faces.length;s<t;s++)F=r.faces[s],w=F.materialIndex,x=void 0!==w?w:-1,void 0===B[x]&&(B[x]={hash:x,counter:0}),u=B[x].hash+"_"+B[x].counter,void 0===r.geometryGroups[u]&&(r.geometryGroups[u]={faces3:[],faces4:[],materialIndex:w,vertices:0,numMorphTargets:C}),y=F instanceof THREE.Face3?3:4,65535<r.geometryGroups[u].vertices+y&&(B[x].counter+=1,u=B[x].hash+"_"+B[x].counter,void 0===r.geometryGroups[u]&&(r.geometryGroups[u]={faces3:[],faces4:[],materialIndex:w,vertices:0,
|
|
|
+numMorphTargets:C})),F instanceof THREE.Face3?r.geometryGroups[u].faces3.push(s):r.geometryGroups[u].faces4.push(s),r.geometryGroups[u].vertices+=y;r.geometryGroupsList=[];var $=void 0;for($ in r.geometryGroups)r.geometryGroups[$].id=P++,r.geometryGroupsList.push(r.geometryGroups[$])}for(i in l.geometryGroups)if(m=l.geometryGroups[i],!m.__webglVertexBuffer){var A=m;A.__webglVertexBuffer=j.createBuffer();A.__webglNormalBuffer=j.createBuffer();A.__webglTangentBuffer=j.createBuffer();A.__webglColorBuffer=
|
|
|
+j.createBuffer();A.__webglUVBuffer=j.createBuffer();A.__webglUV2Buffer=j.createBuffer();A.__webglSkinVertexABuffer=j.createBuffer();A.__webglSkinVertexBBuffer=j.createBuffer();A.__webglSkinIndicesBuffer=j.createBuffer();A.__webglSkinWeightsBuffer=j.createBuffer();A.__webglFaceBuffer=j.createBuffer();A.__webglLineBuffer=j.createBuffer();if(A.numMorphTargets){var D=void 0,I=void 0;A.__webglMorphTargetsBuffers=[];for(D=0,I=A.numMorphTargets;D<I;D++)A.__webglMorphTargetsBuffers.push(j.createBuffer())}E.info.memory.geometries++;
|
|
|
+var G=m,S=g,Z=S.geometry,L=G.faces3,K=G.faces4,M=3*L.length+4*K.length,fa=1*L.length+2*K.length,Q=3*L.length+4*K.length,aa=c(S,G),ba=e(aa),ca=d(aa),ga=aa.vertexColors?aa.vertexColors:!1;G.__vertexArray=new Float32Array(3*M);if(ca)G.__normalArray=new Float32Array(3*M);if(Z.hasTangents)G.__tangentArray=new Float32Array(4*M);if(ga)G.__colorArray=new Float32Array(3*M);if(ba){if(0<Z.faceUvs.length||0<Z.faceVertexUvs.length)G.__uvArray=new Float32Array(2*M);if(1<Z.faceUvs.length||1<Z.faceVertexUvs.length)G.__uv2Array=
|
|
|
+new Float32Array(2*M)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length)G.__skinVertexAArray=new Float32Array(4*M),G.__skinVertexBArray=new Float32Array(4*M),G.__skinIndexArray=new Float32Array(4*M),G.__skinWeightArray=new Float32Array(4*M);G.__faceArray=new Uint16Array(3*fa);G.__lineArray=new Uint16Array(2*Q);if(G.numMorphTargets){G.__morphTargetsArrays=[];for(var R=0,ha=G.numMorphTargets;R<ha;R++)G.__morphTargetsArrays.push(new Float32Array(3*M))}G.__webglFaceCount=3*fa;G.__webglLineCount=
|
|
|
+2*Q;if(aa.attributes){if(void 0===G.__webglCustomAttributesList)G.__webglCustomAttributesList=[];var T=void 0;for(T in aa.attributes){var Na=aa.attributes[T],ja={},za;for(za in Na)ja[za]=Na[za];if(!ja.__webglInitialized||ja.createUniqueBuffers){ja.__webglInitialized=!0;var qa=1;"v2"===ja.type?qa=2:"v3"===ja.type?qa=3:"v4"===ja.type?qa=4:"c"===ja.type&&(qa=3);ja.size=qa;ja.array=new Float32Array(M*qa);ja.buffer=j.createBuffer();ja.buffer.belongsToAttribute=T;Na.needsUpdate=!0;ja.__original=Na}G.__webglCustomAttributesList.push(ja)}}G.__inittedArrays=
|
|
|
+!0;l.__dirtyVertices=!0;l.__dirtyMorphTargets=!0;l.__dirtyElements=!0;l.__dirtyUvs=!0;l.__dirtyNormals=!0;l.__dirtyTangents=!0;l.__dirtyColors=!0}}}else if(g instanceof THREE.Ribbon){if(l=g.geometry,!l.__webglVertexBuffer){var Ea=l;Ea.__webglVertexBuffer=j.createBuffer();Ea.__webglColorBuffer=j.createBuffer();E.info.memory.geometries++;var Ga=l,Ta=Ga.vertices.length;Ga.__vertexArray=new Float32Array(3*Ta);Ga.__colorArray=new Float32Array(3*Ta);Ga.__webglVertexCount=Ta;l.__dirtyVertices=!0;l.__dirtyColors=
|
|
|
+!0}}else if(g instanceof THREE.Line){if(l=g.geometry,!l.__webglVertexBuffer){var Wa=l;Wa.__webglVertexBuffer=j.createBuffer();Wa.__webglColorBuffer=j.createBuffer();E.info.memory.geometries++;var Sa=l,fb=g,Za=Sa.vertices.length;Sa.__vertexArray=new Float32Array(3*Za);Sa.__colorArray=new Float32Array(3*Za);Sa.__webglLineCount=Za;b(Sa,fb);l.__dirtyVertices=!0;l.__dirtyColors=!0}}else if(g instanceof THREE.ParticleSystem&&(l=g.geometry,!l.__webglVertexBuffer)){var lb=l;lb.__webglVertexBuffer=j.createBuffer();
|
|
|
+lb.__webglColorBuffer=j.createBuffer();E.info.geometries++;var $b=l,kd=g,Oc=$b.vertices.length;$b.__vertexArray=new Float32Array(3*Oc);$b.__colorArray=new Float32Array(3*Oc);$b.__sortArray=[];$b.__webglParticleCount=Oc;b($b,kd);l.__dirtyVertices=!0;l.__dirtyColors=!0}if(!g.__webglActive){if(g instanceof THREE.Mesh)if(l=g.geometry,l instanceof THREE.BufferGeometry)k(h.__webglObjects,l,g);else for(i in l.geometryGroups)m=l.geometryGroups[i],k(h.__webglObjects,m,g);else g instanceof THREE.Ribbon||g instanceof
|
|
|
+THREE.Line||g instanceof THREE.ParticleSystem?(l=g.geometry,k(h.__webglObjects,l,g)):void 0!==THREE.MarchingCubes&&g instanceof THREE.MarchingCubes||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var cb=a.__objectsRemoved[0],xc=a;cb instanceof THREE.Mesh||cb instanceof
|
|
|
+THREE.ParticleSystem||cb instanceof THREE.Ribbon||cb instanceof THREE.Line?n(xc.__webglObjects,cb):cb instanceof THREE.Sprite?q(xc.__webglSprites,cb):cb instanceof THREE.LensFlare?q(xc.__webglFlares,cb):(cb instanceof THREE.MarchingCubes||cb.immediateRenderCallback)&&n(xc.__webglObjectsImmediate,cb);cb.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Pc=0,ld=a.__webglObjects.length;Pc<ld;Pc++){var jb=a.__webglObjects[Pc].object,ia=jb.geometry,kc=void 0,ac=void 0,Ua=void 0;if(jb instanceof THREE.Mesh)if(ia instanceof
|
|
|
+THREE.BufferGeometry)ia.__dirtyVertices=!1,ia.__dirtyElements=!1,ia.__dirtyUvs=!1,ia.__dirtyNormals=!1,ia.__dirtyColors=!1;else{for(var Qc=0,md=ia.geometryGroupsList.length;Qc<md;Qc++)if(kc=ia.geometryGroupsList[Qc],Ua=c(jb,kc),ac=Ua.attributes&&p(Ua),ia.__dirtyVertices||ia.__dirtyMorphTargets||ia.__dirtyElements||ia.__dirtyUvs||ia.__dirtyNormals||ia.__dirtyColors||ia.__dirtyTangents||ac){var da=kc,nd=jb,$a=j.DYNAMIC_DRAW,od=!ia.dynamic,zc=Ua;if(da.__inittedArrays){var Zc=d(zc),Rc=zc.vertexColors?
|
|
|
+zc.vertexColors:!1,$c=e(zc),ad=Zc===THREE.SmoothShading,H=void 0,U=void 0,hb=void 0,N=void 0,bc=void 0,Gb=void 0,kb=void 0,Ac=void 0,Ab=void 0,cc=void 0,dc=void 0,V=void 0,W=void 0,X=void 0,na=void 0,mb=void 0,nb=void 0,ob=void 0,lc=void 0,pb=void 0,qb=void 0,rb=void 0,mc=void 0,sb=void 0,tb=void 0,ub=void 0,nc=void 0,vb=void 0,wb=void 0,xb=void 0,oc=void 0,Hb=void 0,Ib=void 0,Jb=void 0,Bc=void 0,Kb=void 0,Lb=void 0,Mb=void 0,Cc=void 0,ka=void 0,bd=void 0,Nb=void 0,ec=void 0,fc=void 0,ab=void 0,cd=
|
|
|
+void 0,Fa=void 0,ya=0,Da=0,Bb=0,Cb=0,db=0,Pa=0,oa=0,Qa=0,Aa=0,J=0,Ba=0,z=0,Xa=void 0,Ia=da.__vertexArray,pc=da.__uvArray,qc=da.__uv2Array,eb=da.__normalArray,ra=da.__tangentArray,Ja=da.__colorArray,sa=da.__skinVertexAArray,ta=da.__skinVertexBArray,ua=da.__skinIndexArray,va=da.__skinWeightArray,Sc=da.__morphTargetsArrays,Tc=da.__webglCustomAttributesList,v=void 0,yb=da.__faceArray,Ya=da.__lineArray,Ra=nd.geometry,pd=Ra.__dirtyElements,dd=Ra.__dirtyUvs,qd=Ra.__dirtyNormals,rd=Ra.__dirtyTangents,sd=
|
|
|
+Ra.__dirtyColors,td=Ra.__dirtyMorphTargets,Ub=Ra.vertices,la=da.faces3,ma=da.faces4,Ca=Ra.faces,Uc=Ra.faceVertexUvs[0],Vc=Ra.faceVertexUvs[1],Vb=Ra.skinVerticesA,Wb=Ra.skinVerticesB,Xb=Ra.skinIndices,Ob=Ra.skinWeights,Pb=Ra.morphTargets;if(Ra.__dirtyVertices){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],V=Ub[N.a].position,W=Ub[N.b].position,X=Ub[N.c].position,Ia[Da]=V.x,Ia[Da+1]=V.y,Ia[Da+2]=V.z,Ia[Da+3]=W.x,Ia[Da+4]=W.y,Ia[Da+5]=W.z,Ia[Da+6]=X.x,Ia[Da+7]=X.y,Ia[Da+8]=X.z,Da+=9;for(H=0,U=ma.length;H<U;H++)N=
|
|
|
+Ca[ma[H]],V=Ub[N.a].position,W=Ub[N.b].position,X=Ub[N.c].position,na=Ub[N.d].position,Ia[Da]=V.x,Ia[Da+1]=V.y,Ia[Da+2]=V.z,Ia[Da+3]=W.x,Ia[Da+4]=W.y,Ia[Da+5]=W.z,Ia[Da+6]=X.x,Ia[Da+7]=X.y,Ia[Da+8]=X.z,Ia[Da+9]=na.x,Ia[Da+10]=na.y,Ia[Da+11]=na.z,Da+=12;j.bindBuffer(j.ARRAY_BUFFER,da.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ia,$a)}if(td)for(ab=0,cd=Pb.length;ab<cd;ab++){Ba=0;for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],V=Pb[ab].vertices[N.a].position,W=Pb[ab].vertices[N.b].position,X=Pb[ab].vertices[N.c].position,
|
|
|
+Fa=Sc[ab],Fa[Ba]=V.x,Fa[Ba+1]=V.y,Fa[Ba+2]=V.z,Fa[Ba+3]=W.x,Fa[Ba+4]=W.y,Fa[Ba+5]=W.z,Fa[Ba+6]=X.x,Fa[Ba+7]=X.y,Fa[Ba+8]=X.z,Ba+=9;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],V=Pb[ab].vertices[N.a].position,W=Pb[ab].vertices[N.b].position,X=Pb[ab].vertices[N.c].position,na=Pb[ab].vertices[N.d].position,Fa=Sc[ab],Fa[Ba]=V.x,Fa[Ba+1]=V.y,Fa[Ba+2]=V.z,Fa[Ba+3]=W.x,Fa[Ba+4]=W.y,Fa[Ba+5]=W.z,Fa[Ba+6]=X.x,Fa[Ba+7]=X.y,Fa[Ba+8]=X.z,Fa[Ba+9]=na.x,Fa[Ba+10]=na.y,Fa[Ba+11]=na.z,Ba+=12;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+da.__webglMorphTargetsBuffers[ab]);j.bufferData(j.ARRAY_BUFFER,Sc[ab],$a)}if(Ob.length){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],sb=Ob[N.a],tb=Ob[N.b],ub=Ob[N.c],va[J]=sb.x,va[J+1]=sb.y,va[J+2]=sb.z,va[J+3]=sb.w,va[J+4]=tb.x,va[J+5]=tb.y,va[J+6]=tb.z,va[J+7]=tb.w,va[J+8]=ub.x,va[J+9]=ub.y,va[J+10]=ub.z,va[J+11]=ub.w,vb=Xb[N.a],wb=Xb[N.b],xb=Xb[N.c],ua[J]=vb.x,ua[J+1]=vb.y,ua[J+2]=vb.z,ua[J+3]=vb.w,ua[J+4]=wb.x,ua[J+5]=wb.y,ua[J+6]=wb.z,ua[J+7]=wb.w,ua[J+8]=xb.x,ua[J+9]=xb.y,ua[J+10]=xb.z,ua[J+11]=
|
|
|
+xb.w,Hb=Vb[N.a],Ib=Vb[N.b],Jb=Vb[N.c],sa[J]=Hb.x,sa[J+1]=Hb.y,sa[J+2]=Hb.z,sa[J+3]=1,sa[J+4]=Ib.x,sa[J+5]=Ib.y,sa[J+6]=Ib.z,sa[J+7]=1,sa[J+8]=Jb.x,sa[J+9]=Jb.y,sa[J+10]=Jb.z,sa[J+11]=1,Kb=Wb[N.a],Lb=Wb[N.b],Mb=Wb[N.c],ta[J]=Kb.x,ta[J+1]=Kb.y,ta[J+2]=Kb.z,ta[J+3]=1,ta[J+4]=Lb.x,ta[J+5]=Lb.y,ta[J+6]=Lb.z,ta[J+7]=1,ta[J+8]=Mb.x,ta[J+9]=Mb.y,ta[J+10]=Mb.z,ta[J+11]=1,J+=12;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],sb=Ob[N.a],tb=Ob[N.b],ub=Ob[N.c],nc=Ob[N.d],va[J]=sb.x,va[J+1]=sb.y,va[J+2]=sb.z,va[J+3]=sb.w,
|
|
|
+va[J+4]=tb.x,va[J+5]=tb.y,va[J+6]=tb.z,va[J+7]=tb.w,va[J+8]=ub.x,va[J+9]=ub.y,va[J+10]=ub.z,va[J+11]=ub.w,va[J+12]=nc.x,va[J+13]=nc.y,va[J+14]=nc.z,va[J+15]=nc.w,vb=Xb[N.a],wb=Xb[N.b],xb=Xb[N.c],oc=Xb[N.d],ua[J]=vb.x,ua[J+1]=vb.y,ua[J+2]=vb.z,ua[J+3]=vb.w,ua[J+4]=wb.x,ua[J+5]=wb.y,ua[J+6]=wb.z,ua[J+7]=wb.w,ua[J+8]=xb.x,ua[J+9]=xb.y,ua[J+10]=xb.z,ua[J+11]=xb.w,ua[J+12]=oc.x,ua[J+13]=oc.y,ua[J+14]=oc.z,ua[J+15]=oc.w,Hb=Vb[N.a],Ib=Vb[N.b],Jb=Vb[N.c],Bc=Vb[N.d],sa[J]=Hb.x,sa[J+1]=Hb.y,sa[J+2]=Hb.z,sa[J+
|
|
|
+3]=1,sa[J+4]=Ib.x,sa[J+5]=Ib.y,sa[J+6]=Ib.z,sa[J+7]=1,sa[J+8]=Jb.x,sa[J+9]=Jb.y,sa[J+10]=Jb.z,sa[J+11]=1,sa[J+12]=Bc.x,sa[J+13]=Bc.y,sa[J+14]=Bc.z,sa[J+15]=1,Kb=Wb[N.a],Lb=Wb[N.b],Mb=Wb[N.c],Cc=Wb[N.d],ta[J]=Kb.x,ta[J+1]=Kb.y,ta[J+2]=Kb.z,ta[J+3]=1,ta[J+4]=Lb.x,ta[J+5]=Lb.y,ta[J+6]=Lb.z,ta[J+7]=1,ta[J+8]=Mb.x,ta[J+9]=Mb.y,ta[J+10]=Mb.z,ta[J+11]=1,ta[J+12]=Cc.x,ta[J+13]=Cc.y,ta[J+14]=Cc.z,ta[J+15]=1,J+=16;0<J&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,sa,
|
|
|
+$a),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,ta,$a),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,ua,$a),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,va,$a))}if(sd&&Rc){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],kb=N.vertexColors,Ac=N.color,3===kb.length&&Rc===THREE.VertexColors?(pb=kb[0],qb=kb[1],rb=kb[2]):rb=qb=pb=Ac,Ja[Aa]=pb.r,Ja[Aa+1]=pb.g,Ja[Aa+2]=pb.b,Ja[Aa+3]=qb.r,Ja[Aa+
|
|
|
+4]=qb.g,Ja[Aa+5]=qb.b,Ja[Aa+6]=rb.r,Ja[Aa+7]=rb.g,Ja[Aa+8]=rb.b,Aa+=9;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],kb=N.vertexColors,Ac=N.color,4===kb.length&&Rc===THREE.VertexColors?(pb=kb[0],qb=kb[1],rb=kb[2],mc=kb[3]):mc=rb=qb=pb=Ac,Ja[Aa]=pb.r,Ja[Aa+1]=pb.g,Ja[Aa+2]=pb.b,Ja[Aa+3]=qb.r,Ja[Aa+4]=qb.g,Ja[Aa+5]=qb.b,Ja[Aa+6]=rb.r,Ja[Aa+7]=rb.g,Ja[Aa+8]=rb.b,Ja[Aa+9]=mc.r,Ja[Aa+10]=mc.g,Ja[Aa+11]=mc.b,Aa+=12;0<Aa&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Ja,$a))}if(rd&&
|
|
|
+Ra.hasTangents){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],Ab=N.vertexTangents,mb=Ab[0],nb=Ab[1],ob=Ab[2],ra[oa]=mb.x,ra[oa+1]=mb.y,ra[oa+2]=mb.z,ra[oa+3]=mb.w,ra[oa+4]=nb.x,ra[oa+5]=nb.y,ra[oa+6]=nb.z,ra[oa+7]=nb.w,ra[oa+8]=ob.x,ra[oa+9]=ob.y,ra[oa+10]=ob.z,ra[oa+11]=ob.w,oa+=12;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],Ab=N.vertexTangents,mb=Ab[0],nb=Ab[1],ob=Ab[2],lc=Ab[3],ra[oa]=mb.x,ra[oa+1]=mb.y,ra[oa+2]=mb.z,ra[oa+3]=mb.w,ra[oa+4]=nb.x,ra[oa+5]=nb.y,ra[oa+6]=nb.z,ra[oa+7]=nb.w,ra[oa+8]=ob.x,ra[oa+
|
|
|
+9]=ob.y,ra[oa+10]=ob.z,ra[oa+11]=ob.w,ra[oa+12]=lc.x,ra[oa+13]=lc.y,ra[oa+14]=lc.z,ra[oa+15]=lc.w,oa+=16;j.bindBuffer(j.ARRAY_BUFFER,da.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ra,$a)}if(qd&&Zc){for(H=0,U=la.length;H<U;H++)if(N=Ca[la[H]],bc=N.vertexNormals,Gb=N.normal,3===bc.length&&ad)for(ka=0;3>ka;ka++)Nb=bc[ka],eb[Pa]=Nb.x,eb[Pa+1]=Nb.y,eb[Pa+2]=Nb.z,Pa+=3;else for(ka=0;3>ka;ka++)eb[Pa]=Gb.x,eb[Pa+1]=Gb.y,eb[Pa+2]=Gb.z,Pa+=3;for(H=0,U=ma.length;H<U;H++)if(N=Ca[ma[H]],bc=N.vertexNormals,
|
|
|
+Gb=N.normal,4===bc.length&&ad)for(ka=0;4>ka;ka++)Nb=bc[ka],eb[Pa]=Nb.x,eb[Pa+1]=Nb.y,eb[Pa+2]=Nb.z,Pa+=3;else for(ka=0;4>ka;ka++)eb[Pa]=Gb.x,eb[Pa+1]=Gb.y,eb[Pa+2]=Gb.z,Pa+=3;j.bindBuffer(j.ARRAY_BUFFER,da.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,eb,$a)}if(dd&&Uc&&$c){for(H=0,U=la.length;H<U;H++)if(hb=la[H],N=Ca[hb],cc=Uc[hb],void 0!==cc)for(ka=0;3>ka;ka++)ec=cc[ka],pc[Bb]=ec.u,pc[Bb+1]=ec.v,Bb+=2;for(H=0,U=ma.length;H<U;H++)if(hb=ma[H],N=Ca[hb],cc=Uc[hb],void 0!==cc)for(ka=0;4>ka;ka++)ec=
|
|
|
+cc[ka],pc[Bb]=ec.u,pc[Bb+1]=ec.v,Bb+=2;0<Bb&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,pc,$a))}if(dd&&Vc&&$c){for(H=0,U=la.length;H<U;H++)if(hb=la[H],N=Ca[hb],dc=Vc[hb],void 0!==dc)for(ka=0;3>ka;ka++)fc=dc[ka],qc[Cb]=fc.u,qc[Cb+1]=fc.v,Cb+=2;for(H=0,U=ma.length;H<U;H++)if(hb=ma[H],N=Ca[hb],dc=Vc[hb],void 0!==dc)for(ka=0;4>ka;ka++)fc=dc[ka],qc[Cb]=fc.u,qc[Cb+1]=fc.v,Cb+=2;0<Cb&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,qc,$a))}if(pd){for(H=
|
|
|
+0,U=la.length;H<U;H++)N=Ca[la[H]],yb[db]=ya,yb[db+1]=ya+1,yb[db+2]=ya+2,db+=3,Ya[Qa]=ya,Ya[Qa+1]=ya+1,Ya[Qa+2]=ya,Ya[Qa+3]=ya+2,Ya[Qa+4]=ya+1,Ya[Qa+5]=ya+2,Qa+=6,ya+=3;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],yb[db]=ya,yb[db+1]=ya+1,yb[db+2]=ya+3,yb[db+3]=ya+1,yb[db+4]=ya+2,yb[db+5]=ya+3,db+=6,Ya[Qa]=ya,Ya[Qa+1]=ya+1,Ya[Qa+2]=ya,Ya[Qa+3]=ya+3,Ya[Qa+4]=ya+1,Ya[Qa+5]=ya+2,Ya[Qa+6]=ya+2,Ya[Qa+7]=ya+3,Qa+=8,ya+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,
|
|
|
+yb,$a);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Ya,$a)}if(Tc)for(ka=0,bd=Tc.length;ka<bd;ka++)if(v=Tc[ka],v.__original.needsUpdate){z=0;if(1===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],v.array[z]=v.value[N.a],v.array[z+1]=v.value[N.b],v.array[z+2]=v.value[N.c],z+=3;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],v.array[z]=v.value[N.a],v.array[z+1]=v.value[N.b],v.array[z+2]=v.value[N.c],v.array[z+3]=v.value[N.d],
|
|
|
+z+=4}else{if("faces"===v.boundTo){for(H=0,U=la.length;H<U;H++)Xa=v.value[la[H]],v.array[z]=Xa,v.array[z+1]=Xa,v.array[z+2]=Xa,z+=3;for(H=0,U=ma.length;H<U;H++)Xa=v.value[ma[H]],v.array[z]=Xa,v.array[z+1]=Xa,v.array[z+2]=Xa,v.array[z+3]=Xa,z+=4}}else if(2===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],V=v.value[N.a],W=v.value[N.b],X=v.value[N.c],v.array[z]=V.x,v.array[z+1]=V.y,v.array[z+2]=W.x,v.array[z+3]=W.y,v.array[z+4]=X.x,v.array[z+5]=X.y,z+=6;
|
|
|
+for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],V=v.value[N.a],W=v.value[N.b],X=v.value[N.c],na=v.value[N.d],v.array[z]=V.x,v.array[z+1]=V.y,v.array[z+2]=W.x,v.array[z+3]=W.y,v.array[z+4]=X.x,v.array[z+5]=X.y,v.array[z+6]=na.x,v.array[z+7]=na.y,z+=8}else{if("faces"===v.boundTo){for(H=0,U=la.length;H<U;H++)X=W=V=Xa=v.value[la[H]],v.array[z]=V.x,v.array[z+1]=V.y,v.array[z+2]=W.x,v.array[z+3]=W.y,v.array[z+4]=X.x,v.array[z+5]=X.y,z+=6;for(H=0,U=ma.length;H<U;H++)na=X=W=V=Xa=v.value[ma[H]],v.array[z]=V.x,v.array[z+
|
|
|
+1]=V.y,v.array[z+2]=W.x,v.array[z+3]=W.y,v.array[z+4]=X.x,v.array[z+5]=X.y,v.array[z+6]=na.x,v.array[z+7]=na.y,z+=8}}else if(3===v.size){var ea;ea="c"===v.type?["r","g","b"]:["x","y","z"];if(void 0===v.boundTo||"vertices"===v.boundTo){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],V=v.value[N.a],W=v.value[N.b],X=v.value[N.c],v.array[z]=V[ea[0]],v.array[z+1]=V[ea[1]],v.array[z+2]=V[ea[2]],v.array[z+3]=W[ea[0]],v.array[z+4]=W[ea[1]],v.array[z+5]=W[ea[2]],v.array[z+6]=X[ea[0]],v.array[z+7]=X[ea[1]],v.array[z+
|
|
|
+8]=X[ea[2]],z+=9;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],V=v.value[N.a],W=v.value[N.b],X=v.value[N.c],na=v.value[N.d],v.array[z]=V[ea[0]],v.array[z+1]=V[ea[1]],v.array[z+2]=V[ea[2]],v.array[z+3]=W[ea[0]],v.array[z+4]=W[ea[1]],v.array[z+5]=W[ea[2]],v.array[z+6]=X[ea[0]],v.array[z+7]=X[ea[1]],v.array[z+8]=X[ea[2]],v.array[z+9]=na[ea[0]],v.array[z+10]=na[ea[1]],v.array[z+11]=na[ea[2]],z+=12}else if("faces"===v.boundTo){for(H=0,U=la.length;H<U;H++)X=W=V=Xa=v.value[la[H]],v.array[z]=V[ea[0]],v.array[z+
|
|
|
+1]=V[ea[1]],v.array[z+2]=V[ea[2]],v.array[z+3]=W[ea[0]],v.array[z+4]=W[ea[1]],v.array[z+5]=W[ea[2]],v.array[z+6]=X[ea[0]],v.array[z+7]=X[ea[1]],v.array[z+8]=X[ea[2]],z+=9;for(H=0,U=ma.length;H<U;H++)na=X=W=V=Xa=v.value[ma[H]],v.array[z]=V[ea[0]],v.array[z+1]=V[ea[1]],v.array[z+2]=V[ea[2]],v.array[z+3]=W[ea[0]],v.array[z+4]=W[ea[1]],v.array[z+5]=W[ea[2]],v.array[z+6]=X[ea[0]],v.array[z+7]=X[ea[1]],v.array[z+8]=X[ea[2]],v.array[z+9]=na[ea[0]],v.array[z+10]=na[ea[1]],v.array[z+11]=na[ea[2]],z+=12}}else if(4===
|
|
|
+v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],V=v.value[N.a],W=v.value[N.b],X=v.value[N.c],v.array[z]=V.x,v.array[z+1]=V.y,v.array[z+2]=V.z,v.array[z+3]=V.w,v.array[z+4]=W.x,v.array[z+5]=W.y,v.array[z+6]=W.z,v.array[z+7]=W.w,v.array[z+8]=X.x,v.array[z+9]=X.y,v.array[z+10]=X.z,v.array[z+11]=X.w,z+=12;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],V=v.value[N.a],W=v.value[N.b],X=v.value[N.c],na=v.value[N.d],v.array[z]=V.x,v.array[z+1]=V.y,v.array[z+2]=V.z,v.array[z+
|
|
|
+3]=V.w,v.array[z+4]=W.x,v.array[z+5]=W.y,v.array[z+6]=W.z,v.array[z+7]=W.w,v.array[z+8]=X.x,v.array[z+9]=X.y,v.array[z+10]=X.z,v.array[z+11]=X.w,v.array[z+12]=na.x,v.array[z+13]=na.y,v.array[z+14]=na.z,v.array[z+15]=na.w,z+=16}else if("faces"===v.boundTo){for(H=0,U=la.length;H<U;H++)X=W=V=Xa=v.value[la[H]],v.array[z]=V.x,v.array[z+1]=V.y,v.array[z+2]=V.z,v.array[z+3]=V.w,v.array[z+4]=W.x,v.array[z+5]=W.y,v.array[z+6]=W.z,v.array[z+7]=W.w,v.array[z+8]=X.x,v.array[z+9]=X.y,v.array[z+10]=X.z,v.array[z+
|
|
|
+11]=X.w,z+=12;for(H=0,U=ma.length;H<U;H++)na=X=W=V=Xa=v.value[ma[H]],v.array[z]=V.x,v.array[z+1]=V.y,v.array[z+2]=V.z,v.array[z+3]=V.w,v.array[z+4]=W.x,v.array[z+5]=W.y,v.array[z+6]=W.z,v.array[z+7]=W.w,v.array[z+8]=X.x,v.array[z+9]=X.y,v.array[z+10]=X.z,v.array[z+11]=X.w,v.array[z+12]=na.x,v.array[z+13]=na.y,v.array[z+14]=na.z,v.array[z+15]=na.w,z+=16}j.bindBuffer(j.ARRAY_BUFFER,v.buffer);j.bufferData(j.ARRAY_BUFFER,v.array,$a)}od&&(delete da.__inittedArrays,delete da.__colorArray,delete da.__normalArray,
|
|
|
+delete da.__tangentArray,delete da.__uvArray,delete da.__uv2Array,delete da.__faceArray,delete da.__vertexArray,delete da.__lineArray,delete da.__skinVertexAArray,delete da.__skinVertexBArray,delete da.__skinIndexArray,delete da.__skinWeightArray)}}ia.__dirtyVertices=!1;ia.__dirtyMorphTargets=!1;ia.__dirtyElements=!1;ia.__dirtyUvs=!1;ia.__dirtyNormals=!1;ia.__dirtyColors=!1;ia.__dirtyTangents=!1;Ua.attributes&&o(Ua)}else if(jb instanceof THREE.Ribbon){if(ia.__dirtyVertices||ia.__dirtyColors){var Qb=
|
|
|
+ia,ed=j.DYNAMIC_DRAW,rc=void 0,sc=void 0,Dc=void 0,Rb=void 0,Ec=void 0,fd=Qb.vertices,gd=Qb.colors,ud=fd.length,vd=gd.length,Fc=Qb.__vertexArray,Gc=Qb.__colorArray,wd=Qb.__dirtyColors;if(Qb.__dirtyVertices){for(rc=0;rc<ud;rc++)Dc=fd[rc].position,Rb=3*rc,Fc[Rb]=Dc.x,Fc[Rb+1]=Dc.y,Fc[Rb+2]=Dc.z;j.bindBuffer(j.ARRAY_BUFFER,Qb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Fc,ed)}if(wd){for(sc=0;sc<vd;sc++)Ec=gd[sc],Rb=3*sc,Gc[Rb]=Ec.r,Gc[Rb+1]=Ec.g,Gc[Rb+2]=Ec.b;j.bindBuffer(j.ARRAY_BUFFER,Qb.__webglColorBuffer);
|
|
|
+j.bufferData(j.ARRAY_BUFFER,Gc,ed)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1}else if(jb instanceof THREE.Line){Ua=c(jb,kc);ac=Ua.attributes&&p(Ua);if(ia.__dirtyVertices||ia.__dirtyColors||ac){var Db=ia,Wc=j.DYNAMIC_DRAW,tc=void 0,uc=void 0,Hc=void 0,wa=void 0,Ic=void 0,hd=Db.vertices,id=Db.colors,xd=hd.length,yd=id.length,Jc=Db.__vertexArray,Kc=Db.__colorArray,zd=Db.__dirtyColors,Xc=Db.__webglCustomAttributesList,Lc=void 0,jd=void 0,Ma=void 0,gc=void 0,Va=void 0,pa=void 0;if(Db.__dirtyVertices){for(tc=
|
|
|
+0;tc<xd;tc++)Hc=hd[tc].position,wa=3*tc,Jc[wa]=Hc.x,Jc[wa+1]=Hc.y,Jc[wa+2]=Hc.z;j.bindBuffer(j.ARRAY_BUFFER,Db.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Jc,Wc)}if(zd){for(uc=0;uc<yd;uc++)Ic=id[uc],wa=3*uc,Kc[wa]=Ic.r,Kc[wa+1]=Ic.g,Kc[wa+2]=Ic.b;j.bindBuffer(j.ARRAY_BUFFER,Db.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Kc,Wc)}if(Xc)for(Lc=0,jd=Xc.length;Lc<jd;Lc++)if(pa=Xc[Lc],pa.needsUpdate&&(void 0===pa.boundTo||"vertices"===pa.boundTo)){wa=0;gc=pa.value.length;if(1===pa.size)for(Ma=0;Ma<
|
|
|
+gc;Ma++)pa.array[Ma]=pa.value[Ma];else if(2===pa.size)for(Ma=0;Ma<gc;Ma++)Va=pa.value[Ma],pa.array[wa]=Va.x,pa.array[wa+1]=Va.y,wa+=2;else if(3===pa.size)if("c"===pa.type)for(Ma=0;Ma<gc;Ma++)Va=pa.value[Ma],pa.array[wa]=Va.r,pa.array[wa+1]=Va.g,pa.array[wa+2]=Va.b,wa+=3;else for(Ma=0;Ma<gc;Ma++)Va=pa.value[Ma],pa.array[wa]=Va.x,pa.array[wa+1]=Va.y,pa.array[wa+2]=Va.z,wa+=3;else if(4===pa.size)for(Ma=0;Ma<gc;Ma++)Va=pa.value[Ma],pa.array[wa]=Va.x,pa.array[wa+1]=Va.y,pa.array[wa+2]=Va.z,pa.array[wa+
|
|
|
+3]=Va.w,wa+=4;j.bindBuffer(j.ARRAY_BUFFER,pa.buffer);j.bufferData(j.ARRAY_BUFFER,pa.array,Wc)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1;Ua.attributes&&o(Ua)}else if(jb instanceof THREE.ParticleSystem)Ua=c(jb,kc),ac=Ua.attributes&&p(Ua),(ia.__dirtyVertices||ia.__dirtyColors||jb.sortParticles||ac)&&f(ia,j.DYNAMIC_DRAW,jb),ia.__dirtyVertices=!1,ia.__dirtyColors=!1,Ua.attributes&&o(Ua)}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?
|
|
|
+i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var k=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var l,m;f=k=0;for(l=0,m=b.length;l<m;l++)e=b[l],e instanceof THREE.SpotLight&&!e.onlyShadow&&
|
|
|
+f++,e instanceof THREE.DirectionalLight&&f++,e instanceof THREE.PointLight&&k++;k+f<=M?l=f:(l=Math.ceil(M*f/(k+f)),k=M-l);e=l;f=k;var o=0;for(k=0,l=b.length;k<l;k++)m=b[k],m instanceof THREE.SpotLight&&m.castShadow&&o++;var p=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var n;a:{l=a.fragmentShader;m=a.vertexShader;var k=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:e,maxPointLights:f,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},q,d=[];i?d.push(i):(d.push(l),d.push(m));for(q in c)d.push(q),d.push(c[q]);i=d.join();for(q=0,d=Q.length;q<d;q++)if(Q[q].code===
|
|
|
+i){n=Q[q].program;break a}q=j.createProgram();d=[0<Za?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.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.wrapAround?"#define WRAP_AROUND":"",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");
|
|
|
+e=["precision "+B+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.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.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(q,t("fragment",
|
|
|
+e+l));j.attachShader(q,t("vertex",d+m));j.linkProgram(q);j.getProgramParameter(q,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,cameraInverseMatrix,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in k)d.push(r);r=d;for(d=0,k=r.length;d<k;d++)l=r[d],q.uniforms[l]=
|
|
|
+j.getUniformLocation(q,l);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(n in b)d.push(n);n=d;for(r=0,b=n.length;r<b;r++)c=n[r],q.attributes[c]=j.getAttribLocation(q,c);q.id=Q.length;Q.push({program:q,code:i});E.info.memory.programs=Q.length;n=q}a.program=n;n=a.program.attributes;0<=n.position&&j.enableVertexAttribArray(n.position);0<=n.color&&j.enableVertexAttribArray(n.color);0<=n.normal&&
|
|
|
+j.enableVertexAttribArray(n.normal);0<=n.tangent&&j.enableVertexAttribArray(n.tangent);a.skinning&&0<=n.skinVertexA&&0<=n.skinVertexB&&0<=n.skinIndex&&0<=n.skinWeight&&(j.enableVertexAttribArray(n.skinVertexA),j.enableVertexAttribArray(n.skinVertexB),j.enableVertexAttribArray(n.skinIndex),j.enableVertexAttribArray(n.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==n[h]&&0<=n[h]&&j.enableVertexAttribArray(n[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)r=
|
|
|
+"morphTarget"+h,0<=n[r]&&(j.enableVertexAttribArray(n[r]),a.numSupportedMorphTargets++);a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?j.frontFace(j.CCW):j.frontFace(j.CW),"back"===a?j.cullFace(j.BACK):"front"===a?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if($!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),
|
|
|
+$=a.doubleSided;if(Z!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),Z=a.flipSided};this.setDepthTest=function(a){fa!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),fa=a)};this.setDepthWrite=function(a){S!==a&&(j.depthMask(a),S=a)};this.setBlending=function(a){if(a!==ga){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;
|
|
|
+case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}ga=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),E.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&0===
|
|
|
+(c.height&c.height-1),e=A(a.format),f=A(a.type);u(j.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===
|
|
|
+a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=A(a.format),e=A(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);u(j.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,
|
|
|
+0,d,e,null);var f=a,g=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,g,f.__webglTexture,0);x(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),u(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),
|
|
|
+j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),x(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=za,a=qa,e=Na,c=ja);b!==R&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(e,c,d,a),R=b);Ga=d;Ea=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;
|
|
|
+this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!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};
|
|
@@ -353,19 +354,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
|
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
|
|
|
THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
|
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,l=f.faces,k=a.faceVertexUvs[0],p=f.faceVertexUvs[0],n={},o=0;o<a.materials.length;o++)n[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var o=0,q=h.length;o<q;o++){var m=new THREE.Vertex(h[o].position.clone());c&&c.multiplyVector3(m.position);g.push(m)}for(o=
|
|
|
-0,q=l.length;o<q;o++){var g=l[o],r,s,t=g.vertexNormals,u=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(m=t.length;h<m;h++)s=t[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(g.color);h=0;for(m=u.length;h<m;h++)s=u[h],r.vertexColors.push(s.clone());if(void 0!==g.materialIndex){h=f.materials[g.materialIndex];m=h.id;
|
|
|
-u=n[m];if(void 0===u)u=a.materials.length,n[m]=u,a.materials.push(h);r.materialIndex=u}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}for(o=0,q=p.length;o<q;o++){c=p[o];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++){var g=new THREE.Vertex(d[a].position.clone());b.vertices.push(g)}for(a=
|
|
|
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,l=f.faces,k=a.faceVertexUvs[0],p=f.faceVertexUvs[0],o={},n=0;n<a.materials.length;n++)o[a.materials[n].id]=n;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var n=0,q=h.length;n<q;n++){var m=new THREE.Vertex(h[n].position.clone());c&&c.multiplyVector3(m.position);g.push(m)}for(n=
|
|
|
+0,q=l.length;n<q;n++){var g=l[n],r,s,t=g.vertexNormals,u=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(m=t.length;h<m;h++)s=t[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(g.color);h=0;for(m=u.length;h<m;h++)s=u[h],r.vertexColors.push(s.clone());if(void 0!==g.materialIndex){h=f.materials[g.materialIndex];m=h.id;
|
|
|
+u=o[m];if(void 0===u)u=a.materials.length,o[m]=u,a.materials.push(h);r.materialIndex=u}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}for(n=0,q=p.length;n<q;n++){c=p[n];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++){var g=new THREE.Vertex(d[a].position.clone());b.vertices.push(g)}for(a=
|
|
|
0,c=e.length;a<c;a++){var h=e[a],i,l,k=h.vertexNormals,p=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(g=k.length;d<g;d++)l=k[d],i.vertexNormals.push(l.clone());i.color.copy(h.color);d=0;for(g=p.length;d<g;d++)l=p[d],i.vertexColors.push(l.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}for(a=0,c=f.length;a<c;a++){e=f[a];i=[];d=0;for(g=e.length;d<
|
|
|
g;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
|
|
|
f=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;f=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?
|
|
|
-THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,l=[],k,p,n,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)k=g[d.a].position,p=g[d.b].position,n=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,p,n);else if(d instanceof
|
|
|
-THREE.Face4)k=g[d.a].position,p=g[d.b].position,n=g[d.c].position,o=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,p,o),d._area2=THREE.GeometryUtils.triangleArea(p,n,o),d._area=d._area1+d._area2;i+=d._area;l[e]=i}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
|
|
|
+THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,l=[],k,p,o,n;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)k=g[d.a].position,p=g[d.b].position,o=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,p,o);else if(d instanceof
|
|
|
+THREE.Face4)k=g[d.a].position,p=g[d.b].position,o=g[d.c].position,n=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,p,n),d._area2=THREE.GeometryUtils.triangleArea(p,o,n),d._area=d._area1+d._area2;i+=d._area;l[e]=i}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
|
|
|
(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v&&(d[e].v-=Math.floor(d[e].v))}};THREE.GeometryUtils.random=THREE.Math.random16;
|
|
|
THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={crossOrigin:"",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return f},getNormalMap:function(a,b){var c=function(a){var b=
|
|
|
-Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),l=i.data,k=0;k<d;k++)for(var p=1;p<e;p++){var n=0>p-1?e-1:p-1,o=(p+1)%e,q=0>k-1?d-1:k-1,m=(k+1)%d,r=[],s=[0,0,h[4*(p*d+k)]/255*b];r.push([-1,0,h[4*(p*d+q)]/255*b]);r.push([-1,-1,h[4*(n*d+q)]/255*b]);r.push([0,-1,h[4*(n*d+k)]/255*b]);r.push([1,
|
|
|
--1,h[4*(n*d+m)]/255*b]);r.push([1,0,h[4*(p*d+m)]/255*b]);r.push([1,1,h[4*(o*d+m)]/255*b]);r.push([0,1,h[4*(o*d+k)]/255*b]);r.push([-1,1,h[4*(o*d+q)]/255*b]);n=[];q=r.length;for(o=0;o<q;o++){var m=r[o],t=r[(o+1)%q],m=[m[0]-s[0],m[1]-s[1],m[2]-s[2]],t=[t[0]-s[0],t[1]-s[1],t[2]-s[2]];n.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}r=[0,0,0];for(o=0;o<n.length;o++)r[0]+=n[o][0],r[1]+=n[o][1],r[2]+=n[o][2];r[0]/=n.length;r[1]/=n.length;r[2]/=n.length;s=4*(p*d+k);l[s]=255*((r[0]+
|
|
|
+Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),l=i.data,k=0;k<d;k++)for(var p=1;p<e;p++){var o=0>p-1?e-1:p-1,n=(p+1)%e,q=0>k-1?d-1:k-1,m=(k+1)%d,r=[],s=[0,0,h[4*(p*d+k)]/255*b];r.push([-1,0,h[4*(p*d+q)]/255*b]);r.push([-1,-1,h[4*(o*d+q)]/255*b]);r.push([0,-1,h[4*(o*d+k)]/255*b]);r.push([1,
|
|
|
+-1,h[4*(o*d+m)]/255*b]);r.push([1,0,h[4*(p*d+m)]/255*b]);r.push([1,1,h[4*(n*d+m)]/255*b]);r.push([0,1,h[4*(n*d+k)]/255*b]);r.push([-1,1,h[4*(n*d+q)]/255*b]);o=[];q=r.length;for(n=0;n<q;n++){var m=r[n],t=r[(n+1)%q],m=[m[0]-s[0],m[1]-s[1],m[2]-s[2]],t=[t[0]-s[0],t[1]-s[1],t[2]-s[2]];o.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}r=[0,0,0];for(n=0;n<o.length;n++)r[0]+=o[n][0],r[1]+=o[n][1],r[2]+=o[n][2];r[0]/=o.length;r[1]/=o.length;r[2]/=o.length;s=4*(p*d+k);l[s]=255*((r[0]+
|
|
|
1)/2)|0;l[s+1]=255*(r[1]+0.5)|0;l[s+2]=255*r[2]|0;l[s+3]=255}g.putImageData(i,0,0);return f}};
|
|
|
THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
|
|
|
b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
|
|
@@ -412,9 +413,9 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.sl
|
|
|
THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
|
|
|
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
|
|
|
THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,f));this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
|
|
|
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,f,g,h,i,l,k,p,n,o,q,m;for(d=0,e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];p=f[0];n=f[1];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b2(m,o,p,h),m=THREE.Shape.Utils.b2(m,q,n,
|
|
|
-i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];p=f[0];n=f[1];l=f[2];k=f[3];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b3(m,o,p,l,h),m=THREE.Shape.Utils.b3(m,q,n,k,i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];m=a*f[0].length;g=g.concat(f[0]);f=new THREE.SplineCurve(g);
|
|
|
-for(g=1;g<=m;g++)c.push(f.getPointAt(g/m));break;case THREE.PathActions.ARC:g=this.actions[d-1].args;h=f[0];i=f[1];l=f[2];p=f[3];m=f[4];n=!!f[5];k=g[g.length-2];o=g[g.length-1];0==g.length&&(k=o=0);q=m-p;var r=2*a;for(g=1;g<=r;g++)m=g/r,n||(m=1-m),m=p+m*q,f=k+h+l*Math.cos(m),m=o+i+l*Math.sin(m),c.push(new THREE.Vector2(f,m))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,f,g,h,i,l,k,p,o,n,q,m;for(d=0,e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];p=f[0];o=f[1];0<c.length?(g=c[c.length-1],n=g.x,q=g.y):(g=this.actions[d-1].args,n=g[g.length-2],q=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b2(m,n,p,h),m=THREE.Shape.Utils.b2(m,q,o,
|
|
|
+i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];p=f[0];o=f[1];l=f[2];k=f[3];0<c.length?(g=c[c.length-1],n=g.x,q=g.y):(g=this.actions[d-1].args,n=g[g.length-2],q=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b3(m,n,p,l,h),m=THREE.Shape.Utils.b3(m,q,o,k,i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];m=a*f[0].length;g=g.concat(f[0]);f=new THREE.SplineCurve(g);
|
|
|
+for(g=1;g<=m;g++)c.push(f.getPointAt(g/m));break;case THREE.PathActions.ARC:g=this.actions[d-1].args;h=f[0];i=f[1];l=f[2];p=f[3];m=f[4];o=!!f[5];k=g[g.length-2];n=g[g.length-1];0==g.length&&(k=n=0);q=m-p;var r=2*a;for(g=1;g<=r;g++)m=g/r,o||(m=1-m),m=p+m*q,f=k+h+l*Math.cos(m),m=n+i+l*Math.sin(m),c.push(new THREE.Vector2(f,m))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
|
|
|
THREE.Path.prototype.nltransform=function(a,b,c,d,e,f){var g=this.getPoints(),h,i,l,k,p;for(h=0,i=g.length;h<i;h++)l=g[h],k=l.x,p=l.y,l.x=a*k+b*p+c,l.y=d*p+e*k+f;return g};
|
|
|
THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
|
|
|
this.getPoints();for(a=0,c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
|
|
@@ -422,8 +423,8 @@ THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;for(a
|
|
|
d.curves):g.holes.push(d);f.push(g)}else{g=new THREE.Shape;for(a=0,b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(g.actions=d.actions,g.curves=d.curves,f.push(g),g=new THREE.Shape):g.holes.push(d)}return f};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
|
THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,l,k,p,n,o,q=[];for(i=0;i<b.length;i++){l=b[i];Array.prototype.push.apply(d,l);f=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){n=l[e];o=[];for(p=0;p<c.length;p++)k=c[p],k=n.distanceToSquared(k),o.push(k),k<f&&(f=k,g=e,h=p)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:l.length-1;var m=[l[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(m);var r=[l[g],l[f],c[h]];n=THREE.FontUtils.Triangulate.area(r);o=h;k=g;h+=1;g+=-1;0>
|
|
|
-h&&(h+=c.length);h%=c.length;0>g&&(g+=l.length);g%=l.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:l.length-1;m=[l[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);r=[l[g],l[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);p+n>m+r&&(h=o,g=k,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=l.length),g%=l.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:l.length-1);p=c.slice(0,h);n=c.slice(h);o=l.slice(g);k=l.slice(0,g);f=[l[g],l[f],c[h]];q.push([l[g],c[h],c[e]]);q.push(f);c=p.concat(o).concat(k).concat(n)}return{shape:c,
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,l,k,p,o,n,q=[];for(i=0;i<b.length;i++){l=b[i];Array.prototype.push.apply(d,l);f=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){o=l[e];n=[];for(p=0;p<c.length;p++)k=c[p],k=o.distanceToSquared(k),n.push(k),k<f&&(f=k,g=e,h=p)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:l.length-1;var m=[l[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(m);var r=[l[g],l[f],c[h]];o=THREE.FontUtils.Triangulate.area(r);n=h;k=g;h+=1;g+=-1;0>
|
|
|
+h&&(h+=c.length);h%=c.length;0>g&&(g+=l.length);g%=l.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:l.length-1;m=[l[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);r=[l[g],l[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);p+o>m+r&&(h=n,g=k,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=l.length),g%=l.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:l.length-1);p=c.slice(0,h);o=c.slice(h);n=l.slice(g);k=l.slice(0,g);f=[l[g],l[f],c[h]];q.push([l[g],c[h],c[e]]);q.push(f);c=p.concat(n).concat(k).concat(o)}return{shape:c,
|
|
|
isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,l={};for(f=0,g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==l[i]&&console.log("Duplicate point",i),l[i]=f;for(f=0,g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=l[i],void 0!==i&&(h[d]=i)}for(f=0,g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=l[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
|
|
|
isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
|
this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f};
|
|
@@ -437,11 +438,11 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
|
|
|
THREE.Bone?e.skinMatrix:e.matrix;var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(void 0!==this.hierarchy[a].animationCache)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,l,k=this.data.JIT.hierarchy,p,n;n=this.currentTime+=a*this.timeScale;p=this.currentTime%=this.data.length;l=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,q=this.hierarchy.length;o<q;o++)if(a=this.hierarchy[o],i=a.animationCache,this.JITCompile&&void 0!==k[o][l])a instanceof THREE.Bone?(a.skinMatrix=k[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
|
|
|
-k[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;3>m;m++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=n){if(p<n)if(this.loop){g=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<p;)g=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<p)}i.prevKey[c]=
|
|
|
-g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
-this.getPrevKeyWith("pos",o,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,1.01*d),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if("rot"===
|
|
|
-c)THREE.Quaternion.slerp(e,f,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&void 0===k[0][l]){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)k[o][l]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,l,k=this.data.JIT.hierarchy,p,o;o=this.currentTime+=a*this.timeScale;p=this.currentTime%=this.data.length;l=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,q=this.hierarchy.length;n<q;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&void 0!==k[n][l])a instanceof THREE.Bone?(a.skinMatrix=k[n][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
|
|
|
+k[n][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;3>m;m++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=o){if(p<o)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<p;)g=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<p)}i.prevKey[c]=
|
|
|
+g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
+this.getPrevKeyWith("pos",n,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,1.01*d),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if("rot"===
|
|
|
+c)THREE.Quaternion.slerp(e,f,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&void 0===k[0][l]){this.hierarchy[0].updateMatrixWorld(!0);for(n=0;n<this.hierarchy.length;n++)k[n][l]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
|
|
|
THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,l;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];l=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],l[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],l[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],l[2],e,c,g);return d};
|
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
|
|
@@ -452,7 +453,7 @@ e.matrix;e=this.data.hierarchy[c].keys;if(e.length)f.animationCache.prevKey=e[0]
|
|
|
THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++){var b=this.hierarchy[a];if(void 0!==b.animationCache){var c=b.animationCache.originalMatrix;b instanceof THREE.Bone?(c.copy(b.skinMatrix),b.skinMatrix=c):(c.copy(b.matrix),b.matrix=c);delete b.animationCache}}};
|
|
|
THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,l=this.hierarchy.length;a<l;a++){var k=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];if(k.length){for(k=
|
|
|
0;k<f.length;k++)g=f[k],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(l=this.hierarchy.length;a<l;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,p=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(k.length){if(this.JITCompile&&p)d instanceof
|
|
|
-THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix;b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!i)for(var n=k.length-1;c.time<g&&c.index!==n;)b=c,c=k[b.index+1];p.prevKey=b;p.nextKey=c}b.interpolate(c,g)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof
|
|
|
+THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix;b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!i)for(var o=k.length-1;c.time<g&&c.index!==o;)b=c,c=k[b.index+1];p.prevKey=b;p.nextKey=c}b.interpolate(c,g)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof
|
|
|
THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
|
|
|
THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
|
this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
|
|
@@ -480,7 +481,7 @@ new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050
|
|
|
b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){this.domElement===
|
|
|
document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
|
|
|
c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=e(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
|
|
|
-this.debugPath,b=this.spline,g=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),o=0;o<b.points.length;o++)c=new THREE.Mesh(g,h),c.position.copy(b.points[o]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
|
|
|
+this.debugPath,b=this.spline,g=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(g,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
|
|
|
!1)}};THREE.PathControlsIdCounter=0;
|
|
|
THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=void 0!==b?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
|
|
|
0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
|
|
@@ -491,12 +492,12 @@ THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,argu
|
|
|
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
|
|
|
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
|
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
|
-THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=!1,h=1,i=0,l=0,k=0,p=0,n=0,o=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
|
|
|
-this.rotateHorizontally(b*p);this.rotateVertically(b*n)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*l);this.object.translateY(b*k);g&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
|
|
|
+THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=!1,h=1,i=0,l=0,k=0,p=0,o=0,n=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
|
|
|
+this.rotateHorizontally(b*p);this.rotateVertically(b*o)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*l);this.object.translateY(b*k);g&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
|
|
|
e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
|
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
|
|
|
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
|
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-o)/window.innerWidth;n=(a.clientY-q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-n)/window.innerWidth;o=(a.clientY-q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:l=-1;break;case 40:case 83:i=-1;break;case 39:case 68:l=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:l=0;break;case 40:case 83:i=0;break;case 39:case 68:l=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
|
|
|
THREE.TrackballControls=function(a,b){var c=this;this.object=a;this.domElement=void 0!==b?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
|
|
|
0,0);var d=!1,e=-1,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector2,l=new THREE.Vector2,k=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*
|
|
@@ -506,23 +507,23 @@ c.target.addSelf(b);c.staticMoving?k=p:k.addSelf(a.sub(p,k).multiplyScalar(c.dyn
|
|
|
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&&(d&&(g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=l=c.getMouseOnScreen(a.clientX,a.clientY),k=p=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==e&&(0===e&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,
|
|
|
a.clientY):2===e&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===e))e=a.button,0===e&&!c.noRotate?g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?i=l=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(k=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),
|
|
|
e=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===e&&(a.keyCode===c.keys[0]&&!c.noRotate?e=0:a.keyCode===c.keys[1]&&!c.noZoom?e=1:a.keyCode===c.keys[2]&&!c.noPan&&(e=2),-1!==e&&(d=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==e&&(e=-1)},!1)};
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,k,m){var n,p=d||1,o=e||1,q=h/2,r=i/2,j=l.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",o=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",p=f||1;var s=p+1,t=o+1,u=h/p,I=i/o,O=new THREE.Vector3;O[n]=0<k?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var T=new THREE.Vector3;T[a]=(i*u-q)*c;T[b]=(h*I-r)*g;T[n]=k;l.vertices.push(new THREE.Vertex(T))}for(h=0;h<o;h++)for(i=0;i<p;i++)a=
|
|
|
-new THREE.Face4(i+s*h+j,i+s*(h+1)+j,i+1+s*(h+1)+j,i+1+s*h+j),a.normal.copy(O),a.vertexNormals.push(O.clone(),O.clone(),O.clone(),O.clone()),a.materialIndex=m,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/p,h/o),new THREE.UV(i/p,(h+1)/o),new THREE.UV((i+1)/p,(h+1)/o),new THREE.UV((i+1)/p,h/o)])}THREE.Geometry.call(this);var l=this,k=a/2,p=b/2,n=c/2,o,q,m,r,s,t;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(g)}o=0;r=1;q=2;s=
|
|
|
-3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var u in h)void 0!==this.sides[u]&&(this.sides[u]=h[u]);this.sides.px&&i("z","y",-1,-1,c,b,k,o);this.sides.nx&&i("z","y",1,-1,c,b,-k,r);this.sides.py&&i("x","z",1,1,a,c,p,q);this.sides.ny&&i("x","z",1,-1,a,c,-p,s);this.sides.pz&&i("x","y",1,-1,a,b,n,m);this.sides.nz&&i("x","y",-1,-1,a,b,-n,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,k,m){var o,p=d||1,n=e||1,q=h/2,j=i/2,r=l.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)o="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)o="y",n=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)o="x",p=f||1;var s=p+1,t=n+1,y=h/p,F=i/n,P=new THREE.Vector3;P[o]=0<k?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var u=new THREE.Vector3;u[a]=(i*y-q)*c;u[b]=(h*F-j)*g;u[o]=k;l.vertices.push(new THREE.Vertex(u))}for(h=0;h<n;h++)for(i=0;i<p;i++)a=
|
|
|
+new THREE.Face4(i+s*h+r,i+s*(h+1)+r,i+1+s*(h+1)+r,i+1+s*h+r),a.normal.copy(P),a.vertexNormals.push(P.clone(),P.clone(),P.clone(),P.clone()),a.materialIndex=m,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/p,h/n),new THREE.UV(i/p,(h+1)/n),new THREE.UV((i+1)/p,(h+1)/n),new THREE.UV((i+1)/p,h/n)])}THREE.Geometry.call(this);var l=this,k=a/2,p=b/2,o=c/2,n,q,m,r,s,t;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(n=0;6>n;n++)this.materials.push(g)}n=0;r=1;q=2;s=
|
|
|
+3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var u in h)void 0!==this.sides[u]&&(this.sides[u]=h[u]);this.sides.px&&i("z","y",-1,-1,c,b,k,n);this.sides.nx&&i("z","y",1,-1,c,b,-k,r);this.sides.py&&i("x","z",1,1,a,c,p,q);this.sides.ny&&i("x","z",1,-1,a,c,-p,s);this.sides.pz&&i("x","y",1,-1,a,b,o,m);this.sides.nz&&i("x","y",-1,-1,a,b,-o,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,l=[],k=[];for(i=0;i<=e;i++){var p=[],n=[],o=i/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,r=q*Math.sin(2*m*Math.PI),s=-o*c+g,t=q*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,t)));p.push(this.vertices.length-1);n.push(new THREE.UV(m,o))}l.push(p);k.push(n)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=l[i][h],p=l[i+1][h],
|
|
|
-n=l[i+1][h+1],o=l[i][h+1],q=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[p].position.clone().setY(0).normalize(),r=this.vertices[n].position.clone().setY(0).normalize(),s=this.vertices[o].position.clone().setY(0).normalize(),t=k[i][h].clone(),u=k[i+1][h].clone(),x=k[i+1][h+1].clone(),v=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,p,n,o,[q,m,r,s]));this.faceVertexUvs[0].push([t,u,x,v])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
|
|
|
-0;h<d;h++)c=l[0][h],p=l[0][h+1],n=this.vertices.length-1,q=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),t=k[0][h].clone(),u=k[0][h+1].clone(),x=new THREE.UV(u.u,0),this.faces.push(new THREE.Face3(c,p,n,[q,m,r])),this.faceVertexUvs[0].push([t,u,x])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=l[i][h+1],p=l[i][h],n=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,
|
|
|
-0),t=k[i][h+1].clone(),u=k[i][h].clone(),x=new THREE.UV(u.u,1),this.faces.push(new THREE.Face3(c,p,n,[q,m,r])),this.faceVertexUvs[0].push([t,u,x])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,l=[],k=[];for(i=0;i<=e;i++){var p=[],o=[],n=i/e,q=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,r=q*Math.sin(2*m*Math.PI),s=-n*c+g,t=q*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,t)));p.push(this.vertices.length-1);o.push(new THREE.UV(m,n))}l.push(p);k.push(o)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=l[i][h],p=l[i+1][h],
|
|
|
+o=l[i+1][h+1],n=l[i][h+1],q=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[p].position.clone().setY(0).normalize(),r=this.vertices[o].position.clone().setY(0).normalize(),s=this.vertices[n].position.clone().setY(0).normalize(),t=k[i][h].clone(),u=k[i+1][h].clone(),x=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,p,o,n,[q,m,r,s]));this.faceVertexUvs[0].push([t,u,x,w])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
|
|
|
+0;h<d;h++)c=l[0][h],p=l[0][h+1],o=this.vertices.length-1,q=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),t=k[0][h].clone(),u=k[0][h+1].clone(),x=new THREE.UV(u.u,0),this.faces.push(new THREE.Face3(c,p,o,[q,m,r])),this.faceVertexUvs[0].push([t,u,x])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=l[i][h+1],p=l[i][h],o=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,
|
|
|
+0),t=k[i][h+1].clone(),u=k[i][h].clone(),x=new THREE.UV(u.u,1),this.faces.push(new THREE.Face3(c,p,o,[q,m,r])),this.faceVertexUvs[0].push([t,u,x])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d,e=a.length;this.shapebb=a[e-1].getBoundingBox();for(d=0;d<e;d++)c=a[d],this.addShape(c,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);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(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+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(H=a.length;0<=--H;){y=H;I=H-1;0>I&&(I=a.length-1);for(var b=
|
|
|
-0,c=o+2*k,b=0;b<c;b++){var d=P*b,e=P*(b+1),f=ga+y+d,g=ga+y+e,j=f,d=ga+I+d,e=ga+I+e,l=g,j=j+F,d=d+F,e=e+F,l=l+F;C.faces.push(new THREE.Face4(j,d,e,l,null,null,x));void 0!==x&&(j=b/c,d=(b+1)/c,e=h+2*i,f=(C.vertices[f].position.z+i)/e,g=(C.vertices[g].position.z+i)/e,C.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=F;b+=F;c+=F;C.faces.push(new THREE.Face3(a,
|
|
|
-b,c,null,null,u));if(void 0!==u){var d=v.minX,e=v.minY,f=v.maxY,g=v.maxX,h=C.vertices[b].position.x-d,b=C.vertices[b].position.y-e,i=C.vertices[c].position.x-d,c=C.vertices[c].position.y-e;C.faceVertexUvs[0].push([new THREE.UV((C.vertices[a].position.x-d)/g,(C.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(i/g,c/f)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:
|
|
|
-3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,o=void 0!==b.steps?b.steps:1,q=b.bendPath,m=b.extrudePath,r,s=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,u=b.material,x=b.extrudeMaterial,v=this.shapebb;if(m)r=m.getPoints(n),o=r.length,s=!0,p=!1;p||(l=i=k=0);var A,D,E,C=this,F=this.vertices.length;q&&a.addWrapPath(q);n=t?a.extractAllSpacedPoints(n):a.extractAllPoints(n);q=n.shape;n=n.holes;if(m=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();for(D=
|
|
|
-0,E=n.length;D<E;D++)A=n[D],THREE.Shape.Utils.isClockWise(A)&&(n[D]=A.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(q,n);t=q;for(D=0,E=n.length;D<E;D++)A=n[D],q=q.concat(A);for(var K,L,R,N,P=q.length,B=m.length,j=[],H=0,V=t.length,y=V-1,I=H+1;H<V;H++,y++,I++)y===V&&(y=0),I===V&&(I=0),j[H]=d(t[H],t[y],t[I]);var O=[],T,aa=j.concat();for(D=0,E=n.length;D<E;D++){A=n[D];T=[];for(H=0,V=A.length,y=V-1,I=H+1;H<V;H++,y++,I++)y===V&&(y=0),I===V&&(I=0),T[H]=d(A[H],A[y],A[I]);O.push(T);aa=aa.concat(T)}for(K=
|
|
|
-0;K<k;K++){L=K/k;R=i*(1-L);L=l*Math.sin(L*Math.PI/2);for(H=0,V=t.length;H<V;H++)N=c(t[H],j[H],L),f(N.x,N.y,-R);for(D=0,E=n.length;D<E;D++){A=n[D];T=O[D];for(H=0,V=A.length;H<V;H++)N=c(A[H],T[H],L),f(N.x,N.y,-R)}}L=l;for(H=0;H<P;H++)N=p?c(q[H],aa[H],L):q[H],s?f(N.x,N.y+r[0].y,r[0].x):f(N.x,N.y,0);for(K=1;K<=o;K++)for(H=0;H<P;H++)N=p?c(q[H],aa[H],L):q[H],s?f(N.x,N.y+r[K-1].y,r[K-1].x):f(N.x,N.y,h/o*K);for(K=k-1;0<=K;K--){L=K/k;R=i*(1-L);L=l*Math.sin(L*Math.PI/2);for(H=0,V=t.length;H<V;H++)N=c(t[H],
|
|
|
-j[H],L),f(N.x,N.y,h+R);for(D=0,E=n.length;D<E;D++){A=n[D];T=O[D];for(H=0,V=A.length;H<V;H++)N=c(A[H],T[H],L),s?f(N.x,N.y+r[o-1].y,r[o-1].x+R):f(N.x,N.y,h+R)}}if(p){p=0*P;for(H=0;H<B;H++)l=m[H],g(l[2]+p,l[1]+p,l[0]+p);p=P*(o+2*k);for(H=0;H<B;H++)l=m[H],g(l[0]+p,l[1]+p,l[2]+p)}else{for(H=0;H<B;H++)l=m[H],g(l[2],l[1],l[0]);for(H=0;H<B;H++)l=m[H],g(l[0]+P*o,l[1]+P*o,l[2]+P*o)}var ga=0;e(t);ga+=t.length;for(D=0,E=n.length;D<E;D++)A=n[D],e(A),ga+=A.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
+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,j=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);j.copy(a).addSelf(g);if(h.equals(j))return g.clone();
|
|
|
+h.copy(b).addSelf(f);j.copy(c).addSelf(g);f=d.dot(g);g=j.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(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+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(I=a.length;0<=--I;){y=I;F=I-1;0>F&&(F=a.length-1);for(var b=
|
|
|
+0,c=n+2*k,b=0;b<c;b++){var d=E*b,e=E*(b+1),f=ga+y+d,g=ga+y+e,j=f,d=ga+F+d,e=ga+F+e,l=g,j=j+G,d=d+G,e=e+G,l=l+G;C.faces.push(new THREE.Face4(j,d,e,l,null,null,x));void 0!==x&&(j=b/c,d=(b+1)/c,e=h+2*i,f=(C.vertices[f].position.z+i)/e,g=(C.vertices[g].position.z+i)/e,C.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=G;b+=G;c+=G;C.faces.push(new THREE.Face3(a,
|
|
|
+b,c,null,null,u));if(void 0!==u){var d=w.minX,e=w.minY,f=w.maxY,g=w.maxX,h=C.vertices[b].position.x-d,b=C.vertices[b].position.y-e,j=C.vertices[c].position.x-d,c=C.vertices[c].position.y-e;C.faceVertexUvs[0].push([new THREE.UV((C.vertices[a].position.x-d)/g,(C.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(j/g,c/f)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:
|
|
|
+3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,o=void 0!==b.curveSegments?b.curveSegments:12,n=void 0!==b.steps?b.steps:1,q=b.bendPath,m=b.extrudePath,r,s=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,u=b.material,x=b.extrudeMaterial,w=this.shapebb;if(m)r=m.getPoints(o),n=r.length,s=!0,p=!1;p||(l=i=k=0);var A,D,B,C=this,G=this.vertices.length;q&&a.addWrapPath(q);o=t?a.extractAllSpacedPoints(o):a.extractAllPoints(o);q=o.shape;o=o.holes;if(m=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();for(D=
|
|
|
+0,B=o.length;D<B;D++)A=o[D],THREE.Shape.Utils.isClockWise(A)&&(o[D]=A.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(q,o);t=q;for(D=0,B=o.length;D<B;D++)A=o[D],q=q.concat(A);for(var K,L,T,M,E=q.length,j=m.length,Q=[],I=0,R=t.length,y=R-1,F=I+1;I<R;I++,y++,F++)y===R&&(y=0),F===R&&(F=0),Q[I]=d(t[I],t[y],t[F]);var P=[],$,Z=Q.concat();for(D=0,B=o.length;D<B;D++){A=o[D];$=[];for(I=0,R=A.length,y=R-1,F=I+1;I<R;I++,y++,F++)y===R&&(y=0),F===R&&(F=0),$[I]=d(A[I],A[y],A[F]);P.push($);Z=Z.concat($)}for(K=
|
|
|
+0;K<k;K++){L=K/k;T=i*(1-L);L=l*Math.sin(L*Math.PI/2);for(I=0,R=t.length;I<R;I++)M=c(t[I],Q[I],L),f(M.x,M.y,-T);for(D=0,B=o.length;D<B;D++){A=o[D];$=P[D];for(I=0,R=A.length;I<R;I++)M=c(A[I],$[I],L),f(M.x,M.y,-T)}}L=l;for(I=0;I<E;I++)M=p?c(q[I],Z[I],L):q[I],s?f(M.x,M.y+r[0].y,r[0].x):f(M.x,M.y,0);for(K=1;K<=n;K++)for(I=0;I<E;I++)M=p?c(q[I],Z[I],L):q[I],s?f(M.x,M.y+r[K-1].y,r[K-1].x):f(M.x,M.y,h/n*K);for(K=k-1;0<=K;K--){L=K/k;T=i*(1-L);L=l*Math.sin(L*Math.PI/2);for(I=0,R=t.length;I<R;I++)M=c(t[I],Q[I],
|
|
|
+L),f(M.x,M.y,h+T);for(D=0,B=o.length;D<B;D++){A=o[D];$=P[D];for(I=0,R=A.length;I<R;I++)M=c(A[I],$[I],L),s?f(M.x,M.y+r[n-1].y,r[n-1].x+T):f(M.x,M.y,h+T)}}if(p){p=0*E;for(I=0;I<j;I++)l=m[I],g(l[2]+p,l[1]+p,l[0]+p);p=E*(n+2*k);for(I=0;I<j;I++)l=m[I],g(l[0]+p,l[1]+p,l[2]+p)}else{for(I=0;I<j;I++)l=m[I],g(l[2],l[1],l[0]);for(I=0;I<j;I++)l=m[I],g(l[0]+E*n,l[1]+E*n,l[2]+E*n)}var ga=0;e(t);ga+=t.length;for(D=0,B=o.length;D<B;D++)A=o[D],e(A),ga+=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-0.5*((Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI),0.5-f.y/2),new THREE.UV(1-
|
|
|
0.5*((Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI),0.5-g.y/2),new THREE.UV(1-0.5*((Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI),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,f=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,f);c(0,5,1,
|
|
@@ -536,17 +537,17 @@ g.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),g.faceVertexUvs[0].push
|
|
|
{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
|
THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,l=b/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*l-f),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),e.normal.copy(k),e.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
|
|
|
c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
-THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,l=[],k=[];for(i=0;i<=c;i++){var p=[],n=[];for(h=0;h<=b;h++){var o=h/b,q=i/c,m=-a*Math.cos(d+o*e)*Math.sin(f+q*g),r=a*Math.cos(f+q*g),s=a*Math.sin(d+o*e)*Math.sin(f+q*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,r,s)));p.push(this.vertices.length-1);n.push(new THREE.UV(o,
|
|
|
-q))}l.push(p);k.push(n)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],e=l[i][h],f=l[i+1][h],g=l[i+1][h+1],p=this.vertices[d].position.clone().normalize(),n=this.vertices[e].position.clone().normalize(),o=this.vertices[f].position.clone().normalize(),q=this.vertices[g].position.clone().normalize(),m=k[i][h+1].clone(),r=k[i][h].clone(),s=k[i+1][h].clone(),t=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[p,o,q])),this.faceVertexUvs[0].push([m,
|
|
|
-s,t])):Math.abs(this.vertices[f].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[p,n,o])),this.faceVertexUvs[0].push([m,r,s])):(this.faces.push(new THREE.Face4(d,e,f,g,[p,n,o,q])),this.faceVertexUvs[0].push([m,r,s,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
+THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,l=[],k=[];for(i=0;i<=c;i++){var p=[],o=[];for(h=0;h<=b;h++){var n=h/b,q=i/c,m=-a*Math.cos(d+n*e)*Math.sin(f+q*g),r=a*Math.cos(f+q*g),s=a*Math.sin(d+n*e)*Math.sin(f+q*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,r,s)));p.push(this.vertices.length-1);o.push(new THREE.UV(n,
|
|
|
+q))}l.push(p);k.push(o)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],e=l[i][h],f=l[i+1][h],g=l[i+1][h+1],p=this.vertices[d].position.clone().normalize(),o=this.vertices[e].position.clone().normalize(),n=this.vertices[f].position.clone().normalize(),q=this.vertices[g].position.clone().normalize(),m=k[i][h+1].clone(),r=k[i][h].clone(),s=k[i+1][h].clone(),t=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[p,n,q])),this.faceVertexUvs[0].push([m,
|
|
|
+s,t])):Math.abs(this.vertices[f].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[p,o,n])),this.faceVertexUvs[0].push([m,r,s])):(this.faces.push(new THREE.Face4(d,e,f,g,[p,o,n,q])),this.faceVertexUvs[0].push([m,r,s,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=void 0!==b.height?b.height:50;if(void 0===b.bevelThickness)b.bevelThickness=10;if(void 0===b.bevelSize)b.bevelSize=8;if(void 0===b.bevelEnabled)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
|
-0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,l,k,p,n,o,q,m,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));l=b.length;for(a=0;a<l;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,
|
|
|
-k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(o,q,i,k);if(g=f[f.length-1]){p=g.x;n=g.y;for(g=1,h=this.divisions;g<=h;g++){var t=g/h,u=THREE.Shape.Utils.b2(t,p,o,i),t=THREE.Shape.Utils.b2(t,n,q,k);f.push(new THREE.Vector2(u,t))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,o=b[a++]*c+d,q=b[a++]*-c,m=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,k,o,q,m,r),g=f[f.length-1]){p=g.x;n=g.y;for(g=1,h=this.divisions;g<=h;g++)t=g/h,u=THREE.Shape.Utils.b3(t,p,o,
|
|
|
-m,i),t=THREE.Shape.Utils.b3(t,n,q,r,k),f.push(new THREE.Vector2(u,t))}}}return{offset:s.ha*c,points:f,path:e}}}};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,l,k;if(0<b(a))for(l=0;l<e;l++)g[l]=l;else for(l=0;l<e;l++)g[l]=e-1-l;var p=2*e;for(l=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=l;e<=i&&(i=0);l=i+1;e<=l&&(l=0);k=l+1;e<=k&&(k=0);var n;a:{n=a;var o=i,q=l,m=k,r=e,s=g,t=void 0,u=void 0,x=void 0,v=void 0,A=void 0,
|
|
|
-D=void 0,E=void 0,C=void 0,F=void 0,u=n[s[o]].x,x=n[s[o]].y,v=n[s[q]].x,A=n[s[q]].y,D=n[s[m]].x,E=n[s[m]].y;if(1.0E-10>(v-u)*(E-x)-(A-x)*(D-u))n=!1;else{for(t=0;t<r;t++)if(!(t==o||t==q||t==m)){var C=n[s[t]].x,F=n[s[t]].y,K=void 0,L=void 0,R=void 0,N=void 0,P=void 0,B=void 0,j=void 0,H=void 0,V=void 0,y=void 0,I=void 0,O=void 0,K=R=P=void 0,K=D-v,L=E-A,R=u-D,N=x-E,P=v-u,B=A-x,j=C-u,H=F-x,V=C-v,y=F-A,I=C-D,O=F-E,K=K*y-L*V,P=P*H-B*j,R=R*O-N*I;if(0<=K&&0<=R&&0<=P){n=!1;break a}}n=!0}}if(n){f.push([a[g[i]],
|
|
|
+0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,l,k,p,o,n,q,m,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));l=b.length;for(a=0;a<l;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,
|
|
|
+k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(n,q,i,k);if(g=f[f.length-1]){p=g.x;o=g.y;for(g=1,h=this.divisions;g<=h;g++){var t=g/h,u=THREE.Shape.Utils.b2(t,p,n,i),t=THREE.Shape.Utils.b2(t,o,q,k);f.push(new THREE.Vector2(u,t))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,n=b[a++]*c+d,q=b[a++]*-c,m=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,k,n,q,m,r),g=f[f.length-1]){p=g.x;o=g.y;for(g=1,h=this.divisions;g<=h;g++)t=g/h,u=THREE.Shape.Utils.b3(t,p,n,
|
|
|
+m,i),t=THREE.Shape.Utils.b3(t,o,q,r,k),f.push(new THREE.Vector2(u,t))}}}return{offset:s.ha*c,points:f,path:e}}}};
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,l,k;if(0<b(a))for(l=0;l<e;l++)g[l]=l;else for(l=0;l<e;l++)g[l]=e-1-l;var p=2*e;for(l=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=l;e<=i&&(i=0);l=i+1;e<=l&&(l=0);k=l+1;e<=k&&(k=0);var o;a:{o=a;var n=i,q=l,m=k,r=e,s=g,t=void 0,u=void 0,x=void 0,w=void 0,A=void 0,
|
|
|
+D=void 0,B=void 0,C=void 0,G=void 0,u=o[s[n]].x,x=o[s[n]].y,w=o[s[q]].x,A=o[s[q]].y,D=o[s[m]].x,B=o[s[m]].y;if(1.0E-10>(w-u)*(B-x)-(A-x)*(D-u))o=!1;else{for(t=0;t<r;t++)if(!(t==n||t==q||t==m)){var C=o[s[t]].x,G=o[s[t]].y,K=void 0,L=void 0,T=void 0,M=void 0,E=void 0,j=void 0,Q=void 0,I=void 0,R=void 0,y=void 0,F=void 0,P=void 0,K=T=E=void 0,K=D-w,L=B-A,T=u-D,M=x-B,E=w-u,j=A-x,Q=C-u,I=G-x,R=C-w,y=G-A,F=C-D,P=G-B,K=K*y-L*R,E=E*I-j*Q,T=T*P-M*F;if(0<=K&&0<=T&&0<=E){o=!1;break a}}o=!0}}if(o){f.push([a[g[i]],
|
|
|
a[g[l]],a[g[k]]]);h.push([g[i],g[l],g[k]]);for(i=l,k=l+1;k<e;i++,k++)g[i]=g[k];e--;p=2*e}}return d?h:f};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||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=2*c/this.segmentsR*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
|
|
|
this.tube*Math.sin(g);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,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
@@ -555,13 +556,13 @@ THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Ma
|
|
|
Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=2*(a/this.segmentsR)*this.p*Math.PI,g=2*(b/this.segmentsT)*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,f);d.add(i,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=i*d.x+g*e.x;f.y+=i*d.y+g*e.y;f.z+=i*d.z+g*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=
|
|
|
0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,l,k])}this.computeCentroids();this.computeFaceNormals();
|
|
|
this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?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;0<b--;)this.smooth(a)};
|
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){k.vertexColors=[];for(var l,m,o,p=0;4>p;p++){o=i[p];l=new THREE.Color;l.setRGB(0,0,0);for(var q=0;q<o.length;q++)m=h.vertexColors[o[q]-1],l.r+=m.r,l.g+=m.g,l.b+=m.b;l.r/=o.length;l.g/=o.length;l.b/=o.length;k.vertexColors[p]=l}}e.push(k);(!g.supportUVs||0!=n.length)&&f.push([n[a],n[b],n[c],n[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
-b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},p={},n=[],o,q,m,r,s,t=a.faceVertexUvs[0];for(o=0,q=t.length;o<q;o++)for(m=0,r=t[o].length;m<r;m++)s=d[o]["abcd".charAt(m)],n[s]||(n[s]=t[o][m]);var u;for(o=0,q=d.length;o<q;o++)if(s=d[o],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),g.supportUVs&&0!=n.length){u=new THREE.UV;if(s instanceof THREE.Face3)u.u=n[s.a].u+n[s.b].u+n[s.c].u,u.v=n[s.a].v+n[s.b].v+n[s.c].v,u.u/=3,u.v/=3;else if(s instanceof THREE.Face4)u.u=
|
|
|
-n[s.a].u+n[s.b].u+n[s.c].u+n[s.d].u,u.v=n[s.a].v+n[s.b].v+n[s.c].v+n[s.d].v,u.u/=4,u.v/=4;n.push(u)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,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 x=0,t=h.length,v,A,D={},E={},C=function(a,
|
|
|
-b){void 0===D[a]&&(D[a]=[]);D[a].push(b)},F=function(a,b){void 0===E[a]&&(E[a]={});E[a][b]=null};for(o in q){u=q[o];v=o.split("_");A=v[0];v=v[1];C(A,[A,v]);C(v,[A,v]);for(m=0,r=u.length;m<r;m++)s=u[m],F(A,s,o),F(v,s,o);2>u.length&&(p[o]=!0)}for(o in q)if(u=q[o],s=u[0],u=u[1],v=o.split("_"),A=v[0],v=v[1],r=new THREE.Vector3,p[o]?(r.addSelf(h[A].position),r.addSelf(h[v].position),r.multiplyScalar(0.5)):(r.addSelf(l[s]),r.addSelf(l[u]),r.addSelf(h[A].position),r.addSelf(h[v].position),r.multiplyScalar(0.25)),
|
|
|
-k[o]=t+d.length+x,i.push(new THREE.Vertex(r)),x++,g.supportUVs&&0!=n.length)u=new THREE.UV,u.u=n[A].u+n[v].u,u.v=n[A].v+n[v].v,u.u/=2,u.v/=2,n.push(u);var K,L;v=["123","12","2","23"];r=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],R=["1234","23","3","34"],N=["1234","34","4","41"],P=["1234","41","1","12"];for(o=0,q=l.length;o<q;o++)s=d[o],u=t+o,s instanceof THREE.Face3?(x=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.a),b(u,k[x],s.b,k[A],s,v),b(u,k[A],s.c,k[K],s,r),b(u,k[K],s.a,k[x],
|
|
|
-s,C)):s instanceof THREE.Face4?(x=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.d),L=c(s.d,s.a),b(u,k[x],s.b,k[A],s,F),b(u,k[A],s.c,k[K],s,R),b(u,k[K],s.d,k[L],s,N),b(u,k[L],s.a,k[x],s,P)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==D[o]){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);u=0;for(m in E[o])i.addSelf(l[m]),u++;x=0;t=D[o].length;for(m=0;m<t;m++)p[c(D[o][m][0],D[o][m][1])]&&x++;if(2!=x){i.divideScalar(u);for(m=0;m<
|
|
|
-t;m++)u=D[o][m],u=h[u[0]].position.clone().addSelf(h[u[1]].position).divideScalar(2),k.addSelf(u);k.divideScalar(t);s.addSelf(h[o].position);s.multiplyScalar(t-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(t);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){k.vertexColors=[];for(var l,m,n,p=0;4>p;p++){n=i[p];l=new THREE.Color;l.setRGB(0,0,0);for(var q=0;q<n.length;q++)m=h.vertexColors[n[q]-1],l.r+=m.r,l.g+=m.g,l.b+=m.b;l.r/=n.length;l.g/=n.length;l.b/=n.length;k.vertexColors[p]=l}}e.push(k);(!g.supportUVs||0!=o.length)&&f.push([o[a],o[b],o[c],o[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
+b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},p={},o=[],n,q,m,r,s,t=a.faceVertexUvs[0];for(n=0,q=t.length;n<q;n++)for(m=0,r=t[n].length;m<r;m++)s=d[n]["abcd".charAt(m)],o[s]||(o[s]=t[n][m]);var u;for(n=0,q=d.length;n<q;n++)if(s=d[n],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),g.supportUVs&&0!=o.length){u=new THREE.UV;if(s instanceof THREE.Face3)u.u=o[s.a].u+o[s.b].u+o[s.c].u,u.v=o[s.a].v+o[s.b].v+o[s.c].v,u.u/=3,u.v/=3;else if(s instanceof THREE.Face4)u.u=
|
|
|
+o[s.a].u+o[s.b].u+o[s.c].u+o[s.d].u,u.v=o[s.a].v+o[s.b].v+o[s.c].v+o[s.d].v,u.u/=4,u.v/=4;o.push(u)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,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 x=0,t=h.length,w,A,D={},B={},C=function(a,
|
|
|
+b){void 0===D[a]&&(D[a]=[]);D[a].push(b)},G=function(a,b){void 0===B[a]&&(B[a]={});B[a][b]=null};for(n in q){u=q[n];w=n.split("_");A=w[0];w=w[1];C(A,[A,w]);C(w,[A,w]);for(m=0,r=u.length;m<r;m++)s=u[m],G(A,s,n),G(w,s,n);2>u.length&&(p[n]=!0)}for(n in q)if(u=q[n],s=u[0],u=u[1],w=n.split("_"),A=w[0],w=w[1],r=new THREE.Vector3,p[n]?(r.addSelf(h[A].position),r.addSelf(h[w].position),r.multiplyScalar(0.5)):(r.addSelf(l[s]),r.addSelf(l[u]),r.addSelf(h[A].position),r.addSelf(h[w].position),r.multiplyScalar(0.25)),
|
|
|
+k[n]=t+d.length+x,i.push(new THREE.Vertex(r)),x++,g.supportUVs&&0!=o.length)u=new THREE.UV,u.u=o[A].u+o[w].u,u.v=o[A].v+o[w].v,u.u/=2,u.v/=2,o.push(u);var K,L;w=["123","12","2","23"];r=["123","23","3","31"];var C=["123","31","1","12"],G=["1234","12","2","23"],T=["1234","23","3","34"],M=["1234","34","4","41"],E=["1234","41","1","12"];for(n=0,q=l.length;n<q;n++)s=d[n],u=t+n,s instanceof THREE.Face3?(x=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.a),b(u,k[x],s.b,k[A],s,w),b(u,k[A],s.c,k[K],s,r),b(u,k[K],s.a,k[x],
|
|
|
+s,C)):s instanceof THREE.Face4?(x=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.d),L=c(s.d,s.a),b(u,k[x],s.b,k[A],s,G),b(u,k[A],s.c,k[K],s,T),b(u,k[K],s.d,k[L],s,M),b(u,k[L],s.a,k[x],s,E)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(n=0,q=h.length;n<q;n++)if(void 0!==D[n]){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);u=0;for(m in B[n])i.addSelf(l[m]),u++;x=0;t=D[n].length;for(m=0;m<t;m++)p[c(D[n][m][0],D[n][m][1])]&&x++;if(2!=x){i.divideScalar(u);for(m=0;m<
|
|
|
+t;m++)u=D[n][m],u=h[u[0]].position.clone().addSelf(h[u[1]].position).divideScalar(2),k.addSelf(u);k.divideScalar(t);s.addSelf(h[n].position);s.multiplyScalar(t-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(t);d[n].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;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,crossOrigin:"",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?b+((100*a.loaded/a.total).toFixed(0)+
|
|
|
"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return 1>a.length?"":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;
|
|
@@ -577,126 +578,126 @@ THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHtt
|
|
|
g.status+"]")};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){4==f.readyState?200==f.status||0==f.status?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("Couldn't load ["+g+"] ["+f.status+"]"):3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);
|
|
|
f.responseType="arraybuffer";f.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,l,k,p,n,o,q,m,r,s,t,u,x,v;function A(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function E(a,b){return(new Uint32Array(a,b,1))[0]}function C(b,c){var d,e,f,g,h,i,j,l,k=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=k[3*d];f=k[3*d+1];g=k[3*d+2];h=H[2*e];e=H[2*e+1];i=H[2*f];j=H[2*f+1];f=H[2*g];l=H[2*g+1];g=P.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));
|
|
|
-m.push(new THREE.UV(f,l));g.push(m)}}function F(b,c){var d,e,f,g,h,i,j,l,k,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];f=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=H[2*e];e=H[2*e+1];j=H[2*f];k=H[2*f+1];l=H[2*g];m=H[2*g+1];g=H[2*h];f=H[2*h+1];h=P.faceVertexUvs[0];var n=[];n.push(new THREE.UV(i,e));n.push(new THREE.UV(j,k));n.push(new THREE.UV(l,m));n.push(new THREE.UV(g,f));h.push(n)}}function K(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[3*d],f=c[3*
|
|
|
-d+1],g=c[3*d+2],h=i[d],P.faces.push(new THREE.Face3(e,f,g,null,null,h))}function L(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[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],P.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function R(b,c,d,e){for(var f,g,h,i,l,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];l=d[3*e];k=d[3*e+1];m=d[3*e+2];i=o[e];var n=j[3*k],p=j[3*k+1];k=
|
|
|
-j[3*k+2];var q=j[3*m],r=j[3*m+1];m=j[3*m+2];P.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(j[3*l],j[3*l+1],j[3*l+2]),new THREE.Vector3(n,p,k),new THREE.Vector3(q,r,m)],null,i))}}function N(b,c,d,e){for(var f,g,h,i,k,l,m,o,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];l=d[4*e];m=d[4*e+1];o=d[4*e+2];n=d[4*e+3];k=p[e];var q=j[3*m],r=j[3*m+1];m=j[3*m+2];var s=j[3*o],t=j[3*o+1];o=j[3*o+2];var u=j[3*n],v=j[3*
|
|
|
-n+1];n=j[3*n+2];P.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(j[3*l],j[3*l+1],j[3*l+2]),new THREE.Vector3(q,r,m),new THREE.Vector3(s,t,o),new THREE.Vector3(u,v,n)],null,k))}}var P=this,B=0,j=[],H=[],V,y;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(P,d,b);c=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,B,12);e=D(a,B+12);D(a,B+13);D(a,B+14);D(a,B+15);i=D(a,B+16);l=D(a,B+17);k=D(a,B+18);p=D(a,B+19);n=E(a,B+20);
|
|
|
-o=E(a,B+20+4);q=E(a,B+20+8);b=E(a,B+20+12);m=E(a,B+20+16);r=E(a,B+20+20);s=E(a,B+20+24);t=E(a,B+20+28);u=E(a,B+20+32);x=E(a,B+20+36);v=E(a,B+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");B+=e;c=3*i+p;y=4*i+p;e=b*c;V=m*(c+3*l);i=r*(c+3*k);p=s*(c+3*l+3*k);c=t*y;l=u*(y+4*l);k=x*(y+4*k);B+=function(b){var b=new Float32Array(a,b,3*n),c,d,e,f;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],P.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
|
|
|
-n*Float32Array.BYTES_PER_ELEMENT}(B);B+=function(b){if(o){var b=new Int8Array(a,b,3*o),c,d,e,f;for(c=0;c<o;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],j.push(d/127,e/127,f/127)}return 3*o*Int8Array.BYTES_PER_ELEMENT}(B);B+=A(3*o);B+=function(b){if(q){var b=new Float32Array(a,b,2*q),c,d,e;for(c=0;c<q;c++)d=b[2*c],e=b[2*c+1],H.push(d,e)}return 2*q*Float32Array.BYTES_PER_ELEMENT}(B);e=B+e+A(2*b);V=e+V+A(2*m);i=V+i+A(2*r);p=i+p+A(2*s);c=p+c+A(2*t);l=c+l+A(2*u);k=l+k+A(2*x);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;
|
|
|
-K(r,a,b+3*r*Uint32Array.BYTES_PER_ELEMENT);C(r,b)}})(V);(function(a){if(s){var b=a+3*s*Uint32Array.BYTES_PER_ELEMENT,c=b+3*s*Uint32Array.BYTES_PER_ELEMENT;R(s,a,b,c+3*s*Uint32Array.BYTES_PER_ELEMENT);C(s,c)}})(i);(function(a){if(x){var b=a+4*x*Uint32Array.BYTES_PER_ELEMENT;L(x,a,b+4*x*Uint32Array.BYTES_PER_ELEMENT);F(x,b)}})(l);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT,c=b+4*v*Uint32Array.BYTES_PER_ELEMENT;N(v,a,b,c+4*v*Uint32Array.BYTES_PER_ELEMENT);F(v,c)}})(k);b&&K(b,B,B+3*b*
|
|
|
-Uint32Array.BYTES_PER_ELEMENT);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;R(m,a,b,b+3*m*Uint32Array.BYTES_PER_ELEMENT)}})(e);t&&L(t,p,p+4*t*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;N(u,a,b,b+4*u*Uint32Array.BYTES_PER_ELEMENT)}})(c);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){S=a;d=d||ca;void 0!==e&&(a=e.split("/"),a.pop(),Ra=1>a.length?"":a.join("/")+"/");if((a=S.evaluate("//dae:asset",S,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var i=a.childNodes[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":Ma=i.textContent.charAt(0)}}if(!Aa.convertUpAxis||Ma===Aa.upAxis)xa=null;else switch(Ma){case "X":xa="Y"===Aa.upAxis?
|
|
|
-"XtoY":"XtoZ";break;case "Y":xa="X"===Aa.upAxis?"YtoX":"YtoZ";break;case "Z":xa="X"===Aa.upAxis?"ZtoX":"ZtoY"}La=b("//dae:library_images/dae:image",g,"image");Ga=b("//dae:library_materials/dae:material",E,"material");Fa=b("//dae:library_effects/dae:effect",R,"effect");qa=b("//dae:library_geometries/dae:geometry",r,"geometry");za=b("//dae:library_controllers/dae:controller",h,"controller");ja=b("//dae:library_animations/dae:animation",P,"animation");gb=b(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
-k,"visual_scene");Sa=[];bb=[];(a=S.evaluate(".//dae:scene/dae:instance_visual_scene",S,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),$=gb[a]):$=null;ba=new THREE.Object3D;for(a=0;a<$.nodes.length;a++)ba.add(f($.nodes[a]));ab=[];c(ba);a={scene:ba,morphs:Sa,skins:bb,animations:ab,dae:{images:La,materials:Ga,effects:Fa,geometries:qa,controllers:za,animations:ja,visualScenes:gb,scene:$}};d&&d(a);return a}function b(a,b,c){for(var a=S.evaluate(a,
|
|
|
-S,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=$.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};ab.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,l,k,p,o,n,q,m,r,s,t,u,x,w;function A(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function B(a,b){return(new Uint32Array(a,b,1))[0]}function C(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=I[2*e];e=I[2*e+1];i=I[2*f];j=I[2*f+1];f=I[2*g];k=I[2*g+1];g=E.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));
|
|
|
+m.push(new THREE.UV(f,k));g.push(m)}}function G(b,c){var d,e,f,g,h,i,j,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];i=I[2*e];e=I[2*e+1];j=I[2*f];l=I[2*f+1];k=I[2*g];m=I[2*g+1];g=I[2*h];f=I[2*h+1];h=E.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,e));o.push(new THREE.UV(j,l));o.push(new THREE.UV(k,m));o.push(new THREE.UV(g,f));h.push(o)}}function K(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[3*d],f=c[3*
|
|
|
+d+1],g=c[3*d+2],h=i[d],E.faces.push(new THREE.Face3(e,f,g,null,null,h))}function L(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[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],E.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function T(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];l=d[3*e+2];i=m[e];var n=Q[3*k],o=Q[3*k+1];k=
|
|
|
+Q[3*k+2];var p=Q[3*l],q=Q[3*l+1];l=Q[3*l+2];E.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(Q[3*j],Q[3*j+1],Q[3*j+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,l)],null,i))}}function M(b,c,d,e){for(var f,g,h,i,j,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];l=d[4*e+1];m=d[4*e+2];n=d[4*e+3];j=o[e];var p=Q[3*l],q=Q[3*l+1];l=Q[3*l+2];var r=Q[3*m],s=Q[3*m+1];m=Q[3*m+2];var t=Q[3*n],u=Q[3*
|
|
|
+n+1];n=Q[3*n+2];E.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(Q[3*k],Q[3*k+1],Q[3*k+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,j))}}var E=this,j=0,Q=[],I=[],R,y;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(E,d,b);c=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,j,12);e=D(a,j+12);D(a,j+13);D(a,j+14);D(a,j+15);i=D(a,j+16);l=D(a,j+17);k=D(a,j+18);p=D(a,j+19);o=B(a,j+20);
|
|
|
+n=B(a,j+20+4);q=B(a,j+20+8);b=B(a,j+20+12);m=B(a,j+20+16);r=B(a,j+20+20);s=B(a,j+20+24);t=B(a,j+20+28);u=B(a,j+20+32);x=B(a,j+20+36);w=B(a,j+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");j+=e;c=3*i+p;y=4*i+p;e=b*c;R=m*(c+3*l);i=r*(c+3*k);p=s*(c+3*l+3*k);c=t*y;l=u*(y+4*l);k=x*(y+4*k);j+=function(b){var b=new Float32Array(a,b,3*o),c,d,e,f;for(c=0;c<o;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],E.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
|
|
|
+o*Float32Array.BYTES_PER_ELEMENT}(j);j+=function(b){if(n){var b=new Int8Array(a,b,3*n),c,d,e,f;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],Q.push(d/127,e/127,f/127)}return 3*n*Int8Array.BYTES_PER_ELEMENT}(j);j+=A(3*n);j+=function(b){if(q){var b=new Float32Array(a,b,2*q),c,d,e;for(c=0;c<q;c++)d=b[2*c],e=b[2*c+1],I.push(d,e)}return 2*q*Float32Array.BYTES_PER_ELEMENT}(j);e=j+e+A(2*b);R=e+R+A(2*m);i=R+i+A(2*r);p=i+p+A(2*s);c=p+c+A(2*t);l=c+l+A(2*u);k=l+k+A(2*x);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;
|
|
|
+K(r,a,b+3*r*Uint32Array.BYTES_PER_ELEMENT);C(r,b)}})(R);(function(a){if(s){var b=a+3*s*Uint32Array.BYTES_PER_ELEMENT,c=b+3*s*Uint32Array.BYTES_PER_ELEMENT;T(s,a,b,c+3*s*Uint32Array.BYTES_PER_ELEMENT);C(s,c)}})(i);(function(a){if(x){var b=a+4*x*Uint32Array.BYTES_PER_ELEMENT;L(x,a,b+4*x*Uint32Array.BYTES_PER_ELEMENT);G(x,b)}})(l);(function(a){if(w){var b=a+4*w*Uint32Array.BYTES_PER_ELEMENT,c=b+4*w*Uint32Array.BYTES_PER_ELEMENT;M(w,a,b,c+4*w*Uint32Array.BYTES_PER_ELEMENT);G(w,c)}})(k);b&&K(b,j,j+3*b*
|
|
|
+Uint32Array.BYTES_PER_ELEMENT);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;T(m,a,b,b+3*m*Uint32Array.BYTES_PER_ELEMENT)}})(e);t&&L(t,p,p+4*t*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;M(u,a,b,b+4*u*Uint32Array.BYTES_PER_ELEMENT)}})(c);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){S=a;d=d||ca;void 0!==e&&(a=e.split("/"),a.pop(),Wa=1>a.length?"":a.join("/")+"/");if((a=S.evaluate("//dae:asset",S,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var i=a.childNodes[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":Ka=i.textContent.charAt(0)}}if(!Oa.convertUpAxis||Ka===Oa.upAxis)xa=null;else switch(Ka){case "X":xa="Y"===Oa.upAxis?
|
|
|
+"XtoY":"XtoZ";break;case "Y":xa="X"===Oa.upAxis?"YtoX":"YtoZ";break;case "Z":xa="X"===Oa.upAxis?"ZtoX":"ZtoY"}Na=b("//dae:library_images/dae:image",g,"image");Ga=b("//dae:library_materials/dae:material",B,"material");Ea=b("//dae:library_effects/dae:effect",T,"effect");qa=b("//dae:library_geometries/dae:geometry",r,"geometry");za=b("//dae:library_controllers/dae:controller",h,"controller");ja=b("//dae:library_animations/dae:animation",E,"animation");Ta=b(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
+k,"visual_scene");fb=[];Za=[];(a=S.evaluate(".//dae:scene/dae:instance_visual_scene",S,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ba=Ta[a]):ba=null;aa=new THREE.Object3D;for(a=0;a<ba.nodes.length;a++)aa.add(f(ba.nodes[a]));Sa=[];c(aa);a={scene:aa,morphs:fb,skins:Za,animations:Sa,dae:{images:Na,materials:Ga,effects:Ea,geometries:qa,controllers:za,animations:ja,visualScenes:Ta,scene:ba}};d&&d(a);return a}function b(a,b,c){for(var a=S.evaluate(a,
|
|
|
+S,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=ba.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};Sa.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=
|
|
|
0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}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,c){var e,f=za[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 c=1E6,g=-c,h=0;for(e in ja)for(var i=ja[e],j=0;j<i.sampler.length;j++){var l=i.sampler[j];l.create();c=Math.min(c,l.startTime);g=Math.max(g,l.endTime);h=Math.max(h,l.input.length)}e=h;for(var b=$.getChildById(b.skeleton[0],!0)||$.getChildBySid(b.skeleton[0],!0),k,m,g=new THREE.Vector3,o,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<e;c++){h=[];
|
|
|
-i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;l=f.skin;for(m=0;m<j.length;m++)if(k=j[m],o=-1,"JOINT"==k.type){for(var n=0;n<l.joints.length;n++)if(k.sid==l.joints[n]){o=n;break}if(0<=o){n=l.invBindMatrices[o];k.invBindMatrix=n;k.skinningMatrix=new THREE.Matrix4;k.skinningMatrix.multiply(k.world,n);k.weights=[];for(n=0;n<l.weights.length;n++)for(var p=0;p<l.weights[n].length;p++){var q=l.weights[n][p];q.joint==o&&k.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
-k.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(l=0;l<h[j].weights.length;l++)k=h[j].weights[l],m=k.index,k=k.weight,o=a.vertices[m],m=i[m],g.x=o.position.x,g.y=o.position.y,g.z=o.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*k,m.position.y+=g.y*k,m.position.z+=g.z*k;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=za[a.controllers[g].url];switch(i.type){case "skin":if(qa[i.skin.source]){var j=
|
|
|
-new m;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(za[i.skin.source]&&(d=i=za[i.skin.source],i.morph&&qa[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j);break;case "morph":if(qa[i.morph.source])j=new m,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=
|
|
|
-0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=qa[i.url],k={},l=[],n=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=Fa[Ga[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=n;l.push(q.material);p=q.material;n++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(1<n){j=new THREE.MeshFaceMaterial;i.materials=
|
|
|
-l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=za[c.url],j.skinInstanceController=c,j.name="skin_"+bb.length,bb.push(j);else if(void 0!==d){h=i;k=d instanceof o?za[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(n=qa[k.targets[l]],n.mesh&&n.mesh.primitives&&n.mesh.primitives.length)n=n.mesh.primitives[0].geometry,
|
|
|
-n.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:n.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Sa.length;Sa.push(j)}else j=new THREE.Mesh(i,j);1<a.geometries.length?b.add(j):b=j}}b.name=a.id||"";b.matrix=a.matrix;c=a.matrix.decompose();b.position=c[0];b.quaternion=c[1];b.useQuaternion=!0;b.scale=c[2];Aa.centerGeometry&&b.geometry&&(c=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(c.multiplySelf(b.scale)),
|
|
|
+!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,g=-c,h=0;for(e in ja)for(var i=ja[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=ba.getChildById(b.skeleton[0],!0)||ba.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<e;c++){h=
|
|
|
+[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++)if(l=j[m],n=-1,"JOINT"==l.type){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(0<=n){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=0;p<k.weights[o].length;p++){var q=k.weights[o][p];q.joint==n&&l.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
+l.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var j=za[a.controllers[g].url];switch(j.type){case "skin":if(qa[j.skin.source]){var i=
|
|
|
+new m;i.url=j.skin.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i);c=a.controllers[g]}else if(za[j.skin.source]&&(d=j=za[j.skin.source],j.morph&&qa[j.morph.source]))i=new m,i.url=j.morph.source,i.instance_material=a.controllers[g].instance_material,a.geometries.push(i);break;case "morph":if(qa[j.morph.source])i=new m,i.url=j.morph.source,i.instance_material=a.controllers[g].instance_material,a.geometries.push(i),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=
|
|
|
+0;g<a.geometries.length;g++){var j=a.geometries[g],i=j.instance_material,j=qa[j.url],l={},k=[],o=0,p;if(j&&j.mesh&&j.mesh.primitives){if(0==b.name.length)b.name=j.id;if(i)for(h=0;h<i.length;h++){p=i[h];var q=Ea[Ga[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;l[p.symbol]=o;k.push(q.material);p=q.material;o++}i=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;if(1<o){i=new THREE.MeshFaceMaterial;j.materials=
|
|
|
+k;for(h=0;h<j.faces.length;h++)k=j.faces[h],k.materialIndex=l[k.daeMaterial]}if(void 0!==c)e(j,c),i.morphTargets=!0,i=new THREE.SkinnedMesh(j,i),i.skeleton=c.skeleton,i.skinController=za[c.url],i.skinInstanceController=c,i.name="skin_"+Za.length,Za.push(i);else if(void 0!==d){h=j;l=d instanceof n?za[d.url]:d;if(!l||!l.morph)console.log("could not find morph controller!");else{l=l.morph;for(k=0;k<l.targets.length;k++)if(o=qa[l.targets[k]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,
|
|
|
+o.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}i.morphTargets=!0;i=new THREE.Mesh(j,i);i.name="morph_"+fb.length;fb.push(i)}else i=new THREE.Mesh(j,i);1<a.geometries.length?b.add(i):b=i}}b.name=a.id||"";b.matrix=a.matrix;c=a.matrix.decompose();b.position=c[0];b.quaternion=c[1];b.useQuaternion=!0;b.scale=c[2];Oa.centerGeometry&&b.geometry&&(c=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(c.multiplySelf(b.scale)),
|
|
|
b.position.subSelf(c));for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=
|
|
|
-[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function n(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function u(){this.material="";this.count=
|
|
|
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function x(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function A(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}
|
|
|
-function F(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=a;this.format=this.init_from=null}function L(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function R(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function N(){this.url=""}function P(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function B(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
|
|
|
-this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function j(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function H(a){this.targets=[];this.time=a}function V(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function y(a){for(var a=O(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function I(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 T(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function aa(a,b){if(Aa.convertUpAxis&&Ma!==Aa.upAxis)switch(xa){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=
|
|
|
-b*c}}function ga(a,b){var c=[a[b],a[b+1],a[b+2]];aa(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function fa(a){if(Aa.convertUpAxis){var b=[a[0],a[4],a[8]];aa(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];aa(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];aa(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];aa(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];aa(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];aa(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],
|
|
|
-a[11]];aa(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var S=null,ba=null,$,ca=null,ia={},La={},ja={},za={},qa={},Ga={},Fa={},ab,gb,Ra,Sa,bb,Wa=THREE.SmoothShading,Aa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Ma="Y",xa=null,Sb=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==
|
|
|
-c.nodeName)this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
-"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new D).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(1==d.nodeType)switch(d.nodeName){case "input":b.push((new A).parse(d))}}return b};
|
|
|
+[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function u(){this.material="";this.count=
|
|
|
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function x(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function A(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function B(){this.name=this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}
|
|
|
+function G(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=a;this.format=this.init_from=null}function L(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function T(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function E(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function j(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
|
|
|
+this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function Q(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function I(a){this.targets=[];this.time=a}function R(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function y(a){for(var a=P(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function F(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 $(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function Z(a,b){if(Oa.convertUpAxis&&Ka!==Oa.upAxis)switch(xa){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=
|
|
|
+b*c}}function ga(a,b){var c=[a[b],a[b+1],a[b+2]];Z(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function fa(a){if(Oa.convertUpAxis){var b=[a[0],a[4],a[8]];Z(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];Z(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];Z(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];Z(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];Z(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];Z(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];
|
|
|
+Z(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var S=null,aa=null,ba,ca=null,ha={},Na={},ja={},za={},qa={},Ga={},Ea={},Sa,Ta,Wa,fb,Za,lb=THREE.SmoothShading,Oa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Ka="Y",xa=null,Sb=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=
|
|
|
+c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
|
|
|
+0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new D).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(1==d.nodeType)switch(d.nodeName){case "input":b.push((new A).parse(d))}}return b};
|
|
|
l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=y(f.textContent);this.bindShapeMatrix=fa(f);break;case "source":f=(new D).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,
|
|
|
b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new A).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new A).parse(g));break;
|
|
|
-case "v":c=I(g.textContent);break;case "vcount":d=I(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};
|
|
|
+case "v":c=F(g.textContent);break;case "vcount":d=F(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],j=[],i=0;i<h;i++){for(var l={},k=0;k<e.length;k++){var m=e[k],o=c[g+m.offset];switch(m.semantic){case "JOINT":l.joint=o;break;case "WEIGHT":l.weight=b[m.source].data[o]}}j.push(l);g+=e.length}for(i=0;i<j.length;i++)j[i].index=f;this.weights.push(j)}};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(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],
|
|
|
d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=
|
|
|
function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type="JOINT"==this.type?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],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,
|
|
|
-"");(b=S.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",S,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new n).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in ja)for(var e=ja[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=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Aa.convertUpAxis)switch(g){case "X":switch(xa){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(xa){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(xa){case "XtoZ":g=
|
|
|
-"X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var l=i[b],q=h.getData(j.type,b),r;r=null;for(var s=0,t=d.length;s<t&&null==r;s++){var u=d[s];if(u.time===l)r=u;else if(u.time>l)break}if(!r){r=new H(l);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=l&&(s=t);l=s;d.splice(-1==l?d.length:l,0,r)}r.addTarget(f,j,g,q)}}else console.log('Could not find transform "'+b.sid+'" in node '+
|
|
|
-this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;q=void 0;if(k.length){q=[];for(l=0;l<k.length;++l)q[l]=k[l]+(j[l]-k[l])*h}else q=k+(j-k)*h;f.addTarget(g,i.transform,i.member,q)}}}this.keys=
|
|
|
-d;this.sids=a}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};n.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=y(a.textContent);this.convert();return this};n.prototype.convert=function(){switch(this.type){case "matrix":this.obj=fa(this.data);break;case "rotate":this.angle=this.data[3]*Sb;case "translate":aa(this.data,-1);this.obj=new THREE.Vector3(this.data[0],
|
|
|
-this.data[1],this.data[2]);break;case "scale":aa(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};n.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};n.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");
|
|
|
-break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*Sb;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*Sb}}};o.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(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=S.evaluate(".//dae:instance_material",c,V,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};m.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(1==c.nodeType&&"bind_material"==c.nodeName){if(a=S.evaluate(".//dae:instance_material",c,V,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 s(this)).parse(c)}}return this};s.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==ia[d]&&(ia[d]=(new D(d)).parse(c));break;case "vertices":this.vertices=(new v).parse(c);break;case "triangles":this.primitives.push((new u).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");
|
|
|
-case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=ia[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(ga(a,b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
|
|
|
-return this};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":n.push(h.set)}for(;c<f.length;){var o=[],p=[],q={},r=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=ia[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":o.push(i);break;case "NORMAL":p.push(ga(k.data,j));break;case "TEXCOORD":void 0===q[h.set]&&(q[h.set]=
|
|
|
-[]);q[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(3===m)d.push(new THREE.Face3(o[0],o[1],o[2],[p[0],p[1],p[2]],r.length?r:new THREE.Color));else if(4===m)d.push(new THREE.Face4(o[0],o[1],o[2],o[3],[p[0],p[1],p[2],p[3]],r.length?r:new THREE.Color));else if(4<m&&Aa.subdivideFaces){r=r.length?r:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(o[0],o[e],o[e+1],[p[0],p[e++],p[e]],r))}if(d.length){o=
|
|
|
-0;for(p=d.length;o<p;o++){e=d[o];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<n.length;e++)r=q[n[e]],r=4<m?[r[0],r[o+1],r[o+2]]:4===m?[r[0],r[1],r[2],r[3]]:[r[0],r[1],r[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(r)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=g.length*m}};t.prototype=new u;t.prototype.constructor=t;u.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};u.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=T(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=I(c.textContent);break;case "p":this.p=I(c.textContent)}}return this};x.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=T(a,"count",0);this.stride=
|
|
|
-T(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){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=T(a,"set",-1);this.offset=T(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};D.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("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=y(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
-I(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("accessor"==c.childNodes[d].nodeName){this.accessor=(new x).parse(c.childNodes[d]);break}}}return this};D.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),c=fa(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new N).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return null==this.texture};C.prototype.isTexture=function(){return null!=this.texture};
|
|
|
+"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],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,
|
|
|
+"");(b=S.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",S,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in ja)for(var e=ja[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=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Oa.convertUpAxis)switch(g){case "X":switch(xa){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(xa){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(xa){case "XtoZ":g=
|
|
|
+"X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var l=i.length;b<l;b++){var k=i[b],q=h.getData(j.type,b),r;r=null;for(var s=0,t=d.length;s<t&&null==r;s++){var u=d[s];if(u.time===k)r=u;else if(u.time>k)break}if(!r){r=new I(k);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=k&&(s=t);k=s;d.splice(-1==k?d.length:k,0,r)}r.addTarget(f,j,g,q)}}else console.log('Could not find transform "'+b.sid+'" in node '+
|
|
|
+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(l=h[i],l.hasTarget(g)){i=l;break a}i=null}l=void 0;a:{for(j+=1;j<h.length;j++)if(l=h[j],l.hasTarget(g))break a;l=null}if(i&&l){h=(f.time-i.time)/(l.time-i.time);i=i.getTarget(g);j=l.getTarget(g).data;l=i.data;q=void 0;if(l.length){q=[];for(k=0;k<l.length;++k)q[k]=l[k]+(j[k]-l[k])*h}else q=l+(j-l)*h;f.addTarget(g,i.transform,i.member,q)}}}this.keys=
|
|
|
+d;this.sids=a}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=y(a.textContent);this.convert();return this};o.prototype.convert=function(){switch(this.type){case "matrix":this.obj=fa(this.data);break;case "rotate":this.angle=this.data[3]*Sb;case "translate":Z(this.data,-1);this.obj=new THREE.Vector3(this.data[0],
|
|
|
+this.data[1],this.data[2]);break;case "scale":Z(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};o.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};o.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");
|
|
|
+break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*Sb;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*Sb}}};n.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(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=S.evaluate(".//dae:instance_material",c,R,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};m.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(1==c.nodeType&&"bind_material"==c.nodeName){if(a=S.evaluate(".//dae:instance_material",c,R,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 s(this)).parse(c)}}return this};s.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==ha[d]&&(ha[d]=(new D(d)).parse(c));break;case "vertices":this.vertices=(new w).parse(c);break;case "triangles":this.primitives.push((new u).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");
|
|
|
+case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=ha[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(ga(a,b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
|
|
|
+return this};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,l,k=0,m=3,o=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":o.push(h.set)}for(;c<f.length;){var n=[],p=[],q={},r=[];a.vcount&&(m=a.vcount[k++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],l=ha[h.source],i=f[c+d*g.length+h.offset],j=l.accessor.params.length,j*=i,h.semantic){case "VERTEX":n.push(i);break;case "NORMAL":p.push(ga(l.data,j));break;case "TEXCOORD":void 0===q[h.set]&&(q[h.set]=
|
|
|
+[]);q[h.set].push(new THREE.UV(l.data[j],1-l.data[j+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(l.data[j],l.data[j+1],l.data[j+2]))}e=null;d=[];if(3===m)d.push(new THREE.Face3(n[0],n[1],n[2],[p[0],p[1],p[2]],r.length?r:new THREE.Color));else if(4===m)d.push(new THREE.Face4(n[0],n[1],n[2],n[3],[p[0],p[1],p[2],p[3]],r.length?r:new THREE.Color));else if(4<m&&Oa.subdivideFaces){r=r.length?r:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(n[0],n[e],n[e+1],[p[0],p[e++],p[e]],r))}if(d.length){n=
|
|
|
+0;for(p=d.length;n<p;n++){e=d[n];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)r=q[o[e]],r=4<m?[r[0],r[n+1],r[n+2]]:4===m?[r[0],r[1],r[2],r[3]]:[r[0],r[1],r[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(r)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=g.length*m}};t.prototype=new u;t.prototype.constructor=t;u.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};u.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=$(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=F(c.textContent);break;case "p":this.p=F(c.textContent)}}return this};x.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=$(a,"count",0);this.stride=
|
|
|
+$(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){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=$(a,"set",-1);this.offset=$(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};D.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("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=y(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
+F(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("accessor"==c.childNodes[d].nodeName){this.accessor=(new x).parse(c.childNodes[d]);break}}}return this};D.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),c=fa(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};B.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new M).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return null==this.texture};C.prototype.isTexture=function(){return null!=this.texture};
|
|
|
C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=y(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"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};C.prototype.parseTexture=function(a){if(!a.childNodes)return this;
|
|
|
-a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};F.prototype.parse=
|
|
|
-function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=S.evaluate(".//dae:float",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
|
|
|
-return this};F.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=La[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(Ra+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,
|
|
|
-e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==c?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=Wa;return this.material=new THREE.MeshLambertMaterial(a)};K.prototype.parse=function(a){for(var b=0;b<
|
|
|
+a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};G.prototype.parse=
|
|
|
+function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=S.evaluate(".//dae:float",c,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
|
|
|
+return this};G.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=Na[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(Wa+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,
|
|
|
+e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==c?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=lb;return this.material=new THREE.MeshLambertMaterial(a)};K.prototype.parse=function(a){for(var b=0;b<
|
|
|
a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=
|
|
|
-c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};R.prototype.create=function(){if(null==this.shader)return null};R.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(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
|
|
|
-R.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new K(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new L(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};R.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)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};R.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};N.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};P.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(1==c.nodeType)switch(c.nodeName){case "source":c=(new D).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new j(this)).parse(c));break;case "channel":this.channel.push((new B(this)).parse(c))}}return this};B.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=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};j.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(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new A).parse(c))}}return this};
|
|
|
-j.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();this.strideOut=c.accessor.stride;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}};j.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":aa(c,-1);break;case "scale":aa(c,1)}}else c=this.output[b];return c};H.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
|
|
|
-member:c,transform:b,data:d})};H.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};H.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};H.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};H.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=
|
|
|
+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(null==this.shader)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(1==c.nodeType)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(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new K(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new L(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};T.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)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(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new G(c.nodeName,this)).parse(c)}}};M.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};E.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(1==c.nodeType)switch(c.nodeName){case "source":c=(new D).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new Q(this)).parse(c));break;case "channel":this.channel.push((new j(this)).parse(c))}}return this};j.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=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};Q.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(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new A).parse(c))}}return this};
|
|
|
+Q.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();this.strideOut=c.accessor.stride;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}};Q.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":Z(c,-1);break;case "scale":Z(c,1)}}else c=this.output[b];return c};I.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
|
|
|
+member:c,transform:b,data:d})};I.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};I.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};I.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};I.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=
|
|
|
this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=
|
|
|
-function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(ca=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Wa=a},applySkin:e,geometries:qa,options:Aa}};
|
|
|
+function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(ca=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){lb=a},applySkin:e,geometries:qa,options:Oa}};
|
|
|
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 f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){try{var h=JSON.parse(f.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+f.status+"]");else 3==f.readyState?e&&(0==g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):
|
|
|
2==f.readyState&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,e,i,l,k,p,n,o,q,m,r,s,t,u,x=a.faces;p=a.vertices;var v=a.normals,A=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=p.length;l<
|
|
|
-k;)n=new THREE.Vertex,n.position.x=p[l++]*b,n.position.y=p[l++]*b,n.position.z=p[l++]*b,d.vertices.push(n);l=0;for(k=x.length;l<k;){b=x[l++];p=b&1;i=b&2;c=b&4;e=b&8;o=b&16;n=b&32;m=b&64;b&=128;p?(r=new THREE.Face4,r.a=x[l++],r.b=x[l++],r.c=x[l++],r.d=x[l++],p=4):(r=new THREE.Face3,r.a=x[l++],r.b=x[l++],r.c=x[l++],p=3);if(i)i=x[l++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<D;c++)s=a.uvs[c],q=x[l++],u=s[2*q],q=s[2*q+1],d.faceUvs[c][i]=new THREE.UV(u,q);if(e)for(c=0;c<D;c++){s=a.uvs[c];t=[];
|
|
|
-for(e=0;e<p;e++)q=x[l++],u=s[2*q],q=s[2*q+1],t[e]=new THREE.UV(u,q);d.faceVertexUvs[c][i]=t}if(o)o=3*x[l++],e=new THREE.Vector3,e.x=v[o++],e.y=v[o++],e.z=v[o],r.normal=e;if(n)for(c=0;c<p;c++)o=3*x[l++],e=new THREE.Vector3,e.x=v[o++],e.y=v[o++],e.z=v[o],r.vertexNormals.push(e);if(m)n=x[l++],n=new THREE.Color(A[n]),r.color=n;if(b)for(c=0;c<p;c++)n=x[l++],n=new THREE.Color(A[n]),r.vertexColors.push(n);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,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)for(b=0,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(void 0!==a.morphTargets){var c,e,i,l,k,p,n,o,q;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;
|
|
|
-q=a.morphTargets[c].vertices;for(i=0,l=q.length;i<l;i+=3)k=q[i]*b,p=q[i+1]*b,n=q[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(k,p,n)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,i=k.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(k[b],k[b+1],k[b+2]),l.push(p)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,e,i,l,k,p,o,n,q,m,r,s,t,u,x=a.faces;p=a.vertices;var w=a.normals,A=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=p.length;l<
|
|
|
+k;)o=new THREE.Vertex,o.position.x=p[l++]*b,o.position.y=p[l++]*b,o.position.z=p[l++]*b,d.vertices.push(o);l=0;for(k=x.length;l<k;){b=x[l++];p=b&1;i=b&2;c=b&4;e=b&8;n=b&16;o=b&32;m=b&64;b&=128;p?(r=new THREE.Face4,r.a=x[l++],r.b=x[l++],r.c=x[l++],r.d=x[l++],p=4):(r=new THREE.Face3,r.a=x[l++],r.b=x[l++],r.c=x[l++],p=3);if(i)i=x[l++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<D;c++)s=a.uvs[c],q=x[l++],u=s[2*q],q=s[2*q+1],d.faceUvs[c][i]=new THREE.UV(u,q);if(e)for(c=0;c<D;c++){s=a.uvs[c];t=[];
|
|
|
+for(e=0;e<p;e++)q=x[l++],u=s[2*q],q=s[2*q+1],t[e]=new THREE.UV(u,q);d.faceVertexUvs[c][i]=t}if(n)n=3*x[l++],e=new THREE.Vector3,e.x=w[n++],e.y=w[n++],e.z=w[n],r.normal=e;if(o)for(c=0;c<p;c++)n=3*x[l++],e=new THREE.Vector3,e.x=w[n++],e.y=w[n++],e.z=w[n],r.vertexNormals.push(e);if(m)o=x[l++],o=new THREE.Color(A[o]),r.color=o;if(b)for(c=0;c<p;c++)o=x[l++],o=new THREE.Color(A[o]),r.vertexColors.push(o);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,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)for(b=0,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(void 0!==a.morphTargets){var c,e,i,l,k,p,o,n,q;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;
|
|
|
+q=a.morphTargets[c].vertices;for(i=0,l=q.length;i<l;i+=3)k=q[i]*b,p=q[i+1]*b,o=q[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,p,o)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,i=k.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(k[b],k[b+1],k[b+2]),l.push(p)}})(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(4==d.readyState)if(200==d.status||0==d.status)try{var e=JSON.parse(d.responseText);void 0===e.metadata||void 0===e.metadata.formatVersion||3!==e.metadata.formatVersion?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(f){console.error(f),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&&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"relativeToHTML"==b?a:l+"/"+a}function e(){var a;for(n in N.objects)if(!y.objects[n])if(s=N.objects[n],void 0!==s.geometry){if(F=y.geometries[s.geometry]){a=!1;for(I=0;I<s.materials.length;I++)R=y.materials[s.materials[I]],a=R instanceof THREE.ShaderMaterial;a&&F.computeTangents();x=s.position;v=s.rotation;A=s.quaternion;D=s.scale;A=0;0==R.length&&(R=new THREE.MeshFaceMaterial);1<R.length&&(R=new THREE.MeshFaceMaterial);
|
|
|
-a=new THREE.Mesh(F,R);a.name=n;a.position.set(x[0],x[1],x[2]);A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]);a.scale.set(D[0],D[1],D[2]);a.visible=s.visible;y.scene.add(a);y.objects[n]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);y.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(F),y.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&"none"!=s.trigger.toLowerCase()&&(b=
|
|
|
-{type:s.trigger,object:s},y.triggers[a.name]=b)}}else x=s.position,v=s.rotation,A=s.quaternion,D=s.scale,A=0,a=new THREE.Object3D,a.name=n,a.position.set(x[0],x[1],x[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(D[0],D[1],D[2]),a.visible=void 0!==s.visible?s.visible:!1,y.scene.add(a),y.objects[n]=a,y.empties[n]=a,s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},y.triggers[a.name]=b)}function f(a){return function(b){y.geometries[a]=
|
|
|
-b;e();B-=1;i.onLoadComplete();h()}}function g(a){return function(b){y.geometries[a]=b}}function h(){i.callbackProgress({totalModels:H,totalTextures:V,loadedModels:H-B,loadedTextures:V-j},y);i.onLoadProgress();0==B&&0==j&&b(y)}var i=this,l=THREE.Loader.prototype.extractUrlbase(c),k,p,n,o,q,m,r,s,t,u,x,v,A,D,E,C,F,K,L,R,N,P,B,j,H,V,y;N=a;c=new THREE.BinaryLoader;P=new THREE.JSONLoader;j=B=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
-empties:{}};a=!1;for(n in N.objects)if(s=N.objects[n],s.meshCollider){a=!0;break}if(a)y.scene.collisions=new THREE.CollisionSystem;if(N.transform)a=N.transform.position,t=N.transform.rotation,E=N.transform.scale,a&&y.scene.position.set(a[0],a[1],a[2]),t&&y.scene.rotation.set(t[0],t[1],t[2]),E&&y.scene.scale.set(E[0],E[1],E[2]),(a||t||E)&&y.scene.updateMatrix();a=function(){j-=1;h();i.onLoadComplete()};for(q in N.cameras)E=N.cameras[q],"perspective"==E.type?K=new THREE.PerspectiveCamera(E.fov,E.aspect,
|
|
|
-E.near,E.far):"ortho"==E.type&&(K=new THREE.OrthographicCamera(E.left,E.right,E.top,E.bottom,E.near,E.far)),x=E.position,t=E.target,E=E.up,K.position.set(x[0],x[1],x[2]),K.target=new THREE.Vector3(t[0],t[1],t[2]),E&&K.up.set(E[0],E[1],E[2]),y.cameras[q]=K;for(o in N.lights)t=N.lights[o],q=void 0!==t.color?t.color:16777215,K=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(x=t.direction,u=new THREE.DirectionalLight(q,K),u.position.set(x[0],x[1],x[2]),u.position.normalize()):"point"==t.type?
|
|
|
-(x=t.position,u=t.distance,u=new THREE.PointLight(q,K,u),u.position.set(x[0],x[1],x[2])):"ambient"==t.type&&(u=new THREE.AmbientLight(q)),y.scene.add(u),y.lights[o]=u;for(m in N.fogs)o=N.fogs[m],"linear"==o.type?L=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(L=new THREE.FogExp2(0,o.density)),E=o.color,L.color.setRGB(E[0],E[1],E[2]),y.fogs[m]=L;if(y.cameras&&N.defaults.camera)y.currentCamera=y.cameras[N.defaults.camera];if(y.fogs&&N.defaults.fog)y.scene.fog=y.fogs[N.defaults.fog];E=N.defaults.bgcolor;
|
|
|
-y.bgColor=new THREE.Color;y.bgColor.setRGB(E[0],E[1],E[2]);y.bgColorAlpha=N.defaults.bgalpha;for(k in N.geometries)if(m=N.geometries[k],"bin_mesh"==m.type||"ascii_mesh"==m.type)B+=1,i.onLoadStart();H=B;for(k in N.geometries)m=N.geometries[k],"cube"==m.type?(F=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),y.geometries[k]=F):"plane"==m.type?(F=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),y.geometries[k]=
|
|
|
-F):"sphere"==m.type?(F=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),y.geometries[k]=F):"cylinder"==m.type?(F=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),y.geometries[k]=F):"torus"==m.type?(F=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),y.geometries[k]=F):"icosahedron"==m.type?(F=new THREE.IcosahedronGeometry(m.subdivisions),y.geometries[k]=F):"bin_mesh"==m.type?c.load(d(m.url,N.urlBaseType),f(k)):"ascii_mesh"==m.type?P.load(d(m.url,
|
|
|
-N.urlBaseType),f(k)):"embedded_mesh"==m.type&&(m=N.embeds[m.id])&&P.createModel(m,g(k),"");for(r in N.textures)if(k=N.textures[r],k.url instanceof Array){j+=k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else j+=1,i.onLoadStart();V=j;for(r in N.textures){k=N.textures[r];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(var I=0;I<k.url.length;I++)m[I]=d(k.url[I],N.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=
|
|
|
-THREE.ImageUtils.loadTexture(d(k.url,N.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])m.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==L[k.wrap[0]])m.wrapS=L[k.wrap[0]];
|
|
|
-if(void 0!==L[k.wrap[1]])m.wrapT=L[k.wrap[1]]}}y.textures[r]=m}for(p in N.materials){r=N.materials[p];for(C in r.parameters)if("envMap"==C||"map"==C||"lightMap"==C)r.parameters[C]=y.textures[r.parameters[C]];else if("shading"==C)r.parameters[C]="flat"==r.parameters[C]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==C)r.parameters[C]=THREE[r.parameters[C]]?THREE[r.parameters[C]]:THREE.NormalBlending;else if("combine"==C)r.parameters[C]="MixOperation"==r.parameters[C]?THREE.MixOperation:THREE.MultiplyOperation;
|
|
|
-else if("vertexColors"==C)if("face"==r.parameters[C])r.parameters[C]=THREE.FaceColors;else if(r.parameters[C])r.parameters[C]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);m=r.parameters.color;L=r.parameters.specular;c=r.parameters.ambient;P=r.parameters.shininess;a.tNormal.texture=y.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=y.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(L);a.uAmbientColor.value.setHex(c);a.uShininess.value=P;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;r=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:l+"/"+a}function e(){var a;for(o in M.objects)if(!y.objects[o])if(s=M.objects[o],void 0!==s.geometry){if(G=y.geometries[s.geometry]){a=!1;for(F=0;F<s.materials.length;F++)T=y.materials[s.materials[F]],a=T instanceof THREE.ShaderMaterial;a&&G.computeTangents();x=s.position;w=s.rotation;A=s.quaternion;D=s.scale;A=0;0==T.length&&(T=new THREE.MeshFaceMaterial);1<T.length&&(T=new THREE.MeshFaceMaterial);
|
|
|
+a=new THREE.Mesh(G,T);a.name=o;a.position.set(x[0],x[1],x[2]);A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]);a.scale.set(D[0],D[1],D[2]);a.visible=s.visible;y.scene.add(a);y.objects[o]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);y.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(G),y.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&"none"!=s.trigger.toLowerCase()&&(b=
|
|
|
+{type:s.trigger,object:s},y.triggers[a.name]=b)}}else x=s.position,w=s.rotation,A=s.quaternion,D=s.scale,A=0,a=new THREE.Object3D,a.name=o,a.position.set(x[0],x[1],x[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]),a.scale.set(D[0],D[1],D[2]),a.visible=void 0!==s.visible?s.visible:!1,y.scene.add(a),y.objects[o]=a,y.empties[o]=a,s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},y.triggers[a.name]=b)}function f(a){return function(b){y.geometries[a]=
|
|
|
+b;e();j-=1;i.onLoadComplete();h()}}function g(a){return function(b){y.geometries[a]=b}}function h(){i.callbackProgress({totalModels:I,totalTextures:R,loadedModels:I-j,loadedTextures:R-Q},y);i.onLoadProgress();0==j&&0==Q&&b(y)}var i=this,l=THREE.Loader.prototype.extractUrlbase(c),k,p,o,n,q,m,r,s,t,u,x,w,A,D,B,C,G,K,L,T,M,E,j,Q,I,R,y;M=a;c=new THREE.BinaryLoader;E=new THREE.JSONLoader;Q=j=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
+empties:{}};a=!1;for(o in M.objects)if(s=M.objects[o],s.meshCollider){a=!0;break}if(a)y.scene.collisions=new THREE.CollisionSystem;if(M.transform)a=M.transform.position,t=M.transform.rotation,B=M.transform.scale,a&&y.scene.position.set(a[0],a[1],a[2]),t&&y.scene.rotation.set(t[0],t[1],t[2]),B&&y.scene.scale.set(B[0],B[1],B[2]),(a||t||B)&&y.scene.updateMatrix();a=function(){Q-=1;h();i.onLoadComplete()};for(q in M.cameras)B=M.cameras[q],"perspective"==B.type?K=new THREE.PerspectiveCamera(B.fov,B.aspect,
|
|
|
+B.near,B.far):"ortho"==B.type&&(K=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far)),x=B.position,t=B.target,B=B.up,K.position.set(x[0],x[1],x[2]),K.target=new THREE.Vector3(t[0],t[1],t[2]),B&&K.up.set(B[0],B[1],B[2]),y.cameras[q]=K;for(n in M.lights)t=M.lights[n],q=void 0!==t.color?t.color:16777215,K=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(x=t.direction,u=new THREE.DirectionalLight(q,K),u.position.set(x[0],x[1],x[2]),u.position.normalize()):"point"==t.type?
|
|
|
+(x=t.position,u=t.distance,u=new THREE.PointLight(q,K,u),u.position.set(x[0],x[1],x[2])):"ambient"==t.type&&(u=new THREE.AmbientLight(q)),y.scene.add(u),y.lights[n]=u;for(m in M.fogs)n=M.fogs[m],"linear"==n.type?L=new THREE.Fog(0,n.near,n.far):"exp2"==n.type&&(L=new THREE.FogExp2(0,n.density)),B=n.color,L.color.setRGB(B[0],B[1],B[2]),y.fogs[m]=L;if(y.cameras&&M.defaults.camera)y.currentCamera=y.cameras[M.defaults.camera];if(y.fogs&&M.defaults.fog)y.scene.fog=y.fogs[M.defaults.fog];B=M.defaults.bgcolor;
|
|
|
+y.bgColor=new THREE.Color;y.bgColor.setRGB(B[0],B[1],B[2]);y.bgColorAlpha=M.defaults.bgalpha;for(k in M.geometries)if(m=M.geometries[k],"bin_mesh"==m.type||"ascii_mesh"==m.type)j+=1,i.onLoadStart();I=j;for(k in M.geometries)m=M.geometries[k],"cube"==m.type?(G=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),y.geometries[k]=G):"plane"==m.type?(G=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),y.geometries[k]=
|
|
|
+G):"sphere"==m.type?(G=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),y.geometries[k]=G):"cylinder"==m.type?(G=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),y.geometries[k]=G):"torus"==m.type?(G=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),y.geometries[k]=G):"icosahedron"==m.type?(G=new THREE.IcosahedronGeometry(m.subdivisions),y.geometries[k]=G):"bin_mesh"==m.type?c.load(d(m.url,M.urlBaseType),f(k)):"ascii_mesh"==m.type?E.load(d(m.url,
|
|
|
+M.urlBaseType),f(k)):"embedded_mesh"==m.type&&(m=M.embeds[m.id])&&E.createModel(m,g(k),"");for(r in M.textures)if(k=M.textures[r],k.url instanceof Array){Q+=k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else Q+=1,i.onLoadStart();R=Q;for(r in M.textures){k=M.textures[r];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(var F=0;F<k.url.length;F++)m[F]=d(k.url[F],M.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=
|
|
|
+THREE.ImageUtils.loadTexture(d(k.url,M.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])m.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==L[k.wrap[0]])m.wrapS=L[k.wrap[0]];
|
|
|
+if(void 0!==L[k.wrap[1]])m.wrapT=L[k.wrap[1]]}}y.textures[r]=m}for(p in M.materials){r=M.materials[p];for(C in r.parameters)if("envMap"==C||"map"==C||"lightMap"==C)r.parameters[C]=y.textures[r.parameters[C]];else if("shading"==C)r.parameters[C]="flat"==r.parameters[C]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==C)r.parameters[C]=THREE[r.parameters[C]]?THREE[r.parameters[C]]:THREE.NormalBlending;else if("combine"==C)r.parameters[C]="MixOperation"==r.parameters[C]?THREE.MixOperation:THREE.MultiplyOperation;
|
|
|
+else if("vertexColors"==C)if("face"==r.parameters[C])r.parameters[C]=THREE.FaceColors;else if(r.parameters[C])r.parameters[C]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);m=r.parameters.color;L=r.parameters.specular;c=r.parameters.ambient;E=r.parameters.shininess;a.tNormal.texture=y.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=y.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(L);a.uAmbientColor.value.setHex(c);a.uShininess.value=E;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);y.materials[p]=r}e();i.callbackSync(y);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=void 0!==c.scale?c.scale:1,f=void 0!==c.offsetX?c.offsetX:0,g=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,
|
|
|
b,e,f,g,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;8>e;e++){for(var f=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),f=f+(h>>1^-(h&1));c[8*g+e]=f}d+=b}b=a.length-d;f=new Uint16Array(b);for(e=g=0;e<b;e++)h=a.charCodeAt(e+d),f[e]=g-h,0==h&&g++;return[c,f]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],k=[];(function(a,g,i){for(var k,l,r,s=a.length;i<s;i+=g)k=a[i],l=a[i+1],r=a[i+2],k=k/16383*c,l=l/16383*c,r=r/16383*c,k+=d,l+=e,r+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,r)))})(g[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)})(g[0],8,3);(function(a,
|
|
|
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,i,t,u,x,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;u=d;x=e;i=f;var A=l[3*e],D=l[3*e+1],E=l[3*e+2],C=l[3*f],F=l[3*f+1],K=l[3*f+2];t=new THREE.Vector3(l[3*d],l[3*d+1],l[3*d+2]);A=new THREE.Vector3(A,D,E);C=new THREE.Vector3(C,F,K);g.faces.push(new THREE.Face3(u,x,i,[t,A,C],null,0));g=k[2*d];d=k[2*d+1];i=k[2*e];t=k[2*e+1];u=k[2*
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],k=[];(function(a,g,i){for(var l,k,r,s=a.length;i<s;i+=g)l=a[i],k=a[i+1],r=a[i+2],l=l/16383*c,k=k/16383*c,r=r/16383*c,l+=d,k+=e,r+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(l,k,r)))})(g[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)})(g[0],8,3);(function(a,
|
|
|
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,i,t,u,x,w=a.length;for(c=0;c<w;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;u=d;x=e;i=f;var A=l[3*e],D=l[3*e+1],B=l[3*e+2],C=l[3*f],G=l[3*f+1],K=l[3*f+2];t=new THREE.Vector3(l[3*d],l[3*d+1],l[3*d+2]);A=new THREE.Vector3(A,D,B);C=new THREE.Vector3(C,G,K);g.faces.push(new THREE.Face3(u,x,i,[t,A,C],null,0));g=k[2*d];d=k[2*d+1];i=k[2*e];t=k[2*e+1];u=k[2*
|
|
|
f];x=k[2*f+1];f=b.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(u,x));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};
|
|
|
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;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(3*this.size3);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(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,f,g,h,i,l,k,p){g=(g-k)/(p-k);k=this.normal_cache;b[f]=h+g*this.delta;b[f+1]=i;b[f+2]=l;e[f]=this.lerp(k[a],k[a+3],g);e[f+1]=this.lerp(k[a+1],k[a+4],g);e[f+2]=this.lerp(k[a+2],k[a+5],g)};this.VIntY=function(a,b,e,f,g,h,i,l,k,p){g=(g-k)/(p-k);k=this.normal_cache;b[f]=h;b[f+1]=i+g*this.delta;b[f+2]=l;b=a+3*this.yd;
|
|
|
e[f]=this.lerp(k[a],k[b],g);e[f+1]=this.lerp(k[a+1],k[b+1],g);e[f+2]=this.lerp(k[a+2],k[b+2],g)};this.VIntZ=function(a,b,e,f,g,h,i,l,k,p){g=(g-k)/(p-k);k=this.normal_cache;b[f]=h;b[f+1]=i;b[f+2]=l+g*this.delta;b=a+3*this.zd;e[f]=this.lerp(k[a],k[b],g);e[f+1]=this.lerp(k[a+1],k[b+1],g);e[f+2]=this.lerp(k[a+2],k[b+2],g)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(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,f,g,h){var i=f+1,l=f+this.yd,k=f+this.zd,p=i+this.yd,n=i+this.zd,o=f+this.yd+this.zd,q=i+this.yd+this.zd,m=0,r=this.field[f],s=this.field[i],t=this.field[l],u=this.field[p],x=this.field[k],v=this.field[n],A=this.field[o],D=this.field[q];r<g&&(m|=1);s<g&&(m|=2);t<g&&(m|=8);u<g&&(m|=4);x<g&&(m|=16);v<g&&(m|=32);A<g&&(m|=128);D<g&&(m|=64);var E=THREE.edgeTable[m];if(0===E)return 0;var C=this.delta,F=a+
|
|
|
-C,K=b+C,C=e+C;E&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(3*f,this.vlist,this.nlist,0,g,a,b,e,r,s));E&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(3*i,this.vlist,this.nlist,3,g,F,b,e,s,u));E&4&&(this.compNorm(l),this.compNorm(p),this.VIntX(3*l,this.vlist,this.nlist,6,g,a,K,e,t,u));E&8&&(this.compNorm(f),this.compNorm(l),this.VIntY(3*f,this.vlist,this.nlist,9,g,a,b,e,r,t));E&16&&(this.compNorm(k),this.compNorm(n),this.VIntX(3*k,this.vlist,this.nlist,12,g,a,b,C,x,v));E&32&&(this.compNorm(n),
|
|
|
-this.compNorm(q),this.VIntY(3*n,this.vlist,this.nlist,15,g,F,b,C,v,D));E&64&&(this.compNorm(o),this.compNorm(q),this.VIntX(3*o,this.vlist,this.nlist,18,g,a,K,C,A,D));E&128&&(this.compNorm(k),this.compNorm(o),this.VIntY(3*k,this.vlist,this.nlist,21,g,a,b,C,x,A));E&256&&(this.compNorm(f),this.compNorm(k),this.VIntZ(3*f,this.vlist,this.nlist,24,g,a,b,e,r,x));E&512&&(this.compNorm(i),this.compNorm(n),this.VIntZ(3*i,this.vlist,this.nlist,27,g,F,b,e,s,v));E&1024&&(this.compNorm(p),this.compNorm(q),this.VIntZ(3*
|
|
|
-p,this.vlist,this.nlist,30,g,F,K,e,u,D));E&2048&&(this.compNorm(l),this.compNorm(o),this.VIntZ(3*l,this.vlist,this.nlist,33,g,a,K,e,t,A));m<<=4;for(g=f=0;-1!=THREE.triTable[m+g];)a=m+g,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),g+=3,f++;return f};this.posnormtriv=function(a,b,e,f,g,h){var i=3*this.count;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[f];this.positionArray[i+
|
|
|
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,f,g,h){var i=f+1,l=f+this.yd,k=f+this.zd,p=i+this.yd,o=i+this.zd,n=f+this.yd+this.zd,q=i+this.yd+this.zd,m=0,r=this.field[f],s=this.field[i],t=this.field[l],u=this.field[p],x=this.field[k],w=this.field[o],A=this.field[n],D=this.field[q];r<g&&(m|=1);s<g&&(m|=2);t<g&&(m|=8);u<g&&(m|=4);x<g&&(m|=16);w<g&&(m|=32);A<g&&(m|=128);D<g&&(m|=64);var B=THREE.edgeTable[m];if(0===B)return 0;var C=this.delta,G=a+
|
|
|
+C,K=b+C,C=e+C;B&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(3*f,this.vlist,this.nlist,0,g,a,b,e,r,s));B&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(3*i,this.vlist,this.nlist,3,g,G,b,e,s,u));B&4&&(this.compNorm(l),this.compNorm(p),this.VIntX(3*l,this.vlist,this.nlist,6,g,a,K,e,t,u));B&8&&(this.compNorm(f),this.compNorm(l),this.VIntY(3*f,this.vlist,this.nlist,9,g,a,b,e,r,t));B&16&&(this.compNorm(k),this.compNorm(o),this.VIntX(3*k,this.vlist,this.nlist,12,g,a,b,C,x,w));B&32&&(this.compNorm(o),
|
|
|
+this.compNorm(q),this.VIntY(3*o,this.vlist,this.nlist,15,g,G,b,C,w,D));B&64&&(this.compNorm(n),this.compNorm(q),this.VIntX(3*n,this.vlist,this.nlist,18,g,a,K,C,A,D));B&128&&(this.compNorm(k),this.compNorm(n),this.VIntY(3*k,this.vlist,this.nlist,21,g,a,b,C,x,A));B&256&&(this.compNorm(f),this.compNorm(k),this.VIntZ(3*f,this.vlist,this.nlist,24,g,a,b,e,r,x));B&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(3*i,this.vlist,this.nlist,27,g,G,b,e,s,w));B&1024&&(this.compNorm(p),this.compNorm(q),this.VIntZ(3*
|
|
|
+p,this.vlist,this.nlist,30,g,G,K,e,u,D));B&2048&&(this.compNorm(l),this.compNorm(n),this.VIntZ(3*l,this.vlist,this.nlist,33,g,a,K,e,t,A));m<<=4;for(g=f=0;-1!=THREE.triTable[m+g];)a=m+g,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),g+=3,f++;return f};this.posnormtriv=function(a,b,e,f,g,h){var i=3*this.count;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[f];this.positionArray[i+
|
|
|
4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[g];this.positionArray[i+7]=a[g+1];this.positionArray[i+8]=a[g+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[f];this.normalArray[i+4]=b[f+1];this.normalArray[i+5]=b[f+2];this.normalArray[i+6]=b[g];this.normalArray[i+7]=b[g+1];this.normalArray[i+8]=b[g+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(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,f,g){var h=this.size*Math.sqrt(f/g),i=e*this.size,l=b*this.size,k=a*this.size,p=Math.floor(i-h);1>p&&(p=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var n=Math.floor(l-h);1>n&&(n=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var o=Math.floor(k-h);1>o&&(o=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
|
|
|
-1);for(var q,m,r,s,t,u,x,k=p;k<i;k++){r=this.size2*k;t=k/this.size-e;u=t*t;for(p=n;p<l;p++){m=r+this.size*p;q=p/this.size-b;x=q*q;for(q=o;q<h;q++)s=q/this.size-a,s=f/(1.0E-6+s*s+x+u)-g,0<s&&(this.field[m+q]+=s)}}};this.addPlaneX=function(a,b){var e,f,g,h,i,l=this.size,k=this.yd,p=this.zd,n=this.field,o=l*Math.sqrt(a/b);o>l&&(o=l);for(e=0;e<o;e++)if(f=e/l,f*=f,h=a/(1.0E-4+f)-b,0<h)for(f=0;f<l;f++){i=e+f*k;for(g=0;g<l;g++)n[p*g+i]+=h}};this.addPlaneY=function(a,b){var e,f,g,h,i,l,k=this.size,p=this.yd,
|
|
|
-n=this.zd,o=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(f=0;f<q;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,0<h){i=f*p;for(e=0;e<k;e++){l=i+e;for(g=0;g<k;g++)o[n*g+l]+=h}}};this.addPlaneZ=function(a,b){var e,f,g,h,i,l,k=this.size,p=this.yd,n=this.zd,o=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(g=0;g<q;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-b,0<h){i=n*g;for(f=0;f<k;f++){l=i+f*p;for(e=0;e<k;e++)o[l+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
|
|
|
-function(a){this.begin();var b,e,f,g,h,i,l,k,p,n=this.size-2;for(g=1;g<n;g++){p=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(f=1;f<n;f++){k=p+this.size*f;i=(f-this.halfsize)/this.halfsize;for(e=1;e<n;e++)h=(e-this.halfsize)/this.halfsize,b=k+e,this.polygonize(h,i,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(f){var g,h,i,l,k,p,n,o;for(g=0;g<f.count;g++)n=3*g,k=n+1,o=n+2,h=f.positionArray[n],i=f.positionArray[k],l=
|
|
|
-f.positionArray[o],p=new THREE.Vector3(h,i,l),h=f.normalArray[n],i=f.normalArray[k],l=f.normalArray[o],n=new THREE.Vector3(h,i,l),n.normalize(),k=new THREE.Vertex(p),b.vertices.push(k),e.push(n);p=f.count/3;for(g=0;g<p;g++)n=3*(a+g),k=n+1,o=n+2,h=e[n],i=e[k],l=e[o],n=new THREE.Face3(n,k,o,[h,i,l]),b.faces.push(n);a+=p;f.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,f,g){var h=this.size*Math.sqrt(f/g),i=e*this.size,l=b*this.size,k=a*this.size,p=Math.floor(i-h);1>p&&(p=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(l-h);1>o&&(o=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var n=Math.floor(k-h);1>n&&(n=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
|
|
|
+1);for(var q,m,r,s,t,u,x,k=p;k<i;k++){r=this.size2*k;t=k/this.size-e;u=t*t;for(p=o;p<l;p++){m=r+this.size*p;q=p/this.size-b;x=q*q;for(q=n;q<h;q++)s=q/this.size-a,s=f/(1.0E-6+s*s+x+u)-g,0<s&&(this.field[m+q]+=s)}}};this.addPlaneX=function(a,b){var e,f,g,h,i,l=this.size,k=this.yd,p=this.zd,o=this.field,n=l*Math.sqrt(a/b);n>l&&(n=l);for(e=0;e<n;e++)if(f=e/l,f*=f,h=a/(1.0E-4+f)-b,0<h)for(f=0;f<l;f++){i=e+f*k;for(g=0;g<l;g++)o[p*g+i]+=h}};this.addPlaneY=function(a,b){var e,f,g,h,i,l,k=this.size,p=this.yd,
|
|
|
+o=this.zd,n=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(f=0;f<q;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,0<h){i=f*p;for(e=0;e<k;e++){l=i+e;for(g=0;g<k;g++)n[o*g+l]+=h}}};this.addPlaneZ=function(a,b){var e,f,g,h,i,l,k=this.size,p=this.yd,o=this.zd,n=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(g=0;g<q;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-b,0<h){i=o*g;for(f=0;f<k;f++){l=i+f*p;for(e=0;e<k;e++)n[l+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
|
|
|
+function(a){this.begin();var b,e,f,g,h,i,l,k,p,o=this.size-2;for(g=1;g<o;g++){p=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(f=1;f<o;f++){k=p+this.size*f;i=(f-this.halfsize)/this.halfsize;for(e=1;e<o;e++)h=(e-this.halfsize)/this.halfsize,b=k+e,this.polygonize(h,i,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(f){var g,h,i,l,k,p,o,n;for(g=0;g<f.count;g++)o=3*g,k=o+1,n=o+2,h=f.positionArray[o],i=f.positionArray[k],l=
|
|
|
+f.positionArray[n],p=new THREE.Vector3(h,i,l),h=f.normalArray[o],i=f.normalArray[k],l=f.normalArray[n],o=new THREE.Vector3(h,i,l),o.normalize(),k=new THREE.Vertex(p),b.vertices.push(k),e.push(o);p=f.count/3;for(g=0;g<p;g++)o=3*(a+g),k=o+1,n=o+2,h=e[o],i=e[k],l=e[n],o=new THREE.Face3(o,k,n,[h,i,l]),b.faces.push(o);a+=p;f.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
|
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
|
|
@@ -728,32 +729,32 @@ THREE.VisibleCamera=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){
|
|
|
this.update(a);this.add(new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces))};THREE.VisibleCamera.prototype=new THREE.Object3D;THREE.VisibleCamera.prototype.constructor=THREE.VisibleCamera;
|
|
|
THREE.VisibleCamera.prototype.update=function(a){function b(a,b,f,g){THREE.VisibleCamera.__v.set(b,f,g);THREE.VisibleCamera.__projector.unprojectVector(THREE.VisibleCamera.__v,THREE.VisibleCamera.__c);a=c.pointMap[a];if(void 0!==a){b=0;for(f=a.length;b<f;b++)c.lineGeometry.vertices[a[b]].position.copy(THREE.VisibleCamera.__v)}}var c=this;THREE.VisibleCamera.__c.projectionMatrix.copy(a.projectionMatrix);b("c",0,0,0);b("t",0,0,1);b("n1",-1,-1,0);b("n2",1,-1,0);b("n3",-1,1,0);b("n4",1,1,0);b("f1",-1,
|
|
|
-1,1);b("f2",1,-1,1);b("f3",-1,1,1);b("f4",1,1,1);b("u1",0.7,1.1,0);b("u2",-0.7,1.1,0);b("u3",0,2,0);b("cf1",-1,0,1);b("cf2",1,0,1);b("cf3",0,-1,1);b("cf4",0,1,1);b("cn1",-1,0,0);b("cn2",1,0,0);b("cn3",0,-1,0);b("cn4",0,1,0);this.lineGeometry.__dirtyVertices=!0};THREE.VisibleCamera.__projector=new THREE.Projector;THREE.VisibleCamera.__v=new THREE.Vector3;THREE.VisibleCamera.__c=new THREE.Camera;
|
|
|
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,l,k,p,n,o;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);e=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
|
|
|
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,l,k,p,o,n;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);e=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
|
|
|
0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;e[q++]=0;e[q++]=1;e[q++]=2;e[q++]=0;e[q++]=2;e[q++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);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,i);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);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,k=a(THREE.ShaderFlares.lensFlare)):(l=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));p={};n={};p.vertex=b.getAttribLocation(k,"position");p.uv=b.getAttribLocation(k,"uv");n.renderType=b.getUniformLocation(k,"renderType");n.map=b.getUniformLocation(k,"map");n.occlusionMap=b.getUniformLocation(k,"occlusionMap");n.opacity=b.getUniformLocation(k,"opacity");n.color=b.getUniformLocation(k,
|
|
|
-"color");n.scale=b.getUniformLocation(k,"scale");n.rotation=b.getUniformLocation(k,"rotation");n.screenPosition=b.getUniformLocation(k,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,t=a.length;if(t){var u=new THREE.Vector3,x=s/e,v=0.5*e,A=0.5*s,D=16/s,E=new THREE.Vector2(D*x,D),C=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),K=n,D=p;b.useProgram(k);o||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),o=!0);b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
|
|
|
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(D.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(D.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var L,R,N,P,B;for(L=0;L<t;L++)if(D=16/s,E.set(D*x,D),P=a[L],u.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(u),d.projectionMatrix.multiplyVector3(u),C.copy(u),F.x=C.x*v+v,F.y=C.y*A+A,l||0<F.x&&F.x<e&&0<F.y&&F.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
-h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(K.renderType,0);b.uniform2f(K.scale,E.x,E.y);b.uniform3f(K.screenPosition,C.x,C.y,C.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,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(K.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
|
|
|
-6,b.UNSIGNED_SHORT,0);P.positionScreen.copy(C);P.customUpdateCallback?P.customUpdateCallback(P):P.updateLensFlares();b.uniform1i(K.renderType,2);b.enable(b.BLEND);for(R=0,N=P.lensFlares.length;R<N;R++)if(B=P.lensFlares[R],0.0010<B.opacity&&0.0010<B.scale)C.x=B.x,C.y=B.y,C.z=B.z,D=B.size*B.scale/s,E.x=D*x,E.y=D,b.uniform3f(K.screenPosition,C.x,C.y,C.z),b.uniform2f(K.scale,E.x,E.y),b.uniform1f(K.rotation,B.rotation),b.uniform1f(K.opacity,B.opacity),b.uniform3f(K.color,B.color.r,B.color.g,B.color.b),
|
|
|
-c.setBlending(B.blending),c.setTexture(B.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,k=a(THREE.ShaderFlares.lensFlare)):(l=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));p={};o={};p.vertex=b.getAttribLocation(k,"position");p.uv=b.getAttribLocation(k,"uv");o.renderType=b.getUniformLocation(k,"renderType");o.map=b.getUniformLocation(k,"map");o.occlusionMap=b.getUniformLocation(k,"occlusionMap");o.opacity=b.getUniformLocation(k,"opacity");o.color=b.getUniformLocation(k,
|
|
|
+"color");o.scale=b.getUniformLocation(k,"scale");o.rotation=b.getUniformLocation(k,"rotation");o.screenPosition=b.getUniformLocation(k,"screenPosition");n=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,t=a.length;if(t){var u=new THREE.Vector3,x=s/e,w=0.5*e,A=0.5*s,D=16/s,B=new THREE.Vector2(D*x,D),C=new THREE.Vector3(1,1,0),G=new THREE.Vector2(1,1),K=o,D=p;b.useProgram(k);n||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),n=!0);b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
|
|
|
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(D.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(D.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var L,T,M,E,j;for(L=0;L<t;L++)if(D=16/s,B.set(D*x,D),E=a[L],u.set(E.matrixWorld.n14,E.matrixWorld.n24,E.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(u),d.projectionMatrix.multiplyVector3(u),C.copy(u),G.x=C.x*w+w,G.y=C.y*A+A,l||0<G.x&&G.x<e&&0<G.y&&G.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
+h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,G.x-8,G.y-8,16,16,0);b.uniform1i(K.renderType,0);b.uniform2f(K.scale,B.x,B.y);b.uniform3f(K.screenPosition,C.x,C.y,C.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,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,G.x-8,G.y-8,16,16,0);b.uniform1i(K.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
|
|
|
+6,b.UNSIGNED_SHORT,0);E.positionScreen.copy(C);E.customUpdateCallback?E.customUpdateCallback(E):E.updateLensFlares();b.uniform1i(K.renderType,2);b.enable(b.BLEND);for(T=0,M=E.lensFlares.length;T<M;T++)if(j=E.lensFlares[T],0.0010<j.opacity&&0.0010<j.scale)C.x=j.x,C.y=j.y,C.z=j.z,D=j.size*j.scale/s,B.x=D*x,B.y=D,b.uniform3f(K.screenPosition,C.x,C.y,C.z),b.uniform2f(K.scale,B.x,B.y),b.uniform1f(K.rotation,j.rotation),b.uniform1f(K.opacity,j.opacity),b.uniform3f(K.color,j.color.r,j.color.g,j.color.b),
|
|
|
+c.setBlending(j.blending),c.setTexture(j.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.ShadowMapPlugin=function(){var a,b,c,d,e,f=new THREE.Frustum,g=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(c){a=c.context;b=c;var c=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(c.uniforms);d=new THREE.ShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,uniforms:f});e=new THREE.ShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,uniforms:f,morphTargets:!0});d._shadowPass=!0;e._shadowPass=!0};this.render=
|
|
|
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,l,k,p,n,o,q,m,r=0,s=h.lights;c||(c=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(i=0,l=s.length;i<l;i++)if(q=s[i],q.castShadow&&q instanceof THREE.SpotLight){this.shadowMap[r]||(this.shadowMap[r]=new THREE.WebGLRenderTarget(b.shadowMapWidth,
|
|
|
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,l,k,p,o,n,q,m,r=0,s=h.lights;c||(c=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(i=0,l=s.length;i<l;i++)if(q=s[i],q.castShadow&&q instanceof THREE.SpotLight){this.shadowMap[r]||(this.shadowMap[r]=new THREE.WebGLRenderTarget(b.shadowMapWidth,
|
|
|
b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),this.shadowMatrix[r]=new THREE.Matrix4);k=this.shadowMap[r];p=this.shadowMatrix[r];c.position.copy(q.position);c.lookAt(q.target.position);null==c.parent&&(h.add(c),b.autoUpdateScene&&h.updateMatrixWorld());c.matrixWorldInverse.getInverse(c.matrixWorld);p.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);p.multiplySelf(c.projectionMatrix);p.multiplySelf(c.matrixWorldInverse);if(!c._viewMatrixArray)c._viewMatrixArray=
|
|
|
-new Float32Array(16);c.matrixWorldInverse.flattenToArray(c._viewMatrixArray);if(!c._projectionMatrixArray)c._projectionMatrixArray=new Float32Array(16);c.projectionMatrix.flattenToArray(c._projectionMatrixArray);g.multiply(c.projectionMatrix,c.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(k);b.clear();m=h.__webglObjects;for(k=0,p=m.length;k<p;k++)if(n=m[k],q=n.object,n.render=!1,q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||f.contains(q)))q.matrixWorld.flattenToArray(q._objectMatrixArray),
|
|
|
-q._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,q.matrixWorld,q._modelViewMatrixArray),n.render=!0;for(k=0,p=m.length;k<p;k++)if(n=m[k],n.render)q=n.object,n=n.buffer,b.setObjectFaces(q),o=q.customDepthMaterial?q.customDepthMaterial:q.geometry.morphTargets.length?e:d,n instanceof THREE.BufferGeometry?b.renderBufferDirect(c,s,null,o,n,q):b.renderBuffer(c,s,null,o,n,q);m=h.__webglObjectsImmediate;for(k=0,p=m.length;k<p;k++)n=m[k],q=n.object,q.visible&&q.castShadow&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),
|
|
|
+new Float32Array(16);c.matrixWorldInverse.flattenToArray(c._viewMatrixArray);if(!c._projectionMatrixArray)c._projectionMatrixArray=new Float32Array(16);c.projectionMatrix.flattenToArray(c._projectionMatrixArray);g.multiply(c.projectionMatrix,c.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(k);b.clear();m=h.__webglObjects;for(k=0,p=m.length;k<p;k++)if(o=m[k],q=o.object,o.render=!1,q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||f.contains(q)))q.matrixWorld.flattenToArray(q._objectMatrixArray),
|
|
|
+q._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,q.matrixWorld,q._modelViewMatrixArray),o.render=!0;for(k=0,p=m.length;k<p;k++)if(o=m[k],o.render)q=o.object,o=o.buffer,b.setObjectFaces(q),n=q.customDepthMaterial?q.customDepthMaterial:q.geometry.morphTargets.length?e:d,o instanceof THREE.BufferGeometry?b.renderBufferDirect(c,s,null,n,o,q):b.renderBuffer(c,s,null,n,o,q);m=h.__webglObjectsImmediate;for(k=0,p=m.length;k<p;k++)o=m[k],q=o.object,q.visible&&q.castShadow&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),
|
|
|
q._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,q.matrixWorld,q._modelViewMatrixArray),b.renderImmediateObject(c,s,null,d,q));r++}h=b.getClearColor();i=b.getClearAlpha();a.clearColor(h.r,h.g,h.b,i);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};
|
|
|
THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,l,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(o);b.compileShader(q);b.attachShader(n,o);b.attachShader(n,q);b.linkProgram(n);h=n;i={};l={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");l.uvOffset=b.getUniformLocation(h,"uvOffset");l.uvScale=b.getUniformLocation(h,
|
|
|
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,o=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(n);b.compileShader(q);b.attachShader(o,n);b.attachShader(o,q);b.linkProgram(o);h=o;i={};l={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");l.uvOffset=b.getUniformLocation(h,"uvOffset");l.uvScale=b.getUniformLocation(h,
|
|
|
"uvScale");l.rotation=b.getUniformLocation(h,"rotation");l.scale=b.getUniformLocation(h,"scale");l.alignment=b.getUniformLocation(h,"alignment");l.color=b.getUniformLocation(h,"color");l.map=b.getUniformLocation(h,"map");l.opacity=b.getUniformLocation(h,"opacity");l.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");l.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");l.screenPosition=b.getUniformLocation(h,"screenPosition");l.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
|
|
|
-l.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,e,o,q){var d=d.__webglSprites,m=d.length;if(m){var r=i,s=l,t=q/o,o=0.5*o,u=0.5*q,x=!0;b.useProgram(h);k||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(s.projectionMatrix,
|
|
|
-!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var v,A=[],r=0;r<m;r++)if(v=d[r],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(r=0;r<m;r++)v=d[r],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(v.position.x-
|
|
|
-o)/o,(u-v.position.y)/u,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,v._modelViewMatrixArray)),e=v.map.image.width/(v.scaleByViewport?q:1),A[0]=e*t*v.scale.x,A[1]=e*v.scale.y,b.uniform2f(s.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(s.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(s.alignment,v.alignment.x,v.alignment.y),b.uniform1f(s.opacity,v.opacity),b.uniform3f(s.color,
|
|
|
-v.color.r,v.color.g,v.color.b),b.uniform1f(s.rotation,v.rotation),b.uniform2fv(s.scale,A),v.mergeWith3D&&!x?(b.enable(b.DEPTH_TEST),x=!0):!v.mergeWith3D&&x&&(b.disable(b.DEPTH_TEST),x=!1),c.setBlending(v.blending),c.setTexture(v.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,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,l,k,p;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=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:n},mapRight:{type:"t",value:1,texture:o}},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}"}),
|
|
|
-m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(q);this.setSize=function(a,d){c.call(b,a,d);n.width=a;n.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||l!==c.near||k!==c.far||p!==c.fov){i=c.aspect;l=c.near;k=c.far;p=c.fov;var t=c.projectionMatrix.clone(),u=0.5*(125/30),x=u*l/125,v=l*Math.tan(p*Math.PI/360),A;g.n14=u;h.n14=-u;u=-v*i+x;A=v*i+x;t.n11=2*l/(A-u);t.n13=(A+u)/(A-u);e.projectionMatrix.copy(t);u=-v*i-x;A=v*i-x;t.n11=
|
|
|
-2*l/(A-u);t.n13=(A+u)/(A-u);f.projectionMatrix.copy(t)}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,n,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,o,!0);m.updateMatrixWorld();d.call(b,m,q)}};
|
|
|
+l.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,e,n,q){var d=d.__webglSprites,m=d.length;if(m){var r=i,s=l,t=q/n,n=0.5*n,u=0.5*q,x=!0;b.useProgram(h);k||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(s.projectionMatrix,
|
|
|
+!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var w,A=[],r=0;r<m;r++)if(w=d[r],w.visible&&0!==w.opacity)w.useScreenCoordinates?w.z=-w.position.z:(w._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,w.matrixWorld,w._modelViewMatrixArray),w.z=-w._modelViewMatrix.n34);d.sort(a);for(r=0;r<m;r++)w=d[r],w.visible&&0!==w.opacity&&w.map&&w.map.image&&w.map.image.width&&(w.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(w.position.x-
|
|
|
+n)/n,(u-w.position.y)/u,Math.max(0,Math.min(1,w.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,w.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,w._modelViewMatrixArray)),e=w.map.image.width/(w.scaleByViewport?q:1),A[0]=e*t*w.scale.x,A[1]=e*w.scale.y,b.uniform2f(s.uvScale,w.uvScale.x,w.uvScale.y),b.uniform2f(s.uvOffset,w.uvOffset.x,w.uvOffset.y),b.uniform2f(s.alignment,w.alignment.x,w.alignment.y),b.uniform1f(s.opacity,w.opacity),b.uniform3f(s.color,
|
|
|
+w.color.r,w.color.g,w.color.b),b.uniform1f(s.rotation,w.rotation),b.uniform2fv(s.scale,A),w.mergeWith3D&&!x?(b.enable(b.DEPTH_TEST),x=!0):!w.mergeWith3D&&x&&(b.disable(b.DEPTH_TEST),x=!1),c.setBlending(w.blending),c.setTexture(w.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,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,l,k,p;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=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:o},mapRight:{type:"t",value:1,texture:n}},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}"}),
|
|
|
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(q);this.setSize=function(a,d){c.call(b,a,d);o.width=a;o.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||l!==c.near||k!==c.far||p!==c.fov){i=c.aspect;l=c.near;k=c.far;p=c.fov;var t=c.projectionMatrix.clone(),u=0.5*(125/30),x=u*l/125,w=l*Math.tan(p*Math.PI/360),A;g.n14=u;h.n14=-u;u=-w*i+x;A=w*i+x;t.n11=2*l/(A-u);t.n13=(A+u)/(A-u);e.projectionMatrix.copy(t);u=-w*i-x;A=w*i-x;t.n11=
|
|
|
+2*l/(A-u);t.n13=(A+u)/(A-u);f.projectionMatrix.copy(t)}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,o,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,n,!0);m.updateMatrixWorld();d.call(b,m,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,f,g=new THREE.PerspectiveCamera;g.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&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;f=d};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=
|
|
|
c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,f);d.call(b,a,g);this.setViewport(e,0,e,f);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:"precision mediump float;\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}"},
|