|
@@ -19,42 +19,42 @@ this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elemen
|
|
|
THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=this.w+a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x=
|
|
|
this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
|
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};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,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],h=d[5],j=d[6],k=d[7],l=d[8],p=d[9],m=d[10],o=d[11],r=d[12],n=d[13],q=d[14],d=d[15];c[0].set(f-a,k-g,o-l,d-r);c[1].set(f+a,k+g,o+l,d+r);c[2].set(f+b,k+h,o+p,d+n);c[3].set(f-b,k-h,o-p,d-n);c[4].set(f-e,k-j,o-m,d-q);c[5].set(f+e,k+j,o+m,d+q);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
|
|
|
+THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],h=d[5],j=d[6],l=d[7],k=d[8],p=d[9],m=d[10],o=d[11],q=d[12],n=d[13],r=d[14],d=d[15];c[0].set(f-a,l-g,o-k,d-q);c[1].set(f+a,l+g,o+k,d+q);c[2].set(f+b,l+h,o+p,d+n);c[3].set(f-b,l-h,o-p,d-n);c[4].set(f-e,l-j,o-m,d-r);c[5].set(f+e,l+j,o+m,d+r);for(a=0;a<6;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=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),e=0;e<6;e++){a=b[e].x*d[12]+b[e].y*d[13]+b[e].z*d[14]+b[e].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
|
|
|
-THREE.Ray=function(a,b){function c(a,b,c){r.sub(c,a);u=r.dot(b);t=n.add(a,q.copy(b).multiplyScalar(u));return y=c.distanceTo(t)}function d(a,b,c,d){r.sub(d,b);n.sub(c,b);q.sub(a,b);s=r.dot(r);x=r.dot(n);D=r.dot(q);B=n.dot(n);w=n.dot(q);v=1/(s*B-x*x);C=(B*D-x*w)*v;K=(s*w-x*D)*v;return C>=0&&K>=0&&C+K<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,
|
|
|
-k=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,n=[];if(a instanceof THREE.Particle){var r=c(this.origin,this.direction,a.matrixWorld.getPosition());if(r>a.scale.x)return[];b={distance:r,point:a.position,face:null,object:a};n.push(b)}else if(a instanceof THREE.Mesh){var r=c(this.origin,this.direction,a.matrixWorld.getPosition()),q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
|
|
|
-a.matrixWorld.getColumnZ().length());if(r>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return n;var s,i,u=a.geometry,t=u.vertices,H;a.matrixRotationWorld.extractRotation(a.matrixWorld);r=0;for(q=u.faces.length;r<q;r++){b=u.faces[r];k.copy(this.origin);l.copy(this.direction);H=a.matrixWorld;p=H.multiplyVector3(p.copy(b.centroid)).subSelf(k);m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal));s=l.dot(m);if(!(Math.abs(s)<e)){i=m.dot(p)/s;if(!(i<0)&&(a.doubleSided||(a.flipSided?
|
|
|
-s>0:s<0))){o.add(k,l.multiplyScalar(i));if(b instanceof THREE.Face3){f=H.multiplyVector3(f.copy(t[b.a]));g=H.multiplyVector3(g.copy(t[b.b]));h=H.multiplyVector3(h.copy(t[b.c]));if(d(o,f,g,h)){b={distance:k.distanceTo(o),point:o.clone(),face:b,object:a};n.push(b)}}else if(b instanceof THREE.Face4){f=H.multiplyVector3(f.copy(t[b.a]));g=H.multiplyVector3(g.copy(t[b.b]));h=H.multiplyVector3(h.copy(t[b.c]));j=H.multiplyVector3(j.copy(t[b.d]));if(d(o,f,g,j)||d(o,g,h,j)){b={distance:k.distanceTo(o),point:o.clone(),
|
|
|
-face:b,object:a};n.push(b)}}}}}}return n};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,u,t,y,s,x,D,B,w,v,C,K};
|
|
|
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=true;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,l,p){h=false;b=f;c=g;d=l;e=p;a()};this.addPoint=function(f,g){if(h){h=false;b=f;c=g;d=f;e=g}else{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,l,p,m,o){if(h){h=false;b=f<l?f<m?f:m:l<m?l:m;c=g<p?g<o?g:o:p<o?p:o;d=f>l?f>m?f:m:l>m?l:m;e=g>p?g>o?g:o:p>o?p:o}else{b=f<l?f<m?f<b?f:b:m<b?m:b:l<m?l<b?l:b:m<b?m: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>l?f>m?f>d?f:d:m>d?m:d:l>m?l>d?l:d:m>d?m: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){if(h){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();c=c<f.getTop()?c:f.getTop();
|
|
|
+THREE.Ray=function(a,b){function c(a,b,c){q.sub(c,a);u=q.dot(b);t=n.add(a,r.copy(b).multiplyScalar(u));return x=c.distanceTo(t)}function d(a,b,c,d){q.sub(d,b);n.sub(c,b);r.sub(a,b);s=q.dot(q);w=q.dot(n);F=q.dot(r);E=n.dot(n);z=n.dot(r);v=1/(s*E-w*w);C=(E*F-w*z)*v;J=(s*z-w*F)*v;return C>=0&&J>=0&&C+J<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,
|
|
|
+l=new THREE.Vector3,k=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,n=[];if(a instanceof THREE.Particle){var q=c(this.origin,this.direction,a.matrixWorld.getPosition());if(q>a.scale.x)return[];b={distance:q,point:a.position,face:null,object:a};n.push(b)}else if(a instanceof THREE.Mesh){var q=c(this.origin,this.direction,a.matrixWorld.getPosition()),r=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
|
|
|
+a.matrixWorld.getColumnZ().length());if(q>a.geometry.boundingSphere.radius*Math.max(r.x,Math.max(r.y,r.z)))return n;var s,i,u=a.geometry,t=u.vertices,A;a.matrixRotationWorld.extractRotation(a.matrixWorld);q=0;for(r=u.faces.length;q<r;q++){b=u.faces[q];l.copy(this.origin);k.copy(this.direction);A=a.matrixWorld;p=A.multiplyVector3(p.copy(b.centroid)).subSelf(l);m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal));s=k.dot(m);if(!(Math.abs(s)<e)){i=m.dot(p)/s;if(!(i<0)&&(a.doubleSided||(a.flipSided?
|
|
|
+s>0:s<0))){o.add(l,k.multiplyScalar(i));if(b instanceof THREE.Face3){f=A.multiplyVector3(f.copy(t[b.a]));g=A.multiplyVector3(g.copy(t[b.b]));h=A.multiplyVector3(h.copy(t[b.c]));if(d(o,f,g,h)){b={distance:l.distanceTo(o),point:o.clone(),face:b,object:a};n.push(b)}}else if(b instanceof THREE.Face4){f=A.multiplyVector3(f.copy(t[b.a]));g=A.multiplyVector3(g.copy(t[b.b]));h=A.multiplyVector3(h.copy(t[b.c]));j=A.multiplyVector3(j.copy(t[b.d]));if(d(o,f,g,j)||d(o,g,h,j)){b={distance:l.distanceTo(o),point:o.clone(),
|
|
|
+face:b,object:a};n.push(b)}}}}}}return n};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var q=new THREE.Vector3,n=new THREE.Vector3,r=new THREE.Vector3,u,t,x,s,w,F,E,z,v,C,J};
|
|
|
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=true;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=false;b=f;c=g;d=k;e=p;a()};this.addPoint=function(f,g){if(h){h=false;b=f;c=g;d=f;e=g}else{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,m,o){if(h){h=false;b=f<k?f<m?f:m:k<m?k:m;c=g<p?g<o?g:o:p<o?p:o;d=f>k?f>m?f:m:k>m?k:m;e=g>p?g>o?g:o:p>o?p:o}else{b=f<k?f<m?f<b?f:b:m<b?m:b:k<m?k<b?k:b:m<b?m: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>m?f>d?f:d:m>d?m:d:k>m?k>d?k:d:m>d?m: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){if(h){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{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=b-f;c=c-f;d=d+f;e=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()?false:true};this.empty=function(){h=true;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())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
|
|
|
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],j=-b[9]*b[0]+b[1]*b[8],k=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*j;l[8]=b*k;return this},
|
|
|
-transpose:function(){var a,b=this.elements;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,j,k,l,p,m,o,r,n){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,j||0,k||0,l!==void 0?l:1,p||0,m||0,o||0,r||0,n!==void 0?n:1)};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,j,k,l,p,m,o,r,n){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=j;q[6]=k;q[10]=l;q[14]=p;q[3]=m;q[7]=o;q[11]=r;q[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
|
|
|
-e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],j=c[12],k=c[1],l=c[5],p=c[9],m=c[13],o=c[2],r=c[6],n=c[10],q=c[14],u=c[3],t=c[7],y=c[11],c=c[15],s=d[0],x=d[4],
|
|
|
-D=d[8],B=d[12],w=d[1],v=d[5],C=d[9],K=d[13],L=d[2],T=d[6],P=d[10],J=d[14],N=d[3],F=d[7],i=d[11],d=d[15];e[0]=f*s+g*w+h*L+j*N;e[4]=f*x+g*v+h*T+j*F;e[8]=f*D+g*C+h*P+j*i;e[12]=f*B+g*K+h*J+j*d;e[1]=k*s+l*w+p*L+m*N;e[5]=k*x+l*v+p*T+m*F;e[9]=k*D+l*C+p*P+m*i;e[13]=k*B+l*K+p*J+m*d;e[2]=o*s+r*w+n*L+q*N;e[6]=o*x+r*v+n*T+q*F;e[10]=o*D+r*C+n*P+q*i;e[14]=o*B+r*K+n*J+q*d;e[3]=u*s+t*w+y*L+c*N;e[7]=u*x+t*v+y*T+c*F;e[11]=u*D+t*C+y*P+c*i;e[15]=u*B+t*K+y*J+c*d;return this},multiplySelf:function(a){return this.multiply(this,
|
|
|
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],j=-b[9]*b[0]+b[1]*b[8],l=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,k=this.elements;k[0]=b*a;k[1]=b*c;k[2]=b*d;k[3]=b*e;k[4]=b*f;k[5]=b*g;k[6]=b*h;k[7]=b*j;k[8]=b*l;return this},
|
|
|
+transpose:function(){var a,b=this.elements;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,j,l,k,p,m,o,q,n){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,j||0,l||0,k!==void 0?k:1,p||0,m||0,o||0,q||0,n!==void 0?n:1)};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,j,l,k,p,m,o,q,n){var r=this.elements;r[0]=a;r[4]=b;r[8]=c;r[12]=d;r[1]=e;r[5]=f;r[9]=g;r[13]=h;r[2]=j;r[6]=l;r[10]=k;r[14]=p;r[3]=m;r[7]=o;r[11]=q;r[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
|
|
|
+e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],j=c[12],l=c[1],k=c[5],p=c[9],m=c[13],o=c[2],q=c[6],n=c[10],r=c[14],u=c[3],t=c[7],x=c[11],c=c[15],s=d[0],w=d[4],
|
|
|
+F=d[8],E=d[12],z=d[1],v=d[5],C=d[9],J=d[13],L=d[2],W=d[6],P=d[10],B=d[14],M=d[3],G=d[7],i=d[11],d=d[15];e[0]=f*s+g*z+h*L+j*M;e[4]=f*w+g*v+h*W+j*G;e[8]=f*F+g*C+h*P+j*i;e[12]=f*E+g*J+h*B+j*d;e[1]=l*s+k*z+p*L+m*M;e[5]=l*w+k*v+p*W+m*G;e[9]=l*F+k*C+p*P+m*i;e[13]=l*E+k*J+p*B+m*d;e[2]=o*s+q*z+n*L+r*M;e[6]=o*w+q*v+n*W+r*G;e[10]=o*F+q*C+n*P+r*i;e[14]=o*E+q*J+n*B+r*d;e[3]=u*s+t*z+x*L+c*M;e[7]=u*w+t*v+x*W+c*G;e[11]=u*F+t*C+x*P+c*i;e[15]=u*E+t*J+x*B+c*d;return this},multiplySelf:function(a){return this.multiply(this,
|
|
|
a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
|
|
|
b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},rotateAxis:function(a){var b=this.elements,c=a.x,
|
|
|
-d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],j=a[13],k=a[2],l=a[6],p=a[10],m=a[14],o=a[3],r=a[7],
|
|
|
-n=a[11],a=a[15];return e*h*l*o-d*j*l*o-e*g*p*o+c*j*p*o+d*g*m*o-c*h*m*o-e*h*k*r+d*j*k*r+e*f*p*r-b*j*p*r-d*f*m*r+b*h*m*r+e*g*k*n-c*j*k*n-e*f*l*n+b*j*l*n+c*f*m*n-b*g*m*n-d*g*k*a+c*h*k*a+d*f*l*a-b*h*l*a-c*f*p*a+b*g*p*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
|
|
|
+d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],j=a[13],l=a[2],k=a[6],p=a[10],m=a[14],o=a[3],q=a[7],
|
|
|
+n=a[11],a=a[15];return e*h*k*o-d*j*k*o-e*g*p*o+c*j*p*o+d*g*m*o-c*h*m*o-e*h*l*q+d*j*l*q+e*f*p*q-b*j*p*q-d*f*m*q+b*h*m*q+e*g*l*n-c*j*l*n-e*f*k*n+b*j*k*n+c*f*m*n-b*g*m*n-d*g*l*a+c*h*l*a+d*f*k*a-b*h*k*a-c*f*p*a+b*g*p*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
|
|
|
a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],
|
|
|
-a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],j=c[5],k=c[9],l=c[13],p=c[2],m=c[6],o=c[10],r=
|
|
|
-c[14],n=c[3],q=c[7],u=c[11],c=c[15];b[0]=k*r*q-l*o*q+l*m*u-j*r*u-k*m*c+j*o*c;b[4]=g*o*q-f*r*q-g*m*u+e*r*u+f*m*c-e*o*c;b[8]=f*l*q-g*k*q+g*j*u-e*l*u-f*j*c+e*k*c;b[12]=g*k*m-f*l*m-g*j*o+e*l*o+f*j*r-e*k*r;b[1]=l*o*n-k*r*n-l*p*u+h*r*u+k*p*c-h*o*c;b[5]=f*r*n-g*o*n+g*p*u-d*r*u-f*p*c+d*o*c;b[9]=g*k*n-f*l*n-g*h*u+d*l*u+f*h*c-d*k*c;b[13]=f*l*p-g*k*p+g*h*o-d*l*o-f*h*r+d*k*r;b[2]=j*r*n-l*m*n+l*p*q-h*r*q-j*p*c+h*m*c;b[6]=g*m*n-e*r*n-g*p*q+d*r*q+e*p*c-d*m*c;b[10]=e*l*n-g*j*n+g*h*q-d*l*q-e*h*c+d*j*c;b[14]=g*j*p-
|
|
|
-e*l*p-g*h*m+d*l*m+e*h*r-d*j*r;b[3]=k*m*n-j*o*n-k*p*q+h*o*q+j*p*u-h*m*u;b[7]=e*o*n-f*m*n+f*p*q-d*o*q-e*p*u+d*m*u;b[11]=f*j*n-e*k*n-f*h*q+d*k*q+e*h*u-d*j*u;b[15]=e*k*p-f*j*p+f*h*m-d*k*m-e*h*o+d*j*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var k=h*j,l=h*f,p=e*j,m=e*f;c[0]=k+m*d;c[4]=p*d-l;c[8]=g*e;c[1]=g*f;c[5]=g*
|
|
|
-j;c[9]=-d;c[2]=l*d-p;c[6]=m+k*d;c[10]=g*h;break;case "ZXY":k=h*j;l=h*f;p=e*j;m=e*f;c[0]=k-m*d;c[4]=-g*f;c[8]=p+l*d;c[1]=l+p*d;c[5]=g*j;c[9]=m-k*d;c[2]=-g*e;c[6]=d;c[10]=g*h;break;case "ZYX":k=g*j;l=g*f;p=d*j;m=d*f;c[0]=h*j;c[4]=p*e-l;c[8]=k*e+m;c[1]=h*f;c[5]=m*e+k;c[9]=l*e-p;c[2]=-e;c[6]=d*h;c[10]=g*h;break;case "YZX":k=g*h;l=g*e;p=d*h;m=d*e;c[0]=h*j;c[4]=m-k*f;c[8]=p*f+l;c[1]=f;c[5]=g*j;c[9]=-d*j;c[2]=-e*j;c[6]=l*f+p;c[10]=k-m*f;break;case "XZY":k=g*h;l=g*e;p=d*h;m=d*e;c[0]=h*j;c[4]=-f;c[8]=e*j;
|
|
|
-c[1]=k*f+m;c[5]=g*j;c[9]=l*f-p;c[2]=p*f-l;c[6]=d*j;c[10]=m*f+k;break;default:k=g*j;l=g*f;p=d*j;m=d*f;c[0]=h*j;c[4]=-h*f;c[8]=e;c[1]=l+p*e;c[5]=k-m*e;c[9]=-d*h;c[2]=m-k*e;c[6]=p+l*e;c[10]=g*h}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,j=e+e,a=c*g,k=c*h,c=c*j,l=d*h,d=d*j,e=e*j,g=f*g,h=f*h,f=f*j;b[0]=1-(l+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},compose:function(a,b,c){var d=this.elements,
|
|
|
+a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],j=c[5],l=c[9],k=c[13],p=c[2],m=c[6],o=c[10],q=
|
|
|
+c[14],n=c[3],r=c[7],u=c[11],c=c[15];b[0]=l*q*r-k*o*r+k*m*u-j*q*u-l*m*c+j*o*c;b[4]=g*o*r-f*q*r-g*m*u+e*q*u+f*m*c-e*o*c;b[8]=f*k*r-g*l*r+g*j*u-e*k*u-f*j*c+e*l*c;b[12]=g*l*m-f*k*m-g*j*o+e*k*o+f*j*q-e*l*q;b[1]=k*o*n-l*q*n-k*p*u+h*q*u+l*p*c-h*o*c;b[5]=f*q*n-g*o*n+g*p*u-d*q*u-f*p*c+d*o*c;b[9]=g*l*n-f*k*n-g*h*u+d*k*u+f*h*c-d*l*c;b[13]=f*k*p-g*l*p+g*h*o-d*k*o-f*h*q+d*l*q;b[2]=j*q*n-k*m*n+k*p*r-h*q*r-j*p*c+h*m*c;b[6]=g*m*n-e*q*n-g*p*r+d*q*r+e*p*c-d*m*c;b[10]=e*k*n-g*j*n+g*h*r-d*k*r-e*h*c+d*j*c;b[14]=g*j*p-
|
|
|
+e*k*p-g*h*m+d*k*m+e*h*q-d*j*q;b[3]=l*m*n-j*o*n-l*p*r+h*o*r+j*p*u-h*m*u;b[7]=e*o*n-f*m*n+f*p*r-d*o*r-e*p*u+d*m*u;b[11]=f*j*n-e*l*n-f*h*r+d*l*r+e*h*u-d*j*u;b[15]=e*l*p-f*j*p+f*h*m-d*l*m-e*h*o+d*j*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var l=h*j,k=h*f,p=e*j,m=e*f;c[0]=l+m*d;c[4]=p*d-k;c[8]=g*e;c[1]=g*f;c[5]=g*
|
|
|
+j;c[9]=-d;c[2]=k*d-p;c[6]=m+l*d;c[10]=g*h;break;case "ZXY":l=h*j;k=h*f;p=e*j;m=e*f;c[0]=l-m*d;c[4]=-g*f;c[8]=p+k*d;c[1]=k+p*d;c[5]=g*j;c[9]=m-l*d;c[2]=-g*e;c[6]=d;c[10]=g*h;break;case "ZYX":l=g*j;k=g*f;p=d*j;m=d*f;c[0]=h*j;c[4]=p*e-k;c[8]=l*e+m;c[1]=h*f;c[5]=m*e+l;c[9]=k*e-p;c[2]=-e;c[6]=d*h;c[10]=g*h;break;case "YZX":l=g*h;k=g*e;p=d*h;m=d*e;c[0]=h*j;c[4]=m-l*f;c[8]=p*f+k;c[1]=f;c[5]=g*j;c[9]=-d*j;c[2]=-e*j;c[6]=k*f+p;c[10]=l-m*f;break;case "XZY":l=g*h;k=g*e;p=d*h;m=d*e;c[0]=h*j;c[4]=-f;c[8]=e*j;
|
|
|
+c[1]=l*f+m;c[5]=g*j;c[9]=k*f-p;c[2]=p*f-k;c[6]=d*j;c[10]=m*f+l;break;default:l=g*j;k=g*f;p=d*j;m=d*f;c[0]=h*j;c[4]=-h*f;c[8]=e;c[1]=k+p*e;c[5]=l-m*e;c[9]=-d*h;c[2]=m-l*e;c[6]=p+k*e;c[10]=g*h}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,j=e+e,a=c*g,l=c*h,c=c*j,k=d*h,d=d*j,e=e*j,g=f*g,h=f*h,f=f*j;b[0]=1-(k+e);b[4]=l-f;b[8]=c+h;b[1]=l+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+k);return this},compose:function(a,b,c){var d=this.elements,
|
|
|
e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);g.set(d[8],d[9],d[10]);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=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;
|
|
|
b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*
|
|
|
-d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],j=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*j;b[7]=l*f+a*k;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*j-a*e;b[11]=l*k-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],j=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*j;b[3]=l*f-a*k;b[8]=l*g+a*c;b[9]=
|
|
|
-l*h+a*d;b[10]=l*j+a*e;b[11]=l*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],j=b[6],k=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*j;b[3]=l*f+a*k;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*j-a*e;b[7]=l*k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
|
|
|
-e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,j=f*f,k=Math.cos(b),l=Math.sin(b),p=1-k,m=d*e*p,o=d*f*p,p=e*f*p,d=d*l,r=e*l,l=f*l,f=g+(1-g)*k,g=m+l,e=o-r,m=m-l,h=h+(1-h)*k,l=p+d,o=o+r,p=p-d,j=j+(1-j)*k,k=c[0],d=c[1],r=c[2],n=c[3],q=c[4],u=c[5],t=c[6],y=c[7],s=c[8],x=c[9],D=c[10],B=c[11];c[0]=f*k+g*q+e*s;c[1]=f*d+g*u+e*x;c[2]=f*r+g*t+e*D;c[3]=f*n+g*y+e*B;c[4]=m*k+h*q+l*s;c[5]=m*d+h*u+l*x;c[6]=m*r+h*t+l*D;c[7]=m*n+h*y+l*B;c[8]=o*k+p*q+j*s;c[9]=o*d+p*u+j*x;c[10]=o*r+p*t+j*D;c[11]=
|
|
|
-o*n+p*y+j*B;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
|
|
|
-makeRotationX: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},makeRotationY: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},makeRotationZ: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},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,j=e*f,k=e*g;this.set(j*f+c,j*g-d*h,j*h+d*g,0,j*g+d*h,k*g+c,k*h-d*f,0,j*h-
|
|
|
-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,
|
|
|
-b,c,d,e,f){var g=this.elements,h=b-a,j=c-d,k=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/j;g[9]=0;g[13]=-((c+d)/j);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((f+e)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;
|
|
|
+d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],j=b[10],l=b[11],k=Math.cos(a),a=Math.sin(a);b[4]=k*c+a*g;b[5]=k*d+a*h;b[6]=k*e+a*j;b[7]=k*f+a*l;b[8]=k*g-a*c;b[9]=k*h-a*d;b[10]=k*j-a*e;b[11]=k*l-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],j=b[10],l=b[11],k=Math.cos(a),a=Math.sin(a);b[0]=k*c-a*g;b[1]=k*d-a*h;b[2]=k*e-a*j;b[3]=k*f-a*l;b[8]=k*g+a*c;b[9]=
|
|
|
+k*h+a*d;b[10]=k*j+a*e;b[11]=k*l+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],j=b[6],l=b[7],k=Math.cos(a),a=Math.sin(a);b[0]=k*c+a*g;b[1]=k*d+a*h;b[2]=k*e+a*j;b[3]=k*f+a*l;b[4]=k*g-a*c;b[5]=k*h-a*d;b[6]=k*j-a*e;b[7]=k*l-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
|
|
|
+e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,j=f*f,l=Math.cos(b),k=Math.sin(b),p=1-l,m=d*e*p,o=d*f*p,p=e*f*p,d=d*k,q=e*k,k=f*k,f=g+(1-g)*l,g=m+k,e=o-q,m=m-k,h=h+(1-h)*l,k=p+d,o=o+q,p=p-d,j=j+(1-j)*l,l=c[0],d=c[1],q=c[2],n=c[3],r=c[4],u=c[5],t=c[6],x=c[7],s=c[8],w=c[9],F=c[10],E=c[11];c[0]=f*l+g*r+e*s;c[1]=f*d+g*u+e*w;c[2]=f*q+g*t+e*F;c[3]=f*n+g*x+e*E;c[4]=m*l+h*r+k*s;c[5]=m*d+h*u+k*w;c[6]=m*q+h*t+k*F;c[7]=m*n+h*x+k*E;c[8]=o*l+p*r+j*s;c[9]=o*d+p*u+j*w;c[10]=o*q+p*t+j*F;c[11]=
|
|
|
+o*n+p*x+j*E;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
|
|
|
+makeRotationX: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},makeRotationY: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},makeRotationZ: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},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,j=e*f,l=e*g;this.set(j*f+c,j*g-d*h,j*h+d*g,0,j*g+d*h,l*g+c,l*h-d*f,0,j*h-
|
|
|
+d*g,l*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,
|
|
|
+b,c,d,e,f){var g=this.elements,h=b-a,j=c-d,l=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/j;g[9]=0;g[13]=-((c+d)/j);g[2]=0;g[6]=0;g[10]=-2/l;g[14]=-((f+e)/l);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;
|
|
|
THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
|
true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
|
|
@@ -63,23 +63,23 @@ this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,
|
|
|
this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
|
|
|
this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},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=false;a=true}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=k[j]=k[j]||new THREE.RenderableVertex;j++;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(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
|
|
|
-d);return true}var e,f,g=[],h,j,k=[],l,p,m=[],o,r=[],n,q,u=[],t,y,s=[],x={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,B=new THREE.Vector4,w=new THREE.Matrix4,v=new THREE.Matrix4,C=new THREE.Frustum,K=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);w.multiply(b.projectionMatrix,b.matrixWorldInverse);w.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
-w.multiply(b.matrixWorld,b.projectionMatrixInverse);w.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;x.objects.length=0;x.sprites.length=0;x.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||C.contains(b))){D.copy(b.matrixWorld.getPosition());
|
|
|
-w.multiplyVector3(D);e=a();e.object=b;e.z=D.z;x.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){D.copy(b.matrixWorld.getPosition());w.multiplyVector3(D);e=a();e.object=b;e.z=D.z;x.sprites.push(e)}else b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&x.objects.sort(c);return x};this.projectScene=function(a,e,f){var g=e.near,F=e.far,i=false,D,E,H,W,G,ha,fa,la,R,$,ba,aa,ea,Na,wa;y=q=o=p=0;x.elements.length=0;
|
|
|
-if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);w.multiply(e.projectionMatrix,e.matrixWorldInverse);C.setFromMatrix(w);x=this.projectGraph(a,false);a=0;for(D=x.objects.length;a<D;a++){R=x.objects[a].object;$=R.matrixWorld;j=0;if(R instanceof THREE.Mesh){ba=R.geometry;aa=R.geometry.materials;W=ba.vertices;ea=ba.faces;Na=ba.faceVertexUvs;ba=R.matrixRotationWorld.extractRotation($);
|
|
|
-E=0;for(H=W.length;E<H;E++){h=b();h.positionWorld.copy(W[E]);$.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);w.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<F}W=0;for(E=ea.length;W<E;W++){H=ea[W];if(H instanceof THREE.Face3){G=k[H.a];ha=k[H.b];fa=k[H.c];if(G.visible&&ha.visible&&fa.visible){i=(fa.positionScreen.x-G.positionScreen.x)*
|
|
|
-(ha.positionScreen.y-G.positionScreen.y)-(fa.positionScreen.y-G.positionScreen.y)*(ha.positionScreen.x-G.positionScreen.x)<0;if(R.doubleSided||i!=R.flipSided){la=m[p]=m[p]||new THREE.RenderableFace3;p++;l=la;l.v1.copy(G);l.v2.copy(ha);l.v3.copy(fa)}else continue}else continue}else if(H instanceof THREE.Face4){G=k[H.a];ha=k[H.b];fa=k[H.c];la=k[H.d];if(G.visible&&ha.visible&&fa.visible&&la.visible){i=(la.positionScreen.x-G.positionScreen.x)*(ha.positionScreen.y-G.positionScreen.y)-(la.positionScreen.y-
|
|
|
-G.positionScreen.y)*(ha.positionScreen.x-G.positionScreen.x)<0||(ha.positionScreen.x-fa.positionScreen.x)*(la.positionScreen.y-fa.positionScreen.y)-(ha.positionScreen.y-fa.positionScreen.y)*(la.positionScreen.x-fa.positionScreen.x)<0;if(R.doubleSided||i!=R.flipSided){wa=r[o]=r[o]||new THREE.RenderableFace4;o++;l=wa;l.v1.copy(G);l.v2.copy(ha);l.v3.copy(fa);l.v4.copy(la)}else continue}else continue}l.normalWorld.copy(H.normal);!i&&(R.flipSided||R.doubleSided)&&l.normalWorld.negate();ba.multiplyVector3(l.normalWorld);
|
|
|
-l.centroidWorld.copy(H.centroid);$.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);w.multiplyVector3(l.centroidScreen);fa=H.vertexNormals;G=0;for(ha=fa.length;G<ha;G++){la=l.vertexNormalsWorld[G];la.copy(fa[G]);!i&&(R.flipSided||R.doubleSided)&&la.negate();ba.multiplyVector3(la)}G=0;for(ha=Na.length;G<ha;G++)if(wa=Na[G][W]){fa=0;for(la=wa.length;fa<la;fa++)l.uvs[G][fa]=wa[fa]}l.material=R.material;l.faceMaterial=H.materialIndex!==null?aa[H.materialIndex]:null;l.z=l.centroidScreen.z;
|
|
|
-x.elements.push(l)}}else if(R instanceof THREE.Line){v.multiply(w,$);W=R.geometry.vertices;G=b();G.positionScreen.copy(W[0]);v.multiplyVector4(G.positionScreen);$=R.type===THREE.LinePieces?2:1;E=1;for(H=W.length;E<H;E++){G=b();G.positionScreen.copy(W[E]);v.multiplyVector4(G.positionScreen);if(!((E+1)%$>0)){ha=k[j-2];K.copy(G.positionScreen);L.copy(ha.positionScreen);if(d(K,L)){K.multiplyScalar(1/K.w);L.multiplyScalar(1/L.w);aa=u[q]=u[q]||new THREE.RenderableLine;q++;n=aa;n.v1.positionScreen.copy(K);
|
|
|
-n.v2.positionScreen.copy(L);n.z=Math.max(K.z,L.z);n.material=R.material;x.elements.push(n)}}}}}a=0;for(D=x.sprites.length;a<D;a++){R=x.sprites[a].object;$=R.matrixWorld;if(R instanceof THREE.Particle){B.set($.elements[12],$.elements[13],$.elements[14],1);w.multiplyVector4(B);B.z=B.z/B.w;if(B.z>0&&B.z<1){g=s[y]=s[y]||new THREE.RenderableParticle;y++;t=g;t.x=B.x/B.w;t.y=B.y/B.w;t.z=B.z;t.rotation=R.rotation.z;t.scale.x=R.scale.x*Math.abs(t.x-(B.x+e.projectionMatrix.elements[0])/(B.w+e.projectionMatrix.elements[12]));
|
|
|
-t.scale.y=R.scale.y*Math.abs(t.y-(B.y+e.projectionMatrix.elements[5])/(B.w+e.projectionMatrix.elements[13]));t.material=R.material;x.elements.push(t)}}}f&&x.elements.sort(c);return x}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
|
|
|
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=l[j]=l[j]||new THREE.RenderableVertex;j++;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(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
|
|
|
+d);return true}var e,f,g=[],h,j,l=[],k,p,m=[],o,q=[],n,r,u=[],t,x,s=[],w={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,E=new THREE.Vector4,z=new THREE.Matrix4,v=new THREE.Matrix4,C=new THREE.Frustum,J=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
+z.multiply(b.matrixWorld,b.projectionMatrixInverse);z.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(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||C.contains(b))){F.copy(b.matrixWorld.getPosition());
|
|
|
+z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;w.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){F.copy(b.matrixWorld.getPosition());z.multiplyVector3(F);e=a();e.object=b;e.z=F.z;w.sprites.push(e)}else 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,G=e.far,i=false,F,V,A,X,H,da,ga,la,Q,S,ba,aa,fa,Na,wa;x=r=o=p=0;w.elements.length=0;
|
|
|
+if(e.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);C.setFromMatrix(z);w=this.projectGraph(a,false);a=0;for(F=w.objects.length;a<F;a++){Q=w.objects[a].object;S=Q.matrixWorld;j=0;if(Q instanceof THREE.Mesh){ba=Q.geometry;aa=Q.geometry.materials;X=ba.vertices;fa=ba.faces;Na=ba.faceVertexUvs;ba=Q.matrixRotationWorld.extractRotation(S);
|
|
|
+V=0;for(A=X.length;V<A;V++){h=b();h.positionWorld.copy(X[V]);S.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);z.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<G}X=0;for(V=fa.length;X<V;X++){A=fa[X];if(A instanceof THREE.Face3){H=l[A.a];da=l[A.b];ga=l[A.c];if(H.visible&&da.visible&&ga.visible){i=(ga.positionScreen.x-H.positionScreen.x)*
|
|
|
+(da.positionScreen.y-H.positionScreen.y)-(ga.positionScreen.y-H.positionScreen.y)*(da.positionScreen.x-H.positionScreen.x)<0;if(Q.doubleSided||i!=Q.flipSided){la=m[p]=m[p]||new THREE.RenderableFace3;p++;k=la;k.v1.copy(H);k.v2.copy(da);k.v3.copy(ga)}else continue}else continue}else if(A instanceof THREE.Face4){H=l[A.a];da=l[A.b];ga=l[A.c];la=l[A.d];if(H.visible&&da.visible&&ga.visible&&la.visible){i=(la.positionScreen.x-H.positionScreen.x)*(da.positionScreen.y-H.positionScreen.y)-(la.positionScreen.y-
|
|
|
+H.positionScreen.y)*(da.positionScreen.x-H.positionScreen.x)<0||(da.positionScreen.x-ga.positionScreen.x)*(la.positionScreen.y-ga.positionScreen.y)-(da.positionScreen.y-ga.positionScreen.y)*(la.positionScreen.x-ga.positionScreen.x)<0;if(Q.doubleSided||i!=Q.flipSided){wa=q[o]=q[o]||new THREE.RenderableFace4;o++;k=wa;k.v1.copy(H);k.v2.copy(da);k.v3.copy(ga);k.v4.copy(la)}else continue}else continue}k.normalWorld.copy(A.normal);!i&&(Q.flipSided||Q.doubleSided)&&k.normalWorld.negate();ba.multiplyVector3(k.normalWorld);
|
|
|
+k.centroidWorld.copy(A.centroid);S.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);z.multiplyVector3(k.centroidScreen);ga=A.vertexNormals;H=0;for(da=ga.length;H<da;H++){la=k.vertexNormalsWorld[H];la.copy(ga[H]);!i&&(Q.flipSided||Q.doubleSided)&&la.negate();ba.multiplyVector3(la)}H=0;for(da=Na.length;H<da;H++)if(wa=Na[H][X]){ga=0;for(la=wa.length;ga<la;ga++)k.uvs[H][ga]=wa[ga]}k.material=Q.material;k.faceMaterial=A.materialIndex!==null?aa[A.materialIndex]:null;k.z=k.centroidScreen.z;
|
|
|
+w.elements.push(k)}}else if(Q instanceof THREE.Line){v.multiply(z,S);X=Q.geometry.vertices;H=b();H.positionScreen.copy(X[0]);v.multiplyVector4(H.positionScreen);S=Q.type===THREE.LinePieces?2:1;V=1;for(A=X.length;V<A;V++){H=b();H.positionScreen.copy(X[V]);v.multiplyVector4(H.positionScreen);if(!((V+1)%S>0)){da=l[j-2];J.copy(H.positionScreen);L.copy(da.positionScreen);if(d(J,L)){J.multiplyScalar(1/J.w);L.multiplyScalar(1/L.w);aa=u[r]=u[r]||new THREE.RenderableLine;r++;n=aa;n.v1.positionScreen.copy(J);
|
|
|
+n.v2.positionScreen.copy(L);n.z=Math.max(J.z,L.z);n.material=Q.material;w.elements.push(n)}}}}}a=0;for(F=w.sprites.length;a<F;a++){Q=w.sprites[a].object;S=Q.matrixWorld;if(Q instanceof THREE.Particle){E.set(S.elements[12],S.elements[13],S.elements[14],1);z.multiplyVector4(E);E.z=E.z/E.w;if(E.z>0&&E.z<1){g=s[x]=s[x]||new THREE.RenderableParticle;x++;t=g;t.x=E.x/E.w;t.y=E.y/E.w;t.z=E.z;t.rotation=Q.rotation.z;t.scale.x=Q.scale.x*Math.abs(t.x-(E.x+e.projectionMatrix.elements[0])/(E.w+e.projectionMatrix.elements[12]));
|
|
|
+t.scale.y=Q.scale.y*Math.abs(t.y-(E.y+e.projectionMatrix.elements[5])/(E.w+e.projectionMatrix.elements[13]));t.material=Q.material;w.elements.push(t)}}}f&&w.elements.sort(c);return w}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),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.elements[0]+a.elements[5]+a.elements[10]))/2;this.x=Math.sqrt(Math.max(0,b+a.elements[0]-a.elements[5]-a.elements[10]))/2;this.y=Math.sqrt(Math.max(0,b-a.elements[0]+a.elements[5]-a.elements[10]))/2;this.z=Math.sqrt(Math.max(0,b-a.elements[0]-a.elements[5]+a.elements[10]))/2;this.x=a.elements[6]-a.elements[9]<0?-Math.abs(this.x):
|
|
|
Math.abs(this.x);this.y=a.elements[8]-a.elements[2]<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.elements[1]-a.elements[4]<0?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=
|
|
|
Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=
|
|
|
-c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,j=this.w,k=j*c+g*e-h*d,l=j*d+h*c-f*e,p=j*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=k*j+c*-f+l*-h-p*-g;b.y=l*j+c*-g+p*-f-k*-h;b.z=p*j+c*-h+k*-g-l*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
|
|
|
+c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,j=this.w,l=j*c+g*e-h*d,k=j*d+h*c-f*e,p=j*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=l*j+c*-f+k*-h-p*-g;b.y=k*j+c*-g+p*-f-l*-h;b.z=p*j+c*-h+l*-g-k*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
|
|
|
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=THREE.Vector3;
|
|
|
THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
@@ -93,16 +93,16 @@ b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices
|
|
|
else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;
|
|
|
for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(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])}else if(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])}}},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
|
|
|
e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
|
|
|
-[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,j,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=new THREE.Vector3;k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(j);h.push(k)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
|
|
|
-j=g.faceNormals[c];k=g.vertexNormals[c];j.copy(e.normal);if(e instanceof THREE.Face3){k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2])}else{k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2]);k.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,G){h=a.vertices[b];j=a.vertices[c];
|
|
|
-k=a.vertices[d];l=g[e];p=g[f];m=g[G];o=j.x-h.x;r=k.x-h.x;n=j.y-h.y;q=k.y-h.y;u=j.z-h.z;t=k.z-h.z;y=p.u-l.u;s=m.u-l.u;x=p.v-l.v;D=m.v-l.v;B=1/(y*D-s*x);K.set((D*o-x*r)*B,(D*n-x*q)*B,(D*u-x*t)*B);L.set((y*r-s*o)*B,(y*q-s*n)*B,(y*t-s*u)*B);v[b].addSelf(K);v[c].addSelf(K);v[d].addSelf(K);C[b].addSelf(L);C[c].addSelf(L);C[d].addSelf(L)}var b,c,d,e,f,g,h,j,k,l,p,m,o,r,n,q,u,t,y,s,x,D,B,w,v=[],C=[],K=new THREE.Vector3,L=new THREE.Vector3,T=new THREE.Vector3,P=new THREE.Vector3,J=new THREE.Vector3;b=0;for(c=
|
|
|
-this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;C[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var N=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){J.copy(f.vertexNormals[d]);e=f[N[d]];w=v[e];T.copy(w);T.subSelf(J.multiplyScalar(J.dot(w))).normalize();
|
|
|
-P.cross(f.vertexNormals[d],w);e=P.dot(C[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
|
|
|
+[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,j,l;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=new THREE.Vector3;l=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(j);h.push(l)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
|
|
|
+j=g.faceNormals[c];l=g.vertexNormals[c];j.copy(e.normal);if(e instanceof THREE.Face3){l.a.copy(e.vertexNormals[0]);l.b.copy(e.vertexNormals[1]);l.c.copy(e.vertexNormals[2])}else{l.a.copy(e.vertexNormals[0]);l.b.copy(e.vertexNormals[1]);l.c.copy(e.vertexNormals[2]);l.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,H){h=a.vertices[b];j=a.vertices[c];
|
|
|
+l=a.vertices[d];k=g[e];p=g[f];m=g[H];o=j.x-h.x;q=l.x-h.x;n=j.y-h.y;r=l.y-h.y;u=j.z-h.z;t=l.z-h.z;x=p.u-k.u;s=m.u-k.u;w=p.v-k.v;F=m.v-k.v;E=1/(x*F-s*w);J.set((F*o-w*q)*E,(F*n-w*r)*E,(F*u-w*t)*E);L.set((x*q-s*o)*E,(x*r-s*n)*E,(x*t-s*u)*E);v[b].addSelf(J);v[c].addSelf(J);v[d].addSelf(J);C[b].addSelf(L);C[c].addSelf(L);C[d].addSelf(L)}var b,c,d,e,f,g,h,j,l,k,p,m,o,q,n,r,u,t,x,s,w,F,E,z,v=[],C=[],J=new THREE.Vector3,L=new THREE.Vector3,W=new THREE.Vector3,P=new THREE.Vector3,B=new THREE.Vector3;b=0;for(c=
|
|
|
+this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;C[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var M=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){B.copy(f.vertexNormals[d]);e=f[M[d]];z=v[e];W.copy(z);W.subSelf(B.multiplyScalar(B.dot(z))).normalize();
|
|
|
+P.cross(f.vertexNormals[d],z);e=P.dot(C[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(W.x,W.y,W.z,e)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];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}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++){a=this.vertices[c].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=[Math.round(d.x*
|
|
|
e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){a=this.faces[f];if(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=(c-a)*0.5;d=(d-b)*0.5;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,j,k,l,p,m;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]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
|
|
|
-f+2;k=this.points[c[0]];l=this.points[c[1]];p=this.points[c[2]];m=this.points[c[3]];h=g*g;j=g*h;d.x=b(k.x,l.x,p.x,m.x,g,h,j);d.y=b(k.y,l.y,p.y,m.y,g,h,j);d.z=b(k.z,l.z,p.z,m.z,g,h,j);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=[],j=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);j=j+g.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){h[b]=j;e=b}}h[h.length]=j;return{chunks:h,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],j=new THREE.Vector3,k=this.getLength();h.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];g=Math.ceil(a*c/k.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);
|
|
|
+THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;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,j,l,k,p,m;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]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
|
|
|
+f+2;l=this.points[c[0]];k=this.points[c[1]];p=this.points[c[2]];m=this.points[c[3]];h=g*g;j=g*h;d.x=b(l.x,k.x,p.x,m.x,g,h,j);d.y=b(l.y,k.y,p.y,m.y,g,h,j);d.z=b(l.z,k.z,p.z,m.z,g,h,j);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=[],j=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);j=j+g.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){h[b]=j;e=b}}h[h.length]=j;return{chunks:h,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],j=new THREE.Vector3,l=this.getLength();h.push(j.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(j.copy(d).clone())}h.push(j.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){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.getRotationFromMatrix(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=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
|
|
|
THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
|
|
@@ -138,7 +138,7 @@ a.fog!==void 0?a.fog:false;this.lights=a.lights!==void 0?a.lights:false;this.ver
|
|
|
THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=h!==void 0?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
|
|
|
true;this.needsUpdate=this.premultiplyAlpha=false;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
|
|
|
THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;
|
|
|
-THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,f,g,h,j,k){THREE.Texture.call(this,null,f,g,h,j,k,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
|
|
|
+THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,f,g,h,j,l){THREE.Texture.call(this,null,f,g,h,j,l,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
|
|
|
THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
|
|
|
THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.ParticleBasicMaterial({color:Math.random()*16777215});this.sortParticles=false;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}this.frustumCulled=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
|
|
|
THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
@@ -169,51 +169,51 @@ THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Scene=function()
|
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)this.__lights.indexOf(a)===-1&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&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);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
|
|
|
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
|
|
|
-THREE.DOMRenderer=function(){console.log("THREE.DOMRenderer",THREE.REVISION);var a,b,c,d,e,f,g,h=new THREE.Projector;g=function(a){for(var b=document.documentElement,c=0;c<a.length;c++)if(typeof b.style[a[c]]==="string")return a[c];return null}(["transform","MozTransform","WebkitTransform","msTransform","OTransform"]);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 l,p,m,o,r,n;a=h.projectScene(c,d);b=a.elements;l=0;for(p=
|
|
|
-b.length;l<p;l++){m=b[l];if(m instanceof THREE.RenderableParticle&&m.material instanceof THREE.ParticleDOMMaterial){o=m.material.domElement;r=m.x*e+e-(o.offsetWidth>>1);n=m.y*f+f-(o.offsetHeight>>1);o.style.left=r+"px";o.style.top=n+"px";o.style.zIndex=Math.abs(Math.floor((1-m.z)*d.far/d.near));g&&(o.style[g]="scale("+m.scale.x*e+","+m.scale.y*f+")")}}}};
|
|
|
-THREE.CanvasRenderer=function(a){function b(a){if(t!=a)n.globalAlpha=t=a}function c(a){if(y!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}y=a}}function d(a){if(s!=a)n.strokeStyle=s=a}function e(a){if(x!=a)n.fillStyle=x=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,j,k=new THREE.Projector,l=a.canvas!==
|
|
|
-void 0?a.canvas:document.createElement("canvas"),p,m,o,r,n=l.getContext("2d"),q=new THREE.Color(0),u=0,t=1,y=0,s=null,x=null,D=null,B=null,w=null,v,C,K,L,T=new THREE.RenderableVertex,P=new THREE.RenderableVertex,J,N,F,i,U,E,H,W,G,ha,fa,la,R=new THREE.Color,$=new THREE.Color,ba=new THREE.Color,aa=new THREE.Color,ea=new THREE.Color,Na=[],wa=[],sa,Oa,Ha,xa,Wa,Ya,Ka,db,hb,mb,Pa=new THREE.Rectangle,ta=new THREE.Rectangle,ua=new THREE.Rectangle,ab=false,pa=new THREE.Color,Ia=new THREE.Color,Xa=new THREE.Color,
|
|
|
-ja=new THREE.Vector3,Fb,ca,S,Q,pc,Cc,a=16;Fb=document.createElement("canvas");Fb.width=Fb.height=2;ca=Fb.getContext("2d");ca.fillStyle="rgba(0,0,0,1)";ca.fillRect(0,0,2,2);S=ca.getImageData(0,0,2,2);Q=S.data;pc=document.createElement("canvas");pc.width=pc.height=a;Cc=pc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;m=b;o=Math.floor(p/2);r=Math.floor(m/
|
|
|
-2);l.width=p;l.height=m;Pa.set(-o,-r,o,r);ta.set(-o,-r,o,r);t=1;y=0;w=B=D=x=s=null};this.setClearColor=function(a,b){q.copy(a);u=b!==void 0?b:1;ta.set(-o,-r,o,r)};this.setClearColorHex=function(a,b){q.setHex(a);u=b!==void 0?b:1;ta.set(-o,-r,o,r)};this.clear=function(){n.setTransform(1,0,0,-1,o,r);if(!ta.isEmpty()){ta.minSelf(Pa);ta.inflate(2);u<1&&n.clearRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()));if(u>0){c(THREE.NormalBlending);b(1);e("rgba("+
|
|
|
-Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+u+")");n.fillRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()))}ta.empty()}};this.render=function(a,l){function m(a){var b,c,d,e;pa.setRGB(0,0,0);Ia.setRGB(0,0,0);Xa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){pa.r=pa.r+e.r;pa.g=pa.g+e.g;pa.b=pa.b+e.b}else if(d instanceof THREE.DirectionalLight){Ia.r=Ia.r+e.r;Ia.g=Ia.g+e.g;Ia.b=
|
|
|
+THREE.DOMRenderer=function(){console.log("THREE.DOMRenderer",THREE.REVISION);var a,b,c,d,e,f,g,h=new THREE.Projector;g=function(a){for(var b=document.documentElement,c=0;c<a.length;c++)if(typeof b.style[a[c]]==="string")return a[c];return null}(["transform","MozTransform","WebkitTransform","msTransform","OTransform"]);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 k,p,m,o,q,n;a=h.projectScene(c,d);b=a.elements;k=0;for(p=
|
|
|
+b.length;k<p;k++){m=b[k];if(m instanceof THREE.RenderableParticle&&m.material instanceof THREE.ParticleDOMMaterial){o=m.material.domElement;q=m.x*e+e-(o.offsetWidth>>1);n=m.y*f+f-(o.offsetHeight>>1);o.style.left=q+"px";o.style.top=n+"px";o.style.zIndex=Math.abs(Math.floor((1-m.z)*d.far/d.near));g&&(o.style[g]="scale("+m.scale.x*e+","+m.scale.y*f+")")}}}};
|
|
|
+THREE.CanvasRenderer=function(a){function b(a){if(t!=a)n.globalAlpha=t=a}function c(a){if(x!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}x=a}}function d(a){if(s!=a)n.strokeStyle=s=a}function e(a){if(w!=a)n.fillStyle=w=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,j,l=new THREE.Projector,k=a.canvas!==
|
|
|
+void 0?a.canvas:document.createElement("canvas"),p,m,o,q,n=k.getContext("2d"),r=new THREE.Color(0),u=0,t=1,x=0,s=null,w=null,F=null,E=null,z=null,v,C,J,L,W=new THREE.RenderableVertex,P=new THREE.RenderableVertex,B,M,G,i,T,V,A,X,H,da,ga,la,Q=new THREE.Color,S=new THREE.Color,ba=new THREE.Color,aa=new THREE.Color,fa=new THREE.Color,Na=[],wa=[],sa,Oa,Ha,xa,Wa,Ya,Ka,db,hb,mb,Pa=new THREE.Rectangle,ta=new THREE.Rectangle,ua=new THREE.Rectangle,ab=false,pa=new THREE.Color,Ia=new THREE.Color,Xa=new THREE.Color,
|
|
|
+ja=new THREE.Vector3,Fb,ca,R,O,pc,Cc,a=16;Fb=document.createElement("canvas");Fb.width=Fb.height=2;ca=Fb.getContext("2d");ca.fillStyle="rgba(0,0,0,1)";ca.fillRect(0,0,2,2);R=ca.getImageData(0,0,2,2);O=R.data;pc=document.createElement("canvas");pc.width=pc.height=a;Cc=pc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;m=b;o=Math.floor(p/2);q=Math.floor(m/
|
|
|
+2);k.width=p;k.height=m;Pa.set(-o,-q,o,q);ta.set(-o,-q,o,q);t=1;x=0;z=E=F=w=s=null};this.setClearColor=function(a,b){r.copy(a);u=b!==void 0?b:1;ta.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);u=b!==void 0?b:1;ta.set(-o,-q,o,q)};this.clear=function(){n.setTransform(1,0,0,-1,o,q);if(!ta.isEmpty()){ta.minSelf(Pa);ta.inflate(2);u<1&&n.clearRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()));if(u>0){c(THREE.NormalBlending);b(1);e("rgba("+
|
|
|
+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+u+")");n.fillRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()))}ta.empty()}};this.render=function(a,k){function m(a){var b,c,d,e;pa.setRGB(0,0,0);Ia.setRGB(0,0,0);Xa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){pa.r=pa.r+e.r;pa.g=pa.g+e.g;pa.b=pa.b+e.b}else if(d instanceof THREE.DirectionalLight){Ia.r=Ia.r+e.r;Ia.g=Ia.g+e.g;Ia.b=
|
|
|
Ia.b+e.b}else if(d instanceof THREE.PointLight){Xa.r=Xa.r+e.r;Xa.g=Xa.g+e.g;Xa.b=Xa.b+e.b}}}function p(a,b,c,d){var e,f,g,ca,h,i;e=0;for(f=a.length;e<f;e++){g=a[e];ca=g.color;if(g instanceof THREE.DirectionalLight){h=g.matrixWorld.getPosition();i=c.dot(h);if(!(i<=0)){i=i*g.intensity;d.r=d.r+ca.r*i;d.g=d.g+ca.g*i;d.b=d.b+ca.b*i}}else if(g instanceof THREE.PointLight){h=g.matrixWorld.getPosition();i=c.dot(ja.sub(h,b).normalize());if(!(i<=0)){i=i*(g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,
|
|
|
-1));if(i!=0){i=i*g.intensity;d.r=d.r+ca.r*i;d.g=d.g+ca.g*i;d.b=d.b+ca.b*i}}}}}function q(a,f,g){b(g.opacity);c(g.blending);var ca,h,i,Q,S,j;if(g instanceof THREE.ParticleBasicMaterial){if(g.map){Q=g.map.image;S=Q.width>>1;j=Q.height>>1;g=f.scale.x*o;i=f.scale.y*r;ca=g*S;h=i*j;ua.set(a.x-ca,a.y-h,a.x+ca,a.y+h);if(Pa.intersects(ua)){n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(g,-i);n.translate(-S,-j);n.drawImage(Q,0,0);n.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){ca=
|
|
|
-f.scale.x*o;h=f.scale.y*r;ua.set(a.x-ca,a.y-h,a.x+ca,a.y+h);if(Pa.intersects(ua)){d(g.color.getContextStyle());e(g.color.getContextStyle());n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(ca,h);g.program(n);n.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(D!=a)n.lineWidth=D=a;a=g.linecap;if(B!=
|
|
|
-a)n.lineCap=B=a;a=g.linejoin;if(w!=a)n.lineJoin=w=a;d(g.color.getContextStyle());n.stroke();ua.inflate(g.linewidth*2)}}function u(a,d,e,g,ca,h,Q,S){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(S.opacity);c(S.blending);J=a.positionScreen.x;N=a.positionScreen.y;F=d.positionScreen.x;i=d.positionScreen.y;U=e.positionScreen.x;E=e.positionScreen.y;y(J,N,F,i,U,E);if(S instanceof THREE.MeshBasicMaterial)if(S.map){if(S.map.mapping instanceof THREE.UVMapping){xa=Q.uvs[0];Tc(J,N,F,
|
|
|
-i,U,E,xa[g].u,xa[g].v,xa[ca].u,xa[ca].v,xa[h].u,xa[h].v,S.map)}}else if(S.envMap){if(S.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=l.matrixWorldInverse;ja.copy(Q.vertexNormalsWorld[g]);Wa=(ja.x*a.elements[0]+ja.y*a.elements[4]+ja.z*a.elements[8])*0.5+0.5;Ya=-(ja.x*a.elements[1]+ja.y*a.elements[5]+ja.z*a.elements[9])*0.5+0.5;ja.copy(Q.vertexNormalsWorld[ca]);Ka=(ja.x*a.elements[0]+ja.y*a.elements[4]+ja.z*a.elements[8])*0.5+0.5;db=-(ja.x*a.elements[1]+ja.y*a.elements[5]+ja.z*a.elements[9])*
|
|
|
-0.5+0.5;ja.copy(Q.vertexNormalsWorld[h]);hb=(ja.x*a.elements[0]+ja.y*a.elements[4]+ja.z*a.elements[8])*0.5+0.5;mb=-(ja.x*a.elements[1]+ja.y*a.elements[5]+ja.z*a.elements[9])*0.5+0.5;Tc(J,N,F,i,U,E,Wa,Ya,Ka,db,hb,mb,S.envMap)}}else S.wireframe?Mb(S.color,S.wireframeLinewidth,S.wireframeLinecap,S.wireframeLinejoin):Gb(S.color);else if(S instanceof THREE.MeshLambertMaterial){if(S.map&&!S.wireframe){if(S.map.mapping instanceof THREE.UVMapping){xa=Q.uvs[0];Tc(J,N,F,i,U,E,xa[g].u,xa[g].v,xa[ca].u,xa[ca].v,
|
|
|
-xa[h].u,xa[h].v,S.map)}c(THREE.SubtractiveBlending)}if(ab)if(!S.wireframe&&S.shading==THREE.SmoothShading&&Q.vertexNormalsWorld.length==3){$.r=ba.r=aa.r=pa.r;$.g=ba.g=aa.g=pa.g;$.b=ba.b=aa.b=pa.b;p(j,Q.v1.positionWorld,Q.vertexNormalsWorld[0],$);p(j,Q.v2.positionWorld,Q.vertexNormalsWorld[1],ba);p(j,Q.v3.positionWorld,Q.vertexNormalsWorld[2],aa);$.r=Math.max(0,Math.min(S.color.r*$.r,1));$.g=Math.max(0,Math.min(S.color.g*$.g,1));$.b=Math.max(0,Math.min(S.color.b*$.b,1));ba.r=Math.max(0,Math.min(S.color.r*
|
|
|
-ba.r,1));ba.g=Math.max(0,Math.min(S.color.g*ba.g,1));ba.b=Math.max(0,Math.min(S.color.b*ba.b,1));aa.r=Math.max(0,Math.min(S.color.r*aa.r,1));aa.g=Math.max(0,Math.min(S.color.g*aa.g,1));aa.b=Math.max(0,Math.min(S.color.b*aa.b,1));ea.r=(ba.r+aa.r)*0.5;ea.g=(ba.g+aa.g)*0.5;ea.b=(ba.b+aa.b)*0.5;Ha=Dc($,ba,aa,ea);gc(J,N,F,i,U,E,0,0,1,0,0,1,Ha)}else{R.r=pa.r;R.g=pa.g;R.b=pa.b;p(j,Q.centroidWorld,Q.normalWorld,R);R.r=Math.max(0,Math.min(S.color.r*R.r,1));R.g=Math.max(0,Math.min(S.color.g*R.g,1));R.b=Math.max(0,
|
|
|
-Math.min(S.color.b*R.b,1));S.wireframe?Mb(R,S.wireframeLinewidth,S.wireframeLinecap,S.wireframeLinejoin):Gb(R)}else S.wireframe?Mb(S.color,S.wireframeLinewidth,S.wireframeLinecap,S.wireframeLinejoin):Gb(S.color)}else if(S instanceof THREE.MeshDepthMaterial){sa=l.near;Oa=l.far;$.r=$.g=$.b=1-ac(a.positionScreen.z,sa,Oa);ba.r=ba.g=ba.b=1-ac(d.positionScreen.z,sa,Oa);aa.r=aa.g=aa.b=1-ac(e.positionScreen.z,sa,Oa);ea.r=(ba.r+aa.r)*0.5;ea.g=(ba.g+aa.g)*0.5;ea.b=(ba.b+aa.b)*0.5;Ha=Dc($,ba,aa,ea);gc(J,N,F,
|
|
|
-i,U,E,0,0,1,0,0,1,Ha)}else if(S instanceof THREE.MeshNormalMaterial){R.r=hc(Q.normalWorld.x);R.g=hc(Q.normalWorld.y);R.b=hc(Q.normalWorld.z);S.wireframe?Mb(R,S.wireframeLinewidth,S.wireframeLinecap,S.wireframeLinejoin):Gb(R)}}function t(a,d,e,g,ca,h,S,Q,k){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap){u(a,d,g,0,1,3,S,Q,k);u(ca,e,h,1,2,3,S,Q,k)}else{J=a.positionScreen.x;N=a.positionScreen.y;F=d.positionScreen.x;i=d.positionScreen.y;
|
|
|
-U=e.positionScreen.x;E=e.positionScreen.y;H=g.positionScreen.x;W=g.positionScreen.y;G=ca.positionScreen.x;ha=ca.positionScreen.y;fa=h.positionScreen.x;la=h.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){x(J,N,F,i,U,E,H,W);Q.wireframe?Mb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(Q.color)}else if(Q instanceof THREE.MeshLambertMaterial)if(ab)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&S.vertexNormalsWorld.length==4){$.r=ba.r=aa.r=ea.r=pa.r;$.g=ba.g=aa.g=
|
|
|
-ea.g=pa.g;$.b=ba.b=aa.b=ea.b=pa.b;p(j,S.v1.positionWorld,S.vertexNormalsWorld[0],$);p(j,S.v2.positionWorld,S.vertexNormalsWorld[1],ba);p(j,S.v4.positionWorld,S.vertexNormalsWorld[3],aa);p(j,S.v3.positionWorld,S.vertexNormalsWorld[2],ea);$.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));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));aa.r=Math.max(0,
|
|
|
-Math.min(Q.color.r*aa.r,1));aa.g=Math.max(0,Math.min(Q.color.g*aa.g,1));aa.b=Math.max(0,Math.min(Q.color.b*aa.b,1));ea.r=Math.max(0,Math.min(Q.color.r*ea.r,1));ea.g=Math.max(0,Math.min(Q.color.g*ea.g,1));ea.b=Math.max(0,Math.min(Q.color.b*ea.b,1));Ha=Dc($,ba,aa,ea);y(J,N,F,i,H,W);gc(J,N,F,i,H,W,0,0,1,0,0,1,Ha);y(G,ha,U,E,fa,la);gc(G,ha,U,E,fa,la,1,0,1,1,0,1,Ha)}else{R.r=pa.r;R.g=pa.g;R.b=pa.b;p(j,S.centroidWorld,S.normalWorld,R);R.r=Math.max(0,Math.min(Q.color.r*R.r,1));R.g=Math.max(0,Math.min(Q.color.g*
|
|
|
-R.g,1));R.b=Math.max(0,Math.min(Q.color.b*R.b,1));x(J,N,F,i,U,E,H,W);Q.wireframe?Mb(R,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(R)}else{x(J,N,F,i,U,E,H,W);Q.wireframe?Mb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(Q.color)}else if(Q instanceof THREE.MeshNormalMaterial){R.r=hc(S.normalWorld.x);R.g=hc(S.normalWorld.y);R.b=hc(S.normalWorld.z);x(J,N,F,i,U,E,H,W);Q.wireframe?Mb(R,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(R)}else if(Q instanceof
|
|
|
-THREE.MeshDepthMaterial){sa=l.near;Oa=l.far;$.r=$.g=$.b=1-ac(a.positionScreen.z,sa,Oa);ba.r=ba.g=ba.b=1-ac(d.positionScreen.z,sa,Oa);aa.r=aa.g=aa.b=1-ac(g.positionScreen.z,sa,Oa);ea.r=ea.g=ea.b=1-ac(e.positionScreen.z,sa,Oa);Ha=Dc($,ba,aa,ea);y(J,N,F,i,H,W);gc(J,N,F,i,H,W,0,0,1,0,0,1,Ha);y(G,ha,U,E,fa,la);gc(G,ha,U,E,fa,la,1,0,1,1,0,1,Ha)}}}function y(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b);n.closePath()}function x(a,b,c,d,e,f,g,ca){n.beginPath();n.moveTo(a,
|
|
|
-b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,ca);n.lineTo(a,b);n.closePath()}function Mb(a,b,c,e){if(D!=b)n.lineWidth=D=b;if(B!=c)n.lineCap=B=c;if(w!=e)n.lineJoin=w=e;d(a.getContextStyle());n.stroke();ua.inflate(b*2)}function Gb(a){e(a.getContextStyle());n.fill()}function Tc(a,b,c,d,f,g,ca,h,Q,i,S,j,l){if(l.image.width!=0){if(l.needsUpdate==true||Na[l.id]==void 0){var k=l.wrapS==THREE.RepeatWrapping,m=l.wrapT==THREE.RepeatWrapping;Na[l.id]=n.createPattern(l.image,k&&m?"repeat":k&&!m?"repeat-x":!k&&m?
|
|
|
-"repeat-y":"no-repeat");l.needsUpdate=false}e(Na[l.id]);var k=l.offset.x/l.repeat.x,m=l.offset.y/l.repeat.y,p=l.image.width*l.repeat.x,o=l.image.height*l.repeat.y,ca=(ca+k)*p,h=(h+m)*o,c=c-a,d=d-b,f=f-a,g=g-b,Q=(Q+k)*p-ca,i=(i+m)*o-h,S=(S+k)*p-ca,j=(j+m)*o-h,k=Q*j-S*i;if(k==0){if(wa[l.id]===void 0){b=document.createElement("canvas");b.width=l.image.width;b.height=l.image.height;b=b.getContext("2d");b.drawImage(l.image,0,0);wa[l.id]=b.getImageData(0,0,l.image.width,l.image.height).data}b=wa[l.id];
|
|
|
-ca=(Math.floor(ca)+Math.floor(h)*l.image.width)*4;R.setRGB(b[ca]/255,b[ca+1]/255,b[ca+2]/255);Gb(R)}else{k=1/k;l=(j*c-i*f)*k;i=(j*d-i*g)*k;c=(Q*f-S*c)*k;d=(Q*g-S*d)*k;a=a-l*ca-c*h;ca=b-i*ca-d*h;n.save();n.transform(l,i,c,d,a,ca);n.fill();n.restore()}}}function gc(a,b,c,d,e,f,g,ca,h,Q,i,S,l){var j,k;j=l.width-1;k=l.height-1;g=g*j;ca=ca*k;c=c-a;d=d-b;e=e-a;f=f-b;h=h*j-g;Q=Q*k-ca;i=i*j-g;S=S*k-ca;k=1/(h*S-i*Q);j=(S*c-Q*e)*k;Q=(S*d-Q*f)*k;c=(h*e-i*c)*k;d=(h*f-i*d)*k;a=a-j*g-c*ca;b=b-Q*g-d*ca;n.save();
|
|
|
-n.transform(j,Q,c,d,a,b);n.clip();n.drawImage(l,0,0);n.restore()}function Dc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),l=~~(c.g*255),c=~~(c.b*255),j=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);Q[0]=e<0?0:e>255?255:e;Q[1]=f<0?0:f>255?255:f;Q[2]=a<0?0:a>255?255:a;Q[4]=g<0?0:g>255?255:g;Q[5]=h<0?0:h>255?255:h;Q[6]=b<0?0:b>255?255:b;Q[8]=i<0?0:i>255?255:i;Q[9]=l<0?0:l>255?255:l;Q[10]=c<0?0:c>255?255:c;Q[12]=j<0?0:j>255?255:j;Q[13]=k<0?0:
|
|
|
-k>255?255:k;Q[14]=d<0?0:d>255?255:d;ca.putImageData(S,0,0);Cc.drawImage(Fb,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!=0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Ec,cd,Ta,kb;this.autoClear?this.clear():n.setTransform(1,0,0,-1,o,r);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,l,this.sortElements);h=g.elements;j=g.lights;
|
|
|
-(ab=j.length>0)&&m(j);Ec=0;for(cd=h.length;Ec<cd;Ec++){Ta=h[Ec];kb=Ta.material;kb=kb instanceof THREE.MeshFaceMaterial?Ta.faceMaterial:kb;if(!(kb==null||kb.opacity==0)){ua.empty();if(Ta instanceof THREE.RenderableParticle){v=Ta;v.x=v.x*o;v.y=v.y*r;q(v,Ta,kb,a)}else if(Ta instanceof THREE.RenderableLine){v=Ta.v1;C=Ta.v2;v.positionScreen.x=v.positionScreen.x*o;v.positionScreen.y=v.positionScreen.y*r;C.positionScreen.x=C.positionScreen.x*o;C.positionScreen.y=C.positionScreen.y*r;ua.addPoint(v.positionScreen.x,
|
|
|
-v.positionScreen.y);ua.addPoint(C.positionScreen.x,C.positionScreen.y);Pa.intersects(ua)&&s(v,C,Ta,kb,a)}else if(Ta instanceof THREE.RenderableFace3){v=Ta.v1;C=Ta.v2;K=Ta.v3;v.positionScreen.x=v.positionScreen.x*o;v.positionScreen.y=v.positionScreen.y*r;C.positionScreen.x=C.positionScreen.x*o;C.positionScreen.y=C.positionScreen.y*r;K.positionScreen.x=K.positionScreen.x*o;K.positionScreen.y=K.positionScreen.y*r;if(kb.overdraw){Nb(v.positionScreen,C.positionScreen);Nb(C.positionScreen,K.positionScreen);
|
|
|
-Nb(K.positionScreen,v.positionScreen)}ua.add3Points(v.positionScreen.x,v.positionScreen.y,C.positionScreen.x,C.positionScreen.y,K.positionScreen.x,K.positionScreen.y);Pa.intersects(ua)&&u(v,C,K,0,1,2,Ta,kb,a)}else if(Ta instanceof THREE.RenderableFace4){v=Ta.v1;C=Ta.v2;K=Ta.v3;L=Ta.v4;v.positionScreen.x=v.positionScreen.x*o;v.positionScreen.y=v.positionScreen.y*r;C.positionScreen.x=C.positionScreen.x*o;C.positionScreen.y=C.positionScreen.y*r;K.positionScreen.x=K.positionScreen.x*o;K.positionScreen.y=
|
|
|
-K.positionScreen.y*r;L.positionScreen.x=L.positionScreen.x*o;L.positionScreen.y=L.positionScreen.y*r;T.positionScreen.copy(C.positionScreen);P.positionScreen.copy(L.positionScreen);if(kb.overdraw){Nb(v.positionScreen,C.positionScreen);Nb(C.positionScreen,L.positionScreen);Nb(L.positionScreen,v.positionScreen);Nb(K.positionScreen,T.positionScreen);Nb(K.positionScreen,P.positionScreen)}ua.addPoint(v.positionScreen.x,v.positionScreen.y);ua.addPoint(C.positionScreen.x,C.positionScreen.y);ua.addPoint(K.positionScreen.x,
|
|
|
-K.positionScreen.y);ua.addPoint(L.positionScreen.x,L.positionScreen.y);Pa.intersects(ua)&&t(v,C,K,L,T,P,Ta,kb,a)}ta.addRectangle(ua)}}n.setTransform(1,0,0,1,0,0)}};
|
|
|
+1));if(i!=0){i=i*g.intensity;d.r=d.r+ca.r*i;d.g=d.g+ca.g*i;d.b=d.b+ca.b*i}}}}}function r(a,f,g){b(g.opacity);c(g.blending);var ca,i,h,O,R,j;if(g instanceof THREE.ParticleBasicMaterial){if(g.map){O=g.map.image;R=O.width>>1;j=O.height>>1;g=f.scale.x*o;h=f.scale.y*q;ca=g*R;i=h*j;ua.set(a.x-ca,a.y-i,a.x+ca,a.y+i);if(Pa.intersects(ua)){n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(g,-h);n.translate(-R,-j);n.drawImage(O,0,0);n.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){ca=
|
|
|
+f.scale.x*o;i=f.scale.y*q;ua.set(a.x-ca,a.y-i,a.x+ca,a.y+i);if(Pa.intersects(ua)){d(g.color.getContextStyle());e(g.color.getContextStyle());n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(ca,i);g.program(n);n.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!=a)n.lineWidth=F=a;a=g.linecap;if(E!=
|
|
|
+a)n.lineCap=E=a;a=g.linejoin;if(z!=a)n.lineJoin=z=a;d(g.color.getContextStyle());n.stroke();ua.inflate(g.linewidth*2)}}function t(a,d,e,g,ca,h,O,R){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(R.opacity);c(R.blending);B=a.positionScreen.x;M=a.positionScreen.y;G=d.positionScreen.x;i=d.positionScreen.y;T=e.positionScreen.x;V=e.positionScreen.y;x(B,M,G,i,T,V);if(R instanceof THREE.MeshBasicMaterial)if(R.map){if(R.map.mapping instanceof THREE.UVMapping){xa=O.uvs[0];Tc(B,M,G,
|
|
|
+i,T,V,xa[g].u,xa[g].v,xa[ca].u,xa[ca].v,xa[h].u,xa[h].v,R.map)}}else if(R.envMap){if(R.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=k.matrixWorldInverse;ja.copy(O.vertexNormalsWorld[g]);Wa=(ja.x*a.elements[0]+ja.y*a.elements[4]+ja.z*a.elements[8])*0.5+0.5;Ya=-(ja.x*a.elements[1]+ja.y*a.elements[5]+ja.z*a.elements[9])*0.5+0.5;ja.copy(O.vertexNormalsWorld[ca]);Ka=(ja.x*a.elements[0]+ja.y*a.elements[4]+ja.z*a.elements[8])*0.5+0.5;db=-(ja.x*a.elements[1]+ja.y*a.elements[5]+ja.z*a.elements[9])*
|
|
|
+0.5+0.5;ja.copy(O.vertexNormalsWorld[h]);hb=(ja.x*a.elements[0]+ja.y*a.elements[4]+ja.z*a.elements[8])*0.5+0.5;mb=-(ja.x*a.elements[1]+ja.y*a.elements[5]+ja.z*a.elements[9])*0.5+0.5;Tc(B,M,G,i,T,V,Wa,Ya,Ka,db,hb,mb,R.envMap)}}else R.wireframe?Mb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(R.color);else if(R instanceof THREE.MeshLambertMaterial){if(R.map&&!R.wireframe){if(R.map.mapping instanceof THREE.UVMapping){xa=O.uvs[0];Tc(B,M,G,i,T,V,xa[g].u,xa[g].v,xa[ca].u,xa[ca].v,
|
|
|
+xa[h].u,xa[h].v,R.map)}c(THREE.SubtractiveBlending)}if(ab)if(!R.wireframe&&R.shading==THREE.SmoothShading&&O.vertexNormalsWorld.length==3){S.r=ba.r=aa.r=pa.r;S.g=ba.g=aa.g=pa.g;S.b=ba.b=aa.b=pa.b;p(j,O.v1.positionWorld,O.vertexNormalsWorld[0],S);p(j,O.v2.positionWorld,O.vertexNormalsWorld[1],ba);p(j,O.v3.positionWorld,O.vertexNormalsWorld[2],aa);S.r=Math.max(0,Math.min(R.color.r*S.r,1));S.g=Math.max(0,Math.min(R.color.g*S.g,1));S.b=Math.max(0,Math.min(R.color.b*S.b,1));ba.r=Math.max(0,Math.min(R.color.r*
|
|
|
+ba.r,1));ba.g=Math.max(0,Math.min(R.color.g*ba.g,1));ba.b=Math.max(0,Math.min(R.color.b*ba.b,1));aa.r=Math.max(0,Math.min(R.color.r*aa.r,1));aa.g=Math.max(0,Math.min(R.color.g*aa.g,1));aa.b=Math.max(0,Math.min(R.color.b*aa.b,1));fa.r=(ba.r+aa.r)*0.5;fa.g=(ba.g+aa.g)*0.5;fa.b=(ba.b+aa.b)*0.5;Ha=Dc(S,ba,aa,fa);gc(B,M,G,i,T,V,0,0,1,0,0,1,Ha)}else{Q.r=pa.r;Q.g=pa.g;Q.b=pa.b;p(j,O.centroidWorld,O.normalWorld,Q);Q.r=Math.max(0,Math.min(R.color.r*Q.r,1));Q.g=Math.max(0,Math.min(R.color.g*Q.g,1));Q.b=Math.max(0,
|
|
|
+Math.min(R.color.b*Q.b,1));R.wireframe?Mb(Q,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(Q)}else R.wireframe?Mb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(R.color)}else if(R instanceof THREE.MeshDepthMaterial){sa=k.near;Oa=k.far;S.r=S.g=S.b=1-ac(a.positionScreen.z,sa,Oa);ba.r=ba.g=ba.b=1-ac(d.positionScreen.z,sa,Oa);aa.r=aa.g=aa.b=1-ac(e.positionScreen.z,sa,Oa);fa.r=(ba.r+aa.r)*0.5;fa.g=(ba.g+aa.g)*0.5;fa.b=(ba.b+aa.b)*0.5;Ha=Dc(S,ba,aa,fa);gc(B,M,G,
|
|
|
+i,T,V,0,0,1,0,0,1,Ha)}else if(R instanceof THREE.MeshNormalMaterial){Q.r=hc(O.normalWorld.x);Q.g=hc(O.normalWorld.y);Q.b=hc(O.normalWorld.z);R.wireframe?Mb(Q,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(Q)}}function u(a,d,e,g,ca,h,R,O,l){f.info.render.vertices=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,R,O,l);t(ca,e,h,1,2,3,R,O,l)}else{B=a.positionScreen.x;M=a.positionScreen.y;G=d.positionScreen.x;i=d.positionScreen.y;
|
|
|
+T=e.positionScreen.x;V=e.positionScreen.y;A=g.positionScreen.x;X=g.positionScreen.y;H=ca.positionScreen.x;da=ca.positionScreen.y;ga=h.positionScreen.x;la=h.positionScreen.y;if(O instanceof THREE.MeshBasicMaterial){w(B,M,G,i,T,V,A,X);O.wireframe?Mb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(O.color)}else if(O instanceof THREE.MeshLambertMaterial)if(ab)if(!O.wireframe&&O.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==4){S.r=ba.r=aa.r=fa.r=pa.r;S.g=ba.g=aa.g=
|
|
|
+fa.g=pa.g;S.b=ba.b=aa.b=fa.b=pa.b;p(j,R.v1.positionWorld,R.vertexNormalsWorld[0],S);p(j,R.v2.positionWorld,R.vertexNormalsWorld[1],ba);p(j,R.v4.positionWorld,R.vertexNormalsWorld[3],aa);p(j,R.v3.positionWorld,R.vertexNormalsWorld[2],fa);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));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));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));fa.r=Math.max(0,Math.min(O.color.r*fa.r,1));fa.g=Math.max(0,Math.min(O.color.g*fa.g,1));fa.b=Math.max(0,Math.min(O.color.b*fa.b,1));Ha=Dc(S,ba,aa,fa);x(B,M,G,i,A,X);gc(B,M,G,i,A,X,0,0,1,0,0,1,Ha);x(H,da,T,V,ga,la);gc(H,da,T,V,ga,la,1,0,1,1,0,1,Ha)}else{Q.r=pa.r;Q.g=pa.g;Q.b=pa.b;p(j,R.centroidWorld,R.normalWorld,Q);Q.r=Math.max(0,Math.min(O.color.r*Q.r,1));Q.g=Math.max(0,Math.min(O.color.g*
|
|
|
+Q.g,1));Q.b=Math.max(0,Math.min(O.color.b*Q.b,1));w(B,M,G,i,T,V,A,X);O.wireframe?Mb(Q,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(Q)}else{w(B,M,G,i,T,V,A,X);O.wireframe?Mb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(O.color)}else if(O instanceof THREE.MeshNormalMaterial){Q.r=hc(R.normalWorld.x);Q.g=hc(R.normalWorld.y);Q.b=hc(R.normalWorld.z);w(B,M,G,i,T,V,A,X);O.wireframe?Mb(Q,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Gb(Q)}else if(O instanceof
|
|
|
+THREE.MeshDepthMaterial){sa=k.near;Oa=k.far;S.r=S.g=S.b=1-ac(a.positionScreen.z,sa,Oa);ba.r=ba.g=ba.b=1-ac(d.positionScreen.z,sa,Oa);aa.r=aa.g=aa.b=1-ac(g.positionScreen.z,sa,Oa);fa.r=fa.g=fa.b=1-ac(e.positionScreen.z,sa,Oa);Ha=Dc(S,ba,aa,fa);x(B,M,G,i,A,X);gc(B,M,G,i,A,X,0,0,1,0,0,1,Ha);x(H,da,T,V,ga,la);gc(H,da,T,V,ga,la,1,0,1,1,0,1,Ha)}}}function x(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b);n.closePath()}function w(a,b,c,d,e,f,g,ca){n.beginPath();n.moveTo(a,
|
|
|
+b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,ca);n.lineTo(a,b);n.closePath()}function Mb(a,b,c,e){if(F!=b)n.lineWidth=F=b;if(E!=c)n.lineCap=E=c;if(z!=e)n.lineJoin=z=e;d(a.getContextStyle());n.stroke();ua.inflate(b*2)}function Gb(a){e(a.getContextStyle());n.fill()}function Tc(a,b,c,d,f,g,ca,h,i,O,R,j,l){if(l.image.width!=0){if(l.needsUpdate==true||Na[l.id]==void 0){var k=l.wrapS==THREE.RepeatWrapping,m=l.wrapT==THREE.RepeatWrapping;Na[l.id]=n.createPattern(l.image,k&&m?"repeat":k&&!m?"repeat-x":!k&&m?
|
|
|
+"repeat-y":"no-repeat");l.needsUpdate=false}e(Na[l.id]);var k=l.offset.x/l.repeat.x,m=l.offset.y/l.repeat.y,p=l.image.width*l.repeat.x,o=l.image.height*l.repeat.y,ca=(ca+k)*p,h=(h+m)*o,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+k)*p-ca,O=(O+m)*o-h,R=(R+k)*p-ca,j=(j+m)*o-h,k=i*j-R*O;if(k==0){if(wa[l.id]===void 0){b=document.createElement("canvas");b.width=l.image.width;b.height=l.image.height;b=b.getContext("2d");b.drawImage(l.image,0,0);wa[l.id]=b.getImageData(0,0,l.image.width,l.image.height).data}b=wa[l.id];
|
|
|
+ca=(Math.floor(ca)+Math.floor(h)*l.image.width)*4;Q.setRGB(b[ca]/255,b[ca+1]/255,b[ca+2]/255);Gb(Q)}else{k=1/k;l=(j*c-O*f)*k;O=(j*d-O*g)*k;c=(i*f-R*c)*k;d=(i*g-R*d)*k;a=a-l*ca-c*h;ca=b-O*ca-d*h;n.save();n.transform(l,O,c,d,a,ca);n.fill();n.restore()}}}function gc(a,b,c,d,e,f,g,ca,h,O,i,R,l){var j,k;j=l.width-1;k=l.height-1;g=g*j;ca=ca*k;c=c-a;d=d-b;e=e-a;f=f-b;h=h*j-g;O=O*k-ca;i=i*j-g;R=R*k-ca;k=1/(h*R-i*O);j=(R*c-O*e)*k;O=(R*d-O*f)*k;c=(h*e-i*c)*k;d=(h*f-i*d)*k;a=a-j*g-c*ca;b=b-O*g-d*ca;n.save();
|
|
|
+n.transform(j,O,c,d,a,b);n.clip();n.drawImage(l,0,0);n.restore()}function Dc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),l=~~(c.g*255),c=~~(c.b*255),j=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);O[0]=e<0?0:e>255?255:e;O[1]=f<0?0:f>255?255:f;O[2]=a<0?0:a>255?255:a;O[4]=g<0?0:g>255?255:g;O[5]=h<0?0:h>255?255:h;O[6]=b<0?0:b>255?255:b;O[8]=i<0?0:i>255?255:i;O[9]=l<0?0:l>255?255:l;O[10]=c<0?0:c>255?255:c;O[12]=j<0?0:j>255?255:j;O[13]=k<0?0:
|
|
|
+k>255?255:k;O[14]=d<0?0:d>255?255:d;ca.putImageData(R,0,0);Cc.drawImage(Fb,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!=0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Ec,cd,Ta,kb;this.autoClear?this.clear():n.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;j=g.lights;
|
|
|
+(ab=j.length>0)&&m(j);Ec=0;for(cd=h.length;Ec<cd;Ec++){Ta=h[Ec];kb=Ta.material;kb=kb instanceof THREE.MeshFaceMaterial?Ta.faceMaterial:kb;if(!(kb==null||kb.opacity==0)){ua.empty();if(Ta instanceof THREE.RenderableParticle){v=Ta;v.x=v.x*o;v.y=v.y*q;r(v,Ta,kb,a)}else if(Ta instanceof THREE.RenderableLine){v=Ta.v1;C=Ta.v2;v.positionScreen.x=v.positionScreen.x*o;v.positionScreen.y=v.positionScreen.y*q;C.positionScreen.x=C.positionScreen.x*o;C.positionScreen.y=C.positionScreen.y*q;ua.addPoint(v.positionScreen.x,
|
|
|
+v.positionScreen.y);ua.addPoint(C.positionScreen.x,C.positionScreen.y);Pa.intersects(ua)&&s(v,C,Ta,kb,a)}else if(Ta instanceof THREE.RenderableFace3){v=Ta.v1;C=Ta.v2;J=Ta.v3;v.positionScreen.x=v.positionScreen.x*o;v.positionScreen.y=v.positionScreen.y*q;C.positionScreen.x=C.positionScreen.x*o;C.positionScreen.y=C.positionScreen.y*q;J.positionScreen.x=J.positionScreen.x*o;J.positionScreen.y=J.positionScreen.y*q;if(kb.overdraw){Nb(v.positionScreen,C.positionScreen);Nb(C.positionScreen,J.positionScreen);
|
|
|
+Nb(J.positionScreen,v.positionScreen)}ua.add3Points(v.positionScreen.x,v.positionScreen.y,C.positionScreen.x,C.positionScreen.y,J.positionScreen.x,J.positionScreen.y);Pa.intersects(ua)&&t(v,C,J,0,1,2,Ta,kb,a)}else if(Ta instanceof THREE.RenderableFace4){v=Ta.v1;C=Ta.v2;J=Ta.v3;L=Ta.v4;v.positionScreen.x=v.positionScreen.x*o;v.positionScreen.y=v.positionScreen.y*q;C.positionScreen.x=C.positionScreen.x*o;C.positionScreen.y=C.positionScreen.y*q;J.positionScreen.x=J.positionScreen.x*o;J.positionScreen.y=
|
|
|
+J.positionScreen.y*q;L.positionScreen.x=L.positionScreen.x*o;L.positionScreen.y=L.positionScreen.y*q;W.positionScreen.copy(C.positionScreen);P.positionScreen.copy(L.positionScreen);if(kb.overdraw){Nb(v.positionScreen,C.positionScreen);Nb(C.positionScreen,L.positionScreen);Nb(L.positionScreen,v.positionScreen);Nb(J.positionScreen,W.positionScreen);Nb(J.positionScreen,P.positionScreen)}ua.addPoint(v.positionScreen.x,v.positionScreen.y);ua.addPoint(C.positionScreen.x,C.positionScreen.y);ua.addPoint(J.positionScreen.x,
|
|
|
+J.positionScreen.y);ua.addPoint(L.positionScreen.x,L.positionScreen.y);Pa.intersects(ua)&&u(v,C,J,L,W,P,Ta,kb,a)}ta.addRectangle(ua)}}n.setTransform(1,0,0,1,0,0)}};
|
|
|
THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,l,j;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){l=g.matrixWorld.getPosition();j=c.dot(l);if(!(j<=0)){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}else if(g instanceof THREE.PointLight){l=g.matrixWorld.getPosition();j=c.dot(v.sub(l,b).normalize());if(!(j<=0)){j=j*(g.distance==0?1:1-Math.min(b.distanceTo(l)/g.distance,1));if(j!=0){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*
|
|
|
-j}}}}}function b(a){if(C[a]==null){C[a]=document.createElementNS("http://www.w3.org/2000/svg","path");J==0&&C[a].setAttribute("shape-rendering","crispEdges")}return C[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}console.log("THREE.SVGRenderer",THREE.REVISION);var d=this,e,f,g,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,p,m,o,r,n,q,u=new THREE.Rectangle,t=new THREE.Rectangle,y=false,s=new THREE.Color,x=new THREE.Color,D=new THREE.Color,B=new THREE.Color,
|
|
|
-w,v=new THREE.Vector3,C=[],K=[],L,T,P,J=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":J=1;break;case "low":J=0}};this.setSize=function(a,b){k=a;l=b;p=k/2;m=l/2;j.setAttribute("viewBox",-p+" "+-m+" "+k+" "+l);j.setAttribute("width",k);j.setAttribute("height",l);u.set(-p,-m,p,m)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(l,
|
|
|
-k){var i,v,E,H;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(l,k,this.sortElements);f=e.elements;g=e.lights;P=T=0;if(y=g.length>0){x.setRGB(0,0,0);D.setRGB(0,0,0);B.setRGB(0,0,0);i=0;for(v=g.length;i<v;i++){H=g[i];E=H.color;if(H instanceof THREE.AmbientLight){x.r=x.r+E.r;x.g=x.g+E.g;x.b=x.b+E.b}else if(H instanceof THREE.DirectionalLight){D.r=D.r+E.r;D.g=D.g+E.g;D.b=D.b+E.b}else if(H instanceof THREE.PointLight){B.r=B.r+E.r;B.g=B.g+E.g;B.b=B.b+E.b}}}i=
|
|
|
-0;for(v=f.length;i<v;i++){E=f[i];H=E.material;H=H instanceof THREE.MeshFaceMaterial?E.faceMaterial:H;if(!(H==null||H.opacity==0)){t.empty();if(E instanceof THREE.RenderableParticle){o=E;o.x=o.x*p;o.y=o.y*-m}else if(E instanceof THREE.RenderableLine){o=E.v1;r=E.v2;o.positionScreen.x=o.positionScreen.x*p;o.positionScreen.y=o.positionScreen.y*-m;r.positionScreen.x=r.positionScreen.x*p;r.positionScreen.y=r.positionScreen.y*-m;t.addPoint(o.positionScreen.x,o.positionScreen.y);t.addPoint(r.positionScreen.x,
|
|
|
-r.positionScreen.y);if(u.intersects(t)){E=o;var W=r,G=P++;if(K[G]==null){K[G]=document.createElementNS("http://www.w3.org/2000/svg","line");J==0&&K[G].setAttribute("shape-rendering","crispEdges")}L=K[G];L.setAttribute("x1",E.positionScreen.x);L.setAttribute("y1",E.positionScreen.y);L.setAttribute("x2",W.positionScreen.x);L.setAttribute("y2",W.positionScreen.y);if(H instanceof THREE.LineBasicMaterial){L.setAttribute("style","fill: none; stroke: "+H.color.getContextStyle()+"; stroke-width: "+H.linewidth+
|
|
|
-"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.linecap+"; stroke-linejoin: "+H.linejoin);j.appendChild(L)}}}else if(E instanceof THREE.RenderableFace3){o=E.v1;r=E.v2;n=E.v3;o.positionScreen.x=o.positionScreen.x*p;o.positionScreen.y=o.positionScreen.y*-m;r.positionScreen.x=r.positionScreen.x*p;r.positionScreen.y=r.positionScreen.y*-m;n.positionScreen.x=n.positionScreen.x*p;n.positionScreen.y=n.positionScreen.y*-m;t.addPoint(o.positionScreen.x,o.positionScreen.y);t.addPoint(r.positionScreen.x,
|
|
|
-r.positionScreen.y);t.addPoint(n.positionScreen.x,n.positionScreen.y);if(u.intersects(t)){var W=o,G=r,C=n;d.info.render.vertices=d.info.render.vertices+3;d.info.render.faces++;L=b(T++);L.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+C.positionScreen.x+","+C.positionScreen.y+"z");if(H instanceof THREE.MeshBasicMaterial)s.copy(H.color);else if(H instanceof THREE.MeshLambertMaterial)if(y){s.r=x.r;s.g=x.g;s.b=x.b;a(g,E.centroidWorld,
|
|
|
-E.normalWorld,s);s.r=Math.max(0,Math.min(H.color.r*s.r,1));s.g=Math.max(0,Math.min(H.color.g*s.g,1));s.b=Math.max(0,Math.min(H.color.b*s.b,1))}else s.copy(H.color);else if(H instanceof THREE.MeshDepthMaterial){w=1-H.__2near/(H.__farPlusNear-E.z*H.__farMinusNear);s.setRGB(w,w,w)}else H instanceof THREE.MeshNormalMaterial&&s.setRGB(c(E.normalWorld.x),c(E.normalWorld.y),c(E.normalWorld.z));H.wireframe?L.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+H.wireframeLinewidth+
|
|
|
-"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.wireframeLinecap+"; stroke-linejoin: "+H.wireframeLinejoin):L.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+H.opacity);j.appendChild(L)}}else if(E instanceof THREE.RenderableFace4){o=E.v1;r=E.v2;n=E.v3;q=E.v4;o.positionScreen.x=o.positionScreen.x*p;o.positionScreen.y=o.positionScreen.y*-m;r.positionScreen.x=r.positionScreen.x*p;r.positionScreen.y=r.positionScreen.y*-m;n.positionScreen.x=n.positionScreen.x*p;n.positionScreen.y=
|
|
|
-n.positionScreen.y*-m;q.positionScreen.x=q.positionScreen.x*p;q.positionScreen.y=q.positionScreen.y*-m;t.addPoint(o.positionScreen.x,o.positionScreen.y);t.addPoint(r.positionScreen.x,r.positionScreen.y);t.addPoint(n.positionScreen.x,n.positionScreen.y);t.addPoint(q.positionScreen.x,q.positionScreen.y);if(u.intersects(t)){var W=o,G=r,C=n,fa=q;d.info.render.vertices=d.info.render.vertices+4;d.info.render.faces++;L=b(T++);L.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+G.positionScreen.x+
|
|
|
-" "+G.positionScreen.y+" L "+C.positionScreen.x+","+C.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");if(H instanceof THREE.MeshBasicMaterial)s.copy(H.color);else if(H instanceof THREE.MeshLambertMaterial)if(y){s.r=x.r;s.g=x.g;s.b=x.b;a(g,E.centroidWorld,E.normalWorld,s);s.r=Math.max(0,Math.min(H.color.r*s.r,1));s.g=Math.max(0,Math.min(H.color.g*s.g,1));s.b=Math.max(0,Math.min(H.color.b*s.b,1))}else s.copy(H.color);else if(H instanceof THREE.MeshDepthMaterial){w=1-H.__2near/
|
|
|
-(H.__farPlusNear-E.z*H.__farMinusNear);s.setRGB(w,w,w)}else H instanceof THREE.MeshNormalMaterial&&s.setRGB(c(E.normalWorld.x),c(E.normalWorld.y),c(E.normalWorld.z));H.wireframe?L.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+H.wireframeLinewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.wireframeLinecap+"; stroke-linejoin: "+H.wireframeLinejoin):L.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+H.opacity);j.appendChild(L)}}}}}};
|
|
|
+j}}}}}function b(a){if(C[a]==null){C[a]=document.createElementNS("http://www.w3.org/2000/svg","path");B==0&&C[a].setAttribute("shape-rendering","crispEdges")}return C[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}console.log("THREE.SVGRenderer",THREE.REVISION);var d=this,e,f,g,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,m,o,q,n,r,u=new THREE.Rectangle,t=new THREE.Rectangle,x=false,s=new THREE.Color,w=new THREE.Color,F=new THREE.Color,E=new THREE.Color,
|
|
|
+z,v=new THREE.Vector3,C=[],J=[],L,W,P,B=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":B=1;break;case "low":B=0}};this.setSize=function(a,b){l=a;k=b;p=l/2;m=k/2;j.setAttribute("viewBox",-p+" "+-m+" "+l+" "+k);j.setAttribute("width",l);j.setAttribute("height",k);u.set(-p,-m,p,m)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(l,
|
|
|
+k){var i,v,C,A;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(l,k,this.sortElements);f=e.elements;g=e.lights;P=W=0;if(x=g.length>0){w.setRGB(0,0,0);F.setRGB(0,0,0);E.setRGB(0,0,0);i=0;for(v=g.length;i<v;i++){A=g[i];C=A.color;if(A instanceof THREE.AmbientLight){w.r=w.r+C.r;w.g=w.g+C.g;w.b=w.b+C.b}else if(A instanceof THREE.DirectionalLight){F.r=F.r+C.r;F.g=F.g+C.g;F.b=F.b+C.b}else if(A instanceof THREE.PointLight){E.r=E.r+C.r;E.g=E.g+C.g;E.b=E.b+C.b}}}i=
|
|
|
+0;for(v=f.length;i<v;i++){C=f[i];A=C.material;A=A instanceof THREE.MeshFaceMaterial?C.faceMaterial:A;if(!(A==null||A.opacity==0)){t.empty();if(C instanceof THREE.RenderableParticle){o=C;o.x=o.x*p;o.y=o.y*-m}else if(C instanceof THREE.RenderableLine){o=C.v1;q=C.v2;o.positionScreen.x=o.positionScreen.x*p;o.positionScreen.y=o.positionScreen.y*-m;q.positionScreen.x=q.positionScreen.x*p;q.positionScreen.y=q.positionScreen.y*-m;t.addPoint(o.positionScreen.x,o.positionScreen.y);t.addPoint(q.positionScreen.x,
|
|
|
+q.positionScreen.y);if(u.intersects(t)){C=o;var X=q,H=P++;if(J[H]==null){J[H]=document.createElementNS("http://www.w3.org/2000/svg","line");B==0&&J[H].setAttribute("shape-rendering","crispEdges")}L=J[H];L.setAttribute("x1",C.positionScreen.x);L.setAttribute("y1",C.positionScreen.y);L.setAttribute("x2",X.positionScreen.x);L.setAttribute("y2",X.positionScreen.y);if(A instanceof THREE.LineBasicMaterial){L.setAttribute("style","fill: none; stroke: "+A.color.getContextStyle()+"; stroke-width: "+A.linewidth+
|
|
|
+"; stroke-opacity: "+A.opacity+"; stroke-linecap: "+A.linecap+"; stroke-linejoin: "+A.linejoin);j.appendChild(L)}}}else if(C instanceof THREE.RenderableFace3){o=C.v1;q=C.v2;n=C.v3;o.positionScreen.x=o.positionScreen.x*p;o.positionScreen.y=o.positionScreen.y*-m;q.positionScreen.x=q.positionScreen.x*p;q.positionScreen.y=q.positionScreen.y*-m;n.positionScreen.x=n.positionScreen.x*p;n.positionScreen.y=n.positionScreen.y*-m;t.addPoint(o.positionScreen.x,o.positionScreen.y);t.addPoint(q.positionScreen.x,
|
|
|
+q.positionScreen.y);t.addPoint(n.positionScreen.x,n.positionScreen.y);if(u.intersects(t)){var X=o,H=q,da=n;d.info.render.vertices=d.info.render.vertices+3;d.info.render.faces++;L=b(W++);L.setAttribute("d","M "+X.positionScreen.x+" "+X.positionScreen.y+" L "+H.positionScreen.x+" "+H.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");if(A instanceof THREE.MeshBasicMaterial)s.copy(A.color);else if(A instanceof THREE.MeshLambertMaterial)if(x){s.r=w.r;s.g=w.g;s.b=w.b;a(g,C.centroidWorld,
|
|
|
+C.normalWorld,s);s.r=Math.max(0,Math.min(A.color.r*s.r,1));s.g=Math.max(0,Math.min(A.color.g*s.g,1));s.b=Math.max(0,Math.min(A.color.b*s.b,1))}else s.copy(A.color);else if(A instanceof THREE.MeshDepthMaterial){z=1-A.__2near/(A.__farPlusNear-C.z*A.__farMinusNear);s.setRGB(z,z,z)}else A instanceof THREE.MeshNormalMaterial&&s.setRGB(c(C.normalWorld.x),c(C.normalWorld.y),c(C.normalWorld.z));A.wireframe?L.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+A.wireframeLinewidth+
|
|
|
+"; stroke-opacity: "+A.opacity+"; stroke-linecap: "+A.wireframeLinecap+"; stroke-linejoin: "+A.wireframeLinejoin):L.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+A.opacity);j.appendChild(L)}}else if(C instanceof THREE.RenderableFace4){o=C.v1;q=C.v2;n=C.v3;r=C.v4;o.positionScreen.x=o.positionScreen.x*p;o.positionScreen.y=o.positionScreen.y*-m;q.positionScreen.x=q.positionScreen.x*p;q.positionScreen.y=q.positionScreen.y*-m;n.positionScreen.x=n.positionScreen.x*p;n.positionScreen.y=
|
|
|
+n.positionScreen.y*-m;r.positionScreen.x=r.positionScreen.x*p;r.positionScreen.y=r.positionScreen.y*-m;t.addPoint(o.positionScreen.x,o.positionScreen.y);t.addPoint(q.positionScreen.x,q.positionScreen.y);t.addPoint(n.positionScreen.x,n.positionScreen.y);t.addPoint(r.positionScreen.x,r.positionScreen.y);if(u.intersects(t)){var X=o,H=q,da=n,ga=r;d.info.render.vertices=d.info.render.vertices+4;d.info.render.faces++;L=b(W++);L.setAttribute("d","M "+X.positionScreen.x+" "+X.positionScreen.y+" L "+H.positionScreen.x+
|
|
|
+" "+H.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+" L "+ga.positionScreen.x+","+ga.positionScreen.y+"z");if(A instanceof THREE.MeshBasicMaterial)s.copy(A.color);else if(A instanceof THREE.MeshLambertMaterial)if(x){s.r=w.r;s.g=w.g;s.b=w.b;a(g,C.centroidWorld,C.normalWorld,s);s.r=Math.max(0,Math.min(A.color.r*s.r,1));s.g=Math.max(0,Math.min(A.color.g*s.g,1));s.b=Math.max(0,Math.min(A.color.b*s.b,1))}else s.copy(A.color);else if(A instanceof THREE.MeshDepthMaterial){z=1-A.__2near/
|
|
|
+(A.__farPlusNear-C.z*A.__farMinusNear);s.setRGB(z,z,z)}else A instanceof THREE.MeshNormalMaterial&&s.setRGB(c(C.normalWorld.x),c(C.normalWorld.y),c(C.normalWorld.z));A.wireframe?L.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+A.wireframeLinewidth+"; stroke-opacity: "+A.opacity+"; stroke-linecap: "+A.wireframeLinecap+"; stroke-linejoin: "+A.wireframeLinejoin):L.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+A.opacity);j.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\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\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",
|
|
@@ -250,130 +250,130 @@ THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3
|
|
|
"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
|
THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=i.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
|
|
|
function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
|
|
|
-var j=a.colors,l=j.length,k=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){ua.copy(ta);ua.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];ab.copy(e);ua.multiplyVector3(ab);n[d]=[ab.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[n[d][1]];f=d*3;k[f]=e.x;k[f+1]=e.y;k[f+2]=e.z}for(d=0;d<l;d++){f=d*3;e=j[n[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){j=0;for(l=r.length;j<l;j++){h=r[j];if(h.boundTo===
|
|
|
+var j=a.colors,l=j.length,k=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){ua.copy(ta);ua.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];ab.copy(e);ua.multiplyVector3(ab);n[d]=[ab.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[n[d][1]];f=d*3;k[f]=e.x;k[f+1]=e.y;k[f+2]=e.z}for(d=0;d<l;d++){f=d*3;e=j[n[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(q){j=0;for(l=q.length;j<l;j++){h=q[j];if(h.boundTo===
|
|
|
void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=n[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=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=f+3}else if(h.size===4)for(d=0;d<e;d++){g=n[d][1];g=h.value[g];
|
|
|
-h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(p)for(d=0;d<g;d++){e=h[d];f=d*3;k[f]=e.x;k[f+1]=e.y;k[f+2]=e.z}if(o)for(d=0;d<l;d++){e=j[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){j=0;for(l=r.length;j<l;j++){h=r[j];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type===
|
|
|
+h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(p)for(d=0;d<g;d++){e=h[d];f=d*3;k[f]=e.x;k[f+1]=e.y;k[f+2]=e.z}if(o)for(d=0;d<l;d++){e=j[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(q){j=0;for(l=q.length;j<l;j++){h=q[j];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type===
|
|
|
"c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=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=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(p||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,k,b)}if(o||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,a.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,
|
|
|
-m,b)}if(r){j=0;for(l=r.length;j<l;j++){h=r[j];if(h.needsUpdate||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,h.buffer);i.bufferData(i.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++){ha=E=null;W=G=wa=Na=$=-1;a[d].render(b,c,hb,mb);ha=E=null;W=G=wa=Na=$=-1}}function j(a,b,c,d,e,f,g,h){var i,j,l,k;if(b){j=a.length-1;k=b=-1}else{j=0;b=a.length;k=1}for(var m=j;m!==b;m=m+k){i=a[m];if(i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=
|
|
|
-i[c];if(!i)continue;g&&F.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);F.setDepthTest(i.depthTest);F.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}F.setObjectFaces(j);l instanceof THREE.BufferGeometry?F.renderBufferDirect(d,e,f,i,l,j):F.renderBuffer(d,e,f,i,l,j)}}}function k(a,b,c,d,e,f,g){for(var h,i,j=0,l=a.length;j<l;j++){h=a[j];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&F.setBlending(h.blending,h.blendEquation,h.blendSrc,
|
|
|
-h.blendDst);F.setDepthTest(h.depthTest);F.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}F.renderImmediateObject(c,d,e,h,i)}}}function l(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 true;return false}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function o(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function r(a,
|
|
|
-b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function n(a,b,c,d,e){if(!d.program||d.needsUpdate){F.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var f=0,g=F.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=false,f=d.program,g=f.uniforms,j=d.uniforms;if(f!==E){i.useProgram(f);E=f;h=true}if(d.id!==W){W=d.id;h=true}if(h||a!==ha){i.uniformMatrix4fv(g.projectionMatrix,
|
|
|
-false,a._projectionMatrixArray);a!==ha&&(ha=a)}if(h){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var l,k=0,m=0,n=0,p,o,r,q=Ia,s=q.directional.colors,u=q.directional.positions,t=q.point.colors,H=q.point.positions,G=q.point.distances,w=0,v=0,x=r=0,c=0,h=b.length;c<h;c++){l=b[c];
|
|
|
-if(!l.onlyShadow){p=l.color;o=l.intensity;r=l.distance;if(l instanceof THREE.AmbientLight)if(F.gammaInput){k=k+p.r*p.r;m=m+p.g*p.g;n=n+p.b*p.b}else{k=k+p.r;m=m+p.g;n=n+p.b}else if(l instanceof THREE.DirectionalLight){r=w*3;if(F.gammaInput){s[r]=p.r*p.r*o*o;s[r+1]=p.g*p.g*o*o;s[r+2]=p.b*p.b*o*o}else{s[r]=p.r*o;s[r+1]=p.g*o;s[r+2]=p.b*o}pa.copy(l.matrixWorld.getPosition());pa.subSelf(l.target.matrixWorld.getPosition());pa.normalize();u[r]=pa.x;u[r+1]=pa.y;u[r+2]=pa.z;w=w+1}else if(l instanceof THREE.PointLight||
|
|
|
-l instanceof THREE.SpotLight){x=v*3;if(F.gammaInput){t[x]=p.r*p.r*o*o;t[x+1]=p.g*p.g*o*o;t[x+2]=p.b*p.b*o*o}else{t[x]=p.r*o;t[x+1]=p.g*o;t[x+2]=p.b*o}l=l.matrixWorld.getPosition();H[x]=l.x;H[x+1]=l.y;H[x+2]=l.z;G[v]=r;v=v+1}}}c=w*3;for(h=s.length;c<h;c++)s[c]=0;c=v*3;for(h=t.length;c<h;c++)t[c]=0;q.point.length=v;q.directional.length=w;q.ambient[0]=k;q.ambient[1]=m;q.ambient[2]=n;c=Ia;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=
|
|
|
-c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=d.opacity;F.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=
|
|
|
+m,b)}if(q){j=0;for(l=q.length;j<l;j++){h=q[j];if(h.needsUpdate||c.sortParticles){i.bindBuffer(i.ARRAY_BUFFER,h.buffer);i.bufferData(i.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++){da=V=null;X=H=wa=Na=S=-1;a[d].render(b,c,hb,mb);da=V=null;X=H=wa=Na=S=-1}}function j(a,b,c,d,e,f,g,h){var i,j,l,k;if(b){j=a.length-1;k=b=-1}else{j=0;b=a.length;k=1}for(var m=j;m!==b;m=m+k){i=a[m];if(i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=
|
|
|
+i[c];if(!i)continue;g&&G.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);G.setDepthTest(i.depthTest);G.setDepthWrite(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}G.setObjectFaces(j);l instanceof THREE.BufferGeometry?G.renderBufferDirect(d,e,f,i,l,j):G.renderBuffer(d,e,f,i,l,j)}}}function l(a,b,c,d,e,f,g){for(var h,i,j=0,l=a.length;j<l;j++){h=a[j];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&G.setBlending(h.blending,h.blendEquation,h.blendSrc,
|
|
|
+h.blendDst);G.setDepthTest(h.depthTest);G.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}G.renderImmediateObject(c,d,e,h,i)}}}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 true;return false}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function o(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function q(a,
|
|
|
+b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function n(a,b,c,d,e){if(!d.program||d.needsUpdate){G.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var f=0,g=G.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=false,f=d.program,g=f.uniforms,j=d.uniforms;if(f!==V){i.useProgram(f);V=f;h=true}if(d.id!==X){X=d.id;h=true}if(h||a!==da){i.uniformMatrix4fv(g.projectionMatrix,
|
|
|
+false,a._projectionMatrixArray);a!==da&&(da=a)}if(h){if(c&&d.fog){j.fogColor.value=c.color;if(c instanceof THREE.Fog){j.fogNear.value=c.near;j.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var l,k=0,m=0,n=0,p,o,q,r=Ia,s=r.directional.colors,t=r.directional.positions,u=r.point.colors,A=r.point.positions,v=r.point.distances,H=0,w=0,z=q=0,c=0,h=b.length;c<h;c++){l=b[c];
|
|
|
+if(!l.onlyShadow){p=l.color;o=l.intensity;q=l.distance;if(l instanceof THREE.AmbientLight)if(G.gammaInput){k=k+p.r*p.r;m=m+p.g*p.g;n=n+p.b*p.b}else{k=k+p.r;m=m+p.g;n=n+p.b}else if(l instanceof THREE.DirectionalLight){q=H*3;if(G.gammaInput){s[q]=p.r*p.r*o*o;s[q+1]=p.g*p.g*o*o;s[q+2]=p.b*p.b*o*o}else{s[q]=p.r*o;s[q+1]=p.g*o;s[q+2]=p.b*o}pa.copy(l.matrixWorld.getPosition());pa.subSelf(l.target.matrixWorld.getPosition());pa.normalize();t[q]=pa.x;t[q+1]=pa.y;t[q+2]=pa.z;H=H+1}else if(l instanceof THREE.PointLight||
|
|
|
+l instanceof THREE.SpotLight){z=w*3;if(G.gammaInput){u[z]=p.r*p.r*o*o;u[z+1]=p.g*p.g*o*o;u[z+2]=p.b*p.b*o*o}else{u[z]=p.r*o;u[z+1]=p.g*o;u[z+2]=p.b*o}l=l.matrixWorld.getPosition();A[z]=l.x;A[z+1]=l.y;A[z+2]=l.z;v[w]=q;w=w+1}}}c=H*3;for(h=s.length;c<h;c++)s[c]=0;c=w*3;for(h=u.length;c<h;c++)u[c]=0;r.point.length=w;r.directional.length=H;r.ambient[0]=k;r.ambient[1]=m;r.ambient[2]=n;c=Ia;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=
|
|
|
+c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=c.point.positions;j.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){j.opacity.value=d.opacity;G.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color;(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y);j.lightMap.texture=
|
|
|
d.lightMap;j.envMap.texture=d.envMap;j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;j.reflectivity.value=d.reflectivity;j.refractionRatio.value=d.refractionRatio;j.combine.value=d.combine;j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof THREE.LineBasicMaterial){j.diffuse.value=d.color;j.opacity.value=d.opacity}else if(d instanceof THREE.ParticleBasicMaterial){j.psColor.value=d.color;j.opacity.value=d.opacity;j.size.value=
|
|
|
-d.size;j.scale.value=B.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(F.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);
|
|
|
+d.size;j.scale.value=E.height/2;j.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){j.shininess.value=d.shininess;if(G.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);j.emissive.value.copyGammaToLinear(d.emissive);j.specular.value.copyGammaToLinear(d.specular)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive;j.specular.value=d.specular}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(G.gammaInput){j.ambient.value.copyGammaToLinear(d.ambient);
|
|
|
j.emissive.value.copyGammaToLinear(d.emissive)}else{j.ambient.value=d.ambient;j.emissive.value=d.emissive}d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){j.mNear.value=a.near;j.mFar.value=a.far;j.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&j.shadowMatrix){h=c=0;for(k=b.length;h<k;h++){m=b[h];if(m.castShadow&&(m instanceof THREE.SpotLight||m instanceof THREE.DirectionalLight&&
|
|
|
!m.shadowCascade)){j.shadowMap.texture[c]=m.shadowMap;j.shadowMapSize.value[c]=m.shadowMapSize;j.shadowMatrix.value[c]=m.shadowMatrix;j.shadowDarkness.value[c]=m.shadowDarkness;j.shadowBias.value[c]=m.shadowBias;c++}}}b=d.uniformsList;j=0;for(c=b.length;j<c;j++)if(m=f.uniforms[b[j][1]]){h=b[j][0];n=h.type;k=h.value;if(n==="i")i.uniform1i(m,k);else if(n==="f")i.uniform1f(m,k);else if(n==="v2")i.uniform2f(m,k.x,k.y);else if(n==="v3")i.uniform3f(m,k.x,k.y,k.z);else if(n==="v4")i.uniform4f(m,k.x,k.y,
|
|
|
-k.z,k.w);else if(n==="c")i.uniform3f(m,k.r,k.g,k.b);else if(n==="fv1")i.uniform1fv(m,k);else if(n==="fv")i.uniform3fv(m,k);else if(n==="v2v"){if(!h._array)h._array=new Float32Array(2*k.length);n=0;for(q=k.length;n<q;n++){s=n*2;h._array[s]=k[n].x;h._array[s+1]=k[n].y}i.uniform2fv(m,h._array)}else if(n==="v3v"){if(!h._array)h._array=new Float32Array(3*k.length);n=0;for(q=k.length;n<q;n++){s=n*3;h._array[s]=k[n].x;h._array[s+1]=k[n].y;h._array[s+2]=k[n].z}i.uniform3fv(m,h._array)}else if(n=="v4v"){if(!h._array)h._array=
|
|
|
-new Float32Array(4*k.length);n=0;for(q=k.length;n<q;n++){s=n*4;h._array[s]=k[n].x;h._array[s+1]=k[n].y;h._array[s+2]=k[n].z;h._array[s+3]=k[n].w}i.uniform4fv(m,h._array)}else if(n==="m4"){if(!h._array)h._array=new Float32Array(16);k.flattenToArray(h._array);i.uniformMatrix4fv(m,false,h._array)}else if(n==="m4v"){if(!h._array)h._array=new Float32Array(16*k.length);n=0;for(q=k.length;n<q;n++)k[n].flattenToArrayOffset(h._array,n*16);i.uniformMatrix4fv(m,false,h._array)}else if(n==="t"){i.uniform1i(m,
|
|
|
-k);if(m=h.texture)if(m.image instanceof Array&&m.image.length===6){h=m;if(h.image.length===6)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=i.createTexture();i.activeTexture(i.TEXTURE0+k);i.bindTexture(i.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);k=[];for(m=0;m<6;m++){n=k;q=m;if(F.autoScaleCubemaps){s=h.image[m];t=ja;if(!(s.width<=t&&s.height<=t)){H=Math.max(s.width,s.height);u=Math.floor(s.width*t/H);t=Math.floor(s.height*t/H);H=document.createElement("canvas");H.width=
|
|
|
-u;H.height=t;H.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,u,t);s=H}}else s=h.image[m];n[q]=s}m=k[0];n=(m.width&m.width-1)===0&&(m.height&m.height-1)===0;q=D(h.format);s=D(h.type);y(i.TEXTURE_CUBE_MAP,h,n);for(m=0;m<6;m++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,q,q,s,k[m]);h.generateMipmaps&&n&&i.generateMipmap(i.TEXTURE_CUBE_MAP);h.needsUpdate=false;if(h.onUpdate)h.onUpdate()}else{i.activeTexture(i.TEXTURE0+k);i.bindTexture(i.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}}else if(m instanceof
|
|
|
-THREE.WebGLRenderTargetCube){h=m;i.activeTexture(i.TEXTURE0+k);i.bindTexture(i.TEXTURE_CUBE_MAP,h.__webglTexture)}else F.setTexture(m,k)}else if(n==="tv"){if(!h._array){h._array=[];n=0;for(q=h.texture.length;n<q;n++)h._array[n]=k+n}i.uniform1iv(m,h._array);n=0;for(q=h.texture.length;n<q;n++)(m=h.texture[n])&&F.setTexture(m,h._array[n])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null){b=a.matrixWorld.getPosition();i.uniform3f(g.cameraPosition,
|
|
|
+k.z,k.w);else if(n==="c")i.uniform3f(m,k.r,k.g,k.b);else if(n==="fv1")i.uniform1fv(m,k);else if(n==="fv")i.uniform3fv(m,k);else if(n==="v2v"){if(!h._array)h._array=new Float32Array(2*k.length);n=0;for(r=k.length;n<r;n++){s=n*2;h._array[s]=k[n].x;h._array[s+1]=k[n].y}i.uniform2fv(m,h._array)}else if(n==="v3v"){if(!h._array)h._array=new Float32Array(3*k.length);n=0;for(r=k.length;n<r;n++){s=n*3;h._array[s]=k[n].x;h._array[s+1]=k[n].y;h._array[s+2]=k[n].z}i.uniform3fv(m,h._array)}else if(n=="v4v"){if(!h._array)h._array=
|
|
|
+new Float32Array(4*k.length);n=0;for(r=k.length;n<r;n++){s=n*4;h._array[s]=k[n].x;h._array[s+1]=k[n].y;h._array[s+2]=k[n].z;h._array[s+3]=k[n].w}i.uniform4fv(m,h._array)}else if(n==="m4"){if(!h._array)h._array=new Float32Array(16);k.flattenToArray(h._array);i.uniformMatrix4fv(m,false,h._array)}else if(n==="m4v"){if(!h._array)h._array=new Float32Array(16*k.length);n=0;for(r=k.length;n<r;n++)k[n].flattenToArrayOffset(h._array,n*16);i.uniformMatrix4fv(m,false,h._array)}else if(n==="t"){i.uniform1i(m,
|
|
|
+k);if(m=h.texture)if(m.image instanceof Array&&m.image.length===6){h=m;if(h.image.length===6)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=i.createTexture();i.activeTexture(i.TEXTURE0+k);i.bindTexture(i.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);k=[];for(m=0;m<6;m++){n=k;r=m;if(G.autoScaleCubemaps){s=h.image[m];u=ja;if(!(s.width<=u&&s.height<=u)){A=Math.max(s.width,s.height);t=Math.floor(s.width*u/A);u=Math.floor(s.height*u/A);A=document.createElement("canvas");A.width=
|
|
|
+t;A.height=u;A.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,u);s=A}}else s=h.image[m];n[r]=s}m=k[0];n=(m.width&m.width-1)===0&&(m.height&m.height-1)===0;r=F(h.format);s=F(h.type);x(i.TEXTURE_CUBE_MAP,h,n);for(m=0;m<6;m++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,r,r,s,k[m]);h.generateMipmaps&&n&&i.generateMipmap(i.TEXTURE_CUBE_MAP);h.needsUpdate=false;if(h.onUpdate)h.onUpdate()}else{i.activeTexture(i.TEXTURE0+k);i.bindTexture(i.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}}else if(m instanceof
|
|
|
+THREE.WebGLRenderTargetCube){h=m;i.activeTexture(i.TEXTURE0+k);i.bindTexture(i.TEXTURE_CUBE_MAP,h.__webglTexture)}else G.setTexture(m,k)}else if(n==="tv"){if(!h._array){h._array=[];n=0;for(r=h.texture.length;n<r;n++)h._array[n]=k+n}i.uniform1iv(m,h._array);n=0;for(r=h.texture.length;n<r;n++)(m=h.texture[n])&&G.setTexture(m,h._array[n])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null){b=a.matrixWorld.getPosition();i.uniform3f(g.cameraPosition,
|
|
|
b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&i.uniformMatrix4fv(g.viewMatrix,false,a._viewMatrixArray);d.skinning&&i.uniformMatrix4fv(g.boneGlobalMatrices,false,e.boneMatrices)}i.uniformMatrix4fv(g.modelViewMatrix,false,e._modelViewMatrix.elements);g.normalMatrix&&i.uniformMatrix3fv(g.normalMatrix,false,e._normalMatrix.elements);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||
|
|
|
-e.receiveShadow)&&g.objectMatrix!==null&&i.uniformMatrix4fv(g.objectMatrix,false,e.matrixWorld.elements);return f}function q(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,b,c){if(sa!==a){a?i.enable(i.POLYGON_OFFSET_FILL):i.disable(i.POLYGON_OFFSET_FILL);sa=a}if(a&&(Oa!==b||Ha!==c)){i.polygonOffset(b,c);Oa=b;Ha=c}}function t(a,b){var c;a==="fragment"?c=i.createShader(i.FRAGMENT_SHADER):a===
|
|
|
-"vertex"&&(c=i.createShader(i.VERTEX_SHADER));i.shaderSource(c,b);i.compileShader(c);if(!i.getShaderParameter(c,i.COMPILE_STATUS)){console.error(i.getShaderInfoLog(c));console.error(b);return null}return c}function y(a,b,c){if(c){i.texParameteri(a,i.TEXTURE_WRAP_S,D(b.wrapS));i.texParameteri(a,i.TEXTURE_WRAP_T,D(b.wrapT));i.texParameteri(a,i.TEXTURE_MAG_FILTER,D(b.magFilter));i.texParameteri(a,i.TEXTURE_MIN_FILTER,D(b.minFilter))}else{i.texParameteri(a,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE);i.texParameteri(a,
|
|
|
-i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);i.texParameteri(a,i.TEXTURE_MAG_FILTER,x(b.magFilter));i.texParameteri(a,i.TEXTURE_MIN_FILTER,x(b.minFilter))}}function s(a,b){i.bindRenderbuffer(i.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_COMPONENT16,b.width,b.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,b.width,b.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,
|
|
|
-i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,a)}else i.renderbufferStorage(i.RENDERBUFFER,i.RGBA4,b.width,b.height)}function x(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return i.NEAREST;default:return i.LINEAR}}function D(a){switch(a){case THREE.RepeatWrapping:return i.REPEAT;case THREE.ClampToEdgeWrapping:return i.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return i.MIRRORED_REPEAT;case THREE.NearestFilter:return i.NEAREST;case THREE.NearestMipMapNearestFilter:return i.NEAREST_MIPMAP_NEAREST;
|
|
|
+e.receiveShadow)&&g.objectMatrix!==null&&i.uniformMatrix4fv(g.objectMatrix,false,e.matrixWorld.elements);return f}function r(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,b,c){if(sa!==a){a?i.enable(i.POLYGON_OFFSET_FILL):i.disable(i.POLYGON_OFFSET_FILL);sa=a}if(a&&(Oa!==b||Ha!==c)){i.polygonOffset(b,c);Oa=b;Ha=c}}function t(a,b){var c;a==="fragment"?c=i.createShader(i.FRAGMENT_SHADER):a===
|
|
|
+"vertex"&&(c=i.createShader(i.VERTEX_SHADER));i.shaderSource(c,b);i.compileShader(c);if(!i.getShaderParameter(c,i.COMPILE_STATUS)){console.error(i.getShaderInfoLog(c));console.error(b);return null}return c}function x(a,b,c){if(c){i.texParameteri(a,i.TEXTURE_WRAP_S,F(b.wrapS));i.texParameteri(a,i.TEXTURE_WRAP_T,F(b.wrapT));i.texParameteri(a,i.TEXTURE_MAG_FILTER,F(b.magFilter));i.texParameteri(a,i.TEXTURE_MIN_FILTER,F(b.minFilter))}else{i.texParameteri(a,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE);i.texParameteri(a,
|
|
|
+i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);i.texParameteri(a,i.TEXTURE_MAG_FILTER,w(b.magFilter));i.texParameteri(a,i.TEXTURE_MIN_FILTER,w(b.minFilter))}}function s(a,b){i.bindRenderbuffer(i.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_COMPONENT16,b.width,b.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,b.width,b.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,
|
|
|
+i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,a)}else i.renderbufferStorage(i.RENDERBUFFER,i.RGBA4,b.width,b.height)}function w(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return i.NEAREST;default:return i.LINEAR}}function F(a){switch(a){case THREE.RepeatWrapping:return i.REPEAT;case THREE.ClampToEdgeWrapping:return i.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return i.MIRRORED_REPEAT;case THREE.NearestFilter:return i.NEAREST;case THREE.NearestMipMapNearestFilter:return i.NEAREST_MIPMAP_NEAREST;
|
|
|
case THREE.NearestMipMapLinearFilter:return i.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return i.LINEAR;case THREE.LinearMipMapNearestFilter:return i.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return i.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return i.BYTE;case THREE.UnsignedByteType:return i.UNSIGNED_BYTE;case THREE.ShortType:return i.SHORT;case THREE.UnsignedShortType:return i.UNSIGNED_SHORT;case THREE.IntType:return i.INT;case THREE.UnsignedIntType:return i.UNSIGNED_INT;case THREE.FloatType:return i.FLOAT;
|
|
|
case THREE.AlphaFormat:return i.ALPHA;case THREE.RGBFormat:return i.RGB;case THREE.RGBAFormat:return i.RGBA;case THREE.LuminanceFormat:return i.LUMINANCE;case THREE.LuminanceAlphaFormat:return i.LUMINANCE_ALPHA;case THREE.AddEquation:return i.FUNC_ADD;case THREE.SubtractEquation:return i.FUNC_SUBTRACT;case THREE.ReverseSubtractEquation:return i.FUNC_REVERSE_SUBTRACT;case THREE.ZeroFactor:return i.ZERO;case THREE.OneFactor:return i.ONE;case THREE.SrcColorFactor:return i.SRC_COLOR;case THREE.OneMinusSrcColorFactor:return i.ONE_MINUS_SRC_COLOR;
|
|
|
-case THREE.SrcAlphaFactor:return i.SRC_ALPHA;case THREE.OneMinusSrcAlphaFactor:return i.ONE_MINUS_SRC_ALPHA;case THREE.DstAlphaFactor:return i.DST_ALPHA;case THREE.OneMinusDstAlphaFactor:return i.ONE_MINUS_DST_ALPHA;case THREE.DstColorFactor:return i.DST_COLOR;case THREE.OneMinusDstColorFactor:return i.ONE_MINUS_DST_COLOR;case THREE.SrcAlphaSaturateFactor:return i.SRC_ALPHA_SATURATE}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},B=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
-w=a.precision!==void 0?a.precision:"highp",v=a.alpha!==void 0?a.alpha:true,C=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,K=a.antialias!==void 0?a.antialias:false,L=a.stencil!==void 0?a.stencil:true,T=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,P=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),J=a.clearAlpha!==void 0?a.clearAlpha:0,N=a.maxLights!==void 0?a.maxLights:4;this.domElement=B;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=
|
|
|
+case THREE.SrcAlphaFactor:return i.SRC_ALPHA;case THREE.OneMinusSrcAlphaFactor:return i.ONE_MINUS_SRC_ALPHA;case THREE.DstAlphaFactor:return i.DST_ALPHA;case THREE.OneMinusDstAlphaFactor:return i.ONE_MINUS_DST_ALPHA;case THREE.DstColorFactor:return i.DST_COLOR;case THREE.OneMinusDstColorFactor:return i.ONE_MINUS_DST_COLOR;case THREE.SrcAlphaSaturateFactor:return i.SRC_ALPHA_SATURATE}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},E=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
+z=a.precision!==void 0?a.precision:"highp",v=a.alpha!==void 0?a.alpha:true,C=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,J=a.antialias!==void 0?a.antialias:false,L=a.stencil!==void 0?a.stencil:true,W=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,P=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),B=a.clearAlpha!==void 0?a.clearAlpha:0,M=a.maxLights!==void 0?a.maxLights:4;this.domElement=E;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=
|
|
|
this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,
|
|
|
-vertices:0,faces:0,points:0}};var F=this,i,U=[],E=null,H=null,W=-1,G=null,ha=null,fa=0,la=null,R=null,$=null,ba=null,aa=null,ea=null,Na=null,wa=null,sa=null,Oa=null,Ha=null,xa=null,Wa=0,Ya=0,Ka=0,db=0,hb=0,mb=0,Pa=new THREE.Frustum,ta=new THREE.Matrix4,ua=new THREE.Matrix4,ab=new THREE.Vector4,pa=new THREE.Vector3,Ia={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};i=function(){var a;try{if(!(a=B.getContext("experimental-webgl",{alpha:v,
|
|
|
-premultipliedAlpha:C,antialias:K,stencil:L,preserveDrawingBuffer:T})))throw"Error creating WebGL context.";}catch(b){console.error(b)}return a}();i.clearColor(0,0,0,1);i.clearDepth(1);i.clearStencil(0);i.enable(i.DEPTH_TEST);i.depthFunc(i.LEQUAL);i.frontFace(i.CCW);i.cullFace(i.BACK);i.enable(i.CULL_FACE);i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA);i.clearColor(P.r,P.g,P.b,J);this.context=i;var Xa=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS);i.getParameter(i.MAX_TEXTURE_SIZE);
|
|
|
-var ja=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return i};this.supportsVertexTextures=function(){return Xa>0};this.setSize=function(a,b){B.width=a;B.height=b;this.setViewport(0,0,B.width,B.height)};this.setViewport=function(a,b,c,d){Wa=a;Ya=b;Ka=c;db=d;i.viewport(Wa,Ya,Ka,db)};this.setScissor=function(a,b,c,d){i.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?i.enable(i.SCISSOR_TEST):i.disable(i.SCISSOR_TEST)};this.setClearColorHex=function(a,b){P.setHex(a);J=
|
|
|
-b;i.clearColor(P.r,P.g,P.b,J)};this.setClearColor=function(a,b){P.copy(a);J=b;i.clearColor(P.r,P.g,P.b,J)};this.getClearColor=function(){return P};this.getClearAlpha=function(){return J};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|i.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|i.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|i.STENCIL_BUFFER_BIT;i.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)};
|
|
|
+vertices:0,faces:0,points:0}};var G=this,i,T=[],V=null,A=null,X=-1,H=null,da=null,ga=0,la=null,Q=null,S=null,ba=null,aa=null,fa=null,Na=null,wa=null,sa=null,Oa=null,Ha=null,xa=null,Wa=0,Ya=0,Ka=0,db=0,hb=0,mb=0,Pa=new THREE.Frustum,ta=new THREE.Matrix4,ua=new THREE.Matrix4,ab=new THREE.Vector4,pa=new THREE.Vector3,Ia={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};i=function(){var a;try{if(!(a=E.getContext("experimental-webgl",{alpha:v,
|
|
|
+premultipliedAlpha:C,antialias:J,stencil:L,preserveDrawingBuffer:W})))throw"Error creating WebGL context.";}catch(b){console.error(b)}return a}();i.clearColor(0,0,0,1);i.clearDepth(1);i.clearStencil(0);i.enable(i.DEPTH_TEST);i.depthFunc(i.LEQUAL);i.frontFace(i.CCW);i.cullFace(i.BACK);i.enable(i.CULL_FACE);i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA);i.clearColor(P.r,P.g,P.b,B);this.context=i;var Xa=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS);i.getParameter(i.MAX_TEXTURE_SIZE);
|
|
|
+var ja=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return i};this.supportsVertexTextures=function(){return Xa>0};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){Wa=a;Ya=b;Ka=c;db=d;i.viewport(Wa,Ya,Ka,db)};this.setScissor=function(a,b,c,d){i.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?i.enable(i.SCISSOR_TEST):i.disable(i.SCISSOR_TEST)};this.setClearColorHex=function(a,b){P.setHex(a);B=
|
|
|
+b;i.clearColor(P.r,P.g,P.b,B)};this.setClearColor=function(a,b){P.copy(a);B=b;i.clearColor(P.r,P.g,P.b,B)};this.getClearColor=function(){return P};this.getClearAlpha=function(){return B};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|i.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|i.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|i.STENCIL_BUFFER_BIT;i.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){a.__webglInit=false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];i.deleteBuffer(c.__webglVertexBuffer);i.deleteBuffer(c.__webglNormalBuffer);i.deleteBuffer(c.__webglTangentBuffer);i.deleteBuffer(c.__webglColorBuffer);
|
|
|
i.deleteBuffer(c.__webglUVBuffer);i.deleteBuffer(c.__webglUV2Buffer);i.deleteBuffer(c.__webglSkinVertexABuffer);i.deleteBuffer(c.__webglSkinVertexBBuffer);i.deleteBuffer(c.__webglSkinIndicesBuffer);i.deleteBuffer(c.__webglSkinWeightsBuffer);i.deleteBuffer(c.__webglFaceBuffer);i.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)i.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)i.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=
|
|
|
-void 0;for(d in c.__webglCustomAttributesList)i.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}F.info.memory.geometries--}else if(a instanceof THREE.Ribbon){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);
|
|
|
-i.deleteBuffer(a.__webglColorBuffer);F.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=false;i.deleteTexture(a.__webglTexture);F.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){i.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){i.deleteFramebuffer(a.__webglFramebuffer[b]);i.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{i.deleteFramebuffer(a.__webglFramebuffer);
|
|
|
-i.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.updateShadowMap=function(a,b){E=null;W=G=wa=Na=$=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=i.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=i.createBuffer();if(a.hasPos){i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,a.positionArray,i.DYNAMIC_DRAW);i.enableVertexAttribArray(b.attributes.position);i.vertexAttribPointer(b.attributes.position,
|
|
|
+void 0;for(d in c.__webglCustomAttributesList)i.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}G.info.memory.geometries--}else if(a instanceof THREE.Ribbon){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);G.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);i.deleteBuffer(a.__webglColorBuffer);G.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;i.deleteBuffer(a.__webglVertexBuffer);
|
|
|
+i.deleteBuffer(a.__webglColorBuffer);G.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=false;i.deleteTexture(a.__webglTexture);G.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){i.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){i.deleteFramebuffer(a.__webglFramebuffer[b]);i.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{i.deleteFramebuffer(a.__webglFramebuffer);
|
|
|
+i.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.updateShadowMap=function(a,b){V=null;X=H=wa=Na=S=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=i.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=i.createBuffer();if(a.hasPos){i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,a.positionArray,i.DYNAMIC_DRAW);i.enableVertexAttribArray(b.attributes.position);i.vertexAttribPointer(b.attributes.position,
|
|
|
3,i.FLOAT,false,0,0)}if(a.hasNormal){i.bindBuffer(i.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,j,k,l,n,m,p=a.count*3;for(m=0;m<p;m=m+9){c=a.normalArray;d=c[m];e=c[m+1];f=c[m+2];g=c[m+3];j=c[m+4];l=c[m+5];h=c[m+6];k=c[m+7];n=c[m+8];d=(d+g+h)/3;e=(e+j+k)/3;f=(f+l+n)/3;c[m]=d;c[m+1]=e;c[m+2]=f;c[m+3]=d;c[m+4]=e;c[m+5]=f;c[m+6]=d;c[m+7]=e;c[m+8]=f}}i.bufferData(i.ARRAY_BUFFER,a.normalArray,i.DYNAMIC_DRAW);i.enableVertexAttribArray(b.attributes.normal);i.vertexAttribPointer(b.attributes.normal,
|
|
|
-3,i.FLOAT,false,0,0)}i.drawArrays(i.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.opacity!==0){c=n(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==G){G=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;d=0;for(c=f.length;d<c;++d){if(b){i.bindBuffer(i.ARRAY_BUFFER,e.vertexPositionBuffer);i.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,i.FLOAT,false,0,f[d].index*12);if(a.normal>=0&&e.vertexNormalBuffer){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
+3,i.FLOAT,false,0,0)}i.drawArrays(i.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.opacity!==0){c=n(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==H){H=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;d=0;for(c=f.length;d<c;++d){if(b){i.bindBuffer(i.ARRAY_BUFFER,e.vertexPositionBuffer);i.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,i.FLOAT,false,0,f[d].index*12);if(a.normal>=0&&e.vertexNormalBuffer){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
e.vertexNormalBuffer);i.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,i.FLOAT,false,0,f[d].index*12)}if(a.uv>=0&&e.vertexUvBuffer)if(e.vertexUvBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.vertexUvBuffer);i.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,i.FLOAT,false,0,f[d].index*8);i.enableVertexAttribArray(a.uv)}else i.disableVertexAttribArray(a.uv);if(a.color>=0&&e.vertexColorBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.vertexColorBuffer);i.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,
|
|
|
-i.FLOAT,false,0,f[d].index*16)}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)}i.drawElements(i.TRIANGLES,f[d].count,i.UNSIGNED_SHORT,f[d].start*2);F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+f[d].count;F.info.render.faces=F.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=n(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==G){G=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
+i.FLOAT,false,0,f[d].index*16)}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)}i.drawElements(i.TRIANGLES,f[d].count,i.UNSIGNED_SHORT,f[d].start*2);G.info.render.calls++;G.info.render.vertices=G.info.render.vertices+f[d].count;G.info.render.faces=G.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=n(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==H){H=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
e.__webglVertexBuffer);i.vertexAttribPointer(b.position,3,i.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;if(f.morphTargetBase!==-1){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);i.vertexAttribPointer(c.position,3,i.FLOAT,false,0,0)}else if(c.position>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer);i.vertexAttribPointer(c.position,3,i.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){g=0;var j=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<
|
|
|
d.numSupportedMorphTargets&&g<j.length;){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[g]]);i.vertexAttribPointer(c["morphTarget"+g],3,i.FLOAT,false,0,0);if(d.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j[g]]);i.vertexAttribPointer(c["morphNormal"+g],3,i.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[g]=h[j[g]];g++}}else{var j=[],k=-1,l=0;h=f.morphTargetInfluences;var m,p=h.length;g=0;for(f.morphTargetBase!==-1&&(j[f.morphTargetBase]=true);g<d.numSupportedMorphTargets;){for(m=
|
|
|
0;m<p;m++)if(!j[m]&&h[m]>k){l=m;k=h[l]}i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);i.vertexAttribPointer(c["morphTarget"+g],3,i.FLOAT,false,0,0);if(d.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);i.vertexAttribPointer(c["morphNormal"+g],3,i.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[g]=k;j[l]=1;k=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&i.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=
|
|
|
0;for(h=e.__webglCustomAttributesList.length;g<h;g++){c=e.__webglCustomAttributesList[g];if(b[c.buffer.belongsToAttribute]>=0){i.bindBuffer(i.ARRAY_BUFFER,c.buffer);i.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,i.FLOAT,false,0,0)}}}if(b.color>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglColorBuffer);i.vertexAttribPointer(b.color,3,i.FLOAT,false,0,0)}if(b.normal>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglNormalBuffer);i.vertexAttribPointer(b.normal,3,i.FLOAT,false,0,0)}if(b.tangent>=0){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
e.__webglTangentBuffer);i.vertexAttribPointer(b.tangent,4,i.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.__webglUVBuffer);i.vertexAttribPointer(b.uv,2,i.FLOAT,false,0,0);i.enableVertexAttribArray(b.uv)}else i.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){i.bindBuffer(i.ARRAY_BUFFER,e.__webglUV2Buffer);i.vertexAttribPointer(b.uv2,2,i.FLOAT,false,0,0);i.enableVertexAttribArray(b.uv2)}else i.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=
|
|
|
0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinVertexABuffer);i.vertexAttribPointer(b.skinVertexA,4,i.FLOAT,false,0,0);i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);i.vertexAttribPointer(b.skinVertexB,4,i.FLOAT,false,0,0);i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);i.vertexAttribPointer(b.skinIndex,4,i.FLOAT,false,0,0);i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);i.vertexAttribPointer(b.skinWeight,4,i.FLOAT,false,0,0)}}if(f instanceof
|
|
|
-THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==xa){i.lineWidth(d);xa=d}a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);i.drawElements(i.LINES,e.__webglLineCount,i.UNSIGNED_SHORT,0)}else{a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);i.drawElements(i.TRIANGLES,e.__webglFaceCount,i.UNSIGNED_SHORT,0)}F.info.render.calls++;F.info.render.vertices=F.info.render.vertices+e.__webglFaceCount;F.info.render.faces=F.info.render.faces+e.__webglFaceCount/3}else if(f instanceof
|
|
|
-THREE.Line){f=f.type===THREE.LineStrip?i.LINE_STRIP:i.LINES;d=d.linewidth;if(d!==xa){i.lineWidth(d);xa=d}i.drawArrays(f,0,e.__webglLineCount);F.info.render.calls++}else if(f instanceof THREE.ParticleSystem){i.drawArrays(i.POINTS,0,e.__webglParticleCount);F.info.render.calls++;F.info.render.points=F.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){i.drawArrays(i.TRIANGLE_STRIP,0,e.__webglVertexCount);F.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,l,m,n=a.__lights,
|
|
|
-p=a.fog;W=-1;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);ta.multiply(b.projectionMatrix,b.matrixWorldInverse);
|
|
|
-Pa.setFromMatrix(ta);this.autoUpdateObjects&&this.initWebGLObjects(a);h(this.renderPluginsPre,a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;F.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];l=f.object;f.render=false;if(l.visible&&(!(l instanceof THREE.Mesh||l instanceof THREE.ParticleSystem)||!l.frustumCulled||Pa.contains(l))){q(l,
|
|
|
-b);var o=f,r=o.object,s=o.buffer,t=void 0,t=t=void 0,t=r.material;if(t instanceof THREE.MeshFaceMaterial){t=s.materialIndex;if(t>=0){t=r.geometry.materials[t];if(t.transparent){o.transparent=t;o.opaque=null}else{o.opaque=t;o.transparent=null}}}else if(t)if(t.transparent){o.transparent=t;o.opaque=null}else{o.opaque=t;o.transparent=null}f.render=true;if(this.sortObjects)if(l.renderDepth)f.z=l.renderDepth;else{ab.copy(l.matrixWorld.getPosition());ta.multiplyVector3(ab);f.z=ab.z}}}this.sortObjects&&m.sort(g);
|
|
|
-m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];l=f.object;if(l.visible){q(l,b);l=f.object.material;if(l.transparent){f.transparent=l;f.opaque=null}else{f.opaque=l;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,n,p,true,d);k(a.__webglObjectsImmediate,
|
|
|
-"",b,n,p,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,n,p,false);k(a.__webglObjectsImmediate,"opaque",b,n,p,false);j(a.__webglObjects,false,"transparent",b,n,p,true);k(a.__webglObjectsImmediate,"transparent",b,n,p,true)}h(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){i.bindTexture(i.TEXTURE_CUBE_MAP,c.__webglTexture);i.generateMipmap(i.TEXTURE_CUBE_MAP);
|
|
|
-i.bindTexture(i.TEXTURE_CUBE_MAP,null)}else{i.bindTexture(i.TEXTURE_2D,c.__webglTexture);i.generateMipmap(i.TEXTURE_2D);i.bindTexture(i.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=n(a,b,c,d,e);G=-1;F.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,i,Pa):e.render(function(a){F.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,j=void 0,k=void 0,n=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){k=g.geometry;if(k instanceof THREE.Geometry){if(k.geometryGroups===void 0){var q=k,s=void 0,u=void 0,t=void 0,H=void 0,w=void 0,G=void 0,v=void 0,x={},y=q.morphTargets.length,W=q.morphNormals.length;q.geometryGroups={};s=0;for(u=q.faces.length;s<
|
|
|
-u;s++){t=q.faces[s];H=t.materialIndex;G=H!==void 0?H:-1;x[G]===void 0&&(x[G]={hash:G,counter:0});v=x[G].hash+"_"+x[G].counter;q.geometryGroups[v]===void 0&&(q.geometryGroups[v]={faces3:[],faces4:[],materialIndex:H,vertices:0,numMorphTargets:y,numMorphNormals:W});w=t instanceof THREE.Face3?3:4;if(q.geometryGroups[v].vertices+w>65535){x[G].counter=x[G].counter+1;v=x[G].hash+"_"+x[G].counter;q.geometryGroups[v]===void 0&&(q.geometryGroups[v]={faces3:[],faces4:[],materialIndex:H,vertices:0,numMorphTargets:y,
|
|
|
-numMorphNormals:W})}t instanceof THREE.Face3?q.geometryGroups[v].faces3.push(s):q.geometryGroups[v].faces4.push(s);q.geometryGroups[v].vertices=q.geometryGroups[v].vertices+w}q.geometryGroupsList=[];var D=void 0;for(D in q.geometryGroups){q.geometryGroups[D].id=fa++;q.geometryGroupsList.push(q.geometryGroups[D])}}for(j in k.geometryGroups){n=k.geometryGroups[j];if(!n.__webglVertexBuffer){var B=n;B.__webglVertexBuffer=i.createBuffer();B.__webglNormalBuffer=i.createBuffer();B.__webglTangentBuffer=i.createBuffer();
|
|
|
-B.__webglColorBuffer=i.createBuffer();B.__webglUVBuffer=i.createBuffer();B.__webglUV2Buffer=i.createBuffer();B.__webglSkinVertexABuffer=i.createBuffer();B.__webglSkinVertexBBuffer=i.createBuffer();B.__webglSkinIndicesBuffer=i.createBuffer();B.__webglSkinWeightsBuffer=i.createBuffer();B.__webglFaceBuffer=i.createBuffer();B.__webglLineBuffer=i.createBuffer();var E=void 0,$=void 0;if(B.numMorphTargets){B.__webglMorphTargetsBuffers=[];E=0;for($=B.numMorphTargets;E<$;E++)B.__webglMorphTargetsBuffers.push(i.createBuffer())}if(B.numMorphNormals){B.__webglMorphNormalsBuffers=
|
|
|
-[];E=0;for($=B.numMorphNormals;E<$;E++)B.__webglMorphNormalsBuffers.push(i.createBuffer())}F.info.memory.geometries++;var C=n,J=g,R=J.geometry,ha=C.faces3,L=C.faces4,K=ha.length*3+L.length*4,P=ha.length*1+L.length*2,N=ha.length*3+L.length*4,aa=c(J,C),ba=e(aa),la=d(aa),ea=aa.vertexColors?aa.vertexColors:false;C.__vertexArray=new Float32Array(K*3);if(la)C.__normalArray=new Float32Array(K*3);if(R.hasTangents)C.__tangentArray=new Float32Array(K*4);if(ea)C.__colorArray=new Float32Array(K*3);if(ba){if(R.faceUvs.length>
|
|
|
-0||R.faceVertexUvs.length>0)C.__uvArray=new Float32Array(K*2);if(R.faceUvs.length>1||R.faceVertexUvs.length>1)C.__uv2Array=new Float32Array(K*2)}if(J.geometry.skinWeights.length&&J.geometry.skinIndices.length){C.__skinVertexAArray=new Float32Array(K*4);C.__skinVertexBArray=new Float32Array(K*4);C.__skinIndexArray=new Float32Array(K*4);C.__skinWeightArray=new Float32Array(K*4)}C.__faceArray=new Uint16Array(P*3);C.__lineArray=new Uint16Array(N*2);var T=void 0,U=void 0;if(C.numMorphTargets){C.__morphTargetsArrays=
|
|
|
-[];T=0;for(U=C.numMorphTargets;T<U;T++)C.__morphTargetsArrays.push(new Float32Array(K*3))}if(C.numMorphNormals){C.__morphNormalsArrays=[];T=0;for(U=C.numMorphNormals;T<U;T++)C.__morphNormalsArrays.push(new Float32Array(K*3))}C.__webglFaceCount=P*3;C.__webglLineCount=N*2;if(aa.attributes){if(C.__webglCustomAttributesList===void 0)C.__webglCustomAttributesList=[];var Na=void 0;for(Na in aa.attributes){var wa=aa.attributes[Na],sa={},Oa;for(Oa in wa)sa[Oa]=wa[Oa];if(!sa.__webglInitialized||sa.createUniqueBuffers){sa.__webglInitialized=
|
|
|
-true;var Ha=1;sa.type==="v2"?Ha=2:sa.type==="v3"?Ha=3:sa.type==="v4"?Ha=4:sa.type==="c"&&(Ha=3);sa.size=Ha;sa.array=new Float32Array(K*Ha);sa.buffer=i.createBuffer();sa.buffer.belongsToAttribute=Na;wa.needsUpdate=true;sa.__original=wa}C.__webglCustomAttributesList.push(sa)}}C.__inittedArrays=true;k.__dirtyVertices=true;k.__dirtyMorphTargets=true;k.__dirtyElements=true;k.__dirtyUvs=true;k.__dirtyNormals=true;k.__dirtyTangents=true;k.__dirtyColors=true}}}}else if(g instanceof THREE.Ribbon){k=g.geometry;
|
|
|
-if(!k.__webglVertexBuffer){var xa=k;xa.__webglVertexBuffer=i.createBuffer();xa.__webglColorBuffer=i.createBuffer();F.info.memory.geometries++;var ja=k,pa=ja.vertices.length;ja.__vertexArray=new Float32Array(pa*3);ja.__colorArray=new Float32Array(pa*3);ja.__webglVertexCount=pa;k.__dirtyVertices=true;k.__dirtyColors=true}}else if(g instanceof THREE.Line){k=g.geometry;if(!k.__webglVertexBuffer){var ua=k;ua.__webglVertexBuffer=i.createBuffer();ua.__webglColorBuffer=i.createBuffer();F.info.memory.geometries++;
|
|
|
-var ta=k,Ia=g,Wa=ta.vertices.length;ta.__vertexArray=new Float32Array(Wa*3);ta.__colorArray=new Float32Array(Wa*3);ta.__webglLineCount=Wa;b(ta,Ia);k.__dirtyVertices=true;k.__dirtyColors=true}}else if(g instanceof THREE.ParticleSystem){k=g.geometry;if(!k.__webglVertexBuffer){var Ya=k;Ya.__webglVertexBuffer=i.createBuffer();Ya.__webglColorBuffer=i.createBuffer();F.info.geometries++;var Pa=k,ab=g,Xa=Pa.vertices.length;Pa.__vertexArray=new Float32Array(Xa*3);Pa.__colorArray=new Float32Array(Xa*3);Pa.__sortArray=
|
|
|
-[];Pa.__webglParticleCount=Xa;b(Pa,ab);k.__dirtyVertices=true;k.__dirtyColors=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){k=g.geometry;if(k instanceof THREE.BufferGeometry)l(h.__webglObjects,k,g);else for(j in k.geometryGroups){n=k.geometryGroups[j];l(h.__webglObjects,n,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){k=g.geometry;l(h.__webglObjects,k,g)}else g instanceof THREE.ImmediateRenderObject||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=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Ka=a.__objectsRemoved[0],db=a;Ka instanceof THREE.Mesh||Ka instanceof THREE.ParticleSystem||Ka instanceof THREE.Ribbon||Ka instanceof THREE.Line?o(db.__webglObjects,Ka):Ka instanceof THREE.Sprite?r(db.__webglSprites,Ka):Ka instanceof THREE.LensFlare?r(db.__webglFlares,Ka):(Ka instanceof
|
|
|
+THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==xa){i.lineWidth(d);xa=d}a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);i.drawElements(i.LINES,e.__webglLineCount,i.UNSIGNED_SHORT,0)}else{a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);i.drawElements(i.TRIANGLES,e.__webglFaceCount,i.UNSIGNED_SHORT,0)}G.info.render.calls++;G.info.render.vertices=G.info.render.vertices+e.__webglFaceCount;G.info.render.faces=G.info.render.faces+e.__webglFaceCount/3}else if(f instanceof
|
|
|
+THREE.Line){f=f.type===THREE.LineStrip?i.LINE_STRIP:i.LINES;d=d.linewidth;if(d!==xa){i.lineWidth(d);xa=d}i.drawArrays(f,0,e.__webglLineCount);G.info.render.calls++}else if(f instanceof THREE.ParticleSystem){i.drawArrays(i.POINTS,0,e.__webglParticleCount);G.info.render.calls++;G.info.render.points=G.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){i.drawArrays(i.TRIANGLE_STRIP,0,e.__webglVertexCount);G.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,k,m,n=a.__lights,
|
|
|
+p=a.fog;X=-1;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);ta.multiply(b.projectionMatrix,b.matrixWorldInverse);
|
|
|
+Pa.setFromMatrix(ta);this.autoUpdateObjects&&this.initWebGLObjects(a);h(this.renderPluginsPre,a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;G.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];k=f.object;f.render=false;if(k.visible&&(!(k instanceof THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||Pa.contains(k))){r(k,
|
|
|
+b);var o=f,q=o.object,s=o.buffer,t=void 0,t=t=void 0,t=q.material;if(t instanceof THREE.MeshFaceMaterial){t=s.materialIndex;if(t>=0){t=q.geometry.materials[t];if(t.transparent){o.transparent=t;o.opaque=null}else{o.opaque=t;o.transparent=null}}}else if(t)if(t.transparent){o.transparent=t;o.opaque=null}else{o.opaque=t;o.transparent=null}f.render=true;if(this.sortObjects)if(k.renderDepth)f.z=k.renderDepth;else{ab.copy(k.matrixWorld.getPosition());ta.multiplyVector3(ab);f.z=ab.z}}}this.sortObjects&&m.sort(g);
|
|
|
+m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];k=f.object;if(k.visible){r(k,b);k=f.object.material;if(k.transparent){f.transparent=k;f.opaque=null}else{f.opaque=k;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,n,p,true,d);l(a.__webglObjectsImmediate,
|
|
|
+"",b,n,p,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,n,p,false);l(a.__webglObjectsImmediate,"opaque",b,n,p,false);j(a.__webglObjects,false,"transparent",b,n,p,true);l(a.__webglObjectsImmediate,"transparent",b,n,p,true)}h(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){i.bindTexture(i.TEXTURE_CUBE_MAP,c.__webglTexture);i.generateMipmap(i.TEXTURE_CUBE_MAP);
|
|
|
+i.bindTexture(i.TEXTURE_CUBE_MAP,null)}else{i.bindTexture(i.TEXTURE_2D,c.__webglTexture);i.generateMipmap(i.TEXTURE_2D);i.bindTexture(i.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=n(a,b,c,d,e);H=-1;G.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,i,Pa):e.render(function(a){G.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,j=void 0,l=void 0,n=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){l=g.geometry;if(l instanceof THREE.Geometry){if(l.geometryGroups===void 0){var r=l,s=void 0,t=void 0,u=void 0,A=void 0,H=void 0,v=void 0,w=void 0,x={},z=r.morphTargets.length,X=r.morphNormals.length;r.geometryGroups={};s=0;for(t=r.faces.length;s<
|
|
|
+t;s++){u=r.faces[s];A=u.materialIndex;v=A!==void 0?A:-1;x[v]===void 0&&(x[v]={hash:v,counter:0});w=x[v].hash+"_"+x[v].counter;r.geometryGroups[w]===void 0&&(r.geometryGroups[w]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:z,numMorphNormals:X});H=u instanceof THREE.Face3?3:4;if(r.geometryGroups[w].vertices+H>65535){x[v].counter=x[v].counter+1;w=x[v].hash+"_"+x[v].counter;r.geometryGroups[w]===void 0&&(r.geometryGroups[w]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:z,
|
|
|
+numMorphNormals:X})}u instanceof THREE.Face3?r.geometryGroups[w].faces3.push(s):r.geometryGroups[w].faces4.push(s);r.geometryGroups[w].vertices=r.geometryGroups[w].vertices+H}r.geometryGroupsList=[];var C=void 0;for(C in r.geometryGroups){r.geometryGroups[C].id=ga++;r.geometryGroupsList.push(r.geometryGroups[C])}}for(j in l.geometryGroups){n=l.geometryGroups[j];if(!n.__webglVertexBuffer){var B=n;B.__webglVertexBuffer=i.createBuffer();B.__webglNormalBuffer=i.createBuffer();B.__webglTangentBuffer=i.createBuffer();
|
|
|
+B.__webglColorBuffer=i.createBuffer();B.__webglUVBuffer=i.createBuffer();B.__webglUV2Buffer=i.createBuffer();B.__webglSkinVertexABuffer=i.createBuffer();B.__webglSkinVertexBBuffer=i.createBuffer();B.__webglSkinIndicesBuffer=i.createBuffer();B.__webglSkinWeightsBuffer=i.createBuffer();B.__webglFaceBuffer=i.createBuffer();B.__webglLineBuffer=i.createBuffer();var E=void 0,F=void 0;if(B.numMorphTargets){B.__webglMorphTargetsBuffers=[];E=0;for(F=B.numMorphTargets;E<F;E++)B.__webglMorphTargetsBuffers.push(i.createBuffer())}if(B.numMorphNormals){B.__webglMorphNormalsBuffers=
|
|
|
+[];E=0;for(F=B.numMorphNormals;E<F;E++)B.__webglMorphNormalsBuffers.push(i.createBuffer())}G.info.memory.geometries++;var S=n,da=g,J=da.geometry,Q=S.faces3,L=S.faces4,aa=Q.length*3+L.length*4,M=Q.length*1+L.length*2,ba=Q.length*3+L.length*4,P=c(da,S),la=e(P),fa=d(P),W=P.vertexColors?P.vertexColors:false;S.__vertexArray=new Float32Array(aa*3);if(fa)S.__normalArray=new Float32Array(aa*3);if(J.hasTangents)S.__tangentArray=new Float32Array(aa*4);if(W)S.__colorArray=new Float32Array(aa*3);if(la){if(J.faceUvs.length>
|
|
|
+0||J.faceVertexUvs.length>0)S.__uvArray=new Float32Array(aa*2);if(J.faceUvs.length>1||J.faceVertexUvs.length>1)S.__uv2Array=new Float32Array(aa*2)}if(da.geometry.skinWeights.length&&da.geometry.skinIndices.length){S.__skinVertexAArray=new Float32Array(aa*4);S.__skinVertexBArray=new Float32Array(aa*4);S.__skinIndexArray=new Float32Array(aa*4);S.__skinWeightArray=new Float32Array(aa*4)}S.__faceArray=new Uint16Array(M*3);S.__lineArray=new Uint16Array(ba*2);var T=void 0,V=void 0;if(S.numMorphTargets){S.__morphTargetsArrays=
|
|
|
+[];T=0;for(V=S.numMorphTargets;T<V;T++)S.__morphTargetsArrays.push(new Float32Array(aa*3))}if(S.numMorphNormals){S.__morphNormalsArrays=[];T=0;for(V=S.numMorphNormals;T<V;T++)S.__morphNormalsArrays.push(new Float32Array(aa*3))}S.__webglFaceCount=M*3;S.__webglLineCount=ba*2;if(P.attributes){if(S.__webglCustomAttributesList===void 0)S.__webglCustomAttributesList=[];var Na=void 0;for(Na in P.attributes){var wa=P.attributes[Na],sa={},Oa;for(Oa in wa)sa[Oa]=wa[Oa];if(!sa.__webglInitialized||sa.createUniqueBuffers){sa.__webglInitialized=
|
|
|
+true;var Ha=1;sa.type==="v2"?Ha=2:sa.type==="v3"?Ha=3:sa.type==="v4"?Ha=4:sa.type==="c"&&(Ha=3);sa.size=Ha;sa.array=new Float32Array(aa*Ha);sa.buffer=i.createBuffer();sa.buffer.belongsToAttribute=Na;wa.needsUpdate=true;sa.__original=wa}S.__webglCustomAttributesList.push(sa)}}S.__inittedArrays=true;l.__dirtyVertices=true;l.__dirtyMorphTargets=true;l.__dirtyElements=true;l.__dirtyUvs=true;l.__dirtyNormals=true;l.__dirtyTangents=true;l.__dirtyColors=true}}}}else if(g instanceof THREE.Ribbon){l=g.geometry;
|
|
|
+if(!l.__webglVertexBuffer){var xa=l;xa.__webglVertexBuffer=i.createBuffer();xa.__webglColorBuffer=i.createBuffer();G.info.memory.geometries++;var ja=l,pa=ja.vertices.length;ja.__vertexArray=new Float32Array(pa*3);ja.__colorArray=new Float32Array(pa*3);ja.__webglVertexCount=pa;l.__dirtyVertices=true;l.__dirtyColors=true}}else if(g instanceof THREE.Line){l=g.geometry;if(!l.__webglVertexBuffer){var ua=l;ua.__webglVertexBuffer=i.createBuffer();ua.__webglColorBuffer=i.createBuffer();G.info.memory.geometries++;
|
|
|
+var ta=l,Ia=g,Wa=ta.vertices.length;ta.__vertexArray=new Float32Array(Wa*3);ta.__colorArray=new Float32Array(Wa*3);ta.__webglLineCount=Wa;b(ta,Ia);l.__dirtyVertices=true;l.__dirtyColors=true}}else if(g instanceof THREE.ParticleSystem){l=g.geometry;if(!l.__webglVertexBuffer){var Ya=l;Ya.__webglVertexBuffer=i.createBuffer();Ya.__webglColorBuffer=i.createBuffer();G.info.geometries++;var Pa=l,ab=g,Xa=Pa.vertices.length;Pa.__vertexArray=new Float32Array(Xa*3);Pa.__colorArray=new Float32Array(Xa*3);Pa.__sortArray=
|
|
|
+[];Pa.__webglParticleCount=Xa;b(Pa,ab);l.__dirtyVertices=true;l.__dirtyColors=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){l=g.geometry;if(l instanceof THREE.BufferGeometry)k(h.__webglObjects,l,g);else for(j in l.geometryGroups){n=l.geometryGroups[j];k(h.__webglObjects,n,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){l=g.geometry;k(h.__webglObjects,l,g)}else g instanceof THREE.ImmediateRenderObject||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=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Ka=a.__objectsRemoved[0],db=a;Ka instanceof THREE.Mesh||Ka instanceof THREE.ParticleSystem||Ka instanceof THREE.Ribbon||Ka instanceof THREE.Line?o(db.__webglObjects,Ka):Ka instanceof THREE.Sprite?q(db.__webglSprites,Ka):Ka instanceof THREE.LensFlare?q(db.__webglFlares,Ka):(Ka instanceof
|
|
|
THREE.ImmediateRenderObject||Ka.immediateRenderCallback)&&o(db.__webglObjectsImmediate,Ka);Ka.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var hb=0,mb=a.__webglObjects.length;hb<mb;hb++){var nb=a.__webglObjects[hb].object,ka=nb.geometry,qc=void 0,ic=void 0,bb=void 0;if(nb instanceof THREE.Mesh)if(ka instanceof THREE.BufferGeometry){ka.__dirtyVertices=false;ka.__dirtyElements=false;ka.__dirtyUvs=false;ka.__dirtyNormals=false;ka.__dirtyColors=false}else{for(var Uc=0,od=ka.geometryGroupsList.length;Uc<
|
|
|
-od;Uc++){qc=ka.geometryGroupsList[Uc];bb=c(nb,qc);ic=bb.attributes&&p(bb);if(ka.__dirtyVertices||ka.__dirtyMorphTargets||ka.__dirtyElements||ka.__dirtyUvs||ka.__dirtyNormals||ka.__dirtyColors||ka.__dirtyTangents||ic){var ga=qc,pd=nb,eb=i.DYNAMIC_DRAW,qd=!ka.dynamic,bc=bb;if(ga.__inittedArrays){var dd=d(bc),Vc=bc.vertexColors?bc.vertexColors:false,ed=e(bc),Fc=dd===THREE.SmoothShading,I=void 0,V=void 0,lb=void 0,O=void 0,jc=void 0,Ob=void 0,ob=void 0,Gc=void 0,Hb=void 0,kc=void 0,lc=void 0,X=void 0,
|
|
|
-Y=void 0,Z=void 0,qa=void 0,pb=void 0,qb=void 0,rb=void 0,rc=void 0,sb=void 0,tb=void 0,ub=void 0,sc=void 0,vb=void 0,wb=void 0,xb=void 0,tc=void 0,yb=void 0,zb=void 0,Ab=void 0,uc=void 0,Bb=void 0,Cb=void 0,Db=void 0,vc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Hc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Ic=void 0,ma=void 0,fd=void 0,Vb=void 0,mc=void 0,nc=void 0,Qa=void 0,gd=void 0,La=void 0,Ma=void 0,Wb=void 0,Ib=void 0,Ea=0,Ja=0,Jb=0,Kb=0,ib=0,Va=0,ra=0,Za=0,Fa=0,M=0,da=0,A=0,fb=void 0,Ra=ga.__vertexArray,
|
|
|
-wc=ga.__uvArray,xc=ga.__uv2Array,jb=ga.__normalArray,ya=ga.__tangentArray,Sa=ga.__colorArray,za=ga.__skinVertexAArray,Aa=ga.__skinVertexBArray,Ba=ga.__skinIndexArray,Ca=ga.__skinWeightArray,Wc=ga.__morphTargetsArrays,Xc=ga.__morphNormalsArrays,Yc=ga.__webglCustomAttributesList,z=void 0,Eb=ga.__faceArray,gb=ga.__lineArray,$a=pd.geometry,rd=$a.__dirtyElements,hd=$a.__dirtyUvs,sd=$a.__dirtyNormals,td=$a.__dirtyTangents,ud=$a.__dirtyColors,vd=$a.__dirtyMorphTargets,cc=$a.vertices,na=ga.faces3,oa=ga.faces4,
|
|
|
-Ga=$a.faces,Zc=$a.faceVertexUvs[0],$c=$a.faceVertexUvs[1],dc=$a.skinVerticesA,ec=$a.skinVerticesB,fc=$a.skinIndices,Xb=$a.skinWeights,Yb=$a.morphTargets,Jc=$a.morphNormals;if($a.__dirtyVertices){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=cc[O.a];Y=cc[O.b];Z=cc[O.c];Ra[Ja]=X.x;Ra[Ja+1]=X.y;Ra[Ja+2]=X.z;Ra[Ja+3]=Y.x;Ra[Ja+4]=Y.y;Ra[Ja+5]=Y.z;Ra[Ja+6]=Z.x;Ra[Ja+7]=Z.y;Ra[Ja+8]=Z.z;Ja=Ja+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=cc[O.a];Y=cc[O.b];Z=cc[O.c];qa=cc[O.d];Ra[Ja]=X.x;Ra[Ja+1]=X.y;Ra[Ja+
|
|
|
-2]=X.z;Ra[Ja+3]=Y.x;Ra[Ja+4]=Y.y;Ra[Ja+5]=Y.z;Ra[Ja+6]=Z.x;Ra[Ja+7]=Z.y;Ra[Ja+8]=Z.z;Ra[Ja+9]=qa.x;Ra[Ja+10]=qa.y;Ra[Ja+11]=qa.z;Ja=Ja+12}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Ra,eb)}if(vd){Qa=0;for(gd=Yb.length;Qa<gd;Qa++){I=da=0;for(V=na.length;I<V;I++){Wb=na[I];O=Ga[Wb];X=Yb[Qa].vertices[O.a];Y=Yb[Qa].vertices[O.b];Z=Yb[Qa].vertices[O.c];La=Wc[Qa];La[da]=X.x;La[da+1]=X.y;La[da+2]=X.z;La[da+3]=Y.x;La[da+4]=Y.y;La[da+5]=Y.z;La[da+6]=Z.x;La[da+7]=Z.y;La[da+
|
|
|
-8]=Z.z;if(bc.morphNormals){if(Fc){Ib=Jc[Qa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c}else ub=tb=sb=Jc[Qa].faceNormals[Wb];Ma=Xc[Qa];Ma[da]=sb.x;Ma[da+1]=sb.y;Ma[da+2]=sb.z;Ma[da+3]=tb.x;Ma[da+4]=tb.y;Ma[da+5]=tb.z;Ma[da+6]=ub.x;Ma[da+7]=ub.y;Ma[da+8]=ub.z}da=da+9}I=0;for(V=oa.length;I<V;I++){Wb=oa[I];O=Ga[Wb];X=Yb[Qa].vertices[O.a];Y=Yb[Qa].vertices[O.b];Z=Yb[Qa].vertices[O.c];qa=Yb[Qa].vertices[O.d];La=Wc[Qa];La[da]=X.x;La[da+1]=X.y;La[da+2]=X.z;La[da+3]=Y.x;La[da+4]=Y.y;La[da+5]=Y.z;La[da+6]=Z.x;
|
|
|
-La[da+7]=Z.y;La[da+8]=Z.z;La[da+9]=qa.x;La[da+10]=qa.y;La[da+11]=qa.z;if(bc.morphNormals){if(Fc){Ib=Jc[Qa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c;sc=Ib.d}else sc=ub=tb=sb=Jc[Qa].faceNormals[Wb];Ma=Xc[Qa];Ma[da]=sb.x;Ma[da+1]=sb.y;Ma[da+2]=sb.z;Ma[da+3]=tb.x;Ma[da+4]=tb.y;Ma[da+5]=tb.z;Ma[da+6]=ub.x;Ma[da+7]=ub.y;Ma[da+8]=ub.z;Ma[da+9]=sc.x;Ma[da+10]=sc.y;Ma[da+11]=sc.z}da=da+12}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglMorphTargetsBuffers[Qa]);i.bufferData(i.ARRAY_BUFFER,Wc[Qa],eb);if(bc.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
-ga.__webglMorphNormalsBuffers[Qa]);i.bufferData(i.ARRAY_BUFFER,Xc[Qa],eb)}}}if(Xb.length){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];yb=Xb[O.a];zb=Xb[O.b];Ab=Xb[O.c];Ca[M]=yb.x;Ca[M+1]=yb.y;Ca[M+2]=yb.z;Ca[M+3]=yb.w;Ca[M+4]=zb.x;Ca[M+5]=zb.y;Ca[M+6]=zb.z;Ca[M+7]=zb.w;Ca[M+8]=Ab.x;Ca[M+9]=Ab.y;Ca[M+10]=Ab.z;Ca[M+11]=Ab.w;Bb=fc[O.a];Cb=fc[O.b];Db=fc[O.c];Ba[M]=Bb.x;Ba[M+1]=Bb.y;Ba[M+2]=Bb.z;Ba[M+3]=Bb.w;Ba[M+4]=Cb.x;Ba[M+5]=Cb.y;Ba[M+6]=Cb.z;Ba[M+7]=Cb.w;Ba[M+8]=Db.x;Ba[M+9]=Db.y;Ba[M+10]=Db.z;Ba[M+11]=
|
|
|
-Db.w;Pb=dc[O.a];Qb=dc[O.b];Rb=dc[O.c];za[M]=Pb.x;za[M+1]=Pb.y;za[M+2]=Pb.z;za[M+3]=1;za[M+4]=Qb.x;za[M+5]=Qb.y;za[M+6]=Qb.z;za[M+7]=1;za[M+8]=Rb.x;za[M+9]=Rb.y;za[M+10]=Rb.z;za[M+11]=1;Sb=ec[O.a];Tb=ec[O.b];Ub=ec[O.c];Aa[M]=Sb.x;Aa[M+1]=Sb.y;Aa[M+2]=Sb.z;Aa[M+3]=1;Aa[M+4]=Tb.x;Aa[M+5]=Tb.y;Aa[M+6]=Tb.z;Aa[M+7]=1;Aa[M+8]=Ub.x;Aa[M+9]=Ub.y;Aa[M+10]=Ub.z;Aa[M+11]=1;M=M+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];yb=Xb[O.a];zb=Xb[O.b];Ab=Xb[O.c];uc=Xb[O.d];Ca[M]=yb.x;Ca[M+1]=yb.y;Ca[M+2]=yb.z;Ca[M+3]=
|
|
|
-yb.w;Ca[M+4]=zb.x;Ca[M+5]=zb.y;Ca[M+6]=zb.z;Ca[M+7]=zb.w;Ca[M+8]=Ab.x;Ca[M+9]=Ab.y;Ca[M+10]=Ab.z;Ca[M+11]=Ab.w;Ca[M+12]=uc.x;Ca[M+13]=uc.y;Ca[M+14]=uc.z;Ca[M+15]=uc.w;Bb=fc[O.a];Cb=fc[O.b];Db=fc[O.c];vc=fc[O.d];Ba[M]=Bb.x;Ba[M+1]=Bb.y;Ba[M+2]=Bb.z;Ba[M+3]=Bb.w;Ba[M+4]=Cb.x;Ba[M+5]=Cb.y;Ba[M+6]=Cb.z;Ba[M+7]=Cb.w;Ba[M+8]=Db.x;Ba[M+9]=Db.y;Ba[M+10]=Db.z;Ba[M+11]=Db.w;Ba[M+12]=vc.x;Ba[M+13]=vc.y;Ba[M+14]=vc.z;Ba[M+15]=vc.w;Pb=dc[O.a];Qb=dc[O.b];Rb=dc[O.c];Hc=dc[O.d];za[M]=Pb.x;za[M+1]=Pb.y;za[M+2]=Pb.z;
|
|
|
-za[M+3]=1;za[M+4]=Qb.x;za[M+5]=Qb.y;za[M+6]=Qb.z;za[M+7]=1;za[M+8]=Rb.x;za[M+9]=Rb.y;za[M+10]=Rb.z;za[M+11]=1;za[M+12]=Hc.x;za[M+13]=Hc.y;za[M+14]=Hc.z;za[M+15]=1;Sb=ec[O.a];Tb=ec[O.b];Ub=ec[O.c];Ic=ec[O.d];Aa[M]=Sb.x;Aa[M+1]=Sb.y;Aa[M+2]=Sb.z;Aa[M+3]=1;Aa[M+4]=Tb.x;Aa[M+5]=Tb.y;Aa[M+6]=Tb.z;Aa[M+7]=1;Aa[M+8]=Ub.x;Aa[M+9]=Ub.y;Aa[M+10]=Ub.z;Aa[M+11]=1;Aa[M+12]=Ic.x;Aa[M+13]=Ic.y;Aa[M+14]=Ic.z;Aa[M+15]=1;M=M+16}if(M>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinVertexABuffer);i.bufferData(i.ARRAY_BUFFER,
|
|
|
-za,eb);i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinVertexBBuffer);i.bufferData(i.ARRAY_BUFFER,Aa,eb);i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinIndicesBuffer);i.bufferData(i.ARRAY_BUFFER,Ba,eb);i.bindBuffer(i.ARRAY_BUFFER,ga.__webglSkinWeightsBuffer);i.bufferData(i.ARRAY_BUFFER,Ca,eb)}}if(ud&&Vc){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];ob=O.vertexColors;Gc=O.color;if(ob.length===3&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2]}else xb=wb=vb=Gc;Sa[Fa]=vb.r;Sa[Fa+1]=vb.g;Sa[Fa+2]=vb.b;Sa[Fa+3]=
|
|
|
-wb.r;Sa[Fa+4]=wb.g;Sa[Fa+5]=wb.b;Sa[Fa+6]=xb.r;Sa[Fa+7]=xb.g;Sa[Fa+8]=xb.b;Fa=Fa+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];ob=O.vertexColors;Gc=O.color;if(ob.length===4&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2];tc=ob[3]}else tc=xb=wb=vb=Gc;Sa[Fa]=vb.r;Sa[Fa+1]=vb.g;Sa[Fa+2]=vb.b;Sa[Fa+3]=wb.r;Sa[Fa+4]=wb.g;Sa[Fa+5]=wb.b;Sa[Fa+6]=xb.r;Sa[Fa+7]=xb.g;Sa[Fa+8]=xb.b;Sa[Fa+9]=tc.r;Sa[Fa+10]=tc.g;Sa[Fa+11]=tc.b;Fa=Fa+12}if(Fa>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,
|
|
|
-Sa,eb)}}if(td&&$a.hasTangents){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];Hb=O.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ra=ra+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];Hb=O.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];rc=Hb[3];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;
|
|
|
-ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ya[ra+12]=rc.x;ya[ra+13]=rc.y;ya[ra+14]=rc.z;ya[ra+15]=rc.w;ra=ra+16}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglTangentBuffer);i.bufferData(i.ARRAY_BUFFER,ya,eb)}if(sd&&dd){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];jc=O.vertexNormals;Ob=O.normal;if(jc.length===3&&Fc)for(ma=0;ma<3;ma++){Vb=jc[ma];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(ma=0;ma<3;ma++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}I=0;for(V=oa.length;I<V;I++){O=
|
|
|
-Ga[oa[I]];jc=O.vertexNormals;Ob=O.normal;if(jc.length===4&&Fc)for(ma=0;ma<4;ma++){Vb=jc[ma];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(ma=0;ma<4;ma++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}i.bindBuffer(i.ARRAY_BUFFER,ga.__webglNormalBuffer);i.bufferData(i.ARRAY_BUFFER,jb,eb)}if(hd&&Zc&&ed){I=0;for(V=na.length;I<V;I++){lb=na[I];O=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(ma=0;ma<3;ma++){mc=kc[ma];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}I=0;for(V=oa.length;I<V;I++){lb=oa[I];O=Ga[lb];kc=
|
|
|
-Zc[lb];if(kc!==void 0)for(ma=0;ma<4;ma++){mc=kc[ma];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}if(Jb>0){i.bindBuffer(i.ARRAY_BUFFER,ga.__webglUVBuffer);i.bufferData(i.ARRAY_BUFFER,wc,eb)}}if(hd&&$c&&ed){I=0;for(V=na.length;I<V;I++){lb=na[I];O=Ga[lb];lc=$c[lb];if(lc!==void 0)for(ma=0;ma<3;ma++){nc=lc[ma];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}I=0;for(V=oa.length;I<V;I++){lb=oa[I];O=Ga[lb];lc=$c[lb];if(lc!==void 0)for(ma=0;ma<4;ma++){nc=lc[ma];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}if(Kb>0){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
-ga.__webglUV2Buffer);i.bufferData(i.ARRAY_BUFFER,xc,eb)}}if(rd){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+2;ib=ib+3;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+2;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;Za=Za+6;Ea=Ea+3}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+3;Eb[ib+3]=Ea+1;Eb[ib+4]=Ea+2;Eb[ib+5]=Ea+3;ib=ib+6;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+3;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;gb[Za+6]=Ea+2;gb[Za+7]=Ea+3;Za=Za+8;Ea=Ea+4}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,
|
|
|
-ga.__webglFaceBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,Eb,eb);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,ga.__webglLineBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,gb,eb)}if(Yc){ma=0;for(fd=Yc.length;ma<fd;ma++){z=Yc[ma];if(z.__original.needsUpdate){A=0;if(z.size===1)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];z.array[A]=z.value[O.a];z.array[A+1]=z.value[O.b];z.array[A+2]=z.value[O.c];A=A+3}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];z.array[A]=z.value[O.a];z.array[A+
|
|
|
-1]=z.value[O.b];z.array[A+2]=z.value[O.c];z.array[A+3]=z.value[O.d];A=A+4}}else{if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){fb=z.value[na[I]];z.array[A]=fb;z.array[A+1]=fb;z.array[A+2]=fb;A=A+3}I=0;for(V=oa.length;I<V;I++){fb=z.value[oa[I]];z.array[A]=fb;z.array[A+1]=fb;z.array[A+2]=fb;z.array[A+3]=fb;A=A+4}}}else if(z.size===2)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X.x;z.array[A+1]=X.y;
|
|
|
-z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;A=A+6}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;z.array[A+6]=qa.x;z.array[A+7]=qa.y;A=A+8}}else{if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;
|
|
|
-A=A+6}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=Y.x;z.array[A+3]=Y.y;z.array[A+4]=Z.x;z.array[A+5]=Z.y;z.array[A+6]=qa.x;z.array[A+7]=qa.y;A=A+8}}}else if(z.size===3){var ia;ia=z.type==="c"?["r","g","b"]:["x","y","z"];if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+
|
|
|
-4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];A=A+9}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];z.array[A+9]=qa[ia[0]];z.array[A+10]=qa[ia[1]];z.array[A+11]=qa[ia[2]];A=A+12}}else if(z.boundTo===
|
|
|
-"faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+8]=Z[ia[2]];A=A+9}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X[ia[0]];z.array[A+1]=X[ia[1]];z.array[A+2]=X[ia[2]];z.array[A+3]=Y[ia[0]];z.array[A+4]=Y[ia[1]];z.array[A+5]=Y[ia[2]];z.array[A+6]=Z[ia[0]];z.array[A+7]=Z[ia[1]];z.array[A+
|
|
|
-8]=Z[ia[2]];z.array[A+9]=qa[ia[0]];z.array[A+10]=qa[ia[1]];z.array[A+11]=qa[ia[2]];A=A+12}}}else if(z.size===4)if(z.boundTo===void 0||z.boundTo==="vertices"){I=0;for(V=na.length;I<V;I++){O=Ga[na[I]];X=z.value[O.a];Y=z.value[O.b];Z=z.value[O.c];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;A=A+12}I=0;for(V=oa.length;I<V;I++){O=Ga[oa[I]];X=z.value[O.a];
|
|
|
-Y=z.value[O.b];Z=z.value[O.c];qa=z.value[O.d];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;z.array[A+12]=qa.x;z.array[A+13]=qa.y;z.array[A+14]=qa.z;z.array[A+15]=qa.w;A=A+16}}else if(z.boundTo==="faces"){I=0;for(V=na.length;I<V;I++){Z=Y=X=fb=z.value[na[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+
|
|
|
-5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;A=A+12}I=0;for(V=oa.length;I<V;I++){qa=Z=Y=X=fb=z.value[oa[I]];z.array[A]=X.x;z.array[A+1]=X.y;z.array[A+2]=X.z;z.array[A+3]=X.w;z.array[A+4]=Y.x;z.array[A+5]=Y.y;z.array[A+6]=Y.z;z.array[A+7]=Y.w;z.array[A+8]=Z.x;z.array[A+9]=Z.y;z.array[A+10]=Z.z;z.array[A+11]=Z.w;z.array[A+12]=qa.x;z.array[A+13]=qa.y;z.array[A+14]=qa.z;z.array[A+15]=qa.w;A=A+16}}i.bindBuffer(i.ARRAY_BUFFER,z.buffer);i.bufferData(i.ARRAY_BUFFER,
|
|
|
-z.array,eb)}}}if(qd){delete ga.__inittedArrays;delete ga.__colorArray;delete ga.__normalArray;delete ga.__tangentArray;delete ga.__uvArray;delete ga.__uv2Array;delete ga.__faceArray;delete ga.__vertexArray;delete ga.__lineArray;delete ga.__skinVertexAArray;delete ga.__skinVertexBArray;delete ga.__skinIndexArray;delete ga.__skinWeightArray}}}}ka.__dirtyVertices=false;ka.__dirtyMorphTargets=false;ka.__dirtyElements=false;ka.__dirtyUvs=false;ka.__dirtyNormals=false;ka.__dirtyColors=false;ka.__dirtyTangents=
|
|
|
+od;Uc++){qc=ka.geometryGroupsList[Uc];bb=c(nb,qc);ic=bb.attributes&&p(bb);if(ka.__dirtyVertices||ka.__dirtyMorphTargets||ka.__dirtyElements||ka.__dirtyUvs||ka.__dirtyNormals||ka.__dirtyColors||ka.__dirtyTangents||ic){var ha=qc,pd=nb,eb=i.DYNAMIC_DRAW,qd=!ka.dynamic,bc=bb;if(ha.__inittedArrays){var dd=d(bc),Vc=bc.vertexColors?bc.vertexColors:false,ed=e(bc),Fc=dd===THREE.SmoothShading,I=void 0,U=void 0,lb=void 0,N=void 0,jc=void 0,Ob=void 0,ob=void 0,Gc=void 0,Hb=void 0,kc=void 0,lc=void 0,Y=void 0,
|
|
|
+Z=void 0,$=void 0,qa=void 0,pb=void 0,qb=void 0,rb=void 0,rc=void 0,sb=void 0,tb=void 0,ub=void 0,sc=void 0,vb=void 0,wb=void 0,xb=void 0,tc=void 0,yb=void 0,zb=void 0,Ab=void 0,uc=void 0,Bb=void 0,Cb=void 0,Db=void 0,vc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Hc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Ic=void 0,ma=void 0,fd=void 0,Vb=void 0,mc=void 0,nc=void 0,Qa=void 0,gd=void 0,La=void 0,Ma=void 0,Wb=void 0,Ib=void 0,Ea=0,Ja=0,Jb=0,Kb=0,ib=0,Va=0,ra=0,Za=0,Fa=0,K=0,ea=0,D=0,fb=void 0,Ra=ha.__vertexArray,
|
|
|
+wc=ha.__uvArray,xc=ha.__uv2Array,jb=ha.__normalArray,ya=ha.__tangentArray,Sa=ha.__colorArray,za=ha.__skinVertexAArray,Aa=ha.__skinVertexBArray,Ba=ha.__skinIndexArray,Ca=ha.__skinWeightArray,Wc=ha.__morphTargetsArrays,Xc=ha.__morphNormalsArrays,Yc=ha.__webglCustomAttributesList,y=void 0,Eb=ha.__faceArray,gb=ha.__lineArray,$a=pd.geometry,rd=$a.__dirtyElements,hd=$a.__dirtyUvs,sd=$a.__dirtyNormals,td=$a.__dirtyTangents,ud=$a.__dirtyColors,vd=$a.__dirtyMorphTargets,cc=$a.vertices,na=ha.faces3,oa=ha.faces4,
|
|
|
+Ga=$a.faces,Zc=$a.faceVertexUvs[0],$c=$a.faceVertexUvs[1],dc=$a.skinVerticesA,ec=$a.skinVerticesB,fc=$a.skinIndices,Xb=$a.skinWeights,Yb=$a.morphTargets,Jc=$a.morphNormals;if($a.__dirtyVertices){I=0;for(U=na.length;I<U;I++){N=Ga[na[I]];Y=cc[N.a];Z=cc[N.b];$=cc[N.c];Ra[Ja]=Y.x;Ra[Ja+1]=Y.y;Ra[Ja+2]=Y.z;Ra[Ja+3]=Z.x;Ra[Ja+4]=Z.y;Ra[Ja+5]=Z.z;Ra[Ja+6]=$.x;Ra[Ja+7]=$.y;Ra[Ja+8]=$.z;Ja=Ja+9}I=0;for(U=oa.length;I<U;I++){N=Ga[oa[I]];Y=cc[N.a];Z=cc[N.b];$=cc[N.c];qa=cc[N.d];Ra[Ja]=Y.x;Ra[Ja+1]=Y.y;Ra[Ja+
|
|
|
+2]=Y.z;Ra[Ja+3]=Z.x;Ra[Ja+4]=Z.y;Ra[Ja+5]=Z.z;Ra[Ja+6]=$.x;Ra[Ja+7]=$.y;Ra[Ja+8]=$.z;Ra[Ja+9]=qa.x;Ra[Ja+10]=qa.y;Ra[Ja+11]=qa.z;Ja=Ja+12}i.bindBuffer(i.ARRAY_BUFFER,ha.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Ra,eb)}if(vd){Qa=0;for(gd=Yb.length;Qa<gd;Qa++){I=ea=0;for(U=na.length;I<U;I++){Wb=na[I];N=Ga[Wb];Y=Yb[Qa].vertices[N.a];Z=Yb[Qa].vertices[N.b];$=Yb[Qa].vertices[N.c];La=Wc[Qa];La[ea]=Y.x;La[ea+1]=Y.y;La[ea+2]=Y.z;La[ea+3]=Z.x;La[ea+4]=Z.y;La[ea+5]=Z.z;La[ea+6]=$.x;La[ea+7]=$.y;La[ea+
|
|
|
+8]=$.z;if(bc.morphNormals){if(Fc){Ib=Jc[Qa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c}else ub=tb=sb=Jc[Qa].faceNormals[Wb];Ma=Xc[Qa];Ma[ea]=sb.x;Ma[ea+1]=sb.y;Ma[ea+2]=sb.z;Ma[ea+3]=tb.x;Ma[ea+4]=tb.y;Ma[ea+5]=tb.z;Ma[ea+6]=ub.x;Ma[ea+7]=ub.y;Ma[ea+8]=ub.z}ea=ea+9}I=0;for(U=oa.length;I<U;I++){Wb=oa[I];N=Ga[Wb];Y=Yb[Qa].vertices[N.a];Z=Yb[Qa].vertices[N.b];$=Yb[Qa].vertices[N.c];qa=Yb[Qa].vertices[N.d];La=Wc[Qa];La[ea]=Y.x;La[ea+1]=Y.y;La[ea+2]=Y.z;La[ea+3]=Z.x;La[ea+4]=Z.y;La[ea+5]=Z.z;La[ea+6]=$.x;
|
|
|
+La[ea+7]=$.y;La[ea+8]=$.z;La[ea+9]=qa.x;La[ea+10]=qa.y;La[ea+11]=qa.z;if(bc.morphNormals){if(Fc){Ib=Jc[Qa].vertexNormals[Wb];sb=Ib.a;tb=Ib.b;ub=Ib.c;sc=Ib.d}else sc=ub=tb=sb=Jc[Qa].faceNormals[Wb];Ma=Xc[Qa];Ma[ea]=sb.x;Ma[ea+1]=sb.y;Ma[ea+2]=sb.z;Ma[ea+3]=tb.x;Ma[ea+4]=tb.y;Ma[ea+5]=tb.z;Ma[ea+6]=ub.x;Ma[ea+7]=ub.y;Ma[ea+8]=ub.z;Ma[ea+9]=sc.x;Ma[ea+10]=sc.y;Ma[ea+11]=sc.z}ea=ea+12}i.bindBuffer(i.ARRAY_BUFFER,ha.__webglMorphTargetsBuffers[Qa]);i.bufferData(i.ARRAY_BUFFER,Wc[Qa],eb);if(bc.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
+ha.__webglMorphNormalsBuffers[Qa]);i.bufferData(i.ARRAY_BUFFER,Xc[Qa],eb)}}}if(Xb.length){I=0;for(U=na.length;I<U;I++){N=Ga[na[I]];yb=Xb[N.a];zb=Xb[N.b];Ab=Xb[N.c];Ca[K]=yb.x;Ca[K+1]=yb.y;Ca[K+2]=yb.z;Ca[K+3]=yb.w;Ca[K+4]=zb.x;Ca[K+5]=zb.y;Ca[K+6]=zb.z;Ca[K+7]=zb.w;Ca[K+8]=Ab.x;Ca[K+9]=Ab.y;Ca[K+10]=Ab.z;Ca[K+11]=Ab.w;Bb=fc[N.a];Cb=fc[N.b];Db=fc[N.c];Ba[K]=Bb.x;Ba[K+1]=Bb.y;Ba[K+2]=Bb.z;Ba[K+3]=Bb.w;Ba[K+4]=Cb.x;Ba[K+5]=Cb.y;Ba[K+6]=Cb.z;Ba[K+7]=Cb.w;Ba[K+8]=Db.x;Ba[K+9]=Db.y;Ba[K+10]=Db.z;Ba[K+11]=
|
|
|
+Db.w;Pb=dc[N.a];Qb=dc[N.b];Rb=dc[N.c];za[K]=Pb.x;za[K+1]=Pb.y;za[K+2]=Pb.z;za[K+3]=1;za[K+4]=Qb.x;za[K+5]=Qb.y;za[K+6]=Qb.z;za[K+7]=1;za[K+8]=Rb.x;za[K+9]=Rb.y;za[K+10]=Rb.z;za[K+11]=1;Sb=ec[N.a];Tb=ec[N.b];Ub=ec[N.c];Aa[K]=Sb.x;Aa[K+1]=Sb.y;Aa[K+2]=Sb.z;Aa[K+3]=1;Aa[K+4]=Tb.x;Aa[K+5]=Tb.y;Aa[K+6]=Tb.z;Aa[K+7]=1;Aa[K+8]=Ub.x;Aa[K+9]=Ub.y;Aa[K+10]=Ub.z;Aa[K+11]=1;K=K+12}I=0;for(U=oa.length;I<U;I++){N=Ga[oa[I]];yb=Xb[N.a];zb=Xb[N.b];Ab=Xb[N.c];uc=Xb[N.d];Ca[K]=yb.x;Ca[K+1]=yb.y;Ca[K+2]=yb.z;Ca[K+3]=
|
|
|
+yb.w;Ca[K+4]=zb.x;Ca[K+5]=zb.y;Ca[K+6]=zb.z;Ca[K+7]=zb.w;Ca[K+8]=Ab.x;Ca[K+9]=Ab.y;Ca[K+10]=Ab.z;Ca[K+11]=Ab.w;Ca[K+12]=uc.x;Ca[K+13]=uc.y;Ca[K+14]=uc.z;Ca[K+15]=uc.w;Bb=fc[N.a];Cb=fc[N.b];Db=fc[N.c];vc=fc[N.d];Ba[K]=Bb.x;Ba[K+1]=Bb.y;Ba[K+2]=Bb.z;Ba[K+3]=Bb.w;Ba[K+4]=Cb.x;Ba[K+5]=Cb.y;Ba[K+6]=Cb.z;Ba[K+7]=Cb.w;Ba[K+8]=Db.x;Ba[K+9]=Db.y;Ba[K+10]=Db.z;Ba[K+11]=Db.w;Ba[K+12]=vc.x;Ba[K+13]=vc.y;Ba[K+14]=vc.z;Ba[K+15]=vc.w;Pb=dc[N.a];Qb=dc[N.b];Rb=dc[N.c];Hc=dc[N.d];za[K]=Pb.x;za[K+1]=Pb.y;za[K+2]=Pb.z;
|
|
|
+za[K+3]=1;za[K+4]=Qb.x;za[K+5]=Qb.y;za[K+6]=Qb.z;za[K+7]=1;za[K+8]=Rb.x;za[K+9]=Rb.y;za[K+10]=Rb.z;za[K+11]=1;za[K+12]=Hc.x;za[K+13]=Hc.y;za[K+14]=Hc.z;za[K+15]=1;Sb=ec[N.a];Tb=ec[N.b];Ub=ec[N.c];Ic=ec[N.d];Aa[K]=Sb.x;Aa[K+1]=Sb.y;Aa[K+2]=Sb.z;Aa[K+3]=1;Aa[K+4]=Tb.x;Aa[K+5]=Tb.y;Aa[K+6]=Tb.z;Aa[K+7]=1;Aa[K+8]=Ub.x;Aa[K+9]=Ub.y;Aa[K+10]=Ub.z;Aa[K+11]=1;Aa[K+12]=Ic.x;Aa[K+13]=Ic.y;Aa[K+14]=Ic.z;Aa[K+15]=1;K=K+16}if(K>0){i.bindBuffer(i.ARRAY_BUFFER,ha.__webglSkinVertexABuffer);i.bufferData(i.ARRAY_BUFFER,
|
|
|
+za,eb);i.bindBuffer(i.ARRAY_BUFFER,ha.__webglSkinVertexBBuffer);i.bufferData(i.ARRAY_BUFFER,Aa,eb);i.bindBuffer(i.ARRAY_BUFFER,ha.__webglSkinIndicesBuffer);i.bufferData(i.ARRAY_BUFFER,Ba,eb);i.bindBuffer(i.ARRAY_BUFFER,ha.__webglSkinWeightsBuffer);i.bufferData(i.ARRAY_BUFFER,Ca,eb)}}if(ud&&Vc){I=0;for(U=na.length;I<U;I++){N=Ga[na[I]];ob=N.vertexColors;Gc=N.color;if(ob.length===3&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2]}else xb=wb=vb=Gc;Sa[Fa]=vb.r;Sa[Fa+1]=vb.g;Sa[Fa+2]=vb.b;Sa[Fa+3]=
|
|
|
+wb.r;Sa[Fa+4]=wb.g;Sa[Fa+5]=wb.b;Sa[Fa+6]=xb.r;Sa[Fa+7]=xb.g;Sa[Fa+8]=xb.b;Fa=Fa+9}I=0;for(U=oa.length;I<U;I++){N=Ga[oa[I]];ob=N.vertexColors;Gc=N.color;if(ob.length===4&&Vc===THREE.VertexColors){vb=ob[0];wb=ob[1];xb=ob[2];tc=ob[3]}else tc=xb=wb=vb=Gc;Sa[Fa]=vb.r;Sa[Fa+1]=vb.g;Sa[Fa+2]=vb.b;Sa[Fa+3]=wb.r;Sa[Fa+4]=wb.g;Sa[Fa+5]=wb.b;Sa[Fa+6]=xb.r;Sa[Fa+7]=xb.g;Sa[Fa+8]=xb.b;Sa[Fa+9]=tc.r;Sa[Fa+10]=tc.g;Sa[Fa+11]=tc.b;Fa=Fa+12}if(Fa>0){i.bindBuffer(i.ARRAY_BUFFER,ha.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,
|
|
|
+Sa,eb)}}if(td&&$a.hasTangents){I=0;for(U=na.length;I<U;I++){N=Ga[na[I]];Hb=N.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ra=ra+12}I=0;for(U=oa.length;I<U;I++){N=Ga[oa[I]];Hb=N.vertexTangents;pb=Hb[0];qb=Hb[1];rb=Hb[2];rc=Hb[3];ya[ra]=pb.x;ya[ra+1]=pb.y;ya[ra+2]=pb.z;ya[ra+3]=pb.w;ya[ra+4]=qb.x;ya[ra+5]=qb.y;ya[ra+6]=qb.z;ya[ra+7]=qb.w;
|
|
|
+ya[ra+8]=rb.x;ya[ra+9]=rb.y;ya[ra+10]=rb.z;ya[ra+11]=rb.w;ya[ra+12]=rc.x;ya[ra+13]=rc.y;ya[ra+14]=rc.z;ya[ra+15]=rc.w;ra=ra+16}i.bindBuffer(i.ARRAY_BUFFER,ha.__webglTangentBuffer);i.bufferData(i.ARRAY_BUFFER,ya,eb)}if(sd&&dd){I=0;for(U=na.length;I<U;I++){N=Ga[na[I]];jc=N.vertexNormals;Ob=N.normal;if(jc.length===3&&Fc)for(ma=0;ma<3;ma++){Vb=jc[ma];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(ma=0;ma<3;ma++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}I=0;for(U=oa.length;I<U;I++){N=
|
|
|
+Ga[oa[I]];jc=N.vertexNormals;Ob=N.normal;if(jc.length===4&&Fc)for(ma=0;ma<4;ma++){Vb=jc[ma];jb[Va]=Vb.x;jb[Va+1]=Vb.y;jb[Va+2]=Vb.z;Va=Va+3}else for(ma=0;ma<4;ma++){jb[Va]=Ob.x;jb[Va+1]=Ob.y;jb[Va+2]=Ob.z;Va=Va+3}}i.bindBuffer(i.ARRAY_BUFFER,ha.__webglNormalBuffer);i.bufferData(i.ARRAY_BUFFER,jb,eb)}if(hd&&Zc&&ed){I=0;for(U=na.length;I<U;I++){lb=na[I];N=Ga[lb];kc=Zc[lb];if(kc!==void 0)for(ma=0;ma<3;ma++){mc=kc[ma];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}I=0;for(U=oa.length;I<U;I++){lb=oa[I];N=Ga[lb];kc=
|
|
|
+Zc[lb];if(kc!==void 0)for(ma=0;ma<4;ma++){mc=kc[ma];wc[Jb]=mc.u;wc[Jb+1]=mc.v;Jb=Jb+2}}if(Jb>0){i.bindBuffer(i.ARRAY_BUFFER,ha.__webglUVBuffer);i.bufferData(i.ARRAY_BUFFER,wc,eb)}}if(hd&&$c&&ed){I=0;for(U=na.length;I<U;I++){lb=na[I];N=Ga[lb];lc=$c[lb];if(lc!==void 0)for(ma=0;ma<3;ma++){nc=lc[ma];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}I=0;for(U=oa.length;I<U;I++){lb=oa[I];N=Ga[lb];lc=$c[lb];if(lc!==void 0)for(ma=0;ma<4;ma++){nc=lc[ma];xc[Kb]=nc.u;xc[Kb+1]=nc.v;Kb=Kb+2}}if(Kb>0){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
+ha.__webglUV2Buffer);i.bufferData(i.ARRAY_BUFFER,xc,eb)}}if(rd){I=0;for(U=na.length;I<U;I++){N=Ga[na[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+2;ib=ib+3;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+2;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;Za=Za+6;Ea=Ea+3}I=0;for(U=oa.length;I<U;I++){N=Ga[oa[I]];Eb[ib]=Ea;Eb[ib+1]=Ea+1;Eb[ib+2]=Ea+3;Eb[ib+3]=Ea+1;Eb[ib+4]=Ea+2;Eb[ib+5]=Ea+3;ib=ib+6;gb[Za]=Ea;gb[Za+1]=Ea+1;gb[Za+2]=Ea;gb[Za+3]=Ea+3;gb[Za+4]=Ea+1;gb[Za+5]=Ea+2;gb[Za+6]=Ea+2;gb[Za+7]=Ea+3;Za=Za+8;Ea=Ea+4}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,
|
|
|
+ha.__webglFaceBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,Eb,eb);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,ha.__webglLineBuffer);i.bufferData(i.ELEMENT_ARRAY_BUFFER,gb,eb)}if(Yc){ma=0;for(fd=Yc.length;ma<fd;ma++){y=Yc[ma];if(y.__original.needsUpdate){D=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(U=na.length;I<U;I++){N=Ga[na[I]];y.array[D]=y.value[N.a];y.array[D+1]=y.value[N.b];y.array[D+2]=y.value[N.c];D=D+3}I=0;for(U=oa.length;I<U;I++){N=Ga[oa[I]];y.array[D]=y.value[N.a];y.array[D+
|
|
|
+1]=y.value[N.b];y.array[D+2]=y.value[N.c];y.array[D+3]=y.value[N.d];D=D+4}}else{if(y.boundTo==="faces"){I=0;for(U=na.length;I<U;I++){fb=y.value[na[I]];y.array[D]=fb;y.array[D+1]=fb;y.array[D+2]=fb;D=D+3}I=0;for(U=oa.length;I<U;I++){fb=y.value[oa[I]];y.array[D]=fb;y.array[D+1]=fb;y.array[D+2]=fb;y.array[D+3]=fb;D=D+4}}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(U=na.length;I<U;I++){N=Ga[na[I]];Y=y.value[N.a];Z=y.value[N.b];$=y.value[N.c];y.array[D]=Y.x;y.array[D+1]=Y.y;
|
|
|
+y.array[D+2]=Z.x;y.array[D+3]=Z.y;y.array[D+4]=$.x;y.array[D+5]=$.y;D=D+6}I=0;for(U=oa.length;I<U;I++){N=Ga[oa[I]];Y=y.value[N.a];Z=y.value[N.b];$=y.value[N.c];qa=y.value[N.d];y.array[D]=Y.x;y.array[D+1]=Y.y;y.array[D+2]=Z.x;y.array[D+3]=Z.y;y.array[D+4]=$.x;y.array[D+5]=$.y;y.array[D+6]=qa.x;y.array[D+7]=qa.y;D=D+8}}else{if(y.boundTo==="faces"){I=0;for(U=na.length;I<U;I++){$=Z=Y=fb=y.value[na[I]];y.array[D]=Y.x;y.array[D+1]=Y.y;y.array[D+2]=Z.x;y.array[D+3]=Z.y;y.array[D+4]=$.x;y.array[D+5]=$.y;
|
|
|
+D=D+6}I=0;for(U=oa.length;I<U;I++){qa=$=Z=Y=fb=y.value[oa[I]];y.array[D]=Y.x;y.array[D+1]=Y.y;y.array[D+2]=Z.x;y.array[D+3]=Z.y;y.array[D+4]=$.x;y.array[D+5]=$.y;y.array[D+6]=qa.x;y.array[D+7]=qa.y;D=D+8}}}else if(y.size===3){var ia;ia=y.type==="c"?["r","g","b"]:["x","y","z"];if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(U=na.length;I<U;I++){N=Ga[na[I]];Y=y.value[N.a];Z=y.value[N.b];$=y.value[N.c];y.array[D]=Y[ia[0]];y.array[D+1]=Y[ia[1]];y.array[D+2]=Y[ia[2]];y.array[D+3]=Z[ia[0]];y.array[D+
|
|
|
+4]=Z[ia[1]];y.array[D+5]=Z[ia[2]];y.array[D+6]=$[ia[0]];y.array[D+7]=$[ia[1]];y.array[D+8]=$[ia[2]];D=D+9}I=0;for(U=oa.length;I<U;I++){N=Ga[oa[I]];Y=y.value[N.a];Z=y.value[N.b];$=y.value[N.c];qa=y.value[N.d];y.array[D]=Y[ia[0]];y.array[D+1]=Y[ia[1]];y.array[D+2]=Y[ia[2]];y.array[D+3]=Z[ia[0]];y.array[D+4]=Z[ia[1]];y.array[D+5]=Z[ia[2]];y.array[D+6]=$[ia[0]];y.array[D+7]=$[ia[1]];y.array[D+8]=$[ia[2]];y.array[D+9]=qa[ia[0]];y.array[D+10]=qa[ia[1]];y.array[D+11]=qa[ia[2]];D=D+12}}else if(y.boundTo===
|
|
|
+"faces"){I=0;for(U=na.length;I<U;I++){$=Z=Y=fb=y.value[na[I]];y.array[D]=Y[ia[0]];y.array[D+1]=Y[ia[1]];y.array[D+2]=Y[ia[2]];y.array[D+3]=Z[ia[0]];y.array[D+4]=Z[ia[1]];y.array[D+5]=Z[ia[2]];y.array[D+6]=$[ia[0]];y.array[D+7]=$[ia[1]];y.array[D+8]=$[ia[2]];D=D+9}I=0;for(U=oa.length;I<U;I++){qa=$=Z=Y=fb=y.value[oa[I]];y.array[D]=Y[ia[0]];y.array[D+1]=Y[ia[1]];y.array[D+2]=Y[ia[2]];y.array[D+3]=Z[ia[0]];y.array[D+4]=Z[ia[1]];y.array[D+5]=Z[ia[2]];y.array[D+6]=$[ia[0]];y.array[D+7]=$[ia[1]];y.array[D+
|
|
|
+8]=$[ia[2]];y.array[D+9]=qa[ia[0]];y.array[D+10]=qa[ia[1]];y.array[D+11]=qa[ia[2]];D=D+12}}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){I=0;for(U=na.length;I<U;I++){N=Ga[na[I]];Y=y.value[N.a];Z=y.value[N.b];$=y.value[N.c];y.array[D]=Y.x;y.array[D+1]=Y.y;y.array[D+2]=Y.z;y.array[D+3]=Y.w;y.array[D+4]=Z.x;y.array[D+5]=Z.y;y.array[D+6]=Z.z;y.array[D+7]=Z.w;y.array[D+8]=$.x;y.array[D+9]=$.y;y.array[D+10]=$.z;y.array[D+11]=$.w;D=D+12}I=0;for(U=oa.length;I<U;I++){N=Ga[oa[I]];Y=y.value[N.a];
|
|
|
+Z=y.value[N.b];$=y.value[N.c];qa=y.value[N.d];y.array[D]=Y.x;y.array[D+1]=Y.y;y.array[D+2]=Y.z;y.array[D+3]=Y.w;y.array[D+4]=Z.x;y.array[D+5]=Z.y;y.array[D+6]=Z.z;y.array[D+7]=Z.w;y.array[D+8]=$.x;y.array[D+9]=$.y;y.array[D+10]=$.z;y.array[D+11]=$.w;y.array[D+12]=qa.x;y.array[D+13]=qa.y;y.array[D+14]=qa.z;y.array[D+15]=qa.w;D=D+16}}else if(y.boundTo==="faces"){I=0;for(U=na.length;I<U;I++){$=Z=Y=fb=y.value[na[I]];y.array[D]=Y.x;y.array[D+1]=Y.y;y.array[D+2]=Y.z;y.array[D+3]=Y.w;y.array[D+4]=Z.x;y.array[D+
|
|
|
+5]=Z.y;y.array[D+6]=Z.z;y.array[D+7]=Z.w;y.array[D+8]=$.x;y.array[D+9]=$.y;y.array[D+10]=$.z;y.array[D+11]=$.w;D=D+12}I=0;for(U=oa.length;I<U;I++){qa=$=Z=Y=fb=y.value[oa[I]];y.array[D]=Y.x;y.array[D+1]=Y.y;y.array[D+2]=Y.z;y.array[D+3]=Y.w;y.array[D+4]=Z.x;y.array[D+5]=Z.y;y.array[D+6]=Z.z;y.array[D+7]=Z.w;y.array[D+8]=$.x;y.array[D+9]=$.y;y.array[D+10]=$.z;y.array[D+11]=$.w;y.array[D+12]=qa.x;y.array[D+13]=qa.y;y.array[D+14]=qa.z;y.array[D+15]=qa.w;D=D+16}}i.bindBuffer(i.ARRAY_BUFFER,y.buffer);i.bufferData(i.ARRAY_BUFFER,
|
|
|
+y.array,eb)}}}if(qd){delete ha.__inittedArrays;delete ha.__colorArray;delete ha.__normalArray;delete ha.__tangentArray;delete ha.__uvArray;delete ha.__uv2Array;delete ha.__faceArray;delete ha.__vertexArray;delete ha.__lineArray;delete ha.__skinVertexAArray;delete ha.__skinVertexBArray;delete ha.__skinIndexArray;delete ha.__skinWeightArray}}}}ka.__dirtyVertices=false;ka.__dirtyMorphTargets=false;ka.__dirtyElements=false;ka.__dirtyUvs=false;ka.__dirtyNormals=false;ka.__dirtyColors=false;ka.__dirtyTangents=
|
|
|
false;bb.attributes&&m(bb)}else if(nb instanceof THREE.Ribbon){if(ka.__dirtyVertices||ka.__dirtyColors){var Zb=ka,id=i.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=void 0,$b=void 0,Lc=void 0,jd=Zb.vertices,kd=Zb.colors,wd=jd.length,xd=kd.length,Mc=Zb.__vertexArray,Nc=Zb.__colorArray,yd=Zb.__dirtyColors;if(Zb.__dirtyVertices){for(yc=0;yc<wd;yc++){Kc=jd[yc];$b=yc*3;Mc[$b]=Kc.x;Mc[$b+1]=Kc.y;Mc[$b+2]=Kc.z}i.bindBuffer(i.ARRAY_BUFFER,Zb.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Mc,id)}if(yd){for(zc=0;zc<
|
|
|
xd;zc++){Lc=kd[zc];$b=zc*3;Nc[$b]=Lc.r;Nc[$b+1]=Lc.g;Nc[$b+2]=Lc.b}i.bindBuffer(i.ARRAY_BUFFER,Zb.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Nc,id)}}ka.__dirtyVertices=false;ka.__dirtyColors=false}else if(nb instanceof THREE.Line){bb=c(nb,qc);ic=bb.attributes&&p(bb);if(ka.__dirtyVertices||ka.__dirtyColors||ic){var Lb=ka,ad=i.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,Da=void 0,Pc=void 0,ld=Lb.vertices,md=Lb.colors,zd=ld.length,Ad=md.length,Qc=Lb.__vertexArray,Rc=Lb.__colorArray,Bd=Lb.__dirtyColors,
|
|
|
bd=Lb.__webglCustomAttributesList,Sc=void 0,nd=void 0,Ua=void 0,oc=void 0,cb=void 0,va=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<zd;Ac++){Oc=ld[Ac];Da=Ac*3;Qc[Da]=Oc.x;Qc[Da+1]=Oc.y;Qc[Da+2]=Oc.z}i.bindBuffer(i.ARRAY_BUFFER,Lb.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,Qc,ad)}if(Bd){for(Bc=0;Bc<Ad;Bc++){Pc=md[Bc];Da=Bc*3;Rc[Da]=Pc.r;Rc[Da+1]=Pc.g;Rc[Da+2]=Pc.b}i.bindBuffer(i.ARRAY_BUFFER,Lb.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,Rc,ad)}if(bd){Sc=0;for(nd=bd.length;Sc<nd;Sc++){va=bd[Sc];
|
|
|
if(va.needsUpdate&&(va.boundTo===void 0||va.boundTo==="vertices")){Da=0;oc=va.value.length;if(va.size===1)for(Ua=0;Ua<oc;Ua++)va.array[Ua]=va.value[Ua];else if(va.size===2)for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=cb.y;Da=Da+2}else if(va.size===3)if(va.type==="c")for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.r;va.array[Da+1]=cb.g;va.array[Da+2]=cb.b;Da=Da+3}else for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=cb.y;va.array[Da+2]=cb.z;Da=Da+
|
|
|
3}else if(va.size===4)for(Ua=0;Ua<oc;Ua++){cb=va.value[Ua];va.array[Da]=cb.x;va.array[Da+1]=cb.y;va.array[Da+2]=cb.z;va.array[Da+3]=cb.w;Da=Da+4}i.bindBuffer(i.ARRAY_BUFFER,va.buffer);i.bufferData(i.ARRAY_BUFFER,va.array,ad)}}}}ka.__dirtyVertices=false;ka.__dirtyColors=false;bb.attributes&&m(bb)}else if(nb instanceof THREE.ParticleSystem){bb=c(nb,qc);ic=bb.attributes&&p(bb);(ka.__dirtyVertices||ka.__dirtyColors||nb.sortParticles||ic)&&f(ka,i.DYNAMIC_DRAW,nb);ka.__dirtyVertices=false;ka.__dirtyColors=
|
|
|
false;bb.attributes&&m(bb)}}};this.initMaterial=function(a,b,c,d){var e,f,g;a instanceof THREE.MeshDepthMaterial?g="depth":a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?g="lambert":a instanceof THREE.MeshPhongMaterial?g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];a.uniforms=THREE.UniformsUtils.clone(h.uniforms);
|
|
|
-a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var j,k,l,m;j=m=h=0;for(k=b.length;j<k;j++){l=b[j];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&h++;l instanceof THREE.SpotLight&&h++}}if(h+m<=N){l=m;m=h}else{l=Math.ceil(N*m/(h+m));m=N-l}var n=0,h=0;for(j=b.length;h<j;h++){k=b[h];if(k.castShadow){k instanceof THREE.SpotLight&&n++;k instanceof THREE.DirectionalLight&&!k.shadowCascade&&n++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=
|
|
|
-d.bones.length;var o;a:{j=a.fragmentShader;k=a.vertexShader;var h=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,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:l,maxPointLights:m,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,
|
|
|
-shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(g)d.push(g);else{d.push(j);d.push(k)}for(r in c){d.push(r);d.push(c[r])}g=d.join();r=0;for(d=U.length;r<d;r++)if(U[r].code===g){o=U[r].program;break a}r=i.createProgram();d=["precision "+w+" float;",Xa>0?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":
|
|
|
-"",F.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.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":
|
|
|
+a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var j,l,k,m;j=m=h=0;for(l=b.length;j<l;j++){k=b[j];if(!k.onlyShadow){k instanceof THREE.DirectionalLight&&m++;k instanceof THREE.PointLight&&h++;k instanceof THREE.SpotLight&&h++}}if(h+m<=M){k=m;m=h}else{k=Math.ceil(M*m/(h+m));m=M-k}var n=0,h=0;for(j=b.length;h<j;h++){l=b[h];if(l.castShadow){l instanceof THREE.SpotLight&&n++;l instanceof THREE.DirectionalLight&&!l.shadowCascade&&n++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=
|
|
|
+d.bones.length;var o;a:{j=a.fragmentShader;l=a.vertexShader;var h=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,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:k,maxPointLights:m,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,
|
|
|
+shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(g)d.push(g);else{d.push(j);d.push(l)}for(q in c){d.push(q);d.push(c[q])}g=d.join();q=0;for(d=T.length;q<d;q++)if(T[q].code===g){o=T[q].program;break a}q=i.createProgram();d=["precision "+z+" float;",Xa>0?"#define VERTEX_TEXTURES":"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":
|
|
|
+"",G.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.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":
|
|
|
"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\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;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-l=["precision "+w+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.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.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");i.attachShader(r,t("fragment",l+j));
|
|
|
-i.attachShader(r,t("vertex",d+k));i.linkProgram(r);i.getProgramParameter(r,i.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+i.getProgramParameter(r,i.VALIDATE_STATUS)+", gl error ["+i.getError()+"]");r.uniforms={};r.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(q in h)d.push(q);q=d;d=0;for(h=q.length;d<h;d++){j=q[d];r.uniforms[j]=i.getUniformLocation(r,
|
|
|
-j)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(q=0;q<c.maxMorphNormals;q++)d.push("morphNormal"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++){c=o[q];r.attributes[c]=i.getAttribLocation(r,c)}r.id=U.length;U.push({program:r,code:g});F.info.memory.programs=U.length;o=r}a.program=o;o=a.program.attributes;o.position>=0&&i.enableVertexAttribArray(o.position);o.color>=0&&i.enableVertexAttribArray(o.color);
|
|
|
-o.normal>=0&&i.enableVertexAttribArray(o.normal);o.tangent>=0&&i.enableVertexAttribArray(o.tangent);if(a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0){i.enableVertexAttribArray(o.skinVertexA);i.enableVertexAttribArray(o.skinVertexB);i.enableVertexAttribArray(o.skinIndex);i.enableVertexAttribArray(o.skinWeight)}if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&i.enableVertexAttribArray(o[f]);if(a.morphTargets){a.numSupportedMorphTargets=0;r="morphTarget";
|
|
|
-for(f=0;f<this.maxMorphTargets;f++){q=r+f;if(o[q]>=0){i.enableVertexAttribArray(o[q]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;r="morphNormal";for(f=0;f<this.maxMorphNormals;f++){q=r+f;if(o[q]>=0){i.enableVertexAttribArray(o[q]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){if(a){!b||b==="ccw"?i.frontFace(i.CCW):i.frontFace(i.CW);a==="back"?i.cullFace(i.BACK):a===
|
|
|
-"front"?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK);i.enable(i.CULL_FACE)}else i.disable(i.CULL_FACE)};this.setObjectFaces=function(a){if(la!==a.doubleSided){a.doubleSided?i.disable(i.CULL_FACE):i.enable(i.CULL_FACE);la=a.doubleSided}if(R!==a.flipSided){a.flipSided?i.frontFace(i.CW):i.frontFace(i.CCW);R=a.flipSided}};this.setDepthTest=function(a){if(Na!==a){a?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST);Na=a}};this.setDepthWrite=function(a){if(wa!==a){i.depthMask(a);wa=a}};this.setBlending=
|
|
|
-function(a,b,c,d){if(a!==$){switch(a){case THREE.NoBlending:i.disable(i.BLEND);break;case THREE.AdditiveBlending:i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.SRC_ALPHA,i.ONE);break;case THREE.SubtractiveBlending:i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.ZERO,i.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.ZERO,i.SRC_COLOR);break;case THREE.CustomBlending:i.enable(i.BLEND);break;default:i.enable(i.BLEND);
|
|
|
-i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD);i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA)}$=a}if(a===THREE.CustomBlending){if(b!==ba){i.blendEquation(D(b));ba=b}if(c!==aa||d!==ea){i.blendFunc(D(c),D(d));aa=c;ea=d}}else ea=aa=ba=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=i.createTexture();F.info.memory.textures++}i.activeTexture(i.TEXTURE0+b);i.bindTexture(i.TEXTURE_2D,a.__webglTexture);i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
|
|
|
-a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=D(a.format),f=D(a.type);y(i.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?i.texImage2D(i.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):i.texImage2D(i.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&i.generateMipmap(i.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{i.activeTexture(i.TEXTURE0+b);i.bindTexture(i.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof
|
|
|
-THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=i.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=D(a.format),e=D(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];i.bindTexture(i.TEXTURE_CUBE_MAP,a.__webglTexture);y(i.TEXTURE_CUBE_MAP,a,c);for(var f=0;f<6;f++){a.__webglFramebuffer[f]=i.createFramebuffer();a.__webglRenderbuffer[f]=i.createRenderbuffer();
|
|
|
-i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=i.TEXTURE_CUBE_MAP_POSITIVE_X+f;i.bindFramebuffer(i.FRAMEBUFFER,a.__webglFramebuffer[f]);i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,h,g.__webglTexture,0);s(a.__webglRenderbuffer[f],a)}c&&i.generateMipmap(i.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=i.createFramebuffer();a.__webglRenderbuffer=i.createRenderbuffer();i.bindTexture(i.TEXTURE_2D,a.__webglTexture);y(i.TEXTURE_2D,a,c);i.texImage2D(i.TEXTURE_2D,
|
|
|
+k=["precision "+z+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.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.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");i.attachShader(q,t("fragment",k+j));
|
|
|
+i.attachShader(q,t("vertex",d+l));i.linkProgram(q);i.getProgramParameter(q,i.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+i.getProgramParameter(q,i.VALIDATE_STATUS)+", gl error ["+i.getError()+"]");q.uniforms={};q.attributes={};var r,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(r in h)d.push(r);r=d;d=0;for(h=r.length;d<h;d++){j=r[d];q.uniforms[j]=i.getUniformLocation(q,
|
|
|
+j)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(r=0;r<c.maxMorphNormals;r++)d.push("morphNormal"+r);for(o in b)d.push(o);o=d;r=0;for(b=o.length;r<b;r++){c=o[r];q.attributes[c]=i.getAttribLocation(q,c)}q.id=T.length;T.push({program:q,code:g});G.info.memory.programs=T.length;o=q}a.program=o;o=a.program.attributes;o.position>=0&&i.enableVertexAttribArray(o.position);o.color>=0&&i.enableVertexAttribArray(o.color);
|
|
|
+o.normal>=0&&i.enableVertexAttribArray(o.normal);o.tangent>=0&&i.enableVertexAttribArray(o.tangent);if(a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0){i.enableVertexAttribArray(o.skinVertexA);i.enableVertexAttribArray(o.skinVertexB);i.enableVertexAttribArray(o.skinIndex);i.enableVertexAttribArray(o.skinWeight)}if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&i.enableVertexAttribArray(o[f]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";
|
|
|
+for(f=0;f<this.maxMorphTargets;f++){r=q+f;if(o[r]>=0){i.enableVertexAttribArray(o[r]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(f=0;f<this.maxMorphNormals;f++){r=q+f;if(o[r]>=0){i.enableVertexAttribArray(o[r]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){if(a){!b||b==="ccw"?i.frontFace(i.CCW):i.frontFace(i.CW);a==="back"?i.cullFace(i.BACK):a===
|
|
|
+"front"?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK);i.enable(i.CULL_FACE)}else i.disable(i.CULL_FACE)};this.setObjectFaces=function(a){if(la!==a.doubleSided){a.doubleSided?i.disable(i.CULL_FACE):i.enable(i.CULL_FACE);la=a.doubleSided}if(Q!==a.flipSided){a.flipSided?i.frontFace(i.CW):i.frontFace(i.CCW);Q=a.flipSided}};this.setDepthTest=function(a){if(Na!==a){a?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST);Na=a}};this.setDepthWrite=function(a){if(wa!==a){i.depthMask(a);wa=a}};this.setBlending=
|
|
|
+function(a,b,c,d){if(a!==S){switch(a){case THREE.NoBlending:i.disable(i.BLEND);break;case THREE.AdditiveBlending:i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.SRC_ALPHA,i.ONE);break;case THREE.SubtractiveBlending:i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.ZERO,i.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:i.enable(i.BLEND);i.blendEquation(i.FUNC_ADD);i.blendFunc(i.ZERO,i.SRC_COLOR);break;case THREE.CustomBlending:i.enable(i.BLEND);break;default:i.enable(i.BLEND);
|
|
|
+i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD);i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA)}S=a}if(a===THREE.CustomBlending){if(b!==ba){i.blendEquation(F(b));ba=b}if(c!==aa||d!==fa){i.blendFunc(F(c),F(d));aa=c;fa=d}}else fa=aa=ba=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=i.createTexture();G.info.memory.textures++}i.activeTexture(i.TEXTURE0+b);i.bindTexture(i.TEXTURE_2D,a.__webglTexture);i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
|
|
|
+a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=F(a.format),f=F(a.type);x(i.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?i.texImage2D(i.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):i.texImage2D(i.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&i.generateMipmap(i.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{i.activeTexture(i.TEXTURE0+b);i.bindTexture(i.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof
|
|
|
+THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=i.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=F(a.format),e=F(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];i.bindTexture(i.TEXTURE_CUBE_MAP,a.__webglTexture);x(i.TEXTURE_CUBE_MAP,a,c);for(var f=0;f<6;f++){a.__webglFramebuffer[f]=i.createFramebuffer();a.__webglRenderbuffer[f]=i.createRenderbuffer();
|
|
|
+i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=i.TEXTURE_CUBE_MAP_POSITIVE_X+f;i.bindFramebuffer(i.FRAMEBUFFER,a.__webglFramebuffer[f]);i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,h,g.__webglTexture,0);s(a.__webglRenderbuffer[f],a)}c&&i.generateMipmap(i.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=i.createFramebuffer();a.__webglRenderbuffer=i.createRenderbuffer();i.bindTexture(i.TEXTURE_2D,a.__webglTexture);x(i.TEXTURE_2D,a,c);i.texImage2D(i.TEXTURE_2D,
|
|
|
0,d,a.width,a.height,0,d,e,null);d=i.TEXTURE_2D;i.bindFramebuffer(i.FRAMEBUFFER,a.__webglFramebuffer);i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,d,a.__webglTexture,0);s(a.__webglRenderbuffer,a);c&&i.generateMipmap(i.TEXTURE_2D)}b?i.bindTexture(i.TEXTURE_CUBE_MAP,null):i.bindTexture(i.TEXTURE_2D,null);i.bindRenderbuffer(i.RENDERBUFFER,null);i.bindFramebuffer(i.FRAMEBUFFER,null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;
|
|
|
-c=Ka;a=db;d=Wa;e=Ya}if(b!==H){i.bindFramebuffer(i.FRAMEBUFFER,b);i.viewport(d,e,c,a);H=b}hb=c;mb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
|
+c=Ka;a=db;d=Wa;e=Ya}if(b!==A){i.bindFramebuffer(i.FRAMEBUFFER,b);i.viewport(d,e,c,a);A=b}hb=c;mb=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=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
|
|
|
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};
|
|
@@ -383,31 +383,31 @@ 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;c<0&&(c=c+1);c>1&&(c=c-1)}b===void 0&&(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,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],p=f.faceVertexUvs[0],m={},o=0;o<a.materials.length;o++)m[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,r=h.length;o<r;o++){var n=h[o].clone();c&&c.multiplyVector3(n);g.push(n)}o=0;for(r=k.length;o<r;o++){var g=
|
|
|
-k[o],q,u,t=g.vertexNormals,y=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=t.length;h<n;h++){u=t[h].clone();d&&d.multiplyVector3(u);q.vertexNormals.push(u)}q.color.copy(g.color);h=0;for(n=y.length;h<n;h++){u=y[h];q.vertexColors.push(u.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];n=h.id;y=m[n];if(y===void 0){y=
|
|
|
-a.materials.length;m[n]=y;a.materials.push(h)}q.materialIndex=y}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);j.push(q)}o=0;for(r=p.length;o<r;o++){c=p[o];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.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();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=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,j=a.faces,l=f.faces,k=a.faceVertexUvs[0],p=f.faceVertexUvs[0],m={},o=0;o<a.materials.length;o++)m[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 n=h[o].clone();c&&c.multiplyVector3(n);g.push(n)}o=0;for(q=l.length;o<q;o++){var g=
|
|
|
+l[o],r,u,t=g.vertexNormals,x=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(n=t.length;h<n;h++){u=t[h].clone();d&&d.multiplyVector3(u);r.vertexNormals.push(u)}r.color.copy(g.color);h=0;for(n=x.length;h<n;h++){u=x[h];r.vertexColors.push(u.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];n=h.id;x=m[n];if(x===void 0){x=
|
|
|
+a.materials.length;m[n]=x;a.materials.push(h)}r.materialIndex=x}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);j.push(r)}o=0;for(q=p.length;o<q;o++){c=p[o];d=[];h=0;for(n=c.length;h<n;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();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;
|
|
|
for(c=f.length;a<c;a++){for(var d=f[a],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(e)}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();if(d+e>1){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){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];return THREE.GeometryUtils.randomPointInTriangle(d,e,f)}if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;if(c)if(a._area1&&a._area2){c=a._area1;g=a._area2}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b);a._area1=c;a._area2=g}else{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 k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,j=0,k=[],l,p,m,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];p=g[d.b];m=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,p,m)}else if(d instanceof THREE.Face4){l=
|
|
|
-g[d.a];p=g[d.b];m=g[d.c];o=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,p,o);d._area2=THREE.GeometryUtils.triangleArea(p,m,o);d._area=d._area1+d._area2}j=j+d._area;k[e]=j}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*j;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}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();
|
|
|
+(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,j=0,l=[],k,p,m,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){k=g[d.a];p=g[d.b];m=g[d.c];d._area=THREE.GeometryUtils.triangleArea(k,p,m)}else if(d instanceof THREE.Face4){k=
|
|
|
+g[d.a];p=g[d.b];m=g[d.c];o=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(k,p,o);d._area2=THREE.GeometryUtils.triangleArea(p,m,o);d._area=d._area1+d._area2}j=j+d._area;l[e]=j}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*j;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}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).makeTranslation(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++){if(d[e].u!==1)d[e].u=d[e].u-Math.floor(d[e].u);if(d[e].v!==1)d[e].v=d[e].v-Math.floor(d[e].v)}},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<
|
|
|
-c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var j=d.b,k=d.c,l=d.d,p=new THREE.Face3,m=new THREE.Face3;p.color.copy(d.color);m.color.copy(d.color);p.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;p.a=e;p.b=j;p.c=l;m.a=j;m.b=k;m.c=l;if(d.vertexColors.length===4){p.vertexColors[0]=d.vertexColors[0].clone();p.vertexColors[1]=d.vertexColors[1].clone();p.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();
|
|
|
-m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}f.push(p,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){p=a.faceVertexUvs[d][b];j=p[1];k=p[2];l=p[3];p=[p[0].clone(),j.clone(),l.clone()];j=[j.clone(),k.clone(),l.clone()];h[d].push(p,j)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){j=a.faceUvs[d][b];g[d].push(j,j)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
|
|
|
-e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,j=f.c,g=a.vertices[g],h=a.vertices[h],j=a.vertices[j],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(j.clone());b.push(k.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else{g=f.a;
|
|
|
-h=f.b;j=f.c;g=a.vertices[g];h=a.vertices[h];j=a.vertices[j];b.push(g.clone());b.push(h.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,j,k,l,p,m,o,r,n,q,u,t,y,s,x=[],D=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)D[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;k=a.vertices[f];l=a.vertices[g];p=a.vertices[h];o=k.distanceTo(l);r=l.distanceTo(p);m=k.distanceTo(p);if(o>
|
|
|
-b||r>b||m>b){j=a.vertices.length;y=e.clone();s=e.clone();if(o>=r&&o>=m){k=k.clone();k.lerpSelf(l,0.5);y.a=f;y.b=j;y.c=h;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);y.vertexNormals[1].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);y.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(r>=o&&r>=m){k=l.clone();k.lerpSelf(p,0.5);y.a=f;y.b=g;y.c=
|
|
|
-j;s.a=j;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f);s.vertexNormals[1].copy(e.vertexNormals[2]);s.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);y.vertexColors[2].copy(f);s.vertexColors[0].copy(f);s.vertexColors[1].copy(e.vertexColors[2]);s.vertexColors[2].copy(e.vertexColors[0])}e=1}else{k=k.clone();
|
|
|
-k.lerpSelf(p,0.5);y.a=f;y.b=g;y.c=j;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);y.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}x.push(y,s);a.vertices.push(k);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];y=k[2];if(e===
|
|
|
-0){l=s.clone();l.lerpSelf(h,0.5);k=[s.clone(),l.clone(),y.clone()];h=[l.clone(),h.clone(),y.clone()]}else if(e===1){l=h.clone();l.lerpSelf(y,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),y.clone(),s.clone()]}else{l=s.clone();l.lerpSelf(y,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),y.clone()]}D[f].push(k,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;j=e.d;k=a.vertices[f];l=a.vertices[g];p=a.vertices[h];m=
|
|
|
-a.vertices[j];o=k.distanceTo(l);r=l.distanceTo(p);n=p.distanceTo(m);q=k.distanceTo(m);if(o>b||r>b||n>b||q>b){u=a.vertices.length;t=a.vertices.length+1;y=e.clone();s=e.clone();if(o>=r&&o>=n&&o>=q||n>=r&&n>=o&&n>=q){o=k.clone();o.lerpSelf(l,0.5);l=p.clone();l.lerpSelf(m,0.5);y.a=f;y.b=u;y.c=t;y.d=j;s.a=u;s.b=g;s.c=h;s.d=t;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);y.vertexNormals[1].copy(f);
|
|
|
-y.vertexNormals[2].copy(g);s.vertexNormals[0].copy(f);s.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);y.vertexColors[1].copy(f);y.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{o=l.clone();o.lerpSelf(p,0.5);l=m.clone();l.lerpSelf(k,0.5);y.a=f;y.b=g;y.c=u;y.d=t;s.a=t;s.b=u;s.c=h;s.d=j;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
|
|
|
-f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);y.vertexNormals[2].copy(f);y.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);y.vertexColors[2].copy(f);y.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}x.push(y,s);a.vertices.push(o,l);
|
|
|
-f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];y=k[2];k=k[3];if(e===0){l=s.clone();l.lerpSelf(h,0.5);p=y.clone();p.lerpSelf(k,0.5);s=[s.clone(),l.clone(),p.clone(),k.clone()];h=[l.clone(),h.clone(),y.clone(),p.clone()]}else{l=h.clone();l.lerpSelf(y,0.5);p=k.clone();p.lerpSelf(s,0.5);s=[s.clone(),h.clone(),l.clone(),p.clone()];h=[p.clone(),l.clone(),y.clone(),k.clone()]}D[f].push(s,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)D[f].push(a.faceVertexUvs[f][c])}}}a.faces=
|
|
|
-x;a.faceVertexUvs=D}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
+c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var j=d.b,l=d.c,k=d.d,p=new THREE.Face3,m=new THREE.Face3;p.color.copy(d.color);m.color.copy(d.color);p.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;p.a=e;p.b=j;p.c=k;m.a=j;m.b=l;m.c=k;if(d.vertexColors.length===4){p.vertexColors[0]=d.vertexColors[0].clone();p.vertexColors[1]=d.vertexColors[1].clone();p.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();
|
|
|
+m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}f.push(p,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){p=a.faceVertexUvs[d][b];j=p[1];l=p[2];k=p[3];p=[p[0].clone(),j.clone(),k.clone()];j=[j.clone(),l.clone(),k.clone()];h[d].push(p,j)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){j=a.faceUvs[d][b];g[d].push(j,j)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
|
|
|
+e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,j=f.c,g=a.vertices[g],h=a.vertices[h],j=a.vertices[j],l=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(j.clone());b.push(l.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else{g=f.a;
|
|
|
+h=f.b;j=f.c;g=a.vertices[g];h=a.vertices[h];j=a.vertices[j];b.push(g.clone());b.push(h.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,j,l,k,p,m,o,q,n,r,u,t,x,s,w=[],F=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)F[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;l=a.vertices[f];k=a.vertices[g];p=a.vertices[h];o=l.distanceTo(k);q=k.distanceTo(p);m=l.distanceTo(p);if(o>
|
|
|
+b||q>b||m>b){j=a.vertices.length;x=e.clone();s=e.clone();if(o>=q&&o>=m){l=l.clone();l.lerpSelf(k,0.5);x.a=f;x.b=j;x.c=h;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);x.vertexNormals[1].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);x.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(q>=o&&q>=m){l=k.clone();l.lerpSelf(p,0.5);x.a=f;x.b=g;x.c=
|
|
|
+j;s.a=j;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);x.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f);s.vertexNormals[1].copy(e.vertexNormals[2]);s.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);x.vertexColors[2].copy(f);s.vertexColors[0].copy(f);s.vertexColors[1].copy(e.vertexColors[2]);s.vertexColors[2].copy(e.vertexColors[0])}e=1}else{l=l.clone();
|
|
|
+l.lerpSelf(p,0.5);x.a=f;x.b=g;x.c=j;s.a=j;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);x.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);x.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}w.push(x,s);a.vertices.push(l);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){l=a.faceVertexUvs[f][c];s=l[0];h=l[1];x=l[2];if(e===
|
|
|
+0){k=s.clone();k.lerpSelf(h,0.5);l=[s.clone(),k.clone(),x.clone()];h=[k.clone(),h.clone(),x.clone()]}else if(e===1){k=h.clone();k.lerpSelf(x,0.5);l=[s.clone(),h.clone(),k.clone()];h=[k.clone(),x.clone(),s.clone()]}else{k=s.clone();k.lerpSelf(x,0.5);l=[s.clone(),h.clone(),k.clone()];h=[k.clone(),h.clone(),x.clone()]}F[f].push(l,h)}}else{w.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;j=e.d;l=a.vertices[f];k=a.vertices[g];p=a.vertices[h];m=
|
|
|
+a.vertices[j];o=l.distanceTo(k);q=k.distanceTo(p);n=p.distanceTo(m);r=l.distanceTo(m);if(o>b||q>b||n>b||r>b){u=a.vertices.length;t=a.vertices.length+1;x=e.clone();s=e.clone();if(o>=q&&o>=n&&o>=r||n>=q&&n>=o&&n>=r){o=l.clone();o.lerpSelf(k,0.5);k=p.clone();k.lerpSelf(m,0.5);x.a=f;x.b=u;x.c=t;x.d=j;s.a=u;s.b=g;s.c=h;s.d=t;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);x.vertexNormals[1].copy(f);
|
|
|
+x.vertexNormals[2].copy(g);s.vertexNormals[0].copy(f);s.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);x.vertexColors[1].copy(f);x.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{o=k.clone();o.lerpSelf(p,0.5);k=m.clone();k.lerpSelf(l,0.5);x.a=f;x.b=g;x.c=u;x.d=t;s.a=t;s.b=u;s.c=h;s.d=j;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
|
|
|
+f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);x.vertexNormals[2].copy(f);x.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);x.vertexColors[2].copy(f);x.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}w.push(x,s);a.vertices.push(o,k);
|
|
|
+f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){l=a.faceVertexUvs[f][c];s=l[0];h=l[1];x=l[2];l=l[3];if(e===0){k=s.clone();k.lerpSelf(h,0.5);p=x.clone();p.lerpSelf(l,0.5);s=[s.clone(),k.clone(),p.clone(),l.clone()];h=[k.clone(),h.clone(),x.clone(),p.clone()]}else{k=h.clone();k.lerpSelf(x,0.5);p=l.clone();p.lerpSelf(s,0.5);s=[s.clone(),h.clone(),k.clone(),p.clone()];h=[p.clone(),k.clone(),x.clone(),l.clone()]}F[f].push(s,h)}}else{w.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)F[f].push(a.faceVertexUvs[f][c])}}}a.faces=
|
|
|
+w;a.faceVertexUvs=F}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=true;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),b=e.loadCount=0;for(d=a.length;b<d;++b){e[b]=new Image;e[b].onload=function(){e.loadCount=e.loadCount+1;if(e.loadCount===6)f.needsUpdate=true;c&&c(this)};e[b].crossOrigin=this.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,j=g.createImageData(d,e),k=j.data,l=0;l<d;l++)for(var p=1;p<e;p++){var m=p-1<0?e-1:p-1,o=(p+1)%e,r=l-1<0?d-1:l-1,n=(l+1)%d,q=[],u=[0,0,h[(p*d+l)*4]/255*b];q.push([-1,0,h[(p*d+r)*4]/255*b]);q.push([-1,-1,h[(m*d+r)*4]/255*b]);q.push([0,-1,
|
|
|
-h[(m*d+l)*4]/255*b]);q.push([1,-1,h[(m*d+n)*4]/255*b]);q.push([1,0,h[(p*d+n)*4]/255*b]);q.push([1,1,h[(o*d+n)*4]/255*b]);q.push([0,1,h[(o*d+l)*4]/255*b]);q.push([-1,1,h[(o*d+r)*4]/255*b]);m=[];r=q.length;for(o=0;o<r;o++){var n=q[o],t=q[(o+1)%r],n=[n[0]-u[0],n[1]-u[1],n[2]-u[2]],t=[t[0]-u[0],t[1]-u[1],t[2]-u[2]];m.push(c([n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]))}q=[0,0,0];for(o=0;o<m.length;o++){q[0]=q[0]+m[o][0];q[1]=q[1]+m[o][1];q[2]=q[2]+m[o][2]}q[0]=q[0]/m.length;q[1]=q[1]/
|
|
|
-m.length;q[2]=q[2]/m.length;u=(p*d+l)*4;k[u]=(q[0]+1)/2*255|0;k[u+1]=(q[1]+0.5)*255|0;k[u+2]=q[2]*255|0;k[u+3]=255}g.putImageData(j,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=true;return 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,j=g.createImageData(d,e),l=j.data,k=0;k<d;k++)for(var p=1;p<e;p++){var m=p-1<0?e-1:p-1,o=(p+1)%e,q=k-1<0?d-1:k-1,n=(k+1)%d,r=[],u=[0,0,h[(p*d+k)*4]/255*b];r.push([-1,0,h[(p*d+q)*4]/255*b]);r.push([-1,-1,h[(m*d+q)*4]/255*b]);r.push([0,-1,
|
|
|
+h[(m*d+k)*4]/255*b]);r.push([1,-1,h[(m*d+n)*4]/255*b]);r.push([1,0,h[(p*d+n)*4]/255*b]);r.push([1,1,h[(o*d+n)*4]/255*b]);r.push([0,1,h[(o*d+k)*4]/255*b]);r.push([-1,1,h[(o*d+q)*4]/255*b]);m=[];q=r.length;for(o=0;o<q;o++){var n=r[o],t=r[(o+1)%q],n=[n[0]-u[0],n[1]-u[1],n[2]-u[2]],t=[t[0]-u[0],t[1]-u[1],t[2]-u[2]];m.push(c([n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]))}r=[0,0,0];for(o=0;o<m.length;o++){r[0]=r[0]+m[o][0];r[1]=r[1]+m[o][1];r[2]=r[2]+m[o][2]}r[0]=r[0]/m.length;r[1]=r[1]/
|
|
|
+m.length;r[2]=r[2]/m.length;u=(p*d+k)*4;l[u]=(r[0]+1)/2*255|0;l[u+1]=(r[1]+0.5)*255|0;l[u+2]=r[2]*255|0;l[u+3]=255}g.putImageData(j,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=true;return a}};
|
|
|
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;if(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}else if(a instanceof THREE.SkinnedMesh)b=new THREE.SkinnedMesh(a.geometry,a.material);else if(a instanceof THREE.Mesh)b=new THREE.Mesh(a.geometry,a.material);else if(a instanceof THREE.Line)b=new THREE.Line(a.geometry,a.material,a.type);else if(a instanceof THREE.Ribbon)b=new THREE.Ribbon(a.geometry,a.material);
|
|
|
else if(a instanceof THREE.ParticleSystem){b=new THREE.ParticleSystem(a.geometry,a.material);b.sortParticles=a.sortParticles}else if(a instanceof THREE.Particle)b=new THREE.Particle(a.material);else if(a instanceof THREE.Sprite){b=new THREE.Sprite({});b.color.copy(a.color);b.map=a.map;b.blending=a.blending;b.useScreenCoordinates=a.useScreenCoordinates;b.mergeWith3D=a.mergeWith3D;b.affectedByDistance=a.affectedByDistance;b.scaleByViewport=a.scaleByViewport;b.alignment=a.alignment;b.rotation3d.copy(a.rotation3d);
|
|
@@ -457,37 +457,37 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.s
|
|
|
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),h=this.actions[this.actions.length-1],h=new THREE.ArcCurve(h.x+a,h.y+b,c,d,e,f);this.curves.push(h);h=h.getPoint(f?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};
|
|
|
THREE.Path.prototype.absarc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=new THREE.ArcCurve(a,b,c,d,e,f);this.curves.push(h);h=h.getPoint(f?1:0);g.push(h.x);g.push(h.y);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){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,j,k,l,p,m,o,r,n;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];j=f[3];p=f[0];m=f[1];if(c.length>0){g=c[c.length-1];
|
|
|
-o=g.x;r=g.y}else{g=this.actions[d-1].args;o=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b2(n,o,p,h);n=THREE.Shape.Utils.b2(n,r,m,j);c.push(new THREE.Vector2(g,n))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];j=f[5];p=f[0];m=f[1];k=f[2];l=f[3];if(c.length>0){g=c[c.length-1];o=g.x;r=g.y}else{g=this.actions[d-1].args;o=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b3(n,o,p,k,h);n=THREE.Shape.Utils.b3(n,r,m,l,j);c.push(new THREE.Vector2(g,
|
|
|
-n))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=g;f++)c.push(n.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];j=f[1];k=f[2];p=f[3];m=!!f[5];l=f[4]-p;o=a*2;for(f=1;f<=o;f++){n=f/o;m||(n=1-n);n=p+n*l;g=h+k*Math.cos(n);n=j+k*Math.sin(n);c.push(new THREE.Vector2(g,n))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-
|
|
|
-1,1);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,j,k,l,p;h=0;for(j=g.length;h<j;h++){k=g[h];l=k.x;p=k.y;k.x=a*l+b*p+c;k.y=d*p+e*l+f}return g};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,j,l,k,p,m,o,q,n;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];j=f[3];p=f[0];m=f[1];if(c.length>0){g=c[c.length-1];
|
|
|
+o=g.x;q=g.y}else{g=this.actions[d-1].args;o=g[g.length-2];q=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b2(n,o,p,h);n=THREE.Shape.Utils.b2(n,q,m,j);c.push(new THREE.Vector2(g,n))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];j=f[5];p=f[0];m=f[1];l=f[2];k=f[3];if(c.length>0){g=c[c.length-1];o=g.x;q=g.y}else{g=this.actions[d-1].args;o=g[g.length-2];q=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b3(n,o,p,l,h);n=THREE.Shape.Utils.b3(n,q,m,k,j);c.push(new THREE.Vector2(g,
|
|
|
+n))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=g;f++)c.push(n.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];j=f[1];l=f[2];p=f[3];m=!!f[5];k=f[4]-p;o=a*2;for(f=1;f<=o;f++){n=f/o;m||(n=1-n);n=p+n*k;g=h+l*Math.cos(n);n=j+l*Math.sin(n);c.push(new THREE.Vector2(g,n))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-
|
|
|
+1,1);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,j,l,k,p;h=0;for(j=g.length;h<j;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();if(!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,a=0;for(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();a=0;for(c=d.length;a<c;a++){e=d[a];b.beginPath();b.arc(e.x,e.y,1.5,0,Math.PI*2,false);b.stroke();b.closePath()}};
|
|
|
THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++){c=this.actions[a];d=c.args;c=c.action;if(c==THREE.PathActions.MOVE_TO&&f.actions.length!=0){e.push(f);f=new THREE.Path}f[c].apply(f,d)}f.actions.length!=0&&e.push(f);if(e.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(e.length==1){f=e[0];g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
|
|
|
b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g.actions=f.actions;g.curves=f.curves;d.push(g);g=new THREE.Shape}else g.holes.push(f)}}else{a=0;for(b=e.length;a<b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves}else g.holes.push(f)}d.push(g)}return d};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.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(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,j,k,l,p,m,o,r=[];for(j=0;j<b.length;j++){k=b[j];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){m=k[e];o=[];for(p=0;p<c.length;p++){l=c[p];l=m.distanceToSquared(l);o.push(l);if(l<f){f=l;g=e;h=p}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;var n=[k[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(n);var q=[k[g],k[f],c[h]];m=THREE.FontUtils.Triangulate.area(q);o=h;l=g;h=h+1;g=g+
|
|
|
--1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+k.length);g=g%k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;n=[k[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[k[g],k[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(p+m>n+q){h=o;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+k.length);g=g%k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1}p=c.slice(0,h);m=c.slice(h);o=k.slice(g);l=k.slice(0,g);f=[k[g],k[f],c[h]];r.push([k[g],c[h],c[e]]);r.push(f);c=p.concat(o).concat(l).concat(m)}return{shape:c,
|
|
|
-isolatedPts:r,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,false),f,g,h,j,k={};f=0;for(g=d.length;f<g;f++){j=d[f].x+":"+d[f].y;k[j]!==void 0&&console.log("Duplicate point",j);k[j]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=k[j];j!==void 0&&(h[d]=j)}}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=k[j];j!==void 0&&(h[d]=j)}}return c.concat(e)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,j,l,k,p,m,o,q=[];for(j=0;j<b.length;j++){l=b[j];Array.prototype.push.apply(d,l);f=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){m=l[e];o=[];for(p=0;p<c.length;p++){k=c[p];k=m.distanceToSquared(k);o.push(k);if(k<f){f=k;g=e;h=p}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:l.length-1;var n=[l[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(n);var r=[l[g],l[f],c[h]];m=THREE.FontUtils.Triangulate.area(r);o=h;k=g;h=h+1;g=g+
|
|
|
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+l.length);g=g%l.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:l.length-1;n=[l[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);r=[l[g],l[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);if(p+m>n+r){h=o;g=k;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+l.length);g=g%l.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:l.length-1}p=c.slice(0,h);m=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(m)}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,false),f,g,h,j,l={};f=0;for(g=d.length;f<g;f++){j=d[f].x+":"+d[f].y;l[j]!==void 0&&console.log("Duplicate point",j);l[j]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=l[j];j!==void 0&&(h[d]=j)}}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++){j=h[d].x+":"+h[d].y;j=l[j];j!==void 0&&(h[d]=j)}}return c.concat(e)},
|
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},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=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",f=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f};
|
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
|
|
|
THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==true){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<
|
|
|
-0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++){var k=a.hierarchy[c].keys[d].morphTargets[j];h[k]=-1}a.hierarchy[c].usedMorphTargets=
|
|
|
-h;for(d=0;d<a.hierarchy[c].keys.length;d++){var l={};for(k in h){for(j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++)if(a.hierarchy[c].keys[d].morphTargets[j]===k){l[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[j];break}j===a.hierarchy[c].keys[d].morphTargets.length&&(l[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time){a.hierarchy[c].keys.splice(d,1);d--}for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
|
|
|
+0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++){var l=a.hierarchy[c].keys[d].morphTargets[j];h[l]=-1}a.hierarchy[c].usedMorphTargets=
|
|
|
+h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k={};for(l in h){for(j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++)if(a.hierarchy[c].keys[d].morphTargets[j]===l){k[l]=a.hierarchy[c].keys[d].morphTargetsInfluences[j];break}j===a.hierarchy[c].keys[d].morphTargets.length&&(k[l]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time){a.hierarchy[c].keys.splice(d,1);d--}for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
|
|
|
d}d=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=true}},get:function(a){if(typeof a==="string"){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],
|
|
|
b)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:true;this.points=[];this.target=new THREE.Vector3};
|
|
|
THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=true;e.matrixAutoUpdate=true;if(e.animationCache===void 0){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
|
|
|
e instanceof 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=false;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=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0){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,j,k,l=this.data.JIT.hierarchy,p,m;m=this.currentTime=this.currentTime+a*this.timeScale;p=this.currentTime=this.currentTime%this.data.length;k=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,r=this.hierarchy.length;o<r;o++){a=this.hierarchy[o];j=a.animationCache;if(this.JITCompile&&l[o][k]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=l[o][k];a.matrixAutoUpdate=
|
|
|
-false;a.matrixWorldNeedsUpdate=false}else{a.matrix=l[o][k];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;n<3;n++){c=b[n];g=j.prevKey[c];h=j.nextKey[c];if(h.time<=m){if(p<m)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,
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,j,l,k=this.data.JIT.hierarchy,p,m;m=this.currentTime=this.currentTime+a*this.timeScale;p=this.currentTime=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++){a=this.hierarchy[o];j=a.animationCache;if(this.JITCompile&&k[o][l]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=k[o][l];a.matrixAutoUpdate=
|
|
|
+false;a.matrixWorldNeedsUpdate=false}else{a.matrix=k[o][l];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;n<3;n++){c=b[n];g=j.prevKey[c];h=j.nextKey[c];if(h.time<=m){if(p<m)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)}j.prevKey[c]=g;j.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(p-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o);d=d<0?0:1}if(c==="pos"){c=a.position;if(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){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=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);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(c==="rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){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&&l[0][k]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(o=0;o<this.hierarchy.length;o++)l[o][k]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,j,k;e=(a.length-1)*b;f=Math.floor(e);e=e-f;c[0]=f===0?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]];j=a[c[2]];k=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],j[0],k[0],e,c,g);d[1]=this.interpolate(f[1],h[1],j[1],k[1],e,c,g);d[2]=this.interpolate(f[2],h[2],j[2],k[2],e,c,g);return d};
|
|
|
+this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){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&&k[0][l]===void 0){this.hierarchy[0].updateMatrixWorld(true);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.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,j,l;e=(a.length-1)*b;f=Math.floor(e);e=e-f;c[0]=f===0?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]];j=a[c[2]];l=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],j[0],l[0],e,c,g);d[1]=this.interpolate(f[1],h[1],j[1],l[1],e,c,g);d[2]=this.interpolate(f[2],h[2],j[2],l[2],e,c,g);return d};
|
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;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(d[c][a]!==void 0)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?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
|
|
|
THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=
|
|
@@ -495,9 +495,9 @@ false;this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}
|
|
|
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey=null;f.animationCache.nextKey=null;f.animationCache.originalMatrix=e instanceof THREE.Bone?
|
|
|
e.skinMatrix:e.matrix}e=this.data.hierarchy[c].keys;if(e.length){f.animationCache.prevKey=e[0];f.animationCache.nextKey=e[1];this.startTime=Math.min(e[0].time,this.startTime);this.endTime=Math.max(e[e.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(b instanceof THREE.Bone){d.copy(b.skinMatrix);b.skinMatrix=d}else{d.copy(b.matrix);b.matrix=d}delete c.animationCache}}};
|
|
|
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,j;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=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((j=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=
|
|
|
-this.hierarchy[a];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,p=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
|
|
|
-true}else if(l.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(j&&this.loop){b=l[0];for(c=l[1];c.time<g;){b=c;c=l[b.index+1]}}else if(!j)for(var m=l.length-1;c.time<g&&c.index!==m;){b=c;c=l[b.index+1]}p.prevKey=b;p.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
|
|
|
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,j;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=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((j=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=true}}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&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
|
|
|
+true}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(j&&this.loop){b=k[0];for(c=k[1];c.time<g;){b=c;c=k[b.index+1]}}else if(!j)for(var m=k.length-1;c.time<g&&c.index!==m;){b=c;c=k[b.index+1]}p.prevKey=b;p.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
|
|
|
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=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=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
|
|
|
THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
|
|
@@ -519,7 +519,7 @@ this.moveRight&&this.object.translateX(b);this.moveUp&&this.object.translateY(b)
|
|
|
Math.sin(this.theta);b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon=this.lon+this.mouseX*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*a*b;this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+
|
|
|
100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),false);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),false);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",
|
|
|
c(this,this.onKeyUp),false)};
|
|
|
-THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,u=0;f=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++){u=d*h.chunks[f]/h.total;b.keys[f]={time:u,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
|
|
|
+THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,u=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<r-1;f++){u=d*h.chunks[f]/h.total;b.keys[f]={time:u,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
|
|
|
return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++){d=c/(a.points.length*b);d=a.getPoint(d);e.vertices[c]=new THREE.Vertex(d.x,d.y,d.z)}return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
|
|
|
this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=
|
|
|
this.domElement.offsetHeight/2;this.domElement.setAttribute("tabindex",-1)}var g=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*this.lookSpeed*a;this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=a>=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
|
|
@@ -537,74 +537,74 @@ false;break;case 2:this.moveBackward=false}this.updateRotationVector()};this.upd
|
|
|
this.object.matrixWorldNeedsUpdate=true};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),false);this.domElement.addEventListener("mousedown",c(this,this.mousedown),false);this.domElement.addEventListener("mouseup",
|
|
|
c(this,this.mouseup),false);this.domElement.addEventListener("keydown",c(this,this.keydown),false);this.domElement.addEventListener("keyup",c(this,this.keyup),false);this.updateMovementVector();this.updateRotationVector()};
|
|
|
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;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=false,h=1,j=0,k=0,l=0,p=0,m=0,o=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=
|
|
|
-a*this.lookSpeed;this.rotateHorizontally(b*p);this.rotateVertically(b*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(j>0||this.autoForward&&!(j<0)?1:j));this.object.translateX(b*k);this.object.translateY(b*l);if(g)this.roll=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);
|
|
|
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;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=false,h=1,j=0,l=0,k=0,p=0,m=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*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(j>0||this.autoForward&&!(j<0)?1:j));this.object.translateX(b*l);this.object.translateY(b*k);if(g)this.roll=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.elements[0]=c.x;this.object.matrix.elements[4]=d.x;this.object.matrix.elements[8]=e.x;this.object.matrix.elements[1]=c.y;this.object.matrix.elements[5]=d.y;this.object.matrix.elements[9]=e.y;this.object.matrix.elements[2]=c.z;this.object.matrix.elements[6]=d.z;this.object.matrix.elements[10]=e.z;f.identity();f.elements[0]=Math.cos(this.roll);f.elements[4]=-Math.sin(this.roll);f.elements[1]=Math.sin(this.roll);f.elements[5]=
|
|
|
Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=true;this.object.matrix.elements[12]=this.object.position.x;this.object.matrix.elements[13]=this.object.position.y;this.object.matrix.elements[14]=this.object.position.z};this.translateX=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[0]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[1]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[2]*
|
|
|
a};this.translateY=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[4]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[5]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[6]*a};this.translateZ=function(a){this.object.position.x=this.object.position.x-this.object.matrix.elements[8]*a;this.object.position.y=this.object.position.y-this.object.matrix.elements[9]*a;this.object.position.z=this.object.position.z-
|
|
|
this.object.matrix.elements[10]*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.elements[0],this.object.matrix.elements[1],this.object.matrix.elements[2]);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.elements[4],this.object.matrix.elements[5],this.object.matrix.elements[6]);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
|
|
|
-false);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-o)/window.innerWidth;m=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=1;break;case 2:j=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=0;break;case 2:j=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:j=
|
|
|
-1;break;case 37:case 65:k=-1;break;case 40:case 83:j=-1;break;case 39:case 68:k=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:l=1;break;case 70:l=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:j=0;break;case 37:case 65:k=0;break;case 40:case 83:j=0;break;case 39:case 68:k=0;break;case 81:g=false;break;case 69:g=false;break;case 82:l=0;break;case 70:l=0}},false)};
|
|
|
+false);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-o)/window.innerWidth;m=(a.clientY-q)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=1;break;case 2:j=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=0;break;case 2:j=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:j=
|
|
|
+1;break;case 37:case 65:l=-1;break;case 40:case 83:j=-1;break;case 39:case 68:l=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:k=1;break;case 70:k=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:j=0;break;case 37:case 65:l=0;break;case 40:case 83:j=0;break;case 39:case 68:l=0;break;case 81:g=false;break;case 69:g=false;break;case 82:k=0;break;case 70:k=0}},false)};
|
|
|
THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=b!==void 0?b:document;this.enabled=true;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=false;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];
|
|
|
-this.target=new THREE.Vector3;var d=new THREE.Vector3,e=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector2,l=new THREE.Vector2,p=new THREE.Vector2,m=new THREE.Vector2,o={type:"change"};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
|
|
|
+this.target=new THREE.Vector3;var d=new THREE.Vector3,e=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector2,k=new THREE.Vector2,p=new THREE.Vector2,m=new THREE.Vector2,o={type:"change"};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
|
|
|
c.screen.width*0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(j)/h.length()/j.length());if(a){var b=(new THREE.Vector3).cross(h,j).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
|
|
|
-d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(j);if(c.staticMoving)h=j;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-k.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?k=l:k.y=k.y+(l.y-k.y)*this.dynamicDampingFactor}};this.panCamera=function(){var a=m.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);
|
|
|
+d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(j);if(c.staticMoving)h=j;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(k.y-l.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?l=k:l.y=l.y+(k.y-l.y)*this.dynamicDampingFactor}};this.panCamera=function(){var a=m.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);
|
|
|
b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?p=m:p.addSelf(a.sub(m,p).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan){c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance);g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))}};this.update=function(){g.copy(c.object.position).subSelf(c.target);
|
|
|
-c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(o);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY);k=l=c.getMouseOnScreen(a.clientX,a.clientY);p=
|
|
|
-m=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?k=l=c.getMouseOnScreen(a.clientX,
|
|
|
+c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(o);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY);l=k=c.getMouseOnScreen(a.clientX,a.clientY);p=
|
|
|
+m=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=k=c.getMouseOnScreen(a.clientX,
|
|
|
a.clientY):this.noPan||(p=m=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();f=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&f===-1){a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2);f!==-1&&(e=true)}},false);window.addEventListener("keyup",function(){c.enabled&&f!==-1&&(f=-1)},false)};
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function j(a,b,c,g,h,j,l,m){var n,o=d||1,p=e||1,r=h/2,q=j/2,t=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=f||1}var i=o+1,u=p+1,y=h/o,H=j/p,W=new THREE.Vector3;W[n]=l>0?1:-1;for(h=0;h<u;h++)for(j=0;j<i;j++){var G=new THREE.Vertex;G[a]=(j*y-r)*c;G[b]=(h*H-q)*g;G[n]=l;k.vertices.push(G)}for(h=0;h<p;h++)for(j=0;j<o;j++){a=new THREE.Face4(j+
|
|
|
-i*h+t,j+i*(h+1)+t,j+1+i*(h+1)+t,j+1+i*h+t);a.normal.copy(W);a.vertexNormals.push(W.clone(),W.clone(),W.clone(),W.clone());a.materialIndex=m;k.faces.push(a);k.faceVertexUvs[0].push([new THREE.UV(j/o,h/p),new THREE.UV(j/o,(h+1)/p),new THREE.UV((j+1)/o,(h+1)/p),new THREE.UV((j+1)/o,h/p)])}}THREE.Geometry.call(this);var k=this,l=a/2,p=b/2,m=c/2,o,r,n,q,u,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(g)}o=0;q=1;r=2;u=3;n=4;t=5}else this.materials=
|
|
|
-[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var y in h)this.sides[y]!==void 0&&(this.sides[y]=h[y]);this.sides.px&&j("z","y",-1,-1,c,b,l,o);this.sides.nx&&j("z","y",1,-1,c,b,-l,q);this.sides.py&&j("x","z",1,1,a,c,p,r);this.sides.ny&&j("x","z",1,-1,a,c,-p,u);this.sides.pz&&j("x","y",1,-1,a,b,m,n);this.sides.nz&&j("x","y",-1,-1,a,b,-m,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function j(a,b,c,g,h,j,k,m){var n,o=d||1,p=e||1,q=h/2,r=j/2,t=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=f||1}var i=o+1,u=p+1,x=h/o,A=j/p,X=new THREE.Vector3;X[n]=k>0?1:-1;for(h=0;h<u;h++)for(j=0;j<i;j++){var H=new THREE.Vertex;H[a]=(j*x-q)*c;H[b]=(h*A-r)*g;H[n]=k;l.vertices.push(H)}for(h=0;h<p;h++)for(j=0;j<o;j++){a=new THREE.Face4(j+
|
|
|
+i*h+t,j+i*(h+1)+t,j+1+i*(h+1)+t,j+1+i*h+t);a.normal.copy(X);a.vertexNormals.push(X.clone(),X.clone(),X.clone(),X.clone());a.materialIndex=m;l.faces.push(a);l.faceVertexUvs[0].push([new THREE.UV(j/o,h/p),new THREE.UV(j/o,(h+1)/p),new THREE.UV((j+1)/o,(h+1)/p),new THREE.UV((j+1)/o,h/p)])}}THREE.Geometry.call(this);var l=this,k=a/2,p=b/2,m=c/2,o,q,n,r,u,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(g)}o=0;r=1;q=2;u=3;n=4;t=5}else this.materials=
|
|
|
+[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var x in h)this.sides[x]!==void 0&&(this.sides[x]=h[x]);this.sides.px&&j("z","y",-1,-1,c,b,k,o);this.sides.nx&&j("z","y",1,-1,c,b,-k,r);this.sides.py&&j("x","z",1,1,a,c,p,q);this.sides.ny&&j("x","z",1,-1,a,c,-p,u);this.sides.pz&&j("x","y",1,-1,a,b,m,n);this.sides.nz&&j("x","y",-1,-1,a,b,-m,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=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,j,k=[],l=[];for(j=0;j<=e;j++){var p=[],m=[],o=j/e,r=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=r*Math.sin(n*Math.PI*2),u=-o*c+g,t=r*Math.cos(n*Math.PI*2);this.vertices.push(new THREE.Vertex(q,u,t));p.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}k.push(p);l.push(m)}for(j=0;j<e;j++)for(h=0;h<d;h++){var c=k[j][h],p=k[j+1][h],m=k[j+1][h+1],o=k[j][h+
|
|
|
-1],r=this.vertices[c].clone().setY(0).normalize(),n=this.vertices[p].clone().setY(0).normalize(),q=this.vertices[m].clone().setY(0).normalize(),u=this.vertices[o].clone().setY(0).normalize(),t=l[j][h].clone(),y=l[j+1][h].clone(),s=l[j+1][h+1].clone(),x=l[j][h+1].clone();this.faces.push(new THREE.Face4(c,p,m,o,[r,n,q,u]));this.faceVertexUvs[0].push([t,y,s,x])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(0,g,0));for(h=0;h<d;h++){c=k[0][h];p=k[0][h+1];m=this.vertices.length-1;r=new THREE.Vector3(0,
|
|
|
-1,0);n=new THREE.Vector3(0,1,0);q=new THREE.Vector3(0,1,0);t=l[0][h].clone();y=l[0][h+1].clone();s=new THREE.UV(y.u,0);this.faces.push(new THREE.Face3(c,p,m,[r,n,q]));this.faceVertexUvs[0].push([t,y,s])}}if(!f&&b>0){this.vertices.push(new THREE.Vertex(0,-g,0));for(h=0;h<d;h++){c=k[j][h+1];p=k[j][h];m=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);n=new THREE.Vector3(0,-1,0);q=new THREE.Vector3(0,-1,0);t=l[j][h+1].clone();y=l[j][h].clone();s=new THREE.UV(y.u,1);this.faces.push(new THREE.Face3(c,
|
|
|
-p,m,[r,n,q]));this.faceVertexUvs[0].push([t,y,s])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,j,l=[],k=[];for(j=0;j<=e;j++){var p=[],m=[],o=j/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,r=q*Math.sin(n*Math.PI*2),u=-o*c+g,t=q*Math.cos(n*Math.PI*2);this.vertices.push(new THREE.Vertex(r,u,t));p.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}l.push(p);k.push(m)}for(j=0;j<e;j++)for(h=0;h<d;h++){var c=l[j][h],p=l[j+1][h],m=l[j+1][h+1],o=l[j][h+
|
|
|
+1],q=this.vertices[c].clone().setY(0).normalize(),n=this.vertices[p].clone().setY(0).normalize(),r=this.vertices[m].clone().setY(0).normalize(),u=this.vertices[o].clone().setY(0).normalize(),t=k[j][h].clone(),x=k[j+1][h].clone(),s=k[j+1][h+1].clone(),w=k[j][h+1].clone();this.faces.push(new THREE.Face4(c,p,m,o,[q,n,r,u]));this.faceVertexUvs[0].push([t,x,s,w])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(0,g,0));for(h=0;h<d;h++){c=l[0][h];p=l[0][h+1];m=this.vertices.length-1;q=new THREE.Vector3(0,
|
|
|
+1,0);n=new THREE.Vector3(0,1,0);r=new THREE.Vector3(0,1,0);t=k[0][h].clone();x=k[0][h+1].clone();s=new THREE.UV(x.u,0);this.faces.push(new THREE.Face3(c,p,m,[q,n,r]));this.faceVertexUvs[0].push([t,x,s])}}if(!f&&b>0){this.vertices.push(new THREE.Vertex(0,-g,0));for(h=0;h<d;h++){c=l[j][h+1];p=l[j][h];m=this.vertices.length-1;q=new THREE.Vector3(0,-1,0);n=new THREE.Vector3(0,-1,0);r=new THREE.Vector3(0,-1,0);t=k[j][h+1].clone();x=k[j][h].clone();s=new THREE.UV(x.u,1);this.faces.push(new THREE.Face3(c,
|
|
|
+p,m,[q,n,r]));this.faceVertexUvs[0].push([t,x,s])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
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);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){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=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(G=c.length;--G>=0;){e=G;f=G-1;f<0&&(f=
|
|
|
-c.length-1);for(var g=0,h=m+l*2,g=0;g<h;g++){var i=E*g,j=E*(g+1),k=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,o=c,p=g,r=h,k=k+K,i=i+K,n=n+K,j=j+K;C.faces.push(new THREE.Face4(k,i,n,j,null,null,t));k=R.generateSideWallUV(C,a,o,b,k,i,n,j,p,r);C.faceVertexUvs[0].push(k)}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(a,b,c))}function g(c,d,e,f){c=c+K;d=d+K;e=e+K;C.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?R.generateBottomUV(C,a,b,c,d,e):R.generateTopUV(C,a,b,c,d,e);C.faceVertexUvs[0].push(c)}var h=
|
|
|
-b.amount!==void 0?b.amount:100,j=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:j-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,p=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,o=b.bendPath,r=b.extrudePath,n,q=false,u=b.material,t=b.extrudeMaterial,y,s,x,D;if(r){n=r.getSpacedPoints(m);q=true;p=false;y=new THREE.TubeGeometry.FrenetFrames(r,m,false);s=new THREE.Vector3;x=new THREE.Vector3;D=new THREE.Vector3}if(!p)k=j=l=0;var B,w,v,C=this,
|
|
|
-K=this.vertices.length;o&&a.addWrapPath(o);var r=a.extractPoints(),o=r.shape,L=r.holes;if(r=!THREE.Shape.Utils.isClockWise(o)){o=o.reverse();w=0;for(v=L.length;w<v;w++){B=L[w];THREE.Shape.Utils.isClockWise(B)&&(L[w]=B.reverse())}r=false}var T=THREE.Shape.Utils.triangulateShape(o,L),P=o;w=0;for(v=L.length;w<v;w++){B=L[w];o=o.concat(B)}var J,N,F,i,U,E=o.length,H,W=T.length,r=[],G=0;F=P.length;J=F-1;for(N=G+1;G<F;G++,J++,N++){J===F&&(J=0);N===F&&(N=0);r[G]=d(P[G],P[J],P[N])}var ha=[],fa,la=r.concat();
|
|
|
-w=0;for(v=L.length;w<v;w++){B=L[w];fa=[];G=0;F=B.length;J=F-1;for(N=G+1;G<F;G++,J++,N++){J===F&&(J=0);N===F&&(N=0);fa[G]=d(B[G],B[J],B[N])}ha.push(fa);la=la.concat(fa)}for(J=0;J<l;J++){F=J/l;i=j*(1-F);N=k*Math.sin(F*Math.PI/2);G=0;for(F=P.length;G<F;G++){U=c(P[G],r[G],N);f(U.x,U.y,-i)}w=0;for(v=L.length;w<v;w++){B=L[w];fa=ha[w];G=0;for(F=B.length;G<F;G++){U=c(B[G],fa[G],N);f(U.x,U.y,-i)}}}N=k;for(G=0;G<E;G++){U=p?c(o[G],la[G],N):o[G];if(q){x.copy(y.normals[0]).multiplyScalar(U.x);s.copy(y.binormals[0]).multiplyScalar(U.y);
|
|
|
-D.copy(n[0]).addSelf(x).addSelf(s);f(D.x,D.y,D.z)}else f(U.x,U.y,0)}for(F=1;F<=m;F++)for(G=0;G<E;G++){U=p?c(o[G],la[G],N):o[G];if(q){x.copy(y.normals[F]).multiplyScalar(U.x);s.copy(y.binormals[F]).multiplyScalar(U.y);D.copy(n[F]).addSelf(x).addSelf(s);f(D.x,D.y,D.z)}else f(U.x,U.y,h/m*F)}for(J=l-1;J>=0;J--){F=J/l;i=j*(1-F);N=k*Math.sin(F*Math.PI/2);G=0;for(F=P.length;G<F;G++){U=c(P[G],r[G],N);f(U.x,U.y,h+i)}w=0;for(v=L.length;w<v;w++){B=L[w];fa=ha[w];G=0;for(F=B.length;G<F;G++){U=c(B[G],fa[G],N);
|
|
|
-q?f(U.x,U.y+n[m-1].y,n[m-1].x+i):f(U.x,U.y,h+i)}}}var R=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(p){var a;a=E*0;for(G=0;G<W;G++){H=T[G];g(H[2]+a,H[1]+a,H[0]+a,true)}a=m+l*2;a=E*a;for(G=0;G<W;G++){H=T[G];g(H[0]+a,H[1]+a,H[2]+a,false)}}else{for(G=0;G<W;G++){H=T[G];g(H[2],H[1],H[0],true)}for(G=0;G<W;G++){H=T[G];g(H[0]+E*m,H[1]+E*m,H[2]+E*m,false)}}})();(function(){var a=0;e(P,a);a=a+P.length;w=0;for(v=L.length;w<v;w++){B=L[w];e(B,a);a=a+B.length}})()};
|
|
|
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,j=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,l=
|
|
|
-a.vertices[g].y,g=a.vertices[g].z,p=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-j)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(k,g),new THREE.UV(p,a)]:[new THREE.UV(c,e),new THREE.UV(j,f),new THREE.UV(l,g),new THREE.UV(m,a)]}};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;
|
|
|
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){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=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(H=c.length;--H>=0;){e=H;f=H-1;f<0&&(f=
|
|
|
+c.length-1);for(var g=0,h=m+k*2,g=0;g<h;g++){var i=V*g,j=V*(g+1),l=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,o=c,p=g,q=h,l=l+J,i=i+J,n=n+J,j=j+J;C.faces.push(new THREE.Face4(l,i,n,j,null,null,t));l=Q.generateSideWallUV(C,a,o,b,l,i,n,j,p,q);C.faceVertexUvs[0].push(l)}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(a,b,c))}function g(c,d,e,f){c=c+J;d=d+J;e=e+J;C.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?Q.generateBottomUV(C,a,b,c,d,e):Q.generateTopUV(C,a,b,c,d,e);C.faceVertexUvs[0].push(c)}var h=
|
|
|
+b.amount!==void 0?b.amount:100,j=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:j-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,p=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,o=b.bendPath,q=b.extrudePath,n,r=false,u=b.material,t=b.extrudeMaterial,x,s,w,F;if(q){n=q.getSpacedPoints(m);r=true;p=false;x=new THREE.TubeGeometry.FrenetFrames(q,m,false);s=new THREE.Vector3;w=new THREE.Vector3;F=new THREE.Vector3}if(!p)l=j=k=0;var E,z,v,C=this,
|
|
|
+J=this.vertices.length;o&&a.addWrapPath(o);var q=a.extractPoints(),o=q.shape,L=q.holes;if(q=!THREE.Shape.Utils.isClockWise(o)){o=o.reverse();z=0;for(v=L.length;z<v;z++){E=L[z];THREE.Shape.Utils.isClockWise(E)&&(L[z]=E.reverse())}q=false}var W=THREE.Shape.Utils.triangulateShape(o,L),P=o;z=0;for(v=L.length;z<v;z++){E=L[z];o=o.concat(E)}var B,M,G,i,T,V=o.length,A,X=W.length,q=[],H=0;G=P.length;B=G-1;for(M=H+1;H<G;H++,B++,M++){B===G&&(B=0);M===G&&(M=0);q[H]=d(P[H],P[B],P[M])}var da=[],ga,la=q.concat();
|
|
|
+z=0;for(v=L.length;z<v;z++){E=L[z];ga=[];H=0;G=E.length;B=G-1;for(M=H+1;H<G;H++,B++,M++){B===G&&(B=0);M===G&&(M=0);ga[H]=d(E[H],E[B],E[M])}da.push(ga);la=la.concat(ga)}for(B=0;B<k;B++){G=B/k;i=j*(1-G);M=l*Math.sin(G*Math.PI/2);H=0;for(G=P.length;H<G;H++){T=c(P[H],q[H],M);f(T.x,T.y,-i)}z=0;for(v=L.length;z<v;z++){E=L[z];ga=da[z];H=0;for(G=E.length;H<G;H++){T=c(E[H],ga[H],M);f(T.x,T.y,-i)}}}M=l;for(H=0;H<V;H++){T=p?c(o[H],la[H],M):o[H];if(r){w.copy(x.normals[0]).multiplyScalar(T.x);s.copy(x.binormals[0]).multiplyScalar(T.y);
|
|
|
+F.copy(n[0]).addSelf(w).addSelf(s);f(F.x,F.y,F.z)}else f(T.x,T.y,0)}for(G=1;G<=m;G++)for(H=0;H<V;H++){T=p?c(o[H],la[H],M):o[H];if(r){w.copy(x.normals[G]).multiplyScalar(T.x);s.copy(x.binormals[G]).multiplyScalar(T.y);F.copy(n[G]).addSelf(w).addSelf(s);f(F.x,F.y,F.z)}else f(T.x,T.y,h/m*G)}for(B=k-1;B>=0;B--){G=B/k;i=j*(1-G);M=l*Math.sin(G*Math.PI/2);H=0;for(G=P.length;H<G;H++){T=c(P[H],q[H],M);f(T.x,T.y,h+i)}z=0;for(v=L.length;z<v;z++){E=L[z];ga=da[z];H=0;for(G=E.length;H<G;H++){T=c(E[H],ga[H],M);
|
|
|
+r?f(T.x,T.y+n[m-1].y,n[m-1].x+i):f(T.x,T.y,h+i)}}}var Q=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(p){var a;a=V*0;for(H=0;H<X;H++){A=W[H];g(A[2]+a,A[1]+a,A[0]+a,true)}a=m+k*2;a=V*a;for(H=0;H<X;H++){A=W[H];g(A[0]+a,A[1]+a,A[2]+a,false)}}else{for(H=0;H<X;H++){A=W[H];g(A[2],A[1],A[0],true)}for(H=0;H<X;H++){A=W[H];g(A[0]+V*m,A[1]+V*m,A[2]+V*m,false)}}})();(function(){var a=0;e(P,a);a=a+P.length;z=0;for(v=L.length;z<v;z++){E=L[z];e(E,a);a=a+E.length}})()};
|
|
|
+THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,j=a.vertices[f].y,f=a.vertices[f].z,l=a.vertices[g].x,k=
|
|
|
+a.vertices[g].y,g=a.vertices[g].z,p=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-j)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(l,g),new THREE.UV(p,a)]:[new THREE.UV(c,e),new THREE.UV(j,f),new THREE.UV(k,g),new THREE.UV(m,a)]}};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.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/b),f=0;f<a.length;f++){d[f]=a[f].clone();this.vertices.push((new THREE.Vertex).copy(d[f]))}for(var g=b+1,c=0;c<g;c++)for(f=0;f<d.length;f++){d[f]=e.multiplyVector3(d[f].clone());this.vertices.push((new THREE.Vertex).copy(d[f]))}for(c=0;c<b;c++){d=0;for(e=a.length;d<e-1;d++){this.faces.push(new THREE.Face4(c*e+d,(c+1)%g*e+d,(c+1)%g*e+(d+1)%e,c*e+(d+1)%e));this.faceVertexUvs[0].push([new THREE.UV(1-
|
|
|
c/b,d/e),new THREE.UV(1-(c+1)/b,d/e),new THREE.UV(1-(c+1)/b,(d+1)/e),new THREE.UV(1-c/b,(d+1)/e)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
-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,j=a/c,k=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(b*j-e,0,a*k-f));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(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.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+
|
|
|
+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,j=a/c,l=b/d,k=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(b*j-e,0,a*l-f));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=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,j,k=[],l=[];for(j=0;j<=c;j++){var p=[],m=[];for(h=0;h<=b;h++){var o=h/b,r=j/c,n=-a*Math.cos(d+o*e)*Math.sin(f+r*g),q=a*Math.cos(f+r*g),u=a*Math.sin(d+o*e)*Math.sin(f+r*g);this.vertices.push(new THREE.Vertex(n,q,u));p.push(this.vertices.length-1);m.push(new THREE.UV(o,r))}k.push(p);
|
|
|
-l.push(m)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=k[j][h+1],e=k[j][h],f=k[j+1][h],g=k[j+1][h+1],p=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),o=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),n=l[j][h+1].clone(),q=l[j][h].clone(),u=l[j+1][h].clone(),t=l[j+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[p,o,r]));this.faceVertexUvs[0].push([n,u,t])}else if(Math.abs(this.vertices[f].y)==a){this.faces.push(new THREE.Face3(d,
|
|
|
-e,f,[p,m,o]));this.faceVertexUvs[0].push([n,q,u])}else{this.faces.push(new THREE.Face4(d,e,f,g,[p,m,o,r]));this.faceVertexUvs[0].push([n,q,u,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=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,j,l=[],k=[];for(j=0;j<=c;j++){var p=[],m=[];for(h=0;h<=b;h++){var o=h/b,q=j/c,n=-a*Math.cos(d+o*e)*Math.sin(f+q*g),r=a*Math.cos(f+q*g),u=a*Math.sin(d+o*e)*Math.sin(f+q*g);this.vertices.push(new THREE.Vertex(n,r,u));p.push(this.vertices.length-1);m.push(new THREE.UV(o,q))}l.push(p);
|
|
|
+k.push(m)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=l[j][h+1],e=l[j][h],f=l[j+1][h],g=l[j+1][h+1],p=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),o=this.vertices[f].clone().normalize(),q=this.vertices[g].clone().normalize(),n=k[j][h+1].clone(),r=k[j][h].clone(),u=k[j+1][h].clone(),t=k[j+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[p,o,q]));this.faceVertexUvs[0].push([n,u,t])}else if(Math.abs(this.vertices[f].y)==a){this.faces.push(new THREE.Face3(d,
|
|
|
+e,f,[p,m,o]));this.faceVertexUvs[0].push([n,r,u])}else{this.faces.push(new THREE.Face4(d,e,f,g,[p,m,o,q]));this.faceVertexUvs[0].push([n,r,u,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=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;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,j,k,l,p,m,o,r,n,q,u=b.glyphs[a]||b.glyphs["?"];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=b.length;for(a=0;a<k;){j=b[a++];switch(j){case "m":j=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(j,l));e.moveTo(j,l);break;case "l":j=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(j,
|
|
|
-l));e.lineTo(j,l);break;case "q":j=b[a++]*c+d;l=b[a++]*c;o=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(o,r,j,l);if(g=f[f.length-1]){p=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h,y=THREE.Shape.Utils.b2(t,p,o,j),t=THREE.Shape.Utils.b2(t,m,r,l);f.push(new THREE.Vector2(y,t))}}break;case "b":j=b[a++]*c+d;l=b[a++]*c;o=b[a++]*c+d;r=b[a++]*-c;n=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(j,l,o,r,n,q);if(g=f[f.length-1]){p=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){t=g/h;y=THREE.Shape.Utils.b3(t,p,o,
|
|
|
-n,j);t=THREE.Shape.Utils.b3(t,m,r,q,l);f.push(new THREE.Vector2(y,t))}}}}}return{offset:u.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=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],j,k,l;if(b(a)>0)for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var p=2*e;for(k=e-1;e>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");break}j=k;e<=j&&(j=0);k=j+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{m=a;var o=j,r=k,n=l,q=e,u=g,t=void 0,y=void 0,s=void 0,x=void 0,D=void 0,
|
|
|
-B=void 0,w=void 0,v=void 0,C=void 0,y=m[u[o]].x,s=m[u[o]].y,x=m[u[r]].x,D=m[u[r]].y,B=m[u[n]].x,w=m[u[n]].y;if(1.0E-10>(x-y)*(w-s)-(D-s)*(B-y))m=false;else{for(t=0;t<q;t++)if(!(t==o||t==r||t==n)){var v=m[u[t]].x,C=m[u[t]].y,K=void 0,L=void 0,T=void 0,P=void 0,J=void 0,N=void 0,F=void 0,i=void 0,U=void 0,E=void 0,H=void 0,W=void 0,K=T=J=void 0,K=B-x,L=w-D,T=y-B,P=s-w,J=x-y,N=D-s,F=v-y,i=C-s,U=v-x,E=C-D,H=v-B,W=C-w,K=K*E-L*U,J=J*i-N*F,T=T*W-P*H;if(K>=0&&T>=0&&J>=0){m=false;break a}}m=true}}if(m){f.push([a[g[j]],
|
|
|
-a[g[k]],a[g[l]]]);h.push([g[j],g[k],g[l]]);j=k;for(l=k+1;l<e;j++,l++)g[j]=g[l];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};
|
|
|
+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,j,l,k,p,m,o,q,n,r,u=b.glyphs[a]||b.glyphs["?"];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));l=b.length;for(a=0;a<l;){j=b[a++];switch(j){case "m":j=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(j,k));e.moveTo(j,k);break;case "l":j=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(j,
|
|
|
+k));e.lineTo(j,k);break;case "q":j=b[a++]*c+d;k=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(o,q,j,k);if(g=f[f.length-1]){p=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h,x=THREE.Shape.Utils.b2(t,p,o,j),t=THREE.Shape.Utils.b2(t,m,q,k);f.push(new THREE.Vector2(x,t))}}break;case "b":j=b[a++]*c+d;k=b[a++]*c;o=b[a++]*c+d;q=b[a++]*-c;n=b[a++]*c+d;r=b[a++]*-c;e.bezierCurveTo(j,k,o,q,n,r);if(g=f[f.length-1]){p=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){t=g/h;x=THREE.Shape.Utils.b3(t,p,o,
|
|
|
+n,j);t=THREE.Shape.Utils.b3(t,m,q,r,k);f.push(new THREE.Vector2(x,t))}}}}}return{offset:u.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=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],j,l,k;if(b(a)>0)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;e>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");break}j=l;e<=j&&(j=0);l=j+1;e<=l&&(l=0);k=l+1;e<=k&&(k=0);var m;a:{m=a;var o=j,q=l,n=k,r=e,u=g,t=void 0,x=void 0,s=void 0,w=void 0,F=void 0,
|
|
|
+E=void 0,z=void 0,v=void 0,C=void 0,x=m[u[o]].x,s=m[u[o]].y,w=m[u[q]].x,F=m[u[q]].y,E=m[u[n]].x,z=m[u[n]].y;if(1.0E-10>(w-x)*(z-s)-(F-s)*(E-x))m=false;else{for(t=0;t<r;t++)if(!(t==o||t==q||t==n)){var v=m[u[t]].x,C=m[u[t]].y,J=void 0,L=void 0,W=void 0,P=void 0,B=void 0,M=void 0,G=void 0,i=void 0,T=void 0,V=void 0,A=void 0,X=void 0,J=W=B=void 0,J=E-w,L=z-F,W=x-E,P=s-z,B=w-x,M=F-s,G=v-x,i=C-s,T=v-w,V=C-F,A=v-E,X=C-z,J=J*V-L*T,B=B*i-M*G,W=W*X-P*A;if(J>=0&&W>=0&&B>=0){m=false;break a}}m=true}}if(m){f.push([a[g[j]],
|
|
|
+a[g[l]],a[g[k]]]);h.push([g[j],g[l],g[k]]);j=l;for(k=l+1;k<e;j++,k++)g[j]=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||Math.PI*2;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=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vertex;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(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,j=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);j.normal.addSelf(b[e]);j.normal.addSelf(b[f]);j.normal.addSelf(b[g]);j.normal.addSelf(b[h]);j.normal.normalize();this.faces.push(j);
|
|
|
this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a=c/d*a;c=Math.cos(a);g=e*(2+c)*0.5*g;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
|
|
|
Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var j=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=h(j,g,this.q,this.p,this.radius,this.heightScale),j=h(j+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(j,f);d.add(j,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(j*d.x+g*e.x);f.y=f.y+(j*d.y+g*e.y);f.z=f.z+(j*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vertex(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),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=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,j,k,l])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
|
|
|
+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),j=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,j,l,k])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
|
|
|
THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
|
|
|
-THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,j,k,l,p=new THREE.Vector3,m,o,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);m=b.tangents;o=b.normals;r=b.binormals;this.tangents=m;this.normals=o;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=m[b];g=o[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
|
|
|
-l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){j=d/this.segmentsRadius*2*Math.PI;k=-this.radius*Math.cos(j);j=this.radius*Math.sin(j);p.copy(l);p.x=p.x+(k*g.x+j*h.x);p.y=p.y+(k*g.y+j*h.y);p.z=p.z+(k*g.z+j*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vertex(p.x,p.y,p.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;p=(d+1)%this.segmentsRadius;
|
|
|
-a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][p];p=this.grid[b][p];m=new THREE.UV(b/this.segments,d/this.segmentsRadius);o=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,p));this.faceVertexUvs[0].push([m,o,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,j,l,k,p=new THREE.Vector3,m,o,q,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);m=b.tangents;o=b.normals;q=b.binormals;this.tangents=m;this.normals=o;this.binormals=q;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);k=a.getPointAt(d);d=m[b];g=o[b];h=q[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
|
|
|
+k,c,255));this.debug.add(new THREE.ArrowHelper(g,k,c,16711680));this.debug.add(new THREE.ArrowHelper(h,k,c,65280))}for(d=0;d<this.segmentsRadius;d++){j=d/this.segmentsRadius*2*Math.PI;l=-this.radius*Math.cos(j);j=this.radius*Math.sin(j);p.copy(k);p.x=p.x+(l*g.x+j*h.x);p.y=p.y+(l*g.y+j*h.y);p.z=p.z+(l*g.z+j*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vertex(p.x,p.y,p.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;p=(d+1)%this.segmentsRadius;
|
|
|
+a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][p];p=this.grid[b][p];m=new THREE.UV(b/this.segments,d/this.segmentsRadius);o=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);q=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,p));this.faceVertexUvs[0].push([m,o,q,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
|
|
|
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,j=new THREE.Matrix4,b=b+1,k,l,p;this.tangents=e;this.normals=f;this.binormals=g;for(k=0;k<b;k++){l=k/(b-1);e[k]=a.getTangentAt(l);e[k].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);l=Math.abs(e[0].y);p=Math.abs(e[0].z);if(k<=a){a=k;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}p<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
|
|
|
-f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(k=1;k<b;k++){f[k]=f[k-1].clone();g[k]=g[k-1].clone();h.cross(e[k-1],e[k]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[k-1].dot(e[k]));j.makeRotationAxis(h,d).multiplyVector3(f[k])}g[k].cross(e[k],f[k])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(k=1;k<b;k++){j.makeRotationAxis(e[k],d*k).multiplyVector3(f[k]);g[k].cross(e[k],f[k])}}};
|
|
|
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,j=new THREE.Matrix4,b=b+1,l,k,p;this.tangents=e;this.normals=f;this.binormals=g;for(l=0;l<b;l++){k=l/(b-1);e[l]=a.getTangentAt(k);e[l].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;l=Math.abs(e[0].x);k=Math.abs(e[0].y);p=Math.abs(e[0].z);if(l<=a){a=l;d.set(1,0,0)}if(k<=a){a=k;d.set(0,1,0)}p<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
|
|
|
+f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(l=1;l<b;l++){f[l]=f[l-1].clone();g[l]=g[l-1].clone();h.cross(e[l-1],e[l]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[l-1].dot(e[l]));j.makeRotationAxis(h,d).multiplyVector3(f[l])}g[l].cross(e[l],f[l])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(l=1;l<b;l++){j.makeRotationAxis(e[l],d*l).multiplyVector3(f[l]);g[l].cross(e[l],f[l])}}};
|
|
|
THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=(new THREE.Vertex).copy(a.normalize());b.index=j.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();j.faces.push(d);d=Math.atan2(d.centroid.z,
|
|
|
-d.centroid.x);j.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){p[a.index]||(p[a.index]=[]);p[b.index]||(p[b.index]=[]);var c=p[a.index][b.index];c===void 0&&(p[a.index][b.index]=p[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));
|
|
|
-return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,j=this,k=0,l=a.length;k<l;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var p=[],a=this.vertices,k=0,l=b.length;k<l;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(l=this.vertices.length;k<l;k++)this.vertices[k].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
|
|
|
+return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,j=this,l=0,k=a.length;l<k;l++)e(new THREE.Vector3(a[l][0],a[l][1],a[l][2]));for(var p=[],a=this.vertices,l=0,k=b.length;l<k;l++)f(a[b[l][0]],a[b[l][1]],a[b[l][2]],d);this.mergeVertices();l=0;for(k=this.vertices.length;l<k;l++)this.vertices[l].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
|
|
|
THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};
|
|
|
THREE.TetrahedronGeometry.prototype=new THREE.Geometry;THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry;
|
|
@@ -619,136 +619,137 @@ this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces);
|
|
|
THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,
|
|
|
1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
|
|
|
THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
|
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){m.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,i){var j=new THREE.Face4(a,c,d,e,null,g.color,g.material);if(m.useOldVertexColors){j.vertexColors=[];for(var k,n,o,r=0;r<4;r++){o=h[r];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<o.length;q++){n=g.vertexColors[o[q]-1];k.r=k.r+n.r;k.g=k.g+n.g;k.b=k.b+n.b}k.r=k.r/o.length;k.g=k.g/o.length;k.b=k.b/o.length;
|
|
|
-j.vertexColors[r]=k}}l.push(j);if(m.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?p.push(g):b("d :( ",e+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=t[e];if(!f){a>=y&&a<y+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}function h(a,
|
|
|
-b){T[a]===void 0&&(T[a]=[]);T[a].push(b)}function j(a,b,c){P[a]===void 0&&(P[a]={});P[a][b]=c}var k=[],l=[],p=[],m=this,o=a.vertices,r=a.faces,k=o.concat(),n=[],q={},u={},t={},y=o.length,s,x,D,B,w,v=a.faceVertexUvs[0],C;b("originalFaces, uvs, originalVerticesLength",r.length,v.length,y);if(m.supportUVs){s=0;for(x=v.length;s<x;s++){D=0;for(B=v[s].length;D<B;D++){C=r[s]["abcd".charAt(D)];g(C,s,v[s][D])}}}if(v.length==0)m.supportUVs=false;s=0;for(w in t)s++;if(!s){m.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
|
|
|
-t,"vs",v.length);s=0;for(x=r.length;s<x;s++){w=r[s];n.push(w.centroid);k.push((new THREE.Vertex).copy(w.centroid));if(m.supportUVs){v=new THREE.UV;if(w instanceof THREE.Face3){v.u=f(w.a,s).u+f(w.b,s).u+f(w.c,s).u;v.v=f(w.a,s).v+f(w.b,s).v+f(w.c,s).v;v.u=v.u/3;v.v=v.v/3}else if(w instanceof THREE.Face4){v.u=f(w.a,s).u+f(w.b,s).u+f(w.c,s).u+f(w.d,s).u;v.v=f(w.a,s).v+f(w.b,s).v+f(w.c,s).v+f(w.d,s).v;v.u=v.u/4;v.v=v.v/4}g(y+s,"",v)}}b("-- added UVs for new Faces",t);x=function(a){function b(a,c){h[a]===
|
|
|
-void 0&&(h[a]=[]);h[a].push(c)}var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);C=0;var K,L,T={},P={};for(s in x){v=x[s];K=s.split("_");L=K[0];K=K[1];h(L,[L,K]);h(K,[L,K]);D=0;for(B=v.length;D<B;D++){w=v[D];j(L,w,s);j(K,w,s)}v.length<2&&(u[s]=true)}b("vertexEdgeMap",T,
|
|
|
-"vertexFaceMap",P);for(s in x){v=x[s];w=v[0];B=v[1];K=s.split("_");L=K[0];K=K[1];v=new THREE.Vector3;if(u[s]){v.addSelf(o[L]);v.addSelf(o[K]);v.multiplyScalar(0.5)}else{v.addSelf(n[w]);v.addSelf(n[B]);v.addSelf(o[L]);v.addSelf(o[K]);v.multiplyScalar(0.25)}q[s]=y+r.length+C;k.push((new THREE.Vertex).copy(v));C++;if(m.supportUVs){v=new THREE.UV;v.u=f(L,w).u+f(K,w).u;v.v=f(L,w).v+f(K,w).v;v.u=v.u/2;v.v=v.v/2;g(q[s],w,v);if(!u[s]){v=new THREE.UV;v.u=f(L,B).u+f(K,B).u;v.v=f(L,B).v+f(K,B).v;v.u=v.u/2;v.v=
|
|
|
-v.v/2;g(q[s],B,v)}}}b("-- Step 2 done");var J,N;B=["123","12","2","23"];K=["123","23","3","31"];var F=["123","31","1","12"],i=["1234","12","2","23"],U=["1234","23","3","34"],E=["1234","34","4","41"],H=["1234","41","1","12"];s=0;for(x=n.length;s<x;s++){w=r[s];v=y+s;if(w instanceof THREE.Face3){C=e(w.a,w.b);L=e(w.b,w.c);J=e(w.c,w.a);d(v,q[C],w.b,q[L],w,B,s);d(v,q[L],w.c,q[J],w,K,s);d(v,q[J],w.a,q[C],w,F,s)}else if(w instanceof THREE.Face4){C=e(w.a,w.b);L=e(w.b,w.c);J=e(w.c,w.d);N=e(w.d,w.a);d(v,q[C],
|
|
|
-w.b,q[L],w,i,s);d(v,q[L],w.c,q[J],w,U,s);d(v,q[J],w.d,q[N],w,E,s);d(v,q[N],w.a,q[C],w,H,s)}else b("face should be a face!",w)}q=new THREE.Vector3;w=new THREE.Vector3;s=0;for(x=o.length;s<x;s++)if(T[s]!==void 0){q.set(0,0,0);w.set(0,0,0);L=new THREE.Vector3(0,0,0);v=0;for(D in P[s]){q.addSelf(n[D]);v++}B=0;C=T[s].length;for(D=0;D<C;D++)u[e(T[s][D][0],T[s][D][1])]&&B++;if(B!=2){q.divideScalar(v);for(D=0;D<C;D++){v=T[s][D];v=o[v[0]].clone().addSelf(o[v[1]]).divideScalar(2);w.addSelf(v)}w.divideScalar(C);
|
|
|
-L.addSelf(o[s]);L.multiplyScalar(C-3);L.addSelf(q);L.addSelf(w.multiplyScalar(2));L.divideScalar(C);k[s]=L}}a.vertices=k;a.faces=l;a.faceVertexUvs[0]=p;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.SubdivisionModifier.prototype.smooth=function(a){function b(){m.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,i){var j=new THREE.Face4(a,c,d,e,null,g.color,g.material);if(m.useOldVertexColors){j.vertexColors=[];for(var l,n,o,q=0;q<4;q++){o=h[q];l=new THREE.Color;l.setRGB(0,0,0);for(var r=0;r<o.length;r++){n=g.vertexColors[o[r]-1];l.r=l.r+n.r;l.g=l.g+n.g;l.b=l.b+n.b}l.r=l.r/o.length;l.g=l.g/o.length;l.b=l.b/o.length;
|
|
|
+j.vertexColors[q]=l}}k.push(j);if(m.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?p.push(g):b("d :( ",e+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=t[e];if(!f){a>=x&&a<x+q.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}function h(a,
|
|
|
+b){W[a]===void 0&&(W[a]=[]);W[a].push(b)}function j(a,b,c){P[a]===void 0&&(P[a]={});P[a][b]=c}var l=[],k=[],p=[],m=this,o=a.vertices,q=a.faces,l=o.concat(),n=[],r={},u={},t={},x=o.length,s,w,F,E,z,v=a.faceVertexUvs[0],C;b("originalFaces, uvs, originalVerticesLength",q.length,v.length,x);if(m.supportUVs){s=0;for(w=v.length;s<w;s++){F=0;for(E=v[s].length;F<E;F++){C=q[s]["abcd".charAt(F)];g(C,s,v[s][F])}}}if(v.length==0)m.supportUVs=false;s=0;for(z in t)s++;if(!s){m.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
|
|
|
+t,"vs",v.length);s=0;for(w=q.length;s<w;s++){z=q[s];n.push(z.centroid);l.push((new THREE.Vertex).copy(z.centroid));if(m.supportUVs){v=new THREE.UV;if(z instanceof THREE.Face3){v.u=f(z.a,s).u+f(z.b,s).u+f(z.c,s).u;v.v=f(z.a,s).v+f(z.b,s).v+f(z.c,s).v;v.u=v.u/3;v.v=v.v/3}else if(z instanceof THREE.Face4){v.u=f(z.a,s).u+f(z.b,s).u+f(z.c,s).u+f(z.d,s).u;v.v=f(z.a,s).v+f(z.b,s).v+f(z.c,s).v+f(z.d,s).v;v.u=v.u/4;v.v=v.v/4}g(x+s,"",v)}}b("-- added UVs for new Faces",t);w=function(a){function b(a,c){h[a]===
|
|
|
+void 0&&(h[a]=[]);h[a].push(c)}var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);C=0;var J,L,W={},P={};for(s in w){v=w[s];J=s.split("_");L=J[0];J=J[1];h(L,[L,J]);h(J,[L,J]);F=0;for(E=v.length;F<E;F++){z=v[F];j(L,z,s);j(J,z,s)}v.length<2&&(u[s]=true)}b("vertexEdgeMap",W,
|
|
|
+"vertexFaceMap",P);for(s in w){v=w[s];z=v[0];E=v[1];J=s.split("_");L=J[0];J=J[1];v=new THREE.Vector3;if(u[s]){v.addSelf(o[L]);v.addSelf(o[J]);v.multiplyScalar(0.5)}else{v.addSelf(n[z]);v.addSelf(n[E]);v.addSelf(o[L]);v.addSelf(o[J]);v.multiplyScalar(0.25)}r[s]=x+q.length+C;l.push((new THREE.Vertex).copy(v));C++;if(m.supportUVs){v=new THREE.UV;v.u=f(L,z).u+f(J,z).u;v.v=f(L,z).v+f(J,z).v;v.u=v.u/2;v.v=v.v/2;g(r[s],z,v);if(!u[s]){v=new THREE.UV;v.u=f(L,E).u+f(J,E).u;v.v=f(L,E).v+f(J,E).v;v.u=v.u/2;v.v=
|
|
|
+v.v/2;g(r[s],E,v)}}}b("-- Step 2 done");var B,M;E=["123","12","2","23"];J=["123","23","3","31"];var G=["123","31","1","12"],i=["1234","12","2","23"],T=["1234","23","3","34"],V=["1234","34","4","41"],A=["1234","41","1","12"];s=0;for(w=n.length;s<w;s++){z=q[s];v=x+s;if(z instanceof THREE.Face3){C=e(z.a,z.b);L=e(z.b,z.c);B=e(z.c,z.a);d(v,r[C],z.b,r[L],z,E,s);d(v,r[L],z.c,r[B],z,J,s);d(v,r[B],z.a,r[C],z,G,s)}else if(z instanceof THREE.Face4){C=e(z.a,z.b);L=e(z.b,z.c);B=e(z.c,z.d);M=e(z.d,z.a);d(v,r[C],
|
|
|
+z.b,r[L],z,i,s);d(v,r[L],z.c,r[B],z,T,s);d(v,r[B],z.d,r[M],z,V,s);d(v,r[M],z.a,r[C],z,A,s)}else b("face should be a face!",z)}r=new THREE.Vector3;z=new THREE.Vector3;s=0;for(w=o.length;s<w;s++)if(W[s]!==void 0){r.set(0,0,0);z.set(0,0,0);L=new THREE.Vector3(0,0,0);v=0;for(F in P[s]){r.addSelf(n[F]);v++}E=0;C=W[s].length;for(F=0;F<C;F++)u[e(W[s][F][0],W[s][F][1])]&&E++;if(E!=2){r.divideScalar(v);for(F=0;F<C;F++){v=W[s][F];v=o[v[0]].clone().addSelf(o[v[1]]).divideScalar(2);z.addSelf(v)}z.divideScalar(C);
|
|
|
+L.addSelf(o[s]);L.multiplyScalar(C-3);L.addSelf(r);L.addSelf(z.multiplyScalar(2));L.divideScalar(C);l[s]=L}}a.vertices=l;a.faces=k;a.faceVertexUvs[0]=p;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:"anonymous",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(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
|
|
|
Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=true};e.crossOrigin=h.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var j=document.createElement("canvas");a[c]=new THREE.Texture(j);a[c].sourceFile=
|
|
|
-d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,j="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
|
|
|
-if(a.shading){var l=a.shading.toLowerCase();l==="phong"?j="MeshPhongMaterial":l==="basic"&&(j="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)k.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.depthWrite!==void 0)k.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;
|
|
|
-if(a.colorDiffuse)k.color=g(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=g(a.colorSpecular);if(a.colorAmbient)k.ambient=g(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",a.mapNormal,a.mapNormalRepeat,
|
|
|
-a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){j=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(j.uniforms);l.tNormal.texture=k.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(k.map){l.tDiffuse.texture=k.map;l.enableDiffuse.value=true}if(k.specularMap){l.tSpecular.texture=k.specularMap;l.enableSpecular.value=true}if(k.lightMap){l.tAO.texture=k.lightMap;
|
|
|
-l.enableAO.value=true}l.uDiffuseColor.value.setHex(k.color);l.uSpecularColor.value.setHex(k.specular);l.uAmbientColor.value.setHex(k.ambient);l.uShininess.value=k.shininess;if(k.opacity!==void 0)l.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:l,lights:true,fog:true})}else k=new THREE[j](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
|
|
|
+d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,j="MeshLambertMaterial",l={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
|
|
|
+if(a.shading){var k=a.shading.toLowerCase();k==="phong"?j="MeshPhongMaterial":k==="basic"&&(j="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)l.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)l.transparent=a.transparent;if(a.depthTest!==void 0)l.depthTest=a.depthTest;if(a.depthWrite!==void 0)l.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")l.vertexColors=THREE.FaceColors;else if(a.vertexColors)l.vertexColors=THREE.VertexColors;
|
|
|
+if(a.colorDiffuse)l.color=g(a.colorDiffuse);else if(a.DbgColor)l.color=a.DbgColor;if(a.colorSpecular)l.specular=g(a.colorSpecular);if(a.colorAmbient)l.ambient=g(a.colorAmbient);if(a.transparency)l.opacity=a.transparency;if(a.specularCoef)l.shininess=a.specularCoef;a.mapDiffuse&&b&&f(l,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(l,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(l,"normalMap",a.mapNormal,a.mapNormalRepeat,
|
|
|
+a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(l,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){j=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(j.uniforms);k.tNormal.texture=l.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(l.map){k.tDiffuse.texture=l.map;k.enableDiffuse.value=true}if(l.specularMap){k.tSpecular.texture=l.specularMap;k.enableSpecular.value=true}if(l.lightMap){k.tAO.texture=l.lightMap;
|
|
|
+k.enableAO.value=true}k.uDiffuseColor.value.setHex(l.color);k.uSpecularColor.value.setHex(l.specular);k.uAmbientColor.value.setHex(l.ambient);k.uShininess.value=l.shininess;if(l.opacity!==void 0)k.uOpacity.value=l.opacity;l=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:k,lights:true,fog:true})}else l=new THREE[j](l);if(a.DbgName!==void 0)l.name=a.DbgName;return l}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
|
|
|
THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);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(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){h==0&&(h=f.getResponseHeader("Content-Length"));e({total:h,loaded:f.responseText.length})}}else f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};
|
|
|
f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,j,k,l,p,m,o,r,n,q,u,t,y,s;function x(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 w(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[d*3];f=l[d*3+1];g=l[d*3+2];h=F[e*2];e=F[e*2+1];i=F[f*2];j=F[f*2+1];f=F[g*2];k=F[g*2+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,
|
|
|
-k));g.push(m)}}function v(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[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];i=F[e*2];e=F[e*2+1];j=F[f*2];l=F[f*2+1];k=F[g*2];m=F[g*2+1];g=F[h*2];f=F[h*2+1];h=P.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 C(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=i[d];
|
|
|
-P.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function K(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];P.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}}function L(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[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=m[e];var n=N[k*3],o=N[k*3+1];k=N[k*3+2];var p=N[l*3],
|
|
|
-r=N[l*3+1];l=N[l*3+2];P.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(N[j*3],N[j*3+1],N[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,r,l)],null,i))}}function T(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[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];n=d[e*4+3];j=o[e];var p=N[l*3],r=N[l*3+1];l=N[l*3+2];var q=N[m*3],s=N[m*3+1];m=N[m*3+2];var t=N[n*3],u=N[n*3+1];n=N[n*3+2];P.faces.push(new THREE.Face4(f,
|
|
|
-g,h,i,[new THREE.Vector3(N[k*3],N[k*3+1],N[k*3+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,u,n)],null,j))}}var P=this,J=0,N=[],F=[],i,U,E;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(P,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,J,12);c=D(a,J+12);D(a,J+13);D(a,J+14);D(a,J+15);e=D(a,J+16);j=D(a,J+17);k=D(a,J+18);l=D(a,J+19);p=B(a,J+20);m=B(a,J+20+4);o=B(a,J+20+8);b=B(a,J+20+12);r=
|
|
|
-B(a,J+20+16);n=B(a,J+20+20);q=B(a,J+20+24);u=B(a,J+20+28);t=B(a,J+20+32);y=B(a,J+20+36);s=B(a,J+20+40);J=J+c;c=e*3+l;E=e*4+l;i=b*c;U=r*(c+j*3);e=n*(c+k*3);l=q*(c+j*3+k*3);c=u*E;j=t*(E+j*4);k=y*(E+k*4);J=J+function(b){var b=new Float32Array(a,b,p*3),c,d,e,f;for(c=0;c<p;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];P.vertices.push(new THREE.Vertex(d,e,f))}return p*3*Float32Array.BYTES_PER_ELEMENT}(J);J=J+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,e,f;for(c=0;c<m;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];N.push(d/
|
|
|
-127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(J);J=J+x(m*3);J=J+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];F.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(J);i=J+i+x(b*2);U=i+U+x(r*2);e=U+e+x(n*2);l=e+l+x(q*2);c=l+c+x(u*2);j=c+j+x(t*2);k=j+k+x(y*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;C(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);w(n,b)}})(U);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
|
|
|
-q*Uint32Array.BYTES_PER_ELEMENT*3;L(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);w(q,c)}})(e);(function(a){if(y){var b=a+y*Uint32Array.BYTES_PER_ELEMENT*4;K(y,a,b+y*Uint32Array.BYTES_PER_ELEMENT*4);v(y,b)}})(j);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4,c=b+s*Uint32Array.BYTES_PER_ELEMENT*4;T(s,a,b,c+s*Uint32Array.BYTES_PER_ELEMENT*4);v(s,c)}})(k);b&&C(b,J,J+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;L(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
-3)}})(i);u&&K(u,l,l+u*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;T(t,a,b,b+t*Uint32Array.BYTES_PER_ELEMENT*4)}})(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){ea=a;d=d||sa;if(e!==void 0){a=e.split("/");a.pop();ta=(a.length<1?".":a.join("/"))+"/"}if((a=ea.evaluate("//dae:asset",ea,W,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":Xa=i.textContent.charAt(0)}}if(!Ia.convertUpAxis||Xa===Ia.upAxis)ja=null;else switch(Xa){case "X":ja=Ia.upAxis===
|
|
|
-"Y"?"XtoY":"XtoZ";break;case "Y":ja=Ia.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":ja=Ia.upAxis==="X"?"ZtoX":"ZtoY"}Ha=b("//dae:library_images/dae:image",g,"image");Ka=b("//dae:library_materials/dae:material",v,"material");db=b("//dae:library_effects/dae:effect",P,"effect");Ya=b("//dae:library_geometries/dae:geometry",q,"geometry");hb=b(".//dae:library_cameras/dae:camera",E,"camera");Wa=b("//dae:library_controllers/dae:controller",h,"controller");xa=b("//dae:library_animations/dae:animation",N,"animation");
|
|
|
-Pa=b(".//dae:library_visual_scenes/dae:visual_scene",l,"visual_scene");ua=[];ab=[];if(a=ea.evaluate(".//dae:scene/dae:instance_visual_scene",ea,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext()){a=a.getAttribute("url").replace(/^#/,"");wa=Pa[a.length>0?a:"visual_scene0"]}else wa=null;Na=new THREE.Object3D;for(a=0;a<wa.nodes.length;a++)Na.add(f(wa.nodes[a]));mb=[];c(Na);a={scene:Na,morphs:ua,skins:ab,animations:mb,dae:{images:Ha,materials:Ka,cameras:hb,effects:db,geometries:Ya,controllers:Wa,
|
|
|
-animations:xa,visualScenes:Pa,scene:wa}};d&&d(a);return a}function b(a,b,c){for(var a=ea.evaluate(a,ea,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=wa.getChildById(a.name,true),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};mb.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,j,l,k,p,m,o,q,n,r,u,t,x,s;function w(a){return a%4?4-a%4:0}function F(a,b){return(new Uint8Array(a,b,1))[0]}function E(a,b){return(new Uint32Array(a,b,1))[0]}function z(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[d*3];f=k[d*3+1];g=k[d*3+2];h=G[e*2];e=G[e*2+1];i=G[f*2];j=G[f*2+1];f=G[g*2];l=G[g*2+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 v(b,c){var d,e,f,g,h,i,j,l,k,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];i=G[e*2];e=G[e*2+1];j=G[f*2];k=G[f*2+1];l=G[g*2];m=G[g*2+1];g=G[h*2];f=G[h*2+1];h=P.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,e));o.push(new THREE.UV(j,k));o.push(new THREE.UV(l,m));o.push(new THREE.UV(g,f));h.push(o)}}function C(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=i[d];
|
|
|
+P.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function J(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];P.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}}function L(b,c,d,e){for(var f,g,h,i,j,l,k,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[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];l=d[e*3+1];k=d[e*3+2];i=m[e];var n=M[l*3],o=M[l*3+1];l=M[l*3+2];var p=M[k*3],
|
|
|
+q=M[k*3+1];k=M[k*3+2];P.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(M[j*3],M[j*3+1],M[j*3+2]),new THREE.Vector3(n,o,l),new THREE.Vector3(p,q,k)],null,i))}}function W(b,c,d,e){for(var f,g,h,i,j,l,k,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[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];l=d[e*4];k=d[e*4+1];m=d[e*4+2];n=d[e*4+3];j=o[e];var p=M[k*3],q=M[k*3+1];k=M[k*3+2];var r=M[m*3],s=M[m*3+1];m=M[m*3+2];var t=M[n*3],u=M[n*3+1];n=M[n*3+2];P.faces.push(new THREE.Face4(f,
|
|
|
+g,h,i,[new THREE.Vector3(M[l*3],M[l*3+1],M[l*3+2]),new THREE.Vector3(p,q,k),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,j))}}var P=this,B=0,M=[],G=[],i,T,V;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(P,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,B,12);c=F(a,B+12);F(a,B+13);F(a,B+14);F(a,B+15);e=F(a,B+16);j=F(a,B+17);l=F(a,B+18);k=F(a,B+19);p=E(a,B+20);m=E(a,B+20+4);o=E(a,B+20+8);b=E(a,B+20+12);q=
|
|
|
+E(a,B+20+16);n=E(a,B+20+20);r=E(a,B+20+24);u=E(a,B+20+28);t=E(a,B+20+32);x=E(a,B+20+36);s=E(a,B+20+40);B=B+c;c=e*3+k;V=e*4+k;i=b*c;T=q*(c+j*3);e=n*(c+l*3);k=r*(c+j*3+l*3);c=u*V;j=t*(V+j*4);l=x*(V+l*4);B=B+function(b){var b=new Float32Array(a,b,p*3),c,d,e,f;for(c=0;c<p;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];P.vertices.push(new THREE.Vertex(d,e,f))}return p*3*Float32Array.BYTES_PER_ELEMENT}(B);B=B+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,e,f;for(c=0;c<m;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];M.push(d/
|
|
|
+127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(B);B=B+w(m*3);B=B+function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return o*2*Float32Array.BYTES_PER_ELEMENT}(B);i=B+i+w(b*2);T=i+T+w(q*2);e=T+e+w(n*2);k=e+k+w(r*2);c=k+c+w(u*2);j=c+j+w(t*2);l=j+l+w(x*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;C(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);z(n,b)}})(T);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
|
|
|
+r*Uint32Array.BYTES_PER_ELEMENT*3;L(r,a,b,c+r*Uint32Array.BYTES_PER_ELEMENT*3);z(r,c)}})(e);(function(a){if(x){var b=a+x*Uint32Array.BYTES_PER_ELEMENT*4;J(x,a,b+x*Uint32Array.BYTES_PER_ELEMENT*4);v(x,b)}})(j);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4,c=b+s*Uint32Array.BYTES_PER_ELEMENT*4;W(s,a,b,c+s*Uint32Array.BYTES_PER_ELEMENT*4);v(s,c)}})(l);b&&C(b,B,B+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;L(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
+3)}})(i);u&&J(u,k,k+u*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;W(t,a,b,b+t*Uint32Array.BYTES_PER_ELEMENT*4)}})(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){fa=a;d=d||sa;if(e!==void 0){a=e.split("/");a.pop();ta=(a.length<1?".":a.join("/"))+"/"}if((a=fa.evaluate("//dae:asset",fa,X,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":Xa=i.textContent.charAt(0)}}if(!Ia.convertUpAxis||Xa===Ia.upAxis)ja=null;else switch(Xa){case "X":ja=Ia.upAxis===
|
|
|
+"Y"?"XtoY":"XtoZ";break;case "Y":ja=Ia.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":ja=Ia.upAxis==="X"?"ZtoX":"ZtoY"}Ha=b("//dae:library_images/dae:image",g,"image");Ka=b("//dae:library_materials/dae:material",v,"material");db=b("//dae:library_effects/dae:effect",P,"effect");Ya=b("//dae:library_geometries/dae:geometry",r,"geometry");hb=b(".//dae:library_cameras/dae:camera",V,"camera");Wa=b("//dae:library_controllers/dae:controller",h,"controller");xa=b("//dae:library_animations/dae:animation",M,"animation");
|
|
|
+Pa=b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");ua=[];ab=[];if(a=fa.evaluate(".//dae:scene/dae:instance_visual_scene",fa,X,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext()){a=a.getAttribute("url").replace(/^#/,"");wa=Pa[a.length>0?a:"visual_scene0"]}else wa=null;Na=new THREE.Object3D;for(a=0;a<wa.nodes.length;a++)Na.add(f(wa.nodes[a]));mb=[];c(Na);a={scene:Na,morphs:ua,skins:ab,animations:mb,dae:{images:Ha,materials:Ka,cameras:hb,effects:db,geometries:Ya,controllers:Wa,
|
|
|
+animations:xa,visualScenes:Pa,scene:wa}};d&&d(a);return a}function b(a,b,c){for(var a=fa.evaluate(a,fa,X,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=wa.getChildById(a.name,true),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};mb.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=Wa[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 xa)for(var i=xa[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=wa.getChildById(b.skeleton[0],true)||wa.getChildBySid(b.skeleton[0],true),l,m,g=new THREE.Vector3,
|
|
|
-n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j]);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex);d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++){l=j[m];n=-1;if(l.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(n>=0){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 r=
|
|
|
-k.weights[o][p];r.joint==n&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}}for(j=0;j<h.length;j++)if(h[j].type=="JOINT")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.x;g.y=n.y;g.z=n.z;h[j].skinningMatrix.multiplyVector3(g);m.x=m.x+g.x*l;m.y=m.y+g.y*l;m.z=m.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 i=Wa[a.controllers[g].url];
|
|
|
+f=Wa[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 xa)for(var i=xa[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=wa.getChildById(b.skeleton[0],true)||wa.getChildBySid(b.skeleton[0],true),k,m,g=new THREE.Vector3,
|
|
|
+n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j]);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex);d(b,h,c);j=h;l=f.skin;for(m=0;m<j.length;m++){k=j[m];n=-1;if(k.type=="JOINT"){for(var o=0;o<l.joints.length;o++)if(k.sid==l.joints[o]){n=o;break}if(n>=0){o=l.invBindMatrices[n];k.invBindMatrix=o;k.skinningMatrix=new THREE.Matrix4;k.skinningMatrix.multiply(k.world,o);k.weights=[];for(o=0;o<l.weights.length;o++)for(var p=0;p<l.weights[o].length;p++){var q=
|
|
|
+l.weights[o][p];q.joint==n&&k.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+k.sid+"'.";}}for(j=0;j<h.length;j++)if(h[j].type=="JOINT")for(l=0;l<h[j].weights.length;l++){k=h[j].weights[l];m=k.index;k=k.weight;n=a.vertices[m];m=i[m];g.x=n.x;g.y=n.y;g.z=n.z;h[j].skinningMatrix.multiplyVector3(g);m.x=m.x+g.x*k;m.y=m.y+g.y*k;m.z=m.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=Wa[a.controllers[g].url];
|
|
|
switch(i.type){case "skin":if(Ya[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(Wa[i.skin.source]){d=i=Wa[i.skin.source];if(i.morph&&Ya[i.morph.source]){j=new n;j.url=i.morph.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j)}}break;case "morph":if(Ya[i.morph.source]){j=new n;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=Ya[i.url],k={},l=[],m=0,p;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var r=Ka[p.target],q=db[r.instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=m;l.push(q.material);p=q.material;p.name=r.name==null||r.name===""?r.id:r.name;
|
|
|
-m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){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(c!==void 0){e(i,c);j.morphTargets=true;j=new THREE.SkinnedMesh(i,j);j.skeleton=c.skeleton;j.skinController=Wa[c.url];j.skinInstanceController=c;j.name="skin_"+ab.length;ab.push(j)}else if(d!==void 0){h=i;k=d instanceof o?Wa[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++){m=Ya[k.targets[l]];if(m.mesh&&m.mesh.primitives&&m.mesh.primitives.length){m=m.mesh.primitives[0].geometry;m.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:m.vertices})}}h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=true;j=new THREE.Mesh(i,j);j.name="morph_"+ua.length;ua.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++){b=hb[a.cameras[g].url];
|
|
|
+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=Ya[i.url],l={},k=[],m=0,p;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=Ka[p.target],r=db[q.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;l[p.symbol]=m;k.push(r.material);p=r.material;p.name=q.name==null||q.name===""?q.id:q.name;
|
|
|
+m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;i.materials=k;for(h=0;h<i.faces.length;h++){k=i.faces[h];k.materialIndex=l[k.daeMaterial]}}if(c!==void 0){e(i,c);j.morphTargets=true;j=new THREE.SkinnedMesh(i,j);j.skeleton=c.skeleton;j.skinController=Wa[c.url];j.skinInstanceController=c;j.name="skin_"+ab.length;ab.push(j)}else if(d!==void 0){h=i;l=d instanceof o?Wa[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++){m=Ya[l.targets[k]];if(m.mesh&&m.mesh.primitives&&m.mesh.primitives.length){m=m.mesh.primitives[0].geometry;m.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:m.vertices})}}h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=true;j=new THREE.Mesh(i,j);j.name="morph_"+ua.length;ua.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++){b=hb[a.cameras[g].url];
|
|
|
b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar)}b.name=a.id||"";b.matrix=a.matrix;g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=true;b.scale=g[2];if(Ia.centerGeometry&&b.geometry){g=THREE.GeometryUtils.center(b.geometry);b.quaternion.multiplyVector3(g.multiplySelf(b.scale));b.position.subSelf(g)}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 j(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){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 m(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url=
|
|
|
-"";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function y(){t.call(this);this.vcount=[]}function s(){t.call(this);this.vcount=3}function x(){this.source="";this.stride=
|
|
|
-this.count=0;this.params=[]}function D(){this.input={}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function w(a){this.id=a;this.type=null}function v(){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 K(a,b){this.type=a;this.effect=b;this.material=null}function L(a){this.effect=a;this.format=this.init_from=
|
|
|
-null}function T(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function P(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function J(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function F(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function i(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 U(a){this.targets=[];this.time=a}function E(){this.technique=this.name=this.id=""}function H(){this.url=""}function W(a){return a=="dae"?"http://www.collada.org/2005/11/COLLADASchema":null}function G(a){for(var a=fa(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function ha(a){for(var a=fa(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function fa(a){return a.length>
|
|
|
-0?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function la(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function R(a,b){if(Ia.convertUpAxis&&Xa!==Ia.upAxis)switch(ja){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 $(a,b){var c=[a[b],
|
|
|
-a[b+1],a[b+2]];R(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Ia.convertUpAxis){var b=[a[0],a[4],a[8]];R(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];R(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];R(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];R(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];R(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];R(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];R(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])}function aa(a){if(Ia.convertUpAxis)switch(a){case "X":switch(ja){case "XtoY":case "XtoZ":case "YtoX":a="Y";break;case "ZtoX":a="Z"}break;case "Y":switch(ja){case "XtoY":case "YtoX":case "ZtoX":a="X";break;case "XtoZ":case "YtoZ":case "ZtoY":a="Z"}break;case "Z":switch(ja){case "XtoZ":a="X";break;case "YtoZ":case "ZtoX":case "ZtoY":a="Y"}}return a}var ea=null,Na=null,wa,sa=null,Oa={},
|
|
|
+null}function j(){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 m(){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 n(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function x(){t.call(this);this.vcount=[]}function s(){t.call(this);this.vcount=3}function w(){this.source="";this.stride=
|
|
|
+this.count=0;this.params=[]}function F(){this.input={}}function E(){this.semantic="";this.offset=0;this.source="";this.set=0}function z(a){this.id=a;this.type=null}function v(){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 J(a,b){this.type=a;this.effect=b;this.material=null}function L(a){this.effect=a;this.format=this.init_from=
|
|
|
+null}function W(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function P(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function B(){this.url=""}function M(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function G(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function i(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 T(a){this.targets=[];this.time=a}function V(){this.technique=this.name=this.id=""}function A(){this.url=""}function X(a){return a=="dae"?"http://www.collada.org/2005/11/COLLADASchema":null}function H(a){for(var a=ga(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function da(a){for(var a=ga(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function ga(a){return a.length>
|
|
|
+0?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function la(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function Q(a,b){if(Ia.convertUpAxis&&Xa!==Ia.upAxis)switch(ja){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 S(a,b){var c=[a[b],
|
|
|
+a[b+1],a[b+2]];Q(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Ia.convertUpAxis){var b=[a[0],a[4],a[8]];Q(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];Q(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];Q(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];Q(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];Q(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];Q(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];Q(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])}function aa(a){if(Ia.convertUpAxis)switch(a){case "X":switch(ja){case "XtoY":case "XtoZ":case "YtoX":a="Y";break;case "ZtoX":a="Z"}break;case "Y":switch(ja){case "XtoY":case "YtoX":case "ZtoX":a="X";break;case "XtoZ":case "YtoZ":case "ZtoY":a="Z"}break;case "Z":switch(ja){case "XtoZ":a="X";break;case "YtoZ":case "ZtoX":case "ZtoY":a="Y"}}return a}var fa=null,Na=null,wa,sa=null,Oa={},
|
|
|
Ha={},xa={},Wa={},Ya={},Ka={},db={},hb={},mb,Pa,ta,ua,ab,pa=THREE.SmoothShading,Ia={centerGeometry:false,convertUpAxis:false,subdivideFaces:true,upAxis:"Y"},Xa="Y",ja=null,Fb=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(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=
|
|
|
-a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new j).parse(c);this.type=c.nodeName}}return this};j.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new w).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=
|
|
|
-0;d<c.length;d++){a=c[d];e=b[a.source];switch(a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}}return this};j.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new B).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];
|
|
|
-for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=G(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new w).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
|
|
|
-(new B).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new B).parse(g));break;case "v":c=ha(g.textContent);break;case "vcount":d=ha(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=g+e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};l.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};l.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};l.prototype.parse=function(a){this.id=
|
|
|
+a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new j).parse(c);this.type=c.nodeName}}return this};j.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new z).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++){a=c[d];e=b[a.source];switch(a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}}return this};j.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new E).parse(d))}}return b};l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];
|
|
|
+for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=H(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new z).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
|
|
|
+(new E).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new E).parse(g));break;case "v":c=da(g.textContent);break;case "vcount":d=da(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var l={},k=0;k<e.length;k++){var m=
|
|
|
+e[k],n=c[g+m.offset];switch(m.semantic){case "JOINT":l.joint=n;break;case "WEIGHT":l.weight=b[m.source].data[n]}}i.push(l);g=g+e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=
|
|
|
a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f){d=e.split(".");e=d.shift();d.shift()}else if(g){h=e.split("(");e=h.shift();
|
|
|
for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a){c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h};return c}}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=
|
|
|
function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++){b=a.childNodes[c];
|
|
|
-if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":this.cameras.push((new H).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ea.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ea,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&
|
|
|
+if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":this.cameras.push((new A).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=fa.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",fa,X,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&
|
|
|
this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new m).parse(b));break;case "extra":break;default:console.log(b.nodeName)}}a=[];c=1E6;b=-1E6;for(var d in xa)for(var e=xa[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++){var i=this.channels[c],f=i.fullSid,g=i.sampler,h=g.input,j=this.getTransformBySid(i.sid),k;if(i.arrIndices){k=[];b=0;for(var l=i.arrIndices.length;b<l;b++){var r=k,q=b,s=i.arrIndices[b];if(s>-1&&s<3){s=aa(["X","Y","Z"][s]);s={X:0,Y:1,Z:2}[s]}r[q]=s}}else k=aa(i.member);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(l=h.length;b<l;b++){for(var r=h[b],i=g.getData(j.type,b),q=null,s=0,t=d.length;s<t&&q==null;s++){var u=d[s];if(u.time===
|
|
|
-r)q=u;else if(u.time>r)break}if(!q){q=new U(r);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=r&&(s=t);r=s;d.splice(r==-1?d.length:r,0,q)}q.addTarget(f,j,k,i)}}else console.log('Could not find transform "'+i.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){q=d[b];if(!q.hasTarget(e)){h=d;f=q;k=b;g=e;j=void 0;a:{j=k?k-1:0;for(j=j>=0?j:j+h.length;j>=0;j--){l=h[j];if(l.hasTarget(g)){j=l;break a}}j=null}l=void 0;a:{for(k=k+1;k<h.length;k++){l=h[k];if(l.hasTarget(g))break a}l=
|
|
|
-null}if(j&&l){h=(f.time-j.time)/(l.time-j.time);j=j.getTarget(g);k=l.getTarget(g).data;l=j.data;i=void 0;if(j.type==="matrix")i=l;else if(l.length){i=[];for(r=0;r<l.length;++r)i[r]=l[r]+(k[r]-l[r])*h}else i=l+(k-l)*h;f.addTarget(g,j.transform,j.member,i)}}}}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)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");
|
|
|
-this.type=a.nodeName;this.data=G(a.textContent);this.convert();return this};m.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*Fb;case "translate":R(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":R(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)}};m.prototype.apply=
|
|
|
+a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){var i=this.channels[c],f=i.fullSid,g=i.sampler,h=g.input,j=this.getTransformBySid(i.sid),l;if(i.arrIndices){l=[];b=0;for(var k=i.arrIndices.length;b<k;b++){var q=l,r=b,s=i.arrIndices[b];if(s>-1&&s<3){s=aa(["X","Y","Z"][s]);s={X:0,Y:1,Z:2}[s]}q[r]=s}}else l=aa(i.member);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(k=h.length;b<k;b++){for(var q=h[b],i=g.getData(j.type,b),r=null,s=0,t=d.length;s<t&&r==null;s++){var u=d[s];if(u.time===
|
|
|
+q)r=u;else if(u.time>q)break}if(!r){r=new T(q);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=q&&(s=t);q=s;d.splice(q==-1?d.length:q,0,r)}r.addTarget(f,j,l,i)}}else console.log('Could not find transform "'+i.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++){r=d[b];if(!r.hasTarget(e)){h=d;f=r;l=b;g=e;j=void 0;a:{j=l?l-1:0;for(j=j>=0?j:j+h.length;j>=0;j--){k=h[j];if(k.hasTarget(g)){j=k;break a}}j=null}k=void 0;a:{for(l=l+1;l<h.length;l++){k=h[l];if(k.hasTarget(g))break a}k=
|
|
|
+null}if(j&&k){h=(f.time-j.time)/(k.time-j.time);j=j.getTarget(g);l=k.getTarget(g).data;k=j.data;i=void 0;if(j.type==="matrix")i=k;else if(k.length){i=[];for(q=0;q<k.length;++q)i[q]=k[q]+(l[q]-k[q])*h}else i=k+(l-k)*h;f.addTarget(g,j.transform,j.member,i)}}}}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)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");
|
|
|
+this.type=a.nodeName;this.data=H(a.textContent);this.convert();return this};m.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*Fb;case "translate":Q(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":Q(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)}};m.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)}};m.prototype.update=function(a,b){var c=["X","Y","Z","ANGLE"];switch(this.type){case "matrix":if(b)if(b.length===1)switch(b[0]){case 0:this.obj.n11=a[0];this.obj.n21=a[1];this.obj.n31=a[2];this.obj.n41=a[3];break;case 1:this.obj.n12=a[0];this.obj.n22=a[1];this.obj.n32=a[2];this.obj.n42=a[3];break;
|
|
|
case 2:this.obj.n13=a[0];this.obj.n23=a[1];this.obj.n33=a[2];this.obj.n43=a[3];break;case 3:this.obj.n14=a[0];this.obj.n24=a[1];this.obj.n34=a[2];this.obj.n44=a[3]}else b.length===2?this.obj["n"+(b[0]+1)+(b[1]+1)]=a:console.log("Incorrect addressing of matrix in transform.");else this.obj.copy(a);break;case "translate":case "scale":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);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":Object.prototype.toString.call(b)==="[object Array]"&&(b=c[b[0]]);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*Fb;break;default:this.obj.x=a[0];this.obj.y=a[1];this.obj.z=a[2];this.angle=a[3]*Fb}}};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(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ea.evaluate(".//dae:instance_material",c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;){this.instance_material.push((new r).parse(d));d=c.iterateNext()}}}return this};r.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=
|
|
|
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=ea.evaluate(".//dae:instance_material",c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;){this.instance_material.push((new r).parse(b));b=a.iterateNext()}break}}return this};q.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 u(this)).parse(c)}}return this};u.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");Oa[d]==void 0&&(Oa[d]=(new w(d)).parse(c));break;case "vertices":this.vertices=(new D).parse(c);break;case "triangles":this.primitives.push((new s).parse(c));break;case "polygons":this.primitives.push((new t).parse(c));break;case "polylist":this.primitives.push((new y).parse(c))}}this.geometry3js=
|
|
|
-new THREE.Geometry;a=Oa[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b=b+3)this.geometry3js.vertices.push((new THREE.Vertex).copy($(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();if(this.geometry3js.calcNormals){this.geometry3js.computeVertexNormals();delete this.geometry3js.calcNormals}this.geometry3js.computeBoundingBox();
|
|
|
-return this};u.prototype.handlePrimitive=function(a,b){var c,d,e=a.p,f=a.inputs,g,h,i,j,k=0,l=3,m=0,n=[];for(c=0;c<f.length;c++){g=f[c];l=g.offset+1;m=m<l?l:m;switch(g.semantic){case "TEXCOORD":n.push(g.set)}}for(var o=0;o<e.length;++o)for(var p=e[o],r=0;r<p.length;){var q=[],s=[],t={},u=[],l=a.vcount?a.vcount.length?a.vcount[k++]:a.vcount:p.length/m;for(c=0;c<l;c++)for(d=0;d<f.length;d++){g=f[d];j=Oa[g.source];h=p[r+c*m+g.offset];i=j.accessor.params.length;i=h*i;switch(g.semantic){case "VERTEX":q.push(h);
|
|
|
-break;case "NORMAL":s.push($(j.data,i));break;case "TEXCOORD":t[g.set]===void 0&&(t[g.set]=[]);t[g.set].push(new THREE.UV(j.data[i],1-j.data[i+1]));break;case "COLOR":u.push((new THREE.Color).setRGB(j.data[i],j.data[i+1],j.data[i+2]))}}d=null;c=[];if(s.length==0)if(g=this.vertices.input.NORMAL){j=Oa[g.source];i=j.accessor.params.length;g=0;for(h=q.length;g<h;g++)s.push($(j.data,q[g]*i))}else b.calcNormals=true;if(l===3)c.push(new THREE.Face3(q[0],q[1],q[2],s,u.length?u:new THREE.Color));else if(l===
|
|
|
-4)c.push(new THREE.Face4(q[0],q[1],q[2],q[3],s,u.length?u:new THREE.Color));else if(l>4&&Ia.subdivideFaces){u=u.length?u:new THREE.Color;for(d=1;d<l-1;)c.push(new THREE.Face3(q[0],q[d],q[d+1],[s[0],s[d++],s[d]],u))}if(c.length){g=0;for(h=c.length;g<h;g++){d=c[g];d.daeMaterial=a.material;b.faces.push(d);for(d=0;d<n.length;d++){q=t[n[d]];q=l>4?[q[0],q[g+1],q[g+2]]:l===4?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]];b.faceVertexUvs[d]||(b.faceVertexUvs[d]=[]);b.faceVertexUvs[d].push(q)}}}else console.log("dropped face with vcount "+
|
|
|
-l+" for geometry with id: "+b.id);r=r+m*l}};t.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};t.prototype.parse=function(a){this.material=a.getAttribute("material");this.count=la(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 B).parse(a.childNodes[b]));break;case "vcount":this.vcount=ha(c.textContent);break;case "p":this.p.push(ha(c.textContent));
|
|
|
-break;case "ph":console.warn("polygon holes not yet supported!")}}return this};y.prototype=new t;y.prototype.constructor=y;s.prototype=new t;s.prototype.constructor=s;x.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};D.prototype.parse=
|
|
|
-function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new B).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=la(a,"set",-1);this.offset=la(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=
|
|
|
-0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=fa(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push(d[f]=="true"||d[f]=="1"?true:false);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=G(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=ha(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=fa(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName==
|
|
|
-"accessor"){this.accessor=(new x).parse(c.childNodes[d]);break}}}return this};w.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b=b+16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};v.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
|
|
|
-for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new J).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=G(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=
|
|
|
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=fa.evaluate(".//dae:instance_material",c,X,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;){this.instance_material.push((new q).parse(d));d=c.iterateNext()}}}return this};q.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=
|
|
|
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=fa.evaluate(".//dae:instance_material",c,X,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 u(this)).parse(c)}}return this};u.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");Oa[d]==void 0&&(Oa[d]=(new z(d)).parse(c));break;case "vertices":this.vertices=(new F).parse(c);break;case "triangles":this.primitives.push((new s).parse(c));break;case "polygons":this.primitives.push((new t).parse(c));break;case "polylist":this.primitives.push((new x).parse(c))}}this.geometry3js=
|
|
|
+new THREE.Geometry;a=Oa[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b=b+3)this.geometry3js.vertices.push((new THREE.Vertex).copy(S(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();if(this.geometry3js.calcNormals){this.geometry3js.computeVertexNormals();delete this.geometry3js.calcNormals}this.geometry3js.computeBoundingBox();
|
|
|
+return this};u.prototype.handlePrimitive=function(a,b){var c,d,e=a.p,f=a.inputs,g,h,i,j,l=0,k=3,m=0,n=[];for(c=0;c<f.length;c++){g=f[c];k=g.offset+1;m=m<k?k:m;switch(g.semantic){case "TEXCOORD":n.push(g.set)}}for(var o=0;o<e.length;++o)for(var p=e[o],q=0;q<p.length;){var r=[],s=[],t={},u=[],k=a.vcount?a.vcount.length?a.vcount[l++]:a.vcount:p.length/m;for(c=0;c<k;c++)for(d=0;d<f.length;d++){g=f[d];j=Oa[g.source];h=p[q+c*m+g.offset];i=j.accessor.params.length;i=h*i;switch(g.semantic){case "VERTEX":r.push(h);
|
|
|
+break;case "NORMAL":s.push(S(j.data,i));break;case "TEXCOORD":t[g.set]===void 0&&(t[g.set]=[]);t[g.set].push(new THREE.UV(j.data[i],1-j.data[i+1]));break;case "COLOR":u.push((new THREE.Color).setRGB(j.data[i],j.data[i+1],j.data[i+2]))}}d=null;c=[];if(s.length==0)if(g=this.vertices.input.NORMAL){j=Oa[g.source];i=j.accessor.params.length;g=0;for(h=r.length;g<h;g++)s.push(S(j.data,r[g]*i))}else b.calcNormals=true;if(k===3)c.push(new THREE.Face3(r[0],r[1],r[2],s,u.length?u:new THREE.Color));else if(k===
|
|
|
+4)c.push(new THREE.Face4(r[0],r[1],r[2],r[3],s,u.length?u:new THREE.Color));else if(k>4&&Ia.subdivideFaces){u=u.length?u:new THREE.Color;for(d=1;d<k-1;)c.push(new THREE.Face3(r[0],r[d],r[d+1],[s[0],s[d++],s[d]],u))}if(c.length){g=0;for(h=c.length;g<h;g++){d=c[g];d.daeMaterial=a.material;b.faces.push(d);for(d=0;d<n.length;d++){r=t[n[d]];r=k>4?[r[0],r[g+1],r[g+2]]:k===4?[r[0],r[1],r[2],r[3]]:[r[0],r[1],r[2]];b.faceVertexUvs[d]||(b.faceVertexUvs[d]=[]);b.faceVertexUvs[d].push(r)}}}else console.log("dropped face with vcount "+
|
|
|
+k+" for geometry with id: "+b.id);q=q+m*k}};t.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};t.prototype.parse=function(a){this.material=a.getAttribute("material");this.count=la(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 E).parse(a.childNodes[b]));break;case "vcount":this.vcount=da(c.textContent);break;case "p":this.p.push(da(c.textContent));
|
|
|
+break;case "ph":console.warn("polygon holes not yet supported!")}}return this};x.prototype=new t;x.prototype.constructor=x;s.prototype=new t;s.prototype.constructor=s;w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};F.prototype.parse=
|
|
|
+function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new E).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};E.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=la(a,"set",-1);this.offset=la(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};z.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=ga(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push(d[f]=="true"||d[f]=="1"?true:false);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=da(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ga(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName==
|
|
|
+"accessor"){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};z.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=b+16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};v.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
|
|
|
+for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new B).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=H(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;if(a.childNodes[1]&&a.childNodes[1].nodeName==="extra"){a=a.childNodes[1];a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(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};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=ea.evaluate(".//dae:float",
|
|
|
-c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;){f.push(e);e=d.iterateNext()}d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};K.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
|
|
|
+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};J.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=fa.evaluate(".//dae:float",
|
|
|
+c,X,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;){f.push(e);e=d.iterateNext()}d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};J.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
|
|
|
this.effect.surface.sid){var e=Ha[this.effect.surface.init_from];if(e){e=THREE.ImageUtils.loadTexture(ta+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;c=="emission"&&(a.emissive=16777215)}}}else if(c=="diffuse"||!b)c=="emission"?a.emissive=d.color.getHex():a[c]=d.color.getHex();
|
|
|
break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b){a.transparent=true;a.opacity=this[c];b=true}}a.shading=pa;switch(this.type){case "constant":a.color=a.emission;this.material=new THREE.MeshBasicMaterial(a);break;case "phong":case "blinn":a.color=a.diffuse;this.material=new THREE.MeshPhongMaterial(a);break;default:a.color=a.diffuse;this.material=new THREE.MeshLambertMaterial(a)}return this.material};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
|
|
|
-a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};T.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
|
|
|
+a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};W.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "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};P.prototype.create=function(){if(this.shader==null)return null};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
|
|
|
-P.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new L(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new T(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};P.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
|
|
|
-break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "image":d=(new g).parse(d);Ha[d.id]=d;break;case "extra":break;default:console.log(d.nodeName)}}return b};P.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new K(c.nodeName,this)).parse(c)}}};J.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,
|
|
|
-"");return this};N.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "animation":var c=(new N).parse(c),d;for(d in c.source)this.source[d]=c.source[d];for(var e=0;e<c.channel.length;e++){this.channel.push(c.channel[e]);this.sampler.push(c.sampler[e])}break;case "source":d=(new w).parse(c);this.source[d.id]=d;break;case "sampler":this.sampler.push((new i(this)).parse(c));
|
|
|
-break;case "channel":this.channel.push((new F(this)).parse(c))}}return this};F.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;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};i.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new B).parse(c))}}return this};i.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=
|
|
|
+P.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new L(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new W(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};P.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
|
|
|
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "image":d=(new g).parse(d);Ha[d.id]=d;break;case "extra":break;default:console.log(d.nodeName)}}return b};P.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new J(c.nodeName,this)).parse(c)}}};B.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,
|
|
|
+"");return this};M.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "animation":var c=(new M).parse(c),d;for(d in c.source)this.source[d]=c.source[d];for(var e=0;e<c.channel.length;e++){this.channel.push(c.channel[e]);this.sampler.push(c.sampler[e])}break;case "source":d=(new z).parse(c);this.source[d.id]=d;break;case "sampler":this.sampler.push((new i(this)).parse(c));
|
|
|
+break;case "channel":this.channel.push((new G(this)).parse(c))}}return this};G.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;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};i.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new E).parse(c))}}return this};i.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}};i.prototype.getData=function(a,b){var c;if(a==="matrix"&&
|
|
|
-this.strideOut===16)c=this.output[b];else if(this.strideOut>1){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":R(c,-1);break;case "scale":R(c,1)}else this.strideOut===4&&a==="matrix"&&R(c,-1)}else c=this.output[b];return c};U.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};U.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)}};U.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};U.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return true;return false};U.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(d.transform.type!=="matrix"&&e){var f=(b-this.time)/(a.time-this.time),
|
|
|
-g=e.data,h=d.data;if(f<0||f>1){console.log("Key.interpolate: Warning! Scale out of bounds:"+f);f=f<0?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)}};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};E.prototype.parseOptics=function(a){for(var b=
|
|
|
+this.strideOut===16)c=this.output[b];else if(this.strideOut>1){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":Q(c,-1);break;case "scale":Q(c,1)}else this.strideOut===4&&a==="matrix"&&Q(c,-1)}else c=this.output[b];return c};T.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};T.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)}};T.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};T.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return true;return false};T.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(d.transform.type!=="matrix"&&e){var f=(b-this.time)/(a.time-this.time),
|
|
|
+g=e.data,h=d.data;if(f<0||f>1){console.log("Key.interpolate: Warning! Scale out of bounds:"+f);f=f<0?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)}};V.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};V.prototype.parseOptics=function(a){for(var b=
|
|
|
0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="technique_common")for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++){this.technique=c.childNodes[d].nodeName;if(this.technique=="perspective")for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "yfov":this.yfov=g.textContent;break;case "xfov":this.xfov=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=g.textContent;break;case "aspect_ratio":this.aspect_ratio=
|
|
|
-g.textContent}}else if(this.technique=="orthographic"){e=c.childNodes[d];for(f=0;f<e.childNodes.length;f++){g=e.childNodes[f];switch(g.nodeName){case "xmag":this.xmag=g.textContent;break;case "ymag":this.ymag=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=g.textContent;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}}}return this};H.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=
|
|
|
+g.textContent}}else if(this.technique=="orthographic"){e=c.childNodes[d];for(f=0;f<e.childNodes.length;f++){g=e.childNodes[f];switch(g.nodeName){case "xmag":this.xmag=g.textContent;break;case "ymag":this.ymag=g.textContent;break;case "znear":this.znear=g.textContent;break;case "zfar":this.zfar=g.textContent;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}}}return this};A.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};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(f.readyState==4){if(f.status==0||f.status==200)if(f.responseXML){sa=c;a(f.responseXML,void 0,b)}else console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else if(f.readyState==3&&d){e==0&&(e=f.getResponseHeader("Content-Length"));d({total:e,loaded:f.responseText.length})}};f.open("GET",b,true);f.send(null)}else alert("Don't know how to parse XML!")},
|
|
|
parse:a,setPreferredShading:function(a){pa=a},applySkin:e,geometries:Ya,options:Ia}};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){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(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else if(f.readyState===f.LOADING){if(e){g===0&&(g=f.getResponseHeader("Content-Length"));
|
|
|
e({total:g,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,true);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=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,j,k,l,p,m,o,r,n,q,u,t,y,s=a.faces;p=a.vertices;var x=a.normals,D=a.colors,B=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&B++;for(c=0;c<B;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(l=p.length;k<l;){m=new THREE.Vertex;m.x=p[k++]*b;m.y=p[k++]*b;m.z=p[k++]*b;d.vertices.push(m)}k=0;for(l=s.length;k<l;){b=s[k++];p=b&1;j=b&2;c=b&
|
|
|
-4;e=b&8;o=b&16;m=b&32;n=b&64;b=b&128;if(p){q=new THREE.Face4;q.a=s[k++];q.b=s[k++];q.c=s[k++];q.d=s[k++];p=4}else{q=new THREE.Face3;q.a=s[k++];q.b=s[k++];q.c=s[k++];p=3}if(j){j=s[k++];q.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<B;c++){u=a.uvs[c];r=s[k++];y=u[r*2];r=u[r*2+1];d.faceUvs[c][j]=new THREE.UV(y,r)}if(e)for(c=0;c<B;c++){u=a.uvs[c];t=[];for(e=0;e<p;e++){r=s[k++];y=u[r*2];r=u[r*2+1];t[e]=new THREE.UV(y,r)}d.faceVertexUvs[c][j]=t}if(o){o=s[k++]*3;e=new THREE.Vector3;e.x=x[o++];e.y=x[o++];
|
|
|
-e.z=x[o];q.normal=e}if(m)for(c=0;c<p;c++){o=s[k++]*3;e=new THREE.Vector3;e.x=x[o++];e.y=x[o++];e.z=x[o];q.vertexNormals.push(e)}if(n){m=s[k++];m=new THREE.Color(D[m]);q.color=m}if(b)for(c=0;c<p;c++){m=s[k++];m=new THREE.Color(D[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,j;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];j=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,j,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
|
|
|
-b+2){e=a.skinIndices[b];j=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,j,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,j,k,l,p,m,o,r;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;j=0;for(k=r.length;j<k;j=j+3){l=r[j]*b;p=r[j+1]*b;m=r[j+2]*b;o.push(new THREE.Vertex(l,p,m))}}}if(a.morphColors!==
|
|
|
-void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(j=l.length;b<j;b=b+3){p=new THREE.Color(16755200);p.setRGB(l[b],l[b+1],l[b+2]);k.push(p)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,j,l,k,p,m,o,q,n,r,u,t,x,s=a.faces;p=a.vertices;var w=a.normals,F=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}l=0;for(k=p.length;l<k;){m=new THREE.Vertex;m.x=p[l++]*b;m.y=p[l++]*b;m.z=p[l++]*b;d.vertices.push(m)}l=0;for(k=s.length;l<k;){b=s[l++];p=b&1;j=b&2;c=b&
|
|
|
+4;e=b&8;o=b&16;m=b&32;n=b&64;b=b&128;if(p){r=new THREE.Face4;r.a=s[l++];r.b=s[l++];r.c=s[l++];r.d=s[l++];p=4}else{r=new THREE.Face3;r.a=s[l++];r.b=s[l++];r.c=s[l++];p=3}if(j){j=s[l++];r.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<E;c++){u=a.uvs[c];q=s[l++];x=u[q*2];q=u[q*2+1];d.faceUvs[c][j]=new THREE.UV(x,q)}if(e)for(c=0;c<E;c++){u=a.uvs[c];t=[];for(e=0;e<p;e++){q=s[l++];x=u[q*2];q=u[q*2+1];t[e]=new THREE.UV(x,q)}d.faceVertexUvs[c][j]=t}if(o){o=s[l++]*3;e=new THREE.Vector3;e.x=w[o++];e.y=w[o++];
|
|
|
+e.z=w[o];r.normal=e}if(m)for(c=0;c<p;c++){o=s[l++]*3;e=new THREE.Vector3;e.x=w[o++];e.y=w[o++];e.z=w[o];r.vertexNormals.push(e)}if(n){m=s[l++];m=new THREE.Color(F[m]);r.color=m}if(b)for(c=0;c<p;c++){m=s[l++];m=new THREE.Color(F[m]);r.vertexColors.push(m)}d.faces.push(r)}})(e);(function(){var b,c,e,j;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];j=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,j,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
|
|
|
+b+2){e=a.skinIndices[b];j=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,j,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,j,l,k,p,m,o,q;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;q=a.morphTargets[c].vertices;j=0;for(l=q.length;j<l;j=j+3){k=q[j]*b;p=q[j+1]*b;m=q[j+2]*b;o.push(new THREE.Vertex(k,p,m))}}}if(a.morphColors!==
|
|
|
+void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(j=k.length;b<j;b=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(d.readyState==4)if(d.status==200||d.status==0){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);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 b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(m in P.objects)if(!E.objects[m]){u=P.objects[m];if(u.geometry!==void 0){if(C=E.geometries[u.geometry]){a=false;K=E.materials[u.materials[0]];(a=K instanceof THREE.ShaderMaterial)&&C.computeTangents();s=u.position;x=u.rotation;D=u.quaternion;B=u.scale;D=0;u.materials.length==0&&(K=new THREE.MeshFaceMaterial);u.materials.length>1&&(K=new THREE.MeshFaceMaterial);a=new THREE.Mesh(C,
|
|
|
-K);a.name=m;a.position.set(s[0],s[1],s[2]);if(D){a.quaternion.set(D[0],D[1],D[2],D[3]);a.useQuaternion=true}else a.rotation.set(x[0],x[1],x[2]);a.scale.set(B[0],B[1],B[2]);a.visible=u.visible;a.doubleSided=u.doubleSided;a.castShadow=u.castShadow;a.receiveShadow=u.receiveShadow;E.scene.add(a);E.objects[m]=a}}else{s=u.position;x=u.rotation;D=u.quaternion;B=u.scale;D=0;a=new THREE.Object3D;a.name=m;a.position.set(s[0],s[1],s[2]);if(D){a.quaternion.set(D[0],D[1],D[2],D[3]);a.useQuaternion=true}else a.rotation.set(x[0],
|
|
|
-x[1],x[2]);a.scale.set(B[0],B[1],B[2]);a.visible=u.visible!==void 0?u.visible:false;E.scene.add(a);E.objects[m]=a;E.empties[m]=a}}}function f(a){return function(b){E.geometries[a]=b;e();N=N-1;j.onLoadComplete();h()}}function g(a){return function(b){E.geometries[a]=b}}function h(){j.callbackProgress({totalModels:i,totalTextures:U,loadedModels:i-N,loadedTextures:U-F},E);j.onLoadProgress();N==0&&F==0&&b(E)}var j=this,k=THREE.Loader.prototype.extractUrlBase(c),l,p,m,o,r,n,q,u,t,y,s,x,D,B,w,v,C,K,L,T,
|
|
|
-P,J,N,F,i,U,E;P=a;c=new THREE.BinaryLoader;J=new THREE.JSONLoader;F=N=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(P.transform){a=P.transform.position;t=P.transform.rotation;w=P.transform.scale;a&&E.scene.position.set(a[0],a[1],a[2]);t&&E.scene.rotation.set(t[0],t[1],t[2]);w&&E.scene.scale.set(w[0],w[1],w[2]);if(a||t||w){E.scene.updateMatrix();E.scene.updateMatrixWorld()}}a=function(){F=F-1;h();j.onLoadComplete()};for(r in P.cameras){w=
|
|
|
-P.cameras[r];w.type=="perspective"?L=new THREE.PerspectiveCamera(w.fov,w.aspect,w.near,w.far):w.type=="ortho"&&(L=new THREE.OrthographicCamera(w.left,w.right,w.top,w.bottom,w.near,w.far));s=w.position;t=w.target;w=w.up;L.position.set(s[0],s[1],s[2]);L.target=new THREE.Vector3(t[0],t[1],t[2]);w&&L.up.set(w[0],w[1],w[2]);E.cameras[r]=L}for(o in P.lights){t=P.lights[o];r=t.color!==void 0?t.color:16777215;L=t.intensity!==void 0?t.intensity:1;if(t.type=="directional"){s=t.direction;y=new THREE.DirectionalLight(r,
|
|
|
-L);y.position.set(s[0],s[1],s[2]);y.position.normalize()}else if(t.type=="point"){s=t.position;y=t.distance;y=new THREE.PointLight(r,L,y);y.position.set(s[0],s[1],s[2])}else t.type=="ambient"&&(y=new THREE.AmbientLight(r));E.scene.add(y);E.lights[o]=y}for(n in P.fogs){o=P.fogs[n];o.type=="linear"?T=new THREE.Fog(0,o.near,o.far):o.type=="exp2"&&(T=new THREE.FogExp2(0,o.density));w=o.color;T.color.setRGB(w[0],w[1],w[2]);E.fogs[n]=T}if(E.cameras&&P.defaults.camera)E.currentCamera=E.cameras[P.defaults.camera];
|
|
|
-if(E.fogs&&P.defaults.fog)E.scene.fog=E.fogs[P.defaults.fog];w=P.defaults.bgcolor;E.bgColor=new THREE.Color;E.bgColor.setRGB(w[0],w[1],w[2]);E.bgColorAlpha=P.defaults.bgalpha;for(l in P.geometries){n=P.geometries[l];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){N=N+1;j.onLoadStart()}}i=N;for(l in P.geometries){n=P.geometries[l];if(n.type=="cube"){C=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);E.geometries[l]=C}else if(n.type==
|
|
|
-"plane"){C=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);E.geometries[l]=C}else if(n.type=="sphere"){C=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);E.geometries[l]=C}else if(n.type=="cylinder"){C=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs);E.geometries[l]=C}else if(n.type=="torus"){C=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);E.geometries[l]=C}else if(n.type=="icosahedron"){C=new THREE.IcosahedronGeometry(n.radius,
|
|
|
-n.subdivisions);E.geometries[l]=C}else if(n.type=="bin_mesh")c.load(d(n.url,P.urlBaseType),f(l));else if(n.type=="ascii_mesh")J.load(d(n.url,P.urlBaseType),f(l));else if(n.type=="embedded_mesh"){n=P.embeds[n.id];n.metadata=P.metadata;n&&J.createModel(n,g(l),"")}}for(q in P.textures){l=P.textures[q];if(l.url instanceof Array){F=F+l.url.length;for(n=0;n<l.url.length;n++)j.onLoadStart()}else{F=F+1;j.onLoadStart()}}U=F;for(q in P.textures){l=P.textures[q];if(l.mapping!=void 0&&THREE[l.mapping]!=void 0)l.mapping=
|
|
|
-new THREE[l.mapping];if(l.url instanceof Array){n=[];for(T=0;T<l.url.length;T++)n[T]=d(l.url[T],P.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,l.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(l.url,P.urlBaseType),l.mapping,a);if(THREE[l.minFilter]!=void 0)n.minFilter=THREE[l.minFilter];if(THREE[l.magFilter]!=void 0)n.magFilter=THREE[l.magFilter];if(l.repeat){n.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}l.offset&&
|
|
|
-n.offset.set(l.offset[0],l.offset[1]);if(l.wrap){T={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(T[l.wrap[0]]!==void 0)n.wrapS=T[l.wrap[0]];if(T[l.wrap[1]]!==void 0)n.wrapT=T[l.wrap[1]]}}E.textures[q]=n}for(p in P.materials){q=P.materials[p];for(v in q.parameters)if(v=="envMap"||v=="map"||v=="lightMap")q.parameters[v]=E.textures[q.parameters[v]];else if(v=="shading")q.parameters[v]=q.parameters[v]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(v=="blending")q.parameters[v]=
|
|
|
-THREE[q.parameters[v]]?THREE[q.parameters[v]]:THREE.NormalBlending;else if(v=="combine")q.parameters[v]=q.parameters[v]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(v=="vertexColors")if(q.parameters[v]=="face")q.parameters[v]=THREE.FaceColors;else if(q.parameters[v])q.parameters[v]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=true;if(q.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(a.uniforms);
|
|
|
-n=q.parameters.color;T=q.parameters.specular;c=q.parameters.ambient;J=q.parameters.shininess;l.tNormal.texture=E.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)l.uNormalScale.value=q.parameters.normalMapFactor;if(q.parameters.map){l.tDiffuse.texture=q.parameters.map;l.enableDiffuse.value=true}if(q.parameters.lightMap){l.tAO.texture=q.parameters.lightMap;l.enableAO.value=true}if(q.parameters.specularMap){l.tSpecular.texture=E.textures[q.parameters.specularMap];l.enableSpecular.value=
|
|
|
-true}l.uDiffuseColor.value.setHex(n);l.uSpecularColor.value.setHex(T);l.uAmbientColor.value.setHex(c);l.uShininess.value=J;if(q.parameters.opacity)l.uOpacity.value=q.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:l,lights:true,fog:true})}else K=new THREE[q.type](q.parameters);E.materials[p]=K}e();j.callbackSync(E);h()};THREE.UTF8Loader=function(){};
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function e(){var a;for(m in B.objects)if(!A.objects[m]){u=B.objects[m];if(u.geometry!==void 0){if(J=A.geometries[u.geometry]){a=false;L=A.materials[u.materials[0]];(a=L instanceof THREE.ShaderMaterial)&&J.computeTangents();w=u.position;F=u.rotation;E=u.quaternion;z=u.scale;t=u.matrix;E=0;u.materials.length==0&&(L=new THREE.MeshFaceMaterial);u.materials.length>1&&(L=new THREE.MeshFaceMaterial);
|
|
|
+a=new THREE.Mesh(J,L);a.name=m;if(t){a.matrixAutoUpdate=false;a.matrix.set(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}else{a.position.set(w[0],w[1],w[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(z[0],z[1],z[2])}a.visible=u.visible;a.doubleSided=u.doubleSided;a.castShadow=u.castShadow;a.receiveShadow=u.receiveShadow;A.scene.add(a);A.objects[m]=a}}else{w=u.position;F=u.rotation;E=u.quaternion;
|
|
|
+z=u.scale;E=0;a=new THREE.Object3D;a.name=m;a.position.set(w[0],w[1],w[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(F[0],F[1],F[2]);a.scale.set(z[0],z[1],z[2]);a.visible=u.visible!==void 0?u.visible:false;A.scene.add(a);A.objects[m]=a;A.empties[m]=a}}}function f(a){return function(b){A.geometries[a]=b;e();G=G-1;j.onLoadComplete();h()}}function g(a){return function(b){A.geometries[a]=b}}function h(){j.callbackProgress({totalModels:T,totalTextures:V,loadedModels:T-
|
|
|
+G,loadedTextures:V-i},A);j.onLoadProgress();G==0&&i==0&&b(A)}var j=this,l=THREE.Loader.prototype.extractUrlBase(c),k,p,m,o,q,n,r,u,t,x,s,w,F,E,z,v,C,J,L,W,P,B,M,G,i,T,V,A;B=a;c=new THREE.BinaryLoader;M=new THREE.JSONLoader;i=G=0;A={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(B.transform){a=B.transform.position;x=B.transform.rotation;v=B.transform.scale;a&&A.scene.position.set(a[0],a[1],a[2]);x&&A.scene.rotation.set(x[0],x[1],
|
|
|
+x[2]);v&&A.scene.scale.set(v[0],v[1],v[2]);if(a||x||v){A.scene.updateMatrix();A.scene.updateMatrixWorld()}}a=function(){i=i-1;h();j.onLoadComplete()};for(q in B.cameras){v=B.cameras[q];v.type=="perspective"?W=new THREE.PerspectiveCamera(v.fov,v.aspect,v.near,v.far):v.type=="ortho"&&(W=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far));w=v.position;x=v.target;v=v.up;W.position.set(w[0],w[1],w[2]);W.target=new THREE.Vector3(x[0],x[1],x[2]);v&&W.up.set(v[0],v[1],v[2]);A.cameras[q]=
|
|
|
+W}for(o in B.lights){x=B.lights[o];q=x.color!==void 0?x.color:16777215;W=x.intensity!==void 0?x.intensity:1;if(x.type=="directional"){w=x.direction;s=new THREE.DirectionalLight(q,W);s.position.set(w[0],w[1],w[2]);s.position.normalize()}else if(x.type=="point"){w=x.position;s=x.distance;s=new THREE.PointLight(q,W,s);s.position.set(w[0],w[1],w[2])}else x.type=="ambient"&&(s=new THREE.AmbientLight(q));A.scene.add(s);A.lights[o]=s}for(n in B.fogs){o=B.fogs[n];o.type=="linear"?P=new THREE.Fog(0,o.near,
|
|
|
+o.far):o.type=="exp2"&&(P=new THREE.FogExp2(0,o.density));v=o.color;P.color.setRGB(v[0],v[1],v[2]);A.fogs[n]=P}if(A.cameras&&B.defaults.camera)A.currentCamera=A.cameras[B.defaults.camera];if(A.fogs&&B.defaults.fog)A.scene.fog=A.fogs[B.defaults.fog];v=B.defaults.bgcolor;A.bgColor=new THREE.Color;A.bgColor.setRGB(v[0],v[1],v[2]);A.bgColorAlpha=B.defaults.bgalpha;for(k in B.geometries){n=B.geometries[k];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){G=G+1;j.onLoadStart()}}T=G;for(k in B.geometries){n=
|
|
|
+B.geometries[k];if(n.type=="cube"){J=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);A.geometries[k]=J}else if(n.type=="plane"){J=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);A.geometries[k]=J}else if(n.type=="sphere"){J=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);A.geometries[k]=J}else if(n.type=="cylinder"){J=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,
|
|
|
+n.heightSegs);A.geometries[k]=J}else if(n.type=="torus"){J=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);A.geometries[k]=J}else if(n.type=="icosahedron"){J=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);A.geometries[k]=J}else if(n.type=="bin_mesh")c.load(d(n.url,B.urlBaseType),f(k));else if(n.type=="ascii_mesh")M.load(d(n.url,B.urlBaseType),f(k));else if(n.type=="embedded_mesh"){n=B.embeds[n.id];n.metadata=B.metadata;n&&M.createModel(n,g(k),"")}}for(r in B.textures){k=B.textures[r];
|
|
|
+if(k.url instanceof Array){i=i+k.url.length;for(n=0;n<k.url.length;n++)j.onLoadStart()}else{i=i+1;j.onLoadStart()}}V=i;for(r in B.textures){k=B.textures[r];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(P=0;P<k.url.length;P++)n[P]=d(k.url[P],B.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,B.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)n.minFilter=THREE[k.minFilter];
|
|
|
+if(THREE[k.magFilter]!=void 0)n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);if(k.wrap){P={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(P[k.wrap[0]]!==void 0)n.wrapS=P[k.wrap[0]];if(P[k.wrap[1]]!==void 0)n.wrapT=P[k.wrap[1]]}}A.textures[r]=n}for(p in B.materials){t=B.materials[p];for(C in t.parameters)if(C==
|
|
|
+"envMap"||C=="map"||C=="lightMap")t.parameters[C]=A.textures[t.parameters[C]];else if(C=="shading")t.parameters[C]=t.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C=="blending")t.parameters[C]=THREE[t.parameters[C]]?THREE[t.parameters[C]]:THREE.NormalBlending;else if(C=="combine")t.parameters[C]=t.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(t.parameters[C]=="face")t.parameters[C]=THREE.FaceColors;else if(t.parameters[C])t.parameters[C]=
|
|
|
+THREE.VertexColors;if(t.parameters.opacity!==void 0&&t.parameters.opacity<1)t.parameters.transparent=true;if(t.parameters.normalMap){r=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(r.uniforms);k=t.parameters.color;n=t.parameters.specular;P=t.parameters.ambient;c=t.parameters.shininess;a.tNormal.texture=A.textures[t.parameters.normalMap];if(t.parameters.normalMapFactor)a.uNormalScale.value=t.parameters.normalMapFactor;if(t.parameters.map){a.tDiffuse.texture=t.parameters.map;a.enableDiffuse.value=
|
|
|
+true}if(t.parameters.lightMap){a.tAO.texture=t.parameters.lightMap;a.enableAO.value=true}if(t.parameters.specularMap){a.tSpecular.texture=A.textures[t.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(k);a.uSpecularColor.value.setHex(n);a.uAmbientColor.value.setHex(P);a.uShininess.value=c;if(t.parameters.opacity)a.uOpacity.value=t.parameters.opacity;L=new THREE.ShaderMaterial({fragmentShader:r.fragmentShader,vertexShader:r.vertexShader,uniforms:a,lights:true,fog:true})}else L=
|
|
|
+new THREE[t.type](t.parameters);A.materials[p]=L}e();j.callbackSync(A);h()};THREE.UTF8Loader=function(){};
|
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,f=c.offsetX!==void 0?c.offsetX:0,g=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,b,e,f,g,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,
|
|
|
true);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b=b-2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;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=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;h==0&&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),k=[],l=[];(function(a,g,j){for(var k,l,q,u=a.length;j<u;j=j+g){k=a[j];l=a[j+1];q=a[j+2];k=k/16383*c;l=l/16383*c;q=q/16383*c;k=k+d;l=l+e;q=q+f;b.vertices.push(new THREE.Vertex(k,l,q))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=c+b){d=a[c];e=a[c+1];d=d/1023;e=e/1023;l.push(d,1-e)}})(g[0],8,3);(function(a,
|
|
|
-b,c){for(var d,e,f,g=a.length;c<g;c=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;k.push(d,e,f)}})(g[0],8,5);(function(a){var c,d,e,f,g,j,t,y,s,x=a.length;for(c=0;c<x;c=c+3){d=a[c];e=a[c+1];f=a[c+2];g=b;y=d;s=e;j=f;var D=k[e*3],B=k[e*3+1],w=k[e*3+2],v=k[f*3],C=k[f*3+1],K=k[f*3+2];t=new THREE.Vector3(k[d*3],k[d*3+1],k[d*3+2]);D=new THREE.Vector3(D,B,w);v=new THREE.Vector3(v,C,K);g.faces.push(new THREE.Face3(y,s,j,[t,D,v],null,0));g=l[d*2];d=l[d*2+1];j=l[e*2];t=l[e*2+1];y=
|
|
|
-l[f*2];s=l[f*2+1];f=b.faceVertexUvs[0];e=j;j=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,j));t.push(new THREE.UV(y,s));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
|
|
|
+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,j){for(var l,k,r,u=a.length;j<u;j=j+g){l=a[j];k=a[j+1];r=a[j+2];l=l/16383*c;k=k/16383*c;r=r/16383*c;l=l+d;k=k+e;r=r+f;b.vertices.push(new THREE.Vertex(l,k,r))}})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c=c+b){d=a[c];e=a[c+1];d=d/1023;e=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=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,j,t,x,s,w=a.length;for(c=0;c<w;c=c+3){d=a[c];e=a[c+1];f=a[c+2];g=b;x=d;s=e;j=f;var F=l[e*3],E=l[e*3+1],z=l[e*3+2],v=l[f*3],C=l[f*3+1],J=l[f*3+2];t=new THREE.Vector3(l[d*3],l[d*3+1],l[d*3+2]);F=new THREE.Vector3(F,E,z);v=new THREE.Vector3(v,C,J);g.faces.push(new THREE.Face3(x,s,j,[t,F,v],null,0));g=k[d*2];d=k[d*2+1];j=k[e*2];t=k[e*2+1];x=
|
|
|
+k[f*2];s=k[f*2+1];f=b.faceVertexUvs[0];e=j;j=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,j));t.push(new THREE.UV(x,s));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
|
|
|
THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){b===void 0&&(b=-1);c===void 0&&(c=0);f===void 0&&(f=1);e===void 0&&(e=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
|
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+e*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
|
|
@@ -760,41 +761,41 @@ THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.ani
|
|
|
THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
|
|
|
THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time=d.time+d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||d.time<0){d.direction=d.direction*-1;if(d.time>d.duration){d.time=d.duration;d.directionBackwards=true}if(d.time<0){d.time=0;d.directionBackwards=false}}}else{d.time=d.time%d.duration;if(d.time<0)d.time=d.time+d.duration}var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/
|
|
|
e),0,d.length-1),g=d.weight;if(f!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[f]=0;d.lastFrame=d.currentFrame;d.currentFrame=f}e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};
|
|
|
-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,j,k,l,p,m,o;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);e=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
|
|
|
-0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;e[r++]=0;e[r++]=1;e[r++]=2;e[r++]=0;e[r++]=2;e[r++]=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();j=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,
|
|
|
+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,j,l,k,p,m,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++]=
|
|
|
+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();j=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,j);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);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){k=false;l=a(THREE.ShaderFlares.lensFlare)}else{k=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}p={};m={};p.vertex=b.getAttribLocation(l,"position");p.uv=b.getAttribLocation(l,"uv");m.renderType=b.getUniformLocation(l,"renderType");m.map=b.getUniformLocation(l,"map");m.occlusionMap=b.getUniformLocation(l,"occlusionMap");m.opacity=b.getUniformLocation(l,"opacity");m.color=b.getUniformLocation(l,
|
|
|
-"color");m.scale=b.getUniformLocation(l,"scale");m.rotation=b.getUniformLocation(l,"rotation");m.screenPosition=b.getUniformLocation(l,"screenPosition");o=false};this.render=function(a,d,e,u){var a=a.__webglFlares,t=a.length;if(t){var y=new THREE.Vector3,s=u/e,x=e*0.5,D=u*0.5,B=16/u,w=new THREE.Vector2(B*s,B),v=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),K=m,B=p;b.useProgram(l);if(!o){b.enableVertexAttribArray(p.vertex);b.enableVertexAttribArray(p.uv);o=true}b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
|
|
|
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(B.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var L,T,P,J,N;for(L=0;L<t;L++){B=16/u;w.set(B*s,B);J=a[L];y.set(J.matrixWorld.elements[12],J.matrixWorld.elements[13],J.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(y);d.projectionMatrix.multiplyVector3(y);v.copy(y);C.x=v.x*x+x;C.y=v.y*D+D;if(k||C.x>0&&C.x<e&&C.y>0&&
|
|
|
-C.y<u){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,C.x-8,C.y-8,16,16,0);b.uniform1i(K.renderType,0);b.uniform2f(K.scale,w.x,w.y);b.uniform3f(K.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,C.x-8,C.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);J.positionScreen.copy(v);J.customUpdateCallback?J.customUpdateCallback(J):J.updateLensFlares();b.uniform1i(K.renderType,2);b.enable(b.BLEND);T=0;for(P=J.lensFlares.length;T<P;T++){N=J.lensFlares[T];if(N.opacity>0.001&&N.scale>0.001){v.x=N.x;v.y=N.y;v.z=N.z;B=N.size*N.scale/u;w.x=B*s;w.y=B;b.uniform3f(K.screenPosition,v.x,v.y,v.z);b.uniform2f(K.scale,w.x,w.y);b.uniform1f(K.rotation,N.rotation);b.uniform1f(K.opacity,N.opacity);
|
|
|
-b.uniform3f(K.color,N.color.r,N.color.g,N.color.b);c.setBlending(N.blending,N.blendEquation,N.blendSrc,N.blendDst);c.setTexture(N.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
|
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){l=false;k=a(THREE.ShaderFlares.lensFlare)}else{l=true;k=a(THREE.ShaderFlares.lensFlareVertexTexture)}p={};m={};p.vertex=b.getAttribLocation(k,"position");p.uv=b.getAttribLocation(k,"uv");m.renderType=b.getUniformLocation(k,"renderType");m.map=b.getUniformLocation(k,"map");m.occlusionMap=b.getUniformLocation(k,"occlusionMap");m.opacity=b.getUniformLocation(k,"opacity");m.color=b.getUniformLocation(k,
|
|
|
+"color");m.scale=b.getUniformLocation(k,"scale");m.rotation=b.getUniformLocation(k,"rotation");m.screenPosition=b.getUniformLocation(k,"screenPosition");o=false};this.render=function(a,d,e,u){var a=a.__webglFlares,t=a.length;if(t){var x=new THREE.Vector3,s=u/e,w=e*0.5,F=u*0.5,E=16/u,z=new THREE.Vector2(E*s,E),v=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),J=m,E=p;b.useProgram(k);if(!o){b.enableVertexAttribArray(p.vertex);b.enableVertexAttribArray(p.uv);o=true}b.uniform1i(J.occlusionMap,0);b.uniform1i(J.map,
|
|
|
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(E.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(E.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var L,W,P,B,M;for(L=0;L<t;L++){E=16/u;z.set(E*s,E);B=a[L];x.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(x);d.projectionMatrix.multiplyVector3(x);v.copy(x);C.x=v.x*w+w;C.y=v.y*F+F;if(l||C.x>0&&C.x<e&&C.y>0&&
|
|
|
+C.y<u){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,C.x-8,C.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,z.x,z.y);b.uniform3f(J.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,C.x-8,C.y-8,16,16,0);b.uniform1i(J.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);B.positionScreen.copy(v);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);W=0;for(P=B.lensFlares.length;W<P;W++){M=B.lensFlares[W];if(M.opacity>0.001&&M.scale>0.001){v.x=M.x;v.y=M.y;v.z=M.z;E=M.size*M.scale/u;z.x=E*s;z.y=E;b.uniform3f(J.screenPosition,v.x,v.y,v.z);b.uniform2f(J.scale,z.x,z.y);b.uniform1f(J.rotation,M.rotation);b.uniform1f(J.opacity,M.opacity);
|
|
|
+b.uniform3f(J.color,M.color.r,M.color.g,M.color.b);c.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst);c.setTexture(M.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
|
|
|
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,k){var l,p,m,o,r,n,q,u,t,y=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(true);l=0;for(p=j.__lights.length;l<p;l++){m=j.__lights[l];if(m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(r=0;r<m.shadowCascadeCount;r++){var s;if(m.shadowCascadeArray[r])s=m.shadowCascadeArray[r];else{t=m;q=r;s=new THREE.DirectionalLight;
|
|
|
-s.isVirtual=true;s.onlyShadow=true;s.castShadow=true;s.shadowCameraNear=t.shadowCameraNear;s.shadowCameraFar=t.shadowCameraFar;s.shadowCameraLeft=t.shadowCameraLeft;s.shadowCameraRight=t.shadowCameraRight;s.shadowCameraBottom=t.shadowCameraBottom;s.shadowCameraTop=t.shadowCameraTop;s.shadowCameraVisible=t.shadowCameraVisible;s.shadowDarkness=t.shadowDarkness;s.shadowBias=t.shadowCascadeBias[q];s.shadowMapWidth=t.shadowCascadeWidth[q];s.shadowMapHeight=t.shadowCascadeHeight[q];s.pointsWorld=[];s.pointsFrustum=
|
|
|
-[];u=s.pointsWorld;n=s.pointsFrustum;for(var x=0;x<8;x++){u[x]=new THREE.Vector3;n[x]=new THREE.Vector3}u=t.shadowCascadeNearZ[q];t=t.shadowCascadeFarZ[q];n[0].set(-1,-1,u);n[1].set(1,-1,u);n[2].set(-1,1,u);n[3].set(1,1,u);n[4].set(-1,-1,t);n[5].set(1,-1,t);n[6].set(-1,1,t);n[7].set(1,1,t);s.originalCamera=k;n=new THREE.Gyroscope;n.position=m.shadowCascadeOffset;n.add(s);n.add(s.target);k.add(n);m.shadowCascadeArray[r]=s;console.log("Created virtualLight",s)}q=m;u=r;t=q.shadowCascadeArray[u];t.position.copy(q.position);
|
|
|
-t.target.position.copy(q.target.position);t.lookAt(t.target);t.shadowCameraVisible=q.shadowCameraVisible;t.shadowDarkness=q.shadowDarkness;t.shadowBias=q.shadowCascadeBias[u];n=q.shadowCascadeNearZ[u];q=q.shadowCascadeFarZ[u];t=t.pointsFrustum;t[0].z=n;t[1].z=n;t[2].z=n;t[3].z=n;t[4].z=q;t[5].z=q;t[6].z=q;t[7].z=q;y[o]=s;o++}else{y[o]=m;o++}}l=0;for(p=y.length;l<p;l++){m=y[l];if(!m.shadowMap){m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,m.shadowMapHeight,{minFilter:THREE.LinearFilter,
|
|
|
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,l){var k,p,m,o,q,n,r,u,t,x=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(true);k=0;for(p=j.__lights.length;k<p;k++){m=j.__lights[k];if(m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(q=0;q<m.shadowCascadeCount;q++){var s;if(m.shadowCascadeArray[q])s=m.shadowCascadeArray[q];else{t=m;r=q;s=new THREE.DirectionalLight;
|
|
|
+s.isVirtual=true;s.onlyShadow=true;s.castShadow=true;s.shadowCameraNear=t.shadowCameraNear;s.shadowCameraFar=t.shadowCameraFar;s.shadowCameraLeft=t.shadowCameraLeft;s.shadowCameraRight=t.shadowCameraRight;s.shadowCameraBottom=t.shadowCameraBottom;s.shadowCameraTop=t.shadowCameraTop;s.shadowCameraVisible=t.shadowCameraVisible;s.shadowDarkness=t.shadowDarkness;s.shadowBias=t.shadowCascadeBias[r];s.shadowMapWidth=t.shadowCascadeWidth[r];s.shadowMapHeight=t.shadowCascadeHeight[r];s.pointsWorld=[];s.pointsFrustum=
|
|
|
+[];u=s.pointsWorld;n=s.pointsFrustum;for(var w=0;w<8;w++){u[w]=new THREE.Vector3;n[w]=new THREE.Vector3}u=t.shadowCascadeNearZ[r];t=t.shadowCascadeFarZ[r];n[0].set(-1,-1,u);n[1].set(1,-1,u);n[2].set(-1,1,u);n[3].set(1,1,u);n[4].set(-1,-1,t);n[5].set(1,-1,t);n[6].set(-1,1,t);n[7].set(1,1,t);s.originalCamera=l;n=new THREE.Gyroscope;n.position=m.shadowCascadeOffset;n.add(s);n.add(s.target);l.add(n);m.shadowCascadeArray[q]=s;console.log("Created virtualLight",s)}r=m;u=q;t=r.shadowCascadeArray[u];t.position.copy(r.position);
|
|
|
+t.target.position.copy(r.target.position);t.lookAt(t.target);t.shadowCameraVisible=r.shadowCameraVisible;t.shadowDarkness=r.shadowDarkness;t.shadowBias=r.shadowCascadeBias[u];n=r.shadowCascadeNearZ[u];r=r.shadowCascadeFarZ[u];t=t.pointsFrustum;t[0].z=n;t[1].z=n;t[2].z=n;t[3].z=n;t[4].z=r;t[5].z=r;t[6].z=r;t[7].z=r;x[o]=s;o++}else{x[o]=m;o++}}k=0;for(p=x.length;k<p;k++){m=x[k];if(!m.shadowMap){m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,m.shadowMapHeight,{minFilter:THREE.LinearFilter,
|
|
|
magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});m.shadowMapSize=new THREE.Vector2(m.shadowMapWidth,m.shadowMapHeight);m.shadowMatrix=new THREE.Matrix4}if(!m.shadowCamera){if(m instanceof THREE.SpotLight)m.shadowCamera=new THREE.PerspectiveCamera(m.shadowCameraFov,m.shadowMapWidth/m.shadowMapHeight,m.shadowCameraNear,m.shadowCameraFar);else if(m instanceof THREE.DirectionalLight)m.shadowCamera=new THREE.OrthographicCamera(m.shadowCameraLeft,m.shadowCameraRight,m.shadowCameraTop,m.shadowCameraBottom,
|
|
|
-m.shadowCameraNear,m.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}j.add(m.shadowCamera);b.autoUpdateScene&&j.updateMatrixWorld()}if(m.shadowCameraVisible&&!m.cameraHelper){m.cameraHelper=new THREE.CameraHelper(m.shadowCamera);m.shadowCamera.add(m.cameraHelper)}if(m.isVirtual&&s.originalCamera==k){r=k;o=m.shadowCamera;n=m.pointsFrustum;t=m.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(q=0;q<8;q++){u=t[q];u.copy(n[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,
|
|
|
-r);o.matrixWorldInverse.multiplyVector3(u);if(u.x<g.x)g.x=u.x;if(u.x>h.x)h.x=u.x;if(u.y<g.y)g.y=u.y;if(u.y>h.y)h.y=u.y;if(u.z<g.z)g.z=u.z;if(u.z>h.z)h.z=u.z}o.left=g.x;o.right=h.x;o.top=h.y;o.bottom=g.y;o.updateProjectionMatrix()}o=m.shadowMap;n=m.shadowMatrix;r=m.shadowCamera;r.position.copy(m.matrixWorld.getPosition());r.lookAt(m.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(m.cameraHelper)m.cameraHelper.lines.visible=m.shadowCameraVisible;
|
|
|
-m.shadowCameraVisible&&m.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(r.projectionMatrix);n.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);f.multiply(r.projectionMatrix,r.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(o);
|
|
|
-b.clear();t=j.__webglObjects;m=0;for(o=t.length;m<o;m++){q=t[m];n=q.object;q.render=false;if(n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);q.render=true}}m=0;for(o=t.length;m<o;m++){q=t[m];if(q.render){n=q.object;q=q.buffer;b.setObjectFaces(n);u=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?b.renderBufferDirect(r,j.__lights,null,
|
|
|
-u,q,n):b.renderBuffer(r,j.__lights,null,u,q,n)}}t=j.__webglObjectsImmediate;m=0;for(o=t.length;m<o;m++){q=t[m];n=q.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(r,j.__lights,null,c,n)}}}l=b.getClearColor();p=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,p);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
|
|
|
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,j,k,l;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,m=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(o);b.compileShader(r);b.attachShader(m,o);b.attachShader(m,r);b.linkProgram(m);h=m;j={};k={};j.position=b.getAttribLocation(h,"position");j.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
|
|
|
-"uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
|
|
|
-k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=false};this.render=function(d,e,o,r){var d=d.__webglSprites,n=d.length;if(n){var q=j,u=k,t=r/o,o=o*0.5,y=r*0.5,s=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
-g);b.uniformMatrix4fv(u.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);for(var x,D=[],q=0;q<n;q++){x=d[q];if(x.visible&&x.opacity!==0)if(x.useScreenCoordinates)x.z=-x.position.z;else{x._modelViewMatrix.multiply(e.matrixWorldInverse,x.matrixWorld);x.z=-x._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<n;q++){x=d[q];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(u.useScreenCoordinates,1);
|
|
|
-b.uniform3f(u.screenPosition,(x.position.x-o)/o,(y-x.position.y)/y,Math.max(0,Math.min(1,x.position.z)))}else{b.uniform1i(u.useScreenCoordinates,0);b.uniform1i(u.affectedByDistance,x.affectedByDistance?1:0);b.uniformMatrix4fv(u.modelViewMatrix,false,x._modelViewMatrix.elements)}e=x.map.image.width/(x.scaleByViewport?r:1);D[0]=e*t*x.scale.x;D[1]=e*x.scale.y;b.uniform2f(u.uvScale,x.uvScale.x,x.uvScale.y);b.uniform2f(u.uvOffset,x.uvOffset.x,x.uvOffset.y);b.uniform2f(u.alignment,x.alignment.x,x.alignment.y);
|
|
|
-b.uniform1f(u.opacity,x.opacity);b.uniform3f(u.color,x.color.r,x.color.g,x.color.b);b.uniform1f(u.rotation,x.rotation);b.uniform2fv(u.scale,D);if(x.mergeWith3D&&!s){b.enable(b.DEPTH_TEST);s=true}else if(!x.mergeWith3D&&s){b.disable(b.DEPTH_TEST);s=false}c.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst);c.setTexture(x.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
|
+m.shadowCameraNear,m.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}j.add(m.shadowCamera);b.autoUpdateScene&&j.updateMatrixWorld()}if(m.shadowCameraVisible&&!m.cameraHelper){m.cameraHelper=new THREE.CameraHelper(m.shadowCamera);m.shadowCamera.add(m.cameraHelper)}if(m.isVirtual&&s.originalCamera==l){q=l;o=m.shadowCamera;n=m.pointsFrustum;t=m.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=0;r<8;r++){u=t[r];u.copy(n[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,
|
|
|
+q);o.matrixWorldInverse.multiplyVector3(u);if(u.x<g.x)g.x=u.x;if(u.x>h.x)h.x=u.x;if(u.y<g.y)g.y=u.y;if(u.y>h.y)h.y=u.y;if(u.z<g.z)g.z=u.z;if(u.z>h.z)h.z=u.z}o.left=g.x;o.right=h.x;o.top=h.y;o.bottom=g.y;o.updateProjectionMatrix()}o=m.shadowMap;n=m.shadowMatrix;q=m.shadowCamera;q.position.copy(m.matrixWorld.getPosition());q.lookAt(m.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);if(m.cameraHelper)m.cameraHelper.lines.visible=m.shadowCameraVisible;
|
|
|
+m.shadowCameraVisible&&m.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(q.projectionMatrix);n.multiplySelf(q.matrixWorldInverse);if(!q._viewMatrixArray)q._viewMatrixArray=new Float32Array(16);if(!q._projectionMatrixArray)q._projectionMatrixArray=new Float32Array(16);q.matrixWorldInverse.flattenToArray(q._viewMatrixArray);q.projectionMatrix.flattenToArray(q._projectionMatrixArray);f.multiply(q.projectionMatrix,q.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(o);
|
|
|
+b.clear();t=j.__webglObjects;m=0;for(o=t.length;m<o;m++){r=t[m];n=r.object;r.render=false;if(n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(q.matrixWorldInverse,n.matrixWorld);r.render=true}}m=0;for(o=t.length;m<o;m++){r=t[m];if(r.render){n=r.object;r=r.buffer;b.setObjectFaces(n);u=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;r instanceof THREE.BufferGeometry?b.renderBufferDirect(q,j.__lights,null,
|
|
|
+u,r,n):b.renderBuffer(q,j.__lights,null,u,r,n)}}t=j.__webglObjectsImmediate;m=0;for(o=t.length;m<o;m++){r=t[m];n=r.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(q.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(q,j.__lights,null,c,n)}}}k=b.getClearColor();p=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,p);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
|
|
|
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,j,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,m=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(m,o);b.attachShader(m,q);b.linkProgram(m);h=m;j={};l={};j.position=b.getAttribLocation(h,"position");j.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=false};this.render=function(d,e,o,q){var d=d.__webglSprites,n=d.length;if(n){var r=j,u=l,t=q/o,o=o*0.5,x=q*0.5,s=true;b.useProgram(h);if(!k){b.enableVertexAttribArray(r.position);b.enableVertexAttribArray(r.uv);k=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
+g);b.uniformMatrix4fv(u.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);for(var w,F=[],r=0;r<n;r++){w=d[r];if(w.visible&&w.opacity!==0)if(w.useScreenCoordinates)w.z=-w.position.z;else{w._modelViewMatrix.multiply(e.matrixWorldInverse,w.matrixWorld);w.z=-w._modelViewMatrix.elements[14]}}d.sort(a);for(r=0;r<n;r++){w=d[r];if(w.visible&&w.opacity!==0&&w.map&&w.map.image&&w.map.image.width){if(w.useScreenCoordinates){b.uniform1i(u.useScreenCoordinates,1);
|
|
|
+b.uniform3f(u.screenPosition,(w.position.x-o)/o,(x-w.position.y)/x,Math.max(0,Math.min(1,w.position.z)))}else{b.uniform1i(u.useScreenCoordinates,0);b.uniform1i(u.affectedByDistance,w.affectedByDistance?1:0);b.uniformMatrix4fv(u.modelViewMatrix,false,w._modelViewMatrix.elements)}e=w.map.image.width/(w.scaleByViewport?q:1);F[0]=e*t*w.scale.x;F[1]=e*w.scale.y;b.uniform2f(u.uvScale,w.uvScale.x,w.uvScale.y);b.uniform2f(u.uvOffset,w.uvOffset.x,w.uvOffset.y);b.uniform2f(u.alignment,w.alignment.x,w.alignment.y);
|
|
|
+b.uniform1f(u.opacity,w.opacity);b.uniform3f(u.color,w.color.r,w.color.g,w.color.b);b.uniform1f(u.rotation,w.rotation);b.uniform2fv(u.scale,F);if(w.mergeWith3D&&!s){b.enable(b.DEPTH_TEST);s=true}else if(!w.mergeWith3D&&s){b.disable(b.DEPTH_TEST);s=false}c.setBlending(w.blending,w.blendEquation,w.blendSrc,w.blendDst);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(true)}}};
|
|
|
THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
|
|
|
-function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var j,k,l,p,m,o;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
|
|
|
-h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();o=g.__webglObjects;j=0;for(k=o.length;j<k;j++){l=o[j];m=l.object;l.render=false;if(m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m))){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);l.render=true}}j=0;for(k=o.length;j<k;j++){l=o[j];if(l.render){m=l.object;l=l.buffer;b.setObjectFaces(m);p=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;l instanceof
|
|
|
-THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,p,l,m):b.renderBuffer(h,g.__lights,null,p,l,m)}}o=g.__webglObjectsImmediate;j=0;for(k=o.length;j<k;j++){l=o[j];m=l.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,m)}}j=b.getClearColor();k=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,k);a.enable(a.BLEND)}};
|
|
|
-THREE.WebGLRenderer&&(THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=false;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,j,k,l,p;e.matrixAutoUpdate=f.matrixAutoUpdate=false;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},m=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53,
|
|
|
-1,1,1E4);r.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:m},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}"}),
|
|
|
-n=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;n.add(a);n.add(r);this.setSize=function(a,d){c.call(b,a,d);m.width=a;m.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(j!==c.aspect||k!==c.near||l!==c.far||p!==c.fov){j=c.aspect;k=c.near;l=c.far;p=c.fov;var t=c.projectionMatrix.clone(),y=125/30*0.5,s=y*k/125,x=k*Math.tan(p*Math.PI/360),D;g.elements[12]=y;h.elements[12]=-y;y=-x*j+s;D=x*j+s;t.elements[0]=2*k/(D-y);t.elements[8]=
|
|
|
-(D+y)/(D-y);e.projectionMatrix.copy(t);y=-x*j-s;D=x*j-s;t.elements[0]=2*k/(D-y);t.elements[8]=(D+y)/(D-y);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,m,true);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,true);n.updateMatrixWorld();d.call(b,n,r)}});
|
|
|
+function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var j,l,k,p,m,o;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
|
|
|
+h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();o=g.__webglObjects;j=0;for(l=o.length;j<l;j++){k=o[j];m=k.object;k.render=false;if(m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m))){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);k.render=true}}j=0;for(l=o.length;j<l;j++){k=o[j];if(k.render){m=k.object;k=k.buffer;b.setObjectFaces(m);p=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;k instanceof
|
|
|
+THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,p,k,m):b.renderBuffer(h,g.__lights,null,p,k,m)}}o=g.__webglObjectsImmediate;j=0;for(l=o.length;j<l;j++){k=o[j];m=k.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,m)}}j=b.getClearColor();l=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,l);a.enable(a.BLEND)}};
|
|
|
+THREE.WebGLRenderer&&(THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=false;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,j,l,k,p;e.matrixAutoUpdate=f.matrixAutoUpdate=false;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},m=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:m},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}"}),
|
|
|
+n=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;n.add(a);n.add(q);this.setSize=function(a,d){c.call(b,a,d);m.width=a;m.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(j!==c.aspect||l!==c.near||k!==c.far||p!==c.fov){j=c.aspect;l=c.near;k=c.far;p=c.fov;var t=c.projectionMatrix.clone(),x=125/30*0.5,s=x*l/125,w=l*Math.tan(p*Math.PI/360),F;g.elements[12]=x;h.elements[12]=-x;x=-w*j+s;F=w*j+s;t.elements[0]=2*l/(F-x);t.elements[8]=
|
|
|
+(F+x)/(F-x);e.projectionMatrix.copy(t);x=-w*j-s;F=w*j-s;t.elements[0]=2*l/(F-x);t.elements[8]=(F+x)/(F-x);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,m,true);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,true);n.updateMatrixWorld();d.call(b,n,q)}});
|
|
|
THREE.WebGLRenderer&&(THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=false;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&&a.separation!==void 0)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,false)}});
|
|
|
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}"},
|