|
@@ -13,49 +13,49 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
|
|
|
sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):
|
|
|
this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=
|
|
|
(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.n14;this.y=
|
|
|
-a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,g=a.n11/c,f=a.n12/d,c=a.n21/c,d=a.n22/d,h=a.n23/e,l=a.n33/e;this.y=Math.asin(a.n13/e);e=Math.cos(this.y);1.0E-5<Math.abs(e)?(this.x=Math.atan2(-h/e,l/e),this.z=Math.atan2(-f/e,g/e)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=b;this.y=c;
|
|
|
+a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,g=a.n11/c,f=a.n12/d,c=a.n21/c,d=a.n22/d,h=a.n23/e,i=a.n33/e;this.y=Math.asin(a.n13/e);e=Math.cos(this.y);1.0E-5<Math.abs(e)?(this.x=Math.atan2(-h/e,i/e),this.z=Math.atan2(-f/e,g/e)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=b;this.y=c;
|
|
|
this.z=a},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return 1.0E-4>this.lengthSq()},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
|
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=void 0!==a.w?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+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=
|
|
|
a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
|
|
|
setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},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;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
|
|
|
THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
|
|
|
-THREE.Ray=function(a,b){function c(a,b,c){q.sub(c,a);s=q.dot(b);t=n.add(a,r.copy(b).multiplyScalar(s));return w=c.distanceTo(t)}function d(a,b,c,d){q.sub(d,b);n.sub(c,b);r.sub(a,b);u=q.dot(q);v=q.dot(n);z=q.dot(r);G=n.dot(n);D=n.dot(r);C=1/(u*G-v*v);I=(G*z-v*D)*C;K=(u*D-v*z)*C;return 0<=I&&0<=K&&1>I+K}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,
|
|
|
-j=new THREE.Vector3,k=new THREE.Vector3,p=new THREE.Vector3,i=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,m,t=a.geometry,u=t.vertices,y;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(q=0,r=t.faces.length;q<r;q++)if(b=t.faces[q],j.copy(this.origin),k.copy(this.direction),y=a.matrixWorld,p=y.multiplyVector3(p.copy(b.centroid)).subSelf(j),i=a.matrixRotationWorld.multiplyVector3(i.copy(b.normal)),s=k.dot(i),!(Math.abs(s)<e)&&(m=i.dot(p)/s,!(0>m)&&(a.doubleSided||(a.flipSided?
|
|
|
-0<s:0>s))))if(o.add(j,k.multiplyScalar(m)),b instanceof THREE.Face3)g=y.multiplyVector3(g.copy(u[b.a].position)),f=y.multiplyVector3(f.copy(u[b.b].position)),h=y.multiplyVector3(h.copy(u[b.c].position)),d(o,g,f,h)&&(b={distance:j.distanceTo(o),point:o.clone(),face:b,object:a},n.push(b));else if(b instanceof THREE.Face4&&(g=y.multiplyVector3(g.copy(u[b.a].position)),f=y.multiplyVector3(f.copy(u[b.b].position)),h=y.multiplyVector3(h.copy(u[b.c].position)),l=y.multiplyVector3(l.copy(u[b.d].position)),
|
|
|
-d(o,g,f,l)||d(o,f,h,l)))b={distance:j.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,s,t,w,u,v,z,G,D,C,I,K};
|
|
|
+THREE.Ray=function(a,b){function c(a,b,c){q.sub(c,a);s=q.dot(b);t=n.add(a,r.copy(b).multiplyScalar(s));return w=c.distanceTo(t)}function d(a,b,c,d){q.sub(d,b);n.sub(c,b);r.sub(a,b);u=q.dot(q);v=q.dot(n);z=q.dot(r);G=n.dot(n);D=n.dot(r);C=1/(u*G-v*v);I=(G*z-v*D)*C;K=(u*D-v*z)*C;return 0<=I&&0<=K&&1>I+K}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,
|
|
|
+j=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,l,t=a.geometry,u=t.vertices,y;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(q=0,r=t.faces.length;q<r;q++)if(b=t.faces[q],j.copy(this.origin),k.copy(this.direction),y=a.matrixWorld,p=y.multiplyVector3(p.copy(b.centroid)).subSelf(j),m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal)),s=k.dot(m),!(Math.abs(s)<e)&&(l=m.dot(p)/s,!(0>l)&&(a.doubleSided||(a.flipSided?
|
|
|
+0<s:0>s))))if(o.add(j,k.multiplyScalar(l)),b instanceof THREE.Face3)g=y.multiplyVector3(g.copy(u[b.a].position)),f=y.multiplyVector3(f.copy(u[b.b].position)),h=y.multiplyVector3(h.copy(u[b.c].position)),d(o,g,f,h)&&(b={distance:j.distanceTo(o),point:o.clone(),face:b,object:a},n.push(b));else if(b instanceof THREE.Face4&&(g=y.multiplyVector3(g.copy(u[b.a].position)),f=y.multiplyVector3(f.copy(u[b.b].position)),h=y.multiplyVector3(h.copy(u[b.c].position)),i=y.multiplyVector3(i.copy(u[b.d].position)),
|
|
|
+d(o,g,f,i)||d(o,f,h,i)))b={distance:j.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,s,t,w,u,v,z,G,D,C,I,K};
|
|
|
THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,f,k,p){h=!1;b=g;c=f;d=k;e=p;a()};this.addPoint=function(g,f){h?(h=!1,b=g,c=f,d=g,e=f):(b=b<g?b:g,c=c<f?c:f,d=d>g?d:g,e=e>f?e:f);a()};this.add3Points=
|
|
|
-function(g,f,k,p,i,o){h?(h=!1,b=g<k?g<i?g:i:k<i?k:i,c=f<p?f<o?f:o:p<o?p:o,d=g>k?g>i?g:i:k>i?k:i,e=f>p?f>o?f:o:p>o?p:o):(b=g<k?g<i?g<b?g:b:i<b?i:b:k<i?k<b?k:b:i<b?i:b,c=f<p?f<o?f<c?f:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c,d=g>k?g>i?g>d?g:d:i>d?i:d:k>i?k>d?k:d:i>d?i:d,e=f>p?f>o?f>e?f:e:o>e?o:e:p>o?p>e?p:e:o>e?o:e);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),e=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),e=e>
|
|
|
+function(g,f,k,p,m,o){h?(h=!1,b=g<k?g<m?g:m:k<m?k:m,c=f<p?f<o?f:o:p<o?p:o,d=g>k?g>m?g:m:k>m?k:m,e=f>p?f>o?f:o:p>o?p:o):(b=g<k?g<m?g<b?g:b:m<b?m:b:k<m?k<b?k:b:m<b?m:b,c=f<p?f<o?f<c?f:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c,d=g>k?g>m?g>d?g:d:m>d?m:d:k>m?k>d?k:d:m>d?m:d,e=f>p?f>o?f>e?f:e:o>e?o:e:p>o?p>e?p:e:o>e?o:e);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),e=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),e=e>
|
|
|
g.getBottom()?e:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
|
|
|
THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0}};THREE.Matrix3=function(){this.m=[]};
|
|
|
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,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,g,f,h,l,j,k,p,i,o,q,n){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==g?g:1,f||0,h||0,l||0,j||0,void 0!==k?k:1,p||0,i||0,o||0,q||0,void 0!==n?n:1);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,l,j,k,p,i,o,q,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=l;this.n32=j;this.n33=k;this.n34=p;this.n41=i;this.n42=o;this.n43=q;this.n44=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
|
|
|
-b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(0===g.length())g.z=1;d.cross(c,g).normalize();0===d.length()&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d);this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,l=a.n23,j=a.n24,k=a.n31,p=a.n32,i=a.n33,o=a.n34,q=a.n41,n=a.n42,r=a.n43,s=a.n44,t=b.n11,
|
|
|
-w=b.n12,u=b.n13,v=b.n14,z=b.n21,G=b.n22,D=b.n23,C=b.n24,I=b.n31,K=b.n32,O=b.n33,Q=b.n34,L=b.n41,B=b.n42,N=b.n43,E=b.n44;this.n11=c*t+d*z+e*I+g*L;this.n12=c*w+d*G+e*K+g*B;this.n13=c*u+d*D+e*O+g*N;this.n14=c*v+d*C+e*Q+g*E;this.n21=f*t+h*z+l*I+j*L;this.n22=f*w+h*G+l*K+j*B;this.n23=f*u+h*D+l*O+j*N;this.n24=f*v+h*C+l*Q+j*E;this.n31=k*t+p*z+i*I+o*L;this.n32=k*w+p*G+i*K+o*B;this.n33=k*u+p*D+i*O+o*N;this.n34=k*v+p*C+i*Q+o*E;this.n41=q*t+n*z+r*I+s*L;this.n42=q*w+n*G+r*K+s*B;this.n43=q*u+n*D+r*O+s*N;this.n44=
|
|
|
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,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,g,f,h,i,j,k,p,m,o,q,n){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==g?g:1,f||0,h||0,i||0,j||0,void 0!==k?k:1,p||0,m||0,o||0,q||0,void 0!==n?n:1);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,j,k,p,m,o,q,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=j;this.n33=k;this.n34=p;this.n41=m;this.n42=o;this.n43=q;this.n44=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
|
|
|
+b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(0===g.length())g.z=1;d.cross(c,g).normalize();0===d.length()&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d);this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,j=a.n24,k=a.n31,p=a.n32,m=a.n33,o=a.n34,q=a.n41,n=a.n42,r=a.n43,s=a.n44,t=b.n11,
|
|
|
+w=b.n12,u=b.n13,v=b.n14,z=b.n21,G=b.n22,D=b.n23,C=b.n24,I=b.n31,K=b.n32,O=b.n33,Q=b.n34,L=b.n41,B=b.n42,N=b.n43,E=b.n44;this.n11=c*t+d*z+e*I+g*L;this.n12=c*w+d*G+e*K+g*B;this.n13=c*u+d*D+e*O+g*N;this.n14=c*v+d*C+e*Q+g*E;this.n21=f*t+h*z+i*I+j*L;this.n22=f*w+h*G+i*K+j*B;this.n23=f*u+h*D+i*O+j*N;this.n24=f*v+h*C+i*Q+j*E;this.n31=k*t+p*z+m*I+o*L;this.n32=k*w+p*G+m*K+o*B;this.n33=k*u+p*D+m*O+o*N;this.n34=k*v+p*C+m*Q+o*E;this.n41=q*t+n*z+r*I+s*L;this.n42=q*w+n*G+r*K+s*B;this.n43=q*u+n*D+r*O+s*N;this.n44=
|
|
|
q*v+n*C+r*Q+s*E;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;
|
|
|
this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*
|
|
|
d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+
|
|
|
-this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,l=this.n31,j=this.n32,k=this.n33,p=this.n34,i=this.n41,o=this.n42,q=this.n43,n=this.n44;return d*f*j*i-c*h*j*i-d*g*k*i+b*h*k*i+c*g*p*i-b*f*p*i-d*f*l*o+c*h*l*o+d*e*k*o-a*h*k*o-c*e*p*o+a*f*p*o+d*g*l*q-b*h*l*q-d*e*j*q+a*h*j*q+b*e*p*q-a*g*p*q-c*g*l*n+b*f*l*n+c*e*j*n-a*f*j*n-b*e*k*n+a*g*k*n},transpose:function(){var a;
|
|
|
+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,i=this.n31,j=this.n32,k=this.n33,p=this.n34,m=this.n41,o=this.n42,q=this.n43,n=this.n44;return d*f*j*m-c*h*j*m-d*g*k*m+b*h*k*m+c*g*p*m-b*f*p*m-d*f*i*o+c*h*i*o+d*e*k*o-a*h*k*o-c*e*p*o+a*f*p*o+d*g*i*q-b*h*i*q-d*e*j*q+a*h*j*q+b*e*p*q-a*g*p*q-c*g*i*n+b*f*i*n+c*e*j*n-a*f*j*n-b*e*k*n+a*g*k*n},transpose:function(){var a;
|
|
|
a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=
|
|
|
this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=
|
|
|
-Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,l=e*g,j=e*f;this.set(l*g+c,l*f-d*h,l*h+d*f,0,l*f+d*h,j*f+c,j*h-d*g,0,l*h-d*f,j*h+d*g,e*h*h+c,0,0,0,0,1);return this},
|
|
|
-setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,f=a.n22,h=a.n23,l=a.n24,j=a.n31,k=
|
|
|
-a.n32,p=a.n33,i=a.n34,o=a.n41,q=a.n42,n=a.n43,r=a.n44;this.n11=h*i*q-l*p*q+l*k*n-f*i*n-h*k*r+f*p*r;this.n12=e*p*q-d*i*q-e*k*n+c*i*n+d*k*r-c*p*r;this.n13=d*l*q-e*h*q+e*f*n-c*l*n-d*f*r+c*h*r;this.n14=e*h*k-d*l*k-e*f*p+c*l*p+d*f*i-c*h*i;this.n21=l*p*o-h*i*o-l*j*n+g*i*n+h*j*r-g*p*r;this.n22=d*i*o-e*p*o+e*j*n-b*i*n-d*j*r+b*p*r;this.n23=e*h*o-d*l*o-e*g*n+b*l*n+d*g*r-b*h*r;this.n24=d*l*j-e*h*j+e*g*p-b*l*p-d*g*i+b*h*i;this.n31=f*i*o-l*k*o+l*j*q-g*i*q-f*j*r+g*k*r;this.n32=e*k*o-c*i*o-e*j*q+b*i*q+c*j*r-b*k*
|
|
|
-r;this.n33=c*l*o-e*f*o+e*g*q-b*l*q-c*g*r+b*f*r;this.n34=e*f*j-c*l*j-e*g*k+b*l*k+c*g*i-b*f*i;this.n41=h*k*o-f*p*o-h*j*q+g*p*q+f*j*n-g*k*n;this.n42=c*p*o-d*k*o+d*j*q-b*p*q-c*j*n+b*k*n;this.n43=d*f*o-c*h*o-d*g*q+b*h*q+c*g*n-b*f*n;this.n44=c*h*j-d*f*j+d*g*k-b*h*k-c*g*p+b*f*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var l=f*h,j=f*e,
|
|
|
-k=d*h,p=d*e;this.n11=l+p*c;this.n12=k*c-j;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=j*c-k;this.n32=p+l*c;this.n33=g*f;break;case "ZXY":l=f*h;j=f*e;k=d*h;p=d*e;this.n11=l-p*c;this.n12=-g*e;this.n13=k+j*c;this.n21=j+k*c;this.n22=g*h;this.n23=p-l*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":l=g*h;j=g*e;k=c*h;p=c*e;this.n11=f*h;this.n12=k*d-j;this.n13=l*d+p;this.n21=f*e;this.n22=p*d+l;this.n23=j*d-k;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":l=g*f;j=g*d;k=c*f;
|
|
|
-p=c*d;this.n11=f*h;this.n12=p-l*e;this.n13=k*e+j;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*e+k;this.n33=l-p*e;break;case "XZY":l=g*f;j=g*d;k=c*f;p=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=l*e+p;this.n22=g*h;this.n23=j*e-k;this.n31=k*e-j;this.n32=c*h;this.n33=p*e+l;break;default:l=g*h,j=g*e,k=c*h,p=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=j+k*d,this.n22=l-p*d,this.n23=-c*f,this.n31=p-l*d,this.n32=k+j*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=
|
|
|
-a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,l=b*f,b=b*h,j=c*f,c=c*h,d=d*h,g=e*g,f=e*f,e=e*h;this.n11=1-(j+d);this.n12=l-e;this.n13=b+f;this.n21=l+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;
|
|
|
+Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,i=e*g,j=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,j*f+c,j*h-d*g,0,i*h-d*f,j*h+d*g,e*h*h+c,0,0,0,0,1);return this},
|
|
|
+setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,f=a.n22,h=a.n23,i=a.n24,j=a.n31,k=
|
|
|
+a.n32,p=a.n33,m=a.n34,o=a.n41,q=a.n42,n=a.n43,r=a.n44;this.n11=h*m*q-i*p*q+i*k*n-f*m*n-h*k*r+f*p*r;this.n12=e*p*q-d*m*q-e*k*n+c*m*n+d*k*r-c*p*r;this.n13=d*i*q-e*h*q+e*f*n-c*i*n-d*f*r+c*h*r;this.n14=e*h*k-d*i*k-e*f*p+c*i*p+d*f*m-c*h*m;this.n21=i*p*o-h*m*o-i*j*n+g*m*n+h*j*r-g*p*r;this.n22=d*m*o-e*p*o+e*j*n-b*m*n-d*j*r+b*p*r;this.n23=e*h*o-d*i*o-e*g*n+b*i*n+d*g*r-b*h*r;this.n24=d*i*j-e*h*j+e*g*p-b*i*p-d*g*m+b*h*m;this.n31=f*m*o-i*k*o+i*j*q-g*m*q-f*j*r+g*k*r;this.n32=e*k*o-c*m*o-e*j*q+b*m*q+c*j*r-b*k*
|
|
|
+r;this.n33=c*i*o-e*f*o+e*g*q-b*i*q-c*g*r+b*f*r;this.n34=e*f*j-c*i*j-e*g*k+b*i*k+c*g*m-b*f*m;this.n41=h*k*o-f*p*o-h*j*q+g*p*q+f*j*n-g*k*n;this.n42=c*p*o-d*k*o+d*j*q-b*p*q-c*j*n+b*k*n;this.n43=d*f*o-c*h*o-d*g*q+b*h*q+c*g*n-b*f*n;this.n44=c*h*j-d*f*j+d*g*k-b*h*k-c*g*p+b*f*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=f*h,j=f*e,
|
|
|
+k=d*h,p=d*e;this.n11=i+p*c;this.n12=k*c-j;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=j*c-k;this.n32=p+i*c;this.n33=g*f;break;case "ZXY":i=f*h;j=f*e;k=d*h;p=d*e;this.n11=i-p*c;this.n12=-g*e;this.n13=k+j*c;this.n21=j+k*c;this.n22=g*h;this.n23=p-i*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":i=g*h;j=g*e;k=c*h;p=c*e;this.n11=f*h;this.n12=k*d-j;this.n13=i*d+p;this.n21=f*e;this.n22=p*d+i;this.n23=j*d-k;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":i=g*f;j=g*d;k=c*f;
|
|
|
+p=c*d;this.n11=f*h;this.n12=p-i*e;this.n13=k*e+j;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*e+k;this.n33=i-p*e;break;case "XZY":i=g*f;j=g*d;k=c*f;p=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=i*e+p;this.n22=g*h;this.n23=j*e-k;this.n31=k*e-j;this.n32=c*h;this.n33=p*e+i;break;default:i=g*h,j=g*e,k=c*h,p=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=j+k*d,this.n22=i-p*d,this.n23=-c*f,this.n31=p-i*d,this.n32=k+j*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=
|
|
|
+a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,i=b*f,b=b*h,j=c*f,c=c*h,d=d*h,g=e*g,f=e*f,e=e*h;this.n11=1-(j+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;
|
|
|
d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();
|
|
|
c.y=e.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=
|
|
|
-a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,g=Math.sqrt(c*c+d*d+e*e),c=c/g,d=d/g,e=e/g,g=c*c,f=d*d,h=e*e,l=Math.cos(b),j=Math.sin(b),k=1-l,p=c*d*k,i=c*e*k,k=d*e*k,c=c*j,o=d*j,j=e*j,e=
|
|
|
-g+(1-g)*l,g=p+j,d=i-o,p=p-j,f=f+(1-f)*l,j=k+c,i=i+o,k=k-c,h=h+(1-h)*l,l=this.n11,c=this.n21,o=this.n31,q=this.n41,n=this.n12,r=this.n22,s=this.n32,t=this.n42,w=this.n13,u=this.n23,v=this.n33,z=this.n43;this.n11=e*l+g*n+d*w;this.n21=e*c+g*r+d*u;this.n31=e*o+g*s+d*v;this.n41=e*q+g*t+d*z;this.n12=p*l+f*n+j*w;this.n22=p*c+f*r+j*u;this.n32=p*o+f*s+j*v;this.n42=p*q+f*t+j*z;this.n13=i*l+k*n+h*w;this.n23=i*c+k*r+h*u;this.n33=i*o+k*s+h*v;this.n43=i*q+k*t+h*z;return this},rotateX:function(a){var b=this.n12,
|
|
|
-c=this.n22,d=this.n32,e=this.n42,g=this.n13,f=this.n23,h=this.n33,l=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*g;this.n22=j*c+a*f;this.n32=j*d+a*h;this.n42=j*e+a*l;this.n13=j*g-a*b;this.n23=j*f-a*c;this.n33=j*h-a*d;this.n43=j*l-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,g=this.n13,f=this.n23,h=this.n33,l=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*g;this.n21=j*c-a*f;this.n31=j*d-a*h;this.n41=j*e-a*l;this.n13=j*g+a*b;this.n23=j*f+a*c;this.n33=
|
|
|
-j*h+a*d;this.n43=j*l+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,g=this.n12,f=this.n22,h=this.n32,l=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*g;this.n21=j*c+a*f;this.n31=j*d+a*h;this.n41=j*e+a*l;this.n12=j*g-a*b;this.n22=j*f-a*c;this.n32=j*h-a*d;this.n42=j*l-a*e;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*
|
|
|
+a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,g=Math.sqrt(c*c+d*d+e*e),c=c/g,d=d/g,e=e/g,g=c*c,f=d*d,h=e*e,i=Math.cos(b),j=Math.sin(b),k=1-i,p=c*d*k,m=c*e*k,k=d*e*k,c=c*j,o=d*j,j=e*j,e=
|
|
|
+g+(1-g)*i,g=p+j,d=m-o,p=p-j,f=f+(1-f)*i,j=k+c,m=m+o,k=k-c,h=h+(1-h)*i,i=this.n11,c=this.n21,o=this.n31,q=this.n41,n=this.n12,r=this.n22,s=this.n32,t=this.n42,w=this.n13,u=this.n23,v=this.n33,z=this.n43;this.n11=e*i+g*n+d*w;this.n21=e*c+g*r+d*u;this.n31=e*o+g*s+d*v;this.n41=e*q+g*t+d*z;this.n12=p*i+f*n+j*w;this.n22=p*c+f*r+j*u;this.n32=p*o+f*s+j*v;this.n42=p*q+f*t+j*z;this.n13=m*i+k*n+h*w;this.n23=m*c+k*r+h*u;this.n33=m*o+k*s+h*v;this.n43=m*q+k*t+h*z;return this},rotateX:function(a){var b=this.n12,
|
|
|
+c=this.n22,d=this.n32,e=this.n42,g=this.n13,f=this.n23,h=this.n33,i=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*g;this.n22=j*c+a*f;this.n32=j*d+a*h;this.n42=j*e+a*i;this.n13=j*g-a*b;this.n23=j*f-a*c;this.n33=j*h-a*d;this.n43=j*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,g=this.n13,f=this.n23,h=this.n33,i=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*g;this.n21=j*c-a*f;this.n31=j*d-a*h;this.n41=j*e-a*i;this.n13=j*g+a*b;this.n23=j*f+a*c;this.n33=
|
|
|
+j*h+a*d;this.n43=j*i+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,g=this.n12,f=this.n22,h=this.n32,i=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*g;this.n21=j*c+a*f;this.n31=j*d+a*h;this.n41=j*e+a*i;this.n12=j*g-a*b;this.n22=j*f-a*c;this.n32=j*h-a*d;this.n42=j*i-a*e;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*
|
|
|
c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this},clone:function(){return new THREE.Matrix4(this.n11,this.n12,this.n13,this.n14,this.n21,this.n22,this.n23,this.n24,this.n31,this.n32,this.n33,this.n34,this.n41,this.n42,this.n43,this.n44)}};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*j;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*l;c[6]=a*j;c[7]=a*k;c[8]=a*p;return b};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*j;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*i;c[6]=a*j;c[7]=a*k;c[8]=a*p;return b};
|
|
|
THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
|
|
|
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,l,j;f=new THREE.Matrix4;h=b-a;l=c-d;j=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/l;f.n23=0;f.n24=-((c+d)/l);f.n31=0;f.n32=0;f.n33=-2/j;f.n34=-((g+e)/j);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};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.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,i,j;f=new THREE.Matrix4;h=b-a;i=c-d;j=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/j;f.n34=-((g+e)/j);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};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=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
|
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,
|
|
@@ -63,23 +63,23 @@ this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,
|
|
|
this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
|
|
|
this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<
|
|
|
c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
|
-THREE.Projector=function(){function a(){var a=f[g]=f[g]||new THREE.RenderableObject;g++;return a}function b(){var a=j[l]=j[l]||new THREE.RenderableVertex;l++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=g&&0<=f&&0<=h)return!0;if(0>e&&0>g||0>f&&0>h)return!1;0>e?c=Math.max(c,e/(e-g)):0>g&&(d=Math.min(d,e/(e-g)));0>f?c=Math.max(c,f/(f-h)):0>h&&(d=Math.min(d,f/(f-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
|
|
|
-var e,g,f=[],h,l,j=[],k,p,i=[],o,q=[],n,r,s=[],t,w,u=[],v={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,G=new THREE.Vector4,D=new THREE.Matrix4,C=new THREE.Matrix4,I=new THREE.Frustum,K=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);D.multiply(b.projectionMatrix,b.matrixWorldInverse);D.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);D.multiply(b.matrixWorld,
|
|
|
+THREE.Projector=function(){function a(){var a=f[g]=f[g]||new THREE.RenderableObject;g++;return a}function b(){var a=j[i]=j[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=g&&0<=f&&0<=h)return!0;if(0>e&&0>g||0>f&&0>h)return!1;0>e?c=Math.max(c,e/(e-g)):0>g&&(d=Math.min(d,e/(e-g)));0>f?c=Math.max(c,f/(f-h)):0>h&&(d=Math.min(d,f/(f-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
|
|
|
+var e,g,f=[],h,i,j=[],k,p,m=[],o,q=[],n,r,s=[],t,w,u=[],v={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,G=new THREE.Vector4,D=new THREE.Matrix4,C=new THREE.Matrix4,I=new THREE.Frustum,K=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);D.multiply(b.projectionMatrix,b.matrixWorldInverse);D.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);D.multiply(b.matrixWorld,
|
|
|
b.projectionMatrixInverse);D.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){g=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var f=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||I.contains(b))?(z.copy(b.matrixWorld.getPosition()),D.multiplyVector3(z),
|
|
|
-e=a(),e.object=b,e.z=z.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.copy(b.matrixWorld.getPosition()),D.multiplyVector3(z),e=a(),e.object=b,e.z=z.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,g){var f=e.near,E=e.far,m=!1,z,F,y,S,P,Z,ja,ha,R,$,T,aa,da,Ua,Ia;w=r=o=p=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);D.multiply(e.projectionMatrix,e.matrixWorldInverse);I.setFromMatrix(D);v=this.projectGraph(a,!1);for(a=0,z=v.objects.length;a<z;a++)if(R=v.objects[a].object,$=R.matrixWorld,l=0,R instanceof THREE.Mesh){T=R.geometry;aa=R.geometry.materials;S=T.vertices;da=T.faces;Ua=T.faceVertexUvs;T=R.matrixRotationWorld.extractRotation($);for(F=0,y=S.length;F<y;F++)h=b(),h.positionWorld.copy(S[F].position),$.multiplyVector3(h.positionWorld),
|
|
|
-h.positionScreen.copy(h.positionWorld),D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<E;for(S=0,F=da.length;S<F;S++){y=da[S];if(y instanceof THREE.Face3)if(P=j[y.a],Z=j[y.b],ja=j[y.c],P.visible&&Z.visible&&ja.visible)if(m=0>(ja.positionScreen.x-P.positionScreen.x)*(Z.positionScreen.y-P.positionScreen.y)-(ja.positionScreen.y-P.positionScreen.y)*(Z.positionScreen.x-P.positionScreen.x),
|
|
|
-R.doubleSided||m!=R.flipSided)ha=i[p]=i[p]||new THREE.RenderableFace3,p++,k=ha,k.v1.copy(P),k.v2.copy(Z),k.v3.copy(ja);else continue;else continue;else if(y instanceof THREE.Face4)if(P=j[y.a],Z=j[y.b],ja=j[y.c],ha=j[y.d],P.visible&&Z.visible&&ja.visible&&ha.visible)if(m=0>(ha.positionScreen.x-P.positionScreen.x)*(Z.positionScreen.y-P.positionScreen.y)-(ha.positionScreen.y-P.positionScreen.y)*(Z.positionScreen.x-P.positionScreen.x)||0>(Z.positionScreen.x-ja.positionScreen.x)*(ha.positionScreen.y-ja.positionScreen.y)-
|
|
|
-(Z.positionScreen.y-ja.positionScreen.y)*(ha.positionScreen.x-ja.positionScreen.x),R.doubleSided||m!=R.flipSided)Ia=q[o]=q[o]||new THREE.RenderableFace4,o++,k=Ia,k.v1.copy(P),k.v2.copy(Z),k.v3.copy(ja),k.v4.copy(ha);else continue;else continue;k.normalWorld.copy(y.normal);!m&&(R.flipSided||R.doubleSided)&&k.normalWorld.negate();T.multiplyVector3(k.normalWorld);k.centroidWorld.copy(y.centroid);$.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);D.multiplyVector3(k.centroidScreen);
|
|
|
-ja=y.vertexNormals;for(P=0,Z=ja.length;P<Z;P++)ha=k.vertexNormalsWorld[P],ha.copy(ja[P]),!m&&(R.flipSided||R.doubleSided)&&ha.negate(),T.multiplyVector3(ha);for(P=0,Z=Ua.length;P<Z;P++)if(Ia=Ua[P][S])for(ja=0,ha=Ia.length;ja<ha;ja++)k.uvs[P][ja]=Ia[ja];k.material=R.material;k.faceMaterial=null!==y.materialIndex?aa[y.materialIndex]:null;k.z=k.centroidScreen.z;v.elements.push(k)}}else if(R instanceof THREE.Line){C.multiply(D,$);S=R.geometry.vertices;P=b();P.positionScreen.copy(S[0].position);C.multiplyVector4(P.positionScreen);
|
|
|
-for(F=1,y=S.length;F<y;F++)if(P=b(),P.positionScreen.copy(S[F].position),C.multiplyVector4(P.positionScreen),Z=j[l-2],K.copy(P.positionScreen),O.copy(Z.positionScreen),d(K,O))K.multiplyScalar(1/K.w),O.multiplyScalar(1/O.w),$=s[r]=s[r]||new THREE.RenderableLine,r++,n=$,n.v1.positionScreen.copy(K),n.v2.positionScreen.copy(O),n.z=Math.max(K.z,O.z),n.material=R.material,v.elements.push(n)}for(a=0,z=v.sprites.length;a<z;a++)if(R=v.sprites[a].object,$=R.matrixWorld,R instanceof THREE.Particle&&(G.set($.n14,
|
|
|
+e=a(),e.object=b,e.z=z.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.copy(b.matrixWorld.getPosition()),D.multiplyVector3(z),e=a(),e.object=b,e.z=z.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,g){var f=e.near,E=e.far,l=!1,z,F,y,S,P,Z,ja,ha,R,$,T,aa,da,Ua,Ia;w=r=o=p=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);D.multiply(e.projectionMatrix,e.matrixWorldInverse);I.setFromMatrix(D);v=this.projectGraph(a,!1);for(a=0,z=v.objects.length;a<z;a++)if(R=v.objects[a].object,$=R.matrixWorld,i=0,R instanceof THREE.Mesh){T=R.geometry;aa=R.geometry.materials;S=T.vertices;da=T.faces;Ua=T.faceVertexUvs;T=R.matrixRotationWorld.extractRotation($);for(F=0,y=S.length;F<y;F++)h=b(),h.positionWorld.copy(S[F].position),$.multiplyVector3(h.positionWorld),
|
|
|
+h.positionScreen.copy(h.positionWorld),D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<E;for(S=0,F=da.length;S<F;S++){y=da[S];if(y instanceof THREE.Face3)if(P=j[y.a],Z=j[y.b],ja=j[y.c],P.visible&&Z.visible&&ja.visible)if(l=0>(ja.positionScreen.x-P.positionScreen.x)*(Z.positionScreen.y-P.positionScreen.y)-(ja.positionScreen.y-P.positionScreen.y)*(Z.positionScreen.x-P.positionScreen.x),
|
|
|
+R.doubleSided||l!=R.flipSided)ha=m[p]=m[p]||new THREE.RenderableFace3,p++,k=ha,k.v1.copy(P),k.v2.copy(Z),k.v3.copy(ja);else continue;else continue;else if(y instanceof THREE.Face4)if(P=j[y.a],Z=j[y.b],ja=j[y.c],ha=j[y.d],P.visible&&Z.visible&&ja.visible&&ha.visible)if(l=0>(ha.positionScreen.x-P.positionScreen.x)*(Z.positionScreen.y-P.positionScreen.y)-(ha.positionScreen.y-P.positionScreen.y)*(Z.positionScreen.x-P.positionScreen.x)||0>(Z.positionScreen.x-ja.positionScreen.x)*(ha.positionScreen.y-ja.positionScreen.y)-
|
|
|
+(Z.positionScreen.y-ja.positionScreen.y)*(ha.positionScreen.x-ja.positionScreen.x),R.doubleSided||l!=R.flipSided)Ia=q[o]=q[o]||new THREE.RenderableFace4,o++,k=Ia,k.v1.copy(P),k.v2.copy(Z),k.v3.copy(ja),k.v4.copy(ha);else continue;else continue;k.normalWorld.copy(y.normal);!l&&(R.flipSided||R.doubleSided)&&k.normalWorld.negate();T.multiplyVector3(k.normalWorld);k.centroidWorld.copy(y.centroid);$.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);D.multiplyVector3(k.centroidScreen);
|
|
|
+ja=y.vertexNormals;for(P=0,Z=ja.length;P<Z;P++)ha=k.vertexNormalsWorld[P],ha.copy(ja[P]),!l&&(R.flipSided||R.doubleSided)&&ha.negate(),T.multiplyVector3(ha);for(P=0,Z=Ua.length;P<Z;P++)if(Ia=Ua[P][S])for(ja=0,ha=Ia.length;ja<ha;ja++)k.uvs[P][ja]=Ia[ja];k.material=R.material;k.faceMaterial=null!==y.materialIndex?aa[y.materialIndex]:null;k.z=k.centroidScreen.z;v.elements.push(k)}}else if(R instanceof THREE.Line){C.multiply(D,$);S=R.geometry.vertices;P=b();P.positionScreen.copy(S[0].position);C.multiplyVector4(P.positionScreen);
|
|
|
+for(F=1,y=S.length;F<y;F++)if(P=b(),P.positionScreen.copy(S[F].position),C.multiplyVector4(P.positionScreen),Z=j[i-2],K.copy(P.positionScreen),O.copy(Z.positionScreen),d(K,O))K.multiplyScalar(1/K.w),O.multiplyScalar(1/O.w),$=s[r]=s[r]||new THREE.RenderableLine,r++,n=$,n.v1.positionScreen.copy(K),n.v2.positionScreen.copy(O),n.z=Math.max(K.z,O.z),n.material=R.material,v.elements.push(n)}for(a=0,z=v.sprites.length;a<z;a++)if(R=v.sprites[a].object,$=R.matrixWorld,R instanceof THREE.Particle&&(G.set($.n14,
|
|
|
$.n24,$.n34,1),D.multiplyVector4(G),G.z/=G.w,0<G.z&&1>G.z))f=u[w]=u[w]||new THREE.RenderableParticle,w++,t=f,t.x=G.x/G.w,t.y=G.y/G.w,t.z=G.z,t.rotation=R.rotation.z,t.scale.x=R.scale.x*Math.abs(t.x-(G.x+e.projectionMatrix.n11)/(G.w+e.projectionMatrix.n14)),t.scale.y=R.scale.y*Math.abs(t.y-(G.y+e.projectionMatrix.n22)/(G.w+e.projectionMatrix.n24)),t.material=R.material,v.elements.push(t);g&&v.elements.sort(c);return v}};
|
|
|
THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
|
|
|
this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);
|
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},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,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,l=this.w,j=l*c+f*e-h*d,k=l*d+h*c-g*e,p=l*e+g*
|
|
|
-d-f*c,c=-g*c-f*d-h*e;b.x=j*l+c*-g+k*-h-p*-f;b.y=k*l+c*-f+p*-g-j*-h;b.z=p*l+c*-h+j*-f-k*-g;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
|
|
|
+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,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,i=this.w,j=i*c+f*e-h*d,k=i*d+h*c-g*e,p=i*e+g*
|
|
|
+d-f*c,c=-g*c-f*d-h*e;b.x=j*i+c*-g+k*-h-p*-f;b.y=k*i+c*-f+p*-g-j*-h;b.z=p*i+c*-h+j*-f-k*-g;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;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return 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),c;b=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/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=function(a){this.position=a||new THREE.Vector3};
|
|
|
THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,g){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=g;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;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
@@ -93,16 +93,16 @@ h=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.v
|
|
|
THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),
|
|
|
d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeMorphNormals:function(){var a,b,c,d,e;for(c=0,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=[];for(a=0,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 g=new THREE.Geometry;g.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};
|
|
|
-this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var f=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,l,j;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],l=new THREE.Vector3,j=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},f.push(l),h.push(j)}f=this.morphNormals[a];g.vertices=this.morphTargets[a].vertices;g.computeFaceNormals();
|
|
|
-g.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],l=f.faceNormals[c],j=f.vertexNormals[c],l.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}for(c=0,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,g,P){h=a.vertices[b].position;l=a.vertices[c].position;j=a.vertices[d].position;k=f[e];p=f[g];i=f[P];o=l.x-h.x;q=j.x-h.x;n=l.y-h.y;r=j.y-h.y;s=l.z-h.z;t=j.z-h.z;w=p.u-k.u;u=i.u-k.u;v=p.v-k.v;z=i.v-k.v;G=1/(w*z-u*v);K.set((z*o-v*q)*G,(z*n-v*r)*G,(z*s-v*t)*G);O.set((w*q-u*o)*G,(w*r-u*n)*G,(w*t-u*s)*G);C[b].addSelf(K);C[c].addSelf(K);C[d].addSelf(K);I[b].addSelf(O);I[c].addSelf(O);I[d].addSelf(O)}var b,c,d,e,g,f,h,l,j,k,p,i,o,q,n,r,s,t,w,u,v,z,G,D,C=[],I=[],K=new THREE.Vector3,O=new THREE.Vector3,
|
|
|
+this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var f=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,j=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},f.push(i),h.push(j)}f=this.morphNormals[a];g.vertices=this.morphTargets[a].vertices;g.computeFaceNormals();
|
|
|
+g.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=f.faceNormals[c],j=f.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}for(c=0,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,g,P){h=a.vertices[b].position;i=a.vertices[c].position;j=a.vertices[d].position;k=f[e];p=f[g];m=f[P];o=i.x-h.x;q=j.x-h.x;n=i.y-h.y;r=j.y-h.y;s=i.z-h.z;t=j.z-h.z;w=p.u-k.u;u=m.u-k.u;v=p.v-k.v;z=m.v-k.v;G=1/(w*z-u*v);K.set((z*o-v*q)*G,(z*n-v*r)*G,(z*s-v*t)*G);O.set((w*q-u*o)*G,(w*r-u*n)*G,(w*t-u*s)*G);C[b].addSelf(K);C[c].addSelf(K);C[d].addSelf(K);I[b].addSelf(O);I[c].addSelf(O);I[d].addSelf(O)}var b,c,d,e,g,f,h,i,j,k,p,m,o,q,n,r,s,t,w,u,v,z,G,D,C=[],I=[],K=new THREE.Vector3,O=new THREE.Vector3,
|
|
|
Q=new THREE.Vector3,L=new THREE.Vector3,B=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,I[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var N=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)B.copy(g.vertexNormals[d]),e=g[N[d]],
|
|
|
D=C[e],Q.copy(D),Q.subSelf(B.multiplyScalar(B.dot(D))).normalize(),L.cross(g.vertexNormals[d],D),e=L.dot(I[e]),e=0>e?-1:1,g.vertexTangents[d]=new THREE.Vector4(Q.x,Q.y,Q.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;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].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}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].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,
|
|
|
4),g,f;for(g=0,f=this.vertices.length;g<f;g++)d=this.vertices[g].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];for(g=0,f=this.faces.length;g<f;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
|
|
|
-THREE.Spline=function(a){function b(a,b,c,d,e,g,f){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,f,h,l,j,k,p,i;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(o){e=(this.points.length-1)*o;g=Math.floor(e);f=e-g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>a.length-2?a.length-1:g+1;c[3]=g>a.length-3?a.length-1:g+2;j=this.points[c[0]];k=this.points[c[1]];
|
|
|
-p=this.points[c[2]];i=this.points[c[3]];h=f*f;l=f*h;d.x=b(j.x,k.x,p.x,i.x,f,h,l);d.y=b(j.y,k.y,p.y,i.y,f,h,l);d.z=b(j.z,k.z,p.z,i.z,f,h,l);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,g=new THREE.Vector3,f=new THREE.Vector3,h=[],l=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),l+=f.distanceTo(g),
|
|
|
-g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=l,e=b);h[h.length]=l;return{chunks:h,total:l}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,f,h=[],l=new THREE.Vector3,k=this.getLength();h.push(l.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];f=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-e),d=this.getPoint(d),h.push(l.copy(d).clone());h.push(l.copy(this.points[b]).clone())}this.points=
|
|
|
+THREE.Spline=function(a){function b(a,b,c,d,e,g,f){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,f,h,i,j,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(o){e=(this.points.length-1)*o;g=Math.floor(e);f=e-g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>a.length-2?a.length-1:g+1;c[3]=g>a.length-3?a.length-1:g+2;j=this.points[c[0]];k=this.points[c[1]];
|
|
|
+p=this.points[c[2]];m=this.points[c[3]];h=f*f;i=f*h;d.x=b(j.x,k.x,p.x,m.x,f,h,i);d.y=b(j.y,k.y,p.y,m.y,f,h,i);d.z=b(j.z,k.z,p.z,m.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
|
|
|
+g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,f,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];f=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.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,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==g?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(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=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?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((void 0!==b?b:24)/(2*a))*(180/Math.PI);this.updateProjectionMatrix()};
|
|
@@ -135,7 +135,7 @@ a.fog?a.fog:!1;this.lights=void 0!==a.lights?a.lights:!1;this.vertexColors=void
|
|
|
THREE.Texture=function(a,b,c,d,e,g,f,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==g?g:THREE.LinearMipMapLinearFilter;this.format=void 0!==f?f:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
|
|
|
!0;this.needsUpdate=!1;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.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};
|
|
|
THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=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,g,f,h,l,j){THREE.Texture.call(this,null,g,f,h,l,j,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
|
|
|
+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,g,f,h,i,j){THREE.Texture.call(this,null,g,f,h,i,j,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=void 0!==b?b:new THREE.ParticleBasicMaterial({color:16777215*Math.random()});this.sortParticles=!1;if(this.geometry)this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius;this.frustumCulled=!1};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=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.type=void 0!==c?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;
|
|
@@ -165,47 +165,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
|
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
|
|
|
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
|
|
|
-THREE.DOMRenderer=function(){var a,b,c=new THREE.Projector,d,e,g,f;this.domElement=document.createElement("div");this.setSize=function(a,b){d=a;e=b;g=d/2;f=e/2};this.render=function(d,e){var j,k,p,i,o;a=c.projectScene(d,e);b=a.elements;for(j=0,k=b.length;j<k;j++)if(p=b[j],p instanceof THREE.RenderableParticle&&(i=p.x*g+g,o=p.y*f+f,p=p.material,p instanceof THREE.ParticleDOMMaterial))p=p.domElement,p.style.left=i+"px",p.style.top=o+"px"}};
|
|
|
-THREE.CanvasRenderer=function(a){function b(a){if(t!=a)n.globalAlpha=t=a}function c(a){if(w!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}w=a}}function d(a){if(u!=a)n.strokeStyle=u=a}function e(a){if(v!=a)n.fillStyle=v=a}var a=a||{},g=this,f,h,l,j=new THREE.Projector,k=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
-p,i,o,q,n=k.getContext("2d"),r=new THREE.Color(0),s=0,t=1,w=0,u=null,v=null,z=null,G=null,D=null,C,I,K,O,Q=new THREE.RenderableVertex,L=new THREE.RenderableVertex,B,N,E,m,Y,F,y,S,P,Z,ja,ha,R=new THREE.Color,$=new THREE.Color,T=new THREE.Color,aa=new THREE.Color,da=new THREE.Color,Ua=[],Ia=[],oa,Fa,Aa,ka,bb,jb,Va,cb,eb,db,Ga=new THREE.Rectangle,ra=new THREE.Rectangle,Ba=new THREE.Rectangle,Oa=!1,sa=new THREE.Color,Wa=new THREE.Color,mb=new THREE.Color,ba=new THREE.Vector3,ga,Fb,Tc,fb,pc,Cc,a=16;ga=
|
|
|
-document.createElement("canvas");ga.width=ga.height=2;Fb=ga.getContext("2d");Fb.fillStyle="rgba(0,0,0,1)";Fb.fillRect(0,0,2,2);Tc=Fb.getImageData(0,0,2,2);fb=Tc.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=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;i=b;o=Math.floor(p/2);q=Math.floor(i/2);k.width=p;k.height=i;Ga.set(-o,
|
|
|
+THREE.DOMRenderer=function(){var a,b,c=new THREE.Projector,d,e,g,f;this.domElement=document.createElement("div");this.setSize=function(a,b){d=a;e=b;g=d/2;f=e/2};this.render=function(d,e){var j,k,p,m,o;a=c.projectScene(d,e);b=a.elements;for(j=0,k=b.length;j<k;j++)if(p=b[j],p instanceof THREE.RenderableParticle&&(m=p.x*g+g,o=p.y*f+f,p=p.material,p instanceof THREE.ParticleDOMMaterial))p=p.domElement,p.style.left=m+"px",p.style.top=o+"px"}};
|
|
|
+THREE.CanvasRenderer=function(a){function b(a){if(t!=a)n.globalAlpha=t=a}function c(a){if(w!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}w=a}}function d(a){if(u!=a)n.strokeStyle=u=a}function e(a){if(v!=a)n.fillStyle=v=a}var a=a||{},g=this,f,h,i,j=new THREE.Projector,k=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
+p,m,o,q,n=k.getContext("2d"),r=new THREE.Color(0),s=0,t=1,w=0,u=null,v=null,z=null,G=null,D=null,C,I,K,O,Q=new THREE.RenderableVertex,L=new THREE.RenderableVertex,B,N,E,l,Y,F,y,S,P,Z,ja,ha,R=new THREE.Color,$=new THREE.Color,T=new THREE.Color,aa=new THREE.Color,da=new THREE.Color,Ua=[],Ia=[],oa,Fa,Aa,ka,bb,jb,Va,cb,eb,db,Ga=new THREE.Rectangle,ra=new THREE.Rectangle,Ba=new THREE.Rectangle,Oa=!1,sa=new THREE.Color,Wa=new THREE.Color,mb=new THREE.Color,ba=new THREE.Vector3,fa,Fb,Tc,fb,pc,Cc,a=16;fa=
|
|
|
+document.createElement("canvas");fa.width=fa.height=2;Fb=fa.getContext("2d");Fb.fillStyle="rgba(0,0,0,1)";Fb.fillRect(0,0,2,2);Tc=Fb.getImageData(0,0,2,2);fb=Tc.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=!0;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;Ga.set(-o,
|
|
|
-q,o,q);ra.set(-o,-q,o,q);t=1;w=0;D=G=z=v=u=null};this.setClearColor=function(a,b){r.copy(a);s=b;ra.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;ra.set(-o,-q,o,q)};this.clear=function(){n.setTransform(1,0,0,-1,o,q);ra.isEmpty()||(ra.minSelf(Ga),ra.inflate(2),1>s&&n.clearRect(Math.floor(ra.getX()),Math.floor(ra.getY()),Math.floor(ra.getWidth()),Math.floor(ra.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
|
|
|
-r.b)+","+s+")"),n.fillRect(Math.floor(ra.getX()),Math.floor(ra.getY()),Math.floor(ra.getWidth()),Math.floor(ra.getHeight()))),ra.empty())};this.render=function(a,k){function i(a){var b,c,d,e;sa.setRGB(0,0,0);Wa.setRGB(0,0,0);mb.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b):d instanceof THREE.DirectionalLight?(Wa.r+=e.r,Wa.g+=e.g,Wa.b+=e.b):d instanceof THREE.PointLight&&(mb.r+=e.r,mb.g+=e.g,mb.b+=e.b)}function p(a,b,c,d){var e,
|
|
|
-g,f,h,l,m;for(e=0,g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(l=f.matrixWorld.getPosition(),m=c.dot(l),0>=m||(m*=f.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)):f instanceof THREE.PointLight&&(l=f.matrixWorld.getPosition(),m=c.dot(ba.sub(l,b).normalize()),0>=m||(m*=0==f.distance?1:1-Math.min(b.distanceTo(l)/f.distance,1),0!=m&&(m*=f.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)))}function r(a,g,f){b(f.opacity);c(f.blending);var h,ba,m,l,ga,k;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)l=
|
|
|
-f.map.image,ga=l.width>>1,k=l.height>>1,f=g.scale.x*o,m=g.scale.y*q,h=f*ga,ba=m*k,Ba.set(a.x-h,a.y-ba,a.x+h,a.y+ba),Ga.intersects(Ba)&&(n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(f,-m),n.translate(-ga,-k),n.drawImage(l,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(h=g.scale.x*o,ba=g.scale.y*q,Ba.set(a.x-h,a.y-ba,a.x+h,a.y+ba),Ga.intersects(Ba)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(h,
|
|
|
-ba),f.program(n),n.restore()))}function s(a,e,g,f){b(f.opacity);c(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(z!=a)n.lineWidth=z=a;a=f.linecap;if(G!=a)n.lineCap=G=a;a=f.linejoin;if(D!=a)n.lineJoin=D=a;d(f.color.getContextStyle());n.stroke();Ba.inflate(2*f.linewidth)}}function t(a,d,e,f,h,ga,j,i){g.info.render.vertices+=3;g.info.render.faces++;b(i.opacity);
|
|
|
-c(i.blending);B=a.positionScreen.x;N=a.positionScreen.y;E=d.positionScreen.x;m=d.positionScreen.y;Y=e.positionScreen.x;F=e.positionScreen.y;v(B,N,E,m,Y,F);if(i instanceof THREE.MeshBasicMaterial)if(i.map)i.map.mapping instanceof THREE.UVMapping&&(ka=j.uvs[0],Uc(B,N,E,m,Y,F,ka[f].u,ka[f].v,ka[h].u,ka[h].v,ka[ga].u,ka[ga].v,i.map));else if(i.envMap){if(i.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,ba.copy(j.vertexNormalsWorld[f]),bb=0.5*(ba.x*a.n11+ba.y*a.n12+ba.z*
|
|
|
-a.n13)+0.5,jb=0.5*-(ba.x*a.n21+ba.y*a.n22+ba.z*a.n23)+0.5,ba.copy(j.vertexNormalsWorld[h]),Va=0.5*(ba.x*a.n11+ba.y*a.n12+ba.z*a.n13)+0.5,cb=0.5*-(ba.x*a.n21+ba.y*a.n22+ba.z*a.n23)+0.5,ba.copy(j.vertexNormalsWorld[ga]),eb=0.5*(ba.x*a.n11+ba.y*a.n12+ba.z*a.n13)+0.5,db=0.5*-(ba.x*a.n21+ba.y*a.n22+ba.z*a.n23)+0.5,Uc(B,N,E,m,Y,F,bb,jb,Va,cb,eb,db,i.envMap)}else i.wireframe?Mb(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):Gb(i.color);else if(i instanceof THREE.MeshLambertMaterial)i.map&&
|
|
|
-!i.wireframe&&(i.map.mapping instanceof THREE.UVMapping&&(ka=j.uvs[0],Uc(B,N,E,m,Y,F,ka[f].u,ka[f].v,ka[h].u,ka[h].v,ka[ga].u,ka[ga].v,i.map)),c(THREE.SubtractiveBlending)),Oa?!i.wireframe&&i.shading==THREE.SmoothShading&&3==j.vertexNormalsWorld.length?($.r=T.r=aa.r=sa.r,$.g=T.g=aa.g=sa.g,$.b=T.b=aa.b=sa.b,p(l,j.v1.positionWorld,j.vertexNormalsWorld[0],$),p(l,j.v2.positionWorld,j.vertexNormalsWorld[1],T),p(l,j.v3.positionWorld,j.vertexNormalsWorld[2],aa),$.r=Math.max(0,Math.min(i.color.r*$.r,1)),
|
|
|
-$.g=Math.max(0,Math.min(i.color.g*$.g,1)),$.b=Math.max(0,Math.min(i.color.b*$.b,1)),T.r=Math.max(0,Math.min(i.color.r*T.r,1)),T.g=Math.max(0,Math.min(i.color.g*T.g,1)),T.b=Math.max(0,Math.min(i.color.b*T.b,1)),aa.r=Math.max(0,Math.min(i.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(i.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(i.color.b*aa.b,1)),da.r=0.5*(T.r+aa.r),da.g=0.5*(T.g+aa.g),da.b=0.5*(T.b+aa.b),Aa=Dc($,T,aa,da),gc(B,N,E,m,Y,F,0,0,1,0,0,1,Aa)):(R.r=sa.r,R.g=sa.g,R.b=sa.b,p(l,j.centroidWorld,j.normalWorld,
|
|
|
-R),R.r=Math.max(0,Math.min(i.color.r*R.r,1)),R.g=Math.max(0,Math.min(i.color.g*R.g,1)),R.b=Math.max(0,Math.min(i.color.b*R.b,1)),i.wireframe?Mb(R,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):Gb(R)):i.wireframe?Mb(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):Gb(i.color);else if(i instanceof THREE.MeshDepthMaterial)oa=k.near,Fa=k.far,$.r=$.g=$.b=1-ac(a.positionScreen.z,oa,Fa),T.r=T.g=T.b=1-ac(d.positionScreen.z,oa,Fa),aa.r=aa.g=aa.b=1-ac(e.positionScreen.z,oa,
|
|
|
-Fa),da.r=0.5*(T.r+aa.r),da.g=0.5*(T.g+aa.g),da.b=0.5*(T.b+aa.b),Aa=Dc($,T,aa,da),gc(B,N,E,m,Y,F,0,0,1,0,0,1,Aa);else if(i instanceof THREE.MeshNormalMaterial)R.r=hc(j.normalWorld.x),R.g=hc(j.normalWorld.y),R.b=hc(j.normalWorld.z),i.wireframe?Mb(R,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):Gb(R)}function u(a,d,e,f,h,ba,ga,i,j){g.info.render.vertices+=4;g.info.render.faces++;b(i.opacity);c(i.blending);if(i.map||i.envMap)t(a,d,f,0,1,3,ga,i,j),t(h,e,ba,1,2,3,ga,i,j);else if(B=a.positionScreen.x,
|
|
|
-N=a.positionScreen.y,E=d.positionScreen.x,m=d.positionScreen.y,Y=e.positionScreen.x,F=e.positionScreen.y,y=f.positionScreen.x,S=f.positionScreen.y,P=h.positionScreen.x,Z=h.positionScreen.y,ja=ba.positionScreen.x,ha=ba.positionScreen.y,i instanceof THREE.MeshBasicMaterial)w(B,N,E,m,Y,F,y,S),i.wireframe?Mb(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):Gb(i.color);else if(i instanceof THREE.MeshLambertMaterial)Oa?!i.wireframe&&i.shading==THREE.SmoothShading&&4==ga.vertexNormalsWorld.length?
|
|
|
-($.r=T.r=aa.r=da.r=sa.r,$.g=T.g=aa.g=da.g=sa.g,$.b=T.b=aa.b=da.b=sa.b,p(l,ga.v1.positionWorld,ga.vertexNormalsWorld[0],$),p(l,ga.v2.positionWorld,ga.vertexNormalsWorld[1],T),p(l,ga.v4.positionWorld,ga.vertexNormalsWorld[3],aa),p(l,ga.v3.positionWorld,ga.vertexNormalsWorld[2],da),$.r=Math.max(0,Math.min(i.color.r*$.r,1)),$.g=Math.max(0,Math.min(i.color.g*$.g,1)),$.b=Math.max(0,Math.min(i.color.b*$.b,1)),T.r=Math.max(0,Math.min(i.color.r*T.r,1)),T.g=Math.max(0,Math.min(i.color.g*T.g,1)),T.b=Math.max(0,
|
|
|
-Math.min(i.color.b*T.b,1)),aa.r=Math.max(0,Math.min(i.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(i.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(i.color.b*aa.b,1)),da.r=Math.max(0,Math.min(i.color.r*da.r,1)),da.g=Math.max(0,Math.min(i.color.g*da.g,1)),da.b=Math.max(0,Math.min(i.color.b*da.b,1)),Aa=Dc($,T,aa,da),v(B,N,E,m,y,S),gc(B,N,E,m,y,S,0,0,1,0,0,1,Aa),v(P,Z,Y,F,ja,ha),gc(P,Z,Y,F,ja,ha,1,0,1,1,0,1,Aa)):(R.r=sa.r,R.g=sa.g,R.b=sa.b,p(l,ga.centroidWorld,ga.normalWorld,R),R.r=Math.max(0,Math.min(i.color.r*
|
|
|
-R.r,1)),R.g=Math.max(0,Math.min(i.color.g*R.g,1)),R.b=Math.max(0,Math.min(i.color.b*R.b,1)),w(B,N,E,m,Y,F,y,S),i.wireframe?Mb(R,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):Gb(R)):(w(B,N,E,m,Y,F,y,S),i.wireframe?Mb(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):Gb(i.color));else if(i instanceof THREE.MeshNormalMaterial)R.r=hc(ga.normalWorld.x),R.g=hc(ga.normalWorld.y),R.b=hc(ga.normalWorld.z),w(B,N,E,m,Y,F,y,S),i.wireframe?Mb(R,i.wireframeLinewidth,i.wireframeLinecap,
|
|
|
-i.wireframeLinejoin):Gb(R);else if(i instanceof THREE.MeshDepthMaterial)oa=k.near,Fa=k.far,$.r=$.g=$.b=1-ac(a.positionScreen.z,oa,Fa),T.r=T.g=T.b=1-ac(d.positionScreen.z,oa,Fa),aa.r=aa.g=aa.b=1-ac(f.positionScreen.z,oa,Fa),da.r=da.g=da.b=1-ac(e.positionScreen.z,oa,Fa),Aa=Dc($,T,aa,da),v(B,N,E,m,y,S),gc(B,N,E,m,y,S,0,0,1,0,0,1,Aa),v(P,Z,Y,F,ja,ha),gc(P,Z,Y,F,ja,ha,1,0,1,1,0,1,Aa)}function v(a,b,c,d,e,g){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(a,b);n.closePath()}function w(a,
|
|
|
-b,c,d,e,g,f,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(f,h);n.lineTo(a,b);n.closePath()}function Mb(a,b,c,e){if(z!=b)n.lineWidth=z=b;if(G!=c)n.lineCap=G=c;if(D!=e)n.lineJoin=D=e;d(a.getContextStyle());n.stroke();Ba.inflate(2*b)}function Gb(a){e(a.getContextStyle());n.fill()}function Uc(a,b,c,d,g,f,h,ba,m,l,i,ga,k){if(0!=k.image.width){if(!0==k.needsUpdate||void 0==Ua[k.id]){var j=k.wrapS==THREE.RepeatWrapping,o=k.wrapT==THREE.RepeatWrapping;Ua[k.id]=n.createPattern(k.image,
|
|
|
-j&&o?"repeat":j&&!o?"repeat-x":!j&&o?"repeat-y":"no-repeat");k.needsUpdate=!1}e(Ua[k.id]);var j=k.offset.x/k.repeat.x,o=k.offset.y/k.repeat.y,Fb=k.image.width*k.repeat.x,p=k.image.height*k.repeat.y,h=(h+j)*Fb,ba=(ba+o)*p,c=c-a,d=d-b,g=g-a,f=f-b,m=(m+j)*Fb-h,l=(l+o)*p-ba,i=(i+j)*Fb-h,ga=(ga+o)*p-ba,j=m*ga-i*l;if(0==j){if(void 0===Ia[k.id])b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),Ia[k.id]=b.getImageData(0,0,k.image.width,
|
|
|
-k.image.height).data;b=Ia[k.id];h=4*(Math.floor(h)+Math.floor(ba)*k.image.width);R.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Gb(R)}else j=1/j,k=(ga*c-l*g)*j,l=(ga*d-l*f)*j,c=(m*g-i*c)*j,d=(m*f-i*d)*j,a=a-k*h-c*ba,h=b-l*h-d*ba,n.save(),n.transform(k,l,c,d,a,h),n.fill(),n.restore()}}function gc(a,b,c,d,e,g,f,h,ba,m,l,i,ga){var k,j;k=ga.width-1;j=ga.height-1;f*=k;h*=j;c-=a;d-=b;e-=a;g-=b;ba=ba*k-f;m=m*j-h;l=l*k-f;i=i*j-h;j=1/(ba*i-l*m);k=(i*c-m*e)*j;m=(i*d-m*g)*j;c=(ba*e-l*c)*j;d=(ba*g-l*d)*j;a=a-k*f-c*
|
|
|
-h;b=b-m*f-d*h;n.save();n.transform(k,m,c,d,a,b);n.clip();n.drawImage(ga,0,0);n.restore()}function Dc(a,b,c,d){var e=~~(255*a.r),g=~~(255*a.g),a=~~(255*a.b),f=~~(255*b.r),h=~~(255*b.g),b=~~(255*b.b),ba=~~(255*c.r),m=~~(255*c.g),c=~~(255*c.b),l=~~(255*d.r),i=~~(255*d.g),d=~~(255*d.b);fb[0]=0>e?0:255<e?255:e;fb[1]=0>g?0:255<g?255:g;fb[2]=0>a?0:255<a?255:a;fb[4]=0>f?0:255<f?255:f;fb[5]=0>h?0:255<h?255:h;fb[6]=0>b?0:255<b?255:b;fb[8]=0>ba?0:255<ba?255:ba;fb[9]=0>m?0:255<m?255:m;fb[10]=0>c?0:255<c?255:
|
|
|
-c;fb[12]=0>l?0:255<l?255:l;fb[13]=0>i?0:255<i?255:i;fb[14]=0>d?0:255<d?255:d;Fb.putImageData(Tc,0,0);Cc.drawImage(ga,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ec,ed,Pa,kb;this.autoClear?this.clear():n.setTransform(1,0,0,-1,o,q);g.info.render.vertices=0;g.info.render.faces=0;f=j.projectScene(a,k,this.sortElements);
|
|
|
-h=f.elements;l=f.lights;(Oa=0<l.length)&&i(l);for(Ec=0,ed=h.length;Ec<ed;Ec++)if(Pa=h[Ec],kb=Pa.material,kb=kb instanceof THREE.MeshFaceMaterial?Pa.faceMaterial:kb,!(null==kb||0==kb.opacity)){Ba.empty();if(Pa instanceof THREE.RenderableParticle)C=Pa,C.x*=o,C.y*=q,r(C,Pa,kb,a);else if(Pa instanceof THREE.RenderableLine)C=Pa.v1,I=Pa.v2,C.positionScreen.x*=o,C.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,Ba.addPoint(C.positionScreen.x,C.positionScreen.y),Ba.addPoint(I.positionScreen.x,
|
|
|
+r.b)+","+s+")"),n.fillRect(Math.floor(ra.getX()),Math.floor(ra.getY()),Math.floor(ra.getWidth()),Math.floor(ra.getHeight()))),ra.empty())};this.render=function(a,k){function m(a){var b,c,d,e;sa.setRGB(0,0,0);Wa.setRGB(0,0,0);mb.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b):d instanceof THREE.DirectionalLight?(Wa.r+=e.r,Wa.g+=e.g,Wa.b+=e.b):d instanceof THREE.PointLight&&(mb.r+=e.r,mb.g+=e.g,mb.b+=e.b)}function p(a,b,c,d){var e,
|
|
|
+g,f,h,i,l;for(e=0,g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),l=c.dot(i),0>=l||(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),l=c.dot(ba.sub(i,b).normalize()),0>=l||(l*=0==f.distance?1:1-Math.min(b.distanceTo(i)/f.distance,1),0!=l&&(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function r(a,g,f){b(f.opacity);c(f.blending);var h,ba,l,i,fa,j;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)i=
|
|
|
+f.map.image,fa=i.width>>1,j=i.height>>1,f=g.scale.x*o,l=g.scale.y*q,h=f*fa,ba=l*j,Ba.set(a.x-h,a.y-ba,a.x+h,a.y+ba),Ga.intersects(Ba)&&(n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(f,-l),n.translate(-fa,-j),n.drawImage(i,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(h=g.scale.x*o,ba=g.scale.y*q,Ba.set(a.x-h,a.y-ba,a.x+h,a.y+ba),Ga.intersects(Ba)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(h,
|
|
|
+ba),f.program(n),n.restore()))}function s(a,e,g,f){b(f.opacity);c(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(z!=a)n.lineWidth=z=a;a=f.linecap;if(G!=a)n.lineCap=G=a;a=f.linejoin;if(D!=a)n.lineJoin=D=a;d(f.color.getContextStyle());n.stroke();Ba.inflate(2*f.linewidth)}}function t(a,d,e,f,h,fa,j,m){g.info.render.vertices+=3;g.info.render.faces++;b(m.opacity);
|
|
|
+c(m.blending);B=a.positionScreen.x;N=a.positionScreen.y;E=d.positionScreen.x;l=d.positionScreen.y;Y=e.positionScreen.x;F=e.positionScreen.y;v(B,N,E,l,Y,F);if(m instanceof THREE.MeshBasicMaterial)if(m.map)m.map.mapping instanceof THREE.UVMapping&&(ka=j.uvs[0],Uc(B,N,E,l,Y,F,ka[f].u,ka[f].v,ka[h].u,ka[h].v,ka[fa].u,ka[fa].v,m.map));else if(m.envMap){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,ba.copy(j.vertexNormalsWorld[f]),bb=0.5*(ba.x*a.n11+ba.y*a.n12+ba.z*
|
|
|
+a.n13)+0.5,jb=0.5*-(ba.x*a.n21+ba.y*a.n22+ba.z*a.n23)+0.5,ba.copy(j.vertexNormalsWorld[h]),Va=0.5*(ba.x*a.n11+ba.y*a.n12+ba.z*a.n13)+0.5,cb=0.5*-(ba.x*a.n21+ba.y*a.n22+ba.z*a.n23)+0.5,ba.copy(j.vertexNormalsWorld[fa]),eb=0.5*(ba.x*a.n11+ba.y*a.n12+ba.z*a.n13)+0.5,db=0.5*-(ba.x*a.n21+ba.y*a.n22+ba.z*a.n23)+0.5,Uc(B,N,E,l,Y,F,bb,jb,Va,cb,eb,db,m.envMap)}else m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color);else if(m instanceof THREE.MeshLambertMaterial)m.map&&
|
|
|
+!m.wireframe&&(m.map.mapping instanceof THREE.UVMapping&&(ka=j.uvs[0],Uc(B,N,E,l,Y,F,ka[f].u,ka[f].v,ka[h].u,ka[h].v,ka[fa].u,ka[fa].v,m.map)),c(THREE.SubtractiveBlending)),Oa?!m.wireframe&&m.shading==THREE.SmoothShading&&3==j.vertexNormalsWorld.length?($.r=T.r=aa.r=sa.r,$.g=T.g=aa.g=sa.g,$.b=T.b=aa.b=sa.b,p(i,j.v1.positionWorld,j.vertexNormalsWorld[0],$),p(i,j.v2.positionWorld,j.vertexNormalsWorld[1],T),p(i,j.v3.positionWorld,j.vertexNormalsWorld[2],aa),$.r=Math.max(0,Math.min(m.color.r*$.r,1)),
|
|
|
+$.g=Math.max(0,Math.min(m.color.g*$.g,1)),$.b=Math.max(0,Math.min(m.color.b*$.b,1)),T.r=Math.max(0,Math.min(m.color.r*T.r,1)),T.g=Math.max(0,Math.min(m.color.g*T.g,1)),T.b=Math.max(0,Math.min(m.color.b*T.b,1)),aa.r=Math.max(0,Math.min(m.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(m.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(m.color.b*aa.b,1)),da.r=0.5*(T.r+aa.r),da.g=0.5*(T.g+aa.g),da.b=0.5*(T.b+aa.b),Aa=Dc($,T,aa,da),gc(B,N,E,l,Y,F,0,0,1,0,0,1,Aa)):(R.r=sa.r,R.g=sa.g,R.b=sa.b,p(i,j.centroidWorld,j.normalWorld,
|
|
|
+R),R.r=Math.max(0,Math.min(m.color.r*R.r,1)),R.g=Math.max(0,Math.min(m.color.g*R.g,1)),R.b=Math.max(0,Math.min(m.color.b*R.b,1)),m.wireframe?Mb(R,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(R)):m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color);else if(m instanceof THREE.MeshDepthMaterial)oa=k.near,Fa=k.far,$.r=$.g=$.b=1-ac(a.positionScreen.z,oa,Fa),T.r=T.g=T.b=1-ac(d.positionScreen.z,oa,Fa),aa.r=aa.g=aa.b=1-ac(e.positionScreen.z,oa,
|
|
|
+Fa),da.r=0.5*(T.r+aa.r),da.g=0.5*(T.g+aa.g),da.b=0.5*(T.b+aa.b),Aa=Dc($,T,aa,da),gc(B,N,E,l,Y,F,0,0,1,0,0,1,Aa);else if(m instanceof THREE.MeshNormalMaterial)R.r=hc(j.normalWorld.x),R.g=hc(j.normalWorld.y),R.b=hc(j.normalWorld.z),m.wireframe?Mb(R,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(R)}function u(a,d,e,f,h,ba,fa,j,m){g.info.render.vertices+=4;g.info.render.faces++;b(j.opacity);c(j.blending);if(j.map||j.envMap)t(a,d,f,0,1,3,fa,j,m),t(h,e,ba,1,2,3,fa,j,m);else if(B=a.positionScreen.x,
|
|
|
+N=a.positionScreen.y,E=d.positionScreen.x,l=d.positionScreen.y,Y=e.positionScreen.x,F=e.positionScreen.y,y=f.positionScreen.x,S=f.positionScreen.y,P=h.positionScreen.x,Z=h.positionScreen.y,ja=ba.positionScreen.x,ha=ba.positionScreen.y,j instanceof THREE.MeshBasicMaterial)w(B,N,E,l,Y,F,y,S),j.wireframe?Mb(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Gb(j.color);else if(j instanceof THREE.MeshLambertMaterial)Oa?!j.wireframe&&j.shading==THREE.SmoothShading&&4==fa.vertexNormalsWorld.length?
|
|
|
+($.r=T.r=aa.r=da.r=sa.r,$.g=T.g=aa.g=da.g=sa.g,$.b=T.b=aa.b=da.b=sa.b,p(i,fa.v1.positionWorld,fa.vertexNormalsWorld[0],$),p(i,fa.v2.positionWorld,fa.vertexNormalsWorld[1],T),p(i,fa.v4.positionWorld,fa.vertexNormalsWorld[3],aa),p(i,fa.v3.positionWorld,fa.vertexNormalsWorld[2],da),$.r=Math.max(0,Math.min(j.color.r*$.r,1)),$.g=Math.max(0,Math.min(j.color.g*$.g,1)),$.b=Math.max(0,Math.min(j.color.b*$.b,1)),T.r=Math.max(0,Math.min(j.color.r*T.r,1)),T.g=Math.max(0,Math.min(j.color.g*T.g,1)),T.b=Math.max(0,
|
|
|
+Math.min(j.color.b*T.b,1)),aa.r=Math.max(0,Math.min(j.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(j.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(j.color.b*aa.b,1)),da.r=Math.max(0,Math.min(j.color.r*da.r,1)),da.g=Math.max(0,Math.min(j.color.g*da.g,1)),da.b=Math.max(0,Math.min(j.color.b*da.b,1)),Aa=Dc($,T,aa,da),v(B,N,E,l,y,S),gc(B,N,E,l,y,S,0,0,1,0,0,1,Aa),v(P,Z,Y,F,ja,ha),gc(P,Z,Y,F,ja,ha,1,0,1,1,0,1,Aa)):(R.r=sa.r,R.g=sa.g,R.b=sa.b,p(i,fa.centroidWorld,fa.normalWorld,R),R.r=Math.max(0,Math.min(j.color.r*
|
|
|
+R.r,1)),R.g=Math.max(0,Math.min(j.color.g*R.g,1)),R.b=Math.max(0,Math.min(j.color.b*R.b,1)),w(B,N,E,l,Y,F,y,S),j.wireframe?Mb(R,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Gb(R)):(w(B,N,E,l,Y,F,y,S),j.wireframe?Mb(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Gb(j.color));else if(j instanceof THREE.MeshNormalMaterial)R.r=hc(fa.normalWorld.x),R.g=hc(fa.normalWorld.y),R.b=hc(fa.normalWorld.z),w(B,N,E,l,Y,F,y,S),j.wireframe?Mb(R,j.wireframeLinewidth,j.wireframeLinecap,
|
|
|
+j.wireframeLinejoin):Gb(R);else if(j instanceof THREE.MeshDepthMaterial)oa=k.near,Fa=k.far,$.r=$.g=$.b=1-ac(a.positionScreen.z,oa,Fa),T.r=T.g=T.b=1-ac(d.positionScreen.z,oa,Fa),aa.r=aa.g=aa.b=1-ac(f.positionScreen.z,oa,Fa),da.r=da.g=da.b=1-ac(e.positionScreen.z,oa,Fa),Aa=Dc($,T,aa,da),v(B,N,E,l,y,S),gc(B,N,E,l,y,S,0,0,1,0,0,1,Aa),v(P,Z,Y,F,ja,ha),gc(P,Z,Y,F,ja,ha,1,0,1,1,0,1,Aa)}function v(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,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,h);n.lineTo(a,b);n.closePath()}function Mb(a,b,c,e){if(z!=b)n.lineWidth=z=b;if(G!=c)n.lineCap=G=c;if(D!=e)n.lineJoin=D=e;d(a.getContextStyle());n.stroke();Ba.inflate(2*b)}function Gb(a){e(a.getContextStyle());n.fill()}function Uc(a,b,c,d,f,g,h,ba,l,i,fa,j,m){if(0!=m.image.width){if(!0==m.needsUpdate||void 0==Ua[m.id]){var k=m.wrapS==THREE.RepeatWrapping,o=m.wrapT==THREE.RepeatWrapping;Ua[m.id]=n.createPattern(m.image,
|
|
|
+k&&o?"repeat":k&&!o?"repeat-x":!k&&o?"repeat-y":"no-repeat");m.needsUpdate=!1}e(Ua[m.id]);var k=m.offset.x/m.repeat.x,o=m.offset.y/m.repeat.y,Fb=m.image.width*m.repeat.x,p=m.image.height*m.repeat.y,h=(h+k)*Fb,ba=(ba+o)*p,c=c-a,d=d-b,f=f-a,g=g-b,l=(l+k)*Fb-h,i=(i+o)*p-ba,fa=(fa+k)*Fb-h,j=(j+o)*p-ba,k=l*j-fa*i;if(0==k){if(void 0===Ia[m.id])b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,b=b.getContext("2d"),b.drawImage(m.image,0,0),Ia[m.id]=b.getImageData(0,0,m.image.width,
|
|
|
+m.image.height).data;b=Ia[m.id];h=4*(Math.floor(h)+Math.floor(ba)*m.image.width);R.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Gb(R)}else k=1/k,m=(j*c-i*f)*k,i=(j*d-i*g)*k,c=(l*f-fa*c)*k,d=(l*g-fa*d)*k,a=a-m*h-c*ba,h=b-i*h-d*ba,n.save(),n.transform(m,i,c,d,a,h),n.fill(),n.restore()}}function gc(a,b,c,d,e,f,g,h,ba,l,i,fa,j){var m,k;m=j.width-1;k=j.height-1;g*=m;h*=k;c-=a;d-=b;e-=a;f-=b;ba=ba*m-g;l=l*k-h;i=i*m-g;fa=fa*k-h;k=1/(ba*fa-i*l);m=(fa*c-l*e)*k;l=(fa*d-l*f)*k;c=(ba*e-i*c)*k;d=(ba*f-i*d)*k;a=a-m*
|
|
|
+g-c*h;b=b-l*g-d*h;n.save();n.transform(m,l,c,d,a,b);n.clip();n.drawImage(j,0,0);n.restore()}function Dc(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),h=~~(255*b.g),b=~~(255*b.b),ba=~~(255*c.r),l=~~(255*c.g),c=~~(255*c.b),i=~~(255*d.r),j=~~(255*d.g),d=~~(255*d.b);fb[0]=0>e?0:255<e?255:e;fb[1]=0>f?0:255<f?255:f;fb[2]=0>a?0:255<a?255:a;fb[4]=0>g?0:255<g?255:g;fb[5]=0>h?0:255<h?255:h;fb[6]=0>b?0:255<b?255:b;fb[8]=0>ba?0:255<ba?255:ba;fb[9]=0>l?0:255<l?255:l;fb[10]=0>c?0:255<c?255:
|
|
|
+c;fb[12]=0>i?0:255<i?255:i;fb[13]=0>j?0:255<j?255:j;fb[14]=0>d?0:255<d?255:d;Fb.putImageData(Tc,0,0);Cc.drawImage(fa,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ec,ed,Pa,kb;this.autoClear?this.clear():n.setTransform(1,0,0,-1,o,q);g.info.render.vertices=0;g.info.render.faces=0;f=j.projectScene(a,k,this.sortElements);
|
|
|
+h=f.elements;i=f.lights;(Oa=0<i.length)&&m(i);for(Ec=0,ed=h.length;Ec<ed;Ec++)if(Pa=h[Ec],kb=Pa.material,kb=kb instanceof THREE.MeshFaceMaterial?Pa.faceMaterial:kb,!(null==kb||0==kb.opacity)){Ba.empty();if(Pa instanceof THREE.RenderableParticle)C=Pa,C.x*=o,C.y*=q,r(C,Pa,kb,a);else if(Pa instanceof THREE.RenderableLine)C=Pa.v1,I=Pa.v2,C.positionScreen.x*=o,C.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,Ba.addPoint(C.positionScreen.x,C.positionScreen.y),Ba.addPoint(I.positionScreen.x,
|
|
|
I.positionScreen.y),Ga.intersects(Ba)&&s(C,I,Pa,kb,a);else if(Pa instanceof THREE.RenderableFace3)C=Pa.v1,I=Pa.v2,K=Pa.v3,C.positionScreen.x*=o,C.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,kb.overdraw&&(Nb(C.positionScreen,I.positionScreen),Nb(I.positionScreen,K.positionScreen),Nb(K.positionScreen,C.positionScreen)),Ba.add3Points(C.positionScreen.x,C.positionScreen.y,I.positionScreen.x,I.positionScreen.y,K.positionScreen.x,K.positionScreen.y),
|
|
|
Ga.intersects(Ba)&&t(C,I,K,0,1,2,Pa,kb,a);else if(Pa instanceof THREE.RenderableFace4)C=Pa.v1,I=Pa.v2,K=Pa.v3,O=Pa.v4,C.positionScreen.x*=o,C.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,O.positionScreen.x*=o,O.positionScreen.y*=q,Q.positionScreen.copy(I.positionScreen),L.positionScreen.copy(O.positionScreen),kb.overdraw&&(Nb(C.positionScreen,I.positionScreen),Nb(I.positionScreen,O.positionScreen),Nb(O.positionScreen,C.positionScreen),
|
|
|
Nb(K.positionScreen,Q.positionScreen),Nb(K.positionScreen,L.positionScreen)),Ba.addPoint(C.positionScreen.x,C.positionScreen.y),Ba.addPoint(I.positionScreen.x,I.positionScreen.y),Ba.addPoint(K.positionScreen.x,K.positionScreen.y),Ba.addPoint(O.positionScreen.x,O.positionScreen.y),Ga.intersects(Ba)&&u(C,I,K,O,Q,L,Pa,kb,a);ra.addRectangle(Ba)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,h,l,i;for(e=0,g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(l=f.matrixWorld.getPosition(),i=c.dot(l),0>=i||(i*=f.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):f instanceof THREE.PointLight&&(l=f.matrixWorld.getPosition(),i=c.dot(C.sub(l,b).normalize()),0>=i||(i*=0==f.distance?1:1-Math.min(b.distanceTo(l)/f.distance,1),0!=i&&(i*=f.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function b(a){null==I[a]&&(I[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"path"),0==B&&I[a].setAttribute("shape-rendering","crispEdges"));return I[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,g,f,h=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,k,p,i,o,q,n,r,s=new THREE.Rectangle,t=new THREE.Rectangle,w=!1,u=new THREE.Color,v=new THREE.Color,z=new THREE.Color,G=new THREE.Color,D,C=new THREE.Vector3,I=[],K=[],O,Q,L,B=1;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;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){j=a;k=b;p=j/2;i=k/2;l.setAttribute("viewBox",-p+" "+-i+" "+j+" "+k);l.setAttribute("width",j);l.setAttribute("height",k);s.set(-p,-i,p,i)};this.clear=function(){for(;0<l.childNodes.length;)l.removeChild(l.childNodes[0])};this.render=function(k,j){var m,C,F,y;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,j,this.sortElements);g=e.elements;
|
|
|
-f=e.lights;L=Q=0;if(w=0<f.length){v.setRGB(0,0,0);z.setRGB(0,0,0);G.setRGB(0,0,0);for(m=0,C=f.length;m<C;m++)y=f[m],F=y.color,y instanceof THREE.AmbientLight?(v.r+=F.r,v.g+=F.g,v.b+=F.b):y instanceof THREE.DirectionalLight?(z.r+=F.r,z.g+=F.g,z.b+=F.b):y instanceof THREE.PointLight&&(G.r+=F.r,G.g+=F.g,G.b+=F.b)}for(m=0,C=g.length;m<C;m++)if(F=g[m],y=F.material,y=y instanceof THREE.MeshFaceMaterial?F.faceMaterial:y,!(null==y||0==y.opacity))if(t.empty(),F instanceof THREE.RenderableParticle)o=F,o.x*=
|
|
|
-p,o.y*=-i;else if(F instanceof THREE.RenderableLine){if(o=F.v1,q=F.v2,o.positionScreen.x*=p,o.positionScreen.y*=-i,q.positionScreen.x*=p,q.positionScreen.y*=-i,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t)){F=o;var S=q,P=L++;null==K[P]&&(K[P]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==B&&K[P].setAttribute("shape-rendering","crispEdges"));O=K[P];O.setAttribute("x1",F.positionScreen.x);O.setAttribute("y1",F.positionScreen.y);
|
|
|
-O.setAttribute("x2",S.positionScreen.x);O.setAttribute("y2",S.positionScreen.y);y instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+y.color.getContextStyle()+"; stroke-width: "+y.linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.linecap+"; stroke-linejoin: "+y.linejoin),l.appendChild(O))}}else if(F instanceof THREE.RenderableFace3){if(o=F.v1,q=F.v2,n=F.v3,o.positionScreen.x*=p,o.positionScreen.y*=-i,q.positionScreen.x*=p,q.positionScreen.y*=-i,n.positionScreen.x*=
|
|
|
-p,n.positionScreen.y*=-i,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(t)){var S=o,P=q,Z=n;d.info.render.vertices+=3;d.info.render.faces++;O=b(Q++);O.setAttribute("d","M "+S.positionScreen.x+" "+S.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");y instanceof THREE.MeshBasicMaterial?u.copy(y.color):y instanceof THREE.MeshLambertMaterial?
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,j;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),j=c.dot(i),0>=j||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),j=c.dot(C.sub(i,b).normalize()),0>=j||(j*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=j&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function b(a){null==I[a]&&(I[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"path"),0==B&&I[a].setAttribute("shape-rendering","crispEdges"));return I[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,k,p,m,o,q,n,r,s=new THREE.Rectangle,t=new THREE.Rectangle,w=!1,u=new THREE.Color,v=new THREE.Color,z=new THREE.Color,G=new THREE.Color,D,C=new THREE.Vector3,I=[],K=[],O,Q,L,B=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
+faces:0}};this.setQuality=function(a){switch(a){case "high":B=1;break;case "low":B=0}};this.setSize=function(a,b){j=a;k=b;p=j/2;m=k/2;i.setAttribute("viewBox",-p+" "+-m+" "+j+" "+k);i.setAttribute("width",j);i.setAttribute("height",k);s.set(-p,-m,p,m)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(j,k){var l,C,F,y;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(j,k,this.sortElements);g=e.elements;
|
|
|
+f=e.lights;L=Q=0;if(w=0<f.length){v.setRGB(0,0,0);z.setRGB(0,0,0);G.setRGB(0,0,0);for(l=0,C=f.length;l<C;l++)y=f[l],F=y.color,y instanceof THREE.AmbientLight?(v.r+=F.r,v.g+=F.g,v.b+=F.b):y instanceof THREE.DirectionalLight?(z.r+=F.r,z.g+=F.g,z.b+=F.b):y instanceof THREE.PointLight&&(G.r+=F.r,G.g+=F.g,G.b+=F.b)}for(l=0,C=g.length;l<C;l++)if(F=g[l],y=F.material,y=y instanceof THREE.MeshFaceMaterial?F.faceMaterial:y,!(null==y||0==y.opacity))if(t.empty(),F instanceof THREE.RenderableParticle)o=F,o.x*=
|
|
|
+p,o.y*=-m;else if(F instanceof THREE.RenderableLine){if(o=F.v1,q=F.v2,o.positionScreen.x*=p,o.positionScreen.y*=-m,q.positionScreen.x*=p,q.positionScreen.y*=-m,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t)){F=o;var S=q,P=L++;null==K[P]&&(K[P]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==B&&K[P].setAttribute("shape-rendering","crispEdges"));O=K[P];O.setAttribute("x1",F.positionScreen.x);O.setAttribute("y1",F.positionScreen.y);
|
|
|
+O.setAttribute("x2",S.positionScreen.x);O.setAttribute("y2",S.positionScreen.y);y instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+y.color.getContextStyle()+"; stroke-width: "+y.linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.linecap+"; stroke-linejoin: "+y.linejoin),i.appendChild(O))}}else if(F instanceof THREE.RenderableFace3){if(o=F.v1,q=F.v2,n=F.v3,o.positionScreen.x*=p,o.positionScreen.y*=-m,q.positionScreen.x*=p,q.positionScreen.y*=-m,n.positionScreen.x*=
|
|
|
+p,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),s.intersects(t)){var S=o,P=q,Z=n;d.info.render.vertices+=3;d.info.render.faces++;O=b(Q++);O.setAttribute("d","M "+S.positionScreen.x+" "+S.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");y instanceof THREE.MeshBasicMaterial?u.copy(y.color):y instanceof THREE.MeshLambertMaterial?
|
|
|
w?(u.r=v.r,u.g=v.g,u.b=v.b,a(f,F.centroidWorld,F.normalWorld,u),u.r=Math.max(0,Math.min(y.color.r*u.r,1)),u.g=Math.max(0,Math.min(y.color.g*u.g,1)),u.b=Math.max(0,Math.min(y.color.b*u.b,1))):u.copy(y.color):y instanceof THREE.MeshDepthMaterial?(D=1-y.__2near/(y.__farPlusNear-F.z*y.__farMinusNear),u.setRGB(D,D,D)):y instanceof THREE.MeshNormalMaterial&&u.setRGB(c(F.normalWorld.x),c(F.normalWorld.y),c(F.normalWorld.z));y.wireframe?O.setAttribute("style","fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+
|
|
|
-y.wireframeLinewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframeLinecap+"; stroke-linejoin: "+y.wireframeLinejoin):O.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+y.opacity);l.appendChild(O)}}else if(F instanceof THREE.RenderableFace4&&(o=F.v1,q=F.v2,n=F.v3,r=F.v4,o.positionScreen.x*=p,o.positionScreen.y*=-i,q.positionScreen.x*=p,q.positionScreen.y*=-i,n.positionScreen.x*=p,n.positionScreen.y*=-i,r.positionScreen.x*=p,r.positionScreen.y*=-i,t.addPoint(o.positionScreen.x,
|
|
|
+y.wireframeLinewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframeLinecap+"; stroke-linejoin: "+y.wireframeLinejoin):O.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+y.opacity);i.appendChild(O)}}else if(F instanceof THREE.RenderableFace4&&(o=F.v1,q=F.v2,n=F.v3,r=F.v4,o.positionScreen.x*=p,o.positionScreen.y*=-m,q.positionScreen.x*=p,q.positionScreen.y*=-m,n.positionScreen.x*=p,n.positionScreen.y*=-m,r.positionScreen.x*=p,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),s.intersects(t))){var S=o,P=q,Z=n,I=r;d.info.render.vertices+=4;d.info.render.faces++;O=b(Q++);O.setAttribute("d","M "+S.positionScreen.x+" "+S.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+"z");y instanceof THREE.MeshBasicMaterial?
|
|
|
u.copy(y.color):y instanceof THREE.MeshLambertMaterial?w?(u.r=v.r,u.g=v.g,u.b=v.b,a(f,F.centroidWorld,F.normalWorld,u),u.r=Math.max(0,Math.min(y.color.r*u.r,1)),u.g=Math.max(0,Math.min(y.color.g*u.g,1)),u.b=Math.max(0,Math.min(y.color.b*u.b,1))):u.copy(y.color):y instanceof THREE.MeshDepthMaterial?(D=1-y.__2near/(y.__farPlusNear-F.z*y.__farMinusNear),u.setRGB(D,D,D)):y instanceof THREE.MeshNormalMaterial&&u.setRGB(c(F.normalWorld.x),c(F.normalWorld.y),c(F.normalWorld.z));y.wireframe?O.setAttribute("style",
|
|
|
-"fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+y.wireframeLinewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframeLinecap+"; stroke-linejoin: "+y.wireframeLinejoin):O.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+y.opacity);l.appendChild(O)}}};
|
|
|
+"fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+y.wireframeLinewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframeLinecap+"; stroke-linejoin: "+y.wireframeLinejoin):O.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+y.opacity);i.appendChild(O)}}};
|
|
|
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",
|
|
@@ -240,129 +240,129 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
|
|
|
THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
|
|
|
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
|
|
|
"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
|
-THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=m.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
|
|
|
-function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
|
|
|
-var i=a.colors,l=i.length,k=a.__vertexArray,j=a.__colorArray,n=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){db.copy(eb);db.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Ga.copy(e),db.multiplyVector3(Ga),n[d]=[Ga.z,d];n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[n[d][1]].position,f=3*d,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;for(d=0;d<l;d++)f=3*d,e=i[n[d][1]],j[f]=e.r,j[f+1]=e.g,j[f+2]=e.b;if(q)for(i=0,l=q.length;i<l;i++)if(h=
|
|
|
-q[i],void 0===h.boundTo||"vertices"===h.boundTo)if(f=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)g=n[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],
|
|
|
-h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}else{if(o)for(d=0;d<g;d++)e=h[d].position,f=3*d,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;if(p)for(d=0;d<l;d++)e=i[d],f=3*d,j[f]=e.r,j[f+1]=e.g,j[f+2]=e.b;if(q)for(i=0,l=q.length;i<l;i++)if(h=q[i],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===
|
|
|
-h.type)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}if(o||c.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,k,b);if(p||c.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,
|
|
|
-j,b);if(q)for(i=0,l=q.length;i<l;i++)if(h=q[i],h.needsUpdate||c.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,h.buffer),m.bufferData(m.ARRAY_BUFFER,h.array,b)}function f(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++)Z=F=null,S=P=aa=T=$=-1,a[d].render(b,c,jb,Va),Z=F=null,S=P=aa=T=$=-1}function l(a,b,c,d,e,f,g,h){var i,l,m,k;b?(l=a.length-1,k=b=-1):(l=0,b=a.length,k=1);for(var j=l;j!==b;j+=k)if(i=a[j],i.render){l=i.object;m=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;
|
|
|
-g&&E.setBlending(i.blending);E.setDepthTest(i.depthTest);E.setDepthWrite(i.depthWrite);s(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setObjectFaces(l);m instanceof THREE.BufferGeometry?E.renderBufferDirect(d,e,f,i,m,l):E.renderBuffer(d,e,f,i,m,l)}}function j(a,b,c,d,e,f,g){for(var h,i,l=0,m=a.length;l<m;l++)if(h=a[l],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&E.setBlending(h.blending);E.setDepthTest(h.depthTest);E.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,
|
|
|
-h.polygonOffsetUnits)}E.renderImmediateObject(c,d,e,h,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!0;return!1}function i(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function n(a,b,c,d,e){d.program||E.initMaterial(d,b,c,e);if(d.morphTargets&&
|
|
|
-!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var f=0,g=E.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==F&&(m.useProgram(f),F=f,h=!0);if(d.id!==S)S=d.id,h=!0;if(h||a!==Z)m.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray),a!==Z&&(Z=a);if(h){if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof
|
|
|
-THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var l,k=0,j=0,n=0,o,p,q,r=Ba,s=r.directional.colors,y=r.directional.positions,t=r.point.colors,u=r.point.positions,v=r.point.distances,P=0,C=0,D=q=0;for(c=0,h=b.length;c<h;c++)if(l=b[c],!l.onlyShadow)if(o=l.color,p=l.intensity,q=l.distance,l instanceof THREE.AmbientLight)E.gammaInput?(k+=o.r*o.r,j+=o.g*o.g,n+=o.b*o.b):(k+=o.r,j+=o.g,n+=o.b);else if(l instanceof THREE.DirectionalLight)q=
|
|
|
-3*P,E.gammaInput?(s[q]=o.r*o.r*p*p,s[q+1]=o.g*o.g*p*p,s[q+2]=o.b*o.b*p*p):(s[q]=o.r*p,s[q+1]=o.g*p,s[q+2]=o.b*p),ra.copy(l.matrixWorld.getPosition()),ra.subSelf(l.target.matrixWorld.getPosition()),ra.normalize(),y[q]=ra.x,y[q+1]=ra.y,y[q+2]=ra.z,P+=1;else if(l instanceof THREE.PointLight||l instanceof THREE.SpotLight)D=3*C,E.gammaInput?(t[D]=o.r*o.r*p*p,t[D+1]=o.g*o.g*p*p,t[D+2]=o.b*o.b*p*p):(t[D]=o.r*p,t[D+1]=o.g*p,t[D+2]=o.b*p),l=l.matrixWorld.getPosition(),u[D]=l.x,u[D+1]=l.y,u[D+2]=l.z,v[C]=q,
|
|
|
-C+=1;for(c=3*P,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=t.length;c<h;c++)t[c]=0;r.point.length=C;r.directional.length=P;r.ambient[0]=k;r.ambient[1]=j;r.ambient[2]=n;c=Ba;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
|
|
|
+THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var e in d.attributes){var g=d.attributes[e];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var f=1;"v2"===g.type?f=2:"v3"===g.type?f=3:"v4"===g.type?f=4:"c"===g.type&&(f=3);g.size=f;g.array=new Float32Array(c*f);g.buffer=l.createBuffer();g.buffer.belongsToAttribute=e;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
|
|
|
+function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;
|
|
|
+var i=a.colors,j=i.length,m=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){db.copy(eb);db.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,Ga.copy(e),db.multiplyVector3(Ga),n[d]=[Ga.z,d];n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[n[d][1]].position,g=3*d,m[g]=e.x,m[g+1]=e.y,m[g+2]=e.z;for(d=0;d<j;d++)g=3*d,e=i[n[d][1]],k[g]=e.r,k[g+1]=e.g,k[g+2]=e.b;if(q)for(i=0,j=q.length;i<j;i++)if(h=
|
|
|
+q[i],void 0===h.boundTo||"vertices"===h.boundTo)if(g=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)f=n[d][1],h.array[d]=h.value[f];else if(2===h.size)for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(4===h.size)for(d=0;d<e;d++)f=n[d][1],f=h.value[f],
|
|
|
+h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}else{if(o)for(d=0;d<f;d++)e=h[d].position,g=3*d,m[g]=e.x,m[g+1]=e.y,m[g+2]=e.z;if(p)for(d=0;d<j;d++)e=i[d],g=3*d,k[g]=e.r,k[g+1]=e.g,k[g+2]=e.b;if(q)for(i=0,j=q.length;i<j;i++)if(h=q[i],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,g=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(3===h.size)if("c"===
|
|
|
+h.type)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(4===h.size)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}if(o||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,m,b);if(p||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,
|
|
|
+k,b);if(q)for(i=0,j=q.length;i<j;i++)if(h=q[i],h.needsUpdate||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,h.buffer),l.bufferData(l.ARRAY_BUFFER,h.array,b)}function f(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++)Z=F=null,S=P=aa=T=$=-1,a[d].render(b,c,jb,Va),Z=F=null,S=P=aa=T=$=-1}function i(a,b,c,d,e,g,f,h){var i,j,l,m;b?(j=a.length-1,m=b=-1):(j=0,b=a.length,m=1);for(var k=j;k!==b;k+=m)if(i=a[k],i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;
|
|
|
+f&&E.setBlending(i.blending);E.setDepthTest(i.depthTest);E.setDepthWrite(i.depthWrite);s(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setObjectFaces(j);l instanceof THREE.BufferGeometry?E.renderBufferDirect(d,e,g,i,l,j):E.renderBuffer(d,e,g,i,l,j)}}function j(a,b,c,d,e,g,f){for(var h,i,j=0,l=a.length;j<l;j++)if(h=a[j],i=h.object,i.visible){if(f)h=f;else{h=h[b];if(!h)continue;g&&E.setBlending(h.blending);E.setDepthTest(h.depthTest);E.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,
|
|
|
+h.polygonOffsetUnits)}E.renderImmediateObject(c,d,e,h,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!0;return!1}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function n(a,b,c,d,e){d.program||E.initMaterial(d,b,c,e);if(d.morphTargets&&
|
|
|
+!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var g=0,f=E.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==F&&(l.useProgram(g),F=g,h=!0);if(d.id!==S)S=d.id,h=!0;if(h||a!==Z)l.uniformMatrix4fv(f.projectionMatrix,!1,a._projectionMatrixArray),a!==Z&&(Z=a);if(h){if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof
|
|
|
+THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var j,m=0,k=0,n=0,o,p,q,r=Ba,s=r.directional.colors,y=r.directional.positions,t=r.point.colors,u=r.point.positions,v=r.point.distances,P=0,C=0,D=q=0;for(c=0,h=b.length;c<h;c++)if(j=b[c],!j.onlyShadow)if(o=j.color,p=j.intensity,q=j.distance,j instanceof THREE.AmbientLight)E.gammaInput?(m+=o.r*o.r,k+=o.g*o.g,n+=o.b*o.b):(m+=o.r,k+=o.g,n+=o.b);else if(j instanceof THREE.DirectionalLight)q=
|
|
|
+3*P,E.gammaInput?(s[q]=o.r*o.r*p*p,s[q+1]=o.g*o.g*p*p,s[q+2]=o.b*o.b*p*p):(s[q]=o.r*p,s[q+1]=o.g*p,s[q+2]=o.b*p),ra.copy(j.matrixWorld.getPosition()),ra.subSelf(j.target.matrixWorld.getPosition()),ra.normalize(),y[q]=ra.x,y[q+1]=ra.y,y[q+2]=ra.z,P+=1;else if(j instanceof THREE.PointLight||j instanceof THREE.SpotLight)D=3*C,E.gammaInput?(t[D]=o.r*o.r*p*p,t[D+1]=o.g*o.g*p*p,t[D+2]=o.b*o.b*p*p):(t[D]=o.r*p,t[D+1]=o.g*p,t[D+2]=o.b*p),j=j.matrixWorld.getPosition(),u[D]=j.x,u[D+1]=j.y,u[D+2]=j.z,v[C]=q,
|
|
|
+C+=1;for(c=3*P,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=t.length;c<h;c++)t[c]=0;r.point.length=C;r.directional.length=P;r.ambient[0]=m;r.ambient[1]=k;r.ambient[2]=n;c=Ba;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
|
|
|
d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,E.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=
|
|
|
d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=G.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,E.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),
|
|
|
i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)E.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=
|
|
|
-a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){h=c=0;for(k=b.length;h<k;h++)if(j=b[h],j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade))i.shadowMap.texture[c]=j.shadowMap,i.shadowMapSize.value[c]=j.shadowMapSize,i.shadowMatrix.value[c]=j.shadowMatrix,i.shadowDarkness.value[c]=j.shadowDarkness,i.shadowBias.value[c]=j.shadowBias,c++}b=d.uniformsList;
|
|
|
-for(i=0,c=b.length;i<c;i++)if(j=f.uniforms[b[i][1]])if(h=b[i][0],n=h.type,k=h.value,"i"===n)m.uniform1i(j,k);else if("f"===n)m.uniform1f(j,k);else if("v2"===n)m.uniform2f(j,k.x,k.y);else if("v3"===n)m.uniform3f(j,k.x,k.y,k.z);else if("v4"===n)m.uniform4f(j,k.x,k.y,k.z,k.w);else if("c"===n)m.uniform3f(j,k.r,k.g,k.b);else if("fv1"===n)m.uniform1fv(j,k);else if("fv"===n)m.uniform3fv(j,k);else if("v2v"===n){if(!h._array)h._array=new Float32Array(2*k.length);for(n=0,r=k.length;n<r;n++)s=2*n,h._array[s]=
|
|
|
-k[n].x,h._array[s+1]=k[n].y;m.uniform2fv(j,h._array)}else if("v3v"===n){if(!h._array)h._array=new Float32Array(3*k.length);for(n=0,r=k.length;n<r;n++)s=3*n,h._array[s]=k[n].x,h._array[s+1]=k[n].y,h._array[s+2]=k[n].z;m.uniform3fv(j,h._array)}else if("v4v"==n){if(!h._array)h._array=new Float32Array(4*k.length);for(n=0,r=k.length;n<r;n++)s=4*n,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;m.uniform4fv(j,h._array)}else if("m4"===n){if(!h._array)h._array=new Float32Array(16);
|
|
|
-k.flattenToArray(h._array);m.uniformMatrix4fv(j,!1,h._array)}else if("m4v"===n){if(!h._array)h._array=new Float32Array(16*k.length);for(n=0,r=k.length;n<r;n++)k[n].flattenToArrayOffset(h._array,16*n);m.uniformMatrix4fv(j,!1,h._array)}else if("t"===n){if(m.uniform1i(j,k),j=h.texture)if(j.image instanceof Array&&6===j.image.length){if(h=j,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=m.createTexture();m.activeTexture(m.TEXTURE0+k);m.bindTexture(m.TEXTURE_CUBE_MAP,
|
|
|
-h.image.__webglTextureCube);k=[];for(j=0;6>j;j++){n=k;r=j;if(E.autoScaleCubemaps){if(s=h.image[j],t=sa,!(s.width<=t&&s.height<=t))u=Math.max(s.width,s.height),y=Math.floor(s.width*t/u),t=Math.floor(s.height*t/u),u=document.createElement("canvas"),u.width=y,u.height=t,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,y,t),s=u}else s=h.image[j];n[r]=s}j=k[0];n=0===(j.width&j.width-1)&&0===(j.height&j.height-1);r=z(h.format);s=z(h.type);w(m.TEXTURE_CUBE_MAP,h,n);for(j=0;6>j;j++)m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
-j,0,r,r,s,k[j]);h.generateMipmaps&&n&&m.generateMipmap(m.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdate)h.onUpdate()}else m.activeTexture(m.TEXTURE0+k),m.bindTexture(m.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else j instanceof THREE.WebGLRenderTargetCube?(h=j,m.activeTexture(m.TEXTURE0+k),m.bindTexture(m.TEXTURE_CUBE_MAP,h.__webglTexture)):E.setTexture(j,k)}else if("tv"===n){if(!h._array){h._array=[];for(n=0,r=h.texture.length;n<r;n++)h._array[n]=k+n}m.uniform1iv(j,h._array);for(n=0,r=h.texture.length;n<
|
|
|
-r;n++)(j=h.texture[n])&&E.setTexture(j,h._array[n])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition)b=a.matrixWorld.getPosition(),m.uniform3f(g.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&m.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&m.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices)}m.uniformMatrix4fv(g.modelViewMatrix,
|
|
|
-!1,e._modelViewMatrixArray);g.normalMatrix&&m.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==g.objectMatrix&&m.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){da!==
|
|
|
-a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),da=a);if(a&&(Ua!==b||Ia!==c))m.polygonOffset(b,c),Ua=b,Ia=c}function t(a,b){var c;"fragment"===a?c=m.createShader(m.FRAGMENT_SHADER):"vertex"===a&&(c=m.createShader(m.VERTEX_SHADER));m.shaderSource(c,b);m.compileShader(c);return!m.getShaderParameter(c,m.COMPILE_STATUS)?(console.error(m.getShaderInfoLog(c)),console.error(b),null):c}function w(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,z(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,
|
|
|
-z(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,z(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,z(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,v(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,v(b.minFilter)))}function u(a,b){m.bindRenderbuffer(m.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,
|
|
|
-m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,b.width,b.height)}function v(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return m.NEAREST;default:return m.LINEAR}}function z(a){switch(a){case THREE.RepeatWrapping:return m.REPEAT;
|
|
|
-case THREE.ClampToEdgeWrapping:return m.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return m.MIRRORED_REPEAT;case THREE.NearestFilter:return m.NEAREST;case THREE.NearestMipMapNearestFilter:return m.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return m.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return m.LINEAR;case THREE.LinearMipMapNearestFilter:return m.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return m.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return m.BYTE;
|
|
|
-case THREE.UnsignedByteType:return m.UNSIGNED_BYTE;case THREE.ShortType:return m.SHORT;case THREE.UnsignedShortType:return m.UNSIGNED_SHORT;case THREE.IntType:return m.INT;case THREE.UnsignedIntType:return m.UNSIGNED_INT;case THREE.FloatType:return m.FLOAT;case THREE.AlphaFormat:return m.ALPHA;case THREE.RGBFormat:return m.RGB;case THREE.RGBAFormat:return m.RGBA;case THREE.LuminanceFormat:return m.LUMINANCE;case THREE.LuminanceAlphaFormat:return m.LUMINANCE_ALPHA}return 0}var a=a||{},G=void 0!==a.canvas?
|
|
|
+a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){h=c=0;for(m=b.length;h<m;h++)if(k=b[h],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.texture[c]=k.shadowMap,i.shadowMapSize.value[c]=k.shadowMapSize,i.shadowMatrix.value[c]=k.shadowMatrix,i.shadowDarkness.value[c]=k.shadowDarkness,i.shadowBias.value[c]=k.shadowBias,c++}b=d.uniformsList;
|
|
|
+for(i=0,c=b.length;i<c;i++)if(k=g.uniforms[b[i][1]])if(h=b[i][0],n=h.type,m=h.value,"i"===n)l.uniform1i(k,m);else if("f"===n)l.uniform1f(k,m);else if("v2"===n)l.uniform2f(k,m.x,m.y);else if("v3"===n)l.uniform3f(k,m.x,m.y,m.z);else if("v4"===n)l.uniform4f(k,m.x,m.y,m.z,m.w);else if("c"===n)l.uniform3f(k,m.r,m.g,m.b);else if("fv1"===n)l.uniform1fv(k,m);else if("fv"===n)l.uniform3fv(k,m);else if("v2v"===n){if(!h._array)h._array=new Float32Array(2*m.length);for(n=0,r=m.length;n<r;n++)s=2*n,h._array[s]=
|
|
|
+m[n].x,h._array[s+1]=m[n].y;l.uniform2fv(k,h._array)}else if("v3v"===n){if(!h._array)h._array=new Float32Array(3*m.length);for(n=0,r=m.length;n<r;n++)s=3*n,h._array[s]=m[n].x,h._array[s+1]=m[n].y,h._array[s+2]=m[n].z;l.uniform3fv(k,h._array)}else if("v4v"==n){if(!h._array)h._array=new Float32Array(4*m.length);for(n=0,r=m.length;n<r;n++)s=4*n,h._array[s]=m[n].x,h._array[s+1]=m[n].y,h._array[s+2]=m[n].z,h._array[s+3]=m[n].w;l.uniform4fv(k,h._array)}else if("m4"===n){if(!h._array)h._array=new Float32Array(16);
|
|
|
+m.flattenToArray(h._array);l.uniformMatrix4fv(k,!1,h._array)}else if("m4v"===n){if(!h._array)h._array=new Float32Array(16*m.length);for(n=0,r=m.length;n<r;n++)m[n].flattenToArrayOffset(h._array,16*n);l.uniformMatrix4fv(k,!1,h._array)}else if("t"===n){if(l.uniform1i(k,m),k=h.texture)if(k.image instanceof Array&&6===k.image.length){if(h=k,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=l.createTexture();l.activeTexture(l.TEXTURE0+m);l.bindTexture(l.TEXTURE_CUBE_MAP,
|
|
|
+h.image.__webglTextureCube);m=[];for(k=0;6>k;k++){n=m;r=k;if(E.autoScaleCubemaps){if(s=h.image[k],t=sa,!(s.width<=t&&s.height<=t))u=Math.max(s.width,s.height),y=Math.floor(s.width*t/u),t=Math.floor(s.height*t/u),u=document.createElement("canvas"),u.width=y,u.height=t,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,y,t),s=u}else s=h.image[k];n[r]=s}k=m[0];n=0===(k.width&k.width-1)&&0===(k.height&k.height-1);r=z(h.format);s=z(h.type);w(l.TEXTURE_CUBE_MAP,h,n);for(k=0;6>k;k++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
+k,0,r,r,s,m[k]);h.generateMipmaps&&n&&l.generateMipmap(l.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdate)h.onUpdate()}else l.activeTexture(l.TEXTURE0+m),l.bindTexture(l.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else k instanceof THREE.WebGLRenderTargetCube?(h=k,l.activeTexture(l.TEXTURE0+m),l.bindTexture(l.TEXTURE_CUBE_MAP,h.__webglTexture)):E.setTexture(k,m)}else if("tv"===n){if(!h._array){h._array=[];for(n=0,r=h.texture.length;n<r;n++)h._array[n]=m+n}l.uniform1iv(k,h._array);for(n=0,r=h.texture.length;n<
|
|
|
+r;n++)(k=h.texture[n])&&E.setTexture(k,h._array[n])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==f.cameraPosition)b=a.matrixWorld.getPosition(),l.uniform3f(f.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==f.viewMatrix&&l.uniformMatrix4fv(f.viewMatrix,!1,a._viewMatrixArray);d.skinning&&l.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices)}l.uniformMatrix4fv(f.modelViewMatrix,
|
|
|
+!1,e._modelViewMatrixArray);f.normalMatrix&&l.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==f.objectMatrix&&l.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){da!==
|
|
|
+a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),da=a);if(a&&(Ua!==b||Ia!==c))l.polygonOffset(b,c),Ua=b,Ia=c}function t(a,b){var c;"fragment"===a?c=l.createShader(l.FRAGMENT_SHADER):"vertex"===a&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);return!l.getShaderParameter(c,l.COMPILE_STATUS)?(console.error(l.getShaderInfoLog(c)),console.error(b),null):c}function w(a,b,c){c?(l.texParameteri(a,l.TEXTURE_WRAP_S,z(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,
|
|
|
+z(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,z(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,z(b.minFilter))):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,v(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,v(b.minFilter)))}function u(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,
|
|
|
+l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function v(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return l.NEAREST;default:return l.LINEAR}}function z(a){switch(a){case THREE.RepeatWrapping:return l.REPEAT;
|
|
|
+case THREE.ClampToEdgeWrapping:return l.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return l.MIRRORED_REPEAT;case THREE.NearestFilter:return l.NEAREST;case THREE.NearestMipMapNearestFilter:return l.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return l.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return l.LINEAR;case THREE.LinearMipMapNearestFilter:return l.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return l.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return l.BYTE;
|
|
|
+case THREE.UnsignedByteType:return l.UNSIGNED_BYTE;case THREE.ShortType:return l.SHORT;case THREE.UnsignedShortType:return l.UNSIGNED_SHORT;case THREE.IntType:return l.INT;case THREE.UnsignedIntType:return l.UNSIGNED_INT;case THREE.FloatType:return l.FLOAT;case THREE.AlphaFormat:return l.ALPHA;case THREE.RGBFormat:return l.RGB;case THREE.RGBAFormat:return l.RGBA;case THREE.LuminanceFormat:return l.LUMINANCE;case THREE.LuminanceAlphaFormat:return l.LUMINANCE_ALPHA}return 0}var a=a||{},G=void 0!==a.canvas?
|
|
|
a.canvas:document.createElement("canvas"),D=void 0!==a.precision?a.precision:"mediump",C=void 0!==a.alpha?a.alpha:!0,I=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,K=void 0!==a.antialias?a.antialias:!1,O=void 0!==a.stencil?a.stencil:!0,Q=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),B=void 0!==a.clearAlpha?a.clearAlpha:0,N=void 0!==a.maxLights?a.maxLights:4;this.domElement=G;this.context=null;this.autoUpdateScene=
|
|
|
this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},
|
|
|
-render:{calls:0,vertices:0,faces:0,points:0}};var E=this,m,Y=[],F=null,y=null,S=-1,P=null,Z=null,ja=0,ha=null,R=null,$=null,T=null,aa=null,da=null,Ua=null,Ia=null,oa=null,Fa=0,Aa=0,ka=0,bb=0,jb=0,Va=0,cb=new THREE.Frustum,eb=new THREE.Matrix4,db=new THREE.Matrix4,Ga=new THREE.Vector4,ra=new THREE.Vector3,Ba={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};m=function(){var a;try{if(!(a=G.getContext("experimental-webgl",{alpha:C,premultipliedAlpha:I,
|
|
|
-antialias:K,stencil:O,preserveDrawingBuffer:Q})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();m.clearColor(0,0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);
|
|
|
-m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.clearColor(L.r,L.g,L.b,B);this.context=m;var Oa=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS);m.getParameter(m.MAX_TEXTURE_SIZE);var sa=m.getParameter(m.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return m};this.supportsVertexTextures=function(){return 0<Oa};this.setSize=function(a,b){G.width=a;G.height=b;this.setViewport(0,0,G.width,G.height)};this.setViewport=function(a,b,c,d){Fa=a;Aa=b;ka=c;bb=d;m.viewport(Fa,Aa,ka,bb)};this.setScissor=
|
|
|
-function(a,b,c,d){m.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColorHex=function(a,b){L.setHex(a);B=b;m.clearColor(L.r,L.g,L.b,B)};this.setClearColor=function(a,b){L.copy(a);B=b;m.clearColor(L.r,L.g,L.b,B)};this.getClearColor=function(){return L};this.getClearAlpha=function(){return B};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=m.COLOR_BUFFER_BIT;if(void 0===b||b)d|=m.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=m.STENCIL_BUFFER_BIT;
|
|
|
-m.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];
|
|
|
-m.deleteBuffer(c.__webglVertexBuffer);m.deleteBuffer(c.__webglNormalBuffer);m.deleteBuffer(c.__webglTangentBuffer);m.deleteBuffer(c.__webglColorBuffer);m.deleteBuffer(c.__webglUVBuffer);m.deleteBuffer(c.__webglUV2Buffer);m.deleteBuffer(c.__webglSkinVertexABuffer);m.deleteBuffer(c.__webglSkinVertexBBuffer);m.deleteBuffer(c.__webglSkinIndicesBuffer);m.deleteBuffer(c.__webglSkinWeightsBuffer);m.deleteBuffer(c.__webglFaceBuffer);m.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets)for(d=
|
|
|
-0,e=c.numMorphTargets;d<e;d++)m.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.numMorphNormals)for(d=0,e=c.numMorphNormals;d<e;d++)m.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)m.deleteBuffer(c.__webglCustomAttributesList[d].buffer);E.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof
|
|
|
-THREE.Line)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,m.deleteTexture(a.__webglTexture),E.info.memory.textures--};this.updateShadowMap=function(a,b){F=null;S=P=aa=T=$=-1;this.shadowMapPlugin.update(a,b)};
|
|
|
-this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=m.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=m.createBuffer();a.hasPos&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,a.positionArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.position),m.vertexAttribPointer(b.attributes.position,3,m.FLOAT,!1,0,0));if(a.hasNormal){m.bindBuffer(m.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,
|
|
|
-e,f,g,h,i,l,k,j,n,o=3*a.count;for(n=0;n<o;n+=9)c=a.normalArray,d=c[n],e=c[n+1],f=c[n+2],g=c[n+3],i=c[n+4],k=c[n+5],h=c[n+6],l=c[n+7],j=c[n+8],d=(d+g+h)/3,e=(e+i+l)/3,f=(f+k+j)/3,c[n]=d,c[n+1]=e,c[n+2]=f,c[n+3]=d,c[n+4]=e,c[n+5]=f,c[n+6]=d,c[n+7]=e,c[n+8]=f}m.bufferData(m.ARRAY_BUFFER,a.normalArray,m.DYNAMIC_DRAW);m.enableVertexAttribArray(b.attributes.normal);m.vertexAttribPointer(b.attributes.normal,3,m.FLOAT,!1,0,0)}m.drawArrays(m.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,
|
|
|
-b,c,d,e,f){if(0!==d.opacity&&(c=n(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==P&&(P=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;for(c=f.length;d<c;++d)b&&(m.bindBuffer(m.ARRAY_BUFFER,e.vertexPositionBuffer),m.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,m.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(m.bindBuffer(m.ARRAY_BUFFER,e.vertexNormalBuffer),m.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,m.FLOAT,!1,0,12*
|
|
|
-f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(m.bindBuffer(m.ARRAY_BUFFER,e.vertexUvBuffer),m.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,m.FLOAT,!1,0,8*f[d].index),m.enableVertexAttribArray(a.uv)):m.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(m.bindBuffer(m.ARRAY_BUFFER,e.vertexColorBuffer),m.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,m.FLOAT,!1,0,16*f[d].index)),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),m.drawElements(m.TRIANGLES,
|
|
|
-f[d].count,m.UNSIGNED_SHORT,2*f[d].start),E.info.render.calls++,E.info.render.vertices+=f[d].count,E.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,b,c,d,e,f){if(0!==d.opacity){var g,h,c=n(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==P&&(P=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?
|
|
|
-(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0)):0<=c.position&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),m.vertexAttribPointer(c["morphTarget"+g],3,m.FLOAT,
|
|
|
-!1,0,0),d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[g]]),m.vertexAttribPointer(c["morphNormal"+g],3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],l=-1,k=0;h=f.morphTargetInfluences;var j,o=h.length;g=0;for(-1!==f.morphTargetBase&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(j=0;j<o;j++)!i[j]&&h[j]>l&&(k=j,l=h[k]);m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);m.vertexAttribPointer(c["morphTarget"+g],3,m.FLOAT,
|
|
|
-!1,0,0);d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k]),m.vertexAttribPointer(c["morphNormal"+g],3,m.FLOAT,!1,0,0));f.__webglMorphTargetInfluences[g]=l;i[k]=1;l=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&m.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
-c.buffer),m.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,m.FLOAT,!1,0,0));0<=b.color&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglColorBuffer),m.vertexAttribPointer(b.color,3,m.FLOAT,!1,0,0));0<=b.normal&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglNormalBuffer),m.vertexAttribPointer(b.normal,3,m.FLOAT,!1,0,0));0<=b.tangent&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglTangentBuffer),m.vertexAttribPointer(b.tangent,4,m.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUVBuffer),
|
|
|
-m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(b.uv)):m.disableVertexAttribArray(b.uv));0<=b.uv2&&(e.__webglUV2Buffer?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUV2Buffer),m.vertexAttribPointer(b.uv2,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(b.uv2)):m.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinVertexABuffer),m.vertexAttribPointer(b.skinVertexA,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
-e.__webglSkinVertexBBuffer),m.vertexAttribPointer(b.skinVertexB,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),m.vertexAttribPointer(b.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),m.vertexAttribPointer(b.skinWeight,4,m.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==oa&&(m.lineWidth(d),oa=d),a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),m.drawElements(m.LINES,e.__webglLineCount,m.UNSIGNED_SHORT,
|
|
|
-0)):(a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),m.drawElements(m.TRIANGLES,e.__webglFaceCount,m.UNSIGNED_SHORT,0)),E.info.render.calls++,E.info.render.vertices+=e.__webglFaceCount,E.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,d=d.linewidth,d!==oa&&(m.lineWidth(d),oa=d),m.drawArrays(f,0,e.__webglLineCount),E.info.render.calls++):f instanceof THREE.ParticleSystem?(m.drawArrays(m.POINTS,0,e.__webglParticleCount),E.info.render.calls++,
|
|
|
-E.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(m.drawArrays(m.TRIANGLE_STRIP,0,e.__webglVertexCount),E.info.render.calls++)}};this.render=function(a,b,c,d){var e,g,i,k,n=a.__lights,o=a.fog;S=-1;void 0===b.parent&&(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);
|
|
|
+render:{calls:0,vertices:0,faces:0,points:0}};var E=this,l,Y=[],F=null,y=null,S=-1,P=null,Z=null,ja=0,ha=null,R=null,$=null,T=null,aa=null,da=null,Ua=null,Ia=null,oa=null,Fa=0,Aa=0,ka=0,bb=0,jb=0,Va=0,cb=new THREE.Frustum,eb=new THREE.Matrix4,db=new THREE.Matrix4,Ga=new THREE.Vector4,ra=new THREE.Vector3,Ba={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};l=function(){var a;try{if(!(a=G.getContext("experimental-webgl",{alpha:C,premultipliedAlpha:I,
|
|
|
+antialias:K,stencil:O,preserveDrawingBuffer:Q})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);
|
|
|
+l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.clearColor(L.r,L.g,L.b,B);this.context=l;var Oa=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS);l.getParameter(l.MAX_TEXTURE_SIZE);var sa=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return l};this.supportsVertexTextures=function(){return 0<Oa};this.setSize=function(a,b){G.width=a;G.height=b;this.setViewport(0,0,G.width,G.height)};this.setViewport=function(a,b,c,d){Fa=a;Aa=b;ka=c;bb=d;l.viewport(Fa,Aa,ka,bb)};this.setScissor=
|
|
|
+function(a,b,c,d){l.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColorHex=function(a,b){L.setHex(a);B=b;l.clearColor(L.r,L.g,L.b,B)};this.setClearColor=function(a,b){L.copy(a);B=b;l.clearColor(L.r,L.g,L.b,B)};this.getClearColor=function(){return L};this.getClearAlpha=function(){return B};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=l.COLOR_BUFFER_BIT;if(void 0===b||b)d|=l.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=l.STENCIL_BUFFER_BIT;
|
|
|
+l.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];
|
|
|
+l.deleteBuffer(c.__webglVertexBuffer);l.deleteBuffer(c.__webglNormalBuffer);l.deleteBuffer(c.__webglTangentBuffer);l.deleteBuffer(c.__webglColorBuffer);l.deleteBuffer(c.__webglUVBuffer);l.deleteBuffer(c.__webglUV2Buffer);l.deleteBuffer(c.__webglSkinVertexABuffer);l.deleteBuffer(c.__webglSkinVertexBBuffer);l.deleteBuffer(c.__webglSkinIndicesBuffer);l.deleteBuffer(c.__webglSkinWeightsBuffer);l.deleteBuffer(c.__webglFaceBuffer);l.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets)for(d=
|
|
|
+0,e=c.numMorphTargets;d<e;d++)l.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.numMorphNormals)for(d=0,e=c.numMorphNormals;d<e;d++)l.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)l.deleteBuffer(c.__webglCustomAttributesList[d].buffer);E.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof
|
|
|
+THREE.Line)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,l.deleteTexture(a.__webglTexture),E.info.memory.textures--};this.updateShadowMap=function(a,b){F=null;S=P=aa=T=$=-1;this.shadowMapPlugin.update(a,b)};
|
|
|
+this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=l.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=l.createBuffer();a.hasPos&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW),l.enableVertexAttribArray(b.attributes.position),l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormal){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,
|
|
|
+e,g,f,h,i,j,m,k,n,o=3*a.count;for(n=0;n<o;n+=9)c=a.normalArray,d=c[n],e=c[n+1],g=c[n+2],f=c[n+3],i=c[n+4],m=c[n+5],h=c[n+6],j=c[n+7],k=c[n+8],d=(d+f+h)/3,e=(e+i+j)/3,g=(g+m+k)/3,c[n]=d,c[n+1]=e,c[n+2]=g,c[n+3]=d,c[n+4]=e,c[n+5]=g,c[n+6]=d,c[n+7]=e,c[n+8]=g}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);l.enableVertexAttribArray(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,
|
|
|
+b,c,d,e,g){if(0!==d.opacity&&(c=n(a,b,c,d,g),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==P&&(P=d,b=!0),g instanceof THREE.Mesh)){g=e.offsets;d=0;for(c=g.length;d<c;++d)b&&(l.bindBuffer(l.ARRAY_BUFFER,e.vertexPositionBuffer),l.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,l.FLOAT,!1,0,12*g[d].index),0<=a.normal&&e.vertexNormalBuffer&&(l.bindBuffer(l.ARRAY_BUFFER,e.vertexNormalBuffer),l.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,l.FLOAT,!1,0,12*
|
|
|
+g[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(l.bindBuffer(l.ARRAY_BUFFER,e.vertexUvBuffer),l.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,l.FLOAT,!1,0,8*g[d].index),l.enableVertexAttribArray(a.uv)):l.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(l.bindBuffer(l.ARRAY_BUFFER,e.vertexColorBuffer),l.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,l.FLOAT,!1,0,16*g[d].index)),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),l.drawElements(l.TRIANGLES,
|
|
|
+g[d].count,l.UNSIGNED_SHORT,2*g[d].start),E.info.render.calls++,E.info.render.vertices+=g[d].count,E.info.render.faces+=g[d].count/3}};this.renderBuffer=function(a,b,c,d,e,g){if(0!==d.opacity){var f,h,c=n(a,b,c,d,g),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==P&&(P=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;-1!==g.morphTargetBase?
|
|
|
+(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0)):0<=c.position&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;f<d.numSupportedMorphTargets&&f<i.length;)l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),l.vertexAttribPointer(c["morphTarget"+f],3,l.FLOAT,
|
|
|
+!1,0,0),d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[f]]),l.vertexAttribPointer(c["morphNormal"+f],3,l.FLOAT,!1,0,0)),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],j=-1,m=0;h=g.morphTargetInfluences;var k,o=h.length;f=0;for(-1!==g.morphTargetBase&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(k=0;k<o;k++)!i[k]&&h[k]>j&&(m=k,j=h[m]);l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[m]);l.vertexAttribPointer(c["morphTarget"+f],3,l.FLOAT,
|
|
|
+!1,0,0);d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[m]),l.vertexAttribPointer(c["morphNormal"+f],3,l.FLOAT,!1,0,0));g.__webglMorphTargetInfluences[f]=j;i[m]=1;j=-1;f++}}null!==d.program.uniforms.morphTargetInfluences&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(f=0,h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],0<=b[c.buffer.belongsToAttribute]&&(l.bindBuffer(l.ARRAY_BUFFER,
|
|
|
+c.buffer),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0));0<=b.color&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0));0<=b.normal&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));0<=b.tangent&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglTangentBuffer),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),
|
|
|
+l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv)):l.disableVertexAttribArray(b.uv));0<=b.uv2&&(e.__webglUV2Buffer?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv2)):l.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinVertexABuffer),l.vertexAttribPointer(b.skinVertexA,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,
|
|
|
+e.__webglSkinVertexBBuffer),l.vertexAttribPointer(b.skinVertexB,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==oa&&(l.lineWidth(d),oa=d),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,l.UNSIGNED_SHORT,
|
|
|
+0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,l.UNSIGNED_SHORT,0)),E.info.render.calls++,E.info.render.vertices+=e.__webglFaceCount,E.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,d=d.linewidth,d!==oa&&(l.lineWidth(d),oa=d),l.drawArrays(g,0,e.__webglLineCount),E.info.render.calls++):g instanceof THREE.ParticleSystem?(l.drawArrays(l.POINTS,0,e.__webglParticleCount),E.info.render.calls++,
|
|
|
+E.info.render.points+=e.__webglParticleCount):g instanceof THREE.Ribbon&&(l.drawArrays(l.TRIANGLE_STRIP,0,e.__webglVertexCount),E.info.render.calls++)}};this.render=function(a,b,c,d){var e,g,m,k,n=a.__lights,o=a.fog;S=-1;void 0===b.parent&&(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);eb.multiply(b.projectionMatrix,b.matrixWorldInverse);cb.setFromMatrix(eb);this.autoUpdateObjects&&this.initWebGLObjects(a);h(this.renderPluginsPre,a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;E.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,
|
|
|
-this.autoClearStencil);k=a.__webglObjects;for(d=0,e=k.length;d<e;d++)if(g=k[d],i=g.object,g.render=!1,i.visible&&(!(i instanceof THREE.Mesh||i instanceof THREE.ParticleSystem)||!i.frustumCulled||cb.contains(i))){i.matrixWorld.flattenToArray(i._objectMatrixArray);r(i,b);var p=g,q=p.object,y=p.buffer,t=void 0,t=t=void 0,t=q.material;if(t instanceof THREE.MeshFaceMaterial){if(t=y.materialIndex,0<=t)t=q.geometry.materials[t],t.transparent?(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null)}else if(t)t.transparent?
|
|
|
-(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null);g.render=!0;if(this.sortObjects)i.renderDepth?g.z=i.renderDepth:(Ga.copy(i.matrixWorld.getPosition()),eb.multiplyVector3(Ga),g.z=Ga.z)}this.sortObjects&&k.sort(f);k=a.__webglObjectsImmediate;for(d=0,e=k.length;d<e;d++)if(g=k[d],i=g.object,i.visible)i.matrixAutoUpdate&&i.matrixWorld.flattenToArray(i._objectMatrixArray),r(i,b),i=g.object.material,i.transparent?(g.transparent=i,g.opaque=null):(g.opaque=i,g.transparent=null);a.overrideMaterial?
|
|
|
-(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),j(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),l(a.__webglObjects,!0,"opaque",b,n,o,!1),j(a.__webglObjectsImmediate,"opaque",b,n,o,!1),
|
|
|
-l(a.__webglObjects,!1,"transparent",b,n,o,!0),j(a.__webglObjectsImmediate,"transparent",b,n,o,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,c.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null)));
|
|
|
-this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var f=n(a,b,c,d,e);P=-1;E.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,m,cb):e.render(function(a){E.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],h=a,l=void 0,j=void 0,n=void 0;if(!f.__webglInit)if(f.__webglInit=
|
|
|
+this.autoClearStencil);k=a.__webglObjects;for(d=0,e=k.length;d<e;d++)if(g=k[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh||m instanceof THREE.ParticleSystem)||!m.frustumCulled||cb.contains(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);r(m,b);var p=g,q=p.object,y=p.buffer,t=void 0,t=t=void 0,t=q.material;if(t instanceof THREE.MeshFaceMaterial){if(t=y.materialIndex,0<=t)t=q.geometry.materials[t],t.transparent?(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null)}else if(t)t.transparent?
|
|
|
+(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(Ga.copy(m.matrixWorld.getPosition()),eb.multiplyVector3(Ga),g.z=Ga.z)}this.sortObjects&&k.sort(f);k=a.__webglObjectsImmediate;for(d=0,e=k.length;d<e;d++)if(g=k[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),r(m,b),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?
|
|
|
+(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),j(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,n,o,!1),j(a.__webglObjectsImmediate,"opaque",b,n,o,!1),
|
|
|
+i(a.__webglObjects,!1,"transparent",b,n,o,!0),j(a.__webglObjectsImmediate,"transparent",b,n,o,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,c.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,c.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null)));
|
|
|
+this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var g=n(a,b,c,d,e);P=-1;E.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(g,l,cb):e.render(function(a){E.renderBufferImmediate(a,g,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],h=a,i=void 0,j=void 0,n=void 0;if(!f.__webglInit)if(f.__webglInit=
|
|
|
!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){if(j=f.geometry,j instanceof THREE.Geometry){if(void 0===j.geometryGroups){var r=j,s=void 0,y=void 0,t=void 0,u=void 0,v=void 0,w=void 0,z=void 0,S={},P=r.morphTargets.length,C=r.morphNormals.length;r.geometryGroups={};for(s=0,y=r.faces.length;s<y;s++)t=r.faces[s],
|
|
|
u=t.materialIndex,w=void 0!==u?u:-1,void 0===S[w]&&(S[w]={hash:w,counter:0}),z=S[w].hash+"_"+S[w].counter,void 0===r.geometryGroups[z]&&(r.geometryGroups[z]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:P,numMorphNormals:C}),v=t instanceof THREE.Face3?3:4,65535<r.geometryGroups[z].vertices+v&&(S[w].counter+=1,z=S[w].hash+"_"+S[w].counter,void 0===r.geometryGroups[z]&&(r.geometryGroups[z]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:P,numMorphNormals:C})),t instanceof
|
|
|
-THREE.Face3?r.geometryGroups[z].faces3.push(s):r.geometryGroups[z].faces4.push(s),r.geometryGroups[z].vertices+=v;r.geometryGroupsList=[];var F=void 0;for(F in r.geometryGroups)r.geometryGroups[F].id=ja++,r.geometryGroupsList.push(r.geometryGroups[F])}for(l in j.geometryGroups)if(n=j.geometryGroups[l],!n.__webglVertexBuffer){var Z=n;Z.__webglVertexBuffer=m.createBuffer();Z.__webglNormalBuffer=m.createBuffer();Z.__webglTangentBuffer=m.createBuffer();Z.__webglColorBuffer=m.createBuffer();Z.__webglUVBuffer=
|
|
|
-m.createBuffer();Z.__webglUV2Buffer=m.createBuffer();Z.__webglSkinVertexABuffer=m.createBuffer();Z.__webglSkinVertexBBuffer=m.createBuffer();Z.__webglSkinIndicesBuffer=m.createBuffer();Z.__webglSkinWeightsBuffer=m.createBuffer();Z.__webglFaceBuffer=m.createBuffer();Z.__webglLineBuffer=m.createBuffer();var D=void 0,G=void 0;if(Z.numMorphTargets){Z.__webglMorphTargetsBuffers=[];for(D=0,G=Z.numMorphTargets;D<G;D++)Z.__webglMorphTargetsBuffers.push(m.createBuffer())}if(Z.numMorphNormals){Z.__webglMorphNormalsBuffers=
|
|
|
-[];for(D=0,G=Z.numMorphNormals;D<G;D++)Z.__webglMorphNormalsBuffers.push(m.createBuffer())}E.info.memory.geometries++;var B=n,I=f,L=I.geometry,R=B.faces3,N=B.faces4,K=3*R.length+4*N.length,O=1*R.length+2*N.length,ha=3*R.length+4*N.length,T=c(I,B),aa=e(T),Q=d(T),$=T.vertexColors?T.vertexColors:!1;B.__vertexArray=new Float32Array(3*K);if(Q)B.__normalArray=new Float32Array(3*K);if(L.hasTangents)B.__tangentArray=new Float32Array(4*K);if($)B.__colorArray=new Float32Array(3*K);if(aa){if(0<L.faceUvs.length||
|
|
|
+THREE.Face3?r.geometryGroups[z].faces3.push(s):r.geometryGroups[z].faces4.push(s),r.geometryGroups[z].vertices+=v;r.geometryGroupsList=[];var F=void 0;for(F in r.geometryGroups)r.geometryGroups[F].id=ja++,r.geometryGroupsList.push(r.geometryGroups[F])}for(i in j.geometryGroups)if(n=j.geometryGroups[i],!n.__webglVertexBuffer){var Z=n;Z.__webglVertexBuffer=l.createBuffer();Z.__webglNormalBuffer=l.createBuffer();Z.__webglTangentBuffer=l.createBuffer();Z.__webglColorBuffer=l.createBuffer();Z.__webglUVBuffer=
|
|
|
+l.createBuffer();Z.__webglUV2Buffer=l.createBuffer();Z.__webglSkinVertexABuffer=l.createBuffer();Z.__webglSkinVertexBBuffer=l.createBuffer();Z.__webglSkinIndicesBuffer=l.createBuffer();Z.__webglSkinWeightsBuffer=l.createBuffer();Z.__webglFaceBuffer=l.createBuffer();Z.__webglLineBuffer=l.createBuffer();var D=void 0,G=void 0;if(Z.numMorphTargets){Z.__webglMorphTargetsBuffers=[];for(D=0,G=Z.numMorphTargets;D<G;D++)Z.__webglMorphTargetsBuffers.push(l.createBuffer())}if(Z.numMorphNormals){Z.__webglMorphNormalsBuffers=
|
|
|
+[];for(D=0,G=Z.numMorphNormals;D<G;D++)Z.__webglMorphNormalsBuffers.push(l.createBuffer())}E.info.memory.geometries++;var B=n,I=f,L=I.geometry,R=B.faces3,N=B.faces4,K=3*R.length+4*N.length,O=1*R.length+2*N.length,ha=3*R.length+4*N.length,T=c(I,B),aa=e(T),Q=d(T),$=T.vertexColors?T.vertexColors:!1;B.__vertexArray=new Float32Array(3*K);if(Q)B.__normalArray=new Float32Array(3*K);if(L.hasTangents)B.__tangentArray=new Float32Array(4*K);if($)B.__colorArray=new Float32Array(3*K);if(aa){if(0<L.faceUvs.length||
|
|
|
0<L.faceVertexUvs.length)B.__uvArray=new Float32Array(2*K);if(1<L.faceUvs.length||1<L.faceVertexUvs.length)B.__uv2Array=new Float32Array(2*K)}if(I.geometry.skinWeights.length&&I.geometry.skinIndices.length)B.__skinVertexAArray=new Float32Array(4*K),B.__skinVertexBArray=new Float32Array(4*K),B.__skinIndexArray=new Float32Array(4*K),B.__skinWeightArray=new Float32Array(4*K);B.__faceArray=new Uint16Array(3*O);B.__lineArray=new Uint16Array(2*ha);var da=void 0,Y=void 0;if(B.numMorphTargets){B.__morphTargetsArrays=
|
|
|
[];for(da=0,Y=B.numMorphTargets;da<Y;da++)B.__morphTargetsArrays.push(new Float32Array(3*K))}if(B.numMorphNormals){B.__morphNormalsArrays=[];for(da=0,Y=B.numMorphNormals;da<Y;da++)B.__morphNormalsArrays.push(new Float32Array(3*K))}B.__webglFaceCount=3*O;B.__webglLineCount=2*ha;if(T.attributes){if(void 0===B.__webglCustomAttributesList)B.__webglCustomAttributesList=[];var Ua=void 0;for(Ua in T.attributes){var Ia=T.attributes[Ua],oa={},Aa;for(Aa in Ia)oa[Aa]=Ia[Aa];if(!oa.__webglInitialized||oa.createUniqueBuffers){oa.__webglInitialized=
|
|
|
-!0;var ka=1;"v2"===oa.type?ka=2:"v3"===oa.type?ka=3:"v4"===oa.type?ka=4:"c"===oa.type&&(ka=3);oa.size=ka;oa.array=new Float32Array(K*ka);oa.buffer=m.createBuffer();oa.buffer.belongsToAttribute=Ua;Ia.needsUpdate=!0;oa.__original=Ia}B.__webglCustomAttributesList.push(oa)}}B.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}}}else if(f instanceof THREE.Ribbon){if(j=f.geometry,!j.__webglVertexBuffer){var ra=
|
|
|
-j;ra.__webglVertexBuffer=m.createBuffer();ra.__webglColorBuffer=m.createBuffer();E.info.memory.geometries++;var Fa=j,sa=Fa.vertices.length;Fa.__vertexArray=new Float32Array(3*sa);Fa.__colorArray=new Float32Array(3*sa);Fa.__webglVertexCount=sa;j.__dirtyVertices=!0;j.__dirtyColors=!0}}else if(f instanceof THREE.Line){if(j=f.geometry,!j.__webglVertexBuffer){var Ba=j;Ba.__webglVertexBuffer=m.createBuffer();Ba.__webglColorBuffer=m.createBuffer();E.info.memory.geometries++;var Ga=j,Oa=f,bb=Ga.vertices.length;
|
|
|
-Ga.__vertexArray=new Float32Array(3*bb);Ga.__colorArray=new Float32Array(3*bb);Ga.__webglLineCount=bb;b(Ga,Oa);j.__dirtyVertices=!0;j.__dirtyColors=!0}}else if(f instanceof THREE.ParticleSystem&&(j=f.geometry,!j.__webglVertexBuffer)){var jb=j;jb.__webglVertexBuffer=m.createBuffer();jb.__webglColorBuffer=m.createBuffer();E.info.geometries++;var Va=j,eb=f,cb=Va.vertices.length;Va.__vertexArray=new Float32Array(3*cb);Va.__colorArray=new Float32Array(3*cb);Va.__sortArray=[];Va.__webglParticleCount=cb;
|
|
|
-b(Va,eb);j.__dirtyVertices=!0;j.__dirtyColors=!0}if(!f.__webglActive){if(f instanceof THREE.Mesh)if(j=f.geometry,j instanceof THREE.BufferGeometry)k(h.__webglObjects,j,f);else for(l in j.geometryGroups)n=j.geometryGroups[l],k(h.__webglObjects,n,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(j=f.geometry,k(h.__webglObjects,j,f)):void 0!==THREE.MarchingCubes&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?h.__webglObjectsImmediate.push({object:f,
|
|
|
+!0;var ka=1;"v2"===oa.type?ka=2:"v3"===oa.type?ka=3:"v4"===oa.type?ka=4:"c"===oa.type&&(ka=3);oa.size=ka;oa.array=new Float32Array(K*ka);oa.buffer=l.createBuffer();oa.buffer.belongsToAttribute=Ua;Ia.needsUpdate=!0;oa.__original=Ia}B.__webglCustomAttributesList.push(oa)}}B.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}}}else if(f instanceof THREE.Ribbon){if(j=f.geometry,!j.__webglVertexBuffer){var ra=
|
|
|
+j;ra.__webglVertexBuffer=l.createBuffer();ra.__webglColorBuffer=l.createBuffer();E.info.memory.geometries++;var Fa=j,sa=Fa.vertices.length;Fa.__vertexArray=new Float32Array(3*sa);Fa.__colorArray=new Float32Array(3*sa);Fa.__webglVertexCount=sa;j.__dirtyVertices=!0;j.__dirtyColors=!0}}else if(f instanceof THREE.Line){if(j=f.geometry,!j.__webglVertexBuffer){var Ba=j;Ba.__webglVertexBuffer=l.createBuffer();Ba.__webglColorBuffer=l.createBuffer();E.info.memory.geometries++;var Ga=j,Oa=f,bb=Ga.vertices.length;
|
|
|
+Ga.__vertexArray=new Float32Array(3*bb);Ga.__colorArray=new Float32Array(3*bb);Ga.__webglLineCount=bb;b(Ga,Oa);j.__dirtyVertices=!0;j.__dirtyColors=!0}}else if(f instanceof THREE.ParticleSystem&&(j=f.geometry,!j.__webglVertexBuffer)){var jb=j;jb.__webglVertexBuffer=l.createBuffer();jb.__webglColorBuffer=l.createBuffer();E.info.geometries++;var Va=j,eb=f,cb=Va.vertices.length;Va.__vertexArray=new Float32Array(3*cb);Va.__colorArray=new Float32Array(3*cb);Va.__sortArray=[];Va.__webglParticleCount=cb;
|
|
|
+b(Va,eb);j.__dirtyVertices=!0;j.__dirtyColors=!0}if(!f.__webglActive){if(f instanceof THREE.Mesh)if(j=f.geometry,j instanceof THREE.BufferGeometry)k(h.__webglObjects,j,f);else for(i in j.geometryGroups)n=j.geometryGroups[i],k(h.__webglObjects,n,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(j=f.geometry,k(h.__webglObjects,j,f)):void 0!==THREE.MarchingCubes&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?h.__webglObjectsImmediate.push({object:f,
|
|
|
opaque:null,transparent:null}):f instanceof THREE.Sprite?h.__webglSprites.push(f):f instanceof THREE.LensFlare&&h.__webglFlares.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var gb=a.__objectsRemoved[0],db=a;gb instanceof THREE.Mesh||gb instanceof THREE.ParticleSystem||gb instanceof THREE.Ribbon||gb instanceof THREE.Line?o(db.__webglObjects,gb):gb instanceof THREE.Sprite?q(db.__webglSprites,gb):gb instanceof THREE.LensFlare?q(db.__webglFlares,gb):(gb instanceof
|
|
|
THREE.MarchingCubes||gb.immediateRenderCallback)&&o(db.__webglObjectsImmediate,gb);gb.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Vc=0,qd=a.__webglObjects.length;Vc<qd;Vc++){var nb=a.__webglObjects[Vc].object,ia=nb.geometry,qc=void 0,ic=void 0,Xa=void 0;if(nb instanceof THREE.Mesh)if(ia instanceof THREE.BufferGeometry)ia.__dirtyVertices=!1,ia.__dirtyElements=!1,ia.__dirtyUvs=!1,ia.__dirtyNormals=!1,ia.__dirtyColors=!1;else{for(var Wc=0,rd=ia.geometryGroupsList.length;Wc<rd;Wc++)if(qc=
|
|
|
-ia.geometryGroupsList[Wc],Xa=c(nb,qc),ic=Xa.attributes&&p(Xa),ia.__dirtyVertices||ia.__dirtyMorphTargets||ia.__dirtyElements||ia.__dirtyUvs||ia.__dirtyNormals||ia.__dirtyColors||ia.__dirtyTangents||ic){var ea=qc,sd=nb,Za=m.DYNAMIC_DRAW,td=!ia.dynamic,bc=Xa;if(ea.__inittedArrays){var fd=d(bc),Xc=bc.vertexColors?bc.vertexColors:!1,gd=e(bc),Fc=fd===THREE.SmoothShading,H=void 0,U=void 0,lb=void 0,M=void 0,jc=void 0,Ob=void 0,ob=void 0,Gc=void 0,Hb=void 0,kc=void 0,lc=void 0,V=void 0,W=void 0,X=void 0,
|
|
|
+ia.geometryGroupsList[Wc],Xa=c(nb,qc),ic=Xa.attributes&&p(Xa),ia.__dirtyVertices||ia.__dirtyMorphTargets||ia.__dirtyElements||ia.__dirtyUvs||ia.__dirtyNormals||ia.__dirtyColors||ia.__dirtyTangents||ic){var ea=qc,sd=nb,Za=l.DYNAMIC_DRAW,td=!ia.dynamic,bc=Xa;if(ea.__inittedArrays){var fd=d(bc),Xc=bc.vertexColors?bc.vertexColors:!1,gd=e(bc),Fc=fd===THREE.SmoothShading,H=void 0,U=void 0,lb=void 0,M=void 0,jc=void 0,Ob=void 0,ob=void 0,Gc=void 0,Hb=void 0,kc=void 0,lc=void 0,V=void 0,W=void 0,X=void 0,
|
|
|
pa=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,la=void 0,hd=void 0,Vb=void 0,mc=void 0,nc=void 0,La=void 0,id=void 0,Ja=void 0,Ka=void 0,Wb=void 0,Ib=void 0,Ca=0,Ha=0,Jb=0,Kb=0,hb=0,Ra=0,qa=0,Sa=0,Da=0,J=0,ca=0,A=0,$a=void 0,Ma=ea.__vertexArray,wc=ea.__uvArray,
|
|
|
xc=ea.__uv2Array,ib=ea.__normalArray,ua=ea.__tangentArray,Na=ea.__colorArray,va=ea.__skinVertexAArray,wa=ea.__skinVertexBArray,xa=ea.__skinIndexArray,ya=ea.__skinWeightArray,Yc=ea.__morphTargetsArrays,Zc=ea.__morphNormalsArrays,$c=ea.__webglCustomAttributesList,x=void 0,Eb=ea.__faceArray,ab=ea.__lineArray,Ta=sd.geometry,ud=Ta.__dirtyElements,jd=Ta.__dirtyUvs,vd=Ta.__dirtyNormals,wd=Ta.__dirtyTangents,xd=Ta.__dirtyColors,yd=Ta.__dirtyMorphTargets,cc=Ta.vertices,ma=ea.faces3,na=ea.faces4,Ea=Ta.faces,
|
|
|
ad=Ta.faceVertexUvs[0],bd=Ta.faceVertexUvs[1],dc=Ta.skinVerticesA,ec=Ta.skinVerticesB,fc=Ta.skinIndices,Xb=Ta.skinWeights,Yb=Ta.morphTargets,Jc=Ta.morphNormals;if(Ta.__dirtyVertices){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],V=cc[M.a].position,W=cc[M.b].position,X=cc[M.c].position,Ma[Ha]=V.x,Ma[Ha+1]=V.y,Ma[Ha+2]=V.z,Ma[Ha+3]=W.x,Ma[Ha+4]=W.y,Ma[Ha+5]=W.z,Ma[Ha+6]=X.x,Ma[Ha+7]=X.y,Ma[Ha+8]=X.z,Ha+=9;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],V=cc[M.a].position,W=cc[M.b].position,X=cc[M.c].position,pa=
|
|
|
-cc[M.d].position,Ma[Ha]=V.x,Ma[Ha+1]=V.y,Ma[Ha+2]=V.z,Ma[Ha+3]=W.x,Ma[Ha+4]=W.y,Ma[Ha+5]=W.z,Ma[Ha+6]=X.x,Ma[Ha+7]=X.y,Ma[Ha+8]=X.z,Ma[Ha+9]=pa.x,Ma[Ha+10]=pa.y,Ma[Ha+11]=pa.z,Ha+=12;m.bindBuffer(m.ARRAY_BUFFER,ea.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,Ma,Za)}if(yd)for(La=0,id=Yb.length;La<id;La++){ca=0;for(H=0,U=ma.length;H<U;H++){Wb=ma[H];M=Ea[Wb];V=Yb[La].vertices[M.a].position;W=Yb[La].vertices[M.b].position;X=Yb[La].vertices[M.c].position;Ja=Yc[La];Ja[ca]=V.x;Ja[ca+1]=V.y;Ja[ca+2]=
|
|
|
+cc[M.d].position,Ma[Ha]=V.x,Ma[Ha+1]=V.y,Ma[Ha+2]=V.z,Ma[Ha+3]=W.x,Ma[Ha+4]=W.y,Ma[Ha+5]=W.z,Ma[Ha+6]=X.x,Ma[Ha+7]=X.y,Ma[Ha+8]=X.z,Ma[Ha+9]=pa.x,Ma[Ha+10]=pa.y,Ma[Ha+11]=pa.z,Ha+=12;l.bindBuffer(l.ARRAY_BUFFER,ea.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Ma,Za)}if(yd)for(La=0,id=Yb.length;La<id;La++){ca=0;for(H=0,U=ma.length;H<U;H++){Wb=ma[H];M=Ea[Wb];V=Yb[La].vertices[M.a].position;W=Yb[La].vertices[M.b].position;X=Yb[La].vertices[M.c].position;Ja=Yc[La];Ja[ca]=V.x;Ja[ca+1]=V.y;Ja[ca+2]=
|
|
|
V.z;Ja[ca+3]=W.x;Ja[ca+4]=W.y;Ja[ca+5]=W.z;Ja[ca+6]=X.x;Ja[ca+7]=X.y;Ja[ca+8]=X.z;if(bc.morphNormals)Fc?(Ib=Jc[La].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c):ub=tb=sb=Jc[La].faceNormals[Wb],Ka=Zc[La],Ka[ca]=sb.x,Ka[ca+1]=sb.y,Ka[ca+2]=sb.z,Ka[ca+3]=tb.x,Ka[ca+4]=tb.y,Ka[ca+5]=tb.z,Ka[ca+6]=ub.x,Ka[ca+7]=ub.y,Ka[ca+8]=ub.z;ca+=9}for(H=0,U=na.length;H<U;H++){Wb=na[H];M=Ea[Wb];V=Yb[La].vertices[M.a].position;W=Yb[La].vertices[M.b].position;X=Yb[La].vertices[M.c].position;pa=Yb[La].vertices[M.d].position;
|
|
|
-Ja=Yc[La];Ja[ca]=V.x;Ja[ca+1]=V.y;Ja[ca+2]=V.z;Ja[ca+3]=W.x;Ja[ca+4]=W.y;Ja[ca+5]=W.z;Ja[ca+6]=X.x;Ja[ca+7]=X.y;Ja[ca+8]=X.z;Ja[ca+9]=pa.x;Ja[ca+10]=pa.y;Ja[ca+11]=pa.z;if(bc.morphNormals)Fc?(Ib=Jc[La].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c,sc=Ib.d):sc=ub=tb=sb=Jc[La].faceNormals[Wb],Ka=Zc[La],Ka[ca]=sb.x,Ka[ca+1]=sb.y,Ka[ca+2]=sb.z,Ka[ca+3]=tb.x,Ka[ca+4]=tb.y,Ka[ca+5]=tb.z,Ka[ca+6]=ub.x,Ka[ca+7]=ub.y,Ka[ca+8]=ub.z,Ka[ca+9]=sc.x,Ka[ca+10]=sc.y,Ka[ca+11]=sc.z;ca+=12}m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
-ea.__webglMorphTargetsBuffers[La]);m.bufferData(m.ARRAY_BUFFER,Yc[La],Za);bc.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,ea.__webglMorphNormalsBuffers[La]),m.bufferData(m.ARRAY_BUFFER,Zc[La],Za))}if(Xb.length){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],yb=Xb[M.a],zb=Xb[M.b],Ab=Xb[M.c],ya[J]=yb.x,ya[J+1]=yb.y,ya[J+2]=yb.z,ya[J+3]=yb.w,ya[J+4]=zb.x,ya[J+5]=zb.y,ya[J+6]=zb.z,ya[J+7]=zb.w,ya[J+8]=Ab.x,ya[J+9]=Ab.y,ya[J+10]=Ab.z,ya[J+11]=Ab.w,Bb=fc[M.a],Cb=fc[M.b],Db=fc[M.c],xa[J]=Bb.x,xa[J+1]=Bb.y,xa[J+2]=
|
|
|
+Ja=Yc[La];Ja[ca]=V.x;Ja[ca+1]=V.y;Ja[ca+2]=V.z;Ja[ca+3]=W.x;Ja[ca+4]=W.y;Ja[ca+5]=W.z;Ja[ca+6]=X.x;Ja[ca+7]=X.y;Ja[ca+8]=X.z;Ja[ca+9]=pa.x;Ja[ca+10]=pa.y;Ja[ca+11]=pa.z;if(bc.morphNormals)Fc?(Ib=Jc[La].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c,sc=Ib.d):sc=ub=tb=sb=Jc[La].faceNormals[Wb],Ka=Zc[La],Ka[ca]=sb.x,Ka[ca+1]=sb.y,Ka[ca+2]=sb.z,Ka[ca+3]=tb.x,Ka[ca+4]=tb.y,Ka[ca+5]=tb.z,Ka[ca+6]=ub.x,Ka[ca+7]=ub.y,Ka[ca+8]=ub.z,Ka[ca+9]=sc.x,Ka[ca+10]=sc.y,Ka[ca+11]=sc.z;ca+=12}l.bindBuffer(l.ARRAY_BUFFER,
|
|
|
+ea.__webglMorphTargetsBuffers[La]);l.bufferData(l.ARRAY_BUFFER,Yc[La],Za);bc.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,ea.__webglMorphNormalsBuffers[La]),l.bufferData(l.ARRAY_BUFFER,Zc[La],Za))}if(Xb.length){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],yb=Xb[M.a],zb=Xb[M.b],Ab=Xb[M.c],ya[J]=yb.x,ya[J+1]=yb.y,ya[J+2]=yb.z,ya[J+3]=yb.w,ya[J+4]=zb.x,ya[J+5]=zb.y,ya[J+6]=zb.z,ya[J+7]=zb.w,ya[J+8]=Ab.x,ya[J+9]=Ab.y,ya[J+10]=Ab.z,ya[J+11]=Ab.w,Bb=fc[M.a],Cb=fc[M.b],Db=fc[M.c],xa[J]=Bb.x,xa[J+1]=Bb.y,xa[J+2]=
|
|
|
Bb.z,xa[J+3]=Bb.w,xa[J+4]=Cb.x,xa[J+5]=Cb.y,xa[J+6]=Cb.z,xa[J+7]=Cb.w,xa[J+8]=Db.x,xa[J+9]=Db.y,xa[J+10]=Db.z,xa[J+11]=Db.w,Pb=dc[M.a],Qb=dc[M.b],Rb=dc[M.c],va[J]=Pb.x,va[J+1]=Pb.y,va[J+2]=Pb.z,va[J+3]=1,va[J+4]=Qb.x,va[J+5]=Qb.y,va[J+6]=Qb.z,va[J+7]=1,va[J+8]=Rb.x,va[J+9]=Rb.y,va[J+10]=Rb.z,va[J+11]=1,Sb=ec[M.a],Tb=ec[M.b],Ub=ec[M.c],wa[J]=Sb.x,wa[J+1]=Sb.y,wa[J+2]=Sb.z,wa[J+3]=1,wa[J+4]=Tb.x,wa[J+5]=Tb.y,wa[J+6]=Tb.z,wa[J+7]=1,wa[J+8]=Ub.x,wa[J+9]=Ub.y,wa[J+10]=Ub.z,wa[J+11]=1,J+=12;for(H=0,U=na.length;H<
|
|
|
U;H++)M=Ea[na[H]],yb=Xb[M.a],zb=Xb[M.b],Ab=Xb[M.c],uc=Xb[M.d],ya[J]=yb.x,ya[J+1]=yb.y,ya[J+2]=yb.z,ya[J+3]=yb.w,ya[J+4]=zb.x,ya[J+5]=zb.y,ya[J+6]=zb.z,ya[J+7]=zb.w,ya[J+8]=Ab.x,ya[J+9]=Ab.y,ya[J+10]=Ab.z,ya[J+11]=Ab.w,ya[J+12]=uc.x,ya[J+13]=uc.y,ya[J+14]=uc.z,ya[J+15]=uc.w,Bb=fc[M.a],Cb=fc[M.b],Db=fc[M.c],vc=fc[M.d],xa[J]=Bb.x,xa[J+1]=Bb.y,xa[J+2]=Bb.z,xa[J+3]=Bb.w,xa[J+4]=Cb.x,xa[J+5]=Cb.y,xa[J+6]=Cb.z,xa[J+7]=Cb.w,xa[J+8]=Db.x,xa[J+9]=Db.y,xa[J+10]=Db.z,xa[J+11]=Db.w,xa[J+12]=vc.x,xa[J+13]=vc.y,
|
|
|
xa[J+14]=vc.z,xa[J+15]=vc.w,Pb=dc[M.a],Qb=dc[M.b],Rb=dc[M.c],Hc=dc[M.d],va[J]=Pb.x,va[J+1]=Pb.y,va[J+2]=Pb.z,va[J+3]=1,va[J+4]=Qb.x,va[J+5]=Qb.y,va[J+6]=Qb.z,va[J+7]=1,va[J+8]=Rb.x,va[J+9]=Rb.y,va[J+10]=Rb.z,va[J+11]=1,va[J+12]=Hc.x,va[J+13]=Hc.y,va[J+14]=Hc.z,va[J+15]=1,Sb=ec[M.a],Tb=ec[M.b],Ub=ec[M.c],Ic=ec[M.d],wa[J]=Sb.x,wa[J+1]=Sb.y,wa[J+2]=Sb.z,wa[J+3]=1,wa[J+4]=Tb.x,wa[J+5]=Tb.y,wa[J+6]=Tb.z,wa[J+7]=1,wa[J+8]=Ub.x,wa[J+9]=Ub.y,wa[J+10]=Ub.z,wa[J+11]=1,wa[J+12]=Ic.x,wa[J+13]=Ic.y,wa[J+14]=Ic.z,
|
|
|
-wa[J+15]=1,J+=16;0<J&&(m.bindBuffer(m.ARRAY_BUFFER,ea.__webglSkinVertexABuffer),m.bufferData(m.ARRAY_BUFFER,va,Za),m.bindBuffer(m.ARRAY_BUFFER,ea.__webglSkinVertexBBuffer),m.bufferData(m.ARRAY_BUFFER,wa,Za),m.bindBuffer(m.ARRAY_BUFFER,ea.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,xa,Za),m.bindBuffer(m.ARRAY_BUFFER,ea.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,ya,Za))}if(xd&&Xc){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],ob=M.vertexColors,Gc=M.color,3===ob.length&&Xc===THREE.VertexColors?
|
|
|
+wa[J+15]=1,J+=16;0<J&&(l.bindBuffer(l.ARRAY_BUFFER,ea.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,va,Za),l.bindBuffer(l.ARRAY_BUFFER,ea.__webglSkinVertexBBuffer),l.bufferData(l.ARRAY_BUFFER,wa,Za),l.bindBuffer(l.ARRAY_BUFFER,ea.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,xa,Za),l.bindBuffer(l.ARRAY_BUFFER,ea.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,ya,Za))}if(xd&&Xc){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],ob=M.vertexColors,Gc=M.color,3===ob.length&&Xc===THREE.VertexColors?
|
|
|
(vb=ob[0],wb=ob[1],xb=ob[2]):xb=wb=vb=Gc,Na[Da]=vb.r,Na[Da+1]=vb.g,Na[Da+2]=vb.b,Na[Da+3]=wb.r,Na[Da+4]=wb.g,Na[Da+5]=wb.b,Na[Da+6]=xb.r,Na[Da+7]=xb.g,Na[Da+8]=xb.b,Da+=9;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],ob=M.vertexColors,Gc=M.color,4===ob.length&&Xc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2],tc=ob[3]):tc=xb=wb=vb=Gc,Na[Da]=vb.r,Na[Da+1]=vb.g,Na[Da+2]=vb.b,Na[Da+3]=wb.r,Na[Da+4]=wb.g,Na[Da+5]=wb.b,Na[Da+6]=xb.r,Na[Da+7]=xb.g,Na[Da+8]=xb.b,Na[Da+9]=tc.r,Na[Da+10]=tc.g,Na[Da+11]=tc.b,Da+=
|
|
|
-12;0<Da&&(m.bindBuffer(m.ARRAY_BUFFER,ea.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,Na,Za))}if(wd&&Ta.hasTangents){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],Hb=M.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],ua[qa]=pb.x,ua[qa+1]=pb.y,ua[qa+2]=pb.z,ua[qa+3]=pb.w,ua[qa+4]=qb.x,ua[qa+5]=qb.y,ua[qa+6]=qb.z,ua[qa+7]=qb.w,ua[qa+8]=rb.x,ua[qa+9]=rb.y,ua[qa+10]=rb.z,ua[qa+11]=rb.w,qa+=12;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],Hb=M.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],rc=Hb[3],ua[qa]=pb.x,ua[qa+1]=pb.y,
|
|
|
-ua[qa+2]=pb.z,ua[qa+3]=pb.w,ua[qa+4]=qb.x,ua[qa+5]=qb.y,ua[qa+6]=qb.z,ua[qa+7]=qb.w,ua[qa+8]=rb.x,ua[qa+9]=rb.y,ua[qa+10]=rb.z,ua[qa+11]=rb.w,ua[qa+12]=rc.x,ua[qa+13]=rc.y,ua[qa+14]=rc.z,ua[qa+15]=rc.w,qa+=16;m.bindBuffer(m.ARRAY_BUFFER,ea.__webglTangentBuffer);m.bufferData(m.ARRAY_BUFFER,ua,Za)}if(vd&&fd){for(H=0,U=ma.length;H<U;H++)if(M=Ea[ma[H]],jc=M.vertexNormals,Ob=M.normal,3===jc.length&&Fc)for(la=0;3>la;la++)Vb=jc[la],ib[Ra]=Vb.x,ib[Ra+1]=Vb.y,ib[Ra+2]=Vb.z,Ra+=3;else for(la=0;3>la;la++)ib[Ra]=
|
|
|
-Ob.x,ib[Ra+1]=Ob.y,ib[Ra+2]=Ob.z,Ra+=3;for(H=0,U=na.length;H<U;H++)if(M=Ea[na[H]],jc=M.vertexNormals,Ob=M.normal,4===jc.length&&Fc)for(la=0;4>la;la++)Vb=jc[la],ib[Ra]=Vb.x,ib[Ra+1]=Vb.y,ib[Ra+2]=Vb.z,Ra+=3;else for(la=0;4>la;la++)ib[Ra]=Ob.x,ib[Ra+1]=Ob.y,ib[Ra+2]=Ob.z,Ra+=3;m.bindBuffer(m.ARRAY_BUFFER,ea.__webglNormalBuffer);m.bufferData(m.ARRAY_BUFFER,ib,Za)}if(jd&&ad&&gd){for(H=0,U=ma.length;H<U;H++)if(lb=ma[H],M=Ea[lb],kc=ad[lb],void 0!==kc)for(la=0;3>la;la++)mc=kc[la],wc[Jb]=mc.u,wc[Jb+1]=mc.v,
|
|
|
-Jb+=2;for(H=0,U=na.length;H<U;H++)if(lb=na[H],M=Ea[lb],kc=ad[lb],void 0!==kc)for(la=0;4>la;la++)mc=kc[la],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;0<Jb&&(m.bindBuffer(m.ARRAY_BUFFER,ea.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,wc,Za))}if(jd&&bd&&gd){for(H=0,U=ma.length;H<U;H++)if(lb=ma[H],M=Ea[lb],lc=bd[lb],void 0!==lc)for(la=0;3>la;la++)nc=lc[la],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;for(H=0,U=na.length;H<U;H++)if(lb=na[H],M=Ea[lb],lc=bd[lb],void 0!==lc)for(la=0;4>la;la++)nc=lc[la],xc[Kb]=nc.u,xc[Kb+1]=nc.v,
|
|
|
-Kb+=2;0<Kb&&(m.bindBuffer(m.ARRAY_BUFFER,ea.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,xc,Za))}if(ud){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],Eb[hb]=Ca,Eb[hb+1]=Ca+1,Eb[hb+2]=Ca+2,hb+=3,ab[Sa]=Ca,ab[Sa+1]=Ca+1,ab[Sa+2]=Ca,ab[Sa+3]=Ca+2,ab[Sa+4]=Ca+1,ab[Sa+5]=Ca+2,Sa+=6,Ca+=3;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],Eb[hb]=Ca,Eb[hb+1]=Ca+1,Eb[hb+2]=Ca+3,Eb[hb+3]=Ca+1,Eb[hb+4]=Ca+2,Eb[hb+5]=Ca+3,hb+=6,ab[Sa]=Ca,ab[Sa+1]=Ca+1,ab[Sa+2]=Ca,ab[Sa+3]=Ca+3,ab[Sa+4]=Ca+1,ab[Sa+5]=Ca+2,ab[Sa+6]=Ca+2,ab[Sa+
|
|
|
-7]=Ca+3,Sa+=8,Ca+=4;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,ea.__webglFaceBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,Eb,Za);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,ea.__webglLineBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,ab,Za)}if($c)for(la=0,hd=$c.length;la<hd;la++)if(x=$c[la],x.__original.needsUpdate){A=0;if(1===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],x.array[A]=x.value[M.a],x.array[A+1]=x.value[M.b],x.array[A+2]=x.value[M.c],A+=3;for(H=0,U=na.length;H<
|
|
|
+12;0<Da&&(l.bindBuffer(l.ARRAY_BUFFER,ea.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,Na,Za))}if(wd&&Ta.hasTangents){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],Hb=M.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],ua[qa]=pb.x,ua[qa+1]=pb.y,ua[qa+2]=pb.z,ua[qa+3]=pb.w,ua[qa+4]=qb.x,ua[qa+5]=qb.y,ua[qa+6]=qb.z,ua[qa+7]=qb.w,ua[qa+8]=rb.x,ua[qa+9]=rb.y,ua[qa+10]=rb.z,ua[qa+11]=rb.w,qa+=12;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],Hb=M.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],rc=Hb[3],ua[qa]=pb.x,ua[qa+1]=pb.y,
|
|
|
+ua[qa+2]=pb.z,ua[qa+3]=pb.w,ua[qa+4]=qb.x,ua[qa+5]=qb.y,ua[qa+6]=qb.z,ua[qa+7]=qb.w,ua[qa+8]=rb.x,ua[qa+9]=rb.y,ua[qa+10]=rb.z,ua[qa+11]=rb.w,ua[qa+12]=rc.x,ua[qa+13]=rc.y,ua[qa+14]=rc.z,ua[qa+15]=rc.w,qa+=16;l.bindBuffer(l.ARRAY_BUFFER,ea.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,ua,Za)}if(vd&&fd){for(H=0,U=ma.length;H<U;H++)if(M=Ea[ma[H]],jc=M.vertexNormals,Ob=M.normal,3===jc.length&&Fc)for(la=0;3>la;la++)Vb=jc[la],ib[Ra]=Vb.x,ib[Ra+1]=Vb.y,ib[Ra+2]=Vb.z,Ra+=3;else for(la=0;3>la;la++)ib[Ra]=
|
|
|
+Ob.x,ib[Ra+1]=Ob.y,ib[Ra+2]=Ob.z,Ra+=3;for(H=0,U=na.length;H<U;H++)if(M=Ea[na[H]],jc=M.vertexNormals,Ob=M.normal,4===jc.length&&Fc)for(la=0;4>la;la++)Vb=jc[la],ib[Ra]=Vb.x,ib[Ra+1]=Vb.y,ib[Ra+2]=Vb.z,Ra+=3;else for(la=0;4>la;la++)ib[Ra]=Ob.x,ib[Ra+1]=Ob.y,ib[Ra+2]=Ob.z,Ra+=3;l.bindBuffer(l.ARRAY_BUFFER,ea.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,ib,Za)}if(jd&&ad&&gd){for(H=0,U=ma.length;H<U;H++)if(lb=ma[H],M=Ea[lb],kc=ad[lb],void 0!==kc)for(la=0;3>la;la++)mc=kc[la],wc[Jb]=mc.u,wc[Jb+1]=mc.v,
|
|
|
+Jb+=2;for(H=0,U=na.length;H<U;H++)if(lb=na[H],M=Ea[lb],kc=ad[lb],void 0!==kc)for(la=0;4>la;la++)mc=kc[la],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;0<Jb&&(l.bindBuffer(l.ARRAY_BUFFER,ea.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,wc,Za))}if(jd&&bd&&gd){for(H=0,U=ma.length;H<U;H++)if(lb=ma[H],M=Ea[lb],lc=bd[lb],void 0!==lc)for(la=0;3>la;la++)nc=lc[la],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;for(H=0,U=na.length;H<U;H++)if(lb=na[H],M=Ea[lb],lc=bd[lb],void 0!==lc)for(la=0;4>la;la++)nc=lc[la],xc[Kb]=nc.u,xc[Kb+1]=nc.v,
|
|
|
+Kb+=2;0<Kb&&(l.bindBuffer(l.ARRAY_BUFFER,ea.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,xc,Za))}if(ud){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],Eb[hb]=Ca,Eb[hb+1]=Ca+1,Eb[hb+2]=Ca+2,hb+=3,ab[Sa]=Ca,ab[Sa+1]=Ca+1,ab[Sa+2]=Ca,ab[Sa+3]=Ca+2,ab[Sa+4]=Ca+1,ab[Sa+5]=Ca+2,Sa+=6,Ca+=3;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],Eb[hb]=Ca,Eb[hb+1]=Ca+1,Eb[hb+2]=Ca+3,Eb[hb+3]=Ca+1,Eb[hb+4]=Ca+2,Eb[hb+5]=Ca+3,hb+=6,ab[Sa]=Ca,ab[Sa+1]=Ca+1,ab[Sa+2]=Ca,ab[Sa+3]=Ca+3,ab[Sa+4]=Ca+1,ab[Sa+5]=Ca+2,ab[Sa+6]=Ca+2,ab[Sa+
|
|
|
+7]=Ca+3,Sa+=8,Ca+=4;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,ea.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,Eb,Za);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,ea.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,ab,Za)}if($c)for(la=0,hd=$c.length;la<hd;la++)if(x=$c[la],x.__original.needsUpdate){A=0;if(1===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],x.array[A]=x.value[M.a],x.array[A+1]=x.value[M.b],x.array[A+2]=x.value[M.c],A+=3;for(H=0,U=na.length;H<
|
|
|
U;H++)M=Ea[na[H]],x.array[A]=x.value[M.a],x.array[A+1]=x.value[M.b],x.array[A+2]=x.value[M.c],x.array[A+3]=x.value[M.d],A+=4}else{if("faces"===x.boundTo){for(H=0,U=ma.length;H<U;H++)$a=x.value[ma[H]],x.array[A]=$a,x.array[A+1]=$a,x.array[A+2]=$a,A+=3;for(H=0,U=na.length;H<U;H++)$a=x.value[na[H]],x.array[A]=$a,x.array[A+1]=$a,x.array[A+2]=$a,x.array[A+3]=$a,A+=4}}else if(2===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],V=x.value[M.a],W=x.value[M.b],
|
|
|
X=x.value[M.c],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=W.x,x.array[A+3]=W.y,x.array[A+4]=X.x,x.array[A+5]=X.y,A+=6;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],pa=x.value[M.d],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=W.x,x.array[A+3]=W.y,x.array[A+4]=X.x,x.array[A+5]=X.y,x.array[A+6]=pa.x,x.array[A+7]=pa.y,A+=8}else{if("faces"===x.boundTo){for(H=0,U=ma.length;H<U;H++)X=W=V=$a=x.value[ma[H]],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=W.x,x.array[A+
|
|
|
-3]=W.y,x.array[A+4]=X.x,x.array[A+5]=X.y,A+=6;for(H=0,U=na.length;H<U;H++)pa=X=W=V=$a=x.value[na[H]],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=W.x,x.array[A+3]=W.y,x.array[A+4]=X.x,x.array[A+5]=X.y,x.array[A+6]=pa.x,x.array[A+7]=pa.y,A+=8}}else if(3===x.size){var fa;fa="c"===x.type?["r","g","b"]:["x","y","z"];if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],x.array[A]=V[fa[0]],x.array[A+1]=V[fa[1]],x.array[A+2]=
|
|
|
-V[fa[2]],x.array[A+3]=W[fa[0]],x.array[A+4]=W[fa[1]],x.array[A+5]=W[fa[2]],x.array[A+6]=X[fa[0]],x.array[A+7]=X[fa[1]],x.array[A+8]=X[fa[2]],A+=9;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],pa=x.value[M.d],x.array[A]=V[fa[0]],x.array[A+1]=V[fa[1]],x.array[A+2]=V[fa[2]],x.array[A+3]=W[fa[0]],x.array[A+4]=W[fa[1]],x.array[A+5]=W[fa[2]],x.array[A+6]=X[fa[0]],x.array[A+7]=X[fa[1]],x.array[A+8]=X[fa[2]],x.array[A+9]=pa[fa[0]],x.array[A+10]=pa[fa[1]],x.array[A+11]=
|
|
|
-pa[fa[2]],A+=12}else if("faces"===x.boundTo){for(H=0,U=ma.length;H<U;H++)X=W=V=$a=x.value[ma[H]],x.array[A]=V[fa[0]],x.array[A+1]=V[fa[1]],x.array[A+2]=V[fa[2]],x.array[A+3]=W[fa[0]],x.array[A+4]=W[fa[1]],x.array[A+5]=W[fa[2]],x.array[A+6]=X[fa[0]],x.array[A+7]=X[fa[1]],x.array[A+8]=X[fa[2]],A+=9;for(H=0,U=na.length;H<U;H++)pa=X=W=V=$a=x.value[na[H]],x.array[A]=V[fa[0]],x.array[A+1]=V[fa[1]],x.array[A+2]=V[fa[2]],x.array[A+3]=W[fa[0]],x.array[A+4]=W[fa[1]],x.array[A+5]=W[fa[2]],x.array[A+6]=X[fa[0]],
|
|
|
-x.array[A+7]=X[fa[1]],x.array[A+8]=X[fa[2]],x.array[A+9]=pa[fa[0]],x.array[A+10]=pa[fa[1]],x.array[A+11]=pa[fa[2]],A+=12}}else if(4===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=V.z,x.array[A+3]=V.w,x.array[A+4]=W.x,x.array[A+5]=W.y,x.array[A+6]=W.z,x.array[A+7]=W.w,x.array[A+8]=X.x,x.array[A+9]=X.y,x.array[A+10]=X.z,x.array[A+11]=X.w,A+=12;for(H=0,U=na.length;H<
|
|
|
+3]=W.y,x.array[A+4]=X.x,x.array[A+5]=X.y,A+=6;for(H=0,U=na.length;H<U;H++)pa=X=W=V=$a=x.value[na[H]],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=W.x,x.array[A+3]=W.y,x.array[A+4]=X.x,x.array[A+5]=X.y,x.array[A+6]=pa.x,x.array[A+7]=pa.y,A+=8}}else if(3===x.size){var ga;ga="c"===x.type?["r","g","b"]:["x","y","z"];if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],x.array[A]=V[ga[0]],x.array[A+1]=V[ga[1]],x.array[A+2]=
|
|
|
+V[ga[2]],x.array[A+3]=W[ga[0]],x.array[A+4]=W[ga[1]],x.array[A+5]=W[ga[2]],x.array[A+6]=X[ga[0]],x.array[A+7]=X[ga[1]],x.array[A+8]=X[ga[2]],A+=9;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],pa=x.value[M.d],x.array[A]=V[ga[0]],x.array[A+1]=V[ga[1]],x.array[A+2]=V[ga[2]],x.array[A+3]=W[ga[0]],x.array[A+4]=W[ga[1]],x.array[A+5]=W[ga[2]],x.array[A+6]=X[ga[0]],x.array[A+7]=X[ga[1]],x.array[A+8]=X[ga[2]],x.array[A+9]=pa[ga[0]],x.array[A+10]=pa[ga[1]],x.array[A+11]=
|
|
|
+pa[ga[2]],A+=12}else if("faces"===x.boundTo){for(H=0,U=ma.length;H<U;H++)X=W=V=$a=x.value[ma[H]],x.array[A]=V[ga[0]],x.array[A+1]=V[ga[1]],x.array[A+2]=V[ga[2]],x.array[A+3]=W[ga[0]],x.array[A+4]=W[ga[1]],x.array[A+5]=W[ga[2]],x.array[A+6]=X[ga[0]],x.array[A+7]=X[ga[1]],x.array[A+8]=X[ga[2]],A+=9;for(H=0,U=na.length;H<U;H++)pa=X=W=V=$a=x.value[na[H]],x.array[A]=V[ga[0]],x.array[A+1]=V[ga[1]],x.array[A+2]=V[ga[2]],x.array[A+3]=W[ga[0]],x.array[A+4]=W[ga[1]],x.array[A+5]=W[ga[2]],x.array[A+6]=X[ga[0]],
|
|
|
+x.array[A+7]=X[ga[1]],x.array[A+8]=X[ga[2]],x.array[A+9]=pa[ga[0]],x.array[A+10]=pa[ga[1]],x.array[A+11]=pa[ga[2]],A+=12}}else if(4===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=V.z,x.array[A+3]=V.w,x.array[A+4]=W.x,x.array[A+5]=W.y,x.array[A+6]=W.z,x.array[A+7]=W.w,x.array[A+8]=X.x,x.array[A+9]=X.y,x.array[A+10]=X.z,x.array[A+11]=X.w,A+=12;for(H=0,U=na.length;H<
|
|
|
U;H++)M=Ea[na[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],pa=x.value[M.d],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=V.z,x.array[A+3]=V.w,x.array[A+4]=W.x,x.array[A+5]=W.y,x.array[A+6]=W.z,x.array[A+7]=W.w,x.array[A+8]=X.x,x.array[A+9]=X.y,x.array[A+10]=X.z,x.array[A+11]=X.w,x.array[A+12]=pa.x,x.array[A+13]=pa.y,x.array[A+14]=pa.z,x.array[A+15]=pa.w,A+=16}else if("faces"===x.boundTo){for(H=0,U=ma.length;H<U;H++)X=W=V=$a=x.value[ma[H]],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=V.z,x.array[A+
|
|
|
-3]=V.w,x.array[A+4]=W.x,x.array[A+5]=W.y,x.array[A+6]=W.z,x.array[A+7]=W.w,x.array[A+8]=X.x,x.array[A+9]=X.y,x.array[A+10]=X.z,x.array[A+11]=X.w,A+=12;for(H=0,U=na.length;H<U;H++)pa=X=W=V=$a=x.value[na[H]],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=V.z,x.array[A+3]=V.w,x.array[A+4]=W.x,x.array[A+5]=W.y,x.array[A+6]=W.z,x.array[A+7]=W.w,x.array[A+8]=X.x,x.array[A+9]=X.y,x.array[A+10]=X.z,x.array[A+11]=X.w,x.array[A+12]=pa.x,x.array[A+13]=pa.y,x.array[A+14]=pa.z,x.array[A+15]=pa.w,A+=16}m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
-x.buffer);m.bufferData(m.ARRAY_BUFFER,x.array,Za)}td&&(delete ea.__inittedArrays,delete ea.__colorArray,delete ea.__normalArray,delete ea.__tangentArray,delete ea.__uvArray,delete ea.__uv2Array,delete ea.__faceArray,delete ea.__vertexArray,delete ea.__lineArray,delete ea.__skinVertexAArray,delete ea.__skinVertexBArray,delete ea.__skinIndexArray,delete ea.__skinWeightArray)}}ia.__dirtyVertices=!1;ia.__dirtyMorphTargets=!1;ia.__dirtyElements=!1;ia.__dirtyUvs=!1;ia.__dirtyNormals=!1;ia.__dirtyColors=
|
|
|
-!1;ia.__dirtyTangents=!1;Xa.attributes&&i(Xa)}else if(nb instanceof THREE.Ribbon){if(ia.__dirtyVertices||ia.__dirtyColors){var Zb=ia,kd=m.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=void 0,$b=void 0,Lc=void 0,ld=Zb.vertices,md=Zb.colors,zd=ld.length,Ad=md.length,Mc=Zb.__vertexArray,Nc=Zb.__colorArray,Bd=Zb.__dirtyColors;if(Zb.__dirtyVertices){for(yc=0;yc<zd;yc++)Kc=ld[yc].position,$b=3*yc,Mc[$b]=Kc.x,Mc[$b+1]=Kc.y,Mc[$b+2]=Kc.z;m.bindBuffer(m.ARRAY_BUFFER,Zb.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,
|
|
|
-Mc,kd)}if(Bd){for(zc=0;zc<Ad;zc++)Lc=md[zc],$b=3*zc,Nc[$b]=Lc.r,Nc[$b+1]=Lc.g,Nc[$b+2]=Lc.b;m.bindBuffer(m.ARRAY_BUFFER,Zb.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,Nc,kd)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1}else if(nb instanceof THREE.Line){Xa=c(nb,qc);ic=Xa.attributes&&p(Xa);if(ia.__dirtyVertices||ia.__dirtyColors||ic){var Lb=ia,cd=m.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,za=void 0,Pc=void 0,nd=Lb.vertices,od=Lb.colors,Cd=nd.length,Dd=od.length,Qc=Lb.__vertexArray,Rc=Lb.__colorArray,
|
|
|
-Ed=Lb.__dirtyColors,dd=Lb.__webglCustomAttributesList,Sc=void 0,pd=void 0,Qa=void 0,oc=void 0,Ya=void 0,ta=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<Cd;Ac++)Oc=nd[Ac].position,za=3*Ac,Qc[za]=Oc.x,Qc[za+1]=Oc.y,Qc[za+2]=Oc.z;m.bindBuffer(m.ARRAY_BUFFER,Lb.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,Qc,cd)}if(Ed){for(Bc=0;Bc<Dd;Bc++)Pc=od[Bc],za=3*Bc,Rc[za]=Pc.r,Rc[za+1]=Pc.g,Rc[za+2]=Pc.b;m.bindBuffer(m.ARRAY_BUFFER,Lb.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,Rc,cd)}if(dd)for(Sc=0,pd=dd.length;Sc<
|
|
|
+3]=V.w,x.array[A+4]=W.x,x.array[A+5]=W.y,x.array[A+6]=W.z,x.array[A+7]=W.w,x.array[A+8]=X.x,x.array[A+9]=X.y,x.array[A+10]=X.z,x.array[A+11]=X.w,A+=12;for(H=0,U=na.length;H<U;H++)pa=X=W=V=$a=x.value[na[H]],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=V.z,x.array[A+3]=V.w,x.array[A+4]=W.x,x.array[A+5]=W.y,x.array[A+6]=W.z,x.array[A+7]=W.w,x.array[A+8]=X.x,x.array[A+9]=X.y,x.array[A+10]=X.z,x.array[A+11]=X.w,x.array[A+12]=pa.x,x.array[A+13]=pa.y,x.array[A+14]=pa.z,x.array[A+15]=pa.w,A+=16}l.bindBuffer(l.ARRAY_BUFFER,
|
|
|
+x.buffer);l.bufferData(l.ARRAY_BUFFER,x.array,Za)}td&&(delete ea.__inittedArrays,delete ea.__colorArray,delete ea.__normalArray,delete ea.__tangentArray,delete ea.__uvArray,delete ea.__uv2Array,delete ea.__faceArray,delete ea.__vertexArray,delete ea.__lineArray,delete ea.__skinVertexAArray,delete ea.__skinVertexBArray,delete ea.__skinIndexArray,delete ea.__skinWeightArray)}}ia.__dirtyVertices=!1;ia.__dirtyMorphTargets=!1;ia.__dirtyElements=!1;ia.__dirtyUvs=!1;ia.__dirtyNormals=!1;ia.__dirtyColors=
|
|
|
+!1;ia.__dirtyTangents=!1;Xa.attributes&&m(Xa)}else if(nb instanceof THREE.Ribbon){if(ia.__dirtyVertices||ia.__dirtyColors){var Zb=ia,kd=l.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=void 0,$b=void 0,Lc=void 0,ld=Zb.vertices,md=Zb.colors,zd=ld.length,Ad=md.length,Mc=Zb.__vertexArray,Nc=Zb.__colorArray,Bd=Zb.__dirtyColors;if(Zb.__dirtyVertices){for(yc=0;yc<zd;yc++)Kc=ld[yc].position,$b=3*yc,Mc[$b]=Kc.x,Mc[$b+1]=Kc.y,Mc[$b+2]=Kc.z;l.bindBuffer(l.ARRAY_BUFFER,Zb.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,
|
|
|
+Mc,kd)}if(Bd){for(zc=0;zc<Ad;zc++)Lc=md[zc],$b=3*zc,Nc[$b]=Lc.r,Nc[$b+1]=Lc.g,Nc[$b+2]=Lc.b;l.bindBuffer(l.ARRAY_BUFFER,Zb.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,Nc,kd)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1}else if(nb instanceof THREE.Line){Xa=c(nb,qc);ic=Xa.attributes&&p(Xa);if(ia.__dirtyVertices||ia.__dirtyColors||ic){var Lb=ia,cd=l.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,za=void 0,Pc=void 0,nd=Lb.vertices,od=Lb.colors,Cd=nd.length,Dd=od.length,Qc=Lb.__vertexArray,Rc=Lb.__colorArray,
|
|
|
+Ed=Lb.__dirtyColors,dd=Lb.__webglCustomAttributesList,Sc=void 0,pd=void 0,Qa=void 0,oc=void 0,Ya=void 0,ta=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<Cd;Ac++)Oc=nd[Ac].position,za=3*Ac,Qc[za]=Oc.x,Qc[za+1]=Oc.y,Qc[za+2]=Oc.z;l.bindBuffer(l.ARRAY_BUFFER,Lb.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Qc,cd)}if(Ed){for(Bc=0;Bc<Dd;Bc++)Pc=od[Bc],za=3*Bc,Rc[za]=Pc.r,Rc[za+1]=Pc.g,Rc[za+2]=Pc.b;l.bindBuffer(l.ARRAY_BUFFER,Lb.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,Rc,cd)}if(dd)for(Sc=0,pd=dd.length;Sc<
|
|
|
pd;Sc++)if(ta=dd[Sc],ta.needsUpdate&&(void 0===ta.boundTo||"vertices"===ta.boundTo)){za=0;oc=ta.value.length;if(1===ta.size)for(Qa=0;Qa<oc;Qa++)ta.array[Qa]=ta.value[Qa];else if(2===ta.size)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,za+=2;else if(3===ta.size)if("c"===ta.type)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.r,ta.array[za+1]=Ya.g,ta.array[za+2]=Ya.b,za+=3;else for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,ta.array[za+2]=
|
|
|
-Ya.z,za+=3;else if(4===ta.size)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,ta.array[za+2]=Ya.z,ta.array[za+3]=Ya.w,za+=4;m.bindBuffer(m.ARRAY_BUFFER,ta.buffer);m.bufferData(m.ARRAY_BUFFER,ta.array,cd)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1;Xa.attributes&&i(Xa)}else if(nb instanceof THREE.ParticleSystem)Xa=c(nb,qc),ic=Xa.attributes&&p(Xa),(ia.__dirtyVertices||ia.__dirtyColors||nb.sortParticles||ic)&&g(ia,m.DYNAMIC_DRAW,nb),ia.__dirtyVertices=!1,ia.__dirtyColors=!1,
|
|
|
-Xa.attributes&&i(Xa)}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);
|
|
|
-a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var l,k;f=j=0;for(l=0,k=b.length;l<k;l++)e=b[l],e.onlyShadow||(e instanceof THREE.DirectionalLight&&f++,e instanceof THREE.PointLight&&j++,e instanceof THREE.SpotLight&&j++);j+f<=N?l=f:(l=Math.ceil(N*f/(j+f)),j=N-l);e=l;f=j;var n=0;for(j=0,l=b.length;j<l;j++)k=b[j],k.castShadow&&(k instanceof THREE.SpotLight&&n++,k instanceof THREE.DirectionalLight&&!k.shadowCascade&&n++);var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;
|
|
|
-var p;a:{l=a.fragmentShader;k=a.vertexShader;var j=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:e,maxPointLights:f,maxBones:o,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=[];i?d.push(i):(d.push(l),d.push(k));for(q in c)d.push(q),d.push(c[q]);i=d.join();for(q=0,d=Y.length;q<d;q++)if(Y[q].code===i){p=Y[q].program;break a}q=m.createProgram();d=[0<Oa?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
|
|
|
+Ya.z,za+=3;else if(4===ta.size)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,ta.array[za+2]=Ya.z,ta.array[za+3]=Ya.w,za+=4;l.bindBuffer(l.ARRAY_BUFFER,ta.buffer);l.bufferData(l.ARRAY_BUFFER,ta.array,cd)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1;Xa.attributes&&m(Xa)}else if(nb instanceof THREE.ParticleSystem)Xa=c(nb,qc),ic=Xa.attributes&&p(Xa),(ia.__dirtyVertices||ia.__dirtyColors||nb.sortParticles||ic)&&g(ia,l.DYNAMIC_DRAW,nb),ia.__dirtyVertices=!1,ia.__dirtyColors=!1,
|
|
|
+Xa.attributes&&m(Xa)}};this.initMaterial=function(a,b,c,d){var e,g,f,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);
|
|
|
+a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var m,k;g=j=0;for(m=0,k=b.length;m<k;m++)e=b[m],e.onlyShadow||(e instanceof THREE.DirectionalLight&&g++,e instanceof THREE.PointLight&&j++,e instanceof THREE.SpotLight&&j++);j+g<=N?m=g:(m=Math.ceil(N*g/(j+g)),j=N-m);e=m;g=j;var n=0;for(j=0,m=b.length;j<m;j++)k=b[j],k.castShadow&&(k instanceof THREE.SpotLight&&n++,k instanceof THREE.DirectionalLight&&!k.shadowCascade&&n++);var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;
|
|
|
+var p;a:{m=a.fragmentShader;k=a.vertexShader;var j=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:e,maxPointLights:g,maxBones:o,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=[];i?d.push(i):(d.push(m),d.push(k));for(q in c)d.push(q),d.push(c[q]);i=d.join();for(q=0,d=Y.length;q<d;q++)if(Y[q].code===i){p=Y[q].program;break a}q=l.createProgram();d=[0<Oa?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
|
|
|
"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.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");
|
|
|
e=["precision "+D+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
|
|
|
-"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.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");m.attachShader(q,t("fragment",e+l));
|
|
|
-m.attachShader(q,t("vertex",d+k));m.linkProgram(q);m.getProgramParameter(q,m.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(q,m.VALIDATE_STATUS)+", gl error ["+m.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in j)d.push(r);r=d;for(d=0,j=r.length;d<j;d++)l=r[d],q.uniforms[l]=m.getUniformLocation(q,
|
|
|
-l);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(r=0;r<c.maxMorphNormals;r++)d.push("morphNormal"+r);for(p in b)d.push(p);p=d;for(r=0,b=p.length;r<b;r++)c=p[r],q.attributes[c]=m.getAttribLocation(q,c);q.id=Y.length;Y.push({program:q,code:i});E.info.memory.programs=Y.length;p=q}a.program=p;p=a.program.attributes;0<=p.position&&m.enableVertexAttribArray(p.position);0<=p.color&&m.enableVertexAttribArray(p.color);
|
|
|
-0<=p.normal&&m.enableVertexAttribArray(p.normal);0<=p.tangent&&m.enableVertexAttribArray(p.tangent);a.skinning&&0<=p.skinVertexA&&0<=p.skinVertexB&&0<=p.skinIndex&&0<=p.skinWeight&&(m.enableVertexAttribArray(p.skinVertexA),m.enableVertexAttribArray(p.skinVertexB),m.enableVertexAttribArray(p.skinIndex),m.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==p[h]&&0<=p[h]&&m.enableVertexAttribArray(p[h]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";
|
|
|
-for(h=0;h<this.maxMorphTargets;h++)r=q+h,0<=p[r]&&(m.enableVertexAttribArray(p[r]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(h=0;h<this.maxMorphNormals;h++)r=q+h,0<=p[r]&&(m.enableVertexAttribArray(p[r]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?m.frontFace(m.CCW):m.frontFace(m.CW),"back"===a?m.cullFace(m.BACK):"front"===a?m.cullFace(m.FRONT):
|
|
|
-m.cullFace(m.FRONT_AND_BACK),m.enable(m.CULL_FACE)):m.disable(m.CULL_FACE)};this.setObjectFaces=function(a){if(ha!==a.doubleSided)a.doubleSided?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),ha=a.doubleSided;if(R!==a.flipSided)a.flipSided?m.frontFace(m.CW):m.frontFace(m.CCW),R=a.flipSided};this.setDepthTest=function(a){T!==a&&(a?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),T=a)};this.setDepthWrite=function(a){aa!==a&&(m.depthMask(a),aa=a)};this.setBlending=function(a){if(a!==$){switch(a){case THREE.NoBlending:m.disable(m.BLEND);
|
|
|
-break;case THREE.AdditiveBlending:m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.enable(m.BLEND),m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}$=
|
|
|
-a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=m.createTexture(),E.info.memory.textures++;m.activeTexture(m.TEXTURE0+b);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=z(a.format),f=z(a.type);w(m.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?m.texImage2D(m.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):m.texImage2D(m.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&m.generateMipmap(m.TEXTURE_2D);
|
|
|
-a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else m.activeTexture(m.TEXTURE0+b),m.bindTexture(m.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=m.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=z(a.format),e=z(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,
|
|
|
-a.__webglTexture);w(m.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=m.createFramebuffer();a.__webglRenderbuffer[c]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,0,d,e,null);var f=a,g=m.TEXTURE_CUBE_MAP_POSITIVE_X+c;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[c]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,g,f.__webglTexture,0);u(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=
|
|
|
-m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),w(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,d,a.__webglTexture,0),u(a.__webglRenderbuffer,a);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:
|
|
|
-a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=ka,a=bb,e=Fa,c=Aa);b!==y&&(m.bindFramebuffer(m.FRAMEBUFFER,b),m.viewport(e,c,d,a),y=b);jb=d;Va=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
|
+"#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");l.attachShader(q,t("fragment",e+m));
|
|
|
+l.attachShader(q,t("vertex",d+k));l.linkProgram(q);l.getProgramParameter(q,l.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+l.getProgramParameter(q,l.VALIDATE_STATUS)+", gl error ["+l.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in j)d.push(r);r=d;for(d=0,j=r.length;d<j;d++)m=r[d],q.uniforms[m]=l.getUniformLocation(q,
|
|
|
+m);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(r=0;r<c.maxMorphNormals;r++)d.push("morphNormal"+r);for(p in b)d.push(p);p=d;for(r=0,b=p.length;r<b;r++)c=p[r],q.attributes[c]=l.getAttribLocation(q,c);q.id=Y.length;Y.push({program:q,code:i});E.info.memory.programs=Y.length;p=q}a.program=p;p=a.program.attributes;0<=p.position&&l.enableVertexAttribArray(p.position);0<=p.color&&l.enableVertexAttribArray(p.color);
|
|
|
+0<=p.normal&&l.enableVertexAttribArray(p.normal);0<=p.tangent&&l.enableVertexAttribArray(p.tangent);a.skinning&&0<=p.skinVertexA&&0<=p.skinVertexB&&0<=p.skinIndex&&0<=p.skinWeight&&(l.enableVertexAttribArray(p.skinVertexA),l.enableVertexAttribArray(p.skinVertexB),l.enableVertexAttribArray(p.skinIndex),l.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==p[h]&&0<=p[h]&&l.enableVertexAttribArray(p[h]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";
|
|
|
+for(h=0;h<this.maxMorphTargets;h++)r=q+h,0<=p[r]&&(l.enableVertexAttribArray(p[r]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(h=0;h<this.maxMorphNormals;h++)r=q+h,0<=p[r]&&(l.enableVertexAttribArray(p[r]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?l.frontFace(l.CCW):l.frontFace(l.CW),"back"===a?l.cullFace(l.BACK):"front"===a?l.cullFace(l.FRONT):
|
|
|
+l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE)):l.disable(l.CULL_FACE)};this.setObjectFaces=function(a){if(ha!==a.doubleSided)a.doubleSided?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),ha=a.doubleSided;if(R!==a.flipSided)a.flipSided?l.frontFace(l.CW):l.frontFace(l.CCW),R=a.flipSided};this.setDepthTest=function(a){T!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),T=a)};this.setDepthWrite=function(a){aa!==a&&(l.depthMask(a),aa=a)};this.setBlending=function(a){if(a!==$){switch(a){case THREE.NoBlending:l.disable(l.BLEND);
|
|
|
+break;case THREE.AdditiveBlending:l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE);break;case THREE.SubtractiveBlending:l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.SRC_COLOR);break;default:l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)}$=
|
|
|
+a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=l.createTexture(),E.info.memory.textures++;l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=z(a.format),g=z(a.type);w(l.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?l.texImage2D(l.TEXTURE_2D,0,e,c.width,c.height,0,e,g,c.data):l.texImage2D(l.TEXTURE_2D,0,e,e,g,a.image);a.generateMipmaps&&d&&l.generateMipmap(l.TEXTURE_2D);
|
|
|
+a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=l.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=z(a.format),e=z(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,
|
|
|
+a.__webglTexture);w(l.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=l.createFramebuffer();a.__webglRenderbuffer[c]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,0,d,e,null);var g=a,f=l.TEXTURE_CUBE_MAP_POSITIVE_X+c;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[c]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,f,g.__webglTexture,0);u(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=
|
|
|
+l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),w(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,0),u(a.__webglRenderbuffer,a);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:
|
|
|
+a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=ka,a=bb,e=Fa,c=Aa);b!==y&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(e,c,d,a),y=b);jb=d;Va=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0};
|
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
|
|
@@ -372,25 +372,25 @@ 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,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=(c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;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,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,l=a.faces,j=g.faces,k=a.faceVertexUvs[0],p=g.faceVertexUvs[0],i={},o=0;o<a.materials.length;o++)i[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.position);f.push(n)}for(o=0,q=j.length;o<q;o++){var f=
|
|
|
-j[o],r,s,t=f.vertexNormals,w=f.vertexColors;f instanceof THREE.Face3?r=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(r=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));r.normal.copy(f.normal);d&&d.multiplyVector3(r.normal);h=0;for(n=t.length;h<n;h++)s=t[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(f.color);h=0;for(n=w.length;h<n;h++)s=w[h],r.vertexColors.push(s.clone());if(void 0!==f.materialIndex){h=g.materials[f.materialIndex];n=h.id;w=i[n];if(void 0===w)w=a.materials.length,
|
|
|
-i[n]=w,a.materials.push(h);r.materialIndex=w}r.centroid.copy(f.centroid);c&&c.multiplyVector3(r.centroid);l.push(r)}for(o=0,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,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=e.length;a<c;a++)b.faces.push(e[a].clone());for(a=0,c=g.length;a<c;a++){for(var d=
|
|
|
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,j=g.faces,k=a.faceVertexUvs[0],p=g.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.position);f.push(n)}for(o=0,q=j.length;o<q;o++){var f=
|
|
|
+j[o],r,s,t=f.vertexNormals,w=f.vertexColors;f instanceof THREE.Face3?r=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(r=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));r.normal.copy(f.normal);d&&d.multiplyVector3(r.normal);h=0;for(n=t.length;h<n;h++)s=t[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(f.color);h=0;for(n=w.length;h<n;h++)s=w[h],r.vertexColors.push(s.clone());if(void 0!==f.materialIndex){h=g.materials[f.materialIndex];n=h.id;w=m[n];if(void 0===w)w=a.materials.length,
|
|
|
+m[n]=w,a.materials.push(h);r.materialIndex=w}r.centroid.copy(f.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}for(o=0,q=p.length;o<q;o++){c=p[o];d=[];h=0;for(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,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=e.length;a<c;a++)b.faces.push(e[a].clone());for(a=0,c=g.length;a<c;a++){for(var d=
|
|
|
g[a],e=[],f=0,h=d.length;f<h;f++)e.push(new THREE.UV(d[f].u,d[f].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,
|
|
|
e=b.vertices[a.b].position,g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*
|
|
|
-(c+f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,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 j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,l=0,j=[],k,p,i,o;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)k=f[d.a].position,p=f[d.b].position,i=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,p,i);else if(d instanceof
|
|
|
-THREE.Face4)k=f[d.a].position,p=f[d.b].position,i=f[d.c].position,o=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,p,o),d._area2=THREE.GeometryUtils.triangleArea(p,i,o),d._area=d._area1+d._area2;l+=d._area;j[e]=l}d=[];for(e=0;e<b;e++)f=THREE.GeometryUtils.random()*l,f=c(f),d[e]=THREE.GeometryUtils.randomPointInFace(g[f],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
|
|
|
+(c+f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,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 j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,j=[],k,p,m,o;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)k=f[d.a].position,p=f[d.b].position,m=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,p,m);else if(d instanceof
|
|
|
+THREE.Face4)k=f[d.a].position,p=f[d.b].position,m=f[d.c].position,o=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,p,o),d._area2=THREE.GeometryUtils.triangleArea(p,m,o),d._area=d._area1+d._area2;i+=d._area;j[e]=i}d=[];for(e=0;e<b;e++)f=THREE.GeometryUtils.random()*i,f=c(f),d[e]=THREE.GeometryUtils.randomPointInFace(g[f],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
|
|
|
(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,g=d.length;e<g;e++)1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v&&(d[e].v-=Math.floor(d[e].v))},triangulateQuads:function(a){for(var b=a.faces.length-1;0<=b;b--){var c=
|
|
|
a.faces[b];if(c instanceof THREE.Face4){var d=c.a,e=c.b,g=c.c,f=c.d,h=c.clone(),c=c.clone();h.a=d;h.b=e;h.c=f;c.a=e;c.b=g;c.c=f;a.faces.splice(b,1,h,c);for(d=0;d<a.faceVertexUvs.length;d++)a.faceVertexUvs[d].length&&(h=a.faceVertexUvs[d][b],e=h[1],g=h[2],f=h[3],h=[h[0].clone(),e.clone(),f.clone()],e=[e.clone(),g.clone(),f.clone()],a.faceVertexUvs[d].splice(b,1,h,e));for(d=0;d<a.faceUvs.length;d++)a.faceUvs[d].length&&(e=a.faceUvs[d][b],a.faceUvs[d].splice(b,1,e,e))}}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,g=a.faces[c];if(g instanceof THREE.Face4){var f=g.a,h=g.b,l=g.c,f=a.vertices[f],h=a.vertices[h],l=a.vertices[l],j=a.vertices[g.d];b.push(f.clone());b.push(h.clone());b.push(l.clone());b.push(j.clone());g.a=e;g.b=e+1;g.c=e+2;g.d=e+3}else f=g.a,h=g.b,l=g.c,f=a.vertices[f],h=a.vertices[h],l=a.vertices[l],b.push(f.clone()),b.push(h.clone()),b.push(l.clone()),g.a=e,
|
|
|
-g.b=e+1,g.c=e+2}a.vertices=b},tessellate:function(a,b){var c,d,e,g,f,h,l,j,k,p,i,o,q,n,r,s,t;for(c=a.faces.length-1;0<=c;c--)if(d=a.faces[c],d instanceof THREE.Face3){if(e=d.a,g=d.b,f=d.c,l=a.vertices[e],j=a.vertices[g],k=a.vertices[f],i=l.position.distanceTo(j.position),o=j.position.distanceTo(k.position),p=l.position.distanceTo(k.position),i>b||o>b||p>b){h=a.vertices.length;t=d.clone();d=d.clone();i>=o&&i>=p?(l=l.clone(),l.position.lerpSelf(j.position,0.5),t.a=e,t.b=h,t.c=f,d.a=h,d.b=g,d.c=f,e=
|
|
|
-0):o>=i&&o>=p?(l=j.clone(),l.position.lerpSelf(k.position,0.5),t.a=e,t.b=g,t.c=h,d.a=h,d.b=f,d.c=e,e=1):(l=l.clone(),l.position.lerpSelf(k.position,0.5),t.a=e,t.b=g,t.c=h,d.a=h,d.b=g,d.c=f,e=2);a.faces.splice(c,1,t,d);a.vertices.push(l);for(g=0;g<a.faceVertexUvs.length;g++)a.faceVertexUvs[g].length&&(k=a.faceVertexUvs[g][c],j=k[0],f=k[1],l=k[2],0===e?(i=j.clone(),i.lerpSelf(f,0.5),k=[j.clone(),i.clone(),l.clone()],f=[i.clone(),f.clone(),l.clone()]):1===e?(i=f.clone(),i.lerpSelf(l,0.5),k=[j.clone(),
|
|
|
-f.clone(),i.clone()],f=[i.clone(),l.clone(),j.clone()]):(i=j.clone(),i.lerpSelf(l,0.5),k=[j.clone(),f.clone(),i.clone()],f=[i.clone(),f.clone(),l.clone()]),a.faceVertexUvs[g].splice(c,1,k,f))}}else if(e=d.a,g=d.b,f=d.c,h=d.d,l=a.vertices[e],j=a.vertices[g],k=a.vertices[f],p=a.vertices[h],i=l.position.distanceTo(j.position),o=j.position.distanceTo(k.position),q=k.position.distanceTo(p.position),n=l.position.distanceTo(p.position),i>b||o>b||q>b||n>b){r=a.vertices.length;s=a.vertices.length+1;t=d.clone();
|
|
|
-d=d.clone();i>=o&&i>=q&&i>=n||q>=o&&q>=i&&q>=n?(i=l.clone(),i.position.lerpSelf(j.position,0.5),j=k.clone(),j.position.lerpSelf(p.position,0.5),t.a=e,t.b=r,t.c=s,t.d=h,d.a=r,d.b=g,d.c=f,d.d=s,e=0):(i=j.clone(),i.position.lerpSelf(k.position,0.5),j=p.clone(),j.position.lerpSelf(l.position,0.5),t.a=e,t.b=g,t.c=r,t.d=s,d.a=s,d.b=r,d.c=f,d.d=h,e=1);a.faces.splice(c,1,t,d);a.vertices.push(i);a.vertices.push(j);for(g=0;g<a.faceVertexUvs.length;g++)a.faceVertexUvs[g].length&&(k=a.faceVertexUvs[g][c],j=k[0],
|
|
|
-f=k[1],l=k[2],k=k[3],0===e?(i=j.clone(),i.lerpSelf(f,0.5),o=l.clone(),o.lerpSelf(k,0.5),j=[j.clone(),i.clone(),o.clone(),k.clone()],f=[i.clone(),f.clone(),l.clone(),o.clone()]):(i=f.clone(),i.lerpSelf(l,0.5),o=k.clone(),o.lerpSelf(j,0.5),j=[j.clone(),f.clone(),i.clone(),o.clone()],f=[o.clone(),i.clone(),l.clone(),k.clone()]),a.faceVertexUvs[g].splice(c,1,j,f))}}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
+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,g=a.faces[c];if(g instanceof THREE.Face4){var f=g.a,h=g.b,i=g.c,f=a.vertices[f],h=a.vertices[h],i=a.vertices[i],j=a.vertices[g.d];b.push(f.clone());b.push(h.clone());b.push(i.clone());b.push(j.clone());g.a=e;g.b=e+1;g.c=e+2;g.d=e+3}else f=g.a,h=g.b,i=g.c,f=a.vertices[f],h=a.vertices[h],i=a.vertices[i],b.push(f.clone()),b.push(h.clone()),b.push(i.clone()),g.a=e,
|
|
|
+g.b=e+1,g.c=e+2}a.vertices=b},tessellate:function(a,b){var c,d,e,g,f,h,i,j,k,p,m,o,q,n,r,s,t;for(c=a.faces.length-1;0<=c;c--)if(d=a.faces[c],d instanceof THREE.Face3){if(e=d.a,g=d.b,f=d.c,i=a.vertices[e],j=a.vertices[g],k=a.vertices[f],m=i.position.distanceTo(j.position),o=j.position.distanceTo(k.position),p=i.position.distanceTo(k.position),m>b||o>b||p>b){h=a.vertices.length;t=d.clone();d=d.clone();m>=o&&m>=p?(i=i.clone(),i.position.lerpSelf(j.position,0.5),t.a=e,t.b=h,t.c=f,d.a=h,d.b=g,d.c=f,e=
|
|
|
+0):o>=m&&o>=p?(i=j.clone(),i.position.lerpSelf(k.position,0.5),t.a=e,t.b=g,t.c=h,d.a=h,d.b=f,d.c=e,e=1):(i=i.clone(),i.position.lerpSelf(k.position,0.5),t.a=e,t.b=g,t.c=h,d.a=h,d.b=g,d.c=f,e=2);a.faces.splice(c,1,t,d);a.vertices.push(i);for(g=0;g<a.faceVertexUvs.length;g++)a.faceVertexUvs[g].length&&(k=a.faceVertexUvs[g][c],j=k[0],f=k[1],i=k[2],0===e?(m=j.clone(),m.lerpSelf(f,0.5),k=[j.clone(),m.clone(),i.clone()],f=[m.clone(),f.clone(),i.clone()]):1===e?(m=f.clone(),m.lerpSelf(i,0.5),k=[j.clone(),
|
|
|
+f.clone(),m.clone()],f=[m.clone(),i.clone(),j.clone()]):(m=j.clone(),m.lerpSelf(i,0.5),k=[j.clone(),f.clone(),m.clone()],f=[m.clone(),f.clone(),i.clone()]),a.faceVertexUvs[g].splice(c,1,k,f))}}else if(e=d.a,g=d.b,f=d.c,h=d.d,i=a.vertices[e],j=a.vertices[g],k=a.vertices[f],p=a.vertices[h],m=i.position.distanceTo(j.position),o=j.position.distanceTo(k.position),q=k.position.distanceTo(p.position),n=i.position.distanceTo(p.position),m>b||o>b||q>b||n>b){r=a.vertices.length;s=a.vertices.length+1;t=d.clone();
|
|
|
+d=d.clone();m>=o&&m>=q&&m>=n||q>=o&&q>=m&&q>=n?(m=i.clone(),m.position.lerpSelf(j.position,0.5),j=k.clone(),j.position.lerpSelf(p.position,0.5),t.a=e,t.b=r,t.c=s,t.d=h,d.a=r,d.b=g,d.c=f,d.d=s,e=0):(m=j.clone(),m.position.lerpSelf(k.position,0.5),j=p.clone(),j.position.lerpSelf(i.position,0.5),t.a=e,t.b=g,t.c=r,t.d=s,d.a=s,d.b=r,d.c=f,d.d=h,e=1);a.faces.splice(c,1,t,d);a.vertices.push(m);a.vertices.push(j);for(g=0;g<a.faceVertexUvs.length;g++)a.faceVertexUvs[g].length&&(k=a.faceVertexUvs[g][c],j=k[0],
|
|
|
+f=k[1],i=k[2],k=k[3],0===e?(m=j.clone(),m.lerpSelf(f,0.5),o=i.clone(),o.lerpSelf(k,0.5),j=[j.clone(),m.clone(),o.clone(),k.clone()],f=[m.clone(),f.clone(),i.clone(),o.clone()]):(m=f.clone(),m.lerpSelf(i,0.5),o=k.clone(),o.lerpSelf(j,0.5),j=[j.clone(),f.clone(),m.clone(),o.clone()],f=[o.clone(),m.clone(),i.clone(),k.clone()]),a.faceVertexUvs[g].splice(c,1,j,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=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return g},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,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,l=f.createImageData(d,e),j=l.data,k=0;k<d;k++)for(var p=1;p<e;p++){var i=0>p-1?e-1:p-1,o=(p+1)%e,q=0>k-1?d-1:k-1,n=(k+1)%d,r=[],s=[0,0,h[4*(p*d+k)]/255*b];r.push([-1,0,h[4*(p*d+q)]/255*b]);r.push([-1,-1,h[4*(i*d+q)]/255*b]);r.push([0,-1,
|
|
|
-h[4*(i*d+k)]/255*b]);r.push([1,-1,h[4*(i*d+n)]/255*b]);r.push([1,0,h[4*(p*d+n)]/255*b]);r.push([1,1,h[4*(o*d+n)]/255*b]);r.push([0,1,h[4*(o*d+k)]/255*b]);r.push([-1,1,h[4*(o*d+q)]/255*b]);i=[];q=r.length;for(o=0;o<q;o++){var n=r[o],t=r[(o+1)%q],n=[n[0]-s[0],n[1]-s[1],n[2]-s[2]],t=[t[0]-s[0],t[1]-s[1],t[2]-s[2]];i.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<i.length;o++)r[0]+=i[o][0],r[1]+=i[o][1],r[2]+=i[o][2];r[0]/=i.length;r[1]/=i.length;r[2]/=i.length;
|
|
|
-s=4*(p*d+k);j[s]=255*((r[0]+1)/2)|0;j[s+1]=255*(r[1]+0.5)|0;j[s+2]=255*r[2]|0;j[s+3]=255}f.putImageData(l,0,0);return g},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),g=Math.floor(255*c.r),f=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=g,e[3*h+1]=f,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;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,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),j=i.data,k=0;k<d;k++)for(var p=1;p<e;p++){var m=0>p-1?e-1:p-1,o=(p+1)%e,q=0>k-1?d-1:k-1,n=(k+1)%d,r=[],s=[0,0,h[4*(p*d+k)]/255*b];r.push([-1,0,h[4*(p*d+q)]/255*b]);r.push([-1,-1,h[4*(m*d+q)]/255*b]);r.push([0,-1,
|
|
|
+h[4*(m*d+k)]/255*b]);r.push([1,-1,h[4*(m*d+n)]/255*b]);r.push([1,0,h[4*(p*d+n)]/255*b]);r.push([1,1,h[4*(o*d+n)]/255*b]);r.push([0,1,h[4*(o*d+k)]/255*b]);r.push([-1,1,h[4*(o*d+q)]/255*b]);m=[];q=r.length;for(o=0;o<q;o++){var n=r[o],t=r[(o+1)%q],n=[n[0]-s[0],n[1]-s[1],n[2]-s[2]],t=[t[0]-s[0],t[1]-s[1],t[2]-s[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]+=m[o][0],r[1]+=m[o][1],r[2]+=m[o][2];r[0]/=m.length;r[1]/=m.length;r[2]/=m.length;
|
|
|
+s=4*(p*d+k);j[s]=255*((r[0]+1)/2)|0;j[s+1]=255*(r[1]+0.5)|0;j[s+2]=255*r[2]|0;j[s+3]=255}f.putImageData(i,0,0);return g},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),g=Math.floor(255*c.r),f=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=g,e[3*h+1]=f,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;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 g=new THREE.Mesh(a,b[c]);e.add(g)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
|
|
|
b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
|
|
|
(b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):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),b.rotation=a.rotation,b.opacity=a.opacity,
|
|
@@ -409,7 +409,7 @@ THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:
|
|
|
THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorArray=this.vertexUvArray=this.vertexNormalArray=this.vertexPositionArray=this.vertexIndexArray=this.vertexColorBuffer=this.vertexUvBuffer=this.vertexNormalBuffer=this.vertexPositionBuffer=this.vertexIndexBuffer=null;this.dynamic=!1;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,computeBoundingBox:function(){},computeBoundingSphere:function(){}};
|
|
|
THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,g=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),g+=c.distanceTo(d),b.push(g),d=c;return this.cacheArcLengths=b};
|
|
|
-THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,g;g=b?b:a*c[e-1];for(var f=0,h=e-1,l;f<=h;)if(d=Math.floor(f+(h-f)/2),l=c[d]-g,0>l)f=d+1;else if(0<l)h=d-1;else{h=d;break}d=h;if(c[d]==g)return d/(e-1);f=c[d];return c=(d+(g-f)/(c[d+1]-f))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
|
+THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,g;g=b?b:a*c[e-1];for(var f=0,h=e-1,i;f<=h;)if(d=Math.floor(f+(h-f)/2),i=c[d]-g,0>i)f=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==g)return d/(e-1);f=c[d];return c=(d+(g-f)/(c[d+1]-f))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
|
THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4,a=a+1.0E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().subSelf(b).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,b){a instanceof THREE.Vector2?(this.v1=a,this.v2=b):THREE.LineCurve.oldConstructor.apply(this,arguments)};
|
|
|
THREE.LineCurve.oldConstructor=function(a,b,c,d){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,d))};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};
|
|
|
THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};THREE.QuadraticBezierCurve=function(a,b,c){if(!(b instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),b=new THREE.Vector2(d[2],d[3]),c=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
|
|
@@ -428,10 +428,10 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]
|
|
|
d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};
|
|
|
THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
|
|
|
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
|
|
|
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var g,f,h,l;l=new THREE.Vector2;for(f=0,h=a.length;f<h;f++){g=a[f];if(g.x>b)b=g.x;else if(g.x<d)d=g.x;if(g.y>c)c=g.y;else if(g.y<c)e=g.y;l.addSelf(g.x,g.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:l.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
|
|
|
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var g,f,h,i;i=new THREE.Vector2;for(f=0,h=a.length;f<h;f++){g=a[f];if(g.x>b)b=g.x;else if(g.x<d)d=g.x;if(g.y>c)c=g.y;else if(g.y<c)e=g.y;i.addSelf(g.x,g.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
|
|
|
THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(new THREE.Vector3(a[c].x,a[c].y,0)));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
|
|
|
THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;if(!b)b=this.bends;for(d=0,e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;for(d=0,e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
|
|
|
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,g,f,h,l;for(d=0,e=a.length;d<e;d++)g=a[d],f=g.x,h=g.y,l=f/c.maxX,l=b.getUtoTmapping(l,f),f=b.getPoint(l),h=b.getNormalVector(l).multiplyScalar(h),g.x=f.x+h.x,g.y=f.y+h.y;return a};
|
|
|
+THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,g,f,h,i;for(d=0,e=a.length;d<e;d++)g=a[d],f=g.x,h=g.y,i=f/c.maxX,i=b.getUtoTmapping(i,f),f=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),g.x=f.x+h.x,g.y=f.y+h.y;return a};
|
|
|
THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){void 0==a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
|
|
|
THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?(this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld),this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject),this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
|
|
|
!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)};THREE.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;
|
|
@@ -442,37 +442,37 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,g){var f=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,g){var f=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,g);this.curves.push(h);h=h.getPoint(g?1:0);f.push(h.x);f.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:f})};
|
|
|
THREE.Path.prototype.absarc=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments),h=new THREE.ArcCurve(a,b,c,d,e,g);this.curves.push(h);h=h.getPoint(g?1:0);f.push(h.x);f.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
|
|
|
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,l,j,k,p,i,o,q,n;for(d=0,e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];l=g[3];p=g[0];i=g[1];0<c.length?(f=c[c.length-1],o=f.x,q=f.y):(f=this.actions[d-1].args,o=f[f.length-2],q=f[f.length-1]);for(g=1;g<=
|
|
|
-a;g++)n=g/a,f=THREE.Shape.Utils.b2(n,o,p,h),n=THREE.Shape.Utils.b2(n,q,i,l),c.push(new THREE.Vector2(f,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];l=g[5];p=g[0];i=g[1];j=g[2];k=g[3];0<c.length?(f=c[c.length-1],o=f.x,q=f.y):(f=this.actions[d-1].args,o=f[f.length-2],q=f[f.length-1]);for(g=1;g<=a;g++)n=g/a,f=THREE.Shape.Utils.b3(n,o,p,j,h),n=THREE.Shape.Utils.b3(n,q,i,k,l),c.push(new THREE.Vector2(f,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;n=[new THREE.Vector2(f[f.length-
|
|
|
-2],f[f.length-1])];f=a*g[0].length;n=n.concat(g[0]);n=new THREE.SplineCurve(n);for(g=1;g<=f;g++)c.push(n.getPointAt(g/f));break;case THREE.PathActions.ARC:h=g[0];l=g[1];j=g[2];p=g[3];i=!!g[5];k=g[4]-p;o=2*a;for(g=1;g<=o;g++)n=g/o,i||(n=1-n),n=p+n*k,f=h+j*Math.cos(n),n=l+j*Math.sin(n),c.push(new THREE.Vector2(f,n))}d=c[c.length-1];1.0E-10>Math.abs(d.x-c[0].x)&&1.0E-10>Math.abs(d.y-c[0].y)&&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,g){var f=this.getPoints(),h,l,j,k,p;for(h=0,l=f.length;h<l;h++)j=f[h],k=j.x,p=j.y,j.x=a*k+b*p+c,j.y=d*p+e*k+g;return f};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,j,k,p,m,o,q,n;for(d=0,e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];p=g[0];m=g[1];0<c.length?(f=c[c.length-1],o=f.x,q=f.y):(f=this.actions[d-1].args,o=f[f.length-2],q=f[f.length-1]);for(g=1;g<=
|
|
|
+a;g++)n=g/a,f=THREE.Shape.Utils.b2(n,o,p,h),n=THREE.Shape.Utils.b2(n,q,m,i),c.push(new THREE.Vector2(f,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];p=g[0];m=g[1];j=g[2];k=g[3];0<c.length?(f=c[c.length-1],o=f.x,q=f.y):(f=this.actions[d-1].args,o=f[f.length-2],q=f[f.length-1]);for(g=1;g<=a;g++)n=g/a,f=THREE.Shape.Utils.b3(n,o,p,j,h),n=THREE.Shape.Utils.b3(n,q,m,k,i),c.push(new THREE.Vector2(f,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;n=[new THREE.Vector2(f[f.length-
|
|
|
+2],f[f.length-1])];f=a*g[0].length;n=n.concat(g[0]);n=new THREE.SplineCurve(n);for(g=1;g<=f;g++)c.push(n.getPointAt(g/f));break;case THREE.PathActions.ARC:h=g[0];i=g[1];j=g[2];p=g[3];m=!!g[5];k=g[4]-p;o=2*a;for(g=1;g<=o;g++)n=g/o,m||(n=1-n),n=p+n*k,f=h+j*Math.cos(n),n=i+j*Math.sin(n),c.push(new THREE.Vector2(f,n))}d=c[c.length-1];1.0E-10>Math.abs(d.x-c[0].x)&&1.0E-10>Math.abs(d.y-c[0].y)&&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,g){var f=this.getPoints(),h,i,j,k,p;for(h=0,i=f.length;h<i;h++)j=f[h],k=j.x,p=j.y,j.x=a*k+b*p+c,j.y=d*p+e*k+g;return f};
|
|
|
THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
|
|
|
this.getPoints();for(a=0,c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
|
|
|
THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],g=new THREE.Path;for(a=0,b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=g.actions.length&&(e.push(g),g=new THREE.Path),g[c].apply(g,d);0!=g.actions.length&&e.push(g);if(0==e.length)return[];var f;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(1==e.length)return g=e[0],f=new THREE.Shape,f.actions=g.actions,f.curves=g.curves,d.push(f),d;if(a){f=new THREE.Shape;for(a=0,b=e.length;a<
|
|
|
b;a++)g=e[a],THREE.Shape.Utils.isClockWise(g.getPoints())?(f.actions=g.actions,f.curves=g.curves,d.push(f),f=new THREE.Shape):f.holes.push(g)}else{for(a=0,b=e.length;a<b;a++)g=e[a],THREE.Shape.Utils.isClockWise(g.getPoints())?(f&&d.push(f),f=new THREE.Shape,f.actions=g.actions,f.curves=g.curves):f.holes.push(g);d.push(f)}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.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,g,f,h,l,j,k,p,i,o,q=[];for(l=0;l<b.length;l++){j=b[l];Array.prototype.push.apply(d,j);g=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){i=j[e];o=[];for(p=0;p<c.length;p++)k=c[p],k=i.distanceToSquared(k),o.push(k),k<g&&(g=k,f=e,h=p)}e=0<=h-1?h-1:c.length-1;g=0<=f-1?f-1:j.length-1;var n=[j[f],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(n);var r=[j[f],j[g],c[h]];i=THREE.FontUtils.Triangulate.area(r);o=h;k=f;h+=1;f+=-1;0>
|
|
|
-h&&(h+=c.length);h%=c.length;0>f&&(f+=j.length);f%=j.length;e=0<=h-1?h-1:c.length-1;g=0<=f-1?f-1:j.length-1;n=[j[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);r=[j[f],j[g],c[h]];r=THREE.FontUtils.Triangulate.area(r);p+i>n+r&&(h=o,f=k,0>h&&(h+=c.length),h%=c.length,0>f&&(f+=j.length),f%=j.length,e=0<=h-1?h-1:c.length-1,g=0<=f-1?f-1:j.length-1);p=c.slice(0,h);i=c.slice(h);o=j.slice(f);k=j.slice(0,f);g=[j[f],j[g],c[h]];q.push([j[f],c[h],c[e]]);q.push(g);c=p.concat(o).concat(k).concat(i)}return{shape:c,
|
|
|
-isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,l,j={};for(g=0,f=d.length;g<f;g++)l=d[g].x+":"+d[g].y,void 0!==j[l]&&console.log("Duplicate point",l),j[l]=g;for(g=0,f=c.length;g<f;g++){h=c[g];for(d=0;3>d;d++)l=h[d].x+":"+h[d].y,l=j[l],void 0!==l&&(h[d]=l)}for(g=0,f=e.length;g<f;g++){h=e[g];for(d=0;3>d;d++)l=h[d].x+":"+h[d].y,l=j[l],void 0!==l&&(h[d]=l)}return c.concat(e)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,j,k,p,m,o,q=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);g=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){m=j[e];o=[];for(p=0;p<c.length;p++)k=c[p],k=m.distanceToSquared(k),o.push(k),k<g&&(g=k,f=e,h=p)}e=0<=h-1?h-1:c.length-1;g=0<=f-1?f-1:j.length-1;var n=[j[f],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(n);var r=[j[f],j[g],c[h]];m=THREE.FontUtils.Triangulate.area(r);o=h;k=f;h+=1;f+=-1;0>
|
|
|
+h&&(h+=c.length);h%=c.length;0>f&&(f+=j.length);f%=j.length;e=0<=h-1?h-1:c.length-1;g=0<=f-1?f-1:j.length-1;n=[j[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);r=[j[f],j[g],c[h]];r=THREE.FontUtils.Triangulate.area(r);p+m>n+r&&(h=o,f=k,0>h&&(h+=c.length),h%=c.length,0>f&&(f+=j.length),f%=j.length,e=0<=h-1?h-1:c.length-1,g=0<=f-1?f-1:j.length-1);p=c.slice(0,h);m=c.slice(h);o=j.slice(f);k=j.slice(0,f);g=[j[f],j[g],c[h]];q.push([j[f],c[h],c[e]]);q.push(g);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,!1),g,f,h,i,j={};for(g=0,f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,void 0!==j[i]&&console.log("Duplicate point",i),j[i]=g;for(g=0,f=c.length;g<f;g++){h=c[g];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}for(g=0,f=e.length;g<f;g++){h=e[g];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
|
|
|
isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
|
this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",g=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
|
|
|
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){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(0>a.hierarchy[c].keys[d].time)a.hierarchy[c].keys[d].time=
|
|
|
-0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(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&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var l=0;l<a.hierarchy[c].keys[d].morphTargets.length;l++){var j=a.hierarchy[c].keys[d].morphTargets[l];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k=
|
|
|
-{};for(j in h){for(l=0;l<a.hierarchy[c].keys[d].morphTargets.length;l++)if(a.hierarchy[c].keys[d].morphTargets[l]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[l];break}l===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)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*
|
|
|
+0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(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&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k=
|
|
|
+{};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)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=!0}},get:function(a){if("string"===typeof a){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=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.JITCompile=void 0!==d?d:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?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=!0;e.matrixAutoUpdate=!0;if(void 0===e.animationCache)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 g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(void 0!==this.hierarchy[a].animationCache)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,l,j,k=this.data.JIT.hierarchy,p,i;i=this.currentTime+=a*this.timeScale;p=this.currentTime%=this.data.length;j=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,q=this.hierarchy.length;o<q;o++)if(a=this.hierarchy[o],l=a.animationCache,this.JITCompile&&void 0!==k[o][j])a instanceof THREE.Bone?(a.skinMatrix=k[o][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
|
|
|
-k[o][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;3>n;n++){c=b[n];f=l.prevKey[c];h=l.nextKey[c];if(h.time<=i){if(p<i)if(this.loop){f=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<p;)f=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<p)}l.prevKey[c]=
|
|
|
-f;l.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-f.time)/(h.time-f.time);e=f[c];g=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,j,k=this.data.JIT.hierarchy,p,m;m=this.currentTime+=a*this.timeScale;p=this.currentTime%=this.data.length;j=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,q=this.hierarchy.length;o<q;o++)if(a=this.hierarchy[o],i=a.animationCache,this.JITCompile&&void 0!==k[o][j])a instanceof THREE.Bone?(a.skinMatrix=k[o][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
|
|
|
+k[o][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;3>n;n++){c=b[n];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=m){if(p<m)if(this.loop){f=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<p;)f=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<p)}i.prevKey[c]=
|
|
|
+f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-f.time)/(h.time-f.time);e=f[c];g=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
this.getPrevKeyWith("pos",o,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,1.01*d),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if("rot"===
|
|
|
c)THREE.Quaternion.slerp(e,g,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&void 0===k[0][j]){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)k[o][j]=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,g,f,h,l,j;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];l=a[c[2]];j=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],l[0],j[0],e,c,f);d[1]=this.interpolate(g[1],h[1],l[1],j[1],e,c,f);d[2]=this.interpolate(g[2],h[2],l[2],j[2],e,c,f);return d};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,j;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],j[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],j[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],j[2],e,c,f);return d};
|
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,d,e,g,f){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
|
|
|
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.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;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 g=c[e],f=this.getNextKeyWith(g,a,0);f&&f.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
@@ -480,9 +480,9 @@ d.matrixWorldNeedsUpdate=!0}}};
|
|
|
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,g;for(c=0;c<d;c++){e=this.hierarchy[c];g=this.data.hierarchy[c];e.useQuaternion=!0;if(void 0===g.animationCache)g.animationCache={},g.animationCache.prevKey=null,g.animationCache.nextKey=null,g.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
|
|
|
e.matrix;e=this.data.hierarchy[c].keys;if(e.length)g.animationCache.prevKey=e[0],g.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=!1;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=!1;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(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;b instanceof THREE.Bone?(d.copy(b.skinMatrix),b.skinMatrix=d):(d.copy(b.matrix),b.matrix=d);delete c.animationCache}}};
|
|
|
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,g=this.data.JIT.hierarchy,f,h,l;h=this.currentTime+=a*this.timeScale;f=this.currentTime%=this.data.length;if(f<this.startTimeMs)f=this.currentTime=this.startTimeMs+f;e=parseInt(Math.min(f*this.data.fps,this.data.length*this.data.fps),10);if((l=f<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,g=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];if(k.length){for(k=
|
|
|
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,g=this.data.JIT.hierarchy,f,h,i;h=this.currentTime+=a*this.timeScale;f=this.currentTime%=this.data.length;if(f<this.startTimeMs)f=this.currentTime=this.startTimeMs+f;e=parseInt(Math.min(f*this.data.fps,this.data.length*this.data.fps),10);if((i=f<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,g=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];if(k.length){for(k=
|
|
|
0;k<g.length;k++)f=g[k],(h=this.getPrevKeyWith(f,a,d))&&h.apply(f);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(f<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,p=b.animationCache;if(this.JITCompile&&void 0!==g[a][e])d instanceof THREE.Bone?(d.skinMatrix=g[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=g[a][e],d.matrixWorldNeedsUpdate=!0);else if(k.length){if(this.JITCompile&&p)d instanceof
|
|
|
-THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix;b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=h){if(l&&this.loop){b=k[0];for(c=k[1];c.time<f;)b=c,c=k[b.index+1]}else if(!l)for(var i=k.length-1;c.time<f&&c.index!==i;)b=c,c=k[b.index+1];p.prevKey=b;p.nextKey=c}c.time>=f?b.interpolate(c,f):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===g[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)g[a][e]=
|
|
|
+THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix;b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<f;)b=c,c=k[b.index+1]}else if(!i)for(var m=k.length-1;c.time<f&&c.index!==m;)b=c,c=k[b.index+1];p.prevKey=b;p.nextKey=c}c.time>=f?b.interpolate(c,f):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===g[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)g[a][e]=
|
|
|
this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
|
|
|
THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
|
this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
|
|
@@ -502,7 +502,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
|
|
|
this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);a*=this.lookSpeed;this.activeLook||(a=0);this.lon+=this.mouseX*a;this.lookVertical&&(this.lat-=this.mouseY*a);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;var 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);b=1;this.constrainVertical&&
|
|
|
(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*a;this.lookVertical&&(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()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
|
|
|
-THREE.PathControls=function(a,b){function c(a){return 1>(a*=2)?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,s=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++)s=d*h.chunks[f]/h.total,b.keys[f]={time:s,pos:g[f]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
|
|
|
+THREE.PathControls=function(a,b){function c(a){return 1>(a*=2)?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:[]},g,f=b.getControlPointsArray(),h=b.getLength(),r=f.length,s=0;g=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:d,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<r-1;g++)s=d*h.chunks[g]/h.total,b.keys[g]={time:s,pos:f[g]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
|
|
|
return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(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(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=void 0!==b?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=
|
|
|
new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;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;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/
|
|
|
2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=2*Math.PI,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(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%f;this.phi=0<=a?a:a+f;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
|
|
@@ -520,71 +520,71 @@ THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,argu
|
|
|
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
|
|
|
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
|
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
|
-THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,l=0,j=0,k=0,p=0,i=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*i)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<l||this.autoForward&&!(0>l)?1:l));this.object.translateX(b*j);this.object.translateY(b*k);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
|
|
|
+THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,j=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*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*j);this.object.translateY(b*k);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
|
|
|
e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
|
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
|
|
|
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
|
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-o)/window.innerWidth;i=(a.clientY-q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
-function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:j=-1;break;case 40:case 83:l=-1;break;case 39:case 68:j=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:j=0;break;case 40:case 83:l=0;break;case 39:case 68:j=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
|
|
|
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-o)/window.innerWidth;m=(a.clientY-q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
+function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
|
|
|
THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=void 0!==b?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
|
|
|
-new THREE.Vector3;var d=new THREE.Vector3,e=!1,g=-1,f=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,p=new THREE.Vector2,i=new THREE.Vector2,o={type:"change"};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
|
|
|
-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(l)/h.length()/l.length());if(a){var b=(new THREE.Vector3).cross(h,l).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
|
|
|
-d.setFromAxisAngle(b,-a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(l);c.staticMoving?h=l:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*c.zoomSpeed;1!==a&&0<a&&(f.multiplyScalar(a),c.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=i.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.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=i:p.addSelf(a.sub(i,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),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.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,f);c.checkDistances();c.object.lookAt(c.target);0<d.distanceTo(c.object.position)&&(c.dispatchEvent(o),d.copy(c.object.position))};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=l=c.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=c.getMouseOnScreen(a.clientX,a.clientY),p=i=c.getMouseOnScreen(a.clientX,
|
|
|
-a.clientY),e=!1),-1!==g&&(0===g&&!c.noRotate?l=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===g&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):2===g&&!c.noPan&&(i=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===g))g=a.button,0===g&&!c.noRotate?h=l=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===g&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=i=
|
|
|
+new THREE.Vector3;var d=new THREE.Vector3,e=!1,g=-1,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,p=new THREE.Vector2,m=new THREE.Vector2,o={type:"change"};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
|
|
|
+0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
|
|
|
+d.setFromAxisAngle(b,-a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*c.zoomSpeed;1!==a&&0<a&&(f.multiplyScalar(a),c.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=m.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.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),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.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,f);c.checkDistances();c.object.lookAt(c.target);0<d.distanceTo(c.object.position)&&(c.dispatchEvent(o),d.copy(c.object.position))};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=c.getMouseOnScreen(a.clientX,a.clientY),p=m=c.getMouseOnScreen(a.clientX,
|
|
|
+a.clientY),e=!1),-1!==g&&(0===g&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===g&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):2===g&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===g))g=a.button,0===g&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===g&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=m=
|
|
|
c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),g=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===g&&(a.keyCode===c.keys[0]&&!c.noRotate?g=0:a.keyCode===c.keys[1]&&!c.noZoom?g=1:a.keyCode===c.keys[2]&&!c.noPan&&(g=2),-1!==g&&(e=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==g&&(g=-1)},!1)};
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function l(a,b,c,f,h,i,k,l){var n,o=d||1,p=e||1,q=h/2,r=i/2,s=j.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",p=g||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",o=g||1;var m=o+1,t=p+1,w=h/o,y=i/p,S=new THREE.Vector3;S[n]=0<k?1:-1;for(h=0;h<t;h++)for(i=0;i<m;i++){var P=new THREE.Vector3;P[a]=(i*w-q)*c;P[b]=(h*y-r)*f;P[n]=k;j.vertices.push(new THREE.Vertex(P))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
|
|
|
-new THREE.Face4(i+m*h+s,i+m*(h+1)+s,i+1+m*(h+1)+s,i+1+m*h+s),a.normal.copy(S),a.vertexNormals.push(S.clone(),S.clone(),S.clone(),S.clone()),a.materialIndex=l,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var j=this,k=a/2,p=b/2,i=c/2,o,q,n,r,s,t;if(void 0!==f){if(f instanceof Array)this.materials=f;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(f)}o=0;r=1;q=2;s=
|
|
|
-3;n=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var w in h)void 0!==this.sides[w]&&(this.sides[w]=h[w]);this.sides.px&&l("z","y",-1,-1,c,b,k,o);this.sides.nx&&l("z","y",1,-1,c,b,-k,r);this.sides.py&&l("x","z",1,1,a,c,p,q);this.sides.ny&&l("x","z",1,-1,a,c,-p,s);this.sides.pz&&l("x","y",1,-1,a,b,i,n);this.sides.nz&&l("x","y",-1,-1,a,b,-i,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,m,k){var n,o=d||1,p=e||1,q=h/2,r=i/2,s=j.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",p=g||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",o=g||1;var l=o+1,t=p+1,w=h/o,y=i/p,S=new THREE.Vector3;S[n]=0<m?1:-1;for(h=0;h<t;h++)for(i=0;i<l;i++){var P=new THREE.Vector3;P[a]=(i*w-q)*c;P[b]=(h*y-r)*f;P[n]=m;j.vertices.push(new THREE.Vertex(P))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
|
|
|
+new THREE.Face4(i+l*h+s,i+l*(h+1)+s,i+1+l*(h+1)+s,i+1+l*h+s),a.normal.copy(S),a.vertexNormals.push(S.clone(),S.clone(),S.clone(),S.clone()),a.materialIndex=k,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var j=this,k=a/2,p=b/2,m=c/2,o,q,n,r,s,t;if(void 0!==f){if(f instanceof Array)this.materials=f;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(f)}o=0;r=1;q=2;s=
|
|
|
+3;n=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var w in h)void 0!==this.sides[w]&&(this.sides[w]=h[w]);this.sides.px&&i("z","y",-1,-1,c,b,k,o);this.sides.nx&&i("z","y",1,-1,c,b,-k,r);this.sides.py&&i("x","z",1,1,a,c,p,q);this.sides.ny&&i("x","z",1,-1,a,c,-p,s);this.sides.pz&&i("x","y",1,-1,a,b,m,n);this.sides.nz&&i("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,g){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,f=c/2,d=d||8,e=e||1,h,l,j=[],k=[];for(l=0;l<=e;l++){var p=[],i=[],o=l/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,r=q*Math.sin(2*n*Math.PI),s=-o*c+f,t=q*Math.cos(2*n*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,t)));p.push(this.vertices.length-1);i.push(new THREE.UV(n,o))}j.push(p);k.push(i)}for(l=0;l<e;l++)for(h=0;h<d;h++){var c=j[l][h],p=j[l+1][h],
|
|
|
-i=j[l+1][h+1],o=j[l][h+1],q=this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[p].position.clone().setY(0).normalize(),r=this.vertices[i].position.clone().setY(0).normalize(),s=this.vertices[o].position.clone().setY(0).normalize(),t=k[l][h].clone(),w=k[l+1][h].clone(),u=k[l+1][h+1].clone(),v=k[l][h+1].clone();this.faces.push(new THREE.Face4(c,p,i,o,[q,n,r,s]));this.faceVertexUvs[0].push([t,w,u,v])}if(!g&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=
|
|
|
-0;h<d;h++)c=j[0][h],p=j[0][h+1],i=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(),w=k[0][h+1].clone(),u=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(c,p,i,[q,n,r])),this.faceVertexUvs[0].push([t,w,u])}if(!g&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=j[l][h+1],p=j[l][h],i=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[l][h+1].clone(),w=k[l][h].clone(),u=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(c,p,i,[q,n,r])),this.faceVertexUvs[0].push([t,w,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,f=c/2,d=d||8,e=e||1,h,i,j=[],k=[];for(i=0;i<=e;i++){var p=[],m=[],o=i/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,r=q*Math.sin(2*n*Math.PI),s=-o*c+f,t=q*Math.cos(2*n*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,t)));p.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}j.push(p);k.push(m)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=j[i][h],p=j[i+1][h],
|
|
|
+m=j[i+1][h+1],o=j[i][h+1],q=this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[p].position.clone().setY(0).normalize(),r=this.vertices[m].position.clone().setY(0).normalize(),s=this.vertices[o].position.clone().setY(0).normalize(),t=k[i][h].clone(),w=k[i+1][h].clone(),u=k[i+1][h+1].clone(),v=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,p,m,o,[q,n,r,s]));this.faceVertexUvs[0].push([t,w,u,v])}if(!g&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=
|
|
|
+0;h<d;h++)c=j[0][h],p=j[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(),w=k[0][h+1].clone(),u=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(c,p,m,[q,n,r])),this.faceVertexUvs[0].push([t,w,u])}if(!g&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=j[i][h+1],p=j[i][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[i][h+1].clone(),w=k[i][h].clone(),u=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(c,p,m,[q,n,r])),this.faceVertexUvs[0].push([t,w,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a)THREE.Geometry.call(this),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);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(y=c.length;0<=--y;){e=y;f=y-1;0>f&&(f=c.length-1);
|
|
|
-for(var g=0,h=o+2*k,g=0;g<h;g++){var i=m*g,j=m*(g+1),l=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,p=c,q=g,r=h,l=l+C,i=i+C,n=n+C,j=j+C;D.faces.push(new THREE.Face4(l,i,n,j,null,null,u));l=P.generateSideWallUV(D,a,p,b,l,i,n,j,q,r);D.faceVertexUvs[0].push(l)}}}function g(a,b,c){D.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(c,d,e,f){c+=C;d+=C;e+=C;D.faces.push(new THREE.Face3(c,d,e,null,null,w));c=f?P.generateBottomUV(D,a,b,c,d,e):P.generateTopUV(D,a,b,c,d,e);D.faceVertexUvs[0].push(c)}var h=
|
|
|
-void 0!==b.amount?b.amount:100,l=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:l-2,k=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,i=void 0!==b.curveSegments?b.curveSegments:12,o=void 0!==b.steps?b.steps:1,q=b.bendPath,n=b.extrudePath,r,s=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,w=b.material,u=b.extrudeMaterial;if(n)r=n.getPoints(i),o=r.length,s=!0,p=!1;p||(j=l=k=0);var v,z,G,D=this,C=this.vertices.length;q&&a.addWrapPath(q);
|
|
|
-var q=t?a.extractAllSpacedPoints(i):a.extractAllPoints(i),i=q.shape,I=q.holes;if(q=!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();for(z=0,G=I.length;z<G;z++)v=I[z],THREE.Shape.Utils.isClockWise(v)&&(I[z]=v.reverse());q=!1}var K=THREE.Shape.Utils.triangulateShape(i,I),O=i;for(z=0,G=I.length;z<G;z++)v=I[z],i=i.concat(v);var Q,L,B,N,E,m=i.length,Y,F=K.length,q=[],y=0;B=O.length;Q=B-1;for(L=y+1;y<B;y++,Q++,L++)Q===B&&(Q=0),L===B&&(L=0),q[y]=d(O[y],O[Q],O[L]);var n=[],S,t=q.concat();for(z=0,G=I.length;z<
|
|
|
-G;z++){v=I[z];S=[];for(y=0,B=v.length,Q=B-1,L=y+1;y<B;y++,Q++,L++)Q===B&&(Q=0),L===B&&(L=0),S[y]=d(v[y],v[Q],v[L]);n.push(S);t=t.concat(S)}for(Q=0;Q<k;Q++){B=Q/k;N=l*(1-B);L=j*Math.sin(B*Math.PI/2);for(y=0,B=O.length;y<B;y++)E=c(O[y],q[y],L),g(E.x,E.y,-N);for(z=0,G=I.length;z<G;z++){v=I[z];S=n[z];for(y=0,B=v.length;y<B;y++)E=c(v[y],S[y],L),g(E.x,E.y,-N)}}L=j;for(y=0;y<m;y++)E=p?c(i[y],t[y],L):i[y],s?g(E.x,E.y+r[0].y,r[0].x):g(E.x,E.y,0);for(B=1;B<=o;B++)for(y=0;y<m;y++)E=p?c(i[y],t[y],L):i[y],s?g(E.x,
|
|
|
-E.y+r[B-1].y,r[B-1].x):g(E.x,E.y,h/o*B);for(Q=k-1;0<=Q;Q--){B=Q/k;N=l*(1-B);L=j*Math.sin(B*Math.PI/2);for(y=0,B=O.length;y<B;y++)E=c(O[y],q[y],L),g(E.x,E.y,h+N);for(z=0,G=I.length;z<G;z++){v=I[z];S=n[z];for(y=0,B=v.length;y<B;y++)E=c(v[y],S[y],L),s?g(E.x,E.y+r[o-1].y,r[o-1].x+N):g(E.x,E.y,h+N)}}var P=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(p){var a;a=0*m;for(y=0;y<F;y++)Y=K[y],f(Y[2]+a,Y[1]+a,Y[0]+a,!0);a=o+2*k;a*=m;for(y=0;y<F;y++)Y=K[y],f(Y[0]+a,Y[1]+a,Y[2]+a,!1)}else{for(y=0;y<F;y++)Y=
|
|
|
-K[y],f(Y[2],Y[1],Y[0],!0);for(y=0;y<F;y++)Y=K[y],f(Y[0]+m*o,Y[1]+m*o,Y[2]+m*o,!1)}})();(function(){var a=0;e(O,a);a+=O.length;for(z=0,G=I.length;z<G;z++)v=I[z],e(v,a),a+=v.length})()};
|
|
|
+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,g=THREE.ExtrudeGeometry.__v3,f=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();g.set(-d.y,d.x);f.set(e.y,-e.x);h.copy(a).addSelf(g);i.copy(a).addSelf(f);if(h.equals(i))return f.clone();
|
|
|
+h.copy(b).addSelf(g);i.copy(c).addSelf(f);g=d.dot(f);f=i.subSelf(h).dot(f);0===g&&(console.log("Either infinite or no solutions!"),0===f?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=g;return 0>f?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(f).addSelf(h).subSelf(a).clone()}function e(c,d){var e,g;for(y=c.length;0<=--y;){e=y;g=y-1;0>g&&(g=c.length-1);
|
|
|
+for(var f=0,h=o+2*k,f=0;f<h;f++){var i=l*f,j=l*(f+1),m=d+e+i,i=d+g+i,n=d+g+j,j=d+e+j,p=c,q=f,r=h,m=m+C,i=i+C,n=n+C,j=j+C;D.faces.push(new THREE.Face4(m,i,n,j,null,null,u));m=P.generateSideWallUV(D,a,p,b,m,i,n,j,q,r);D.faceVertexUvs[0].push(m)}}}function g(a,b,c){D.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(c,d,e,g){c+=C;d+=C;e+=C;D.faces.push(new THREE.Face3(c,d,e,null,null,w));c=g?P.generateBottomUV(D,a,b,c,d,e):P.generateTopUV(D,a,b,c,d,e);D.faceVertexUvs[0].push(c)}var h=
|
|
|
+void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,o=void 0!==b.steps?b.steps:1,q=b.bendPath,n=b.extrudePath,r,s=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,w=b.material,u=b.extrudeMaterial;if(n)r=n.getPoints(m),o=r.length,s=!0,p=!1;p||(j=i=k=0);var v,z,G,D=this,C=this.vertices.length;q&&a.addWrapPath(q);
|
|
|
+var q=t?a.extractAllSpacedPoints(m):a.extractAllPoints(m),m=q.shape,I=q.holes;if(q=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();for(z=0,G=I.length;z<G;z++)v=I[z],THREE.Shape.Utils.isClockWise(v)&&(I[z]=v.reverse());q=!1}var K=THREE.Shape.Utils.triangulateShape(m,I),O=m;for(z=0,G=I.length;z<G;z++)v=I[z],m=m.concat(v);var Q,L,B,N,E,l=m.length,Y,F=K.length,q=[],y=0;B=O.length;Q=B-1;for(L=y+1;y<B;y++,Q++,L++)Q===B&&(Q=0),L===B&&(L=0),q[y]=d(O[y],O[Q],O[L]);var n=[],S,t=q.concat();for(z=0,G=I.length;z<
|
|
|
+G;z++){v=I[z];S=[];for(y=0,B=v.length,Q=B-1,L=y+1;y<B;y++,Q++,L++)Q===B&&(Q=0),L===B&&(L=0),S[y]=d(v[y],v[Q],v[L]);n.push(S);t=t.concat(S)}for(Q=0;Q<k;Q++){B=Q/k;N=i*(1-B);L=j*Math.sin(B*Math.PI/2);for(y=0,B=O.length;y<B;y++)E=c(O[y],q[y],L),g(E.x,E.y,-N);for(z=0,G=I.length;z<G;z++){v=I[z];S=n[z];for(y=0,B=v.length;y<B;y++)E=c(v[y],S[y],L),g(E.x,E.y,-N)}}L=j;for(y=0;y<l;y++)E=p?c(m[y],t[y],L):m[y],s?g(E.x,E.y+r[0].y,r[0].x):g(E.x,E.y,0);for(B=1;B<=o;B++)for(y=0;y<l;y++)E=p?c(m[y],t[y],L):m[y],s?g(E.x,
|
|
|
+E.y+r[B-1].y,r[B-1].x):g(E.x,E.y,h/o*B);for(Q=k-1;0<=Q;Q--){B=Q/k;N=i*(1-B);L=j*Math.sin(B*Math.PI/2);for(y=0,B=O.length;y<B;y++)E=c(O[y],q[y],L),g(E.x,E.y,h+N);for(z=0,G=I.length;z<G;z++){v=I[z];S=n[z];for(y=0,B=v.length;y<B;y++)E=c(v[y],S[y],L),s?g(E.x,E.y+r[o-1].y,r[o-1].x+N):g(E.x,E.y,h+N)}}var P=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(p){var a;a=0*l;for(y=0;y<F;y++)Y=K[y],f(Y[2]+a,Y[1]+a,Y[0]+a,!0);a=o+2*k;a*=l;for(y=0;y<F;y++)Y=K[y],f(Y[0]+a,Y[1]+a,Y[2]+a,!1)}else{for(y=0;y<F;y++)Y=
|
|
|
+K[y],f(Y[2],Y[1],Y[0],!0);for(y=0;y<F;y++)Y=K[y],f(Y[0]+l*o,Y[1]+l*o,Y[2]+l*o,!1)}})();(function(){var a=0;e(O,a);a+=O.length;for(z=0,G=I.length;z<G;z++)v=I[z],e(v,a),a+=v.length})()};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,g){b=a.vertices[e].position.x;e=a.vertices[e].position.y;c=a.vertices[g].position.x;g=a.vertices[g].position.y;return[new THREE.UV(a.vertices[d].position.x,1-a.vertices[d].position.y),new THREE.UV(b,1-e),new THREE.UV(c,1-g)]},generateBottomUV:function(a,b,c,d,e,g){return this.generateTopUV(a,b,c,d,e,g)},generateSideWallUV:function(a,b,c,d,e,g,f,h){var b=a.vertices[e].position.x,c=a.vertices[e].position.y,e=a.vertices[e].position.z,
|
|
|
-d=a.vertices[g].position.x,l=a.vertices[g].position.y,g=a.vertices[g].position.z,j=a.vertices[f].position.x,k=a.vertices[f].position.y,f=a.vertices[f].position.z,p=a.vertices[h].position.x,i=a.vertices[h].position.y,a=a.vertices[h].position.z;return 0.01>Math.abs(c-l)?[new THREE.UV(b,e),new THREE.UV(d,g),new THREE.UV(j,f),new THREE.UV(p,a)]:[new THREE.UV(c,e),new THREE.UV(l,g),new THREE.UV(k,f),new THREE.UV(i,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
+d=a.vertices[g].position.x,i=a.vertices[g].position.y,g=a.vertices[g].position.z,j=a.vertices[f].position.x,k=a.vertices[f].position.y,f=a.vertices[f].position.z,p=a.vertices[h].position.x,m=a.vertices[h].position.y,a=a.vertices[h].position.z;return 0.01>Math.abs(c-i)?[new THREE.UV(b,e),new THREE.UV(d,g),new THREE.UV(j,f),new THREE.UV(p,a)]:[new THREE.UV(c,e),new THREE.UV(i,g),new THREE.UV(k,f),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);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],g=[],f=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var l=0;l<=this.angle+0.0010;l+=b){for(h=0;h<c.length;h++)l<this.angle?(c[h]=f.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=g;0==l&&(g=d);
|
|
|
-for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,h/a.length),new THREE.UV(1-l/this.angle,(h+1)/a.length),new THREE.UV(1-(l-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(l-b)/this.angle,h/a.length)]);d=e;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,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,l=a/c,j=b/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*l-e,-(a*j-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*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/
|
|
|
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],g=[],f=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=f.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=g;0==i&&(g=d);
|
|
|
+for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;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,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*j-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*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,g,f){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,g=void 0!==g?g:0,f=void 0!==f?f:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,l,j=[],k=[];for(l=0;l<=c;l++){var p=[],i=[];for(h=0;h<=b;h++){var o=h/b,q=l/c,n=-a*Math.cos(d+o*e)*Math.sin(g+q*f),r=a*Math.cos(g+q*f),s=a*Math.sin(d+o*e)*Math.sin(g+q*f);this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,r,s)));p.push(this.vertices.length-1);i.push(new THREE.UV(o,
|
|
|
-q))}j.push(p);k.push(i)}for(l=0;l<c;l++)for(h=0;h<b;h++){var d=j[l][h+1],e=j[l][h],g=j[l+1][h],f=j[l+1][h+1],p=this.vertices[d].position.clone().normalize(),i=this.vertices[e].position.clone().normalize(),o=this.vertices[g].position.clone().normalize(),q=this.vertices[f].position.clone().normalize(),n=k[l][h+1].clone(),r=k[l][h].clone(),s=k[l+1][h].clone(),t=k[l+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[p,o,q])),this.faceVertexUvs[0].push([n,
|
|
|
-s,t])):Math.abs(this.vertices[g].position.y)==a?(this.faces.push(new THREE.Face3(d,e,g,[p,i,o])),this.faceVertexUvs[0].push([n,r,s])):(this.faces.push(new THREE.Face4(d,e,g,f,[p,i,o,q])),this.faceVertexUvs[0].push([n,r,s,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
+THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,g=void 0!==g?g:0,f=void 0!==f?f:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],k=[];for(i=0;i<=c;i++){var p=[],m=[];for(h=0;h<=b;h++){var o=h/b,q=i/c,n=-a*Math.cos(d+o*e)*Math.sin(g+q*f),r=a*Math.cos(g+q*f),s=a*Math.sin(d+o*e)*Math.sin(g+q*f);this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,r,s)));p.push(this.vertices.length-1);m.push(new THREE.UV(o,
|
|
|
+q))}j.push(p);k.push(m)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],e=j[i][h],g=j[i+1][h],f=j[i+1][h+1],p=this.vertices[d].position.clone().normalize(),m=this.vertices[e].position.clone().normalize(),o=this.vertices[g].position.clone().normalize(),q=this.vertices[f].position.clone().normalize(),n=k[i][h+1].clone(),r=k[i][h].clone(),s=k[i+1][h].clone(),t=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[p,o,q])),this.faceVertexUvs[0].push([n,
|
|
|
+s,t])):Math.abs(this.vertices[g].position.y)==a?(this.faces.push(new THREE.Face3(d,e,g,[p,m,o])),this.faceVertexUvs[0].push([n,r,s])):(this.faces.push(new THREE.Face4(d,e,g,f,[p,m,o,q])),this.faceVertexUvs[0].push([n,r,s,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=void 0!==b.height?b.height:50;if(void 0===b.bevelThickness)b.bevelThickness=10;if(void 0===b.bevelSize)b.bevelSize=8;if(void 0===b.bevelEnabled)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
|
-0,e=(""+a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,l,j,k,p,i,o,q,n,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));j=b.length;for(a=0;a<j;)switch(l=b[a++],l){case "m":l=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(l,k));e.moveTo(l,k);break;case "l":l=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(l,
|
|
|
-k));e.lineTo(l,k);break;case "q":l=b[a++]*c+d;k=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(o,q,l,k);if(f=g[g.length-1]){p=f.x;i=f.y;for(f=1,h=this.divisions;f<=h;f++){var t=f/h,w=THREE.Shape.Utils.b2(t,p,o,l),t=THREE.Shape.Utils.b2(t,i,q,k);g.push(new THREE.Vector2(w,t))}}break;case "b":if(l=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(l,k,o,q,n,r),f=g[g.length-1]){p=f.x;i=f.y;for(f=1,h=this.divisions;f<=h;f++)t=f/h,w=THREE.Shape.Utils.b3(t,p,o,
|
|
|
-n,l),t=THREE.Shape.Utils.b3(t,i,q,r,k),g.push(new THREE.Vector2(w,t))}}}return{offset:s.ha*c,points:g,path:e}}}};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var g=[],f=[],h=[],l,j,k;if(0<b(a))for(j=0;j<e;j++)f[j]=j;else for(j=0;j<e;j++)f[j]=e-1-j;var p=2*e;for(j=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}l=j;e<=l&&(l=0);j=l+1;e<=j&&(j=0);k=j+1;e<=k&&(k=0);var i;a:{i=a;var o=l,q=j,n=k,r=e,s=f,t=void 0,w=void 0,u=void 0,v=void 0,z=void 0,
|
|
|
-G=void 0,D=void 0,C=void 0,I=void 0,w=i[s[o]].x,u=i[s[o]].y,v=i[s[q]].x,z=i[s[q]].y,G=i[s[n]].x,D=i[s[n]].y;if(1.0E-10>(v-w)*(D-u)-(z-u)*(G-w))i=!1;else{for(t=0;t<r;t++)if(!(t==o||t==q||t==n)){var C=i[s[t]].x,I=i[s[t]].y,K=void 0,O=void 0,Q=void 0,L=void 0,B=void 0,N=void 0,E=void 0,m=void 0,Y=void 0,F=void 0,y=void 0,S=void 0,K=Q=B=void 0,K=G-v,O=D-z,Q=w-G,L=u-D,B=v-w,N=z-u,E=C-w,m=I-u,Y=C-v,F=I-z,y=C-G,S=I-D,K=K*F-O*Y,B=B*m-N*E,Q=Q*S-L*y;if(0<=K&&0<=Q&&0<=B){i=!1;break a}}i=!0}}if(i){g.push([a[f[l]],
|
|
|
-a[f[j]],a[f[k]]]);h.push([f[l],f[j],f[k]]);for(l=j,k=j+1;k<e;l++,k++)f[l]=f[k];e--;p=2*e}}return d?h:g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
+0,e=(""+a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,j,k,p,m,o,q,n,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,
|
|
|
+k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(o,q,i,k);if(f=g[g.length-1]){p=f.x;m=f.y;for(f=1,h=this.divisions;f<=h;f++){var t=f/h,w=THREE.Shape.Utils.b2(t,p,o,i),t=THREE.Shape.Utils.b2(t,m,q,k);g.push(new THREE.Vector2(w,t))}}break;case "b":if(i=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(i,k,o,q,n,r),f=g[g.length-1]){p=f.x;m=f.y;for(f=1,h=this.divisions;f<=h;f++)t=f/h,w=THREE.Shape.Utils.b3(t,p,o,
|
|
|
+n,i),t=THREE.Shape.Utils.b3(t,m,q,r,k),g.push(new THREE.Vector2(w,t))}}}return{offset:s.ha*c,points:g,path:e}}}};
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var g=[],f=[],h=[],i,j,k;if(0<b(a))for(j=0;j<e;j++)f[j]=j;else for(j=0;j<e;j++)f[j]=e-1-j;var p=2*e;for(j=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);k=j+1;e<=k&&(k=0);var m;a:{m=a;var o=i,q=j,n=k,r=e,s=f,t=void 0,w=void 0,u=void 0,v=void 0,z=void 0,
|
|
|
+G=void 0,D=void 0,C=void 0,I=void 0,w=m[s[o]].x,u=m[s[o]].y,v=m[s[q]].x,z=m[s[q]].y,G=m[s[n]].x,D=m[s[n]].y;if(1.0E-10>(v-w)*(D-u)-(z-u)*(G-w))m=!1;else{for(t=0;t<r;t++)if(!(t==o||t==q||t==n)){var C=m[s[t]].x,I=m[s[t]].y,K=void 0,O=void 0,Q=void 0,L=void 0,B=void 0,N=void 0,E=void 0,l=void 0,Y=void 0,F=void 0,y=void 0,S=void 0,K=Q=B=void 0,K=G-v,O=D-z,Q=w-G,L=u-D,B=v-w,N=z-u,E=C-w,l=I-u,Y=C-v,F=I-z,y=C-G,S=I-D,K=K*F-O*Y,B=B*l-N*E,Q=Q*S-L*y;if(0<=K&&0<=Q&&0<=B){m=!1;break a}}m=!0}}if(m){g.push([a[f[i]],
|
|
|
+a[f[j]],a[f[k]]]);h.push([f[i],f[j],f[k]]);for(i=j,k=j+1;k<e;i++,k++)f[i]=f[k];e--;p=2*e}}return d?h:g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=2*c/this.segmentsR*Math.PI;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
|
|
|
-this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,l=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);l.normal.addSelf(b[e]);l.normal.addSelf(b[g]);l.normal.addSelf(b[f]);l.normal.addSelf(b[h]);l.normal.normalize();this.faces.push(l);
|
|
|
+this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
|
this.faceVertexUvs[0].push([a[e].clone(),a[g].clone(),a[f].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,g,f){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);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=g||3;this.heightScale=f||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 l=2*(a/this.segmentsR)*this.p*Math.PI,f=2*(b/this.segmentsT)*Math.PI,g=h(l,f,this.q,this.p,this.radius,this.heightScale),l=h(l+0.01,f,this.q,this.p,this.radius,this.heightScale);c.sub(l,g);d.add(l,g);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();l=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=l*d.x+f*e.x;g.y+=l*d.y+f*e.y;g.z+=l*d.z+f*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(a=
|
|
|
-0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=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,g));this.faceVertexUvs[0].push([f,l,j,k])}this.computeCentroids();this.computeFaceNormals();
|
|
|
+THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,e,g){var f=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);f*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*g*e*Math.sin(a);return new THREE.Vector3(f,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=g||3;this.heightScale=f||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 i=2*(a/this.segmentsR)*this.p*Math.PI,f=2*(b/this.segmentsT)*Math.PI,g=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);c.sub(i,g);d.add(i,g);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=i*d.x+f*e.x;g.y+=i*d.y+f*e.y;g.z+=i*d.z+f*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(a=
|
|
|
+0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=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,g));this.faceVertexUvs[0].push([f,i,j,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){THREE.Geometry.call(this);this.radius=a||40;this.segments=b||64;this.segmentsRadius=c||8;this.grid=Array(this.segments);this.path=d;if(e)this.debug=new THREE.Object3D;for(var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,f,h,l,b=0;b<this.segments;++b){this.grid[b]=Array(this.segmentsRadius);c=b/this.segments;g=this.path.getPointAt(c);c=this.path.getTangentAt(c);if(void 0===l){l=Number.MAX_VALUE;var j,k,p;h=Math.abs(c.x);f=Math.abs(c.y);
|
|
|
-var i=Math.abs(c.z);h<=l&&(l=h,j=1,p=k=0);f<=l&&(l=f,j=0,k=1,p=0);i<=l&&(k=j=0,p=1);l=new THREE.Vector3(j,k,p)}e.cross(l,c).normalize();d.cross(c,e).normalize();l=d;this.debug&&this.debug.add(new THREE.ArrowHelper(e,g,2*a,16711680));for(c=0;c<this.segmentsRadius;++c)f=2*(c/this.segmentsRadius)*Math.PI,h=-this.radius*Math.cos(f),f=this.radius*Math.sin(f),i=g.clone(),i.x+=h*e.x+f*d.x,i.y+=h*e.y+f*d.y,i.z+=h*e.z+f*d.z,this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(i.x,i.y,i.z)))-
|
|
|
-1}for(b=0;b<this.segments;++b)for(c=0;c<this.segmentsRadius;++c)k=(b+1)%this.segments,p=(c+1)%this.segmentsRadius,a=this.grid[b][c],j=this.grid[k][c],k=this.grid[k][p],p=this.grid[b][p],d=new THREE.UV(b/this.segments,c/this.segmentsRadius),e=new THREE.UV((b+1)/this.segments,c/this.segmentsRadius),g=new THREE.UV((b+1)/this.segments,(c+1)/this.segmentsRadius),l=new THREE.UV(b/this.segments,(c+1)/this.segmentsRadius),this.faces.push(new THREE.Face4(a,j,k,p)),this.faceVertexUvs[0].push([d,e,g,l]);this.computeCentroids();
|
|
|
-this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
|
|
|
-THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=new THREE.Vertex(a.normalize());b.index=l.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 g(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]),d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),d.normal=d.centroid.clone().normalize(),
|
|
|
-l.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),l.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])):(d-=1,g(a,f(a,b),f(a,c),d),g(f(a,b),b,f(b,c),d),g(f(a,c),f(b,c),c,d),g(f(a,b),f(b,c),f(a,c),d))}function f(a,b){p[a.index]||(p[a.index]=[]);p[b.index]||(p[b.index]=[]);var c=p[a.index][b.index];void 0===c&&(p[a.index][b.index]=p[b.index][a.index]=c=e((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.u&&
|
|
|
-(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(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,l=this,j=0,k=a.length;j<k;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var p=[],a=this.vertices,j=0,k=b.length;j<k;j++)g(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].position.multiplyScalar(c);this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.TubeGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||40;this.segments=b||64;this.segmentsRadius=c||8;this.grid=Array(this.segments);this.path=d;if(e)this.debug=new THREE.Object3D;for(var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,f,h,i,b=0;b<this.segments;++b){this.grid[b]=Array(this.segmentsRadius);f=b/(this.segments-1);g=this.path.getPointAt(f);c=this.path.getTangentAt(f);if(void 0===i&&(i=f-0.0010,0>i&&(i=0),i=this.path.getTangentAt(i),
|
|
|
+f+=0.0010,1<f&&(f=1),f=this.path.getTangentAt(f),e.sub(f,i).normalize(),d.cross(c,e),i=d,0==i.length())){f=Number.MAX_VALUE;h=Math.abs(c.x);var j=Math.abs(c.y),k=Math.abs(c.z);h<=f&&(f=h,i.set(1,0,0));j<=f&&(f=j,i.set(0,1,0));k<=f&&i.set(0,0,1)}e.cross(i,c).normalize();d.cross(c,e).normalize();i=d;this.debug&&this.debug.add(new THREE.ArrowHelper(e,g,2*a,16711680));for(c=0;c<this.segmentsRadius;++c)h=2*(c/this.segmentsRadius)*Math.PI,f=-this.radius*Math.cos(h),h=this.radius*Math.sin(h),j=g.clone(),
|
|
|
+j.x+=f*e.x+h*d.x,j.y+=f*e.y+h*d.y,j.z+=f*e.z+h*d.z,this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(j.x,j.y,j.z)))-1}for(b=0;b<this.segments-1;++b)for(c=0;c<this.segmentsRadius;++c)d=(b+1)%this.segments,e=(c+1)%this.segmentsRadius,a=this.grid[b][c],i=this.grid[d][c],d=this.grid[d][e],e=this.grid[b][e],g=new THREE.UV(b/this.segments,c/this.segmentsRadius),f=new THREE.UV((b+1)/this.segments,c/this.segmentsRadius),h=new THREE.UV((b+1)/this.segments,(c+1)/this.segmentsRadius),j=new THREE.UV(b/
|
|
|
+this.segments,(c+1)/this.segmentsRadius),this.faces.push(new THREE.Face4(a,i,d,e)),this.faceVertexUvs[0].push([g,f,h,j]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
|
|
|
+THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=new THREE.Vertex(a.normalize());b.index=i.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 g(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]),d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),d.normal=d.centroid.clone().normalize(),
|
|
|
+i.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),i.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])):(d-=1,g(a,f(a,b),f(a,c),d),g(f(a,b),b,f(b,c),d),g(f(a,c),f(b,c),c,d),g(f(a,b),f(b,c),f(a,c),d))}function f(a,b){p[a.index]||(p[a.index]=[]);p[b.index]||(p[b.index]=[]);var c=p[a.index][b.index];void 0===c&&(p[a.index][b.index]=p[b.index][a.index]=c=e((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.u&&
|
|
|
+(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(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,i=this,j=0,k=a.length;j<k;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var p=[],a=this.vertices,j=0,k=b.length;j<k;j++)g(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].position.multiplyScalar(c);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;
|
|
@@ -599,80 +599,80 @@ this.update(a);this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THR
|
|
|
THREE.CameraHelper.prototype.update=function(a){function b(a,b,g,f){THREE.CameraHelper.__v.set(b,g,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=c.pointMap[a];if(void 0!==a){b=0;for(g=a.length;b<g;b++)c.lineGeometry.vertices[a[b]].position.copy(THREE.CameraHelper.__v)}}var c=this;THREE.CameraHelper.__c.projectionMatrix.copy(a.projectionMatrix);b("c",0,0,-1);b("t",0,0,1);b("n1",-1,-1,-1);b("n2",1,-1,-1);b("n3",-1,1,-1);b("n4",1,1,-1);b("f1",-1,-1,
|
|
|
1);b("f2",1,-1,1);b("f3",-1,1,1);b("f4",1,1,1);b("u1",0.7,1.1,-1);b("u2",-0.7,1.1,-1);b("u3",0,2,-1);b("cf1",-1,0,1);b("cf2",1,0,1);b("cf3",0,-1,1);b("cf4",0,1,1);b("cn1",-1,0,-1);b("cn2",1,0,-1);b("cn3",0,-1,-1);b("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
|
|
|
THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;0<b--;)this.smooth(a)};
|
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,j){var l=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){l.vertexColors=[];for(var k,n,p,o=0;4>o;o++){p=j[o];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<p.length;q++)n=h.vertexColors[p[q]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=p.length;k.g/=p.length;k.b/=p.length;l.vertexColors[o]=k}}e.push(l);(!f.supportUVs||0!=i.length)&&g.push([i[a],i[b],i[c],i[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
-b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,l=h.concat(),j=[],k={},p={},i=[],o,q,n,r,s,t=a.faceVertexUvs[0];for(o=0,q=t.length;o<q;o++)for(n=0,r=t[o].length;n<r;n++)s=d[o]["abcd".charAt(n)],i[s]||(i[s]=t[o][n]);var w;for(o=0,q=d.length;o<q;o++)if(s=d[o],j.push(s.centroid),l.push(new THREE.Vertex(s.centroid)),f.supportUVs&&0!=i.length){w=new THREE.UV;if(s instanceof THREE.Face3)w.u=i[s.a].u+i[s.b].u+i[s.c].u,w.v=i[s.a].v+i[s.b].v+i[s.c].v,w.u/=3,w.v/=3;else if(s instanceof THREE.Face4)w.u=
|
|
|
-i[s.a].u+i[s.b].u+i[s.c].u+i[s.d].u,w.v=i[s.a].v+i[s.b].v+i[s.c].v+i[s.d].v,w.u/=4,w.v/=4;i.push(w)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var u=0,t=h.length,v,z,G={},D={},C=function(a,
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,n,p,o=0;4>o;o++){p=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<p.length;q++)n=h.vertexColors[p[q]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=p.length;k.g/=p.length;k.b/=p.length;j.vertexColors[o]=k}}e.push(j);(!f.supportUVs||0!=m.length)&&g.push([m[a],m[b],m[c],m[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
+b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},p={},m=[],o,q,n,r,s,t=a.faceVertexUvs[0];for(o=0,q=t.length;o<q;o++)for(n=0,r=t[o].length;n<r;n++)s=d[o]["abcd".charAt(n)],m[s]||(m[s]=t[o][n]);var w;for(o=0,q=d.length;o<q;o++)if(s=d[o],j.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),f.supportUVs&&0!=m.length){w=new THREE.UV;if(s instanceof THREE.Face3)w.u=m[s.a].u+m[s.b].u+m[s.c].u,w.v=m[s.a].v+m[s.b].v+m[s.c].v,w.u/=3,w.v/=3;else if(s instanceof THREE.Face4)w.u=
|
|
|
+m[s.a].u+m[s.b].u+m[s.c].u+m[s.d].u,w.v=m[s.a].v+m[s.b].v+m[s.c].v+m[s.d].v,w.u/=4,w.v/=4;m.push(w)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,g,f,h={};for(d=0,e=a.faces.length;d<e;d++)g=a.faces[d],g instanceof THREE.Face3?(f=c(g.a,g.b),b(h,f,d),f=c(g.b,g.c),b(h,f,d),f=c(g.c,g.a),b(h,f,d)):g instanceof THREE.Face4&&(f=c(g.a,g.b),b(h,f,d),f=c(g.b,g.c),b(h,f,d),f=c(g.c,g.d),b(h,f,d),f=c(g.d,g.a),b(h,f,d));return h}(a);var u=0,t=h.length,v,z,G={},D={},C=function(a,
|
|
|
b){void 0===G[a]&&(G[a]=[]);G[a].push(b)},I=function(a,b){void 0===D[a]&&(D[a]={});D[a][b]=null};for(o in q){w=q[o];v=o.split("_");z=v[0];v=v[1];C(z,[z,v]);C(v,[z,v]);for(n=0,r=w.length;n<r;n++)s=w[n],I(z,s,o),I(v,s,o);2>w.length&&(p[o]=!0)}for(o in q)if(w=q[o],s=w[0],w=w[1],v=o.split("_"),z=v[0],v=v[1],r=new THREE.Vector3,p[o]?(r.addSelf(h[z].position),r.addSelf(h[v].position),r.multiplyScalar(0.5)):(r.addSelf(j[s]),r.addSelf(j[w]),r.addSelf(h[z].position),r.addSelf(h[v].position),r.multiplyScalar(0.25)),
|
|
|
-k[o]=t+d.length+u,l.push(new THREE.Vertex(r)),u++,f.supportUVs&&0!=i.length)w=new THREE.UV,w.u=i[z].u+i[v].u,w.v=i[z].v+i[v].v,w.u/=2,w.v/=2,i.push(w);var K,O;v=["123","12","2","23"];r=["123","23","3","31"];var C=["123","31","1","12"],I=["1234","12","2","23"],Q=["1234","23","3","34"],L=["1234","34","4","41"],B=["1234","41","1","12"];for(o=0,q=j.length;o<q;o++)s=d[o],w=t+o,s instanceof THREE.Face3?(u=c(s.a,s.b),z=c(s.b,s.c),K=c(s.c,s.a),b(w,k[u],s.b,k[z],s,v),b(w,k[z],s.c,k[K],s,r),b(w,k[K],s.a,k[u],
|
|
|
-s,C)):s instanceof THREE.Face4?(u=c(s.a,s.b),z=c(s.b,s.c),K=c(s.c,s.d),O=c(s.d,s.a),b(w,k[u],s.b,k[z],s,I),b(w,k[z],s.c,k[K],s,Q),b(w,k[K],s.d,k[O],s,L),b(w,k[O],s.a,k[u],s,B)):console.log("face should be a face!",s);d=l;l=new THREE.Vector3;k=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==G[o]){l.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);w=0;for(n in D[o])l.addSelf(j[n]),w++;u=0;t=G[o].length;for(n=0;n<t;n++)p[c(G[o][n][0],G[o][n][1])]&&u++;if(2!=u){l.divideScalar(w);for(n=0;n<
|
|
|
-t;n++)w=G[o][n],w=h[w[0]].position.clone().addSelf(h[w[1]].position).divideScalar(2),k.addSelf(w);k.divideScalar(t);s.addSelf(h[o].position);s.multiplyScalar(t-3);s.addSelf(l);s.addSelf(k.multiplyScalar(2));s.divideScalar(t);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
+k[o]=t+d.length+u,i.push(new THREE.Vertex(r)),u++,f.supportUVs&&0!=m.length)w=new THREE.UV,w.u=m[z].u+m[v].u,w.v=m[z].v+m[v].v,w.u/=2,w.v/=2,m.push(w);var K,O;v=["123","12","2","23"];r=["123","23","3","31"];var C=["123","31","1","12"],I=["1234","12","2","23"],Q=["1234","23","3","34"],L=["1234","34","4","41"],B=["1234","41","1","12"];for(o=0,q=j.length;o<q;o++)s=d[o],w=t+o,s instanceof THREE.Face3?(u=c(s.a,s.b),z=c(s.b,s.c),K=c(s.c,s.a),b(w,k[u],s.b,k[z],s,v),b(w,k[z],s.c,k[K],s,r),b(w,k[K],s.a,k[u],
|
|
|
+s,C)):s instanceof THREE.Face4?(u=c(s.a,s.b),z=c(s.b,s.c),K=c(s.c,s.d),O=c(s.d,s.a),b(w,k[u],s.b,k[z],s,I),b(w,k[z],s.c,k[K],s,Q),b(w,k[K],s.d,k[O],s,L),b(w,k[O],s.a,k[u],s,B)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==G[o]){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);w=0;for(n in D[o])i.addSelf(j[n]),w++;u=0;t=G[o].length;for(n=0;n<t;n++)p[c(G[o][n][0],G[o][n][1])]&&u++;if(2!=u){i.divideScalar(w);for(n=0;n<
|
|
|
+t;n++)w=G[o][n],w=h[w[0]].position.clone().addSelf(h[w[1]].position).divideScalar(2),k.addSelf(w);k.divideScalar(t);s.addSelf(h[o].position);s.multiplyScalar(t-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(t);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,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(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=
|
|
|
-Math.log(a)/Math.LN2;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=!0};e.crossOrigin=h.crossOrigin;e.src=b}function g(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(1!=f[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=f[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(void 0!==f[h[0]])a[c].wrapS=f[h[0]];if(void 0!==f[h[1]])a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,l="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&
|
|
|
-("Phong"==a.shading?l="MeshPhongMaterial":"Basic"==a.shading&&(l="MeshBasicMaterial"));if(a.blending)if("Additive"==a.blending)j.blending=THREE.AdditiveBlending;else if("Subtractive"==a.blending)j.blending=THREE.SubtractiveBlending;else if("Multiply"==a.blending)j.blending=THREE.MultiplyBlending;if(void 0!==a.transparent||1>a.opacity)j.transparent=a.transparent;if(void 0!==a.depthTest)j.depthTest=a.depthTest;if(void 0!==a.vertexColors)if("face"==a.vertexColors)j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=
|
|
|
+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=!0};e.crossOrigin=h.crossOrigin;e.src=b}function g(a,c,d,g,f,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=d;
|
|
|
+if(g){a[c].repeat.set(g[0],g[1]);if(1!=g[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=g[1])a[c].wrapT=THREE.RepeatWrapping}f&&a[c].offset.set(f[0],f[1]);if(h){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==g[h[0]])a[c].wrapS=g[h[0]];if(void 0!==g[h[1]])a[c].wrapT=g[h[1]]}e(a[c],b+"/"+d)}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&
|
|
|
+("Phong"==a.shading?i="MeshPhongMaterial":"Basic"==a.shading&&(i="MeshBasicMaterial"));if(a.blending)if("Additive"==a.blending)j.blending=THREE.AdditiveBlending;else if("Subtractive"==a.blending)j.blending=THREE.SubtractiveBlending;else if("Multiply"==a.blending)j.blending=THREE.MultiplyBlending;if(void 0!==a.transparent||1>a.opacity)j.transparent=a.transparent;if(void 0!==a.depthTest)j.depthTest=a.depthTest;if(void 0!==a.vertexColors)if("face"==a.vertexColors)j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=
|
|
|
THREE.VertexColors;if(a.colorDiffuse)j.color=f(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=f(a.colorSpecular);if(a.colorAmbient)j.ambient=f(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&g(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&g(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&g(j,"normalMap",
|
|
|
-a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&g(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(l.uniforms);k.tNormal.texture=j.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(j.map)k.tDiffuse.texture=j.map,k.enableDiffuse.value=!0;if(j.specularMap)k.tSpecular.texture=j.specularMap,k.enableSpecular.value=!0;if(j.lightMap)k.tAO.texture=
|
|
|
-j.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(j.color);k.uSpecularColor.value.setHex(j.specular);k.uAmbientColor.value.setHex(j.ambient);k.uShininess.value=j.shininess;if(void 0!==j.opacity)k.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:k,lights:!0,fog:!0})}else j=new THREE[l](j);if(void 0!==a.DbgName)j.name=a.DbgName;return j}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
|
|
|
+a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&g(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var i=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(i.uniforms);k.tNormal.texture=j.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(j.map)k.tDiffuse.texture=j.map,k.enableDiffuse.value=!0;if(j.specularMap)k.tSpecular.texture=j.specularMap,k.enableSpecular.value=!0;if(j.lightMap)k.tAO.texture=
|
|
|
+j.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(j.color);k.uSpecularColor.value.setHex(j.specular);k.uAmbientColor.value.setHex(j.ambient);k.uShininess.value=j.shininess;if(void 0!==j.opacity)k.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:k,lights:!0,fog:!0})}else j=new THREE[i](j);if(void 0!==a.DbgName)j.name=a.DbgName;return j}};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,g){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){var h=JSON.parse(f.responseText);a.loadAjaxBuffers(h,c,e,d,g)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+f.status+"]")};f.open("GET",b,!0);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){4==g.readyState?200==g.status||0==g.status?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+f+"] ["+g.status+"]"):3==g.readyState?e&&(0==h&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):2==g.readyState&&(h=g.getResponseHeader("Content-Length"))};
|
|
|
g.open("GET",f,!0);g.responseType="arraybuffer";g.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,l,j,k,p,i,o,q,n,r,s,t,w,u;function v(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function G(a,b){return(new Uint32Array(a,b,1))[0]}function D(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=E[2*e];e=E[2*e+1];i=E[2*f];j=E[2*f+1];f=E[2*g];k=E[2*g+1];g=L.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 C(b,c){var d,e,f,g,h,i,j,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];i=E[2*e];e=E[2*e+1];j=E[2*f];l=E[2*f+1];k=E[2*g];m=E[2*g+1];g=E[2*h];f=E[2*h+1];h=L.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 I(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],
|
|
|
-L.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[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],L.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function O(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];l=d[3*e+2];i=m[e];var n=N[3*k],o=N[3*k+1];k=N[3*k+2];var p=N[3*l],q=
|
|
|
-N[3*l+1];l=N[3*l+2];L.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(N[3*j],N[3*j+1],N[3*j+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,l)],null,i))}}function Q(b,c,d,e){for(var f,g,h,i,j,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];l=d[4*e+1];m=d[4*e+2];n=d[4*e+3];j=o[e];var p=N[3*l],q=N[3*l+1];l=N[3*l+2];var r=N[3*m],s=N[3*m+1];m=N[3*m+2];var t=N[3*n],u=N[3*n+1];n=N[3*n+2];L.faces.push(new THREE.Face4(f,
|
|
|
-g,h,i,[new THREE.Vector3(N[3*k],N[3*k+1],N[3*k+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,j))}}var L=this,B=0,N=[],E=[],m,Y,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(L,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d})(a,B,12);c=z(a,B+12);z(a,B+13);z(a,B+14);z(a,B+15);e=z(a,B+16);l=z(a,B+17);j=z(a,B+18);k=z(a,B+19);p=G(a,B+20);i=G(a,B+20+4);o=G(a,B+20+8);b=G(a,B+20+12);q=
|
|
|
-G(a,B+20+16);n=G(a,B+20+20);r=G(a,B+20+24);s=G(a,B+20+28);t=G(a,B+20+32);w=G(a,B+20+36);u=G(a,B+20+40);B+=c;c=3*e+k;F=4*e+k;m=b*c;Y=q*(c+3*l);e=n*(c+3*j);k=r*(c+3*l+3*j);c=s*F;l=t*(F+4*l);j=w*(F+4*j);B+=function(b){var b=new Float32Array(a,b,3*p),c,d,e,f;for(c=0;c<p;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],L.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*p*Float32Array.BYTES_PER_ELEMENT}(B);B+=function(b){if(i){var b=new Int8Array(a,b,3*i),c,d,e,f;for(c=0;c<i;c++)d=b[3*c],e=b[3*c+1],
|
|
|
-f=b[3*c+2],N.push(d/127,e/127,f/127)}return 3*i*Int8Array.BYTES_PER_ELEMENT}(B);B+=v(3*i);B+=function(b){if(o){var b=new Float32Array(a,b,2*o),c,d,e;for(c=0;c<o;c++)d=b[2*c],e=b[2*c+1],E.push(d,e)}return 2*o*Float32Array.BYTES_PER_ELEMENT}(B);m=B+m+v(2*b);Y=m+Y+v(2*q);e=Y+e+v(2*n);k=e+k+v(2*r);c=k+c+v(2*s);l=c+l+v(2*t);j=l+j+v(2*w);(function(a){if(n){var b=a+3*n*Uint32Array.BYTES_PER_ELEMENT;I(n,a,b+3*n*Uint32Array.BYTES_PER_ELEMENT);D(n,b)}})(Y);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT,
|
|
|
-c=b+3*r*Uint32Array.BYTES_PER_ELEMENT;O(r,a,b,c+3*r*Uint32Array.BYTES_PER_ELEMENT);D(r,c)}})(e);(function(a){if(w){var b=a+4*w*Uint32Array.BYTES_PER_ELEMENT;K(w,a,b+4*w*Uint32Array.BYTES_PER_ELEMENT);C(w,b)}})(l);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT,c=b+4*u*Uint32Array.BYTES_PER_ELEMENT;Q(u,a,b,c+4*u*Uint32Array.BYTES_PER_ELEMENT);C(u,c)}})(j);b&&I(b,B,B+3*b*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(q){var b=a+3*q*Uint32Array.BYTES_PER_ELEMENT;O(q,a,b,b+3*q*Uint32Array.BYTES_PER_ELEMENT)}})(m);
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,k,p,m,o,q,n,r,s,t,w,u;function v(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function G(a,b){return(new Uint32Array(a,b,1))[0]}function D(b,c){var d,e,g,f,h,i,j,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[3*d];g=m[3*d+1];f=m[3*d+2];h=E[2*e];e=E[2*e+1];i=E[2*g];j=E[2*g+1];g=E[2*f];k=E[2*f+1];f=L.faceVertexUvs[0];var l=[];l.push(new THREE.UV(h,e));l.push(new THREE.UV(i,j));l.push(new THREE.UV(g,
|
|
|
+k));f.push(l)}}function C(b,c){var d,e,g,f,h,i,j,k,m,l,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];g=n[4*d+1];f=n[4*d+2];h=n[4*d+3];i=E[2*e];e=E[2*e+1];j=E[2*g];m=E[2*g+1];k=E[2*f];l=E[2*f+1];f=E[2*h];g=E[2*h+1];h=L.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,e));o.push(new THREE.UV(j,m));o.push(new THREE.UV(k,l));o.push(new THREE.UV(f,g));h.push(o)}}function I(b,c,d){for(var e,g,f,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],g=c[3*d+1],f=c[3*d+2],h=i[d],
|
|
|
+L.faces.push(new THREE.Face3(e,g,f,null,null,h))}function K(b,c,d){for(var e,g,f,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],g=c[4*d+1],f=c[4*d+2],h=c[4*d+3],i=j[d],L.faces.push(new THREE.Face4(e,g,f,h,null,null,i))}function O(b,c,d,e){for(var g,f,h,i,j,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),l=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[3*e];f=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];m=d[3*e+2];i=l[e];var n=N[3*k],o=N[3*k+1];k=N[3*k+2];var p=N[3*m],q=
|
|
|
+N[3*m+1];m=N[3*m+2];L.faces.push(new THREE.Face3(g,f,h,[new THREE.Vector3(N[3*j],N[3*j+1],N[3*j+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,m)],null,i))}}function Q(b,c,d,e){for(var g,f,h,i,j,k,m,l,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++){g=c[4*e];f=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];m=d[4*e+1];l=d[4*e+2];n=d[4*e+3];j=o[e];var p=N[3*m],q=N[3*m+1];m=N[3*m+2];var r=N[3*l],s=N[3*l+1];l=N[3*l+2];var t=N[3*n],u=N[3*n+1];n=N[3*n+2];L.faces.push(new THREE.Face4(g,
|
|
|
+f,h,i,[new THREE.Vector3(N[3*k],N[3*k+1],N[3*k+2]),new THREE.Vector3(p,q,m),new THREE.Vector3(r,s,l),new THREE.Vector3(t,u,n)],null,j))}}var L=this,B=0,N=[],E=[],l,Y,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(L,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d})(a,B,12);c=z(a,B+12);z(a,B+13);z(a,B+14);z(a,B+15);e=z(a,B+16);i=z(a,B+17);j=z(a,B+18);k=z(a,B+19);p=G(a,B+20);m=G(a,B+20+4);o=G(a,B+20+8);b=G(a,B+20+12);q=
|
|
|
+G(a,B+20+16);n=G(a,B+20+20);r=G(a,B+20+24);s=G(a,B+20+28);t=G(a,B+20+32);w=G(a,B+20+36);u=G(a,B+20+40);B+=c;c=3*e+k;F=4*e+k;l=b*c;Y=q*(c+3*i);e=n*(c+3*j);k=r*(c+3*i+3*j);c=s*F;i=t*(F+4*i);j=w*(F+4*j);B+=function(b){var b=new Float32Array(a,b,3*p),c,d,e,g;for(c=0;c<p;c++)d=b[3*c],e=b[3*c+1],g=b[3*c+2],L.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return 3*p*Float32Array.BYTES_PER_ELEMENT}(B);B+=function(b){if(m){var b=new Int8Array(a,b,3*m),c,d,e,g;for(c=0;c<m;c++)d=b[3*c],e=b[3*c+1],
|
|
|
+g=b[3*c+2],N.push(d/127,e/127,g/127)}return 3*m*Int8Array.BYTES_PER_ELEMENT}(B);B+=v(3*m);B+=function(b){if(o){var b=new Float32Array(a,b,2*o),c,d,e;for(c=0;c<o;c++)d=b[2*c],e=b[2*c+1],E.push(d,e)}return 2*o*Float32Array.BYTES_PER_ELEMENT}(B);l=B+l+v(2*b);Y=l+Y+v(2*q);e=Y+e+v(2*n);k=e+k+v(2*r);c=k+c+v(2*s);i=c+i+v(2*t);j=i+j+v(2*w);(function(a){if(n){var b=a+3*n*Uint32Array.BYTES_PER_ELEMENT;I(n,a,b+3*n*Uint32Array.BYTES_PER_ELEMENT);D(n,b)}})(Y);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT,
|
|
|
+c=b+3*r*Uint32Array.BYTES_PER_ELEMENT;O(r,a,b,c+3*r*Uint32Array.BYTES_PER_ELEMENT);D(r,c)}})(e);(function(a){if(w){var b=a+4*w*Uint32Array.BYTES_PER_ELEMENT;K(w,a,b+4*w*Uint32Array.BYTES_PER_ELEMENT);C(w,b)}})(i);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT,c=b+4*u*Uint32Array.BYTES_PER_ELEMENT;Q(u,a,b,c+4*u*Uint32Array.BYTES_PER_ELEMENT);C(u,c)}})(j);b&&I(b,B,B+3*b*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(q){var b=a+3*q*Uint32Array.BYTES_PER_ELEMENT;O(q,a,b,b+3*q*Uint32Array.BYTES_PER_ELEMENT)}})(l);
|
|
|
s&&K(s,k,k+4*s*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT;Q(t,a,b,b+4*t*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
THREE.ColladaLoader=function(){function a(a,d,e){T=a;d=d||Ua;void 0!==e&&(a=e.split("/"),a.pop(),db=(1>a.length?".":a.join("/"))+"/");if((a=T.evaluate("//dae:asset",T,y,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":sa=i.textContent.charAt(0)}}if(!Oa.convertUpAxis||sa===Oa.upAxis)Wa=null;else switch(sa){case "X":Wa="Y"===
|
|
|
Oa.upAxis?"XtoY":"XtoZ";break;case "Y":Wa="X"===Oa.upAxis?"YtoX":"YtoZ";break;case "Z":Wa="X"===Oa.upAxis?"ZtoX":"ZtoY"}oa=b("//dae:library_images/dae:image",f,"image");bb=b("//dae:library_materials/dae:material",D,"material");jb=b("//dae:library_effects/dae:effect",Q,"effect");ka=b("//dae:library_geometries/dae:geometry",r,"geometry");Va=b(".//dae:library_cameras/dae:camera",Y,"camera");Aa=b("//dae:library_controllers/dae:controller",h,"controller");Fa=b("//dae:library_animations/dae:animation",
|
|
|
B,"animation");eb=b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");Ga=[];ra=[];(a=T.evaluate(".//dae:scene/dae:instance_visual_scene",T,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),da=eb[0<a.length?a:"visual_scene0"]):da=null;aa=new THREE.Object3D;for(a=0;a<da.nodes.length;a++)aa.add(g(da.nodes[a]));cb=[];c(aa);a={scene:aa,morphs:Ga,skins:ra,animations:cb,dae:{images:oa,materials:bb,cameras:Va,effects:jb,geometries:ka,controllers:Aa,
|
|
|
-animations:Fa,visualScenes:eb,scene:da}};d&&d(a);return a}function b(a,b,c){for(var a=T.evaluate(a,T,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=da.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};cb.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=Aa[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 Fa)for(var i=Fa[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=da.getChildById(b.skeleton[0],!0)||da.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,
|
|
|
-j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++)if(l=j[m],n=-1,"JOINT"==l.type){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(0<=n){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=
|
|
|
-0;p<k.weights[o].length;p++){var q=k.weights[o][p];q.joint==n&&l.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function g(a){var b=
|
|
|
+animations:Fa,visualScenes:eb,scene:da}};d&&d(a);return a}function b(a,b,c){for(var a=T.evaluate(a,T,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),g=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+g++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=da.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};cb.push(d);for(var e=0,g=b.keys.length;e<g;e++)d.length=Math.max(d.length,
|
|
|
+b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(g=a.children.length;e<g;e++)for(var b=0,f=c(a.children[e]).hierarchy.length;b<f;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 g=a.channels[0].sampler.output[c];g instanceof THREE.Matrix4&&a.world.copy(g)}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,
|
|
|
+g=Aa[b.url];if(!g||!g.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,f=-c,h=0;for(e in Fa)for(var i=Fa[e],j=0;j<i.sampler.length;j++){var m=i.sampler[j];m.create();c=Math.min(c,m.startTime);f=Math.max(f,m.endTime);h=Math.max(h,m.input.length)}e=h;for(var b=da.getChildById(b.skeleton[0],!0)||da.getChildBySid(b.skeleton[0],!0),k,l,f=new THREE.Vector3,n,
|
|
|
+j=0;j<a.vertices.length;j++)g.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;m=g.skin;for(l=0;l<j.length;l++)if(k=j[l],n=-1,"JOINT"==k.type){for(var o=0;o<m.joints.length;o++)if(k.sid==m.joints[o]){n=o;break}if(0<=n){o=m.invBindMatrices[n];k.invBindMatrix=o;k.skinningMatrix=new THREE.Matrix4;k.skinningMatrix.multiply(k.world,o);k.weights=[];for(o=0;o<m.weights.length;o++)for(var p=
|
|
|
+0;p<m.weights[o].length;p++){var q=m.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("JOINT"==h[j].type)for(m=0;m<h[j].weights.length;m++)k=h[j].weights[m],l=k.index,k=k.weight,n=a.vertices[l],l=i[l],f.x=n.position.x,f.y=n.position.y,f.z=n.position.z,h[j].skinningMatrix.multiplyVector3(f),l.position.x+=f.x*k,l.position.y+=f.y*k,l.position.z+=f.z*k;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function g(a){var b=
|
|
|
new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=Aa[a.controllers[f].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(Aa[i.skin.source]&&(d=i=Aa[i.skin.source],i.morph&&ka[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new n,
|
|
|
-j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ka[i.url],k={},l=[],m=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=bb[p.target],r=jb[q.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;
|
|
|
-k[p.symbol]=m;l.push(r.material);p=r.material;p.name=null==q.name||""===q.name?q.id:q.name;m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(1<m){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=Aa[c.url],j.skinInstanceController=c,j.name="skin_"+ra.length,ra.push(j);
|
|
|
-else if(void 0!==d){h=i;k=d instanceof o?Aa[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(m=ka[k.targets[l]],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=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Ga.length;Ga.push(j)}else j=
|
|
|
+j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ka[i.url],k={},m=[],l=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=bb[p.target],r=jb[q.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;
|
|
|
+k[p.symbol]=l;m.push(r.material);p=r.material;p.name=null==q.name||""===q.name?q.id:q.name;l++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(1<l){j=new THREE.MeshFaceMaterial;i.materials=m;for(h=0;h<i.faces.length;h++)m=i.faces[h],m.materialIndex=k[m.daeMaterial]}if(void 0!==c)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=Aa[c.url],j.skinInstanceController=c,j.name="skin_"+ra.length,ra.push(j);
|
|
|
+else if(void 0!==d){h=i;k=d instanceof o?Aa[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(m=0;m<k.targets.length;m++)if(l=ka[k.targets[m]],l.mesh&&l.mesh.primitives&&l.mesh.primitives.length)l=l.mesh.primitives[0].geometry,l.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:l.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Ga.length;Ga.push(j)}else j=
|
|
|
new THREE.Mesh(i,j);1<a.geometries.length?b.add(j):b=j}}for(f=0;f<a.cameras.length;f++)b=Va[a.cameras[f].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;f=a.matrix.decompose();b.position=f[0];b.quaternion=f[1];b.useQuaternion=!0;b.scale=f[2];Oa.centerGeometry&&b.geometry&&(f=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(f.multiplySelf(b.scale)),b.position.subSelf(f));for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));
|
|
|
-return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function l(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=
|
|
|
-[];this.matrix=new THREE.Matrix4}function i(){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 s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}
|
|
|
+return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function 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 s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}
|
|
|
function u(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function z(){this.semantic="";this.offset=0;this.source="";this.set=0}function G(a){this.id=a;this.type=null}function D(){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 I(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=
|
|
|
a;this.format=this.init_from=null}function O(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function L(){this.url=""}function B(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function N(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function E(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 m(a){this.targets=[];this.time=a}function Y(){this.name=this.id=""}function F(){this.url=""}function y(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function S(a){for(var a=Z(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function P(a){for(var a=Z(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function Z(a){return 0<
|
|
|
+a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function l(a){this.targets=[];this.time=a}function Y(){this.name=this.id=""}function F(){this.url=""}function y(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function S(a){for(var a=Z(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function P(a){for(var a=Z(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function Z(a){return 0<
|
|
|
a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function ja(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function ha(a,b){if(Oa.convertUpAxis&&sa!==Oa.upAxis)switch(Wa){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 R(a,b){var c=
|
|
|
[a[b],a[b+1],a[b+2]];ha(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function $(a){if(Oa.convertUpAxis){var b=[a[0],a[4],a[8]];ha(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];ha(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];ha(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];ha(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];ha(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];ha(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];ha(b,-1);a[3]=b[0];
|
|
|
a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var T=null,aa=null,da,Ua=null,Ia={},oa={},Fa={},Aa={},ka={},bb={},jb={},Va={},cb,eb,db,Ga,ra,Ba=THREE.SmoothShading,Oa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},sa="Y",Wa=null,mb=Math.PI/180;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=
|
|
|
-c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new j).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new l).parse(c),this.type=c.nodeName}}return this};l.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
|
|
|
-0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new G).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};l.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new z).parse(d))}}return b};
|
|
|
+c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new j).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
|
|
|
+0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new G).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new z).parse(d))}}return b};
|
|
|
j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=S(f.textContent);this.bindShapeMatrix=$(f);break;case "source":f=(new G).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,
|
|
|
b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new z).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new z).parse(g));break;
|
|
|
-case "v":c=P(g.textContent);break;case "vcount":d=P(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};
|
|
|
+case "v":c=P(g.textContent);break;case "vcount":d=P(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},m=0;m<e.length;m++){var l=e[m],n=c[g+l.offset];switch(l.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[l.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};
|
|
|
k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],
|
|
|
d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=
|
|
|
function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type="JOINT"==this.type?this.type:
|
|
|
"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":this.cameras.push((new F).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=T.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",T,y,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 i).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Fa)for(var e=Fa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],
|
|
|
+case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=T.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",T,y,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 Fa)for(var e=Fa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],
|
|
|
h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Oa.convertUpAxis)switch(g){case "X":switch(Wa){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(Wa){case "XtoY":case "YtoX":case "ZtoX":g="X";
|
|
|
-break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(Wa){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,j=h.input,k=this.getTransformBySid(b.sid);if(k){-1===a.indexOf(f)&&a.push(f);b=0;for(var l=j.length;b<l;b++){var q=j[b],r=h.getData(k.type,b),s;s=null;for(var t=0,u=d.length;t<u&&null==s;t++){var v=d[t];if(v.time===q)s=v;else if(v.time>q)break}if(!s){s=new m(q);t=-1;u=0;for(v=d.length;u<v&&-1==t;u++)d[u].time>=q&&(t=u);q=t;d.splice(-1==q?d.length:
|
|
|
-q,0,s)}s.addTarget(f,k,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(s=d[b],!s.hasTarget(e)){h=d;f=s;k=b;g=e;j=void 0;a:{j=k?k-1:0;for(j=0<=j?j:j+h.length;0<=j;j--)if(l=h[j],l.hasTarget(g)){j=l;break a}j=null}l=void 0;a:{for(k+=1;k<h.length;k++)if(l=h[k],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;r=void 0;if(l.length){r=[];for(q=0;q<
|
|
|
-l.length;++q)r[q]=l[q]+(k[q]-l[q])*h}else r=l+(k-l)*h;f.addTarget(g,j.transform,j.member,r)}}}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)};i.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=S(a.textContent);this.convert();return this};i.prototype.convert=function(){switch(this.type){case "matrix":this.obj=$(this.data);
|
|
|
-break;case "rotate":this.angle=this.data[3]*mb;case "translate":ha(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":ha(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)}};i.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)}};i.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=
|
|
|
+break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(Wa){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var q=i[b],r=h.getData(j.type,b),s;s=null;for(var t=0,u=d.length;t<u&&null==s;t++){var v=d[t];if(v.time===q)s=v;else if(v.time>q)break}if(!s){s=new l(q);t=-1;u=0;for(v=d.length;u<v&&-1==t;u++)d[u].time>=q&&(t=u);q=t;d.splice(-1==q?d.length:
|
|
|
+q,0,s)}s.addTarget(f,j,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(s=d[b],!s.hasTarget(e)){h=d;f=s;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;r=void 0;if(k.length){r=[];for(q=0;q<
|
|
|
+k.length;++q)r[q]=k[q]+(j[q]-k[q])*h}else r=k+(j-k)*h;f.addTarget(g,i.transform,i.member,r)}}}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=S(a.textContent);this.convert();return this};m.prototype.convert=function(){switch(this.type){case "matrix":this.obj=$(this.data);
|
|
|
+break;case "rotate":this.angle=this.data[3]*mb;case "translate":ha(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":ha(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){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=
|
|
|
a*mb;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*mb}}};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=T.evaluate(".//dae:instance_material",c,y,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(1==c.nodeType&&"bind_material"==c.nodeName){if(a=T.evaluate(".//dae:instance_material",c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new s(this)).parse(c)}}return this};s.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==Ia[d]&&(Ia[d]=
|
|
|
(new G(d)).parse(c));break;case "vertices":this.vertices=(new v).parse(c);break;case "triangles":this.primitives.push((new w).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=Ia[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(R(a,b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),
|
|
|
-this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=0,o=[];for(d=0;d<g.length;d++){h=g[d];var p=h.offset+1,n=n<p?p:n;switch(h.semantic){case "TEXCOORD":o.push(h.set)}}for(;c<f.length;){var q=
|
|
|
-[],r=[],p={},s=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Ia[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":q.push(i);break;case "NORMAL":r.push(R(k.data,j));break;case "TEXCOORD":void 0===p[h.set]&&(p[h.set]=[]);p[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(0==r.length)if(h=this.vertices.input.NORMAL){k=Ia[h.source];
|
|
|
-j=k.accessor.params.length;h=0;for(i=q.length;h<i;h++)r.push(R(k.data,q[h]*j))}else b.calcNormals=!0;if(3===m)d.push(new THREE.Face3(q[0],q[1],q[2],r,s.length?s:new THREE.Color));else if(4===m)d.push(new THREE.Face4(q[0],q[1],q[2],q[3],r,s.length?s:new THREE.Color));else if(4<m&&Oa.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(q[0],q[e],q[e+1],[r[0],r[e++],r[e]],s))}if(d.length){h=0;for(i=d.length;h<i;h++){e=d[h];e.daeMaterial=a.material;b.faces.push(e);for(e=
|
|
|
-0;e<o.length;e++)q=p[o[e]],q=4<m?[q[0],q[h+1],q[h+2]]:4===m?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=n*m}};t.prototype=new w;t.prototype.constructor=t;w.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};w.prototype.parse=function(a){this.inputs=[];this.material=
|
|
|
+this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,m=0,l=3,n=0,o=[];for(d=0;d<g.length;d++){h=g[d];var p=h.offset+1,n=n<p?p:n;switch(h.semantic){case "TEXCOORD":o.push(h.set)}}for(;c<f.length;){var q=
|
|
|
+[],r=[],p={},s=[];a.vcount&&(l=a.vcount[m++]);for(d=0;d<l;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Ia[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":q.push(i);break;case "NORMAL":r.push(R(k.data,j));break;case "TEXCOORD":void 0===p[h.set]&&(p[h.set]=[]);p[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(0==r.length)if(h=this.vertices.input.NORMAL){k=Ia[h.source];
|
|
|
+j=k.accessor.params.length;h=0;for(i=q.length;h<i;h++)r.push(R(k.data,q[h]*j))}else b.calcNormals=!0;if(3===l)d.push(new THREE.Face3(q[0],q[1],q[2],r,s.length?s:new THREE.Color));else if(4===l)d.push(new THREE.Face4(q[0],q[1],q[2],q[3],r,s.length?s:new THREE.Color));else if(4<l&&Oa.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<l-1;)d.push(new THREE.Face3(q[0],q[e],q[e+1],[r[0],r[e++],r[e]],s))}if(d.length){h=0;for(i=d.length;h<i;h++){e=d[h];e.daeMaterial=a.material;b.faces.push(e);for(e=
|
|
|
+0;e<o.length;e++)q=p[o[e]],q=4<l?[q[0],q[h+1],q[h+2]]:4===l?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+l+" for geometry with id: "+b.id);c+=n*l}};t.prototype=new w;t.prototype.constructor=t;w.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};w.prototype.parse=function(a){this.inputs=[];this.material=
|
|
|
a.getAttribute("material");this.count=ja(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new z).parse(a.childNodes[b]));break;case "vcount":this.vcount=P(c.textContent);break;case "p":this.p=P(c.textContent)}}return this};u.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=ja(a,"count",0);this.stride=ja(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==
|
|
|
c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new z).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};z.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=ja(a,"set",-1);this.offset=ja(a,"offset",0);
|
|
|
if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};G.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=Z(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=S(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=P(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=
|
|
@@ -690,8 +690,8 @@ Q.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){va
|
|
|
if(1==c.nodeType)switch(c.nodeName){case "source":c=(new G).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new E(this)).parse(c));break;case "channel":this.channel.push((new N(this)).parse(c))}}return this};N.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();
|
|
|
else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new z).parse(c))}}return this};E.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}};E.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":ha(c,-1);break;case "scale":ha(c,1)}}else c=this.output[b];return c};m.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};m.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)}};m.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};m.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};m.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/
|
|
|
+this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};E.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":ha(c,-1);break;case "scale":ha(c,1)}}else c=this.output[b];return c};l.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};l.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)}};l.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};l.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};l.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/
|
|
|
(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};Y.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(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};Y.prototype.parseOptics=
|
|
|
function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if("perspective"==c.childNodes[d].nodeName)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};F.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(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(Ua=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),
|
|
@@ -699,46 +699,46 @@ d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else
|
|
|
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 g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState===g.DONE)if(200===g.status||0===g.status){if(g.responseText){var h=JSON.parse(g.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+"] ["+g.status+"]");else g.readyState===g.LOADING?e&&(0===f&&(f=g.getResponseHeader("Content-Length")),
|
|
|
e({total:f,loaded:g.responseText.length})):g.readyState===g.HEADERS_RECEIVED&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,l,j,k,p,i,o,q,n,r,s,t,w,u=a.faces;p=a.vertices;var v=a.normals,z=a.colors,G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=p.length;j<k;)i=new THREE.Vertex,i.position.x=p[j++]*b,i.position.y=p[j++]*b,i.position.z=p[j++]*b,d.vertices.push(i);j=0;for(k=u.length;j<k;){b=
|
|
|
-u[j++];p=b&1;l=b&2;c=b&4;e=b&8;o=b&16;i=b&32;n=b&64;b&=128;p?(r=new THREE.Face4,r.a=u[j++],r.b=u[j++],r.c=u[j++],r.d=u[j++],p=4):(r=new THREE.Face3,r.a=u[j++],r.b=u[j++],r.c=u[j++],p=3);if(l)l=u[j++],r.materialIndex=l;l=d.faces.length;if(c)for(c=0;c<G;c++)s=a.uvs[c],q=u[j++],w=s[2*q],q=s[2*q+1],d.faceUvs[c][l]=new THREE.UV(w,q);if(e)for(c=0;c<G;c++){s=a.uvs[c];t=[];for(e=0;e<p;e++)q=u[j++],w=s[2*q],q=s[2*q+1],t[e]=new THREE.UV(w,q);d.faceVertexUvs[c][l]=t}if(o)o=3*u[j++],e=new THREE.Vector3,e.x=v[o++],
|
|
|
-e.y=v[o++],e.z=v[o],r.normal=e;if(i)for(c=0;c<p;c++)o=3*u[j++],e=new THREE.Vector3,e.x=v[o++],e.y=v[o++],e.z=v[o],r.vertexNormals.push(e);if(n)i=u[j++],i=new THREE.Color(z[i]),r.color=i;if(b)for(c=0;c<p;c++)i=u[j++],i=new THREE.Color(z[i]),r.vertexColors.push(i);d.faces.push(r)}})(e);(function(){var b,c,e,l;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=2)e=a.skinWeights[b],l=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,l,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<
|
|
|
-c;b+=2)e=a.skinIndices[b],l=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,l,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,l,j,k,p,i,o,q;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;q=a.morphTargets[c].vertices;for(l=0,j=q.length;l<j;l+=3)k=q[l]*b,p=q[l+1]*b,i=q[l+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(k,p,
|
|
|
-i)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,l=k.length;b<l;b+=3)p=new THREE.Color(16755200),p.setRGB(k[b],k[b+1],k[b+2]),j.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=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,j,k,p,m,o,q,n,r,s,t,w,u=a.faces;p=a.vertices;var v=a.normals,z=a.colors,G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=p.length;j<k;)m=new THREE.Vertex,m.position.x=p[j++]*b,m.position.y=p[j++]*b,m.position.z=p[j++]*b,d.vertices.push(m);j=0;for(k=u.length;j<k;){b=
|
|
|
+u[j++];p=b&1;i=b&2;c=b&4;e=b&8;o=b&16;m=b&32;n=b&64;b&=128;p?(r=new THREE.Face4,r.a=u[j++],r.b=u[j++],r.c=u[j++],r.d=u[j++],p=4):(r=new THREE.Face3,r.a=u[j++],r.b=u[j++],r.c=u[j++],p=3);if(i)i=u[j++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<G;c++)s=a.uvs[c],q=u[j++],w=s[2*q],q=s[2*q+1],d.faceUvs[c][i]=new THREE.UV(w,q);if(e)for(c=0;c<G;c++){s=a.uvs[c];t=[];for(e=0;e<p;e++)q=u[j++],w=s[2*q],q=s[2*q+1],t[e]=new THREE.UV(w,q);d.faceVertexUvs[c][i]=t}if(o)o=3*u[j++],e=new THREE.Vector3,e.x=v[o++],
|
|
|
+e.y=v[o++],e.z=v[o],r.normal=e;if(m)for(c=0;c<p;c++)o=3*u[j++],e=new THREE.Vector3,e.x=v[o++],e.y=v[o++],e.z=v[o],r.vertexNormals.push(e);if(n)m=u[j++],m=new THREE.Color(z[m]),r.color=m;if(b)for(c=0;c<p;c++)m=u[j++],m=new THREE.Color(z[m]),r.vertexColors.push(m);d.faces.push(r)}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<
|
|
|
+c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,i,j,k,p,m,o,q;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;q=a.morphTargets[c].vertices;for(i=0,j=q.length;i<j;i+=3)k=q[i]*b,p=q[i+1]*b,m=q[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(k,p,
|
|
|
+m)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,i=k.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(k[b],k[b+1],k[b+2]),j.push(p)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status){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,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
|
|
|
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:j+"/"+a}function e(){var a;for(i in L.objects)if(!F.objects[i])if(s=L.objects[i],void 0!==s.geometry){if(I=F.geometries[s.geometry]){a=!1;K=F.materials[s.materials[0]];(a=K instanceof THREE.ShaderMaterial)&&I.computeTangents();u=s.position;v=s.rotation;z=s.quaternion;G=s.scale;z=0;0==s.materials.length&&(K=new THREE.MeshFaceMaterial);1<s.materials.length&&(K=new THREE.MeshFaceMaterial);a=new THREE.Mesh(I,
|
|
|
-K);a.name=i;a.position.set(u[0],u[1],u[2]);z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]);a.scale.set(G[0],G[1],G[2]);a.visible=s.visible;F.scene.add(a);F.objects[i]=a;if(s.castsShadow){var b=new THREE.ShadowVolume(I);F.scene.add(b);b.position=a.position;b.rotation=a.rotation;b.scale=a.scale}s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},F.triggers[a.name]=b)}}else u=s.position,v=s.rotation,z=s.quaternion,G=s.scale,z=0,a=new THREE.Object3D,
|
|
|
-a.name=i,a.position.set(u[0],u[1],u[2]),z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(G[0],G[1],G[2]),a.visible=void 0!==s.visible?s.visible:!1,F.scene.add(a),F.objects[i]=a,F.empties[i]=a,s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},F.triggers[a.name]=b)}function g(a){return function(b){F.geometries[a]=b;e();N-=1;l.onLoadComplete();h()}}function f(a){return function(b){F.geometries[a]=b}}function h(){l.callbackProgress({totalModels:m,
|
|
|
-totalTextures:Y,loadedModels:m-N,loadedTextures:Y-E},F);l.onLoadProgress();0==N&&0==E&&b(F)}var l=this,j=THREE.Loader.prototype.extractUrlBase(c),k,p,i,o,q,n,r,s,t,w,u,v,z,G,D,C,I,K,O,Q,L,B,N,E,m,Y,F;L=a;c=new THREE.BinaryLoader;B=new THREE.JSONLoader;E=N=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};if(L.transform)a=L.transform.position,t=L.transform.rotation,D=L.transform.scale,a&&F.scene.position.set(a[0],a[1],
|
|
|
-a[2]),t&&F.scene.rotation.set(t[0],t[1],t[2]),D&&F.scene.scale.set(D[0],D[1],D[2]),(a||t||D)&&F.scene.updateMatrix();a=function(){E-=1;h();l.onLoadComplete()};for(q in L.cameras)D=L.cameras[q],"perspective"==D.type?O=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):"ortho"==D.type&&(O=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far)),u=D.position,t=D.target,D=D.up,O.position.set(u[0],u[1],u[2]),O.target=new THREE.Vector3(t[0],t[1],t[2]),D&&O.up.set(D[0],D[1],D[2]),
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:j+"/"+a}function e(){var a;for(m in L.objects)if(!F.objects[m])if(s=L.objects[m],void 0!==s.geometry){if(I=F.geometries[s.geometry]){a=!1;K=F.materials[s.materials[0]];(a=K instanceof THREE.ShaderMaterial)&&I.computeTangents();u=s.position;v=s.rotation;z=s.quaternion;G=s.scale;z=0;0==s.materials.length&&(K=new THREE.MeshFaceMaterial);1<s.materials.length&&(K=new THREE.MeshFaceMaterial);a=new THREE.Mesh(I,
|
|
|
+K);a.name=m;a.position.set(u[0],u[1],u[2]);z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]);a.scale.set(G[0],G[1],G[2]);a.visible=s.visible;F.scene.add(a);F.objects[m]=a;if(s.castsShadow){var b=new THREE.ShadowVolume(I);F.scene.add(b);b.position=a.position;b.rotation=a.rotation;b.scale=a.scale}s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},F.triggers[a.name]=b)}}else u=s.position,v=s.rotation,z=s.quaternion,G=s.scale,z=0,a=new THREE.Object3D,
|
|
|
+a.name=m,a.position.set(u[0],u[1],u[2]),z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(G[0],G[1],G[2]),a.visible=void 0!==s.visible?s.visible:!1,F.scene.add(a),F.objects[m]=a,F.empties[m]=a,s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},F.triggers[a.name]=b)}function g(a){return function(b){F.geometries[a]=b;e();N-=1;i.onLoadComplete();h()}}function f(a){return function(b){F.geometries[a]=b}}function h(){i.callbackProgress({totalModels:l,
|
|
|
+totalTextures:Y,loadedModels:l-N,loadedTextures:Y-E},F);i.onLoadProgress();0==N&&0==E&&b(F)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),k,p,m,o,q,n,r,s,t,w,u,v,z,G,D,C,I,K,O,Q,L,B,N,E,l,Y,F;L=a;c=new THREE.BinaryLoader;B=new THREE.JSONLoader;E=N=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};if(L.transform)a=L.transform.position,t=L.transform.rotation,D=L.transform.scale,a&&F.scene.position.set(a[0],a[1],
|
|
|
+a[2]),t&&F.scene.rotation.set(t[0],t[1],t[2]),D&&F.scene.scale.set(D[0],D[1],D[2]),(a||t||D)&&F.scene.updateMatrix();a=function(){E-=1;h();i.onLoadComplete()};for(q in L.cameras)D=L.cameras[q],"perspective"==D.type?O=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):"ortho"==D.type&&(O=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far)),u=D.position,t=D.target,D=D.up,O.position.set(u[0],u[1],u[2]),O.target=new THREE.Vector3(t[0],t[1],t[2]),D&&O.up.set(D[0],D[1],D[2]),
|
|
|
F.cameras[q]=O;for(o in L.lights)t=L.lights[o],q=void 0!==t.color?t.color:16777215,O=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(u=t.direction,w=new THREE.DirectionalLight(q,O),w.position.set(u[0],u[1],u[2]),w.position.normalize()):"point"==t.type?(u=t.position,w=t.distance,w=new THREE.PointLight(q,O,w),w.position.set(u[0],u[1],u[2])):"ambient"==t.type&&(w=new THREE.AmbientLight(q)),F.scene.add(w),F.lights[o]=w;for(n in L.fogs)o=L.fogs[n],"linear"==o.type?Q=new THREE.Fog(0,o.near,o.far):
|
|
|
-"exp2"==o.type&&(Q=new THREE.FogExp2(0,o.density)),D=o.color,Q.color.setRGB(D[0],D[1],D[2]),F.fogs[n]=Q;if(F.cameras&&L.defaults.camera)F.currentCamera=F.cameras[L.defaults.camera];if(F.fogs&&L.defaults.fog)F.scene.fog=F.fogs[L.defaults.fog];D=L.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(D[0],D[1],D[2]);F.bgColorAlpha=L.defaults.bgalpha;for(k in L.geometries)if(n=L.geometries[k],"bin_mesh"==n.type||"ascii_mesh"==n.type)N+=1,l.onLoadStart();m=N;for(k in L.geometries)if(n=L.geometries[k],
|
|
|
+"exp2"==o.type&&(Q=new THREE.FogExp2(0,o.density)),D=o.color,Q.color.setRGB(D[0],D[1],D[2]),F.fogs[n]=Q;if(F.cameras&&L.defaults.camera)F.currentCamera=F.cameras[L.defaults.camera];if(F.fogs&&L.defaults.fog)F.scene.fog=F.fogs[L.defaults.fog];D=L.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(D[0],D[1],D[2]);F.bgColorAlpha=L.defaults.bgalpha;for(k in L.geometries)if(n=L.geometries[k],"bin_mesh"==n.type||"ascii_mesh"==n.type)N+=1,i.onLoadStart();l=N;for(k in L.geometries)if(n=L.geometries[k],
|
|
|
"cube"==n.type)I=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),F.geometries[k]=I;else if("plane"==n.type)I=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),F.geometries[k]=I;else if("sphere"==n.type)I=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),F.geometries[k]=I;else if("cylinder"==n.type)I=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),F.geometries[k]=
|
|
|
I;else if("torus"==n.type)I=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),F.geometries[k]=I;else if("icosahedron"==n.type)I=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),F.geometries[k]=I;else if("bin_mesh"==n.type)c.load(d(n.url,L.urlBaseType),g(k));else if("ascii_mesh"==n.type)B.load(d(n.url,L.urlBaseType),g(k));else if("embedded_mesh"==n.type)n=L.embeds[n.id],n.metadata=L.metadata,n&&B.createModel(n,f(k),"");for(r in L.textures)if(k=L.textures[r],k.url instanceof Array){E+=
|
|
|
-k.url.length;for(n=0;n<k.url.length;n++)l.onLoadStart()}else E+=1,l.onLoadStart();Y=E;for(r in L.textures){k=L.textures[r];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(Q=0;Q<k.url.length;Q++)n[Q]=d(k.url[Q],L.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,L.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])n.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])n.magFilter=
|
|
|
+k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else E+=1,i.onLoadStart();Y=E;for(r in L.textures){k=L.textures[r];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(Q=0;Q<k.url.length;Q++)n[Q]=d(k.url[Q],L.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,L.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])n.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])n.magFilter=
|
|
|
THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])n.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);if(k.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==Q[k.wrap[0]])n.wrapS=Q[k.wrap[0]];if(void 0!==Q[k.wrap[1]])n.wrapT=Q[k.wrap[1]]}}F.textures[r]=n}for(p in L.materials){r=L.materials[p];for(C in r.parameters)if("envMap"==C||"map"==C||"lightMap"==C)r.parameters[C]=
|
|
|
F.textures[r.parameters[C]];else if("shading"==C)r.parameters[C]="flat"==r.parameters[C]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==C)r.parameters[C]=THREE[r.parameters[C]]?THREE[r.parameters[C]]:THREE.NormalBlending;else if("combine"==C)r.parameters[C]="MixOperation"==r.parameters[C]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==C)if("face"==r.parameters[C])r.parameters[C]=THREE.FaceColors;else if(r.parameters[C])r.parameters[C]=THREE.VertexColors;if(void 0!==
|
|
|
r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(a.uniforms);n=r.parameters.color;Q=r.parameters.specular;c=r.parameters.ambient;B=r.parameters.shininess;k.tNormal.texture=F.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)k.uNormalScale.value=r.parameters.normalMapFactor;if(r.parameters.map)k.tDiffuse.texture=r.parameters.map,k.enableDiffuse.value=!0;if(r.parameters.lightMap)k.tAO.texture=
|
|
|
r.parameters.lightMap,k.enableAO.value=!0;if(r.parameters.specularMap)k.tSpecular.texture=F.textures[r.parameters.specularMap],k.enableSpecular.value=!0;k.uDiffuseColor.value.setHex(n);k.uSpecularColor.value.setHex(Q);k.uAmbientColor.value.setHex(c);k.uShininess.value=B;if(r.parameters.opacity)k.uOpacity.value=r.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:k,lights:!0,fog:!0})}else K=new THREE[r.type](r.parameters);F.materials[p]=
|
|
|
-K}e();l.callbackSync(F);h()};THREE.UTF8Loader=function(){};
|
|
|
+K}e();i.callbackSync(F);h()};THREE.UTF8Loader=function(){};
|
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,e=void 0!==c.scale?c.scale:1,g=void 0!==c.offsetX?c.offsetX:0,f=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,b,e,g,f,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,
|
|
|
!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;8>e;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d),g=g+(h>>1^-(h&1));c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,0==h&&f++;return[c,g]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,f,j){for(var k,l,r,s=a.length;j<s;j+=f)k=a[j],l=a[j+1],r=a[j+2],k=k/16383*c,l=l/16383*c,r=r/16383*c,k+=d,l+=e,r+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,r)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
|
|
|
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,l,t,w,u,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;w=d;u=e;l=f;var z=j[3*e],G=j[3*e+1],D=j[3*e+2],C=j[3*f],I=j[3*f+1],K=j[3*f+2];t=new THREE.Vector3(j[3*d],j[3*d+1],j[3*d+2]);z=new THREE.Vector3(z,G,D);C=new THREE.Vector3(C,I,K);g.faces.push(new THREE.Face3(w,u,l,[t,z,C],null,0));g=k[2*d];d=k[2*d+1];l=k[2*e];t=k[2*e+1];w=k[2*
|
|
|
-f];u=k[2*f+1];f=b.faceVertexUvs[0];e=l;l=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,l));t.push(new THREE.UV(w,u));f.push(t)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,f,i){for(var j,k,r,s=a.length;i<s;i+=f)j=a[i],k=a[i+1],r=a[i+2],j=j/16383*c,k=k/16383*c,r=r/16383*c,j+=d,k+=e,r+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
|
|
|
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,t,w,u,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;w=d;u=e;i=f;var z=j[3*e],G=j[3*e+1],D=j[3*e+2],C=j[3*f],I=j[3*f+1],K=j[3*f+2];t=new THREE.Vector3(j[3*d],j[3*d+1],j[3*d+2]);z=new THREE.Vector3(z,G,D);C=new THREE.Vector3(C,I,K);g.faces.push(new THREE.Face3(w,u,i,[t,z,C],null,0));g=k[2*d];d=k[2*d+1];i=k[2*e];t=k[2*e+1];w=k[2*
|
|
|
+f];u=k[2*f+1];f=b.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(w,u));f.push(t)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
|
|
|
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(3*this.size3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
|
|
|
-this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,l,j,k,p){f=(f-k)/(p-k);k=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=l;b[g+2]=j;e[g]=this.lerp(k[a],k[a+3],f);e[g+1]=this.lerp(k[a+1],k[a+4],f);e[g+2]=this.lerp(k[a+2],k[a+5],f)};this.VIntY=function(a,b,e,g,f,h,l,j,k,p){f=(f-k)/(p-k);k=this.normal_cache;b[g]=h;b[g+1]=l+f*this.delta;b[g+2]=j;b=a+3*this.yd;
|
|
|
-e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,l,j,k,p){f=(f-k)/(p-k);k=this.normal_cache;b[g]=h;b[g+1]=l;b[g+2]=j+f*this.delta;b=a+3*this.zd;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
|
|
|
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var l=g+1,j=g+this.yd,k=g+this.zd,p=l+this.yd,i=l+this.zd,o=g+this.yd+this.zd,q=l+this.yd+this.zd,n=0,r=this.field[g],s=this.field[l],t=this.field[j],w=this.field[p],u=this.field[k],v=this.field[i],z=this.field[o],G=this.field[q];r<f&&(n|=1);s<f&&(n|=2);t<f&&(n|=8);w<f&&(n|=4);u<f&&(n|=16);v<f&&(n|=32);z<f&&(n|=128);G<f&&(n|=64);var D=THREE.edgeTable[n];if(0===D)return 0;var C=this.delta,I=a+
|
|
|
-C,K=b+C,C=e+C;D&1&&(this.compNorm(g),this.compNorm(l),this.VIntX(3*g,this.vlist,this.nlist,0,f,a,b,e,r,s));D&2&&(this.compNorm(l),this.compNorm(p),this.VIntY(3*l,this.vlist,this.nlist,3,f,I,b,e,s,w));D&4&&(this.compNorm(j),this.compNorm(p),this.VIntX(3*j,this.vlist,this.nlist,6,f,a,K,e,t,w));D&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(3*g,this.vlist,this.nlist,9,f,a,b,e,r,t));D&16&&(this.compNorm(k),this.compNorm(i),this.VIntX(3*k,this.vlist,this.nlist,12,f,a,b,C,u,v));D&32&&(this.compNorm(i),
|
|
|
-this.compNorm(q),this.VIntY(3*i,this.vlist,this.nlist,15,f,I,b,C,v,G));D&64&&(this.compNorm(o),this.compNorm(q),this.VIntX(3*o,this.vlist,this.nlist,18,f,a,K,C,z,G));D&128&&(this.compNorm(k),this.compNorm(o),this.VIntY(3*k,this.vlist,this.nlist,21,f,a,b,C,u,z));D&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(3*g,this.vlist,this.nlist,24,f,a,b,e,r,u));D&512&&(this.compNorm(l),this.compNorm(i),this.VIntZ(3*l,this.vlist,this.nlist,27,f,I,b,e,s,v));D&1024&&(this.compNorm(p),this.compNorm(q),this.VIntZ(3*
|
|
|
-p,this.vlist,this.nlist,30,f,I,K,e,w,G));D&2048&&(this.compNorm(j),this.compNorm(o),this.VIntZ(3*j,this.vlist,this.nlist,33,f,a,K,e,t,z));n<<=4;for(f=g=0;-1!=THREE.triTable[n+f];)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var l=3*this.count;this.positionArray[l]=a[e];this.positionArray[l+1]=a[e+1];this.positionArray[l+2]=a[e+2];this.positionArray[l+3]=a[g];this.positionArray[l+
|
|
|
-4]=a[g+1];this.positionArray[l+5]=a[g+2];this.positionArray[l+6]=a[f];this.positionArray[l+7]=a[f+1];this.positionArray[l+8]=a[f+2];this.normalArray[l]=b[e];this.normalArray[l+1]=b[e+1];this.normalArray[l+2]=b[e+2];this.normalArray[l+3]=b[g];this.normalArray[l+4]=b[g+1];this.normalArray[l+5]=b[g+2];this.normalArray[l+6]=b[f];this.normalArray[l+7]=b[f+1];this.normalArray[l+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
|
|
|
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),l=e*this.size,j=b*this.size,k=a*this.size,p=Math.floor(l-h);1>p&&(p=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var i=Math.floor(j-h);1>i&&(i=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var o=Math.floor(k-h);1>o&&(o=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
|
|
|
-1);for(var q,n,r,s,t,w,u,k=p;k<l;k++){r=this.size2*k;t=k/this.size-e;w=t*t;for(p=i;p<j;p++){n=r+this.size*p;q=p/this.size-b;u=q*q;for(q=o;q<h;q++)s=q/this.size-a,s=g/(1.0E-6+s*s+u+w)-f,0<s&&(this.field[n+q]+=s)}}};this.addPlaneX=function(a,b){var e,g,f,h,l,j=this.size,k=this.yd,p=this.zd,i=this.field,o=j*Math.sqrt(a/b);o>j&&(o=j);for(e=0;e<o;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-b,0<h)for(g=0;g<j;g++){l=e+g*k;for(f=0;f<j;f++)i[p*f+l]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,l,j,k=this.size,p=this.yd,
|
|
|
-i=this.zd,o=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(g=0;g<q;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-b,0<h){l=g*p;for(e=0;e<k;e++){j=l+e;for(f=0;f<k;f++)o[i*f+j]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,l,j,k=this.size,p=this.yd,i=this.zd,o=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(f=0;f<q;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,0<h){l=i*f;for(g=0;g<k;g++){j=l+g*p;for(e=0;e<k;e++)o[j+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
|
|
|
-function(a){this.begin();var b,e,g,f,h,l,j,k,p,i=this.size-2;for(f=1;f<i;f++){p=this.size2*f;j=(f-this.halfsize)/this.halfsize;for(g=1;g<i;g++){k=p+this.size*g;l=(g-this.halfsize)/this.halfsize;for(e=1;e<i;e++)h=(e-this.halfsize)/this.halfsize,b=k+e,this.polygonize(h,l,j,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,l,j,k,p,i,o;for(f=0;f<g.count;f++)i=3*f,k=i+1,o=i+2,h=g.positionArray[i],l=g.positionArray[k],j=
|
|
|
-g.positionArray[o],p=new THREE.Vector3(h,l,j),h=g.normalArray[i],l=g.normalArray[k],j=g.normalArray[o],i=new THREE.Vector3(h,l,j),i.normalize(),k=new THREE.Vertex(p),b.vertices.push(k),e.push(i);p=g.count/3;for(f=0;f<p;f++)i=3*(a+f),k=i+1,o=i+2,h=e[i],l=e[k],j=e[o],i=new THREE.Face3(i,k,o,[h,l,j]),b.faces.push(i);a+=p;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
+this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,j,k,p){f=(f-k)/(p-k);k=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=j;e[g]=this.lerp(k[a],k[a+3],f);e[g+1]=this.lerp(k[a+1],k[a+4],f);e[g+2]=this.lerp(k[a+2],k[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,j,k,p){f=(f-k)/(p-k);k=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=j;b=a+3*this.yd;
|
|
|
+e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,j,k,p){f=(f-k)/(p-k);k=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=j+f*this.delta;b=a+3*this.zd;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
|
|
|
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,j=g+this.yd,k=g+this.zd,p=i+this.yd,m=i+this.zd,o=g+this.yd+this.zd,q=i+this.yd+this.zd,n=0,r=this.field[g],s=this.field[i],t=this.field[j],w=this.field[p],u=this.field[k],v=this.field[m],z=this.field[o],G=this.field[q];r<f&&(n|=1);s<f&&(n|=2);t<f&&(n|=8);w<f&&(n|=4);u<f&&(n|=16);v<f&&(n|=32);z<f&&(n|=128);G<f&&(n|=64);var D=THREE.edgeTable[n];if(0===D)return 0;var C=this.delta,I=a+
|
|
|
+C,K=b+C,C=e+C;D&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(3*g,this.vlist,this.nlist,0,f,a,b,e,r,s));D&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(3*i,this.vlist,this.nlist,3,f,I,b,e,s,w));D&4&&(this.compNorm(j),this.compNorm(p),this.VIntX(3*j,this.vlist,this.nlist,6,f,a,K,e,t,w));D&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(3*g,this.vlist,this.nlist,9,f,a,b,e,r,t));D&16&&(this.compNorm(k),this.compNorm(m),this.VIntX(3*k,this.vlist,this.nlist,12,f,a,b,C,u,v));D&32&&(this.compNorm(m),
|
|
|
+this.compNorm(q),this.VIntY(3*m,this.vlist,this.nlist,15,f,I,b,C,v,G));D&64&&(this.compNorm(o),this.compNorm(q),this.VIntX(3*o,this.vlist,this.nlist,18,f,a,K,C,z,G));D&128&&(this.compNorm(k),this.compNorm(o),this.VIntY(3*k,this.vlist,this.nlist,21,f,a,b,C,u,z));D&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(3*g,this.vlist,this.nlist,24,f,a,b,e,r,u));D&512&&(this.compNorm(i),this.compNorm(m),this.VIntZ(3*i,this.vlist,this.nlist,27,f,I,b,e,s,v));D&1024&&(this.compNorm(p),this.compNorm(q),this.VIntZ(3*
|
|
|
+p,this.vlist,this.nlist,30,f,I,K,e,w,G));D&2048&&(this.compNorm(j),this.compNorm(o),this.VIntZ(3*j,this.vlist,this.nlist,33,f,a,K,e,t,z));n<<=4;for(f=g=0;-1!=THREE.triTable[n+f];)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=3*this.count;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
|
|
|
+4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
|
|
|
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,j=b*this.size,k=a*this.size,p=Math.floor(i-h);1>p&&(p=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var m=Math.floor(j-h);1>m&&(m=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var o=Math.floor(k-h);1>o&&(o=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
|
|
|
+1);for(var q,n,r,s,t,w,u,k=p;k<i;k++){r=this.size2*k;t=k/this.size-e;w=t*t;for(p=m;p<j;p++){n=r+this.size*p;q=p/this.size-b;u=q*q;for(q=o;q<h;q++)s=q/this.size-a,s=g/(1.0E-6+s*s+u+w)-f,0<s&&(this.field[n+q]+=s)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,j=this.size,k=this.yd,p=this.zd,m=this.field,o=j*Math.sqrt(a/b);o>j&&(o=j);for(e=0;e<o;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-b,0<h)for(g=0;g<j;g++){i=e+g*k;for(f=0;f<j;f++)m[p*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,j,k=this.size,p=this.yd,
|
|
|
+m=this.zd,o=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(g=0;g<q;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-b,0<h){i=g*p;for(e=0;e<k;e++){j=i+e;for(f=0;f<k;f++)o[m*f+j]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,j,k=this.size,p=this.yd,m=this.zd,o=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(f=0;f<q;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,0<h){i=m*f;for(g=0;g<k;g++){j=i+g*p;for(e=0;e<k;e++)o[j+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
|
|
|
+function(a){this.begin();var b,e,g,f,h,i,j,k,p,m=this.size-2;for(f=1;f<m;f++){p=this.size2*f;j=(f-this.halfsize)/this.halfsize;for(g=1;g<m;g++){k=p+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<m;e++)h=(e-this.halfsize)/this.halfsize,b=k+e,this.polygonize(h,i,j,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,j,k,p,m,o;for(f=0;f<g.count;f++)m=3*f,k=m+1,o=m+2,h=g.positionArray[m],i=g.positionArray[k],j=
|
|
|
+g.positionArray[o],p=new THREE.Vector3(h,i,j),h=g.normalArray[m],i=g.normalArray[k],j=g.normalArray[o],m=new THREE.Vector3(h,i,j),m.normalize(),k=new THREE.Vertex(p),b.vertices.push(k),e.push(m);p=g.count/3;for(f=0;f<p;f++)m=3*(a+f),k=m+1,o=m+2,h=e[m],i=e[k],j=e[o],m=new THREE.Face3(m,k,o,[h,i,j]),b.faces.push(m);a+=p;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
|
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
|
|
@@ -767,49 +767,49 @@ THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototyp
|
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;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=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
|
|
|
THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=new THREE.Mesh;THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh;
|
|
|
THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)};
|
|
|
-THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,g=0,f=e.morphTargets.length;g<f;g++){var h=e.morphTargets[g].name.match(b);if(h&&1<h.length){var l=h[1];d[l]||(d[l]={start:Infinity,end:-Infinity});h=d[l];if(g<h.start)h.start=g;if(g>h.end)h.end=g;c||(c=l)}}for(l in d)h=d[l],this.createAnimation(l,h.start,h.end,a);this.firstAnimation=c};
|
|
|
+THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,g=0,f=e.morphTargets.length;g<f;g++){var h=e.morphTargets[g].name.match(b);if(h&&1<h.length){var i=h[1];d[i]||(d[i]={start:Infinity,end:-Infinity});h=d[i];if(g<h.start)h.start=g;if(g>h.end)h.end=g;c||(c=i)}}for(i in d)h=d[i],this.createAnimation(i,h.start,h.end,a);this.firstAnimation=c};
|
|
|
THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];if(c)c.fps=b,c.duration=(c.end-c.start)/c.fps};
|
|
|
THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];if(c)c.duration=b,c.fps=(c.end-c.start)/c.duration};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];if(c)c.weight=b};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];if(c)c.time=b};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
|
|
|
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];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
|
|
|
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.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time){d.direction*=-1;if(d.time>d.duration)d.time=d.duration,d.directionBackwards=!0;if(0>d.time)d.time=0,d.directionBackwards=!1}}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var g=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),f=d.weight;
|
|
|
if(g!==d.currentFrame)this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*f,this.morphTargetInfluences[g]=0,d.lastFrame=d.currentFrame,d.currentFrame=g;e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*f;this.morphTargetInfluences[d.lastFrame]=(1-e)*f}}};
|
|
|
-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,g,f,h,l,j,k,p,i,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;g=b.createBuffer();f=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();l=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,l);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
|
|
|
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(j=!1,k=a(THREE.ShaderFlares.lensFlare)):(j=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));p={};i={};p.vertex=b.getAttribLocation(k,"position");p.uv=b.getAttribLocation(k,"uv");i.renderType=b.getUniformLocation(k,"renderType");i.map=b.getUniformLocation(k,"map");i.occlusionMap=b.getUniformLocation(k,"occlusionMap");i.opacity=b.getUniformLocation(k,"opacity");i.color=b.getUniformLocation(k,
|
|
|
-"color");i.scale=b.getUniformLocation(k,"scale");i.rotation=b.getUniformLocation(k,"rotation");i.screenPosition=b.getUniformLocation(k,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,t=a.length;if(t){var w=new THREE.Vector3,u=s/e,v=0.5*e,z=0.5*s,G=16/s,D=new THREE.Vector2(G*u,G),C=new THREE.Vector3(1,1,0),I=new THREE.Vector2(1,1),K=i,G=p;b.useProgram(k);o||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),o=!0);b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
|
|
|
+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,g,f,h,i,j,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;g=b.createBuffer();f=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
|
|
|
+b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
|
|
|
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(j=!1,k=a(THREE.ShaderFlares.lensFlare)):(j=!0,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=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,t=a.length;if(t){var w=new THREE.Vector3,u=s/e,v=0.5*e,z=0.5*s,G=16/s,D=new THREE.Vector2(G*u,G),C=new THREE.Vector3(1,1,0),I=new THREE.Vector2(1,1),K=m,G=p;b.useProgram(k);o||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),o=!0);b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
|
|
|
1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(G.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(G.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.disable(b.CULL_FACE);b.depthMask(!1);var O,Q,L,B,N;for(O=0;O<t;O++)if(G=16/s,D.set(G*u,G),B=a[O],w.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(w),d.projectionMatrix.multiplyVector3(w),C.copy(w),I.x=C.x*v+v,I.y=C.y*z+z,j||0<I.x&&I.x<e&&0<I.y&&I.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
-h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,I.x-8,I.y-8,16,16,0);b.uniform1i(K.renderType,0);b.uniform2f(K.scale,D.x,D.y);b.uniform3f(K.screenPosition,C.x,C.y,C.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,l);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,I.x-8,I.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,
|
|
|
+h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,I.x-8,I.y-8,16,16,0);b.uniform1i(K.renderType,0);b.uniform2f(K.scale,D.x,D.y);b.uniform3f(K.screenPosition,C.x,C.y,C.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,I.x-8,I.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);B.positionScreen.copy(C);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(K.renderType,2);b.enable(b.BLEND);for(Q=0,L=B.lensFlares.length;Q<L;Q++)if(N=B.lensFlares[Q],0.0010<N.opacity&&0.0010<N.scale)C.x=N.x,C.y=N.y,C.z=N.z,G=N.size*N.scale/s,D.x=G*u,D.y=G,b.uniform3f(K.screenPosition,C.x,C.y,C.z),b.uniform2f(K.scale,D.x,D.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),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(!0)}}};
|
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,g=new THREE.Matrix4,f=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:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
|
|
|
-c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,j){var k,p,i,o,q,n,r,s,t,w=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(k=0,p=l.__lights.length;k<p;k++)if(i=l.__lights[k],i.castShadow)if(i instanceof THREE.DirectionalLight&&i.shadowCascade)for(q=0;q<i.shadowCascadeCount;q++){var u;if(i.shadowCascadeArray[q])u=i.shadowCascadeArray[q];else{t=i;r=q;u=new THREE.DirectionalLight;u.isVirtual=
|
|
|
+c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var k,p,m,o,q,n,r,s,t,w=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(k=0,p=i.__lights.length;k<p;k++)if(m=i.__lights[k],m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(q=0;q<m.shadowCascadeCount;q++){var u;if(m.shadowCascadeArray[q])u=m.shadowCascadeArray[q];else{t=m;r=q;u=new THREE.DirectionalLight;u.isVirtual=
|
|
|
!0;u.onlyShadow=!0;u.castShadow=!0;u.shadowCameraNear=t.shadowCameraNear;u.shadowCameraFar=t.shadowCameraFar;u.shadowCameraLeft=t.shadowCameraLeft;u.shadowCameraRight=t.shadowCameraRight;u.shadowCameraBottom=t.shadowCameraBottom;u.shadowCameraTop=t.shadowCameraTop;u.shadowCameraVisible=t.shadowCameraVisible;u.shadowDarkness=t.shadowDarkness;u.shadowBias=t.shadowCascadeBias[r];u.shadowMapWidth=t.shadowCascadeWidth[r];u.shadowMapHeight=t.shadowCascadeHeight[r];u.pointsWorld=[];u.pointsFrustum=[];s=
|
|
|
-u.pointsWorld;n=u.pointsFrustum;for(var v=0;8>v;v++)s[v]=new THREE.Vector3,n[v]=new THREE.Vector3;s=t.shadowCascadeNearZ[r];t=t.shadowCascadeFarZ[r];n[0].set(-1,-1,s);n[1].set(1,-1,s);n[2].set(-1,1,s);n[3].set(1,1,s);n[4].set(-1,-1,t);n[5].set(1,-1,t);n[6].set(-1,1,t);n[7].set(1,1,t);u.originalCamera=j;n=new THREE.Gyroscope;n.position=i.shadowCascadeOffset;n.add(u);n.add(u.target);j.add(n);i.shadowCascadeArray[q]=u;console.log("Created virtualLight",u)}r=i;s=q;t=r.shadowCascadeArray[s];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[s];n=r.shadowCascadeNearZ[s];r=r.shadowCascadeFarZ[s];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;w[o]=u;o++}else w[o]=i,o++;for(k=0,p=w.length;k<p;k++){i=w[k];if(!i.shadowMap)i.shadowMap=new THREE.WebGLRenderTarget(i.shadowMapWidth,i.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
-format:THREE.RGBAFormat}),i.shadowMapSize=new THREE.Vector2(i.shadowMapWidth,i.shadowMapHeight),i.shadowMatrix=new THREE.Matrix4;if(!i.shadowCamera){if(i instanceof THREE.SpotLight)i.shadowCamera=new THREE.PerspectiveCamera(i.shadowCameraFov,i.shadowMapWidth/i.shadowMapHeight,i.shadowCameraNear,i.shadowCameraFar);else if(i instanceof THREE.DirectionalLight)i.shadowCamera=new THREE.OrthographicCamera(i.shadowCameraLeft,i.shadowCameraRight,i.shadowCameraTop,i.shadowCameraBottom,i.shadowCameraNear,i.shadowCameraFar);
|
|
|
-else{console.error("Unsupported light type for shadow");continue}l.add(i.shadowCamera);b.autoUpdateScene&&l.updateMatrixWorld()}if(i.shadowCameraVisible&&!i.cameraHelper)i.cameraHelper=new THREE.CameraHelper(i.shadowCamera),i.shadowCamera.add(i.cameraHelper);if(i.isVirtual&&u.originalCamera==j){q=j;o=i.shadowCamera;n=i.pointsFrustum;t=i.pointsWorld;f.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=0;8>r;r++){s=t[r];s.copy(n[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(s,
|
|
|
-q);o.matrixWorldInverse.multiplyVector3(s);if(s.x<f.x)f.x=s.x;if(s.x>h.x)h.x=s.x;if(s.y<f.y)f.y=s.y;if(s.y>h.y)h.y=s.y;if(s.z<f.z)f.z=s.z;if(s.z>h.z)h.z=s.z}o.left=f.x;o.right=h.x;o.top=h.y;o.bottom=f.y;o.updateProjectionMatrix()}o=i.shadowMap;n=i.shadowMatrix;q=i.shadowCamera;q.position.copy(i.matrixWorld.getPosition());q.lookAt(i.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);if(i.cameraHelper)i.cameraHelper.lines.visible=i.shadowCameraVisible;
|
|
|
-i.shadowCameraVisible&&i.cameraHelper.update(i.shadowCamera);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);g.multiply(q.projectionMatrix,q.matrixWorldInverse);e.setFromMatrix(g);
|
|
|
-b.setRenderTarget(o);b.clear();t=l.__webglObjects;for(i=0,o=t.length;i<o;i++)if(r=t[i],n=r.object,r.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),r.render=!0;for(i=0,o=t.length;i<o;i++)if(r=t[i],r.render)n=r.object,r=r.buffer,b.setObjectFaces(n),s=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?
|
|
|
-d:c,r instanceof THREE.BufferGeometry?b.renderBufferDirect(q,l.__lights,null,s,r,n):b.renderBuffer(q,l.__lights,null,s,r,n);t=l.__webglObjectsImmediate;for(i=0,o=t.length;i<o;i++)r=t[i],n=r.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(q,l.__lights,null,c,n))}k=b.getClearColor();p=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,
|
|
|
+u.pointsWorld;n=u.pointsFrustum;for(var v=0;8>v;v++)s[v]=new THREE.Vector3,n[v]=new THREE.Vector3;s=t.shadowCascadeNearZ[r];t=t.shadowCascadeFarZ[r];n[0].set(-1,-1,s);n[1].set(1,-1,s);n[2].set(-1,1,s);n[3].set(1,1,s);n[4].set(-1,-1,t);n[5].set(1,-1,t);n[6].set(-1,1,t);n[7].set(1,1,t);u.originalCamera=j;n=new THREE.Gyroscope;n.position=m.shadowCascadeOffset;n.add(u);n.add(u.target);j.add(n);m.shadowCascadeArray[q]=u;console.log("Created virtualLight",u)}r=m;s=q;t=r.shadowCascadeArray[s];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[s];n=r.shadowCascadeNearZ[s];r=r.shadowCascadeFarZ[s];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;w[o]=u;o++}else w[o]=m,o++;for(k=0,p=w.length;k<p;k++){m=w[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}i.add(m.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(m.shadowCameraVisible&&!m.cameraHelper)m.cameraHelper=new THREE.CameraHelper(m.shadowCamera),m.shadowCamera.add(m.cameraHelper);if(m.isVirtual&&u.originalCamera==j){q=j;o=m.shadowCamera;n=m.pointsFrustum;t=m.pointsWorld;f.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=0;8>r;r++){s=t[r];s.copy(n[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(s,
|
|
|
+q);o.matrixWorldInverse.multiplyVector3(s);if(s.x<f.x)f.x=s.x;if(s.x>h.x)h.x=s.x;if(s.y<f.y)f.y=s.y;if(s.y>h.y)h.y=s.y;if(s.z<f.z)f.z=s.z;if(s.z>h.z)h.z=s.z}o.left=f.x;o.right=h.x;o.top=h.y;o.bottom=f.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(m.shadowCamera);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);g.multiply(q.projectionMatrix,q.matrixWorldInverse);e.setFromMatrix(g);
|
|
|
+b.setRenderTarget(o);b.clear();t=i.__webglObjects;for(m=0,o=t.length;m<o;m++)if(r=t[m],n=r.object,r.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),r.render=!0;for(m=0,o=t.length;m<o;m++)if(r=t[m],r.render)n=r.object,r=r.buffer,b.setObjectFaces(n),s=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?
|
|
|
+d:c,r instanceof THREE.BufferGeometry?b.renderBufferDirect(q,i.__lights,null,s,r,n):b.renderBuffer(q,i.__lights,null,s,r,n);t=i.__webglObjectsImmediate;for(m=0,o=t.length;m<o;m++)r=t[m],n=r.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(q,i.__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,g,f,h,l,j,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;g=b.createBuffer();f=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
-f);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,i=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(i,o);b.attachShader(i,q);b.linkProgram(i);h=i;l={};j={};l.position=b.getAttribLocation(h,"position");l.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
|
|
|
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,g,f,h,i,j,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;g=b.createBuffer();f=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
+f);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;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
|
|
|
"uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
|
|
|
-j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,e,o,q){var d=d.__webglSprites,n=d.length;if(n){var r=l,s=j,t=q/o,o=0.5*o,w=0.5*q,u=!0;b.useProgram(h);k||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.uniformMatrix4fv(s.projectionMatrix,
|
|
|
+j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,e,o,q){var d=d.__webglSprites,n=d.length;if(n){var r=i,s=j,t=q/o,o=0.5*o,w=0.5*q,u=!0;b.useProgram(h);k||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.uniformMatrix4fv(s.projectionMatrix,
|
|
|
!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var v,z=[],r=0;r<n;r++)if(v=d[r],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(r=0;r<n;r++)v=d[r],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(v.position.x-
|
|
|
o)/o,(w-v.position.y)/w,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,v._modelViewMatrixArray)),e=v.map.image.width/(v.scaleByViewport?q:1),z[0]=e*t*v.scale.x,z[1]=e*v.scale.y,b.uniform2f(s.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(s.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(s.alignment,v.alignment.x,v.alignment.y),b.uniform1f(s.opacity,v.opacity),b.uniform3f(s.color,
|
|
|
v.color.r,v.color.g,v.color.b),b.uniform1f(s.rotation,v.rotation),b.uniform2fv(s.scale,z),v.mergeWith3D&&!u?(b.enable(b.DEPTH_TEST),u=!0):!v.mergeWith3D&&u&&(b.disable(b.DEPTH_TEST),u=!1),c.setBlending(v.blending),c.setTexture(v.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:g,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
|
|
|
-b){this.enabled&&this.update(a,b)};this.update=function(f,h){var l,j,k,p,i,o;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&f.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);g.multiply(h.projectionMatrix,
|
|
|
-h.matrixWorldInverse);e.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();o=f.__webglObjects;for(l=0,j=o.length;l<j;l++)if(k=o[l],i=k.object,k.render=!1,i.visible&&(!(i instanceof THREE.Mesh)||!i.frustumCulled||e.contains(i)))i.matrixWorld.flattenToArray(i._objectMatrixArray),i._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,i.matrixWorld,i._modelViewMatrixArray),k.render=!0;for(l=0,j=o.length;l<j;l++)if(k=o[l],k.render)i=k.object,k=k.buffer,b.setObjectFaces(i),p=i.customDepthMaterial?
|
|
|
-i.customDepthMaterial:i.geometry.morphTargets.length?d:c,k instanceof THREE.BufferGeometry?b.renderBufferDirect(h,f.__lights,null,p,k,i):b.renderBuffer(h,f.__lights,null,p,k,i);o=f.__webglObjectsImmediate;for(l=0,j=o.length;l<j;l++)k=o[l],i=k.object,i.visible&&i.castShadow&&(i.matrixAutoUpdate&&i.matrixWorld.flattenToArray(i._objectMatrixArray),i._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,i.matrixWorld,i._modelViewMatrixArray),b.renderImmediateObject(h,f.__lights,null,c,i));l=b.getClearColor();
|
|
|
-j=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,j);a.enable(a.BLEND)}};
|
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,l,j,k,p;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},i=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:i},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;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(q);this.setSize=function(a,d){c.call(b,a,d);i.width=a;i.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(l!==c.aspect||j!==c.near||k!==c.far||p!==c.fov){l=c.aspect;j=c.near;k=c.far;p=c.fov;var t=c.projectionMatrix.clone(),w=0.5*(125/30),u=w*j/125,v=j*Math.tan(p*Math.PI/360),z;f.n14=w;h.n14=-w;w=-v*l+u;z=v*l+u;t.n11=2*j/(z-w);t.n13=(z+w)/(z-w);e.projectionMatrix.copy(t);w=-v*l-u;z=v*l-u;t.n11=
|
|
|
-2*j/(z-w);t.n13=(z+w)/(z-w);g.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,i,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,o,!0);n.updateMatrixWorld();d.call(b,n,q)}};
|
|
|
+b){this.enabled&&this.update(a,b)};this.update=function(f,h){var i,j,k,p,m,o;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&f.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);g.multiply(h.projectionMatrix,
|
|
|
+h.matrixWorldInverse);e.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();o=f.__webglObjects;for(i=0,j=o.length;i<j;i++)if(k=o[i],m=k.object,k.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),k.render=!0;for(i=0,j=o.length;i<j;i++)if(k=o[i],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,f.__lights,null,p,k,m):b.renderBuffer(h,f.__lights,null,p,k,m);o=f.__webglObjectsImmediate;for(i=0,j=o.length;i<j;i++)k=o[i],m=k.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(h,f.__lights,null,c,m));i=b.getClearColor();
|
|
|
+j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,p;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;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;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),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(i!==c.aspect||j!==c.near||k!==c.far||p!==c.fov){i=c.aspect;j=c.near;k=c.far;p=c.fov;var t=c.projectionMatrix.clone(),w=0.5*(125/30),u=w*j/125,v=j*Math.tan(p*Math.PI/360),z;f.n14=w;h.n14=-w;w=-v*i+u;z=v*i+u;t.n11=2*j/(z-w);t.n13=(z+w)/(z-w);e.projectionMatrix.copy(t);w=-v*i-u;z=v*i-u;t.n11=
|
|
|
+2*j/(z-w);t.n13=(z+w)/(z-w);g.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,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,o,!0);n.updateMatrixWorld();d.call(b,n,q)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,g,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
|
|
|
c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
|
|
|
THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"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}"},
|