|
@@ -17,38 +17,38 @@ b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,c){return a.distance-c.distance});return e},intersectObject:function(a){function b(a,c,b){var e;e=b.clone().subSelf(a).dot(c);if(e<=0)return null;a=a.clone().addSelf(c.clone().multiplyScalar(e));return b.distanceTo(a)}function c(a,c,b,e){var e=e.clone().subSelf(c),
|
|
THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,c){return a.distance-c.distance});return e},intersectObject:function(a){function b(a,c,b){var e;e=b.clone().subSelf(a).dot(c);if(e<=0)return null;a=a.clone().addSelf(c.clone().multiplyScalar(e));return b.distanceTo(a)}function c(a,c,b,e){var e=e.clone().subSelf(c),
|
|
b=b.clone().subSelf(c),f=a.clone().subSelf(c),a=e.dot(e),c=e.dot(b),e=e.dot(f),k=b.dot(b),b=b.dot(f),f=1/(a*k-c*c),k=(k*e-c*b)*f,a=(a*b-c*e)*f;return k>0&&a>0&&k+a<1}for(var e,f=[],h=0,k=a.children.length;h<k;h++)Array.prototype.push.apply(f,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=b(this.origin,this.direction,a.matrixWorld.getPosition());if(h==null||h>a.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=b(this.origin,
|
|
b=b.clone().subSelf(c),f=a.clone().subSelf(c),a=e.dot(e),c=e.dot(b),e=e.dot(f),k=b.dot(b),b=b.dot(f),f=1/(a*k-c*c),k=(k*e-c*b)*f,a=(a*b-c*e)*f;return k>0&&a>0&&k+a<1}for(var e,f=[],h=0,k=a.children.length;h<k;h++)Array.prototype.push.apply(f,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=b(this.origin,this.direction,a.matrixWorld.getPosition());if(h==null||h>a.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=b(this.origin,
|
|
-this.direction,a.matrixWorld.getPosition());if(h==null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var l,m,t,u,p,v,o,z,x=a.geometry,w=x.vertices,h=0,k=x.faces.length;h<k;h++)if(e=x.faces[h],o=this.origin.clone(),z=this.direction.clone(),u=a.matrixWorld,l=u.multiplyVector3(e.centroid.clone()).subSelf(o),v=l.dot(z),!(v<=0)&&(l=u.multiplyVector3(w[e.a].position.clone()),m=u.multiplyVector3(w[e.b].position.clone()),t=u.multiplyVector3(w[e.c].position.clone()),
|
|
|
|
-u=e instanceof THREE.Face4?u.multiplyVector3(w[e.d].position.clone()):null,p=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),v=z.dot(p),a.doubleSided||(a.flipSided?v>0:v<0)))if(v=p.dot((new THREE.Vector3).sub(l,o))/v,o=o.addSelf(z.multiplyScalar(v)),e instanceof THREE.Face3)c(o,l,m,t)&&(e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(o,l,m,u)||c(o,m,t,u)))e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e)}return f}};
|
|
|
|
-THREE.Rectangle=function(){function a(){h=e-b;k=f-c}var b,c,e,f,h,k,l=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(k,h,u,p){l=!1;b=k;c=h;e=u;f=p;a()};this.addPoint=function(k,h){l?(l=!1,b=k,c=h,e=k,f=h):(b=b<k?b:k,c=c<h?c:h,e=e>k?e:k,f=f>h?f:h);a()};this.add3Points=
|
|
|
|
-function(k,h,u,p,v,o){l?(l=!1,b=k<u?k<v?k:v:u<v?u:v,c=h<p?h<o?h:o:p<o?p:o,e=k>u?k>v?k:v:u>v?u:v,f=h>p?h>o?h:o:p>o?p:o):(b=k<u?k<v?k<b?k:b:v<b?v:b:u<v?u<b?u:b:v<b?v:b,c=h<p?h<o?h<c?h:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c,e=k>u?k>v?k>e?k:e:v>e?v:e:u>v?u>e?u:e:v>e?v:e,f=h>p?h>o?h>f?h:f:o>f?o:f:p>o?p>f?p:f:o>f?o:f);a()};this.addRectangle=function(k){l?(l=!1,b=k.getLeft(),c=k.getTop(),e=k.getRight(),f=k.getBottom()):(b=b<k.getLeft()?b:k.getLeft(),c=c<k.getTop()?c:k.getTop(),e=e>k.getRight()?e:k.getRight(),f=f>
|
|
|
|
|
|
+this.direction,a.matrixWorld.getPosition());if(h==null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var l,n,p,u,t,v,o,y,x=a.geometry,w=x.vertices,h=0,k=x.faces.length;h<k;h++)if(e=x.faces[h],o=this.origin.clone(),y=this.direction.clone(),u=a.matrixWorld,l=u.multiplyVector3(e.centroid.clone()).subSelf(o),v=l.dot(y),!(v<=0)&&(l=u.multiplyVector3(w[e.a].position.clone()),n=u.multiplyVector3(w[e.b].position.clone()),p=u.multiplyVector3(w[e.c].position.clone()),
|
|
|
|
+u=e instanceof THREE.Face4?u.multiplyVector3(w[e.d].position.clone()):null,t=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),v=y.dot(t),a.doubleSided||(a.flipSided?v>0:v<0)))if(v=t.dot((new THREE.Vector3).sub(l,o))/v,o=o.addSelf(y.multiplyScalar(v)),e instanceof THREE.Face3)c(o,l,n,p)&&(e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(o,l,n,u)||c(o,n,p,u)))e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e)}return f}};
|
|
|
|
+THREE.Rectangle=function(){function a(){h=e-b;k=f-c}var b,c,e,f,h,k,l=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(k,h,u,t){l=!1;b=k;c=h;e=u;f=t;a()};this.addPoint=function(k,h){l?(l=!1,b=k,c=h,e=k,f=h):(b=b<k?b:k,c=c<h?c:h,e=e>k?e:k,f=f>h?f:h);a()};this.add3Points=
|
|
|
|
+function(k,h,u,t,v,o){l?(l=!1,b=k<u?k<v?k:v:u<v?u:v,c=h<t?h<o?h:o:t<o?t:o,e=k>u?k>v?k:v:u>v?u:v,f=h>t?h>o?h:o:t>o?t:o):(b=k<u?k<v?k<b?k:b:v<b?v:b:u<v?u<b?u:b:v<b?v:b,c=h<t?h<o?h<c?h:c:o<c?o:c:t<o?t<c?t:c:o<c?o:c,e=k>u?k>v?k>e?k:e:v>e?v:e:u>v?u>e?u:e:v>e?v:e,f=h>t?h>o?h>f?h:f:o>f?o:f:t>o?t>f?t:f:o>f?o:f);a()};this.addRectangle=function(k){l?(l=!1,b=k.getLeft(),c=k.getTop(),e=k.getRight(),f=k.getBottom()):(b=b<k.getLeft()?b:k.getLeft(),c=c<k.getTop()?c:k.getTop(),e=e>k.getRight()?e:k.getRight(),f=f>
|
|
k.getBottom()?f:k.getBottom());a()};this.inflate=function(k){b-=k;c-=k;e+=k;f+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();e=e<k.getRight()?e:k.getRight();f=f<k.getBottom()?f:k.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){l=!0;f=e=c=b=0;a()};this.isEmpty=function(){return l}};
|
|
k.getBottom()?f:k.getBottom());a()};this.inflate=function(k){b-=k;c-=k;e+=k;f+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();e=e<k.getRight()?e:k.getRight();f=f<k.getBottom()?f:k.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){l=!0;f=e=c=b=0;a()};this.isEmpty=function(){return l}};
|
|
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,e,f){return e+(a-b)*(f-e)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
|
|
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,e,f){return e+(a-b)*(f-e)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
-THREE.Matrix4=function(a,b,c,e,f,h,k,l,m,t,u,p,v,o,z,x){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,h!==void 0?h:1,k||0,l||0,m||0,t||0,u!==void 0?u:1,p||0,v||0,o||0,z||0,x!==void 0?x:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,k,l,m,t,u,p,v,o,z,x){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=h;this.n23=k;this.n24=l;this.n31=m;this.n32=t;this.n33=u;this.n34=p;this.n41=v;this.n42=o;this.n43=z;this.n44=x;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,
|
|
|
|
|
|
+THREE.Matrix4=function(a,b,c,e,f,h,k,l,n,p,u,t,v,o,y,x){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,h!==void 0?h:1,k||0,l||0,n||0,p||0,u!==void 0?u:1,t||0,v||0,o||0,y||0,x!==void 0?x:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,k,l,n,p,u,t,v,o,y,x){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=h;this.n23=k;this.n24=l;this.n31=n;this.n32=p;this.n33=u;this.n34=t;this.n41=v;this.n42=o;this.n43=y;this.n44=x;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 e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(c,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;
|
|
b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(c,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;
|
|
a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+
|
|
a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+
|
|
-c*this.n32+e*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},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,k=a.n21,l=a.n22,m=a.n23,t=a.n24,u=a.n31,p=a.n32,v=a.n33,o=a.n34,z=a.n41,x=a.n42,w=a.n43,B=a.n44,y=b.n11,A=b.n12,
|
|
|
|
-E=b.n13,C=b.n14,L=b.n21,F=b.n22,G=b.n23,N=b.n24,R=b.n31,H=b.n32,S=b.n33,J=b.n34,V=b.n41,X=b.n42,O=b.n43,n=b.n44;this.n11=c*y+e*L+f*R+h*V;this.n12=c*A+e*F+f*H+h*X;this.n13=c*E+e*G+f*S+h*O;this.n14=c*C+e*N+f*J+h*n;this.n21=k*y+l*L+m*R+t*V;this.n22=k*A+l*F+m*H+t*X;this.n23=k*E+l*G+m*S+t*O;this.n24=k*C+l*N+m*J+t*n;this.n31=u*y+p*L+v*R+o*V;this.n32=u*A+p*F+v*H+o*X;this.n33=u*E+p*G+v*S+o*O;this.n34=u*C+p*N+v*J+o*n;this.n41=z*y+x*L+w*R+B*V;this.n42=z*A+x*F+w*H+B*X;this.n43=z*E+x*G+w*S+B*O;this.n44=z*C+x*
|
|
|
|
-N+w*J+B*n;return this},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},multiplySelf:function(a){this.multiply(this,a);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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,h=this.n22,k=this.n23,l=this.n24,m=this.n31,t=this.n32,u=this.n33,p=this.n34,v=this.n41,o=this.n42,z=this.n43,x=this.n44;return e*k*t*v-c*l*t*v-e*h*u*v+b*l*u*v+c*h*p*v-b*k*p*v-e*k*m*o+c*l*m*o+e*f*u*o-a*l*u*o-c*f*p*o+a*k*p*o+e*h*m*z-b*l*m*z-e*f*t*z+a*l*t*z+b*f*p*z-a*h*p*z-c*h*m*x+b*k*m*x+c*f*t*x-a*k*t*x-b*f*u*x+a*h*u*x},
|
|
|
|
-transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;
|
|
|
|
-a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;
|
|
|
|
-a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;
|
|
|
|
-a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,
|
|
|
|
-0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,h=a.x,k=a.y,l=a.z,m=f*h,t=f*k;this.set(m*h+c,m*k-e*l,m*l+e*k,0,m*k+e*l,t*k+c,t*l-e*h,0,m*l-e*k,t*l+e*h,f*l*l+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(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
|
|
|
|
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,h=Math.cos(c),c=Math.sin(c),k=Math.cos(e),e=Math.sin(e),l=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var m=
|
|
|
|
-k*l,t=k*f,u=e*l,p=e*f;this.n11=m+p*c;this.n12=u*c-t;this.n13=h*e;this.n21=h*f;this.n22=h*l;this.n23=-c;this.n31=t*c-u;this.n32=p+m*c;this.n33=h*k;break;case "ZXY":m=k*l;t=k*f;u=e*l;p=e*f;this.n11=m-p*c;this.n12=-h*f;this.n13=u+t*c;this.n21=t+u*c;this.n22=h*l;this.n23=p-m*c;this.n31=-h*e;this.n32=c;this.n33=h*k;break;case "ZYX":m=h*l;t=h*f;u=c*l;p=c*f;this.n11=k*l;this.n12=u*e-t;this.n13=m*e+p;this.n21=k*f;this.n22=p*e+m;this.n23=t*e-u;this.n31=-e;this.n32=c*k;this.n33=h*k;break;case "YZX":m=h*k;t=
|
|
|
|
-h*e;u=c*k;p=c*e;this.n11=k*l;this.n12=p-m*f;this.n13=u*f+t;this.n21=f;this.n22=h*l;this.n23=-c*l;this.n31=-e*l;this.n32=t*f+u;this.n33=m-p*f;break;case "XZY":m=h*k;t=h*e;u=c*k;p=c*e;this.n11=k*l;this.n12=-f;this.n13=e*l;this.n21=m*f+p;this.n22=h*l;this.n23=t*f-u;this.n31=u*f-t;this.n32=c*l;this.n33=p*f+m;break;default:m=h*l,t=h*f,u=c*l,p=c*f,this.n11=k*l,this.n12=-k*f,this.n13=e,this.n21=t+u*e,this.n22=m-p*e,this.n23=-c*k,this.n31=p-m*e,this.n32=u+t*e,this.n33=h*k}return this},setRotationFromQuaternion:function(a){var b=
|
|
|
|
-a.x,c=a.y,e=a.z,f=a.w,h=b+b,k=c+c,l=e+e,a=b*h,m=b*k;b*=l;var t=c*k;c*=l;e*=l;h*=f;k*=f;f*=l;this.n11=1-(t+e);this.n12=m-f;this.n13=b+k;this.n21=m+f;this.n22=1-(a+e);this.n23=c-h;this.n31=b-k;this.n32=c+h;this.n33=1-(a+t);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 e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;
|
|
|
|
|
|
+c*this.n32+e*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},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,k=a.n21,l=a.n22,n=a.n23,p=a.n24,u=a.n31,t=a.n32,v=a.n33,o=a.n34,y=a.n41,x=a.n42,w=a.n43,A=a.n44,z=b.n11,C=b.n12,
|
|
|
|
+B=b.n13,K=b.n14,F=b.n21,M=b.n22,E=b.n23,O=b.n24,V=b.n31,H=b.n32,P=b.n33,L=b.n34,T=b.n41,S=b.n42,m=b.n43,aa=b.n44;this.n11=c*z+e*F+f*V+h*T;this.n12=c*C+e*M+f*H+h*S;this.n13=c*B+e*E+f*P+h*m;this.n14=c*K+e*O+f*L+h*aa;this.n21=k*z+l*F+n*V+p*T;this.n22=k*C+l*M+n*H+p*S;this.n23=k*B+l*E+n*P+p*m;this.n24=k*K+l*O+n*L+p*aa;this.n31=u*z+t*F+v*V+o*T;this.n32=u*C+t*M+v*H+o*S;this.n33=u*B+t*E+v*P+o*m;this.n34=u*K+t*O+v*L+o*aa;this.n41=y*z+x*F+w*V+A*T;this.n42=y*C+x*M+w*H+A*S;this.n43=y*B+x*E+w*P+A*m;this.n44=y*
|
|
|
|
+K+x*O+w*L+A*aa;return this},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},multiplySelf:function(a){this.multiply(this,a);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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,h=this.n22,k=this.n23,l=this.n24,n=this.n31,p=this.n32,u=this.n33,t=this.n34,v=this.n41,o=this.n42,y=this.n43,x=this.n44;return e*k*p*v-c*l*p*v-e*h*u*v+b*l*u*v+c*h*t*v-b*k*t*v-e*k*n*o+c*l*n*o+e*f*u*o-a*l*u*o-c*f*t*o+a*k*t*o+e*h*n*y-b*l*n*y-e*f*p*y+a*l*p*y+b*f*t*y-a*h*t*y-c*h*n*x+b*k*n*x+c*f*p*x-a*k*p*x-b*f*
|
|
|
|
+u*x+a*h*u*x},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=
|
|
|
|
+this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=
|
|
|
|
+this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=
|
|
|
|
+this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,
|
|
|
|
+0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,h=a.x,k=a.y,l=a.z,n=f*h,p=f*k;this.set(n*h+c,n*k-e*l,n*l+e*k,0,n*k+e*l,p*k+c,p*l-e*h,0,n*l-e*k,p*l+e*h,f*l*l+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(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
|
|
|
|
+new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,h=Math.cos(c),c=Math.sin(c),k=Math.cos(e),e=Math.sin(e),l=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var n=
|
|
|
|
+k*l,p=k*f,u=e*l,t=e*f;this.n11=n+t*c;this.n12=u*c-p;this.n13=h*e;this.n21=h*f;this.n22=h*l;this.n23=-c;this.n31=p*c-u;this.n32=t+n*c;this.n33=h*k;break;case "ZXY":n=k*l;p=k*f;u=e*l;t=e*f;this.n11=n-t*c;this.n12=-h*f;this.n13=u+p*c;this.n21=p+u*c;this.n22=h*l;this.n23=t-n*c;this.n31=-h*e;this.n32=c;this.n33=h*k;break;case "ZYX":n=h*l;p=h*f;u=c*l;t=c*f;this.n11=k*l;this.n12=u*e-p;this.n13=n*e+t;this.n21=k*f;this.n22=t*e+n;this.n23=p*e-u;this.n31=-e;this.n32=c*k;this.n33=h*k;break;case "YZX":n=h*k;p=
|
|
|
|
+h*e;u=c*k;t=c*e;this.n11=k*l;this.n12=t-n*f;this.n13=u*f+p;this.n21=f;this.n22=h*l;this.n23=-c*l;this.n31=-e*l;this.n32=p*f+u;this.n33=n-t*f;break;case "XZY":n=h*k;p=h*e;u=c*k;t=c*e;this.n11=k*l;this.n12=-f;this.n13=e*l;this.n21=n*f+t;this.n22=h*l;this.n23=p*f-u;this.n31=u*f-p;this.n32=c*l;this.n33=t*f+n;break;default:n=h*l,p=h*f,u=c*l,t=c*f,this.n11=k*l,this.n12=-k*f,this.n13=e,this.n21=p+u*e,this.n22=n-t*e,this.n23=-c*k,this.n31=t-n*e,this.n32=u+p*e,this.n33=h*k}return this},setRotationFromQuaternion:function(a){var b=
|
|
|
|
+a.x,c=a.y,e=a.z,f=a.w,h=b+b,k=c+c,l=e+e,a=b*h,n=b*k;b*=l;var p=c*k;c*=l;e*=l;h*=f;k*=f;f*=l;this.n11=1-(p+e);this.n12=n-f;this.n13=b+k;this.n21=n+f;this.n22=1-(a+e);this.n23=c-h;this.n31=b-k;this.n32=c+h;this.n33=1-(a+p);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 e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;
|
|
e.identity();e.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(e,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);h.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=e.length();
|
|
e.identity();e.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(e,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);h.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=e.length();
|
|
c.y=f.length();c.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=c.x;e.n21/=c.x;e.n31/=c.x;e.n12/=c.y;e.n22/=c.y;e.n32/=c.y;e.n13/=c.z;e.n23/=c.z;e.n33/=c.z;b.setFromRotationMatrix(e);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=
|
|
c.y=f.length();c.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=c.x;e.n21/=c.x;e.n31/=c.x;e.n12/=c.y;e.n22/=c.y;e.n32/=c.y;e.n13/=c.z;e.n23/=c.z;e.n33/=c.z;b.setFromRotationMatrix(e);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=
|
|
a.n23*f;this.n33=a.n33*f}};
|
|
a.n23*f;this.n33=a.n33*f}};
|
|
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,k=a.n21,l=a.n22,m=a.n23,t=a.n24,u=a.n31,p=a.n32,v=a.n33,o=a.n34,z=a.n41,x=a.n42,w=a.n43,B=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=m*o*x-t*v*x+t*p*w-l*o*w-m*p*B+l*v*B;b.n12=h*v*x-f*o*x-h*p*w+e*o*w+f*p*B-e*v*B;b.n13=f*t*x-h*m*x+h*l*w-e*t*w-f*l*B+e*m*B;b.n14=h*m*p-f*t*p-h*l*v+e*t*v+f*l*o-e*m*o;b.n21=t*v*z-m*o*z-t*u*w+k*o*w+m*u*B-k*v*B;b.n22=f*o*z-h*v*z+h*u*w-c*o*w-f*u*B+c*v*B;b.n23=h*m*z-f*t*z-h*k*w+c*t*w+f*k*B-c*m*B;b.n24=
|
|
|
|
-f*t*u-h*m*u+h*k*v-c*t*v-f*k*o+c*m*o;b.n31=l*o*z-t*p*z+t*u*x-k*o*x-l*u*B+k*p*B;b.n32=h*p*z-e*o*z-h*u*x+c*o*x+e*u*B-c*p*B;b.n33=f*t*z-h*l*z+h*k*x-c*t*x-e*k*B+c*l*B;b.n34=h*l*u-e*t*u-h*k*p+c*t*p+e*k*o-c*l*o;b.n41=m*p*z-l*v*z-m*u*x+k*v*x+l*u*w-k*p*w;b.n42=e*v*z-f*p*z+f*u*x-c*v*x-e*u*w+c*p*w;b.n43=f*l*z-e*m*z-f*k*x+c*m*x+e*k*w-c*l*w;b.n44=e*m*u-f*l*u+f*k*p-c*m*p-e*k*v+c*l*v;b.multiplyScalar(1/a.determinant());return b};
|
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,k=-a.n33*a.n12+a.n32*a.n13,l=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,u=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*k+a.n31*t;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*k;c[4]=a*l;c[5]=a*m;c[6]=a*t;c[7]=a*u;c[8]=a*p;return b};
|
|
|
|
|
|
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,k=a.n21,l=a.n22,n=a.n23,p=a.n24,u=a.n31,t=a.n32,v=a.n33,o=a.n34,y=a.n41,x=a.n42,w=a.n43,A=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=n*o*x-p*v*x+p*t*w-l*o*w-n*t*A+l*v*A;b.n12=h*v*x-f*o*x-h*t*w+e*o*w+f*t*A-e*v*A;b.n13=f*p*x-h*n*x+h*l*w-e*p*w-f*l*A+e*n*A;b.n14=h*n*t-f*p*t-h*l*v+e*p*v+f*l*o-e*n*o;b.n21=p*v*y-n*o*y-p*u*w+k*o*w+n*u*A-k*v*A;b.n22=f*o*y-h*v*y+h*u*w-c*o*w-f*u*A+c*v*A;b.n23=h*n*y-f*p*y-h*k*w+c*p*w+f*k*A-c*n*A;b.n24=
|
|
|
|
+f*p*u-h*n*u+h*k*v-c*p*v-f*k*o+c*n*o;b.n31=l*o*y-p*t*y+p*u*x-k*o*x-l*u*A+k*t*A;b.n32=h*t*y-e*o*y-h*u*x+c*o*x+e*u*A-c*t*A;b.n33=f*p*y-h*l*y+h*k*x-c*p*x-e*k*A+c*l*A;b.n34=h*l*u-e*p*u-h*k*t+c*p*t+e*k*o-c*l*o;b.n41=n*t*y-l*v*y-n*u*x+k*v*x+l*u*w-k*t*w;b.n42=e*v*y-f*t*y+f*u*x-c*v*x-e*u*w+c*t*w;b.n43=f*l*y-e*n*y-f*k*x+c*n*x+e*k*w-c*l*w;b.n44=e*n*u-f*l*u+f*k*t-c*n*t-e*k*v+c*l*v;b.multiplyScalar(1/a.determinant());return b};
|
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,k=-a.n33*a.n12+a.n32*a.n13,l=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,p=a.n23*a.n12-a.n22*a.n13,u=-a.n23*a.n11+a.n21*a.n13,t=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*k+a.n31*p;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*k;c[4]=a*l;c[5]=a*n;c[6]=a*p;c[7]=a*u;c[8]=a*t;return b};
|
|
THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){var k;k=new THREE.Matrix4;k.n11=2*f/(b-a);k.n12=0;k.n13=(b+a)/(b-a);k.n14=0;k.n21=0;k.n22=2*f/(e-c);k.n23=(e+c)/(e-c);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+f)/(h-f);k.n34=-2*h*f/(h-f);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
|
|
THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){var k;k=new THREE.Matrix4;k.n11=2*f/(b-a);k.n12=0;k.n13=(b+a)/(b-a);k.n14=0;k.n21=0;k.n22=2*f/(e-c);k.n23=(e+c)/(e-c);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+f)/(h-f);k.n34=-2*h*f/(h-f);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
|
|
-THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var k,l,m,t;k=new THREE.Matrix4;l=b-a;m=c-e;t=h-f;k.n11=2/l;k.n12=0;k.n13=0;k.n14=-((b+a)/l);k.n21=0;k.n22=2/m;k.n23=0;k.n24=-((c+e)/m);k.n31=0;k.n32=0;k.n33=-2/t;k.n34=-((h+f)/t);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};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,e,f,h){var k,l,n,p;k=new THREE.Matrix4;l=b-a;n=c-e;p=h-f;k.n11=2/l;k.n12=0;k.n13=0;k.n14=-((b+a)/l);k.n21=0;k.n22=2/n;k.n23=0;k.n24=-((c+e)/n);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((h+f)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};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.name="";this.id=THREE.Object3DCount++;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=this.dynamic=!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=
|
|
THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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=this.dynamic=!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};
|
|
!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,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,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,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,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
|
|
@@ -56,41 +56,41 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
|
|
a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&
|
|
a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&
|
|
this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
|
|
this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
|
|
this.remove(a)}};THREE.Object3DCount=0;
|
|
this.remove(a)}};THREE.Object3DCount=0;
|
|
-THREE.Projector=function(){function a(){var a=m[l]=m[l]||new THREE.RenderableVertex;l++;return a}function b(a,c){return c.z-a.z}function c(a,c){var b=0,e=1,f=a.z+a.w,k=c.z+c.w,h=-a.z+a.w,l=-c.z+c.w;return f>=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?b=Math.max(b,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?b=Math.max(b,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),e<b?!1:(a.lerpSelf(c,b),c.lerpSelf(a,1-e),!0))}var e,f,h=[],k,l,m=[],t,u,p=[],v,o=[],z,x,w=[],B,y,A=[],E=[],C=[],L=new THREE.Vector4,F=new THREE.Vector4,
|
|
|
|
-G=new THREE.Matrix4,N=new THREE.Matrix4,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(a,c){G.multiply(c.projectionMatrix,c.matrixWorldInverse);G.multiplyVector3(a);return a};this.unprojectVector=function(a,c){G.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));G.multiplyVector3(a);return a};this.pickingRay=function(a,c){var b;a.z=-1;b=new THREE.Vector3(a.x,
|
|
|
|
-a.y,1);this.unprojectVector(a,c);this.unprojectVector(b,c);b.subSelf(a).normalize();return new THREE.Ray(a,b)};this.projectObjects=function(a,c,k){var l,n;f=E.length=0;l=a.objects;a=0;for(c=l.length;a<c;a++){n=l[a];var m;if(!(m=!n.visible))if(m=n instanceof THREE.Mesh)if(m=n.frustumCulled){a:{m=void 0;for(var t=n.matrixWorld,o=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),p=0;p<6;p++)if(m=R[p].x*t.n14+R[p].y*t.n24+R[p].z*t.n34+R[p].w,m<=o){m=!1;break a}m=!0}m=
|
|
|
|
-!m}if(!m)m=h[f]=h[f]||new THREE.RenderableObject,f++,e=m,L.copy(n.position),G.multiplyVector3(L),e.object=n,e.z=L.z,E.push(e)}k&&E.sort(b);return E};this.projectScene=function(e,f,h){var E=f.near,n=f.far,L,$,aa,ca,ea,la,ka,Z,Q,T,fa,ga,qa,oa,da,sa,ma;y=x=v=u=C.length=0;f.matrixAutoUpdate&&f.update(void 0,!0);e.update(void 0,!1,f);G.multiply(f.projectionMatrix,f.matrixWorldInverse);R[0].set(G.n41-G.n11,G.n42-G.n12,G.n43-G.n13,G.n44-G.n14);R[1].set(G.n41+G.n11,G.n42+G.n12,G.n43+G.n13,G.n44+G.n14);R[2].set(G.n41+
|
|
|
|
-G.n21,G.n42+G.n22,G.n43+G.n23,G.n44+G.n24);R[3].set(G.n41-G.n21,G.n42-G.n22,G.n43-G.n23,G.n44-G.n24);R[4].set(G.n41-G.n31,G.n42-G.n32,G.n43-G.n33,G.n44-G.n34);R[5].set(G.n41+G.n31,G.n42+G.n32,G.n43+G.n33,G.n44+G.n34);for(L=0;L<6;L++)Q=R[L],Q.divideScalar(Math.sqrt(Q.x*Q.x+Q.y*Q.y+Q.z*Q.z));Q=this.projectObjects(e,f,!0);e=0;for(L=Q.length;e<L;e++)if(T=Q[e].object,T.visible)if(fa=T.matrixWorld,ga=T.matrixRotationWorld,qa=T.materials,oa=T.overdraw,l=0,T instanceof THREE.Mesh){da=T.geometry;ca=da.vertices;
|
|
|
|
-sa=da.faces;da=da.faceVertexUvs;$=0;for(aa=ca.length;$<aa;$++)k=a(),k.positionWorld.copy(ca[$].position),fa.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),G.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>E&&k.positionScreen.z<n;ca=0;for($=sa.length;ca<$;ca++){aa=sa[ca];if(aa instanceof THREE.Face3)if(ea=m[aa.a],la=m[aa.b],ka=m[aa.c],ea.visible&&la.visible&&ka.visible&&(T.doubleSided||
|
|
|
|
-T.flipSided!=(ka.positionScreen.x-ea.positionScreen.x)*(la.positionScreen.y-ea.positionScreen.y)-(ka.positionScreen.y-ea.positionScreen.y)*(la.positionScreen.x-ea.positionScreen.x)<0))Z=p[u]=p[u]||new THREE.RenderableFace3,u++,t=Z,t.v1.copy(ea),t.v2.copy(la),t.v3.copy(ka);else continue;else if(aa instanceof THREE.Face4)if(ea=m[aa.a],la=m[aa.b],ka=m[aa.c],Z=m[aa.d],ea.visible&&la.visible&&ka.visible&&Z.visible&&(T.doubleSided||T.flipSided!=((Z.positionScreen.x-ea.positionScreen.x)*(la.positionScreen.y-
|
|
|
|
-ea.positionScreen.y)-(Z.positionScreen.y-ea.positionScreen.y)*(la.positionScreen.x-ea.positionScreen.x)<0||(la.positionScreen.x-ka.positionScreen.x)*(Z.positionScreen.y-ka.positionScreen.y)-(la.positionScreen.y-ka.positionScreen.y)*(Z.positionScreen.x-ka.positionScreen.x)<0)))ma=o[v]=o[v]||new THREE.RenderableFace4,v++,t=ma,t.v1.copy(ea),t.v2.copy(la),t.v3.copy(ka),t.v4.copy(Z);else continue;t.normalWorld.copy(aa.normal);ga.multiplyVector3(t.normalWorld);t.centroidWorld.copy(aa.centroid);fa.multiplyVector3(t.centroidWorld);
|
|
|
|
-t.centroidScreen.copy(t.centroidWorld);G.multiplyVector3(t.centroidScreen);ka=aa.vertexNormals;ea=0;for(la=ka.length;ea<la;ea++)Z=t.vertexNormalsWorld[ea],Z.copy(ka[ea]),ga.multiplyVector3(Z);ea=0;for(la=da.length;ea<la;ea++)if(ma=da[ea][ca]){ka=0;for(Z=ma.length;ka<Z;ka++)t.uvs[ea][ka]=ma[ka]}t.meshMaterials=qa;t.faceMaterials=aa.materials;t.overdraw=oa;t.z=t.centroidScreen.z;C.push(t)}}else if(T instanceof THREE.Line){N.multiply(G,fa);ca=T.geometry.vertices;ea=a();ea.positionScreen.copy(ca[0].position);
|
|
|
|
-N.multiplyVector4(ea.positionScreen);$=1;for(aa=ca.length;$<aa;$++)if(ea=a(),ea.positionScreen.copy(ca[$].position),N.multiplyVector4(ea.positionScreen),la=m[l-2],H.copy(ea.positionScreen),S.copy(la.positionScreen),c(H,S))H.multiplyScalar(1/H.w),S.multiplyScalar(1/S.w),fa=w[x]=w[x]||new THREE.RenderableLine,x++,z=fa,z.v1.positionScreen.copy(H),z.v2.positionScreen.copy(S),z.z=Math.max(H.z,S.z),z.materials=T.materials,C.push(z)}else if(T instanceof THREE.Particle&&(F.set(T.matrixWorld.n14,T.matrixWorld.n24,
|
|
|
|
-T.matrixWorld.n34,1),G.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))fa=A[y]=A[y]||new THREE.RenderableParticle,y++,B=fa,B.x=F.x/F.w,B.y=F.y/F.w,B.z=F.z,B.rotation=T.rotation.z,B.scale.x=T.scale.x*Math.abs(B.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14)),B.scale.y=T.scale.y*Math.abs(B.y-(F.y+f.projectionMatrix.n22)/(F.w+f.projectionMatrix.n24)),B.materials=T.materials,C.push(B);h&&C.sort(b);return C}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
|
|
|
|
|
|
+THREE.Projector=function(){function a(){var a=n[l]=n[l]||new THREE.RenderableVertex;l++;return a}function b(a,c){return c.z-a.z}function c(a,c){var b=0,e=1,f=a.z+a.w,k=c.z+c.w,h=-a.z+a.w,l=-c.z+c.w;return f>=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?b=Math.max(b,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?b=Math.max(b,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),e<b?!1:(a.lerpSelf(c,b),c.lerpSelf(a,1-e),!0))}var e,f,h=[],k,l,n=[],p,u,t=[],v,o=[],y,x,w=[],A,z,C=[],B=[],K=[],F=new THREE.Vector4,M=new THREE.Vector4,
|
|
|
|
+E=new THREE.Matrix4,O=new THREE.Matrix4,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(a,c){E.multiply(c.projectionMatrix,c.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,c){E.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));E.multiplyVector3(a);return a};this.pickingRay=function(a,c){var b;a.z=-1;b=new THREE.Vector3(a.x,
|
|
|
|
+a.y,1);this.unprojectVector(a,c);this.unprojectVector(b,c);b.subSelf(a).normalize();return new THREE.Ray(a,b)};this.projectObjects=function(a,c,k){var m,l;f=B.length=0;m=a.objects;a=0;for(c=m.length;a<c;a++){l=m[a];var n;if(!(n=!l.visible))if(n=l instanceof THREE.Mesh)if(n=l.frustumCulled){a:{n=void 0;for(var p=l.matrixWorld,o=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),t=0;t<6;t++)if(n=V[t].x*p.n14+V[t].y*p.n24+V[t].z*p.n34+V[t].w,n<=o){n=!1;break a}n=!0}n=
|
|
|
|
+!n}if(!n)n=h[f]=h[f]||new THREE.RenderableObject,f++,e=n,F.copy(l.position),E.multiplyVector3(F),e.object=l,e.z=F.z,B.push(e)}k&&B.sort(b);return B};this.projectScene=function(e,f,h){var m=f.near,B=f.far,F,ea,da,ia,ha,ja,ca,Z,R,Y,X,ga,oa,na,fa,qa,la;z=x=v=u=K.length=0;f.matrixAutoUpdate&&f.update(void 0,!0);e.update(void 0,!1,f);E.multiply(f.projectionMatrix,f.matrixWorldInverse);V[0].set(E.n41-E.n11,E.n42-E.n12,E.n43-E.n13,E.n44-E.n14);V[1].set(E.n41+E.n11,E.n42+E.n12,E.n43+E.n13,E.n44+E.n14);V[2].set(E.n41+
|
|
|
|
+E.n21,E.n42+E.n22,E.n43+E.n23,E.n44+E.n24);V[3].set(E.n41-E.n21,E.n42-E.n22,E.n43-E.n23,E.n44-E.n24);V[4].set(E.n41-E.n31,E.n42-E.n32,E.n43-E.n33,E.n44-E.n34);V[5].set(E.n41+E.n31,E.n42+E.n32,E.n43+E.n33,E.n44+E.n34);for(F=0;F<6;F++)R=V[F],R.divideScalar(Math.sqrt(R.x*R.x+R.y*R.y+R.z*R.z));R=this.projectObjects(e,f,!0);e=0;for(F=R.length;e<F;e++)if(Y=R[e].object,Y.visible)if(X=Y.matrixWorld,ga=Y.matrixRotationWorld,oa=Y.materials,na=Y.overdraw,l=0,Y instanceof THREE.Mesh){fa=Y.geometry;ia=fa.vertices;
|
|
|
|
+qa=fa.faces;fa=fa.faceVertexUvs;ea=0;for(da=ia.length;ea<da;ea++)k=a(),k.positionWorld.copy(ia[ea].position),X.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),E.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>m&&k.positionScreen.z<B;ia=0;for(ea=qa.length;ia<ea;ia++){da=qa[ia];if(da instanceof THREE.Face3)if(ha=n[da.a],ja=n[da.b],ca=n[da.c],ha.visible&&ja.visible&&ca.visible&&(Y.doubleSided||
|
|
|
|
+Y.flipSided!=(ca.positionScreen.x-ha.positionScreen.x)*(ja.positionScreen.y-ha.positionScreen.y)-(ca.positionScreen.y-ha.positionScreen.y)*(ja.positionScreen.x-ha.positionScreen.x)<0))Z=t[u]=t[u]||new THREE.RenderableFace3,u++,p=Z,p.v1.copy(ha),p.v2.copy(ja),p.v3.copy(ca);else continue;else if(da instanceof THREE.Face4)if(ha=n[da.a],ja=n[da.b],ca=n[da.c],Z=n[da.d],ha.visible&&ja.visible&&ca.visible&&Z.visible&&(Y.doubleSided||Y.flipSided!=((Z.positionScreen.x-ha.positionScreen.x)*(ja.positionScreen.y-
|
|
|
|
+ha.positionScreen.y)-(Z.positionScreen.y-ha.positionScreen.y)*(ja.positionScreen.x-ha.positionScreen.x)<0||(ja.positionScreen.x-ca.positionScreen.x)*(Z.positionScreen.y-ca.positionScreen.y)-(ja.positionScreen.y-ca.positionScreen.y)*(Z.positionScreen.x-ca.positionScreen.x)<0)))la=o[v]=o[v]||new THREE.RenderableFace4,v++,p=la,p.v1.copy(ha),p.v2.copy(ja),p.v3.copy(ca),p.v4.copy(Z);else continue;p.normalWorld.copy(da.normal);ga.multiplyVector3(p.normalWorld);p.centroidWorld.copy(da.centroid);X.multiplyVector3(p.centroidWorld);
|
|
|
|
+p.centroidScreen.copy(p.centroidWorld);E.multiplyVector3(p.centroidScreen);ca=da.vertexNormals;ha=0;for(ja=ca.length;ha<ja;ha++)Z=p.vertexNormalsWorld[ha],Z.copy(ca[ha]),ga.multiplyVector3(Z);ha=0;for(ja=fa.length;ha<ja;ha++)if(la=fa[ha][ia]){ca=0;for(Z=la.length;ca<Z;ca++)p.uvs[ha][ca]=la[ca]}p.meshMaterials=oa;p.faceMaterials=da.materials;p.overdraw=na;p.z=p.centroidScreen.z;K.push(p)}}else if(Y instanceof THREE.Line){O.multiply(E,X);ia=Y.geometry.vertices;ha=a();ha.positionScreen.copy(ia[0].position);
|
|
|
|
+O.multiplyVector4(ha.positionScreen);ea=1;for(da=ia.length;ea<da;ea++)if(ha=a(),ha.positionScreen.copy(ia[ea].position),O.multiplyVector4(ha.positionScreen),ja=n[l-2],H.copy(ha.positionScreen),P.copy(ja.positionScreen),c(H,P))H.multiplyScalar(1/H.w),P.multiplyScalar(1/P.w),X=w[x]=w[x]||new THREE.RenderableLine,x++,y=X,y.v1.positionScreen.copy(H),y.v2.positionScreen.copy(P),y.z=Math.max(H.z,P.z),y.materials=Y.materials,K.push(y)}else if(Y instanceof THREE.Particle&&(M.set(Y.matrixWorld.n14,Y.matrixWorld.n24,
|
|
|
|
+Y.matrixWorld.n34,1),E.multiplyVector4(M),M.z/=M.w,M.z>0&&M.z<1))X=C[z]=C[z]||new THREE.RenderableParticle,z++,A=X,A.x=M.x/M.w,A.y=M.y/M.w,A.z=M.z,A.rotation=Y.rotation.z,A.scale.x=Y.scale.x*Math.abs(A.x-(M.x+f.projectionMatrix.n11)/(M.w+f.projectionMatrix.n14)),A.scale.y=Y.scale.y*Math.abs(A.y-(M.y+f.projectionMatrix.n22)/(M.w+f.projectionMatrix.n24)),A.materials=Y.materials,K.push(A);h&&K.sort(b);return K}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;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,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),k=a*b,l=e*f;this.w=k*h-l*c;this.x=k*c+l*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;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,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),k=a*b,l=e*f;this.w=k*h-l*c;this.x=k*c+l*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
|
|
this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
|
|
-this.x,c=this.y,e=this.z,f=this.w,h=a.x,k=a.y,l=a.z,a=a.w;this.x=b*a+f*h+c*l-e*k;this.y=c*a+f*k+e*h-b*l;this.z=e*a+f*l+b*k-c*h;this.w=f*a-b*h-c*k-e*l;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},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,k=this.y,l=this.z,m=this.w,t=m*c+k*f-l*e,u=m*e+l*c-h*f,p=m*f+h*e-k*c,c=-h*
|
|
|
|
-c-k*e-l*f;b.x=t*m+c*-h+u*-l-p*-k;b.y=u*m+c*-k+p*-h-t*-l;b.z=p*m+c*-l+t*-k-u*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),k=Math.sqrt(1-f*f);if(Math.abs(k)<0.0010)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;f=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};
|
|
|
|
|
|
+this.x,c=this.y,e=this.z,f=this.w,h=a.x,k=a.y,l=a.z,a=a.w;this.x=b*a+f*h+c*l-e*k;this.y=c*a+f*k+e*h-b*l;this.z=e*a+f*l+b*k-c*h;this.w=f*a-b*h-c*k-e*l;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},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,k=this.y,l=this.z,n=this.w,p=n*c+k*f-l*e,u=n*e+l*c-h*f,t=n*f+h*e-k*c,c=-h*
|
|
|
|
+c-k*e-l*f;b.x=p*n+c*-h+u*-l-t*-k;b.y=u*n+c*-k+t*-h-p*-l;b.z=t*n+c*-l+p*-k-u*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),k=Math.sqrt(1-f*f);if(Math.abs(k)<0.0010)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;f=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};
|
|
THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
|
|
THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
|
|
THREE.Face4=function(a,b,c,e,f,h,k){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=k;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
|
|
THREE.Face4=function(a,b,c,e,f,h,k){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=k;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
|
|
THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
|
|
THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var h=0,k=f.vertexNormals.length;h<k;h++)b.multiplyVector3(f.vertexNormals[h]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var h=0,k=f.vertexNormals.length;h<k;h++)b.multiplyVector3(f.vertexNormals[h]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
|
|
b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
|
|
b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
|
|
-c,e,f,h,k,l=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){l.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)l.addSelf(h.vertexNormals[b]);l.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],k=this.vertices[h.c],l.sub(k.position,c.position),m.sub(b.position,c.position),l.crossSelf(m);l.isZero()||l.normalize();h.normal.copy(l)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=
|
|
|
|
|
|
+c,e,f,h,k,l=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){l.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)l.addSelf(h.vertexNormals[b]);l.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],k=this.vertices[h.c],l.sub(k.position,c.position),n.sub(b.position,c.position),l.crossSelf(n);l.isZero()||l.normalize();h.normal.copy(l)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=
|
|
Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
|
|
Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
|
|
THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
|
|
THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
|
|
-c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,c,b,e,f,h,G){l=a.vertices[c].position;m=a.vertices[b].position;t=a.vertices[e].position;u=k[f];p=k[h];v=k[G];o=m.x-l.x;z=t.x-l.x;x=m.y-l.y;w=t.y-l.y;B=m.z-l.z;y=t.z-l.z;A=p.u-u.u;E=v.u-u.u;C=p.v-u.v;L=v.v-u.v;F=1/(A*L-E*C);H.set((L*o-C*z)*F,(L*x-C*w)*F,(L*B-C*y)*F);S.set((A*z-E*o)*F,(A*w-E*x)*F,(A*y-E*B)*F);N[c].addSelf(H);N[b].addSelf(H);N[e].addSelf(H);R[c].addSelf(S);
|
|
|
|
-R[b].addSelf(S);R[e].addSelf(S)}var b,c,e,f,h,k,l,m,t,u,p,v,o,z,x,w,B,y,A,E,C,L,F,G,N=[],R=[],H=new THREE.Vector3,S=new THREE.Vector3,J=new THREE.Vector3,V=new THREE.Vector3,X=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)N[b]=new THREE.Vector3,R[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],k=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var O=["a","b",
|
|
|
|
-"c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)X.copy(h.vertexNormals[e]),f=h[O[e]],G=N[f],J.copy(G),J.subSelf(X.multiplyScalar(X.dot(G))).normalize(),V.cross(h.vertexNormals[e],G),f=V.dot(R[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(J.x,J.y,J.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
|
|
|
|
|
|
+c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,c,b,e,f,h,m){l=a.vertices[c].position;n=a.vertices[b].position;p=a.vertices[e].position;u=k[f];t=k[h];v=k[m];o=n.x-l.x;y=p.x-l.x;x=n.y-l.y;w=p.y-l.y;A=n.z-l.z;z=p.z-l.z;C=t.u-u.u;B=v.u-u.u;K=t.v-u.v;F=v.v-u.v;M=1/(C*F-B*K);H.set((F*o-K*y)*M,(F*x-K*w)*M,(F*A-K*z)*M);P.set((C*y-B*o)*M,(C*w-B*x)*M,(C*z-B*A)*M);O[c].addSelf(H);O[b].addSelf(H);O[e].addSelf(H);V[c].addSelf(P);
|
|
|
|
+V[b].addSelf(P);V[e].addSelf(P)}var b,c,e,f,h,k,l,n,p,u,t,v,o,y,x,w,A,z,C,B,K,F,M,E,O=[],V=[],H=new THREE.Vector3,P=new THREE.Vector3,L=new THREE.Vector3,T=new THREE.Vector3,S=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)O[b]=new THREE.Vector3,V[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],k=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var m=["a","b",
|
|
|
|
+"c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)S.copy(h.vertexNormals[e]),f=h[m[e]],E=O[f],L.copy(E),L.subSelf(S.multiplyScalar(S.dot(E))).normalize(),T.cross(h.vertexNormals[e],E),f=T.dot(V[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(L.x,L.y,L.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
|
|
this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
|
|
this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
|
|
a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),h,k;h=0;for(k=this.vertices.length;h<k;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),
|
|
a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),h,k;h=0;for(k=this.vertices.length;h<k;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),
|
|
c[h]=b.length-1):c[h]=c[a[e]];h=0;for(k=this.faces.length;h<k;h++){a=this.faces[h];if(a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];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;
|
|
c[h]=b.length-1):c[h]=c[a[e]];h=0;for(k=this.faces.length;h<k;h++){a=this.faces[h];if(a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];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,c,b,e,f,k,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*k+a*f+c}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,k,l,m,t,u,p,v;this.initFromArray=function(a){this.points=[];for(var c=0;c<a.length;c++)this.points[c]={x:a[c][0],y:a[c][1],z:a[c][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;h=Math.floor(f);k=f-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;t=this.points[c[0]];u=this.points[c[1]];
|
|
|
|
-p=this.points[c[2]];v=this.points[c[3]];l=k*k;m=k*l;e.x=b(t.x,u.x,p.x,v.x,k,l,m);e.y=b(t.y,u.y,p.y,v.y,k,l,m);e.z=b(t.z,u.z,p.z,v.z,k,l,m);return e};this.getControlPointsArray=function(){var a,c,b=this.points.length,e=[];for(a=0;a<b;a++)c=this.points[a],e[a]=[c.x,c.y,c.z];return e};this.getLength=function(a){var c,b,e=c=c=0,f=new THREE.Vector3,k=new THREE.Vector3,h=[],l=0;h[0]=0;a||(a=100);b=this.points.length*a;f.copy(this.points[0]);for(a=1;a<b;a++)c=a/b,position=this.getPoint(c),k.copy(position),
|
|
|
|
-l+=k.distanceTo(f),f.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=e&&(h[c]=l,e=c);h[h.length]=l;return{chunks:h,total:l}};this.reparametrizeByArcLength=function(a){var c,b,e,f,k,h,l=[],m=new THREE.Vector3,t=this.getLength();l.push(m.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){b=t.chunks[c]-t.chunks[c-1];h=Math.ceil(a*b/t.total);f=(c-1)/(this.points.length-1);k=c/(this.points.length-1);for(b=1;b<h-1;b++)e=f+b*(1/h)*(k-f),position=this.getPoint(e),l.push(m.copy(position).clone());
|
|
|
|
-l.push(m.copy(this.points[c]).clone())}this.points=l}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};
|
|
|
|
|
|
+THREE.Spline=function(a){function b(a,c,b,e,f,k,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*k+a*f+c}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,k,l,n,p,u,t,v;this.initFromArray=function(a){this.points=[];for(var c=0;c<a.length;c++)this.points[c]={x:a[c][0],y:a[c][1],z:a[c][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;h=Math.floor(f);k=f-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];u=this.points[c[1]];
|
|
|
|
+t=this.points[c[2]];v=this.points[c[3]];l=k*k;n=k*l;e.x=b(p.x,u.x,t.x,v.x,k,l,n);e.y=b(p.y,u.y,t.y,v.y,k,l,n);e.z=b(p.z,u.z,t.z,v.z,k,l,n);return e};this.getControlPointsArray=function(){var a,c,b=this.points.length,e=[];for(a=0;a<b;a++)c=this.points[a],e[a]=[c.x,c.y,c.z];return e};this.getLength=function(a){var c,b,e=c=c=0,f=new THREE.Vector3,k=new THREE.Vector3,h=[],l=0;h[0]=0;a||(a=100);b=this.points.length*a;f.copy(this.points[0]);for(a=1;a<b;a++)c=a/b,position=this.getPoint(c),k.copy(position),
|
|
|
|
+l+=k.distanceTo(f),f.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=e&&(h[c]=l,e=c);h[h.length]=l;return{chunks:h,total:l}};this.reparametrizeByArcLength=function(a){var c,b,e,f,k,h,l=[],n=new THREE.Vector3,p=this.getLength();l.push(n.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){b=p.chunks[c]-p.chunks[c-1];h=Math.ceil(a*b/p.total);f=(c-1)/(this.points.length-1);k=c/(this.points.length-1);for(b=1;b<h-1;b++)e=f+b*(1/h)*(k-f),position=this.getPoint(e),l.push(n.copy(position).clone());
|
|
|
|
+l.push(n.copy(this.points[c]).clone())}this.points=l}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};
|
|
THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
|
|
THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
|
|
THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
|
|
THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
|
|
THREE.OrthographicCamera=function(a,b,c,e,f,h){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=e;this.near=f!==void 0?f:0.1;this.far=h!==void 0?h: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.OrthographicCamera=function(a,b,c,e,f,h){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=e;this.near=f!==void 0?f:0.1;this.far=h!==void 0?h: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)};
|
|
@@ -122,7 +122,7 @@ void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.ve
|
|
THREE.Texture=function(a,b,c,e,f,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
THREE.Texture=function(a,b,c,e,f,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
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);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.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);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.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,e,f,h,k,l,m){THREE.Texture.call(this,null,f,h,k,l,m);this.image={data:a,width:b,height:c};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
|
|
|
|
|
|
+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,e,f,h,k,l,n){THREE.Texture.call(this,null,f,h,k,l,n);this.image={data:a,width:b,height:c};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
|
|
THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1};
|
|
THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!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=b;this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
|
|
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
|
|
@@ -151,49 +151,49 @@ THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)th
|
|
THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
|
|
THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
|
|
THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
|
|
THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
|
|
THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
|
|
THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,f,h;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;e=b;f=c/2;h=e/2};this.render=function(c,e){var m,t,u,p,v,o,z,x;a=b.projectScene(c,e);m=0;for(t=a.length;m<t;m++)if(v=a[m],v instanceof THREE.RenderableParticle){z=v.x*f+f;x=v.y*h+h;u=0;for(p=v.material.length;u<p;u++)if(o=v.material[u],o instanceof THREE.ParticleDOMMaterial)o=o.domElement,o.style.left=z+"px",o.style.top=x+"px"}}};
|
|
|
|
-THREE.CanvasRenderer=function(a){function b(a){if(w!=a)o.globalAlpha=w=a}function c(a){if(B!=a){switch(a){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}B=a}}function e(a){if(y!=a)o.strokeStyle=y=a}function f(a){if(A!=a)o.fillStyle=A=a}var h=this,k=null,l=new THREE.Projector,a=a||{},m=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
|
-t,u,p,v,o=m.getContext("2d"),z=new THREE.Color(0),x=0,w=1,B=0,y=null,A=null,E=null,C=null,L=null,F,G,N,R,H=new THREE.RenderableVertex,S=new THREE.RenderableVertex,J,V,X,O,n,U,$,aa,ca,ea,la,ka,Z=new THREE.Color(0),Q=new THREE.Color(0),T=new THREE.Color(0),fa=new THREE.Color(0),ga=new THREE.Color(0),qa=[],oa,da,sa,ma,na,pa,Ca,Fa,Ea,za,Da=new THREE.Rectangle,M=new THREE.Rectangle,Y=new THREE.Rectangle,ia=!1,ja=new THREE.Color,K=new THREE.Color,ra=new THREE.Color,wa=new THREE.Color,ha=new THREE.Vector3,
|
|
|
|
-xa,ua,ya,Ba,Ha,Ia,a=16;xa=document.createElement("canvas");xa.width=xa.height=2;ua=xa.getContext("2d");ua.fillStyle="rgba(0,0,0,1)";ua.fillRect(0,0,2,2);ya=ua.getImageData(0,0,2,2);Ba=ya.data;Ha=document.createElement("canvas");Ha.width=Ha.height=a;Ia=Ha.getContext("2d");Ia.translate(-a/2,-a/2);Ia.scale(a,a);a--;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,c){t=a;u=c;p=Math.floor(t/2);v=Math.floor(u/2);m.width=
|
|
|
|
-t;m.height=u;Da.set(-p,-v,p,v);M.set(-p,-v,p,v);w=1;B=0;L=C=E=A=y=null};this.setClearColor=function(a,c){z.copy(a);x=c;M.set(-p,-v,p,v)};this.setClearColorHex=function(a,c){z.setHex(a);x=c;M.set(-p,-v,p,v)};this.clear=function(){o.setTransform(1,0,0,-1,p,v);M.isEmpty()||(M.minSelf(Da),M.inflate(2),x<1&&o.clearRect(Math.floor(M.getX()),Math.floor(M.getY()),Math.floor(M.getWidth()),Math.floor(M.getHeight())),x>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+
|
|
|
|
-Math.floor(z.b*255)+","+x+")"),o.fillRect(Math.floor(M.getX()),Math.floor(M.getY()),Math.floor(M.getWidth()),Math.floor(M.getHeight()))),M.empty())};this.render=function(a,m){function t(a){var c,b,e,f=a.lights;K.setRGB(0,0,0);ra.setRGB(0,0,0);wa.setRGB(0,0,0);a=0;for(c=f.length;a<c;a++)b=f[a],e=b.color,b instanceof THREE.AmbientLight?(K.r+=e.r,K.g+=e.g,K.b+=e.b):b instanceof THREE.DirectionalLight?(ra.r+=e.r,ra.g+=e.g,ra.b+=e.b):b instanceof THREE.PointLight&&(wa.r+=e.r,wa.g+=e.g,wa.b+=e.b)}function u(a,
|
|
|
|
-c,b,e){var f,k,h,n,l=a.lights,a=0;for(f=l.length;a<f;a++)k=l[a],h=k.color,k instanceof THREE.DirectionalLight?(n=b.dot(k.position),n<=0||(n*=k.intensity,e.r+=h.r*n,e.g+=h.g*n,e.b+=h.b*n)):k instanceof THREE.PointLight&&(n=b.dot(ha.sub(k.position,c).normalize()),n<=0||(n*=k.distance==0?1:1-Math.min(c.distanceTo(k.position)/k.distance,1),n!=0&&(n*=k.intensity,e.r+=h.r*n,e.g+=h.g*n,e.b+=h.b*n)))}function w(a,k,h){b(h.opacity);c(h.blending);var n,l,m,t,u,va;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)t=
|
|
|
|
-h.map.image,u=t.width>>1,va=t.height>>1,h=k.scale.x*p,m=k.scale.y*v,n=h*u,l=m*va,Y.set(a.x-n,a.y-l,a.x+n,a.y+l),Da.intersects(Y)&&(o.save(),o.translate(a.x,a.y),o.rotate(-k.rotation),o.scale(h,-m),o.translate(-u,-va),o.drawImage(t,0,0),o.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(n=k.scale.x*p,l=k.scale.y*v,Y.set(a.x-n,a.y-l,a.x+n,a.y+l),Da.intersects(Y)&&(e(h.color.getContextStyle()),f(h.color.getContextStyle()),o.save(),o.translate(a.x,a.y),o.rotate(-k.rotation),o.scale(n,l),h.program(o),
|
|
|
|
-o.restore()))}function x(a,f,k,h){b(h.opacity);c(h.blending);o.beginPath();o.moveTo(a.positionScreen.x,a.positionScreen.y);o.lineTo(f.positionScreen.x,f.positionScreen.y);o.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(E!=a)o.lineWidth=E=a;a=h.linecap;if(C!=a)o.lineCap=C=a;a=h.linejoin;if(L!=a)o.lineJoin=L=a;e(h.color.getContextStyle());o.stroke();Y.inflate(h.linewidth*2)}}function z(a,e,f,k,l,t,p,o,v){h.info.render.vertices+=3;h.info.render.faces++;b(o.opacity);c(o.blending);
|
|
|
|
-J=a.positionScreen.x;V=a.positionScreen.y;X=e.positionScreen.x;O=e.positionScreen.y;n=f.positionScreen.x;U=f.positionScreen.y;B(J,V,X,O,n,U);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(ma=p.uvs[0],$a(J,V,X,O,n,U,ma[k].u,ma[k].v,ma[l].u,ma[l].v,ma[t].u,ma[t].v,o.map));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=m.matrixWorldInverse,ha.copy(p.vertexNormalsWorld[0]),na=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,pa=
|
|
|
|
--(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+0.5,ha.copy(p.vertexNormalsWorld[1]),Ca=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,Fa=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+0.5,ha.copy(p.vertexNormalsWorld[2]),Ea=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,za=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+0.5,$a(J,V,X,O,n,U,na,pa,Ca,Fa,Ea,za,o.envMap)}else o.wireframe?Ma(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Na(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&
|
|
|
|
-(o.map.mapping instanceof THREE.UVMapping&&(ma=p.uvs[0],$a(J,V,X,O,n,U,ma[k].u,ma[k].v,ma[l].u,ma[l].v,ma[t].u,ma[t].v,o.map)),c(THREE.SubtractiveBlending)),ia?!o.wireframe&&o.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3?(Q.r=T.r=fa.r=K.r,Q.g=T.g=fa.g=K.g,Q.b=T.b=fa.b=K.b,u(v,p.v1.positionWorld,p.vertexNormalsWorld[0],Q),u(v,p.v2.positionWorld,p.vertexNormalsWorld[1],T),u(v,p.v3.positionWorld,p.vertexNormalsWorld[2],fa),Q.r=Math.max(0,Math.min(o.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(o.color.g*
|
|
|
|
-Q.g,1)),Q.b=Math.max(0,Math.min(o.color.b*Q.b,1)),T.r=Math.max(0,Math.min(o.color.r*T.r,1)),T.g=Math.max(0,Math.min(o.color.g*T.g,1)),T.b=Math.max(0,Math.min(o.color.b*T.b,1)),fa.r=Math.max(0,Math.min(o.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(o.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(o.color.b*fa.b,1)),ga.r=(T.r+fa.r)*0.5,ga.g=(T.g+fa.g)*0.5,ga.b=(T.b+fa.b)*0.5,sa=Xa(Q,T,fa,ga),Ua(J,V,X,O,n,U,0,0,1,0,0,1,sa)):(ja.r=K.r,ja.g=K.g,ja.b=K.b,u(v,p.centroidWorld,p.normalWorld,ja),Z.r=Math.max(0,Math.min(o.color.r*
|
|
|
|
-ja.r,1)),Z.g=Math.max(0,Math.min(o.color.g*ja.g,1)),Z.b=Math.max(0,Math.min(o.color.b*ja.b,1)),o.wireframe?Ma(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Na(Z)):o.wireframe?Ma(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Na(o.color);else if(o instanceof THREE.MeshDepthMaterial)oa=m.near,da=m.far,Q.r=Q.g=Q.b=1-Qa(a.positionScreen.z,oa,da),T.r=T.g=T.b=1-Qa(e.positionScreen.z,oa,da),fa.r=fa.g=fa.b=1-Qa(f.positionScreen.z,oa,da),ga.r=(T.r+fa.r)*0.5,ga.g=(T.g+
|
|
|
|
-fa.g)*0.5,ga.b=(T.b+fa.b)*0.5,sa=Xa(Q,T,fa,ga),Ua(J,V,X,O,n,U,0,0,1,0,0,1,sa);else if(o instanceof THREE.MeshNormalMaterial)Z.r=Va(p.normalWorld.x),Z.g=Va(p.normalWorld.y),Z.b=Va(p.normalWorld.z),o.wireframe?Ma(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Na(Z)}function y(a,e,f,k,l,t,o,p,v){h.info.render.vertices+=4;h.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)z(a,e,k,0,1,3,o,p,v),z(l,f,t,1,2,3,o,p,v);else if(J=a.positionScreen.x,V=a.positionScreen.y,X=e.positionScreen.x,
|
|
|
|
-O=e.positionScreen.y,n=f.positionScreen.x,U=f.positionScreen.y,$=k.positionScreen.x,aa=k.positionScreen.y,ca=l.positionScreen.x,ea=l.positionScreen.y,la=t.positionScreen.x,ka=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)A(J,V,X,O,n,U,$,aa),p.wireframe?Ma(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Na(p.color);else if(p instanceof THREE.MeshLambertMaterial)ia?!p.wireframe&&p.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==4?(Q.r=T.r=fa.r=ga.r=K.r,Q.g=
|
|
|
|
-T.g=fa.g=ga.g=K.g,Q.b=T.b=fa.b=ga.b=K.b,u(v,o.v1.positionWorld,o.vertexNormalsWorld[0],Q),u(v,o.v2.positionWorld,o.vertexNormalsWorld[1],T),u(v,o.v4.positionWorld,o.vertexNormalsWorld[3],fa),u(v,o.v3.positionWorld,o.vertexNormalsWorld[2],ga),Q.r=Math.max(0,Math.min(p.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(p.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(p.color.b*Q.b,1)),T.r=Math.max(0,Math.min(p.color.r*T.r,1)),T.g=Math.max(0,Math.min(p.color.g*T.g,1)),T.b=Math.max(0,Math.min(p.color.b*T.b,1)),fa.r=Math.max(0,
|
|
|
|
-Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),sa=Xa(Q,T,fa,ga),B(J,V,X,O,$,aa),Ua(J,V,X,O,$,aa,0,0,1,0,0,1,sa),B(ca,ea,n,U,la,ka),Ua(ca,ea,n,U,la,ka,1,0,1,1,0,1,sa)):(ja.r=K.r,ja.g=K.g,ja.b=K.b,u(v,o.centroidWorld,o.normalWorld,ja),Z.r=Math.max(0,Math.min(p.color.r*ja.r,1)),Z.g=Math.max(0,Math.min(p.color.g*
|
|
|
|
-ja.g,1)),Z.b=Math.max(0,Math.min(p.color.b*ja.b,1)),A(J,V,X,O,n,U,$,aa),p.wireframe?Ma(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Na(Z)):(A(J,V,X,O,n,U,$,aa),p.wireframe?Ma(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Na(p.color));else if(p instanceof THREE.MeshNormalMaterial)Z.r=Va(o.normalWorld.x),Z.g=Va(o.normalWorld.y),Z.b=Va(o.normalWorld.z),A(J,V,X,O,n,U,$,aa),p.wireframe?Ma(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Na(Z);else if(p instanceof
|
|
|
|
-THREE.MeshDepthMaterial)oa=m.near,da=m.far,Q.r=Q.g=Q.b=1-Qa(a.positionScreen.z,oa,da),T.r=T.g=T.b=1-Qa(e.positionScreen.z,oa,da),fa.r=fa.g=fa.b=1-Qa(k.positionScreen.z,oa,da),ga.r=ga.g=ga.b=1-Qa(f.positionScreen.z,oa,da),sa=Xa(Q,T,fa,ga),B(J,V,X,O,$,aa),Ua(J,V,X,O,$,aa,0,0,1,0,0,1,sa),B(ca,ea,n,U,la,ka),Ua(ca,ea,n,U,la,ka,1,0,1,1,0,1,sa)}function B(a,c,b,e,f,k){o.beginPath();o.moveTo(a,c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(a,c);o.closePath()}function A(a,c,b,e,f,k,h,n){o.beginPath();o.moveTo(a,
|
|
|
|
-c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(h,n);o.lineTo(a,c);o.closePath()}function Ma(a,c,b,f){if(E!=c)o.lineWidth=E=c;if(C!=b)o.lineCap=C=b;if(L!=f)o.lineJoin=L=f;e(a.getContextStyle());o.stroke();Y.inflate(c*2)}function Na(a){f(a.getContextStyle());o.fill()}function $a(a,c,b,e,k,h,n,l,m,t,p,v,u){if(u.image.width!=0){if(u.needsUpdate==!0||qa[u.id]==void 0){var va=u.wrapS==THREE.RepeatWrapping,M=u.wrapT==THREE.RepeatWrapping;qa[u.id]=o.createPattern(u.image,va&&M?"repeat":va&&!M?"repeat-x":!va&&M?
|
|
|
|
-"repeat-y":"no-repeat");u.needsUpdate=!1}f(qa[u.id]);var va=u.offset.x/u.repeat.x,M=u.offset.y/u.repeat.y,w=(u.image.width-1)*u.repeat.x,u=(u.image.height-1)*u.repeat.y,n=(n+va)*w,l=(l+M)*u,m=(m+va)*w,t=(t+M)*u,p=(p+va)*w,v=(v+M)*u;b-=a;e-=c;k-=a;h-=c;m-=n;t-=l;p-=n;v-=l;va=1/(m*v-p*t);u=(v*b-t*k)*va;t=(v*e-t*h)*va;b=(m*k-p*b)*va;e=(m*h-p*e)*va;a=a-u*n-b*l;c=c-t*n-e*l;o.save();o.transform(u,t,b,e,a,c);o.fill();o.restore()}}function Ua(a,c,b,e,f,k,h,n,l,m,t,p,u){var v,va;v=u.width-1;va=u.height-1;
|
|
|
|
-h*=v;n*=va;l*=v;m*=va;t*=v;p*=va;b-=a;e-=c;f-=a;k-=c;l-=h;m-=n;t-=h;p-=n;va=1/(l*p-t*m);v=(p*b-m*f)*va;m=(p*e-m*k)*va;b=(l*f-t*b)*va;e=(l*k-t*e)*va;a=a-v*h-b*n;c=c-m*h-e*n;o.save();o.transform(v,m,b,e,a,c);o.clip();o.drawImage(u,0,0);o.restore()}function Xa(a,c,b,e){var f=~~(a.r*255),k=~~(a.g*255),a=~~(a.b*255),h=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),l=~~(b.r*255),m=~~(b.g*255),b=~~(b.b*255),t=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255);Ba[0]=f<0?0:f>255?255:f;Ba[1]=k<0?0:k>255?255:k;Ba[2]=a<0?0:a>
|
|
|
|
-255?255:a;Ba[4]=h<0?0:h>255?255:h;Ba[5]=n<0?0:n>255?255:n;Ba[6]=c<0?0:c>255?255:c;Ba[8]=l<0?0:l>255?255:l;Ba[9]=m<0?0:m>255?255:m;Ba[10]=b<0?0:b>255?255:b;Ba[12]=t<0?0:t>255?255:t;Ba[13]=p<0?0:p>255?255:p;Ba[14]=e<0?0:e>255?255:e;ua.putImageData(ya,0,0);Ia.drawImage(xa,0,0);return Ha}function Qa(a,c,b){a=(a-c)/(b-c);return a*a*(3-2*a)}function Va(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Oa(a,c){var b=c.x-a.x,e=c.y-a.y,f=b*b+e*e;f!=0&&(f=1/Math.sqrt(f),b*=f,e*=f,c.x+=b,c.y+=e,a.x-=b,a.y-=e)}var Ya,
|
|
|
|
-ab,ta,Ga,Pa,Wa,Za,Aa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,p,v);h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,m,this.sortElements);(ia=a.lights.length>0)&&t(a);Ya=0;for(ab=k.length;Ya<ab;Ya++){ta=k[Ya];Y.empty();if(ta instanceof THREE.RenderableParticle){F=ta;F.x*=p;F.y*=v;Ga=0;for(Pa=ta.materials.length;Ga<Pa;)Aa=ta.materials[Ga++],Aa.opacity!=0&&w(F,ta,Aa,a)}else if(ta instanceof THREE.RenderableLine){if(F=ta.v1,G=ta.v2,F.positionScreen.x*=p,F.positionScreen.y*=
|
|
|
|
-v,G.positionScreen.x*=p,G.positionScreen.y*=v,Y.addPoint(F.positionScreen.x,F.positionScreen.y),Y.addPoint(G.positionScreen.x,G.positionScreen.y),Da.intersects(Y)){Ga=0;for(Pa=ta.materials.length;Ga<Pa;)Aa=ta.materials[Ga++],Aa.opacity!=0&&x(F,G,ta,Aa,a)}}else if(ta instanceof THREE.RenderableFace3){if(F=ta.v1,G=ta.v2,N=ta.v3,F.positionScreen.x*=p,F.positionScreen.y*=v,G.positionScreen.x*=p,G.positionScreen.y*=v,N.positionScreen.x*=p,N.positionScreen.y*=v,ta.overdraw&&(Oa(F.positionScreen,G.positionScreen),
|
|
|
|
-Oa(G.positionScreen,N.positionScreen),Oa(N.positionScreen,F.positionScreen)),Y.add3Points(F.positionScreen.x,F.positionScreen.y,G.positionScreen.x,G.positionScreen.y,N.positionScreen.x,N.positionScreen.y),Da.intersects(Y)){Ga=0;for(Pa=ta.meshMaterials.length;Ga<Pa;)if(Aa=ta.meshMaterials[Ga++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=ta.faceMaterials.length;Wa<Za;)(Aa=ta.faceMaterials[Wa++])&&Aa.opacity!=0&&z(F,G,N,0,1,2,ta,Aa,a)}else Aa.opacity!=0&&z(F,G,N,0,1,2,ta,Aa,a)}}else if(ta instanceof
|
|
|
|
-THREE.RenderableFace4&&(F=ta.v1,G=ta.v2,N=ta.v3,R=ta.v4,F.positionScreen.x*=p,F.positionScreen.y*=v,G.positionScreen.x*=p,G.positionScreen.y*=v,N.positionScreen.x*=p,N.positionScreen.y*=v,R.positionScreen.x*=p,R.positionScreen.y*=v,H.positionScreen.copy(G.positionScreen),S.positionScreen.copy(R.positionScreen),ta.overdraw&&(Oa(F.positionScreen,G.positionScreen),Oa(G.positionScreen,R.positionScreen),Oa(R.positionScreen,F.positionScreen),Oa(N.positionScreen,H.positionScreen),Oa(N.positionScreen,S.positionScreen)),
|
|
|
|
-Y.addPoint(F.positionScreen.x,F.positionScreen.y),Y.addPoint(G.positionScreen.x,G.positionScreen.y),Y.addPoint(N.positionScreen.x,N.positionScreen.y),Y.addPoint(R.positionScreen.x,R.positionScreen.y),Da.intersects(Y))){Ga=0;for(Pa=ta.meshMaterials.length;Ga<Pa;)if(Aa=ta.meshMaterials[Ga++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=ta.faceMaterials.length;Wa<Za;)(Aa=ta.faceMaterials[Wa++])&&Aa.opacity!=0&&y(F,G,N,R,H,S,ta,Aa,a)}else Aa.opacity!=0&&y(F,G,N,R,H,S,ta,Aa,a)}M.addRectangle(Y)}o.setTransform(1,
|
|
|
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,f,h;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;e=b;f=c/2;h=e/2};this.render=function(c,e){var n,p,u,t,v,o,y,x;a=b.projectScene(c,e);n=0;for(p=a.length;n<p;n++)if(v=a[n],v instanceof THREE.RenderableParticle){y=v.x*f+f;x=v.y*h+h;u=0;for(t=v.material.length;u<t;u++)if(o=v.material[u],o instanceof THREE.ParticleDOMMaterial)o=o.domElement,o.style.left=y+"px",o.style.top=x+"px"}}};
|
|
|
|
+THREE.CanvasRenderer=function(a){function b(a){if(w!=a)o.globalAlpha=w=a}function c(a){if(A!=a){switch(a){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}A=a}}function e(a){if(z!=a)o.strokeStyle=z=a}function f(a){if(C!=a)o.fillStyle=C=a}var h=this,k=null,l=new THREE.Projector,a=a||{},n=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
|
+p,u,t,v,o=n.getContext("2d"),y=new THREE.Color(0),x=0,w=1,A=0,z=null,C=null,B=null,K=null,F=null,M,E,O,V,H=new THREE.RenderableVertex,P=new THREE.RenderableVertex,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z=new THREE.Color(0),R=new THREE.Color(0),Y=new THREE.Color(0),X=new THREE.Color(0),ga=new THREE.Color(0),oa=[],na,fa,qa,la,ua,sa,Da,Ea,za,Fa,xa=new THREE.Rectangle,G=new THREE.Rectangle,$=new THREE.Rectangle,ma=!1,I=new THREE.Color,N=new THREE.Color,ta=new THREE.Color,pa=new THREE.Color,ka=new THREE.Vector3,
|
|
|
|
+ya,va,Ca,Ba,Ga,W,a=16;ya=document.createElement("canvas");ya.width=ya.height=2;va=ya.getContext("2d");va.fillStyle="rgba(0,0,0,1)";va.fillRect(0,0,2,2);Ca=va.getImageData(0,0,2,2);Ba=Ca.data;Ga=document.createElement("canvas");Ga.width=Ga.height=a;W=Ga.getContext("2d");W.translate(-a/2,-a/2);W.scale(a,a);a--;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,c){p=a;u=c;t=Math.floor(p/2);v=Math.floor(u/2);n.width=p;
|
|
|
|
+n.height=u;xa.set(-t,-v,t,v);G.set(-t,-v,t,v);w=1;A=0;F=K=B=C=z=null};this.setClearColor=function(a,c){y.copy(a);x=c;G.set(-t,-v,t,v)};this.setClearColorHex=function(a,c){y.setHex(a);x=c;G.set(-t,-v,t,v)};this.clear=function(){o.setTransform(1,0,0,-1,t,v);G.isEmpty()||(G.minSelf(xa),G.inflate(2),x<1&&o.clearRect(Math.floor(G.getX()),Math.floor(G.getY()),Math.floor(G.getWidth()),Math.floor(G.getHeight())),x>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+
|
|
|
|
+Math.floor(y.b*255)+","+x+")"),o.fillRect(Math.floor(G.getX()),Math.floor(G.getY()),Math.floor(G.getWidth()),Math.floor(G.getHeight()))),G.empty())};this.render=function(a,n){function p(a){var c,b,e,f=a.lights;N.setRGB(0,0,0);ta.setRGB(0,0,0);pa.setRGB(0,0,0);a=0;for(c=f.length;a<c;a++)b=f[a],e=b.color,b instanceof THREE.AmbientLight?(N.r+=e.r,N.g+=e.g,N.b+=e.b):b instanceof THREE.DirectionalLight?(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b):b instanceof THREE.PointLight&&(pa.r+=e.r,pa.g+=e.g,pa.b+=e.b)}function u(a,
|
|
|
|
+c,b,e){var f,k,h,m,l=a.lights,a=0;for(f=l.length;a<f;a++)k=l[a],h=k.color,k instanceof THREE.DirectionalLight?(m=b.dot(k.position),m<=0||(m*=k.intensity,e.r+=h.r*m,e.g+=h.g*m,e.b+=h.b*m)):k instanceof THREE.PointLight&&(m=b.dot(ka.sub(k.position,c).normalize()),m<=0||(m*=k.distance==0?1:1-Math.min(c.distanceTo(k.position)/k.distance,1),m!=0&&(m*=k.intensity,e.r+=h.r*m,e.g+=h.g*m,e.b+=h.b*m)))}function x(a,k,h){b(h.opacity);c(h.blending);var m,l,n,p,u,wa;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)p=
|
|
|
|
+h.map.image,u=p.width>>1,wa=p.height>>1,h=k.scale.x*t,n=k.scale.y*v,m=h*u,l=n*wa,$.set(a.x-m,a.y-l,a.x+m,a.y+l),xa.intersects($)&&(o.save(),o.translate(a.x,a.y),o.rotate(-k.rotation),o.scale(h,-n),o.translate(-u,-wa),o.drawImage(p,0,0),o.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(m=k.scale.x*t,l=k.scale.y*v,$.set(a.x-m,a.y-l,a.x+m,a.y+l),xa.intersects($)&&(e(h.color.getContextStyle()),f(h.color.getContextStyle()),o.save(),o.translate(a.x,a.y),o.rotate(-k.rotation),o.scale(m,l),h.program(o),
|
|
|
|
+o.restore()))}function w(a,f,k,h){b(h.opacity);c(h.blending);o.beginPath();o.moveTo(a.positionScreen.x,a.positionScreen.y);o.lineTo(f.positionScreen.x,f.positionScreen.y);o.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(B!=a)o.lineWidth=B=a;a=h.linecap;if(K!=a)o.lineCap=K=a;a=h.linejoin;if(F!=a)o.lineJoin=F=a;e(h.color.getContextStyle());o.stroke();$.inflate(h.linewidth*2)}}function y(a,e,f,k,l,p,t,o,v){h.info.render.vertices+=3;h.info.render.faces++;b(o.opacity);c(o.blending);
|
|
|
|
+L=a.positionScreen.x;T=a.positionScreen.y;S=e.positionScreen.x;m=e.positionScreen.y;aa=f.positionScreen.x;U=f.positionScreen.y;A(L,T,S,m,aa,U);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(la=t.uvs[0],$a(L,T,S,m,aa,U,la[k].u,la[k].v,la[l].u,la[l].v,la[p].u,la[p].v,o.map));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=n.matrixWorldInverse,ka.copy(t.vertexNormalsWorld[0]),ua=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,
|
|
|
|
+sa=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,ka.copy(t.vertexNormalsWorld[1]),Da=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,Ea=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,ka.copy(t.vertexNormalsWorld[2]),za=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,Fa=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,$a(L,T,S,m,aa,U,ua,sa,Da,Ea,za,Fa,o.envMap)}else o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&
|
|
|
|
+(o.map.mapping instanceof THREE.UVMapping&&(la=t.uvs[0],$a(L,T,S,m,aa,U,la[k].u,la[k].v,la[l].u,la[l].v,la[p].u,la[p].v,o.map)),c(THREE.SubtractiveBlending)),ma?!o.wireframe&&o.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?(R.r=Y.r=X.r=N.r,R.g=Y.g=X.g=N.g,R.b=Y.b=X.b=N.b,u(v,t.v1.positionWorld,t.vertexNormalsWorld[0],R),u(v,t.v2.positionWorld,t.vertexNormalsWorld[1],Y),u(v,t.v3.positionWorld,t.vertexNormalsWorld[2],X),R.r=Math.max(0,Math.min(o.color.r*R.r,1)),R.g=Math.max(0,Math.min(o.color.g*
|
|
|
|
+R.g,1)),R.b=Math.max(0,Math.min(o.color.b*R.b,1)),Y.r=Math.max(0,Math.min(o.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(o.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(o.color.b*Y.b,1)),X.r=Math.max(0,Math.min(o.color.r*X.r,1)),X.g=Math.max(0,Math.min(o.color.g*X.g,1)),X.b=Math.max(0,Math.min(o.color.b*X.b,1)),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,ga.b=(Y.b+X.b)*0.5,qa=Xa(R,Y,X,ga),Ua(L,T,S,m,aa,U,0,0,1,0,0,1,qa)):(I.r=N.r,I.g=N.g,I.b=N.b,u(v,t.centroidWorld,t.normalWorld,I),Z.r=Math.max(0,Math.min(o.color.r*
|
|
|
|
+I.r,1)),Z.g=Math.max(0,Math.min(o.color.g*I.g,1)),Z.b=Math.max(0,Math.min(o.color.b*I.b,1)),o.wireframe?Ka(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(Z)):o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color);else if(o instanceof THREE.MeshDepthMaterial)na=n.near,fa=n.far,R.r=R.g=R.b=1-Oa(a.positionScreen.z,na,fa),Y.r=Y.g=Y.b=1-Oa(e.positionScreen.z,na,fa),X.r=X.g=X.b=1-Oa(f.positionScreen.z,na,fa),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,
|
|
|
|
+ga.b=(Y.b+X.b)*0.5,qa=Xa(R,Y,X,ga),Ua(L,T,S,m,aa,U,0,0,1,0,0,1,qa);else if(o instanceof THREE.MeshNormalMaterial)Z.r=Va(t.normalWorld.x),Z.g=Va(t.normalWorld.y),Z.b=Va(t.normalWorld.z),o.wireframe?Ka(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(Z)}function z(a,e,f,k,l,p,o,t,v){h.info.render.vertices+=4;h.info.render.faces++;b(t.opacity);c(t.blending);if(t.map||t.envMap)y(a,e,k,0,1,3,o,t,v),y(l,f,p,1,2,3,o,t,v);else if(L=a.positionScreen.x,T=a.positionScreen.y,S=e.positionScreen.x,
|
|
|
|
+m=e.positionScreen.y,aa=f.positionScreen.x,U=f.positionScreen.y,ea=k.positionScreen.x,da=k.positionScreen.y,ia=l.positionScreen.x,ha=l.positionScreen.y,ja=p.positionScreen.x,ca=p.positionScreen.y,t instanceof THREE.MeshBasicMaterial)C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color);else if(t instanceof THREE.MeshLambertMaterial)ma?!t.wireframe&&t.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==4?(R.r=Y.r=X.r=ga.r=N.r,R.g=
|
|
|
|
+Y.g=X.g=ga.g=N.g,R.b=Y.b=X.b=ga.b=N.b,u(v,o.v1.positionWorld,o.vertexNormalsWorld[0],R),u(v,o.v2.positionWorld,o.vertexNormalsWorld[1],Y),u(v,o.v4.positionWorld,o.vertexNormalsWorld[3],X),u(v,o.v3.positionWorld,o.vertexNormalsWorld[2],ga),R.r=Math.max(0,Math.min(t.color.r*R.r,1)),R.g=Math.max(0,Math.min(t.color.g*R.g,1)),R.b=Math.max(0,Math.min(t.color.b*R.b,1)),Y.r=Math.max(0,Math.min(t.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(t.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(t.color.b*Y.b,1)),X.r=Math.max(0,
|
|
|
|
+Math.min(t.color.r*X.r,1)),X.g=Math.max(0,Math.min(t.color.g*X.g,1)),X.b=Math.max(0,Math.min(t.color.b*X.b,1)),ga.r=Math.max(0,Math.min(t.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(t.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(t.color.b*ga.b,1)),qa=Xa(R,Y,X,ga),A(L,T,S,m,ea,da),Ua(L,T,S,m,ea,da,0,0,1,0,0,1,qa),A(ia,ha,aa,U,ja,ca),Ua(ia,ha,aa,U,ja,ca,1,0,1,1,0,1,qa)):(I.r=N.r,I.g=N.g,I.b=N.b,u(v,o.centroidWorld,o.normalWorld,I),Z.r=Math.max(0,Math.min(t.color.r*I.r,1)),Z.g=Math.max(0,Math.min(t.color.g*
|
|
|
|
+I.g,1)),Z.b=Math.max(0,Math.min(t.color.b*I.b,1)),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z)):(C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color));else if(t instanceof THREE.MeshNormalMaterial)Z.r=Va(o.normalWorld.x),Z.g=Va(o.normalWorld.y),Z.b=Va(o.normalWorld.z),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z);
|
|
|
|
+else if(t instanceof THREE.MeshDepthMaterial)na=n.near,fa=n.far,R.r=R.g=R.b=1-Oa(a.positionScreen.z,na,fa),Y.r=Y.g=Y.b=1-Oa(e.positionScreen.z,na,fa),X.r=X.g=X.b=1-Oa(k.positionScreen.z,na,fa),ga.r=ga.g=ga.b=1-Oa(f.positionScreen.z,na,fa),qa=Xa(R,Y,X,ga),A(L,T,S,m,ea,da),Ua(L,T,S,m,ea,da,0,0,1,0,0,1,qa),A(ia,ha,aa,U,ja,ca),Ua(ia,ha,aa,U,ja,ca,1,0,1,1,0,1,qa)}function A(a,c,b,e,f,k){o.beginPath();o.moveTo(a,c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(a,c);o.closePath()}function C(a,c,b,e,f,k,h,m){o.beginPath();
|
|
|
|
+o.moveTo(a,c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(h,m);o.lineTo(a,c);o.closePath()}function Ka(a,c,b,f){if(B!=c)o.lineWidth=B=c;if(K!=b)o.lineCap=K=b;if(F!=f)o.lineJoin=F=f;e(a.getContextStyle());o.stroke();$.inflate(c*2)}function La(a){f(a.getContextStyle());o.fill()}function $a(a,c,b,e,k,h,m,l,n,p,t,u,v){if(v.image.width!=0){if(v.needsUpdate==!0||oa[v.id]==void 0){var wa=v.wrapS==THREE.RepeatWrapping,G=v.wrapT==THREE.RepeatWrapping;oa[v.id]=o.createPattern(v.image,wa&&G?"repeat":wa&&!G?"repeat-x":
|
|
|
|
+!wa&&G?"repeat-y":"no-repeat");v.needsUpdate=!1}f(oa[v.id]);var wa=v.offset.x/v.repeat.x,G=v.offset.y/v.repeat.y,x=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,m=(m+wa)*x,l=(l+G)*v,n=(n+wa)*x,p=(p+G)*v,t=(t+wa)*x,u=(u+G)*v;b-=a;e-=c;k-=a;h-=c;n-=m;p-=l;t-=m;u-=l;wa=1/(n*u-t*p);v=(u*b-p*k)*wa;p=(u*e-p*h)*wa;b=(n*k-t*b)*wa;e=(n*h-t*e)*wa;a=a-v*m-b*l;c=c-p*m-e*l;o.save();o.transform(v,p,b,e,a,c);o.fill();o.restore()}}function Ua(a,c,b,e,f,k,h,m,l,n,p,t,v){var u,wa;u=v.width-1;wa=v.height-
|
|
|
|
+1;h*=u;m*=wa;l*=u;n*=wa;p*=u;t*=wa;b-=a;e-=c;f-=a;k-=c;l-=h;n-=m;p-=h;t-=m;wa=1/(l*t-p*n);u=(t*b-n*f)*wa;n=(t*e-n*k)*wa;b=(l*f-p*b)*wa;e=(l*k-p*e)*wa;a=a-u*h-b*m;c=c-n*h-e*m;o.save();o.transform(u,n,b,e,a,c);o.clip();o.drawImage(v,0,0);o.restore()}function Xa(a,c,b,e){var f=~~(a.r*255),k=~~(a.g*255),a=~~(a.b*255),h=~~(c.r*255),m=~~(c.g*255),c=~~(c.b*255),l=~~(b.r*255),n=~~(b.g*255),b=~~(b.b*255),p=~~(e.r*255),t=~~(e.g*255),e=~~(e.b*255);Ba[0]=f<0?0:f>255?255:f;Ba[1]=k<0?0:k>255?255:k;Ba[2]=a<0?0:
|
|
|
|
+a>255?255:a;Ba[4]=h<0?0:h>255?255:h;Ba[5]=m<0?0:m>255?255:m;Ba[6]=c<0?0:c>255?255:c;Ba[8]=l<0?0:l>255?255:l;Ba[9]=n<0?0:n>255?255:n;Ba[10]=b<0?0:b>255?255:b;Ba[12]=p<0?0:p>255?255:p;Ba[13]=t<0?0:t>255?255:t;Ba[14]=e<0?0:e>255?255:e;va.putImageData(Ca,0,0);W.drawImage(ya,0,0);return Ga}function Oa(a,c,b){a=(a-c)/(b-c);return a*a*(3-2*a)}function Va(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ma(a,c){var b=c.x-a.x,e=c.y-a.y,f=b*b+e*e;f!=0&&(f=1/Math.sqrt(f),b*=f,e*=f,c.x+=b,c.y+=e,a.x-=b,a.y-=e)}var Ya,
|
|
|
|
+ab,ra,Ha,Na,Wa,Za,Aa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,t,v);h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,n,this.sortElements);(ma=a.lights.length>0)&&p(a);Ya=0;for(ab=k.length;Ya<ab;Ya++){ra=k[Ya];$.empty();if(ra instanceof THREE.RenderableParticle){M=ra;M.x*=t;M.y*=v;Ha=0;for(Na=ra.materials.length;Ha<Na;)Aa=ra.materials[Ha++],Aa.opacity!=0&&x(M,ra,Aa,a)}else if(ra instanceof THREE.RenderableLine){if(M=ra.v1,E=ra.v2,M.positionScreen.x*=t,M.positionScreen.y*=
|
|
|
|
+v,E.positionScreen.x*=t,E.positionScreen.y*=v,$.addPoint(M.positionScreen.x,M.positionScreen.y),$.addPoint(E.positionScreen.x,E.positionScreen.y),xa.intersects($)){Ha=0;for(Na=ra.materials.length;Ha<Na;)Aa=ra.materials[Ha++],Aa.opacity!=0&&w(M,E,ra,Aa,a)}}else if(ra instanceof THREE.RenderableFace3){if(M=ra.v1,E=ra.v2,O=ra.v3,M.positionScreen.x*=t,M.positionScreen.y*=v,E.positionScreen.x*=t,E.positionScreen.y*=v,O.positionScreen.x*=t,O.positionScreen.y*=v,ra.overdraw&&(Ma(M.positionScreen,E.positionScreen),
|
|
|
|
+Ma(E.positionScreen,O.positionScreen),Ma(O.positionScreen,M.positionScreen)),$.add3Points(M.positionScreen.x,M.positionScreen.y,E.positionScreen.x,E.positionScreen.y,O.positionScreen.x,O.positionScreen.y),xa.intersects($)){Ha=0;for(Na=ra.meshMaterials.length;Ha<Na;)if(Aa=ra.meshMaterials[Ha++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=ra.faceMaterials.length;Wa<Za;)(Aa=ra.faceMaterials[Wa++])&&Aa.opacity!=0&&y(M,E,O,0,1,2,ra,Aa,a)}else Aa.opacity!=0&&y(M,E,O,0,1,2,ra,Aa,a)}}else if(ra instanceof
|
|
|
|
+THREE.RenderableFace4&&(M=ra.v1,E=ra.v2,O=ra.v3,V=ra.v4,M.positionScreen.x*=t,M.positionScreen.y*=v,E.positionScreen.x*=t,E.positionScreen.y*=v,O.positionScreen.x*=t,O.positionScreen.y*=v,V.positionScreen.x*=t,V.positionScreen.y*=v,H.positionScreen.copy(E.positionScreen),P.positionScreen.copy(V.positionScreen),ra.overdraw&&(Ma(M.positionScreen,E.positionScreen),Ma(E.positionScreen,V.positionScreen),Ma(V.positionScreen,M.positionScreen),Ma(O.positionScreen,H.positionScreen),Ma(O.positionScreen,P.positionScreen)),
|
|
|
|
+$.addPoint(M.positionScreen.x,M.positionScreen.y),$.addPoint(E.positionScreen.x,E.positionScreen.y),$.addPoint(O.positionScreen.x,O.positionScreen.y),$.addPoint(V.positionScreen.x,V.positionScreen.y),xa.intersects($))){Ha=0;for(Na=ra.meshMaterials.length;Ha<Na;)if(Aa=ra.meshMaterials[Ha++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=ra.faceMaterials.length;Wa<Za;)(Aa=ra.faceMaterials[Wa++])&&Aa.opacity!=0&&z(M,E,O,V,H,P,ra,Aa,a)}else Aa.opacity!=0&&z(M,E,O,V,H,P,ra,Aa,a)}G.addRectangle($)}o.setTransform(1,
|
|
0,0,1,0,0)}};
|
|
0,0,1,0,0)}};
|
|
-THREE.SVGRenderer=function(){function a(a,c,b){var e,f,k,h;e=0;for(f=a.lights.length;e<f;e++)k=a.lights[e],k instanceof THREE.DirectionalLight?(h=c.normalWorld.dot(k.position)*k.intensity,h>0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h)):k instanceof THREE.PointLight&&(R.sub(k.position,c.centroidWorld),R.normalize(),h=c.normalWorld.dot(R)*k.intensity,h>0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h))}function b(c,b,k,l,t,p){h.info.render.vertices+=3;h.info.render.faces++;J=e(V++);
|
|
|
|
-J.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?E.copy(t.color):t instanceof THREE.MeshLambertMaterial?A?(C.r=L.r,C.g=L.g,C.b=L.b,a(p,l,C),E.r=Math.max(0,Math.min(t.color.r*C.r,1)),E.g=Math.max(0,Math.min(t.color.g*C.g,1)),E.b=Math.max(0,Math.min(t.color.b*C.b,1))):E.copy(t.color):t instanceof THREE.MeshDepthMaterial?(N=1-t.__2near/(t.__farPlusNear-
|
|
|
|
-l.z*t.__farMinusNear),E.setRGB(N,N,N)):t instanceof THREE.MeshNormalMaterial&&E.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));t.wireframe?J.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):J.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+t.opacity);m.appendChild(J)}function c(c,b,k,l,t,p,o){h.info.render.vertices+=
|
|
|
|
-4;h.info.render.faces++;J=e(V++);J.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+l.positionScreen.x+","+l.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?E.copy(p.color):p instanceof THREE.MeshLambertMaterial?A?(C.r=L.r,C.g=L.g,C.b=L.b,a(o,t,C),E.r=Math.max(0,Math.min(p.color.r*C.r,1)),E.g=Math.max(0,Math.min(p.color.g*C.g,1)),E.b=Math.max(0,Math.min(p.color.b*C.b,1))):
|
|
|
|
-E.copy(p.color):p instanceof THREE.MeshDepthMaterial?(N=1-p.__2near/(p.__farPlusNear-t.z*p.__farMinusNear),E.setRGB(N,N,N)):p instanceof THREE.MeshNormalMaterial&&E.setRGB(f(t.normalWorld.x),f(t.normalWorld.y),f(t.normalWorld.z));p.wireframe?J.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):J.setAttribute("style","fill: "+E.getContextStyle()+
|
|
|
|
-"; fill-opacity: "+p.opacity);m.appendChild(J)}function e(a){H[a]==null&&(H[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),O==0&&H[a].setAttribute("shape-rendering","crispEdges"));return H[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var h=this,k=null,l=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,u,p,v,o,z,x,w,B=new THREE.Rectangle,y=new THREE.Rectangle,A=!1,E=new THREE.Color(16777215),C=new THREE.Color(16777215),L=new THREE.Color(0),
|
|
|
|
-F=new THREE.Color(0),G=new THREE.Color(0),N,R=new THREE.Vector3,H=[],S=[],J,V,X,O=1;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,c){t=a;u=c;p=t/2;v=u/2;m.setAttribute("viewBox",-p+" "+-v+" "+t+" "+u);m.setAttribute("width",t);m.setAttribute("height",u);B.set(-p,-v,p,v)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};
|
|
|
|
-this.render=function(a,e){var f,t,u,E,N,H,C,Q;this.autoClear&&this.clear();h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,e,this.sortElements);X=V=0;if(A=a.lights.length>0){C=a.lights;L.setRGB(0,0,0);F.setRGB(0,0,0);G.setRGB(0,0,0);f=0;for(t=C.length;f<t;f++)u=C[f],E=u.color,u instanceof THREE.AmbientLight?(L.r+=E.r,L.g+=E.g,L.b+=E.b):u instanceof THREE.DirectionalLight?(F.r+=E.r,F.g+=E.g,F.b+=E.b):u instanceof THREE.PointLight&&(G.r+=E.r,G.g+=E.g,G.b+=E.b)}f=0;for(t=k.length;f<
|
|
|
|
-t;f++)if(C=k[f],y.empty(),C instanceof THREE.RenderableParticle){o=C;o.x*=p;o.y*=-v;u=0;for(E=C.materials.length;u<E;)u++}else if(C instanceof THREE.RenderableLine){if(o=C.v1,z=C.v2,o.positionScreen.x*=p,o.positionScreen.y*=-v,z.positionScreen.x*=p,z.positionScreen.y*=-v,y.addPoint(o.positionScreen.x,o.positionScreen.y),y.addPoint(z.positionScreen.x,z.positionScreen.y),B.intersects(y)){u=0;for(E=C.materials.length;u<E;)if((Q=C.materials[u++])&&Q.opacity!=0){N=o;H=z;var T=X++;S[T]==null&&(S[T]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
-"line"),O==0&&S[T].setAttribute("shape-rendering","crispEdges"));J=S[T];J.setAttribute("x1",N.positionScreen.x);J.setAttribute("y1",N.positionScreen.y);J.setAttribute("x2",H.positionScreen.x);J.setAttribute("y2",H.positionScreen.y);Q instanceof THREE.LineBasicMaterial&&(J.setAttribute("style","fill: none; stroke: "+Q.color.getContextStyle()+"; stroke-width: "+Q.linewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.linecap+"; stroke-linejoin: "+Q.linejoin),m.appendChild(J))}}}else if(C instanceof
|
|
|
|
-THREE.RenderableFace3){if(o=C.v1,z=C.v2,x=C.v3,o.positionScreen.x*=p,o.positionScreen.y*=-v,z.positionScreen.x*=p,z.positionScreen.y*=-v,x.positionScreen.x*=p,x.positionScreen.y*=-v,y.addPoint(o.positionScreen.x,o.positionScreen.y),y.addPoint(z.positionScreen.x,z.positionScreen.y),y.addPoint(x.positionScreen.x,x.positionScreen.y),B.intersects(y)){u=0;for(E=C.meshMaterials.length;u<E;)if(Q=C.meshMaterials[u++],Q instanceof THREE.MeshFaceMaterial){N=0;for(H=C.faceMaterials.length;N<H;)(Q=C.faceMaterials[N++])&&
|
|
|
|
-Q.opacity!=0&&b(o,z,x,C,Q,a)}else Q&&Q.opacity!=0&&b(o,z,x,C,Q,a)}}else if(C instanceof THREE.RenderableFace4&&(o=C.v1,z=C.v2,x=C.v3,w=C.v4,o.positionScreen.x*=p,o.positionScreen.y*=-v,z.positionScreen.x*=p,z.positionScreen.y*=-v,x.positionScreen.x*=p,x.positionScreen.y*=-v,w.positionScreen.x*=p,w.positionScreen.y*=-v,y.addPoint(o.positionScreen.x,o.positionScreen.y),y.addPoint(z.positionScreen.x,z.positionScreen.y),y.addPoint(x.positionScreen.x,x.positionScreen.y),y.addPoint(w.positionScreen.x,w.positionScreen.y),
|
|
|
|
-B.intersects(y))){u=0;for(E=C.meshMaterials.length;u<E;)if(Q=C.meshMaterials[u++],Q instanceof THREE.MeshFaceMaterial){N=0;for(H=C.faceMaterials.length;N<H;)(Q=C.faceMaterials[N++])&&Q.opacity!=0&&c(o,z,x,w,C,Q,a)}else Q&&Q.opacity!=0&&c(o,z,x,w,C,Q,a)}}};
|
|
|
|
|
|
+THREE.SVGRenderer=function(){function a(a,c,b){var e,f,k,h;e=0;for(f=a.lights.length;e<f;e++)k=a.lights[e],k instanceof THREE.DirectionalLight?(h=c.normalWorld.dot(k.position)*k.intensity,h>0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h)):k instanceof THREE.PointLight&&(V.sub(k.position,c.centroidWorld),V.normalize(),h=c.normalWorld.dot(V)*k.intensity,h>0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h))}function b(c,b,k,m,l,p){h.info.render.vertices+=3;h.info.render.faces++;L=e(T++);
|
|
|
|
+L.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");l instanceof THREE.MeshBasicMaterial?B.copy(l.color):l instanceof THREE.MeshLambertMaterial?C?(K.r=F.r,K.g=F.g,K.b=F.b,a(p,m,K),B.r=Math.max(0,Math.min(l.color.r*K.r,1)),B.g=Math.max(0,Math.min(l.color.g*K.g,1)),B.b=Math.max(0,Math.min(l.color.b*K.b,1))):B.copy(l.color):l instanceof THREE.MeshDepthMaterial?(O=1-l.__2near/(l.__farPlusNear-
|
|
|
|
+m.z*l.__farMinusNear),B.setRGB(O,O,O)):l instanceof THREE.MeshNormalMaterial&&B.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));l.wireframe?L.setAttribute("style","fill: none; stroke: "+B.getContextStyle()+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):L.setAttribute("style","fill: "+B.getContextStyle()+"; fill-opacity: "+l.opacity);n.appendChild(L)}function c(c,b,k,m,l,p,t){h.info.render.vertices+=
|
|
|
|
+4;h.info.render.faces++;L=e(T++);L.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?B.copy(p.color):p instanceof THREE.MeshLambertMaterial?C?(K.r=F.r,K.g=F.g,K.b=F.b,a(t,l,K),B.r=Math.max(0,Math.min(p.color.r*K.r,1)),B.g=Math.max(0,Math.min(p.color.g*K.g,1)),B.b=Math.max(0,Math.min(p.color.b*K.b,1))):
|
|
|
|
+B.copy(p.color):p instanceof THREE.MeshDepthMaterial?(O=1-p.__2near/(p.__farPlusNear-l.z*p.__farMinusNear),B.setRGB(O,O,O)):p instanceof THREE.MeshNormalMaterial&&B.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));p.wireframe?L.setAttribute("style","fill: none; stroke: "+B.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):L.setAttribute("style","fill: "+B.getContextStyle()+
|
|
|
|
+"; fill-opacity: "+p.opacity);n.appendChild(L)}function e(a){H[a]==null&&(H[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),m==0&&H[a].setAttribute("shape-rendering","crispEdges"));return H[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var h=this,k=null,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,u,t,v,o,y,x,w,A=new THREE.Rectangle,z=new THREE.Rectangle,C=!1,B=new THREE.Color(16777215),K=new THREE.Color(16777215),F=new THREE.Color(0),
|
|
|
|
+M=new THREE.Color(0),E=new THREE.Color(0),O,V=new THREE.Vector3,H=[],P=[],L,T,S,m=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":m=1;break;case "low":m=0}};this.setSize=function(a,c){p=a;u=c;t=p/2;v=u/2;n.setAttribute("viewBox",-t+" "+-v+" "+p+" "+u);n.setAttribute("width",p);n.setAttribute("height",u);A.set(-t,-v,t,v)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};
|
|
|
|
+this.render=function(a,e){var f,p,u,B,O,H,K,R;this.autoClear&&this.clear();h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,e,this.sortElements);S=T=0;if(C=a.lights.length>0){K=a.lights;F.setRGB(0,0,0);M.setRGB(0,0,0);E.setRGB(0,0,0);f=0;for(p=K.length;f<p;f++)u=K[f],B=u.color,u instanceof THREE.AmbientLight?(F.r+=B.r,F.g+=B.g,F.b+=B.b):u instanceof THREE.DirectionalLight?(M.r+=B.r,M.g+=B.g,M.b+=B.b):u instanceof THREE.PointLight&&(E.r+=B.r,E.g+=B.g,E.b+=B.b)}f=0;for(p=k.length;f<
|
|
|
|
+p;f++)if(K=k[f],z.empty(),K instanceof THREE.RenderableParticle){o=K;o.x*=t;o.y*=-v;u=0;for(B=K.materials.length;u<B;)u++}else if(K instanceof THREE.RenderableLine){if(o=K.v1,y=K.v2,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),A.intersects(z)){u=0;for(B=K.materials.length;u<B;)if((R=K.materials[u++])&&R.opacity!=0){O=o;H=y;var Y=S++;P[Y]==null&&(P[Y]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
+"line"),m==0&&P[Y].setAttribute("shape-rendering","crispEdges"));L=P[Y];L.setAttribute("x1",O.positionScreen.x);L.setAttribute("y1",O.positionScreen.y);L.setAttribute("x2",H.positionScreen.x);L.setAttribute("y2",H.positionScreen.y);R instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+R.color.getContextStyle()+"; stroke-width: "+R.linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.linecap+"; stroke-linejoin: "+R.linejoin),n.appendChild(L))}}}else if(K instanceof
|
|
|
|
+THREE.RenderableFace3){if(o=K.v1,y=K.v2,x=K.v3,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),z.addPoint(x.positionScreen.x,x.positionScreen.y),A.intersects(z)){u=0;for(B=K.meshMaterials.length;u<B;)if(R=K.meshMaterials[u++],R instanceof THREE.MeshFaceMaterial){O=0;for(H=K.faceMaterials.length;O<H;)(R=K.faceMaterials[O++])&&
|
|
|
|
+R.opacity!=0&&b(o,y,x,K,R,a)}else R&&R.opacity!=0&&b(o,y,x,K,R,a)}}else if(K instanceof THREE.RenderableFace4&&(o=K.v1,y=K.v2,x=K.v3,w=K.v4,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,w.positionScreen.x*=t,w.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),z.addPoint(x.positionScreen.x,x.positionScreen.y),z.addPoint(w.positionScreen.x,w.positionScreen.y),
|
|
|
|
+A.intersects(z))){u=0;for(B=K.meshMaterials.length;u<B;)if(R=K.meshMaterials[u++],R instanceof THREE.MeshFaceMaterial){O=0;for(H=K.faceMaterials.length;O<H;)(R=K.faceMaterials[O++])&&R.opacity!=0&&c(o,y,x,w,K,R,a)}else R&&R.opacity!=0&&c(o,y,x,w,K,R,a)}}};
|
|
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",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
|
|
@@ -227,123 +227,122 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
|
|
THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
|
|
THREE.ShaderChunk.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.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.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,c){var b;a.material&&!(a.material instanceof THREE.MeshFaceMaterial)?b=a.material:c.materialIndex>=0&&(b=a.geometry.materials[c.materialIndex]);return b}function c(a,c,b){var e,f,k,h=a.vertices,l=h.length,m=a.colors,t=m.length,p=a.__vertexArray,o=a.__colorArray,u=a.__sortArray,v=a.__dirtyVertices,M=a.__dirtyColors,w=a.__webglCustomAttributesList,x;if(w){k=0;for(e=w.length;k<e;k++)w[k].offset=0}if(b.sortParticles){Ca.multiplySelf(b.matrixWorld);for(e=0;e<
|
|
|
|
-l;e++)f=h[e].position,za.copy(f),Ca.multiplyVector3(za),u[e]=[za.z,e];u.sort(function(a,c){return c[0]-a[0]});for(e=0;e<l;e++)f=h[u[e][1]].position,k=e*3,p[k]=f.x,p[k+1]=f.y,p[k+2]=f.z;for(e=0;e<t;e++)k=e*3,color=m[u[e][1]],o[k]=color.r,o[k+1]=color.g,o[k+2]=color.b;if(w){k=0;for(e=w.length;k<e;k++){l=w[k];t=l.value.length;for(m=0;m<t;m++){index=u[m][1];h=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[h]=l.value[index]}else{if(l.boundTo===void 0||l.boundTo==="vertices")x=
|
|
|
|
-l.value[index];l.size===2?(l.array[h]=x.x,l.array[h+1]=x.y):l.size===3?l.type==="c"?(l.array[h]=x.r,l.array[h+1]=x.g,l.array[h+2]=x.b):(l.array[h]=x.x,l.array[h+1]=x.y,l.array[h+2]=x.z):(l.array[h]=x.x,l.array[h+1]=x.y,l.array[h+2]=x.z,l.array[h+3]=x.w)}l.offset+=l.size}}}}else{if(v)for(e=0;e<l;e++)f=h[e].position,k=e*3,p[k]=f.x,p[k+1]=f.y,p[k+2]=f.z;if(M)for(e=0;e<t;e++)color=m[e],k=e*3,o[k]=color.r,o[k+1]=color.g,o[k+2]=color.b;if(w){k=0;for(e=w.length;k<e;k++)if(l=w[k],l.__original.needsUpdate){t=
|
|
|
|
-l.value.length;for(m=0;m<t;m++){h=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[h]=l.value[m]}else{if(l.boundTo===void 0||l.boundTo==="vertices")x=l.value[m];l.size===2?(l.array[h]=x.x,l.array[h+1]=x.y):l.size===3?l.type==="c"?(l.array[h]=x.r,l.array[h+1]=x.g,l.array[h+2]=x.b):(l.array[h]=x.x,l.array[h+1]=x.y,l.array[h+2]=x.z):(l.array[h]=x.x,l.array[h+1]=x.y,l.array[h+2]=x.z,l.array[h+3]=x.w)}l.offset+=l.size}}}}if(v||b.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,a.__webglVertexBuffer),
|
|
|
|
-n.bufferData(n.ARRAY_BUFFER,p,c);if(M||b.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,a.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,o,c);if(w){k=0;for(e=w.length;k<e;k++)if(l=w[k],l.__original.needsUpdate||b.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,l.buffer),n.bufferData(n.ARRAY_BUFFER,l.array,c)}}function e(a,c,b,e,k){e.program||O.initMaterial(e,c,b,k);if(e.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets);for(var f=0,h=O.maxMorphTargets;f<
|
|
|
|
-h;f++)k.__webglMorphTargetInfluences[f]=0}var l=!1,f=e.program,h=f.uniforms,m=e.uniforms;f!=$&&(n.useProgram(f),$=f,l=!0);if(e.id!=ca)ca=e.id,l=!0;if(l){n.uniformMatrix4fv(h.projectionMatrix,!1,Fa);if(b&&e.fog)if(m.fogColor.value=b.color,b instanceof THREE.Fog)m.fogNear.value=b.near,m.fogFar.value=b.far;else if(b instanceof THREE.FogExp2)m.fogDensity.value=b.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var t,p,o=0,u=0,v=0,x,w,z,Y=Da,ia=Y.directional.colors,
|
|
|
|
-y=Y.directional.positions,B=Y.point.colors,A=Y.point.positions,E=Y.point.distances,ja=0,C=0,b=t=z=0,l=c.length;b<l;b++)if(t=c[b],p=t.color,x=t.position,w=t.intensity,z=t.distance,t instanceof THREE.AmbientLight)O.gammaInput?(o+=p.r*p.r,u+=p.g*p.g,v+=p.b*p.b):(o+=p.r,u+=p.g,v+=p.b);else if(t instanceof THREE.DirectionalLight)z=ja*3,O.gammaInput?(ia[z]=p.r*p.r*w*w,ia[z+1]=p.g*p.g*w*w,ia[z+2]=p.b*p.b*w*w):(ia[z]=p.r*w,ia[z+1]=p.g*w,ia[z+2]=p.b*w),y[z]=x.x,y[z+1]=x.y,y[z+2]=x.z,ja+=1;else if(t instanceof
|
|
|
|
-THREE.SpotLight)z=ja*3,O.gammaInput?(ia[z]=p.r*p.r*w*w,ia[z+1]=p.g*p.g*w*w,ia[z+2]=p.b*p.b*w*w):(ia[z]=p.r*w,ia[z+1]=p.g*w,ia[z+2]=p.b*w),p=1/x.length(),y[z]=x.x*p,y[z+1]=x.y*p,y[z+2]=x.z*p,ja+=1;else if(t instanceof THREE.PointLight)t=C*3,O.gammaInput?(B[t]=p.r*p.r*w*w,B[t+1]=p.g*p.g*w*w,B[t+2]=p.b*p.b*w*w):(B[t]=p.r*w,B[t+1]=p.g*w,B[t+2]=p.b*w),A[t]=x.x,A[t+1]=x.y,A[t+2]=x.z,E[C]=z,C+=1;b=ja*3;for(l=ia.length;b<l;b++)ia[b]=0;b=C*3;for(l=B.length;b<l;b++)B[b]=0;Y.point.length=C;Y.directional.length=
|
|
|
|
-ja;Y.ambient[0]=o;Y.ambient[1]=u;Y.ambient[2]=v;c=Da;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)m.opacity.value=
|
|
|
|
-e.opacity,O.gammaInput?m.diffuse.value.copyGammaToLinear(e.color):m.diffuse.value=e.color,(m.map.texture=e.map)&&m.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),m.lightMap.texture=e.lightMap,m.envMap.texture=e.envMap,m.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,m.reflectivity.value=e.reflectivity,m.refractionRatio.value=e.refractionRatio,m.combine.value=e.combine,m.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;
|
|
|
|
-if(e instanceof THREE.LineBasicMaterial)m.diffuse.value=e.color,m.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)m.psColor.value=e.color,m.opacity.value=e.opacity,m.size.value=e.size,m.scale.value=M.height/2,m.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)m.shininess.value=e.shininess,O.gammaInput?(m.ambient.value.copyGammaToLinear(e.ambient),m.specular.value.copyGammaToLinear(e.specular)):(m.ambient.value=e.ambient,m.specular.value=e.specular);else if(e instanceof
|
|
|
|
-THREE.MeshLambertMaterial)O.gammaInput?m.ambient.value.copyGammaToLinear(e.ambient):m.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)m.mNear.value=a.near,m.mFar.value=a.far,m.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)m.opacity.value=e.opacity;if(k.receiveShadow&&!e._shadowPass&&m.shadowMatrix){for(c=0;c<xa.length;c++)m.shadowMatrix.value[c]=xa[c],m.shadowMap.texture[c]=O.shadowMap[c];m.shadowDarkness.value=O.shadowMapDarkness;m.shadowBias.value=O.shadowMapBias}c=
|
|
|
|
-e.uniformsList;m=0;for(b=c.length;m<b;m++)if(u=f.uniforms[c[m][1]])if(o=c[m][0],v=o.type,l=o.value,v=="i")n.uniform1i(u,l);else if(v=="f")n.uniform1f(u,l);else if(v=="v2")n.uniform2f(u,l.x,l.y);else if(v=="v3")n.uniform3f(u,l.x,l.y,l.z);else if(v=="v4")n.uniform4f(u,l.x,l.y,l.z,l.w);else if(v=="c")n.uniform3f(u,l.r,l.g,l.b);else if(v=="fv1")n.uniform1fv(u,l);else if(v=="fv")n.uniform3fv(u,l);else if(v=="v3v"){if(!o._array)o._array=new Float32Array(3*l.length);v=0;for(x=l.length;v<x;v++)Y=v*3,o._array[Y]=
|
|
|
|
-l[v].x,o._array[Y+1]=l[v].y,o._array[Y+2]=l[v].z;n.uniform3fv(u,o._array)}else if(v=="m4"){if(!o._array)o._array=new Float32Array(16);l.flattenToArray(o._array);n.uniformMatrix4fv(u,!1,o._array)}else if(v=="m4v"){if(!o._array)o._array=new Float32Array(16*l.length);v=0;for(x=l.length;v<x;v++)l[v].flattenToArrayOffset(o._array,v*16);n.uniformMatrix4fv(u,!1,o._array)}else if(v=="t"){if(n.uniform1i(u,l),u=o.texture)if(u.image instanceof Array&&u.image.length==6){if(o=u,o.image.length==6)if(o.needsUpdate){if(!o.image.__webglTextureCube)o.image.__webglTextureCube=
|
|
|
|
-n.createTexture();n.activeTexture(n.TEXTURE0+l);n.bindTexture(n.TEXTURE_CUBE_MAP,o.image.__webglTextureCube);for(l=0;l<6;l++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,o.image[l]);G(n.TEXTURE_CUBE_MAP,o,o.image[0]);o.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+l),n.bindTexture(n.TEXTURE_CUBE_MAP,o.image.__webglTextureCube)}else u instanceof THREE.WebGLRenderTargetCube?(o=u,n.activeTexture(n.TEXTURE0+l),n.bindTexture(n.TEXTURE_CUBE_MAP,o.__webglTexture)):N(u,l)}else if(v==
|
|
|
|
-"tv"){if(!o._array){o._array=[];v=0;for(x=o.texture.length;v<x;v++)o._array[v]=l+v}n.uniform1iv(u,o._array);v=0;for(x=o.texture.length;v<x;v++)(u=o.texture[v])&&N(u,o._array[v])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&h.cameraPosition!==null&&n.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&h.viewMatrix!==null&&
|
|
|
|
-n.uniformMatrix4fv(h.viewMatrix,!1,Ea);e.skinning&&(n.uniformMatrix4fv(h.cameraInverseMatrix,!1,Ea),n.uniformMatrix4fv(h.boneGlobalMatrices,!1,k.boneMatrices))}n.uniformMatrix4fv(h.modelViewMatrix,!1,k._modelViewMatrixArray);h.normalMatrix&&n.uniformMatrix3fv(h.normalMatrix,!1,k._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||k.receiveShadow)&&h.objectMatrix!==null&&n.uniformMatrix4fv(h.objectMatrix,!1,k._objectMatrixArray);return f}function f(a,c,b,k,f,h){if(k.opacity!=
|
|
|
|
-0){var l,m,b=e(a,c,b,k,h),a=b.attributes,c=!1,b=f.id*16777215+b.id*2+(k.wireframe?1:0);b!=ea&&(ea=b,c=!0);if(!k.morphTargets&&a.position>=0)c&&(n.bindBuffer(n.ARRAY_BUFFER,f.__webglVertexBuffer),n.vertexAttribPointer(a.position,3,n.FLOAT,!1,0,0));else if(h.morphTargetBase){b=k.program.attributes;h.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),n.vertexAttribPointer(b.position,3,n.FLOAT,!1,0,0)):b.position>=0&&(n.bindBuffer(n.ARRAY_BUFFER,f.__webglVertexBuffer),
|
|
|
|
-n.vertexAttribPointer(b.position,3,n.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){l=0;var p=h.morphTargetForcedOrder;for(m=h.morphTargetInfluences;l<k.numSupportedMorphTargets&&l<p.length;)n.bindBuffer(n.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[l]]),n.vertexAttribPointer(b["morphTarget"+l],3,n.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[l]=m[p[l]],l++}else{var p=[],t=-1,o=0;m=h.morphTargetInfluences;var u,v=m.length;l=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);l<k.numSupportedMorphTargets;){for(u=
|
|
|
|
-0;u<v;u++)!p[u]&&m[u]>t&&(o=u,t=m[o]);n.bindBuffer(n.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[o]);n.vertexAttribPointer(b["morphTarget"+l],3,n.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[l]=t;p[o]=1;t=-1;l++}}k.program.uniforms.morphTargetInfluences!==null&&n.uniform1fv(k.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(c){if(f.__webglCustomAttributesList){l=0;for(m=f.__webglCustomAttributesList.length;l<m;l++)b=f.__webglCustomAttributesList[l],a[b.buffer.belongsToAttribute]>=
|
|
|
|
-0&&(n.bindBuffer(n.ARRAY_BUFFER,b.buffer),n.vertexAttribPointer(a[b.buffer.belongsToAttribute],b.size,n.FLOAT,!1,0,0))}a.color>=0&&(n.bindBuffer(n.ARRAY_BUFFER,f.__webglColorBuffer),n.vertexAttribPointer(a.color,3,n.FLOAT,!1,0,0));a.normal>=0&&(n.bindBuffer(n.ARRAY_BUFFER,f.__webglNormalBuffer),n.vertexAttribPointer(a.normal,3,n.FLOAT,!1,0,0));a.tangent>=0&&(n.bindBuffer(n.ARRAY_BUFFER,f.__webglTangentBuffer),n.vertexAttribPointer(a.tangent,4,n.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(n.bindBuffer(n.ARRAY_BUFFER,
|
|
|
|
-f.__webglUVBuffer),n.vertexAttribPointer(a.uv,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(a.uv)):n.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(n.bindBuffer(n.ARRAY_BUFFER,f.__webglUV2Buffer),n.vertexAttribPointer(a.uv2,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(a.uv2)):n.disableVertexAttribArray(a.uv2));k.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(n.bindBuffer(n.ARRAY_BUFFER,f.__webglSkinVertexABuffer),n.vertexAttribPointer(a.skinVertexA,4,
|
|
|
|
-n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),n.vertexAttribPointer(a.skinVertexB,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),n.vertexAttribPointer(a.skinIndex,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),n.vertexAttribPointer(a.skinWeight,4,n.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(k.wireframe?(n.lineWidth(k.wireframeLinewidth),c&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),n.drawElements(n.LINES,f.__webglLineCount,
|
|
|
|
-n.UNSIGNED_SHORT,0)):(c&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),n.drawElements(n.TRIANGLES,f.__webglFaceCount,n.UNSIGNED_SHORT,0)),O.info.render.calls++,O.info.render.vertices+=f.__webglFaceCount,O.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type==THREE.LineStrip?n.LINE_STRIP:n.LINES,n.lineWidth(k.linewidth),n.drawArrays(h,0,f.__webglLineCount),O.info.render.calls++):h instanceof THREE.ParticleSystem?(n.drawArrays(n.POINTS,0,f.__webglParticleCount),O.info.render.calls++):
|
|
|
|
-h instanceof THREE.Ribbon&&(n.drawArrays(n.TRIANGLE_STRIP,0,f.__webglVertexCount),O.info.render.calls++)}}function h(a,c,b){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=n.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=n.createBuffer();a.hasPos&&(n.bindBuffer(n.ARRAY_BUFFER,a.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,a.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttribArray(c.attributes.position),n.vertexAttribPointer(c.attributes.position,3,n.FLOAT,!1,0,0));if(a.hasNormal){n.bindBuffer(n.ARRAY_BUFFER,
|
|
|
|
-a.__webglNormalBuffer);if(b==THREE.FlatShading){var e,f,k,h,l,m,p,t,o,u,v=a.count*3;for(u=0;u<v;u+=9)b=a.normalArray,e=b[u],f=b[u+1],k=b[u+2],h=b[u+3],m=b[u+4],t=b[u+5],l=b[u+6],p=b[u+7],o=b[u+8],e=(e+h+l)/3,f=(f+m+p)/3,k=(k+t+o)/3,b[u]=e,b[u+1]=f,b[u+2]=k,b[u+3]=e,b[u+4]=f,b[u+5]=k,b[u+6]=e,b[u+7]=f,b[u+8]=k}n.bufferData(n.ARRAY_BUFFER,a.normalArray,n.DYNAMIC_DRAW);n.enableVertexAttribArray(c.attributes.normal);n.vertexAttribPointer(c.attributes.normal,3,n.FLOAT,!1,0,0)}n.drawArrays(n.TRIANGLES,
|
|
|
|
-0,a.count);a.count=0}function k(a){if(ka!=a.doubleSided)a.doubleSided?n.disable(n.CULL_FACE):n.enable(n.CULL_FACE),ka=a.doubleSided;if(Z!=a.flipSided)a.flipSided?n.frontFace(n.CW):n.frontFace(n.CCW),Z=a.flipSided}function l(a){T!=a&&(a?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),T=a)}function m(a){fa!=a&&(n.depthMask(a),fa=a)}function t(a,c,b){ga!=a&&(a?n.enable(n.POLYGON_OFFSET_FILL):n.disable(n.POLYGON_OFFSET_FILL),ga=a);if(a&&(qa!=c||oa!=b))n.polygonOffset(c,b),qa=c,oa=b}function u(a){pa[0].set(a.n41-
|
|
|
|
-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);pa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);pa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);pa[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);pa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);pa[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var c,a=0;a<6;a++)c=pa[a],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function p(a){for(var c=a.matrixWorld,b=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
|
|
|
|
-Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=pa[e].x*c.n14+pa[e].y*c.n24+pa[e].z*c.n34+pa[e].w,a<=b)return!1;return!0}function v(a,c){a.list[a.count]=c;a.count+=1}function o(a){var c;c=a.object;var b=a.opaque,a=a.transparent;a.count=0;b.count=0;c=c.material;c.transparent?v(a,c):v(b,c)}function z(a){var c,b;c=a.object;var e=a.buffer,f=a.opaque,a=a.transparent;a.count=0;f.count=0;b=c.material;b instanceof THREE.MeshFaceMaterial?(materialIndex=e.materialIndex,materialIndex>=0&&(c=c.geometry.materials[materialIndex],
|
|
|
|
-c.transparent?v(a,c):v(f,c))):(c=b)&&(c.transparent?v(a,c):v(f,c))}function x(a,c){return c.z-a.z}function w(a){var c,b,m,t=0,o,v,x,w,M=a.lights;ha||(ha=new THREE.PerspectiveCamera(O.shadowCameraFov,O.shadowMapWidth/O.shadowMapHeight,O.shadowCameraNear,O.shadowCameraFar));c=0;for(b=M.length;c<b;c++)if(m=M[c],m instanceof THREE.SpotLight&&m.castShadow){ca=-1;O.shadowMap[t]||(O.shadowMap[t]=new THREE.WebGLRenderTarget(O.shadowMapWidth,O.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
|
-format:THREE.RGBAFormat}));xa[t]||(xa[t]=new THREE.Matrix4);o=O.shadowMap[t];v=xa[t];ha.position.copy(m.position);ha.lookAt(m.target.position);ha.update(void 0,!0);a.update(void 0,!1,ha);v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(ha.projectionMatrix);v.multiplySelf(ha.matrixWorldInverse);ha.matrixWorldInverse.flattenToArray(Ea);ha.projectionMatrix.flattenToArray(Fa);Ca.multiply(ha.projectionMatrix,ha.matrixWorldInverse);u(Ca);O.initWebGLObjects(a);H(o);n.clearColor(1,1,1,1);
|
|
|
|
-O.clear();n.clearColor(K.r,K.g,K.b,ra);v=a.__webglObjects.length;m=a.__webglObjectsImmediate.length;for(o=0;o<v;o++)x=a.__webglObjects[o],w=x.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||!w.frustumCulled||p(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),y(w,ha,!1),x.render=!0):x.render=!1:x.render=!1;l(!0);F(THREE.NormalBlending);for(o=0;o<v;o++)if(x=a.__webglObjects[o],x.render)w=x.object,buffer=x.buffer,k(w),x=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?
|
|
|
|
-Ba:ya,f(ha,M,null,x,buffer,w);for(o=0;o<m;o++)x=a.__webglObjectsImmediate[o],w=x.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ea=-1,y(w,ha,!1),k(w),program=e(ha,M,null,ya,w),w.immediateRenderCallback?w.immediateRenderCallback(program,n,pa):w.render(function(a){h(a,program,ya.shading)}));t++}}function B(a,c){var b,e,f;b=W.attributes;var k=W.uniforms,h=na/ma,l,m=[],p=ma*0.5,t=na*0.5,o=!0;n.useProgram(W.program);$=W.program;ea=T=Q=-1;Ja||(n.enableVertexAttribArray(W.attributes.position),
|
|
|
|
-n.enableVertexAttribArray(W.attributes.uv),Ja=!0);n.disable(n.CULL_FACE);n.enable(n.BLEND);n.depthMask(!0);n.bindBuffer(n.ARRAY_BUFFER,W.vertexBuffer);n.vertexAttribPointer(b.position,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(b.uv,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,W.elementBuffer);n.uniformMatrix4fv(k.projectionMatrix,!1,Fa);n.activeTexture(n.TEXTURE0);n.uniform1i(k.map,0);b=0;for(e=a.__webglSprites.length;b<e;b++)if(f=a.__webglSprites[b],f.visible&&f.opacity!=0)f.useScreenCoordinates?
|
|
|
|
-f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(x);b=0;for(e=a.__webglSprites.length;b<e;b++)f=a.__webglSprites[b],f.visible&&f.opacity!=0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(n.uniform1i(k.useScreenCoordinates,1),n.uniform3f(k.screenPosition,(f.position.x-p)/p,(t-f.position.y)/t,Math.max(0,Math.min(1,f.position.z)))):(n.uniform1i(k.useScreenCoordinates,
|
|
|
|
-0),n.uniform1i(k.affectedByDistance,f.affectedByDistance?1:0),n.uniformMatrix4fv(k.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?na:1),m[0]=l*h*f.scale.x,m[1]=l*f.scale.y,n.uniform2f(k.uvScale,f.uvScale.x,f.uvScale.y),n.uniform2f(k.uvOffset,f.uvOffset.x,f.uvOffset.y),n.uniform2f(k.alignment,f.alignment.x,f.alignment.y),n.uniform1f(k.opacity,f.opacity),n.uniform3f(k.color,f.color.r,f.color.g,f.color.b),n.uniform1f(k.rotation,f.rotation),n.uniform2fv(k.scale,m),
|
|
|
|
-f.mergeWith3D&&!o?(n.enable(n.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(n.disable(n.DEPTH_TEST),o=!1),F(f.blending),N(f.map,0),n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0));n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(fa)}function y(a,c,b){a._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);b&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function A(a,c){var e=b(c,a);if(e.attributes)for(var f in e.attributes)if(e.attributes[f].needsUpdate)return!0;
|
|
|
|
-return!1}function E(a,c){var e=b(c,a);if(e.attributes)for(var f in e.attributes)e.attributes[f].needsUpdate=!1}function C(a,c){var b;for(b=a.length-1;b>=0;b--)a[b].object==c&&a.splice(b,1)}function L(a,c,b){a.push({buffer:c,object:b,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(a){if(a!=Q){switch(a){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.ONE_MINUS_SRC_COLOR);
|
|
|
|
-break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}Q=a}}function G(a,c,b){(b.width&b.width-1)==0&&(b.height&b.height-1)==0?(n.texParameteri(a,n.TEXTURE_WRAP_S,X(c.wrapS)),n.texParameteri(a,n.TEXTURE_WRAP_T,X(c.wrapT)),n.texParameteri(a,n.TEXTURE_MAG_FILTER,X(c.magFilter)),n.texParameteri(a,n.TEXTURE_MIN_FILTER,X(c.minFilter)),
|
|
|
|
-n.generateMipmap(a)):(n.texParameteri(a,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(a,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(a,n.TEXTURE_MAG_FILTER,V(c.magFilter)),n.texParameteri(a,n.TEXTURE_MIN_FILTER,V(c.minFilter)))}function N(a,c){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=n.createTexture(),O.info.memory.textures++;n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?n.texImage2D(n.TEXTURE_2D,0,X(a.format),
|
|
|
|
-a.image.width,a.image.height,0,X(a.format),n.UNSIGNED_BYTE,a.image.data):n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,a.image);G(n.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+c),n.bindTexture(n.TEXTURE_2D,a.__webglTexture)}function R(a,c){n.bindRenderbuffer(n.RENDERBUFFER,a);c.depthBuffer&&!c.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,c.width,c.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,a)):
|
|
|
|
-c.depthBuffer&&c.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,c.width,c.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,a)):n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,c.width,c.height)}function H(a){var c=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=n.createTexture();if(c){a.__webglFramebuffer=[];a.__webglRenderbuffer=
|
|
|
|
-[];n.bindTexture(n.TEXTURE_CUBE_MAP,a.__webglTexture);G(n.TEXTURE_CUBE_MAP,a,a);for(var b=0;b<6;b++){a.__webglFramebuffer[b]=n.createFramebuffer();a.__webglRenderbuffer[b]=n.createRenderbuffer();n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+b,0,X(a.format),a.width,a.height,0,X(a.format),X(a.type),null);var e=a,f=n.TEXTURE_CUBE_MAP_POSITIVE_X+b;n.bindFramebuffer(n.FRAMEBUFFER,a.__webglFramebuffer[b]);n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,f,e.__webglTexture,0);R(a.__webglRenderbuffer[b],
|
|
|
|
-a)}}else a.__webglFramebuffer=n.createFramebuffer(),a.__webglRenderbuffer=n.createRenderbuffer(),n.bindTexture(n.TEXTURE_2D,a.__webglTexture),G(n.TEXTURE_2D,a,a),n.texImage2D(n.TEXTURE_2D,0,X(a.format),a.width,a.height,0,X(a.format),X(a.type),null),b=n.TEXTURE_2D,n.bindFramebuffer(n.FRAMEBUFFER,a.__webglFramebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,b,a.__webglTexture,0),n.bindRenderbuffer(n.RENDERBUFFER,a.__webglRenderbuffer),R(a.__webglRenderbuffer,a);c?n.bindTexture(n.TEXTURE_CUBE_MAP,
|
|
|
|
-null):n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null)}a?(c=c?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,b=a.width,a=a.height,f=e=0):(c=null,b=ma,a=na,e=da,f=sa);c!=aa&&(n.bindFramebuffer(n.FRAMEBUFFER,c),n.viewport(e,f,b,a),aa=c)}function S(a){a instanceof THREE.WebGLRenderTargetCube?(n.bindTexture(n.TEXTURE_CUBE_MAP,a.__webglTexture),n.generateMipmap(n.TEXTURE_CUBE_MAP),n.bindTexture(n.TEXTURE_CUBE_MAP,null)):(n.bindTexture(n.TEXTURE_2D,
|
|
|
|
-a.__webglTexture),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null))}function J(a,c){var b;a=="fragment"?b=n.createShader(n.FRAGMENT_SHADER):a=="vertex"&&(b=n.createShader(n.VERTEX_SHADER));n.shaderSource(b,c);n.compileShader(b);if(!n.getShaderParameter(b,n.COMPILE_STATUS))return console.error(n.getShaderInfoLog(b)),console.error(c),null;return b}function V(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return n.NEAREST;
|
|
|
|
-default:return n.LINEAR}}function X(a){switch(a){case THREE.RepeatWrapping:return n.REPEAT;case THREE.ClampToEdgeWrapping:return n.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return n.MIRRORED_REPEAT;case THREE.NearestFilter:return n.NEAREST;case THREE.NearestMipMapNearestFilter:return n.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return n.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return n.LINEAR;case THREE.LinearMipMapNearestFilter:return n.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return n.LINEAR_MIPMAP_LINEAR;
|
|
|
|
-case THREE.ByteType:return n.BYTE;case THREE.UnsignedByteType:return n.UNSIGNED_BYTE;case THREE.ShortType:return n.SHORT;case THREE.UnsignedShortType:return n.UNSIGNED_SHORT;case THREE.IntType:return n.INT;case THREE.UnsignedShortType:return n.UNSIGNED_INT;case THREE.FloatType:return n.FLOAT;case THREE.AlphaFormat:return n.ALPHA;case THREE.RGBFormat:return n.RGB;case THREE.RGBAFormat:return n.RGBA;case THREE.LuminanceFormat:return n.LUMINANCE;case THREE.LuminanceAlphaFormat:return n.LUMINANCE_ALPHA}return 0}
|
|
|
|
-var O=this,n,U=[],$=null,aa=null,ca=-1,ea=null,la=0,ka=null,Z=null,Q=null,T=null,fa=null,ga=null,qa=null,oa=null,da=0,sa=0,ma=0,na=0,pa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Fa=new Float32Array(16),Ea=new Float32Array(16),za=new THREE.Vector4,Da={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},M=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
|
-Y=a.stencil!==void 0?a.stencil:!0,ia=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ja=a.antialias!==void 0?a.antialias:!1,K=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ra=a.clearAlpha!==void 0?a.clearAlpha:0,wa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=M;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
|
|
|
|
-!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var ha,xa=[],a=THREE.ShaderLib.depthRGBA,ua=THREE.UniformsUtils.clone(a.uniforms),ya=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ua}),
|
|
|
|
-Ba=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ua,morphTargets:!0});ya._shadowPass=!0;Ba._shadowPass=!0;try{if(!(n=M.getContext("experimental-webgl",{antialias:ja,stencil:Y,preserveDrawingBuffer:ia})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Ha){console.error(Ha)}n.clearColor(0,
|
|
|
|
-0,0,1);n.clearDepth(1);n.clearStencil(0);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(K.r,K.g,K.b,ra);this.context=n;var Ia=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);Y=0;W.vertices[Y++]=-1;W.vertices[Y++]=-1;W.vertices[Y++]=0;W.vertices[Y++]=1;W.vertices[Y++]=1;
|
|
|
|
-W.vertices[Y++]=-1;W.vertices[Y++]=1;W.vertices[Y++]=1;W.vertices[Y++]=1;W.vertices[Y++]=1;W.vertices[Y++]=1;W.vertices[Y++]=0;W.vertices[Y++]=-1;W.vertices[Y++]=1;W.vertices[Y++]=0;Y=W.vertices[Y++]=0;W.faces[Y++]=0;W.faces[Y++]=1;W.faces[Y++]=2;W.faces[Y++]=0;W.faces[Y++]=2;W.faces[Y++]=3;W.vertexBuffer=n.createBuffer();W.elementBuffer=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,W.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,W.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,W.elementBuffer);
|
|
|
|
-n.bufferData(n.ELEMENT_ARRAY_BUFFER,W.faces,n.STATIC_DRAW);W.program=n.createProgram();n.attachShader(W.program,J("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(W.program,J("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=n.getAttribLocation(W.program,"position");W.attributes.uv=n.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=n.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=n.getUniformLocation(W.program,
|
|
|
|
-"uvScale");W.uniforms.rotation=n.getUniformLocation(W.program,"rotation");W.uniforms.scale=n.getUniformLocation(W.program,"scale");W.uniforms.alignment=n.getUniformLocation(W.program,"alignment");W.uniforms.color=n.getUniformLocation(W.program,"color");W.uniforms.map=n.getUniformLocation(W.program,"map");W.uniforms.opacity=n.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=n.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=n.getUniformLocation(W.program,
|
|
|
|
-"affectedByDistance");W.uniforms.screenPosition=n.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=n.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=n.getUniformLocation(W.program,"projectionMatrix");var Ja=!1;this.setSize=function(a,c){M.width=a;M.height=c;this.setViewport(0,0,M.width,M.height)};this.setViewport=function(a,c,b,e){da=a;sa=c;ma=b;na=e;n.viewport(da,sa,ma,na)};this.setScissor=function(a,c,b,e){n.scissor(a,c,b,e)};this.enableScissorTest=
|
|
|
|
-function(a){a?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.setClearColorHex=function(a,c){K.setHex(a);ra=c;n.clearColor(K.r,K.g,K.b,ra)};this.setClearColor=function(a,c){K.copy(a);ra=c;n.clearColor(K.r,K.g,K.b,ra)};this.getClearColor=function(){return K};this.getClearAlpha=function(){return ra};this.clear=function(a,c,b){var e=0;if(a==void 0||a)e|=n.COLOR_BUFFER_BIT;if(c==void 0||c)e|=n.DEPTH_BUFFER_BIT;if(b==void 0||b)e|=n.STENCIL_BUFFER_BIT;n.clear(e)};this.getContext=function(){return n};
|
|
|
|
-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(g in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[g];n.deleteBuffer(c.__webglVertexBuffer);n.deleteBuffer(c.__webglNormalBuffer);n.deleteBuffer(c.__webglTangentBuffer);n.deleteBuffer(c.__webglColorBuffer);n.deleteBuffer(c.__webglUVBuffer);n.deleteBuffer(c.__webglUV2Buffer);n.deleteBuffer(c.__webglSkinVertexABuffer);
|
|
|
|
-n.deleteBuffer(c.__webglSkinVertexBBuffer);n.deleteBuffer(c.__webglSkinIndicesBuffer);n.deleteBuffer(c.__webglSkinWeightsBuffer);n.deleteBuffer(c.__webglFaceBuffer);n.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var b=0,e=c.numMorphTargets;b<e;b++)n.deleteBuffer(c.__webglMorphTargetsBuffers[b]);O.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,n.deleteBuffer(a.__webglVertexBuffer),n.deleteBuffer(a.__webglColorBuffer),O.info.memory.geometries--;else if(a instanceof
|
|
|
|
-THREE.Line)a=a.geometry,n.deleteBuffer(a.__webglVertexBuffer),n.deleteBuffer(a.__webglColorBuffer),O.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,n.deleteBuffer(a.__webglVertexBuffer),n.deleteBuffer(a.__webglColorBuffer),O.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,n.deleteTexture(a.__webglTexture),O.info.memory.textures--};this.initMaterial=function(a,c,b,e){var f,k,h,l;a instanceof THREE.MeshDepthMaterial?l="depth":
|
|
|
|
-a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var m=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(m.uniforms);a.vertexShader=m.vertexShader;a.fragmentShader=m.fragmentShader}var p,t,o;p=o=m=0;for(t=c.length;p<t;p++)h=c[p],h instanceof
|
|
|
|
-THREE.SpotLight&&o++,h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&m++;m+o<=wa?p=o:(p=Math.ceil(wa*o/(m+o)),m=wa-p);h={directional:p,point:m};m=o=0;for(p=c.length;m<p;m++)t=c[m],t instanceof THREE.SpotLight&&t.castShadow&&o++;var u=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)u=e.bones.length;var v;a:{p=a.fragmentShader;t=a.vertexShader;var m=a.uniforms,c=a.attributes,b={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:b,useFog:a.fog,
|
|
|
|
-sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:u,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},w,e=[];l?e.push(l):(e.push(p),e.push(t));for(w in b)e.push(w),e.push(b[w]);l=e.join();w=0;
|
|
|
|
-for(e=U.length;w<e;w++)if(U[w].code==l){v=U[w].program;break a}w=n.createProgram();e=[Ia?"#define VERTEX_TEXTURES":"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,"#define MAX_SHADOWS "+b.maxShadows,"#define MAX_BONES "+b.maxBones,b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":"",b.lightMap?"#define USE_LIGHTMAP":
|
|
|
|
|
|
+THREE.WebGLRenderer=function(a){function b(a,c){var b;a.material&&!(a.material instanceof THREE.MeshFaceMaterial)?b=a.material:c.materialIndex>=0&&(b=a.geometry.materials[c.materialIndex]);return b}function c(a,c,b){var e,f,k,h=a.vertices,l=h.length,n=a.colors,p=n.length,t=a.__vertexArray,o=a.__colorArray,u=a.__sortArray,v=a.__dirtyVertices,G=a.__dirtyColors,x=a.__webglCustomAttributesList,w;if(x){k=0;for(e=x.length;k<e;k++)x[k].offset=0}if(b.sortParticles){sa.multiplySelf(b.matrixWorld);for(e=0;e<
|
|
|
|
+l;e++)f=h[e].position,za.copy(f),sa.multiplyVector3(za),u[e]=[za.z,e];u.sort(function(a,c){return c[0]-a[0]});for(e=0;e<l;e++)f=h[u[e][1]].position,k=e*3,t[k]=f.x,t[k+1]=f.y,t[k+2]=f.z;for(e=0;e<p;e++)k=e*3,color=n[u[e][1]],o[k]=color.r,o[k+1]=color.g,o[k+2]=color.b;if(x){k=0;for(e=x.length;k<e;k++){l=x[k];p=l.value.length;for(n=0;n<p;n++){index=u[n][1];h=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[h]=l.value[index]}else{if(l.boundTo===void 0||l.boundTo==="vertices")w=
|
|
|
|
+l.value[index];l.size===2?(l.array[h]=w.x,l.array[h+1]=w.y):l.size===3?l.type==="c"?(l.array[h]=w.r,l.array[h+1]=w.g,l.array[h+2]=w.b):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z,l.array[h+3]=w.w)}l.offset+=l.size}}}}else{if(v)for(e=0;e<l;e++)f=h[e].position,k=e*3,t[k]=f.x,t[k+1]=f.y,t[k+2]=f.z;if(G)for(e=0;e<p;e++)color=n[e],k=e*3,o[k]=color.r,o[k+1]=color.g,o[k+2]=color.b;if(x){k=0;for(e=x.length;k<e;k++)if(l=x[k],l.__original.needsUpdate){p=
|
|
|
|
+l.value.length;for(n=0;n<p;n++){h=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[h]=l.value[n]}else{if(l.boundTo===void 0||l.boundTo==="vertices")w=l.value[n];l.size===2?(l.array[h]=w.x,l.array[h+1]=w.y):l.size===3?l.type==="c"?(l.array[h]=w.r,l.array[h+1]=w.g,l.array[h+2]=w.b):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z,l.array[h+3]=w.w)}l.offset+=l.size}}}}if(v||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),
|
|
|
|
+m.bufferData(m.ARRAY_BUFFER,t,c);if(G||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,o,c);if(x){k=0;for(e=x.length;k<e;k++)if(l=x[k],l.__original.needsUpdate||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,l.buffer),m.bufferData(m.ARRAY_BUFFER,l.array,c)}}function e(a,c,b,e,k){e.program||S.initMaterial(e,c,b,k);if(e.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(S.maxMorphTargets);for(var f=0,h=S.maxMorphTargets;f<
|
|
|
|
+h;f++)k.__webglMorphTargetInfluences[f]=0}var l=!1,f=e.program,h=f.uniforms,n=e.uniforms;f!=U&&(m.useProgram(f),U=f,l=!0);if(e.id!=da)da=e.id,l=!0;if(l){m.uniformMatrix4fv(h.projectionMatrix,!1,Da);if(b&&e.fog)if(n.fogColor.value=b.color,b instanceof THREE.Fog)n.fogNear.value=b.near,n.fogFar.value=b.far;else if(b instanceof THREE.FogExp2)n.fogDensity.value=b.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var p,t,o=0,u=0,v=0,G,w,x,y=Fa,ma=y.directional.colors,
|
|
|
|
+$=y.directional.positions,z=y.point.colors,A=y.point.positions,C=y.point.distances,B=0,I=0,b=p=x=0,l=c.length;b<l;b++)if(p=c[b],t=p.color,G=p.position,w=p.intensity,x=p.distance,p instanceof THREE.AmbientLight)S.gammaInput?(o+=t.r*t.r,u+=t.g*t.g,v+=t.b*t.b):(o+=t.r,u+=t.g,v+=t.b);else if(p instanceof THREE.DirectionalLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),$[x]=G.x,$[x+1]=G.y,$[x+2]=G.z,B+=1;else if(p instanceof
|
|
|
|
+THREE.SpotLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),t=1/G.length(),$[x]=G.x*t,$[x+1]=G.y*t,$[x+2]=G.z*t,B+=1;else if(p instanceof THREE.PointLight)p=I*3,S.gammaInput?(z[p]=t.r*t.r*w*w,z[p+1]=t.g*t.g*w*w,z[p+2]=t.b*t.b*w*w):(z[p]=t.r*w,z[p+1]=t.g*w,z[p+2]=t.b*w),A[p]=G.x,A[p+1]=G.y,A[p+2]=G.z,C[I]=x,I+=1;b=B*3;for(l=ma.length;b<l;b++)ma[b]=0;b=I*3;for(l=z.length;b<l;b++)z[b]=0;y.point.length=I;y.directional.length=
|
|
|
|
+B;y.ambient[0]=o;y.ambient[1]=u;y.ambient[2]=v;c=Fa;n.enableLighting.value=c.directional.length+c.point.length;n.ambientLightColor.value=c.ambient;n.directionalLightColor.value=c.directional.colors;n.directionalLightDirection.value=c.directional.positions;n.pointLightColor.value=c.point.colors;n.pointLightPosition.value=c.point.positions;n.pointLightDistance.value=c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=
|
|
|
|
+e.opacity,S.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;
|
|
|
|
+if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=xa.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,S.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof
|
|
|
|
+THREE.MeshLambertMaterial)S.gammaInput?n.ambient.value.copyGammaToLinear(e.ambient):n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(k.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(c=0;c<ka.length;c++)n.shadowMatrix.value[c]=ka[c],n.shadowMap.texture[c]=S.shadowMap[c];n.shadowDarkness.value=S.shadowMapDarkness;n.shadowBias.value=S.shadowMapBias}c=
|
|
|
|
+e.uniformsList;n=0;for(b=c.length;n<b;n++)if(u=f.uniforms[c[n][1]])if(o=c[n][0],v=o.type,l=o.value,v=="i")m.uniform1i(u,l);else if(v=="f")m.uniform1f(u,l);else if(v=="v2")m.uniform2f(u,l.x,l.y);else if(v=="v3")m.uniform3f(u,l.x,l.y,l.z);else if(v=="v4")m.uniform4f(u,l.x,l.y,l.z,l.w);else if(v=="c")m.uniform3f(u,l.r,l.g,l.b);else if(v=="fv1")m.uniform1fv(u,l);else if(v=="fv")m.uniform3fv(u,l);else if(v=="v3v"){if(!o._array)o._array=new Float32Array(3*l.length);v=0;for(G=l.length;v<G;v++)y=v*3,o._array[y]=
|
|
|
|
+l[v].x,o._array[y+1]=l[v].y,o._array[y+2]=l[v].z;m.uniform3fv(u,o._array)}else if(v=="m4"){if(!o._array)o._array=new Float32Array(16);l.flattenToArray(o._array);m.uniformMatrix4fv(u,!1,o._array)}else if(v=="m4v"){if(!o._array)o._array=new Float32Array(16*l.length);v=0;for(G=l.length;v<G;v++)l[v].flattenToArrayOffset(o._array,v*16);m.uniformMatrix4fv(u,!1,o._array)}else if(v=="t"){if(m.uniform1i(u,l),u=o.texture)if(u.image instanceof Array&&u.image.length==6){if(o=u,o.image.length==6)if(o.needsUpdate){if(!o.image.__webglTextureCube)o.image.__webglTextureCube=
|
|
|
|
+m.createTexture();m.activeTexture(m.TEXTURE0+l);m.bindTexture(m.TEXTURE_CUBE_MAP,o.image.__webglTextureCube);for(l=0;l<6;l++)m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,o.image[l]);M(m.TEXTURE_CUBE_MAP,o,o.image[0]);o.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,o.image.__webglTextureCube)}else u instanceof THREE.WebGLRenderTargetCube?(o=u,m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,o.__webglTexture)):E(u,l)}else if(v==
|
|
|
|
+"tv"){if(!o._array){o._array=[];v=0;for(G=o.texture.length;v<G;v++)o._array[v]=l+v}m.uniform1iv(u,o._array);v=0;for(G=o.texture.length;v<G;v++)(u=o.texture[v])&&E(u,o._array[v])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&h.cameraPosition!==null&&m.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&h.viewMatrix!==null&&
|
|
|
|
+m.uniformMatrix4fv(h.viewMatrix,!1,Ea);e.skinning&&(m.uniformMatrix4fv(h.cameraInverseMatrix,!1,Ea),m.uniformMatrix4fv(h.boneGlobalMatrices,!1,k.boneMatrices))}m.uniformMatrix4fv(h.modelViewMatrix,!1,k._modelViewMatrixArray);h.normalMatrix&&m.uniformMatrix3fv(h.normalMatrix,!1,k._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||k.receiveShadow)&&h.objectMatrix!==null&&m.uniformMatrix4fv(h.objectMatrix,!1,k._objectMatrixArray);return f}function f(a,c,b,k,f,h){if(k.opacity!=
|
|
|
|
+0){var l,n,b=e(a,c,b,k,h),a=b.attributes,c=!1,b=f.id*16777215+b.id*2+(k.wireframe?1:0);b!=ia&&(ia=b,c=!0);if(!k.morphTargets&&a.position>=0)c&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglVertexBuffer),m.vertexAttribPointer(a.position,3,m.FLOAT,!1,0,0));else if(h.morphTargetBase){b=k.program.attributes;h.morphTargetBase!==-1?(m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0)):b.position>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglVertexBuffer),
|
|
|
|
+m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){l=0;var p=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;l<k.numSupportedMorphTargets&&l<p.length;)m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[l]]),m.vertexAttribPointer(b["morphTarget"+l],3,m.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[l]=n[p[l]],l++}else{var p=[],t=-1,o=0;n=h.morphTargetInfluences;var v,u=n.length;l=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);l<k.numSupportedMorphTargets;){for(v=
|
|
|
|
+0;v<u;v++)!p[v]&&n[v]>t&&(o=v,t=n[o]);m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[o]);m.vertexAttribPointer(b["morphTarget"+l],3,m.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[l]=t;p[o]=1;t=-1;l++}}k.program.uniforms.morphTargetInfluences!==null&&m.uniform1fv(k.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(c){if(f.__webglCustomAttributesList){l=0;for(n=f.__webglCustomAttributesList.length;l<n;l++)b=f.__webglCustomAttributesList[l],a[b.buffer.belongsToAttribute]>=
|
|
|
|
+0&&(m.bindBuffer(m.ARRAY_BUFFER,b.buffer),m.vertexAttribPointer(a[b.buffer.belongsToAttribute],b.size,m.FLOAT,!1,0,0))}a.color>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglColorBuffer),m.vertexAttribPointer(a.color,3,m.FLOAT,!1,0,0));a.normal>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglNormalBuffer),m.vertexAttribPointer(a.normal,3,m.FLOAT,!1,0,0));a.tangent>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglTangentBuffer),m.vertexAttribPointer(a.tangent,4,m.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
|
+f.__webglUVBuffer),m.vertexAttribPointer(a.uv,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(a.uv)):m.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(m.bindBuffer(m.ARRAY_BUFFER,f.__webglUV2Buffer),m.vertexAttribPointer(a.uv2,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(a.uv2)):m.disableVertexAttribArray(a.uv2));k.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinVertexABuffer),m.vertexAttribPointer(a.skinVertexA,4,
|
|
|
|
+m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),m.vertexAttribPointer(a.skinVertexB,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),m.vertexAttribPointer(a.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),m.vertexAttribPointer(a.skinWeight,4,m.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(k.wireframe?(m.lineWidth(k.wireframeLinewidth),c&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),m.drawElements(m.LINES,f.__webglLineCount,
|
|
|
|
+m.UNSIGNED_SHORT,0)):(c&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),m.drawElements(m.TRIANGLES,f.__webglFaceCount,m.UNSIGNED_SHORT,0)),S.info.render.calls++,S.info.render.vertices+=f.__webglFaceCount,S.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type==THREE.LineStrip?m.LINE_STRIP:m.LINES,m.lineWidth(k.linewidth),m.drawArrays(h,0,f.__webglLineCount),S.info.render.calls++):h instanceof THREE.ParticleSystem?(m.drawArrays(m.POINTS,0,f.__webglParticleCount),S.info.render.calls++):
|
|
|
|
+h instanceof THREE.Ribbon&&(m.drawArrays(m.TRIANGLE_STRIP,0,f.__webglVertexCount),S.info.render.calls++)}}function h(a,c,b){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(c.attributes.position),m.vertexAttribPointer(c.attributes.position,3,m.FLOAT,!1,0,0));if(a.hasNormal){m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
|
+a.__webglNormalBuffer);if(b==THREE.FlatShading){var e,f,k,h,l,n,p,t,o,v,u=a.count*3;for(v=0;v<u;v+=9)b=a.normalArray,e=b[v],f=b[v+1],k=b[v+2],h=b[v+3],n=b[v+4],t=b[v+5],l=b[v+6],p=b[v+7],o=b[v+8],e=(e+h+l)/3,f=(f+n+p)/3,k=(k+t+o)/3,b[v]=e,b[v+1]=f,b[v+2]=k,b[v+3]=e,b[v+4]=f,b[v+5]=k,b[v+6]=e,b[v+7]=f,b[v+8]=k}m.bufferData(m.ARRAY_BUFFER,a.normalArray,m.DYNAMIC_DRAW);m.enableVertexAttribArray(c.attributes.normal);m.vertexAttribPointer(c.attributes.normal,3,m.FLOAT,!1,0,0)}m.drawArrays(m.TRIANGLES,
|
|
|
|
+0,a.count);a.count=0}function k(a){if(ja!=a.doubleSided)a.doubleSided?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),ja=a.doubleSided;if(ca!=a.flipSided)a.flipSided?m.frontFace(m.CW):m.frontFace(m.CCW),ca=a.flipSided}function l(a){R!=a&&(a?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),R=a)}function n(a){Y!=a&&(m.depthMask(a),Y=a)}function p(a,c,b){X!=a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),X=a);if(a&&(ga!=c||oa!=b))m.polygonOffset(c,b),ga=c,oa=b}function u(a){ua[0].set(a.n41-
|
|
|
|
+a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ua[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ua[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ua[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ua[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ua[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var c,a=0;a<6;a++)c=ua[a],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function t(a){for(var c=a.matrixWorld,b=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
|
|
|
|
+Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ua[e].x*c.n14+ua[e].y*c.n24+ua[e].z*c.n34+ua[e].w,a<=b)return!1;return!0}function v(a){var c=a.object.material;c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}function o(a){var c=a.object,b=a.buffer,e;e=c.material;if(e instanceof THREE.MeshFaceMaterial){if(b=b.materialIndex,b>=0)c=c.geometry.materials[b],c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}else if(c=e)c.transparent?(a.transparent=
|
|
|
|
+c,a.opaque=null):(a.opaque=c,a.transparent=null)}function y(a,c){return c.z-a.z}function x(a){var c,b,n,p=0,o,v,G,w,x=a.lights;pa||(pa=new THREE.PerspectiveCamera(S.shadowCameraFov,S.shadowMapWidth/S.shadowMapHeight,S.shadowCameraNear,S.shadowCameraFar));c=0;for(b=x.length;c<b;c++)if(n=x[c],n instanceof THREE.SpotLight&&n.castShadow){da=-1;S.shadowMap[p]||(S.shadowMap[p]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
|
|
|
|
+ka[p]||(ka[p]=new THREE.Matrix4);o=S.shadowMap[p];v=ka[p];pa.position.copy(n.position);pa.lookAt(n.target.position);pa.update(void 0,!0);a.update(void 0,!1,pa);v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(pa.projectionMatrix);v.multiplySelf(pa.matrixWorldInverse);pa.matrixWorldInverse.flattenToArray(Ea);pa.projectionMatrix.flattenToArray(Da);sa.multiply(pa.projectionMatrix,pa.matrixWorldInverse);u(sa);S.initWebGLObjects(a);V(o);m.clearColor(1,1,1,1);S.clear();m.clearColor(I.r,
|
|
|
|
+I.g,I.b,N);v=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(o=0;o<v;o++)G=a.__webglObjects[o],w=G.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||!w.frustumCulled||t(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),A(w,pa,!1),G.render=!0):G.render=!1:G.render=!1;l(!0);F(THREE.NormalBlending);for(o=0;o<v;o++)if(G=a.__webglObjects[o],G.render)w=G.object,buffer=G.buffer,k(w),G=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Ca:va,f(pa,x,null,
|
|
|
|
+G,buffer,w);for(o=0;o<n;o++)G=a.__webglObjectsImmediate[o],w=G.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ia=-1,A(w,pa,!1),k(w),program=e(pa,x,null,va,w),w.immediateRenderCallback?w.immediateRenderCallback(program,m,ua):w.render(function(a){h(a,program,va.shading)}));p++}}function w(a,c){var b,e,f;b=W.attributes;var k=W.uniforms,h=la/qa,l,n=[],p=qa*0.5,t=la*0.5,o=!0;m.useProgram(W.program);U=W.program;ia=R=Z=-1;Ta||(m.enableVertexAttribArray(W.attributes.position),
|
|
|
|
+m.enableVertexAttribArray(W.attributes.uv),Ta=!0);m.disable(m.CULL_FACE);m.enable(m.BLEND);m.depthMask(!0);m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.vertexAttribPointer(b.position,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.uniformMatrix4fv(k.projectionMatrix,!1,Da);m.activeTexture(m.TEXTURE0);m.uniform1i(k.map,0);b=0;for(e=a.__webglSprites.length;b<e;b++)if(f=a.__webglSprites[b],f.visible&&f.opacity!=0)f.useScreenCoordinates?
|
|
|
|
+f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(y);b=0;for(e=a.__webglSprites.length;b<e;b++)f=a.__webglSprites[b],f.visible&&f.opacity!=0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(m.uniform1i(k.useScreenCoordinates,1),m.uniform3f(k.screenPosition,(f.position.x-p)/p,(t-f.position.y)/t,Math.max(0,Math.min(1,f.position.z)))):(m.uniform1i(k.useScreenCoordinates,
|
|
|
|
+0),m.uniform1i(k.affectedByDistance,f.affectedByDistance?1:0),m.uniformMatrix4fv(k.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?la:1),n[0]=l*h*f.scale.x,n[1]=l*f.scale.y,m.uniform2f(k.uvScale,f.uvScale.x,f.uvScale.y),m.uniform2f(k.uvOffset,f.uvOffset.x,f.uvOffset.y),m.uniform2f(k.alignment,f.alignment.x,f.alignment.y),m.uniform1f(k.opacity,f.opacity),m.uniform3f(k.color,f.color.r,f.color.g,f.color.b),m.uniform1f(k.rotation,f.rotation),m.uniform2fv(k.scale,n),
|
|
|
|
+f.mergeWith3D&&!o?(m.enable(m.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(m.disable(m.DEPTH_TEST),o=!1),F(f.blending),E(f.map,0),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0));m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(Y)}function A(a,c,b){a._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);b&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function z(a,c){var e=b(c,a);if(e.attributes)for(var f in e.attributes)if(e.attributes[f].needsUpdate)return!0;
|
|
|
|
+return!1}function C(a,c){var e=b(c,a);if(e.attributes)for(var f in e.attributes)e.attributes[f].needsUpdate=!1}function B(a,c){var b;for(b=a.length-1;b>=0;b--)a[b].object==c&&a.splice(b,1)}function K(a,c,b){a.push({buffer:c,object:b,opaque:null,transparent:null})}function F(a){if(a!=Z){switch(a){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD);
|
|
|
|
+m.blendFunc(m.ZERO,m.SRC_COLOR);break;default: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)}Z=a}}function M(a,c,b){(b.width&b.width-1)==0&&(b.height&b.height-1)==0?(m.texParameteri(a,m.TEXTURE_WRAP_S,T(c.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,T(c.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,T(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,T(c.minFilter)),m.generateMipmap(a)):(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,L(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,L(c.minFilter)))}function E(a,c){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=m.createTexture(),S.info.memory.textures++;m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.image.width,a.image.height,0,T(a.format),m.UNSIGNED_BYTE,
|
|
|
|
+a.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,a.image);M(m.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+c),m.bindTexture(m.TEXTURE_2D,a.__webglTexture)}function O(a,c){m.bindRenderbuffer(m.RENDERBUFFER,a);c.depthBuffer&&!c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):c.depthBuffer&&c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,
|
|
|
|
+m.DEPTH_STENCIL,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,c.width,c.height)}function V(a){var c=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=m.createTexture();if(c){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);
|
|
|
|
+M(m.TEXTURE_CUBE_MAP,a,a);for(var b=0;b<6;b++){a.__webglFramebuffer[b]=m.createFramebuffer();a.__webglRenderbuffer[b]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+b,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null);var e=a,f=m.TEXTURE_CUBE_MAP_POSITIVE_X+b;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[b]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,f,e.__webglTexture,0);O(a.__webglRenderbuffer[b],a)}}else a.__webglFramebuffer=m.createFramebuffer(),
|
|
|
|
+a.__webglRenderbuffer=m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),M(m.TEXTURE_2D,a,a),m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null),b=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,b,a.__webglTexture,0),m.bindRenderbuffer(m.RENDERBUFFER,a.__webglRenderbuffer),O(a.__webglRenderbuffer,a);c?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);
|
|
|
|
+m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(c=c?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,b=a.width,a=a.height,f=e=0):(c=null,b=qa,a=la,e=na,f=fa);c!=ea&&(m.bindFramebuffer(m.FRAMEBUFFER,c),m.viewport(e,f,b,a),ea=c)}function H(a){a instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture),
|
|
|
|
+m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function P(a,c){var b;a=="fragment"?b=m.createShader(m.FRAGMENT_SHADER):a=="vertex"&&(b=m.createShader(m.VERTEX_SHADER));m.shaderSource(b,c);m.compileShader(b);if(!m.getShaderParameter(b,m.COMPILE_STATUS))return console.error(m.getShaderInfoLog(b)),console.error(c),null;return b}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return m.NEAREST;default:return m.LINEAR}}
|
|
|
|
+function T(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.UnsignedShortType: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 S=this,m,aa=[],U=null,ea=null,da=-1,ia=null,ha=0,ja=null,ca=null,Z=null,R=null,Y=null,X=null,ga=null,oa=null,na=0,fa=0,qa=0,la=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),Ea=new Float32Array(16),za=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},xa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
|
+G=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ma=a.antialias!==void 0?a.antialias:!1,I=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),N=a.clearAlpha!==void 0?a.clearAlpha:0,ta=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
|
|
|
|
+!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var pa,ka=[],a=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(a.uniforms),va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya}),
|
|
|
|
+Ca=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya,morphTargets:!0});va._shadowPass=!0;Ca._shadowPass=!0;try{if(!(m=xa.getContext("experimental-webgl",{antialias:ma,stencil:G,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+m.getParameter(m.VERSION)+" | "+m.getParameter(m.VENDOR)+" | "+m.getParameter(m.RENDERER)+" | "+m.getParameter(m.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}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(I.r,I.g,I.b,N);this.context=m;var Ga=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);G=0;W.vertices[G++]=-1;W.vertices[G++]=-1;W.vertices[G++]=0;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=
|
|
|
|
+-1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=0;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=0;G=W.vertices[G++]=0;W.faces[G++]=0;W.faces[G++]=1;W.faces[G++]=2;W.faces[G++]=0;W.faces[G++]=2;W.faces[G++]=3;W.vertexBuffer=m.createBuffer();W.elementBuffer=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.bufferData(m.ARRAY_BUFFER,W.vertices,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+W.faces,m.STATIC_DRAW);W.program=m.createProgram();m.attachShader(W.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));m.attachShader(W.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));m.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=m.getAttribLocation(W.program,"position");W.attributes.uv=m.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=m.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=m.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=
|
|
|
|
+m.getUniformLocation(W.program,"rotation");W.uniforms.scale=m.getUniformLocation(W.program,"scale");W.uniforms.alignment=m.getUniformLocation(W.program,"alignment");W.uniforms.color=m.getUniformLocation(W.program,"color");W.uniforms.map=m.getUniformLocation(W.program,"map");W.uniforms.opacity=m.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=m.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=m.getUniformLocation(W.program,"affectedByDistance");
|
|
|
|
+W.uniforms.screenPosition=m.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=m.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=m.getUniformLocation(W.program,"projectionMatrix");var Ta=!1;this.setSize=function(a,c){xa.width=a;xa.height=c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(a,c,b,e){na=a;fa=c;qa=b;la=e;m.viewport(na,fa,qa,la)};this.setScissor=function(a,c,b,e){m.scissor(a,c,b,e)};this.enableScissorTest=function(a){a?
|
|
|
|
+m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColorHex=function(a,c){I.setHex(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.setClearColor=function(a,c){I.copy(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.getClearColor=function(){return I};this.getClearAlpha=function(){return N};this.clear=function(a,c,b){var e=0;if(a==void 0||a)e|=m.COLOR_BUFFER_BIT;if(c==void 0||c)e|=m.DEPTH_BUFFER_BIT;if(b==void 0||b)e|=m.STENCIL_BUFFER_BIT;m.clear(e)};this.getContext=function(){return m};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(g in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[g];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);if(c.numMorphTargets)for(var b=0,e=c.numMorphTargets;b<e;b++)m.deleteBuffer(c.__webglMorphTargetsBuffers[b]);S.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof
|
|
|
|
+THREE.Line)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,m.deleteTexture(a.__webglTexture),S.info.memory.textures--};this.initMaterial=function(a,c,b,e){var f,k,h,l;a instanceof THREE.MeshDepthMaterial?l="depth":
|
|
|
|
+a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var p,t,o;p=o=n=0;for(t=c.length;p<t;p++)h=c[p],h instanceof
|
|
|
|
+THREE.SpotLight&&o++,h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&n++;n+o<=ta?p=o:(p=Math.ceil(ta*o/(n+o)),n=ta-p);h={directional:p,point:n};n=o=0;for(p=c.length;n<p;n++)t=c[n],t instanceof THREE.SpotLight&&t.castShadow&&o++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=e.bones.length;var u;a:{p=a.fragmentShader;t=a.vertexShader;var n=a.uniforms,c=a.attributes,b={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:b,useFog:a.fog,
|
|
|
|
+sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},w,e=[];l?e.push(l):(e.push(p),e.push(t));for(w in b)e.push(w),e.push(b[w]);l=e.join();w=0;
|
|
|
|
+for(e=aa.length;w<e;w++)if(aa[w].code==l){u=aa[w].program;break a}w=m.createProgram();e=[Ga?"#define VERTEX_TEXTURES":"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,"#define MAX_SHADOWS "+b.maxShadows,"#define MAX_BONES "+b.maxBones,b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":"",b.lightMap?"#define USE_LIGHTMAP":
|
|
"",b.vertexColors?"#define USE_COLOR":"",b.skinning?"#define USE_SKINNING":"",b.morphTargets?"#define USE_MORPHTARGETS":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
"",b.vertexColors?"#define USE_COLOR":"",b.skinning?"#define USE_SKINNING":"",b.morphTargets?"#define USE_MORPHTARGETS":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
-h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,"#define MAX_SHADOWS "+b.maxShadows,b.alphaTest?"#define ALPHATEST "+b.alphaTest:"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",b.useFog&&b.fog?"#define USE_FOG":"",b.useFog&&b.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":
|
|
|
|
-"",b.lightMap?"#define USE_LIGHTMAP":"",b.vertexColors?"#define USE_COLOR":"",b.metal?"#define METAL":"",b.perPixel?"#define PHONG_PER_PIXEL":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.shadowMapSoft?"#define SHADOWMAP_WIDTH "+b.shadowMapWidth.toFixed(1):"",b.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+b.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");n.attachShader(w,J("fragment",h+p));n.attachShader(w,
|
|
|
|
-J("vertex",e+t));n.linkProgram(w);n.getProgramParameter(w,n.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+n.getProgramParameter(w,n.VALIDATE_STATUS)+", gl error ["+n.getError()+"]");w.uniforms={};w.attributes={};var x,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in m)e.push(x);x=e;e=0;for(m=x.length;e<m;e++)p=x[e],w.uniforms[p]=n.getUniformLocation(w,
|
|
|
|
-p);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<b.maxMorphTargets;x++)e.push("morphTarget"+x);for(v in c)e.push(v);v=e;x=0;for(c=v.length;x<c;x++)b=v[x],w.attributes[b]=n.getAttribLocation(w,b);w.id=U.length;U.push({program:w,code:l});O.info.memory.programs=U.length;v=w}a.program=v;v=a.program.attributes;v.position>=0&&n.enableVertexAttribArray(v.position);v.color>=0&&n.enableVertexAttribArray(v.color);v.normal>=0&&n.enableVertexAttribArray(v.normal);
|
|
|
|
-v.tangent>=0&&n.enableVertexAttribArray(v.tangent);a.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(n.enableVertexAttribArray(v.skinVertexA),n.enableVertexAttribArray(v.skinVertexB),n.enableVertexAttribArray(v.skinIndex),n.enableVertexAttribArray(v.skinWeight));if(a.attributes)for(k in a.attributes)v[k]!==void 0&&v[k]>=0&&n.enableVertexAttribArray(v[k]);if(a.morphTargets)for(k=a.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)x="morphTarget"+k,v[x]>=0&&(n.enableVertexAttribArray(v[x]),
|
|
|
|
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,c,b,e){H(a);this.clear(c,b,e)};this.updateShadowMap=function(a,c){w(a,c)};this.render=function(a,c,b,v){var M,Y,ia,A,E,ja,C,G,oa=a.lights,N=a.fog;ca=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&w(a,c);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;if(c.matrixAutoUpdate){for(E=c;E.parent;)E=E.parent;E.update(void 0,!0)}a.update(void 0,
|
|
|
|
-!1,c);c.matrixWorldInverse.flattenToArray(Ea);c.projectionMatrix.flattenToArray(Fa);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);u(Ca);this.initWebGLObjects(a);H(b);(this.autoClear||v)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);E=a.__webglObjects.length;for(v=0;v<E;v++)if(M=a.__webglObjects[v],C=M.object,C.visible)if(!(C instanceof THREE.Mesh)||!C.frustumCulled||p(C)){if(C.matrixWorld.flattenToArray(C._objectMatrixArray),y(C,c,!0),z(M),M.render=!0,this.sortObjects)M.object.renderDepth?
|
|
|
|
-M.z=M.object.renderDepth:(za.copy(C.position),Ca.multiplyVector3(za),M.z=za.z)}else M.render=!1;else M.render=!1;this.sortObjects&&a.__webglObjects.sort(x);ja=a.__webglObjectsImmediate.length;for(v=0;v<ja;v++)M=a.__webglObjectsImmediate[v],C=M.object,C.visible&&(C.matrixAutoUpdate&&C.matrixWorld.flattenToArray(C._objectMatrixArray),y(C,c,!0),o(M));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);F(a.overrideMaterial.blending);for(v=0;v<E;v++)if(M=a.__webglObjects[v],M.render)C=M.object,G=M.buffer,
|
|
|
|
-k(C),f(c,oa,N,a.overrideMaterial,G,C);for(v=0;v<ja;v++)M=a.__webglObjectsImmediate[v],C=M.object,C.visible&&(ea=-1,k(C),Y=e(c,oa,N,a.overrideMaterial,C),C.immediateRenderCallback?C.immediateRenderCallback(Y,n,pa):C.render(function(c){h(c,Y,a.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(v=E-1;v>=0;v--)if(M=a.__webglObjects[v],M.render){C=M.object;G=M.buffer;ia=M.opaque;k(C);for(M=0;M<ia.count;M++)A=ia.list[M],l(A.depthTest),m(A.depthWrite),t(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),
|
|
|
|
-f(c,oa,N,A,G,C)}for(v=0;v<ja;v++)if(M=a.__webglObjectsImmediate[v],C=M.object,C.visible){ea=-1;ia=M.opaque;k(C);for(M=0;M<ia.count;M++)A=ia.list[M],l(A.depthTest),m(A.depthWrite),t(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),Y=e(c,oa,N,A,C),C.immediateRenderCallback?C.immediateRenderCallback(Y,n,pa):C.render(function(a){h(a,Y,A.shading)})}for(v=0;v<E;v++)if(M=a.__webglObjects[v],M.render){C=M.object;G=M.buffer;ia=M.transparent;k(C);for(M=0;M<ia.count;M++)A=ia.list[M],F(A.blending),
|
|
|
|
-l(A.depthTest),m(A.depthWrite),t(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),f(c,oa,N,A,G,C)}for(v=0;v<ja;v++)if(M=a.__webglObjectsImmediate[v],C=M.object,C.visible){ea=-1;ia=M.transparent;k(C);for(M=0;M<ia.count;M++)A=ia.list[M],F(A.blending),l(A.depthTest),m(A.depthWrite),t(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),Y=e(c,oa,N,A,C),C.immediateRenderCallback?C.immediateRenderCallback(Y,n,pa):C.render(function(a){h(a,Y,A.shading)})}}a.__webglSprites.length&&B(a,c);
|
|
|
|
-b&&b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&S(b)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,k=void 0,h=void 0,l=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),
|
|
|
|
-e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups==void 0){var l=h,m=void 0,p=void 0,t=void 0,o=void 0,v=t=void 0,u=void 0,w={},M=l.morphTargets!==void 0?l.morphTargets.length:0;l.geometryGroups={};m=0;for(p=l.faces.length;m<p;m++)t=l.faces[m],o=t.materialIndex,v=o!==void 0?o:-1,w[v]==void 0&&(w[v]={hash:v,counter:0}),u=w[v].hash+"_"+w[v].counter,l.geometryGroups[u]==void 0&&(l.geometryGroups[u]={faces:[],materialIndex:o,vertices:0,numMorphTargets:M}),t=t instanceof THREE.Face3?3:4,l.geometryGroups[u].vertices+
|
|
|
|
-t>65535&&(w[v].counter+=1,u=w[v].hash+"_"+w[v].counter,l.geometryGroups[u]==void 0&&(l.geometryGroups[u]={faces:[],materialIndex:o,vertices:0,numMorphTargets:M})),l.geometryGroups[u].faces.push(m),l.geometryGroups[u].vertices+=t;l.geometryGroupsList=[];m=void 0;for(m in l.geometryGroups)l.geometryGroups[m].id=la++,l.geometryGroupsList.push(l.geometryGroups[m])}for(k in h.geometryGroups)if(l=h.geometryGroups[k],!l.__webglVertexBuffer){m=l;m.__webglVertexBuffer=n.createBuffer();m.__webglNormalBuffer=
|
|
|
|
-n.createBuffer();m.__webglTangentBuffer=n.createBuffer();m.__webglColorBuffer=n.createBuffer();m.__webglUVBuffer=n.createBuffer();m.__webglUV2Buffer=n.createBuffer();m.__webglSkinVertexABuffer=n.createBuffer();m.__webglSkinVertexBBuffer=n.createBuffer();m.__webglSkinIndicesBuffer=n.createBuffer();m.__webglSkinWeightsBuffer=n.createBuffer();m.__webglFaceBuffer=n.createBuffer();m.__webglLineBuffer=n.createBuffer();if(m.numMorphTargets){o=p=void 0;m.__webglMorphTargetsBuffers=[];p=0;for(o=m.numMorphTargets;p<
|
|
|
|
-o;p++)m.__webglMorphTargetsBuffers.push(n.createBuffer())}O.info.memory.geometries++;for(var o=e,x=t=w=void 0,v=x=M=x=void 0,u=v=m=0,z=t=void 0,Y=void 0,t=p=M=w=void 0,M=o.geometry,z=M.faces,Y=l.faces,w=0,t=Y.length;w<t;w++)x=Y[w],x=z[x],x instanceof THREE.Face3?(m+=3,v+=1,u+=3):x instanceof THREE.Face4&&(m+=4,v+=2,u+=4);w=b(o,l);t=w.map||w.lightMap||w instanceof THREE.ShaderMaterial?!0:!1;Y=w instanceof THREE.MeshBasicMaterial&&!w.envMap||w instanceof THREE.MeshDepthMaterial?!1:w&&w.shading!=void 0&&
|
|
|
|
-w.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;z=w.vertexColors?w.vertexColors:!1;l.__vertexArray=new Float32Array(m*3);if(Y)l.__normalArray=new Float32Array(m*3);if(M.hasTangents)l.__tangentArray=new Float32Array(m*4);if(z)l.__colorArray=new Float32Array(m*3);if(t){if(M.faceUvs.length>0||M.faceVertexUvs.length>0)l.__uvArray=new Float32Array(m*2);if(M.faceUvs.length>1||M.faceVertexUvs.length>1)l.__uv2Array=new Float32Array(m*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)l.__skinVertexAArray=
|
|
|
|
-new Float32Array(m*4),l.__skinVertexBArray=new Float32Array(m*4),l.__skinIndexArray=new Float32Array(m*4),l.__skinWeightArray=new Float32Array(m*4);l.__faceArray=new Uint16Array(v*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0));l.__lineArray=new Uint16Array(u*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];M=0;for(x=l.numMorphTargets;M<x;M++)l.__morphTargetsArrays.push(new Float32Array(m*3))}l.__needsSmoothNormals=Y==THREE.SmoothShading;l.__uvType=t;l.__vertexColorType=z;l.__normalType=
|
|
|
|
-Y;l.__webglFaceCount=v*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0);l.__webglLineCount=u*2;if(w.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=[];o=void 0;for(o in w.attributes){t=w.attributes[o];M={};for(p in t)M[p]=t[p];if(!M.__webglInitialized||M.createUniqueBuffers)M.__webglInitialized=!0,v=1,M.type==="v2"?v=2:M.type==="v3"?v=3:M.type==="v4"?v=4:M.type==="c"&&(v=3),M.size=v,M.array=new Float32Array(m*v),M.buffer=n.createBuffer(),M.buffer.belongsToAttribute=
|
|
|
|
-o,t.needsUpdate=!0,M.__original=t;l.__webglCustomAttributesList.push(M)}}l.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)l=h,l.__webglVertexBuffer=n.createBuffer(),l.__webglColorBuffer=n.createBuffer(),O.info.memory.geometries++,l=h,m=l.vertices.length,l.__vertexArray=new Float32Array(m*3),l.__colorArray=new Float32Array(m*
|
|
|
|
-3),l.__webglVertexCount=m,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)l=h,l.__webglVertexBuffer=n.createBuffer(),l.__webglColorBuffer=n.createBuffer(),O.info.memory.geometries++,l=h,m=l.vertices.length,l.__vertexArray=new Float32Array(m*3),l.__colorArray=new Float32Array(m*3),l.__webglLineCount=m,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer)){l=h;l.__webglVertexBuffer=
|
|
|
|
-n.createBuffer();l.__webglColorBuffer=n.createBuffer();O.info.geometries++;l=h;p=e;m=l.vertices.length;l.__vertexArray=new Float32Array(m*3);l.__colorArray=new Float32Array(m*3);l.__sortArray=[];l.__webglParticleCount=m;p=p.material;if(p.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=[];o=void 0;for(o in p.attributes){originalAttribute=p.attributes[o];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||
|
|
|
|
-attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(m*size),attribute.buffer=n.createBuffer(),attribute.buffer.belongsToAttribute=o,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;l.__webglCustomAttributesList.push(attribute)}}h.__dirtyVertices=!0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof
|
|
|
|
-THREE.Mesh)for(k in h=e.geometry,h.geometryGroups)l=h.geometryGroups[k],L(f.__webglObjects,l,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,L(f.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,
|
|
|
|
-1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)C(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;h=void 0;for(h=f.length-1;h>=0;h--)f[h]==k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&C(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(h=
|
|
|
|
-a.__webglObjects[e].object,o=l=k=void 0,h instanceof THREE.Mesh){k=h.geometry;m=0;for(p=k.geometryGroupsList.length;m<p;m++)if(l=k.geometryGroupsList[m],o=A(l,h),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||o)if(o=l,v=n.DYNAMIC_DRAW,u=!k.dynamic,o.__inittedArrays){var ia=M=w=void 0,y=void 0,B=ia=void 0,ja=void 0,G=void 0,oa=void 0,N=x=Y=z=t=void 0,F=void 0,H=void 0,da=void 0,ra=void 0,K=y=oa=y=G=ja=void 0,J=void 0,
|
|
|
|
-I=J=K=ja=void 0,D=void 0,I=J=K=ia=ia=B=J=K=y=I=J=K=D=I=J=K=D=I=J=K=void 0,Q=0,T=0,sa=0,S=0,ma=0,U=0,R=0,wa=0,ha=0,P=0,X=0,V=I=0,V=void 0,W=o.__vertexArray,fa=o.__uvArray,ea=o.__uv2Array,xa=o.__normalArray,ca=o.__tangentArray,aa=o.__colorArray,ga=o.__skinVertexAArray,$=o.__skinVertexBArray,na=o.__skinIndexArray,Z=o.__skinWeightArray,ka=o.__morphTargetsArrays,ya=o.__webglCustomAttributesList,D=void 0,qa=o.__faceArray,pa=o.__lineArray,Ba=o.__needsSmoothNormals,z=o.__vertexColorType,t=o.__uvType,Y=o.__normalType,
|
|
|
|
-ua=h.geometry,Ca=ua.__dirtyVertices,Fa=ua.__dirtyElements,za=ua.__dirtyUvs,Ia=ua.__dirtyNormals,Ea=ua.__dirtyTangents,Ha=ua.__dirtyColors,Da=ua.__dirtyMorphTargets,Ja=ua.vertices,bb=o.faces,eb=ua.faces,cb=ua.faceVertexUvs[0],db=ua.faceVertexUvs[1],Ra=ua.skinVerticesA,Sa=ua.skinVerticesB,Ta=ua.skinIndices,La=ua.skinWeights,Ka=ua.morphTargets;if(ya){K=0;for(J=ya.length;K<J;K++)ya[K].offset=0,ya[K].offsetSrc=0}w=0;for(M=bb.length;w<M;w++)if(ia=bb[w],y=eb[ia],cb&&(x=cb[ia]),db&&(N=db[ia]),ia=y.vertexNormals,
|
|
|
|
-B=y.normal,ja=y.vertexColors,G=y.color,oa=y.vertexTangents,y instanceof THREE.Face3){if(Ca)F=Ja[y.a].position,H=Ja[y.b].position,da=Ja[y.c].position,W[T]=F.x,W[T+1]=F.y,W[T+2]=F.z,W[T+3]=H.x,W[T+4]=H.y,W[T+5]=H.z,W[T+6]=da.x,W[T+7]=da.y,W[T+8]=da.z,T+=9;if(ya){K=0;for(J=ya.length;K<J;K++)if(D=ya[K],D.__original.needsUpdate)I=D.offset,V=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[I]=D.value[y.a],D.array[I+1]=D.value[y.b],D.array[I+2]=D.value[y.c]):D.boundTo==="faces"?
|
|
|
|
-(V=D.value[V],D.array[I]=V,D.array[I+1]=V,D.array[I+2]=V,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[I]=D.value[V],D.array[I+1]=D.value[V+1],D.array[I+2]=D.value[V+2],D.offsetSrc+=3),D.offset+=3):(D.boundTo===void 0||D.boundTo==="vertices"?(F=D.value[y.a],H=D.value[y.b],da=D.value[y.c]):D.boundTo==="faces"?(da=H=F=V=D.value[V],D.offsetSrc++):D.boundTo==="faceVertices"&&(F=D.value[V],H=D.value[V+1],da=D.value[V+2],D.offsetSrc+=3),D.size===2?(D.array[I]=F.x,D.array[I+1]=F.y,D.array[I+2]=H.x,
|
|
|
|
-D.array[I+3]=H.y,D.array[I+4]=da.x,D.array[I+5]=da.y,D.offset+=6):D.size===3?(D.type==="c"?(D.array[I]=F.r,D.array[I+1]=F.g,D.array[I+2]=F.b,D.array[I+3]=H.r,D.array[I+4]=H.g,D.array[I+5]=H.b,D.array[I+6]=da.r,D.array[I+7]=da.g,D.array[I+8]=da.b):(D.array[I]=F.x,D.array[I+1]=F.y,D.array[I+2]=F.z,D.array[I+3]=H.x,D.array[I+4]=H.y,D.array[I+5]=H.z,D.array[I+6]=da.x,D.array[I+7]=da.y,D.array[I+8]=da.z),D.offset+=9):(D.array[I]=F.x,D.array[I+1]=F.y,D.array[I+2]=F.z,D.array[I+3]=F.w,D.array[I+4]=H.x,D.array[I+
|
|
|
|
-5]=H.y,D.array[I+6]=H.z,D.array[I+7]=H.w,D.array[I+8]=da.x,D.array[I+9]=da.y,D.array[I+10]=da.z,D.array[I+11]=da.w,D.offset+=12))}if(Da){K=0;for(J=Ka.length;K<J;K++)F=Ka[K].vertices[y.a].position,H=Ka[K].vertices[y.b].position,da=Ka[K].vertices[y.c].position,I=ka[K],I[X]=F.x,I[X+1]=F.y,I[X+2]=F.z,I[X+3]=H.x,I[X+4]=H.y,I[X+5]=H.z,I[X+6]=da.x,I[X+7]=da.y,I[X+8]=da.z;X+=9}if(La.length)K=La[y.a],J=La[y.b],I=La[y.c],Z[P]=K.x,Z[P+1]=K.y,Z[P+2]=K.z,Z[P+3]=K.w,Z[P+4]=J.x,Z[P+5]=J.y,Z[P+6]=J.z,Z[P+7]=J.w,
|
|
|
|
-Z[P+8]=I.x,Z[P+9]=I.y,Z[P+10]=I.z,Z[P+11]=I.w,K=Ta[y.a],J=Ta[y.b],I=Ta[y.c],na[P]=K.x,na[P+1]=K.y,na[P+2]=K.z,na[P+3]=K.w,na[P+4]=J.x,na[P+5]=J.y,na[P+6]=J.z,na[P+7]=J.w,na[P+8]=I.x,na[P+9]=I.y,na[P+10]=I.z,na[P+11]=I.w,K=Ra[y.a],J=Ra[y.b],I=Ra[y.c],ga[P]=K.x,ga[P+1]=K.y,ga[P+2]=K.z,ga[P+3]=1,ga[P+4]=J.x,ga[P+5]=J.y,ga[P+6]=J.z,ga[P+7]=1,ga[P+8]=I.x,ga[P+9]=I.y,ga[P+10]=I.z,ga[P+11]=1,K=Sa[y.a],J=Sa[y.b],I=Sa[y.c],$[P]=K.x,$[P+1]=K.y,$[P+2]=K.z,$[P+3]=1,$[P+4]=J.x,$[P+5]=J.y,$[P+6]=J.z,$[P+7]=1,$[P+
|
|
|
|
-8]=I.x,$[P+9]=I.y,$[P+10]=I.z,$[P+11]=1,P+=12;if(Ha&&z)ja.length==3&&z==THREE.VertexColors?(y=ja[0],K=ja[1],J=ja[2]):J=K=y=G,aa[ha]=y.r,aa[ha+1]=y.g,aa[ha+2]=y.b,aa[ha+3]=K.r,aa[ha+4]=K.g,aa[ha+5]=K.b,aa[ha+6]=J.r,aa[ha+7]=J.g,aa[ha+8]=J.b,ha+=9;if(Ea&&ua.hasTangents)ja=oa[0],G=oa[1],y=oa[2],ca[R]=ja.x,ca[R+1]=ja.y,ca[R+2]=ja.z,ca[R+3]=ja.w,ca[R+4]=G.x,ca[R+5]=G.y,ca[R+6]=G.z,ca[R+7]=G.w,ca[R+8]=y.x,ca[R+9]=y.y,ca[R+10]=y.z,ca[R+11]=y.w,R+=12;if(Ia&&Y)if(ia.length==3&&Ba)for(K=0;K<3;K++)B=ia[K],xa[U]=
|
|
|
|
-B.x,xa[U+1]=B.y,xa[U+2]=B.z,U+=3;else for(K=0;K<3;K++)xa[U]=B.x,xa[U+1]=B.y,xa[U+2]=B.z,U+=3;if(za&&x!==void 0&&t)for(K=0;K<3;K++)ia=x[K],fa[sa]=ia.u,fa[sa+1]=ia.v,sa+=2;if(za&&N!==void 0&&t)for(K=0;K<3;K++)ia=N[K],ea[S]=ia.u,ea[S+1]=ia.v,S+=2;Fa&&(qa[ma]=Q,qa[ma+1]=Q+1,qa[ma+2]=Q+2,ma+=3,pa[wa]=Q,pa[wa+1]=Q+1,pa[wa+2]=Q,pa[wa+3]=Q+2,pa[wa+4]=Q+1,pa[wa+5]=Q+2,wa+=6,Q+=3)}else if(y instanceof THREE.Face4){if(Ca)F=Ja[y.a].position,H=Ja[y.b].position,da=Ja[y.c].position,ra=Ja[y.d].position,W[T]=F.x,
|
|
|
|
-W[T+1]=F.y,W[T+2]=F.z,W[T+3]=H.x,W[T+4]=H.y,W[T+5]=H.z,W[T+6]=da.x,W[T+7]=da.y,W[T+8]=da.z,W[T+9]=ra.x,W[T+10]=ra.y,W[T+11]=ra.z,T+=12;if(ya){K=0;for(J=ya.length;K<J;K++)if(D=ya[K],D.__original.needsUpdate)I=D.offset,V=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[I]=D.value[y.a],D.array[I+1]=D.value[y.b],D.array[I+2]=D.value[y.c],D.array[I+3]=D.value[y.d]):D.boundTo==="faces"?(V=D.value[V],D.array[I]=V,D.array[I+1]=V,D.array[I+2]=V,D.array[I+3]=V,D.offsetSrc++):D.boundTo===
|
|
|
|
-"faceVertices"&&(D.array[I]=D.value[V],D.array[I+1]=D.value[V+1],D.array[I+2]=D.value[V+2],D.array[I+3]=D.value[V+3],D.offsetSrc+=4),D.offset+=4):(D.boundTo===void 0||D.boundTo==="vertices"?(F=D.value[y.a],H=D.value[y.b],da=D.value[y.c],ra=D.value[y.d]):D.boundTo==="faces"?(ra=da=H=F=V=D.value[V],D.offsetSrc++):D.boundTo==="faceVertices"&&(F=D.value[V],H=D.value[V+1],da=D.value[V+2],ra=D.value[V+3],D.offsetSrc+=4),D.size===2?(D.array[I]=F.x,D.array[I+1]=F.y,D.array[I+2]=H.x,D.array[I+3]=H.y,D.array[I+
|
|
|
|
-4]=da.x,D.array[I+5]=da.y,D.array[I+6]=ra.x,D.array[I+7]=ra.y,D.offset+=8):D.size===3?(D.type==="c"?(D.array[I]=F.r,D.array[I+1]=F.g,D.array[I+2]=F.b,D.array[I+3]=H.r,D.array[I+4]=H.g,D.array[I+5]=H.b,D.array[I+6]=da.r,D.array[I+7]=da.g,D.array[I+8]=da.b,D.array[I+9]=ra.r,D.array[I+10]=ra.g,D.array[I+11]=ra.b):(D.array[I]=F.x,D.array[I+1]=F.y,D.array[I+2]=F.z,D.array[I+3]=H.x,D.array[I+4]=H.y,D.array[I+5]=H.z,D.array[I+6]=da.x,D.array[I+7]=da.y,D.array[I+8]=da.z,D.array[I+9]=ra.x,D.array[I+10]=ra.y,
|
|
|
|
-D.array[I+11]=ra.z),D.offset+=12):(D.array[I]=F.x,D.array[I+1]=F.y,D.array[I+2]=F.z,D.array[I+3]=F.w,D.array[I+4]=H.x,D.array[I+5]=H.y,D.array[I+6]=H.z,D.array[I+7]=H.w,D.array[I+8]=da.x,D.array[I+9]=da.y,D.array[I+10]=da.z,D.array[I+11]=da.w,D.array[I+12]=ra.x,D.array[I+13]=ra.y,D.array[I+14]=ra.z,D.array[I+15]=ra.w,D.offset+=16))}if(Da){K=0;for(J=Ka.length;K<J;K++)F=Ka[K].vertices[y.a].position,H=Ka[K].vertices[y.b].position,da=Ka[K].vertices[y.c].position,ra=Ka[K].vertices[y.d].position,I=ka[K],
|
|
|
|
-I[X]=F.x,I[X+1]=F.y,I[X+2]=F.z,I[X+3]=H.x,I[X+4]=H.y,I[X+5]=H.z,I[X+6]=da.x,I[X+7]=da.y,I[X+8]=da.z,I[X+9]=ra.x,I[X+10]=ra.y,I[X+11]=ra.z;X+=12}if(La.length)K=La[y.a],J=La[y.b],I=La[y.c],D=La[y.d],Z[P]=K.x,Z[P+1]=K.y,Z[P+2]=K.z,Z[P+3]=K.w,Z[P+4]=J.x,Z[P+5]=J.y,Z[P+6]=J.z,Z[P+7]=J.w,Z[P+8]=I.x,Z[P+9]=I.y,Z[P+10]=I.z,Z[P+11]=I.w,Z[P+12]=D.x,Z[P+13]=D.y,Z[P+14]=D.z,Z[P+15]=D.w,K=Ta[y.a],J=Ta[y.b],I=Ta[y.c],D=Ta[y.d],na[P]=K.x,na[P+1]=K.y,na[P+2]=K.z,na[P+3]=K.w,na[P+4]=J.x,na[P+5]=J.y,na[P+6]=J.z,na[P+
|
|
|
|
-7]=J.w,na[P+8]=I.x,na[P+9]=I.y,na[P+10]=I.z,na[P+11]=I.w,na[P+12]=D.x,na[P+13]=D.y,na[P+14]=D.z,na[P+15]=D.w,K=Ra[y.a],J=Ra[y.b],I=Ra[y.c],D=Ra[y.d],ga[P]=K.x,ga[P+1]=K.y,ga[P+2]=K.z,ga[P+3]=1,ga[P+4]=J.x,ga[P+5]=J.y,ga[P+6]=J.z,ga[P+7]=1,ga[P+8]=I.x,ga[P+9]=I.y,ga[P+10]=I.z,ga[P+11]=1,ga[P+12]=D.x,ga[P+13]=D.y,ga[P+14]=D.z,ga[P+15]=1,K=Sa[y.a],J=Sa[y.b],I=Sa[y.c],y=Sa[y.d],$[P]=K.x,$[P+1]=K.y,$[P+2]=K.z,$[P+3]=1,$[P+4]=J.x,$[P+5]=J.y,$[P+6]=J.z,$[P+7]=1,$[P+8]=I.x,$[P+9]=I.y,$[P+10]=I.z,$[P+11]=
|
|
|
|
-1,$[P+12]=y.x,$[P+13]=y.y,$[P+14]=y.z,$[P+15]=1,P+=16;if(Ha&&z)ja.length==4&&z==THREE.VertexColors?(y=ja[0],K=ja[1],J=ja[2],ja=ja[3]):ja=J=K=y=G,aa[ha]=y.r,aa[ha+1]=y.g,aa[ha+2]=y.b,aa[ha+3]=K.r,aa[ha+4]=K.g,aa[ha+5]=K.b,aa[ha+6]=J.r,aa[ha+7]=J.g,aa[ha+8]=J.b,aa[ha+9]=ja.r,aa[ha+10]=ja.g,aa[ha+11]=ja.b,ha+=12;if(Ea&&ua.hasTangents)ja=oa[0],G=oa[1],y=oa[2],oa=oa[3],ca[R]=ja.x,ca[R+1]=ja.y,ca[R+2]=ja.z,ca[R+3]=ja.w,ca[R+4]=G.x,ca[R+5]=G.y,ca[R+6]=G.z,ca[R+7]=G.w,ca[R+8]=y.x,ca[R+9]=y.y,ca[R+10]=y.z,
|
|
|
|
-ca[R+11]=y.w,ca[R+12]=oa.x,ca[R+13]=oa.y,ca[R+14]=oa.z,ca[R+15]=oa.w,R+=16;if(Ia&&Y)if(ia.length==4&&Ba)for(K=0;K<4;K++)B=ia[K],xa[U]=B.x,xa[U+1]=B.y,xa[U+2]=B.z,U+=3;else for(K=0;K<4;K++)xa[U]=B.x,xa[U+1]=B.y,xa[U+2]=B.z,U+=3;if(za&&x!==void 0&&t)for(K=0;K<4;K++)ia=x[K],fa[sa]=ia.u,fa[sa+1]=ia.v,sa+=2;if(za&&N!==void 0&&t)for(K=0;K<4;K++)ia=N[K],ea[S]=ia.u,ea[S+1]=ia.v,S+=2;Fa&&(qa[ma]=Q,qa[ma+1]=Q+1,qa[ma+2]=Q+3,qa[ma+3]=Q+1,qa[ma+4]=Q+2,qa[ma+5]=Q+3,ma+=6,pa[wa]=Q,pa[wa+1]=Q+1,pa[wa+2]=Q,pa[wa+
|
|
|
|
-3]=Q+3,pa[wa+4]=Q+1,pa[wa+5]=Q+2,pa[wa+6]=Q+2,pa[wa+7]=Q+3,wa+=8,Q+=4)}Ca&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,W,v));if(ya){K=0;for(J=ya.length;K<J;K++)D=ya[K],D.__original.needsUpdate&&(n.bindBuffer(n.ARRAY_BUFFER,D.buffer),n.bufferData(n.ARRAY_BUFFER,D.array,v))}if(Da){K=0;for(J=Ka.length;K<J;K++)n.bindBuffer(n.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[K]),n.bufferData(n.ARRAY_BUFFER,ka[K],v)}Ha&&ha>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglColorBuffer),
|
|
|
|
-n.bufferData(n.ARRAY_BUFFER,aa,v));Ia&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,xa,v));Ea&&ua.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,ca,v));za&&sa>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,fa,v));za&&S>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglUV2Buffer),n.bufferData(n.ARRAY_BUFFER,ea,v));Fa&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-qa,v),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,pa,v));P>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,ga,v),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,$,v),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,na,v),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,Z,v));u&&(delete o.__inittedArrays,delete o.__colorArray,
|
|
|
|
-delete o.__normalArray,delete o.__tangentArray,delete o.__uvArray,delete o.__uv2Array,delete o.__faceArray,delete o.__vertexArray,delete o.__lineArray,delete o.__skinVertexAArray,delete o.__skinVertexBArray,delete o.__skinIndexArray,delete o.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;E(l,h)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;
|
|
|
|
-l=n.DYNAMIC_DRAW;m=w=u=u=void 0;M=h.vertices;p=h.colors;t=M.length;o=p.length;z=h.__vertexArray;v=h.__colorArray;Y=h.__dirtyColors;if(h.__dirtyVertices){for(u=0;u<t;u++)w=M[u].position,m=u*3,z[m]=w.x,z[m+1]=w.y,z[m+2]=w.z;n.bindBuffer(n.ARRAY_BUFFER,h.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,z,l)}if(Y){for(u=0;u<o;u++)color=p[u],m=u*3,v[m]=color.r,v[m+1]=color.g,v[m+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,h.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,v,l)}}k.__dirtyVertices=!1;k.__dirtyColors=
|
|
|
|
-!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;l=n.DYNAMIC_DRAW;m=w=u=u=void 0;M=h.vertices;p=h.colors;t=M.length;o=p.length;z=h.__vertexArray;v=h.__colorArray;Y=h.__dirtyColors;if(h.__dirtyVertices){for(u=0;u<t;u++)w=M[u].position,m=u*3,z[m]=w.x,z[m+1]=w.y,z[m+2]=w.z;n.bindBuffer(n.ARRAY_BUFFER,h.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,z,l)}if(Y){for(u=0;u<o;u++)color=p[u],m=u*3,v[m]=color.r,v[m+1]=color.g,v[m+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,
|
|
|
|
-h.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,v,l)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,o=A(k,h),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||o)&&c(k,n.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,E(k,h)};this.setFaceCulling=function(a,c){a?(!c||c=="ccw"?n.frontFace(n.CCW):n.frontFace(n.CW),a=="back"?n.cullFace(n.BACK):a=="front"?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK),n.enable(n.CULL_FACE)):n.disable(n.CULL_FACE)};
|
|
|
|
-this.supportsVertexTextures=function(){return Ia}};
|
|
|
|
|
|
+h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,"#define MAX_SHADOWS "+b.maxShadows,b.alphaTest?"#define ALPHATEST "+b.alphaTest:"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",b.useFog&&b.fog?"#define USE_FOG":"",b.useFog&&b.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":
|
|
|
|
+"",b.lightMap?"#define USE_LIGHTMAP":"",b.vertexColors?"#define USE_COLOR":"",b.metal?"#define METAL":"",b.perPixel?"#define PHONG_PER_PIXEL":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.shadowMapSoft?"#define SHADOWMAP_WIDTH "+b.shadowMapWidth.toFixed(1):"",b.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+b.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");m.attachShader(w,P("fragment",h+p));m.attachShader(w,
|
|
|
|
+P("vertex",e+t));m.linkProgram(w);m.getProgramParameter(w,m.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(w,m.VALIDATE_STATUS)+", gl error ["+m.getError()+"]");w.uniforms={};w.attributes={};var G,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(G in n)e.push(G);G=e;e=0;for(n=G.length;e<n;e++)p=G[e],w.uniforms[p]=m.getUniformLocation(w,
|
|
|
|
+p);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(G=0;G<b.maxMorphTargets;G++)e.push("morphTarget"+G);for(u in c)e.push(u);u=e;G=0;for(c=u.length;G<c;G++)b=u[G],w.attributes[b]=m.getAttribLocation(w,b);w.id=aa.length;aa.push({program:w,code:l});S.info.memory.programs=aa.length;u=w}a.program=u;u=a.program.attributes;u.position>=0&&m.enableVertexAttribArray(u.position);u.color>=0&&m.enableVertexAttribArray(u.color);u.normal>=0&&m.enableVertexAttribArray(u.normal);
|
|
|
|
+u.tangent>=0&&m.enableVertexAttribArray(u.tangent);a.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(m.enableVertexAttribArray(u.skinVertexA),m.enableVertexAttribArray(u.skinVertexB),m.enableVertexAttribArray(u.skinIndex),m.enableVertexAttribArray(u.skinWeight));if(a.attributes)for(k in a.attributes)u[k]!==void 0&&u[k]>=0&&m.enableVertexAttribArray(u[k]);if(a.morphTargets)for(k=a.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)G="morphTarget"+k,u[G]>=0&&(m.enableVertexAttribArray(u[G]),
|
|
|
|
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,c,b,e){V(a);this.clear(c,b,e)};this.updateShadowMap=function(a,c){x(a,c)};this.render=function(a,c,b,G){var ma,$,z,C,B,I,K,E=a.lights,na=a.fog;da=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,c);S.info.render.calls=0;S.info.render.vertices=0;S.info.render.faces=0;if(c.matrixAutoUpdate){for(z=c;z.parent;)z=z.parent;z.update(void 0,!0)}a.update(void 0,!1,
|
|
|
|
+c);c.matrixWorldInverse.flattenToArray(Ea);c.projectionMatrix.flattenToArray(Da);sa.multiply(c.projectionMatrix,c.matrixWorldInverse);u(sa);this.initWebGLObjects(a);V(b);(this.autoClear||G)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);z=a.__webglObjects.length;for(G=0;G<z;G++)if(B=a.__webglObjects[G],I=B.object,I.visible)if(!(I instanceof THREE.Mesh)||!I.frustumCulled||t(I)){if(I.matrixWorld.flattenToArray(I._objectMatrixArray),A(I,c,!0),o(B),B.render=!0,this.sortObjects)B.object.renderDepth?
|
|
|
|
+B.z=B.object.renderDepth:(za.copy(I.position),sa.multiplyVector3(za),B.z=za.z)}else B.render=!1;else B.render=!1;this.sortObjects&&a.__webglObjects.sort(y);C=a.__webglObjectsImmediate.length;for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray),A(I,c,!0),v(B));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);F(a.overrideMaterial.blending);for(G=0;G<z;G++)if(B=a.__webglObjects[G],B.render)I=B.object,K=B.buffer,
|
|
|
|
+k(I),f(c,E,na,a.overrideMaterial,K,I);for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,k(I),ma=e(c,E,na,a.overrideMaterial,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(c){h(c,ma,a.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(G=z-1;G>=0;G--)if(B=a.__webglObjects[G],B.render&&(I=B.object,K=B.buffer,$=B.opaque))k(I),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),f(c,E,na,$,K,
|
|
|
|
+I);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,$=B.opaque))k(I),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(a){h(a,ma,$.shading)});for(G=0;G<z;G++)if(B=a.__webglObjects[G],B.render&&(I=B.object,K=B.buffer,$=B.transparent))k(I),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),
|
|
|
|
+f(c,E,na,$,K,I);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,$=B.transparent))k(I),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(a){h(a,ma,$.shading)})}a.__webglSprites.length&&w(a,c);b&&b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&H(b)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
|
|
|
|
+[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,k=void 0,h=void 0,l=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups==void 0){var l=h,n=void 0,p=void 0,t=void 0,o=void 0,
|
|
|
|
+v=t=void 0,u=void 0,G={},w=l.morphTargets!==void 0?l.morphTargets.length:0;l.geometryGroups={};n=0;for(p=l.faces.length;n<p;n++)t=l.faces[n],o=t.materialIndex,v=o!==void 0?o:-1,G[v]==void 0&&(G[v]={hash:v,counter:0}),u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]==void 0&&(l.geometryGroups[u]={faces:[],materialIndex:o,vertices:0,numMorphTargets:w}),t=t instanceof THREE.Face3?3:4,l.geometryGroups[u].vertices+t>65535&&(G[v].counter+=1,u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]==void 0&&(l.geometryGroups[u]=
|
|
|
|
+{faces:[],materialIndex:o,vertices:0,numMorphTargets:w})),l.geometryGroups[u].faces.push(n),l.geometryGroups[u].vertices+=t;l.geometryGroupsList=[];n=void 0;for(n in l.geometryGroups)l.geometryGroups[n].id=ha++,l.geometryGroupsList.push(l.geometryGroups[n])}for(k in h.geometryGroups)if(l=h.geometryGroups[k],!l.__webglVertexBuffer){n=l;n.__webglVertexBuffer=m.createBuffer();n.__webglNormalBuffer=m.createBuffer();n.__webglTangentBuffer=m.createBuffer();n.__webglColorBuffer=m.createBuffer();n.__webglUVBuffer=
|
|
|
|
+m.createBuffer();n.__webglUV2Buffer=m.createBuffer();n.__webglSkinVertexABuffer=m.createBuffer();n.__webglSkinVertexBBuffer=m.createBuffer();n.__webglSkinIndicesBuffer=m.createBuffer();n.__webglSkinWeightsBuffer=m.createBuffer();n.__webglFaceBuffer=m.createBuffer();n.__webglLineBuffer=m.createBuffer();if(n.numMorphTargets){o=p=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(o=n.numMorphTargets;p<o;p++)n.__webglMorphTargetsBuffers.push(m.createBuffer())}S.info.memory.geometries++;for(var o=e,x=t=G=
|
|
|
|
+void 0,v=x=w=x=void 0,u=v=n=0,y=t=void 0,ma=void 0,t=p=w=G=void 0,w=o.geometry,y=w.faces,ma=l.faces,G=0,t=ma.length;G<t;G++)x=ma[G],x=y[x],x instanceof THREE.Face3?(n+=3,v+=1,u+=3):x instanceof THREE.Face4&&(n+=4,v+=2,u+=4);G=b(o,l);t=G.map||G.lightMap||G instanceof THREE.ShaderMaterial?!0:!1;ma=G instanceof THREE.MeshBasicMaterial&&!G.envMap||G instanceof THREE.MeshDepthMaterial?!1:G&&G.shading!=void 0&&G.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;y=G.vertexColors?G.vertexColors:
|
|
|
|
+!1;l.__vertexArray=new Float32Array(n*3);if(ma)l.__normalArray=new Float32Array(n*3);if(w.hasTangents)l.__tangentArray=new Float32Array(n*4);if(y)l.__colorArray=new Float32Array(n*3);if(t){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)l.__uvArray=new Float32Array(n*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)l.__uv2Array=new Float32Array(n*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)l.__skinVertexAArray=new Float32Array(n*4),l.__skinVertexBArray=new Float32Array(n*
|
|
|
|
+4),l.__skinIndexArray=new Float32Array(n*4),l.__skinWeightArray=new Float32Array(n*4);l.__faceArray=new Uint16Array(v*3);l.__lineArray=new Uint16Array(u*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];w=0;for(x=l.numMorphTargets;w<x;w++)l.__morphTargetsArrays.push(new Float32Array(n*3))}l.__needsSmoothNormals=ma==THREE.SmoothShading;l.__uvType=t;l.__vertexColorType=y;l.__normalType=ma;l.__webglFaceCount=v*3;l.__webglLineCount=u*2;if(G.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=
|
|
|
|
+[];o=void 0;for(o in G.attributes){t=G.attributes[o];w={};for(p in t)w[p]=t[p];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,v=1,w.type==="v2"?v=2:w.type==="v3"?v=3:w.type==="v4"?v=4:w.type==="c"&&(v=3),w.size=v,w.array=new Float32Array(n*v),w.buffer=m.createBuffer(),w.buffer.belongsToAttribute=o,t.needsUpdate=!0,w.__original=t;l.__webglCustomAttributesList.push(w)}}l.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=
|
|
|
|
+!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)l=h,l.__webglVertexBuffer=m.createBuffer(),l.__webglColorBuffer=m.createBuffer(),S.info.memory.geometries++,l=h,n=l.vertices.length,l.__vertexArray=new Float32Array(n*3),l.__colorArray=new Float32Array(n*3),l.__webglVertexCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)l=h,l.__webglVertexBuffer=m.createBuffer(),
|
|
|
|
+l.__webglColorBuffer=m.createBuffer(),S.info.memory.geometries++,l=h,n=l.vertices.length,l.__vertexArray=new Float32Array(n*3),l.__colorArray=new Float32Array(n*3),l.__webglLineCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer)){l=h;l.__webglVertexBuffer=m.createBuffer();l.__webglColorBuffer=m.createBuffer();S.info.geometries++;l=h;p=e;n=l.vertices.length;l.__vertexArray=new Float32Array(n*3);l.__colorArray=new Float32Array(n*
|
|
|
|
+3);l.__sortArray=[];l.__webglParticleCount=n;p=p.material;if(p.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=[];o=void 0;for(o in p.attributes){originalAttribute=p.attributes[o];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:
|
|
|
|
+attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=m.createBuffer(),attribute.buffer.belongsToAttribute=o,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;l.__webglCustomAttributesList.push(attribute)}}h.__dirtyVertices=!0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(k in h=e.geometry,h.geometryGroups)l=h.geometryGroups[k],K(f.__webglObjects,l,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
|
|
|
|
+e instanceof THREE.ParticleSystem?(h=e.geometry,K(f.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)B(f.__webglObjects,
|
|
|
|
+e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;h=void 0;for(h=f.length-1;h>=0;h--)f[h]==k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&B(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(h=a.__webglObjects[e].object,o=l=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(p=k.geometryGroupsList.length;n<p;n++)if(l=k.geometryGroupsList[n],o=z(l,h),k.__dirtyVertices||k.__dirtyMorphTargets||
|
|
|
|
+k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||o)if(o=l,v=m.DYNAMIC_DRAW,u=!k.dynamic,o.__inittedArrays){var $=w=G=void 0,I=void 0,A=$=void 0,E=void 0,na=void 0,O=void 0,M=x=ma=y=t=void 0,H=void 0,F=void 0,fa=void 0,ta=void 0,N=I=O=I=na=E=void 0,L=void 0,J=L=N=E=void 0,D=void 0,J=L=N=$=$=A=L=N=I=J=L=N=D=J=L=N=D=J=L=N=void 0,R=0,P=0,qa=0,Y=0,la=0,pa=0,T=0,W=0,V=0,Q=0,U=0,X=J=0,X=void 0,ka=o.__vertexArray,ia=o.__uvArray,ua=o.__uv2Array,ya=o.__normalArray,aa=o.__tangentArray,
|
|
|
|
+da=o.__colorArray,ga=o.__skinVertexAArray,ea=o.__skinVertexBArray,Z=o.__skinIndexArray,ca=o.__skinWeightArray,ja=o.__morphTargetsArrays,oa=o.__webglCustomAttributesList,D=void 0,Ca=o.__faceArray,va=o.__lineArray,Ba=o.__needsSmoothNormals,y=o.__vertexColorType,t=o.__uvType,ma=o.__normalType,sa=h.geometry,Da=sa.__dirtyVertices,Ea=sa.__dirtyElements,za=sa.__dirtyUvs,Fa=sa.__dirtyNormals,xa=sa.__dirtyTangents,Ga=sa.__dirtyColors,Ta=sa.__dirtyMorphTargets,Pa=sa.vertices,bb=o.faces,eb=sa.faces,cb=sa.faceVertexUvs[0],
|
|
|
|
+db=sa.faceVertexUvs[1],Qa=sa.skinVerticesA,Ra=sa.skinVerticesB,Sa=sa.skinIndices,Ja=sa.skinWeights,Ia=sa.morphTargets;if(oa){N=0;for(L=oa.length;N<L;N++)oa[N].offset=0,oa[N].offsetSrc=0}G=0;for(w=bb.length;G<w;G++)if($=bb[G],I=eb[$],cb&&(x=cb[$]),db&&(M=db[$]),$=I.vertexNormals,A=I.normal,E=I.vertexColors,na=I.color,O=I.vertexTangents,I instanceof THREE.Face3){if(Da)H=Pa[I.a].position,F=Pa[I.b].position,fa=Pa[I.c].position,ka[P]=H.x,ka[P+1]=H.y,ka[P+2]=H.z,ka[P+3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+
|
|
|
|
+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,P+=9;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=D.offset,X=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[I.a],D.array[J+1]=D.value[I.b],D.array[J+2]=D.value[I.c]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.offsetSrc+=3),D.offset+=3):(D.boundTo===
|
|
|
|
+void 0||D.boundTo==="vertices"?(H=D.value[I.a],F=D.value[I.b],fa=D.value[I.c]):D.boundTo==="faces"?(fa=F=H=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(H=D.value[X],F=D.value[X+1],fa=D.value[X+2],D.offsetSrc+=3),D.size===2?(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.offset+=6):D.size===3?(D.type==="c"?(D.array[J]=H.r,D.array[J+1]=H.g,D.array[J+2]=H.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=F.b,D.array[J+6]=fa.r,D.array[J+
|
|
|
|
+7]=fa.g,D.array[J+8]=fa.b):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z),D.offset+=9):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=H.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=fa.y,D.array[J+10]=fa.z,D.array[J+11]=fa.w,D.offset+=12))}if(Ta){N=0;for(L=Ia.length;N<L;N++)H=Ia[N].vertices[I.a].position,F=Ia[N].vertices[I.b].position,
|
|
|
|
+fa=Ia[N].vertices[I.c].position,J=ja[N],J[U]=H.x,J[U+1]=H.y,J[U+2]=H.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z;U+=9}if(Ja.length)N=Ja[I.a],L=Ja[I.b],J=Ja[I.c],ca[Q]=N.x,ca[Q+1]=N.y,ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,N=Sa[I.a],L=Sa[I.b],J=Sa[I.c],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,Z[Q+10]=J.z,Z[Q+11]=J.w,N=Qa[I.a],
|
|
|
|
+L=Qa[I.b],J=Qa[I.c],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,N=Ra[I.a],L=Ra[I.b],J=Ra[I.c],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,Q+=12;if(Ga&&y)E.length==3&&y==THREE.VertexColors?(I=E[0],N=E[1],L=E[2]):L=N=I=na,da[V]=I.r,da[V+1]=I.g,da[V+2]=I.b,da[V+3]=N.r,da[V+4]=N.g,da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,
|
|
|
|
+da[V+8]=L.b,V+=9;if(xa&&sa.hasTangents)E=O[0],na=O[1],I=O[2],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=I.w,T+=12;if(Fa&&ma)if($.length==3&&Ba)for(N=0;N<3;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<3;N++)ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;if(za&&x!==void 0&&t)for(N=0;N<3;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&t)for(N=0;N<3;N++)$=M[N],ua[Y]=$.u,
|
|
|
|
+ua[Y+1]=$.v,Y+=2;Ea&&(Ca[la]=R,Ca[la+1]=R+1,Ca[la+2]=R+2,la+=3,va[W]=R,va[W+1]=R+1,va[W+2]=R,va[W+3]=R+2,va[W+4]=R+1,va[W+5]=R+2,W+=6,R+=3)}else if(I instanceof THREE.Face4){if(Da)H=Pa[I.a].position,F=Pa[I.b].position,fa=Pa[I.c].position,ta=Pa[I.d].position,ka[P]=H.x,ka[P+1]=H.y,ka[P+2]=H.z,ka[P+3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,ka[P+9]=ta.x,ka[P+10]=ta.y,ka[P+11]=ta.z,P+=12;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=D.offset,X=D.offsetSrc,
|
|
|
|
+D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[I.a],D.array[J+1]=D.value[I.b],D.array[J+2]=D.value[I.c],D.array[J+3]=D.value[I.d]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.array[J+3]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.array[J+3]=D.value[X+3],D.offsetSrc+=4),D.offset+=4):(D.boundTo===void 0||D.boundTo==="vertices"?(H=D.value[I.a],F=D.value[I.b],fa=
|
|
|
|
+D.value[I.c],ta=D.value[I.d]):D.boundTo==="faces"?(ta=fa=F=H=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(H=D.value[X],F=D.value[X+1],fa=D.value[X+2],ta=D.value[X+3],D.offsetSrc+=4),D.size===2?(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.array[J+6]=ta.x,D.array[J+7]=ta.y,D.offset+=8):D.size===3?(D.type==="c"?(D.array[J]=H.r,D.array[J+1]=H.g,D.array[J+2]=H.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=F.b,D.array[J+6]=fa.r,
|
|
|
|
+D.array[J+7]=fa.g,D.array[J+8]=fa.b,D.array[J+9]=ta.r,D.array[J+10]=ta.g,D.array[J+11]=ta.b):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z,D.array[J+9]=ta.x,D.array[J+10]=ta.y,D.array[J+11]=ta.z),D.offset+=12):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=H.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=fa.y,D.array[J+10]=
|
|
|
|
+fa.z,D.array[J+11]=fa.w,D.array[J+12]=ta.x,D.array[J+13]=ta.y,D.array[J+14]=ta.z,D.array[J+15]=ta.w,D.offset+=16))}if(Ta){N=0;for(L=Ia.length;N<L;N++)H=Ia[N].vertices[I.a].position,F=Ia[N].vertices[I.b].position,fa=Ia[N].vertices[I.c].position,ta=Ia[N].vertices[I.d].position,J=ja[N],J[U]=H.x,J[U+1]=H.y,J[U+2]=H.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z,J[U+9]=ta.x,J[U+10]=ta.y,J[U+11]=ta.z;U+=12}if(Ja.length)N=Ja[I.a],L=Ja[I.b],J=Ja[I.c],D=Ja[I.d],ca[Q]=N.x,ca[Q+1]=N.y,
|
|
|
|
+ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,ca[Q+12]=D.x,ca[Q+13]=D.y,ca[Q+14]=D.z,ca[Q+15]=D.w,N=Sa[I.a],L=Sa[I.b],J=Sa[I.c],D=Sa[I.d],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,Z[Q+10]=J.z,Z[Q+11]=J.w,Z[Q+12]=D.x,Z[Q+13]=D.y,Z[Q+14]=D.z,Z[Q+15]=D.w,N=Qa[I.a],L=Qa[I.b],J=Qa[I.c],D=Qa[I.d],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=L.x,ga[Q+5]=L.y,
|
|
|
|
+ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,ga[Q+12]=D.x,ga[Q+13]=D.y,ga[Q+14]=D.z,ga[Q+15]=1,N=Ra[I.a],L=Ra[I.b],J=Ra[I.c],I=Ra[I.d],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,ea[Q+12]=I.x,ea[Q+13]=I.y,ea[Q+14]=I.z,ea[Q+15]=1,Q+=16;if(Ga&&y)E.length==4&&y==THREE.VertexColors?(I=E[0],N=E[1],L=E[2],E=E[3]):E=L=N=I=na,da[V]=I.r,da[V+1]=I.g,da[V+2]=I.b,da[V+3]=N.r,da[V+4]=N.g,da[V+
|
|
|
|
+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,da[V+9]=E.r,da[V+10]=E.g,da[V+11]=E.b,V+=12;if(xa&&sa.hasTangents)E=O[0],na=O[1],I=O[2],O=O[3],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=I.w,aa[T+12]=O.x,aa[T+13]=O.y,aa[T+14]=O.z,aa[T+15]=O.w,T+=16;if(Fa&&ma)if($.length==4&&Ba)for(N=0;N<4;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<4;N++)ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=
|
|
|
|
+3;if(za&&x!==void 0&&t)for(N=0;N<4;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&t)for(N=0;N<4;N++)$=M[N],ua[Y]=$.u,ua[Y+1]=$.v,Y+=2;Ea&&(Ca[la]=R,Ca[la+1]=R+1,Ca[la+2]=R+3,Ca[la+3]=R+1,Ca[la+4]=R+2,Ca[la+5]=R+3,la+=6,va[W]=R,va[W+1]=R+1,va[W+2]=R,va[W+3]=R+3,va[W+4]=R+1,va[W+5]=R+2,va[W+6]=R+2,va[W+7]=R+3,W+=8,R+=4)}Da&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,ka,v));if(oa){N=0;for(L=oa.length;N<L;N++)D=oa[N],D.__original.needsUpdate&&(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
|
+D.buffer),m.bufferData(m.ARRAY_BUFFER,D.array,v))}if(Ta){N=0;for(L=Ia.length;N<L;N++)m.bindBuffer(m.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[N]),m.bufferData(m.ARRAY_BUFFER,ja[N],v)}Ga&&V>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,da,v));Fa&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglNormalBuffer),m.bufferData(m.ARRAY_BUFFER,ya,v));xa&&sa.hasTangents&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglTangentBuffer),m.bufferData(m.ARRAY_BUFFER,aa,v));za&&qa>0&&(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
|
+o.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,ia,v));za&&Y>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,ua,v));Ea&&(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,Ca,v),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,va,v));Q>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinVertexABuffer),m.bufferData(m.ARRAY_BUFFER,ga,v),m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinVertexBBuffer),
|
|
|
|
+m.bufferData(m.ARRAY_BUFFER,ea,v),m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,Z,v),m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,ca,v));u&&(delete o.__inittedArrays,delete o.__colorArray,delete o.__normalArray,delete o.__tangentArray,delete o.__uvArray,delete o.__uv2Array,delete o.__faceArray,delete o.__vertexArray,delete o.__lineArray,delete o.__skinVertexAArray,delete o.__skinVertexBArray,delete o.__skinIndexArray,delete o.__skinWeightArray)}k.__dirtyVertices=
|
|
|
|
+!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;C(l,h)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;l=m.DYNAMIC_DRAW;n=G=u=u=void 0;w=h.vertices;p=h.colors;t=w.length;o=p.length;y=h.__vertexArray;v=h.__colorArray;ma=h.__dirtyColors;if(h.__dirtyVertices){for(u=0;u<t;u++)G=w[u].position,n=u*3,y[n]=G.x,y[n+1]=G.y,y[n+2]=G.z;m.bindBuffer(m.ARRAY_BUFFER,h.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,
|
|
|
|
+y,l)}if(ma){for(u=0;u<o;u++)color=p[u],n=u*3,v[n]=color.r,v[n+1]=color.g,v[n+2]=color.b;m.bindBuffer(m.ARRAY_BUFFER,h.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,v,l)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;l=m.DYNAMIC_DRAW;n=G=u=u=void 0;w=h.vertices;p=h.colors;t=w.length;o=p.length;y=h.__vertexArray;v=h.__colorArray;ma=h.__dirtyColors;if(h.__dirtyVertices){for(u=0;u<t;u++)G=w[u].position,n=u*3,y[n]=G.x,
|
|
|
|
+y[n+1]=G.y,y[n+2]=G.z;m.bindBuffer(m.ARRAY_BUFFER,h.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,y,l)}if(ma){for(u=0;u<o;u++)color=p[u],n=u*3,v[n]=color.r,v[n+1]=color.g,v[n+2]=color.b;m.bindBuffer(m.ARRAY_BUFFER,h.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,v,l)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,o=z(k,h),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||o)&&c(k,m.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,C(k,
|
|
|
|
+h)};this.setFaceCulling=function(a,c){a?(!c||c=="ccw"?m.frontFace(m.CCW):m.frontFace(m.CW),a=="back"?m.cullFace(m.BACK):a=="front"?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),m.enable(m.CULL_FACE)):m.disable(m.CULL_FACE)};this.supportsVertexTextures=function(){return Ga}};
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
|
|
THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
|
|
THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
|
|
@@ -353,19 +352,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
|
|
THREE.ColorUtils={adjustHSV:function(a,b,c,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,f=a.b,h=Math.max(Math.max(c,e),f),k=Math.min(Math.min(c,e),f);if(k==h)k=c=0;else{var l=h-k,k=l/h,c=c==h?(e-f)/l:e==h?2+(f-c)/l:4+(c-e)/l;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=k;b.v=h;return b}};
|
|
THREE.ColorUtils={adjustHSV:function(a,b,c,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,f=a.b,h=Math.max(Math.max(c,e),f),k=Math.min(Math.min(c,e),f);if(k==h)k=c=0;else{var l=h-k,k=l/h,c=c==h?(e-f)/l:e==h?2+(f-c)/l:4+(c-e)/l;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=k;b.v=h;return b}};
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
-THREE.GeometryUtils={merge:function(a,b){for(var c,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,k=a.vertices,l=h.vertices,m=a.faces,t=h.faces,u=a.faceVertexUvs[0],p=h.faceVertexUvs[0],v={},o=0;o<a.materials.length;o++)v[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,e=new THREE.Matrix4,e.extractRotation(c,b.scale);for(var o=0,z=l.length;o<z;o++){var x=new THREE.Vertex(l[o].position.clone());c&&c.multiplyVector3(x.position);k.push(x)}o=
|
|
|
|
-0;for(z=t.length;o<z;o++){var k=t[o],w,B,y=k.vertexNormals,A=k.vertexColors;k instanceof THREE.Face3?w=new THREE.Face3(k.a+f,k.b+f,k.c+f):k instanceof THREE.Face4&&(w=new THREE.Face4(k.a+f,k.b+f,k.c+f,k.d+f));w.normal.copy(k.normal);e&&e.multiplyVector3(w.normal);l=0;for(x=y.length;l<x;l++)B=y[l].clone(),e&&e.multiplyVector3(B),w.vertexNormals.push(B);w.color.copy(k.color);l=0;for(x=A.length;l<x;l++)B=A[l],w.vertexColors.push(B.clone());if(k.materialIndex!==void 0){l=h.materials[k.materialIndex];
|
|
|
|
-x=v[l.id];if(x===void 0)x=a.materials.length,a.materials.push(l);w.materialIndex=x}w.centroid.copy(k.centroid);c&&c.multiplyVector3(w.centroid);m.push(w)}o=0;for(z=p.length;o<z;o++){c=p[o];e=[];l=0;for(x=c.length;l<x;l++)e.push(new THREE.UV(c[l].u,c[l].v));u.push(e)}},clone:function(a){var b=new THREE.Geometry,c,e=a.vertices,f=a.faces,h=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=e.length;a<c;a++){var k=new THREE.Vertex(e[a].position.clone());b.vertices.push(k)}a=0;
|
|
|
|
-for(c=f.length;a<c;a++){var l=f[a],m,t,u=l.vertexNormals,p=l.vertexColors;l instanceof THREE.Face3?m=new THREE.Face3(l.a,l.b,l.c):l instanceof THREE.Face4&&(m=new THREE.Face4(l.a,l.b,l.c,l.d));m.normal.copy(l.normal);e=0;for(k=u.length;e<k;e++)t=u[e],m.vertexNormals.push(t.clone());m.color.copy(l.color);e=0;for(k=p.length;e<k;e++)t=p[e],m.vertexColors.push(t.clone());m.materialIndex=l.materialIndex;m.centroid.copy(l.centroid);b.faces.push(m)}a=0;for(c=h.length;a<c;a++){f=h[a];m=[];e=0;for(k=f.length;e<
|
|
|
|
-k;e++)m.push(new THREE.UV(f[e].u,f[e].v));b.faceVertexUvs[0].push(m)}return b},randomPointInTriangle:function(a,b,c){var e,f,h,k=new THREE.Vector3,l=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();e+f>1&&(e=1-e,f=1-f);h=1-e-f;k.copy(a);k.multiplyScalar(e);l.copy(b);l.multiplyScalar(f);k.addSelf(l);l.copy(c);l.multiplyScalar(h);k.addSelf(l);return k},randomPointInFace:function(a,b,c){var e,f,h;if(a instanceof THREE.Face3)return e=b.vertices[a.a].position,f=b.vertices[a.b].position,
|
|
|
|
|
|
+THREE.GeometryUtils={merge:function(a,b){for(var c,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,k=a.vertices,l=h.vertices,n=a.faces,p=h.faces,u=a.faceVertexUvs[0],t=h.faceVertexUvs[0],v={},o=0;o<a.materials.length;o++)v[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,e=new THREE.Matrix4,e.extractRotation(c,b.scale);for(var o=0,y=l.length;o<y;o++){var x=new THREE.Vertex(l[o].position.clone());c&&c.multiplyVector3(x.position);k.push(x)}o=
|
|
|
|
+0;for(y=p.length;o<y;o++){var k=p[o],w,A,z=k.vertexNormals,C=k.vertexColors;k instanceof THREE.Face3?w=new THREE.Face3(k.a+f,k.b+f,k.c+f):k instanceof THREE.Face4&&(w=new THREE.Face4(k.a+f,k.b+f,k.c+f,k.d+f));w.normal.copy(k.normal);e&&e.multiplyVector3(w.normal);l=0;for(x=z.length;l<x;l++)A=z[l].clone(),e&&e.multiplyVector3(A),w.vertexNormals.push(A);w.color.copy(k.color);l=0;for(x=C.length;l<x;l++)A=C[l],w.vertexColors.push(A.clone());if(k.materialIndex!==void 0){l=h.materials[k.materialIndex];
|
|
|
|
+x=v[l.id];if(x===void 0)x=a.materials.length,a.materials.push(l);w.materialIndex=x}w.centroid.copy(k.centroid);c&&c.multiplyVector3(w.centroid);n.push(w)}o=0;for(y=t.length;o<y;o++){c=t[o];e=[];l=0;for(x=c.length;l<x;l++)e.push(new THREE.UV(c[l].u,c[l].v));u.push(e)}},clone:function(a){var b=new THREE.Geometry,c,e=a.vertices,f=a.faces,h=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=e.length;a<c;a++){var k=new THREE.Vertex(e[a].position.clone());b.vertices.push(k)}a=0;
|
|
|
|
+for(c=f.length;a<c;a++){var l=f[a],n,p,u=l.vertexNormals,t=l.vertexColors;l instanceof THREE.Face3?n=new THREE.Face3(l.a,l.b,l.c):l instanceof THREE.Face4&&(n=new THREE.Face4(l.a,l.b,l.c,l.d));n.normal.copy(l.normal);e=0;for(k=u.length;e<k;e++)p=u[e],n.vertexNormals.push(p.clone());n.color.copy(l.color);e=0;for(k=t.length;e<k;e++)p=t[e],n.vertexColors.push(p.clone());n.materialIndex=l.materialIndex;n.centroid.copy(l.centroid);b.faces.push(n)}a=0;for(c=h.length;a<c;a++){f=h[a];n=[];e=0;for(k=f.length;e<
|
|
|
|
+k;e++)n.push(new THREE.UV(f[e].u,f[e].v));b.faceVertexUvs[0].push(n)}return b},randomPointInTriangle:function(a,b,c){var e,f,h,k=new THREE.Vector3,l=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();e+f>1&&(e=1-e,f=1-f);h=1-e-f;k.copy(a);k.multiplyScalar(e);l.copy(b);l.multiplyScalar(f);k.addSelf(l);l.copy(c);l.multiplyScalar(h);k.addSelf(l);return k},randomPointInFace:function(a,b,c){var e,f,h;if(a instanceof THREE.Face3)return e=b.vertices[a.a].position,f=b.vertices[a.b].position,
|
|
h=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else if(a instanceof THREE.Face4){e=b.vertices[a.a].position;f=b.vertices[a.b].position;h=b.vertices[a.c].position;var b=b.vertices[a.d].position,k;c?a._area1&&a._area2?(c=a._area1,k=a._area2):(c=THREE.GeometryUtils.triangleArea(e,f,b),k=THREE.GeometryUtils.triangleArea(f,h,b),a._area1=c,a._area2=k):(c=THREE.GeometryUtils.triangleArea(e,f,b),k=THREE.GeometryUtils.triangleArea(f,h,b));return THREE.GeometryUtils.random()*(c+
|
|
h=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else if(a instanceof THREE.Face4){e=b.vertices[a.a].position;f=b.vertices[a.b].position;h=b.vertices[a.c].position;var b=b.vertices[a.d].position,k;c?a._area1&&a._area2?(c=a._area1,k=a._area2):(c=THREE.GeometryUtils.triangleArea(e,f,b),k=THREE.GeometryUtils.triangleArea(f,h,b),a._area1=c,a._area2=k):(c=THREE.GeometryUtils.triangleArea(e,f,b),k=THREE.GeometryUtils.triangleArea(f,h,b));return THREE.GeometryUtils.random()*(c+
|
|
-k)<c?THREE.GeometryUtils.randomPointInTriangle(e,f,b):THREE.GeometryUtils.randomPointInTriangle(f,h,b)}},randomPointsInGeometry:function(a,b){function c(a){function c(b,e){if(e<b)return b;var f=b+Math.floor((e-b)/2);return t[f]>a?c(b,f-1):t[f]<a?c(f+1,e):f}return c(0,t.length-1)}var e,f,h=a.faces,k=a.vertices,l=h.length,m=0,t=[],u,p,v,o;for(f=0;f<l;f++){e=h[f];if(e instanceof THREE.Face3)u=k[e.a].position,p=k[e.b].position,v=k[e.c].position,e._area=THREE.GeometryUtils.triangleArea(u,p,v);else if(e instanceof
|
|
|
|
-THREE.Face4)u=k[e.a].position,p=k[e.b].position,v=k[e.c].position,o=k[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(u,p,o),e._area2=THREE.GeometryUtils.triangleArea(p,v,o),e._area=e._area1+e._area2;m+=e._area;t[f]=m}e=[];k={};for(f=0;f<b;f++)l=THREE.GeometryUtils.random()*m,l=c(l),e[f]=THREE.GeometryUtils.randomPointInFace(h[l],a,!0),k[l]?k[l]+=1:k[l]=1;return e},triangleArea:function(a,b,c){var e,f=THREE.GeometryUtils.__v1;f.sub(a,b);e=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();
|
|
|
|
|
|
+k)<c?THREE.GeometryUtils.randomPointInTriangle(e,f,b):THREE.GeometryUtils.randomPointInTriangle(f,h,b)}},randomPointsInGeometry:function(a,b){function c(a){function c(b,e){if(e<b)return b;var f=b+Math.floor((e-b)/2);return p[f]>a?c(b,f-1):p[f]<a?c(f+1,e):f}return c(0,p.length-1)}var e,f,h=a.faces,k=a.vertices,l=h.length,n=0,p=[],u,t,v,o;for(f=0;f<l;f++){e=h[f];if(e instanceof THREE.Face3)u=k[e.a].position,t=k[e.b].position,v=k[e.c].position,e._area=THREE.GeometryUtils.triangleArea(u,t,v);else if(e instanceof
|
|
|
|
+THREE.Face4)u=k[e.a].position,t=k[e.b].position,v=k[e.c].position,o=k[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(u,t,o),e._area2=THREE.GeometryUtils.triangleArea(t,v,o),e._area=e._area1+e._area2;n+=e._area;p[f]=n}e=[];k={};for(f=0;f<b;f++)l=THREE.GeometryUtils.random()*n,l=c(l),e[f]=THREE.GeometryUtils.randomPointInFace(h[l],a,!0),k[l]?k[l]+=1:k[l]=1;return e},triangleArea:function(a,b,c){var e,f=THREE.GeometryUtils.__v1;f.sub(a,b);e=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();
|
|
b=0.5*(e+a+c);return Math.sqrt(b*(b-e)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
b=0.5*(e+a+c);return Math.sqrt(b*(b-e)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
THREE.ImageUtils={loadTexture:function(a,b,c){var e=new Image,f=new THREE.Texture(e,b);e.onload=function(){f.needsUpdate=!0;c&&c(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,b,c){var e,f=[],h=new THREE.Texture(f,b),b=f.loadCount=0;for(e=a.length;b<e;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)h.needsUpdate=!0;c&&c(this)},f[b].crossOrigin="",f[b].src=a[b];return h},getNormalMap:function(a,b){var c=function(a){var c=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
THREE.ImageUtils={loadTexture:function(a,b,c){var e=new Image,f=new THREE.Texture(e,b);e.onload=function(){f.needsUpdate=!0;c&&c(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,b,c){var e,f=[],h=new THREE.Texture(f,b),b=f.loadCount=0;for(e=a.length;b<e;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)h.needsUpdate=!0;c&&c(this)},f[b].crossOrigin="",f[b].src=a[b];return h},getNormalMap:function(a,b){var c=function(a){var c=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
-a[2]*a[2]);return[a[0]/c,a[1]/c,a[2]/c]};b|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var k=h.getContext("2d");k.drawImage(a,0,0);for(var l=k.getImageData(0,0,e,f).data,m=k.createImageData(e,f),t=m.data,u=0;u<e;u++)for(var p=1;p<f;p++){var v=p-1<0?f-1:p-1,o=(p+1)%f,z=u-1<0?e-1:u-1,x=(u+1)%e,w=[],B=[0,0,l[(p*e+u)*4]/255*b];w.push([-1,0,l[(p*e+z)*4]/255*b]);w.push([-1,-1,l[(v*e+z)*4]/255*b]);w.push([0,-1,l[(v*e+u)*4]/255*b]);w.push([1,-1,l[(v*e+x)*4]/255*b]);
|
|
|
|
-w.push([1,0,l[(p*e+x)*4]/255*b]);w.push([1,1,l[(o*e+x)*4]/255*b]);w.push([0,1,l[(o*e+u)*4]/255*b]);w.push([-1,1,l[(o*e+z)*4]/255*b]);v=[];z=w.length;for(o=0;o<z;o++){var x=w[o],y=w[(o+1)%z],x=[x[0]-B[0],x[1]-B[1],x[2]-B[2]],y=[y[0]-B[0],y[1]-B[1],y[2]-B[2]];v.push(c([x[1]*y[2]-x[2]*y[1],x[2]*y[0]-x[0]*y[2],x[0]*y[1]-x[1]*y[0]]))}w=[0,0,0];for(o=0;o<v.length;o++)w[0]+=v[o][0],w[1]+=v[o][1],w[2]+=v[o][2];w[0]/=v.length;w[1]/=v.length;w[2]/=v.length;B=(p*e+u)*4;t[B]=(w[0]+1)/2*255|0;t[B+1]=(w[1]+0.5)*
|
|
|
|
-255|0;t[B+2]=w[2]*255|0;t[B+3]=255}k.putImageData(m,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,e,f=a.children.length;for(e=0;e<f;e++)c=a.children[e],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,e=b.length,f=new THREE.Object3D;for(c=0;c<e;c++){var h=new THREE.Mesh(a,b[c]);f.add(h)}return f}};
|
|
|
|
|
|
+a[2]*a[2]);return[a[0]/c,a[1]/c,a[2]/c]};b|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var k=h.getContext("2d");k.drawImage(a,0,0);for(var l=k.getImageData(0,0,e,f).data,n=k.createImageData(e,f),p=n.data,u=0;u<e;u++)for(var t=1;t<f;t++){var v=t-1<0?f-1:t-1,o=(t+1)%f,y=u-1<0?e-1:u-1,x=(u+1)%e,w=[],A=[0,0,l[(t*e+u)*4]/255*b];w.push([-1,0,l[(t*e+y)*4]/255*b]);w.push([-1,-1,l[(v*e+y)*4]/255*b]);w.push([0,-1,l[(v*e+u)*4]/255*b]);w.push([1,-1,l[(v*e+x)*4]/255*b]);
|
|
|
|
+w.push([1,0,l[(t*e+x)*4]/255*b]);w.push([1,1,l[(o*e+x)*4]/255*b]);w.push([0,1,l[(o*e+u)*4]/255*b]);w.push([-1,1,l[(o*e+y)*4]/255*b]);v=[];y=w.length;for(o=0;o<y;o++){var x=w[o],z=w[(o+1)%y],x=[x[0]-A[0],x[1]-A[1],x[2]-A[2]],z=[z[0]-A[0],z[1]-A[1],z[2]-A[2]];v.push(c([x[1]*z[2]-x[2]*z[1],x[2]*z[0]-x[0]*z[2],x[0]*z[1]-x[1]*z[0]]))}w=[0,0,0];for(o=0;o<v.length;o++)w[0]+=v[o][0],w[1]+=v[o][1],w[2]+=v[o][2];w[0]/=v.length;w[1]/=v.length;w[2]/=v.length;A=(t*e+u)*4;p[A]=(w[0]+1)/2*255|0;p[A+1]=(w[1]+0.5)*
|
|
|
|
+255|0;p[A+2]=w[2]*255|0;p[A+3]=255}k.putImageData(n,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,e,f=a.children.length;for(e=0;e<f;e++)c=a.children[e],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,e=b.length,f=new THREE.Object3D;for(c=0;c<e;c++){var h=new THREE.Mesh(a,b[c]);f.add(h)}return f}};
|
|
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
|
|
@@ -376,7 +375,7 @@ THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelV
|
|
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
|
|
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
|
|
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=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=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var b=[],c,e=this.getPoint(0),f,h=0;b.push(0);for(f=1;f<=a;f++)c=this.getPoint(f/a),h+=c.distanceTo(e),b.push(h),e=c;return this.cacheArcLengths=b};
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var b=[],c,e=this.getPoint(0),f,h=0;b.push(0);for(f=1;f<=a;f++)c=this.getPoint(f/a),h+=c.distanceTo(e),b.push(h),e=c;return this.cacheArcLengths=b};
|
|
-THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),e=0,f=c.length,h;h=b?b:a*c[f-1];time=Date.now();for(var k=0,l=f-1,m;k<=l;)if(e=Math.floor(k+(l-k)/2),m=c[e]-h,m<0)k=e+1;else if(m>0)l=e-1;else{l=e;break}e=l;if(c[e]==h)return e/(f-1);k=c[e];return c=(e+(h-k)/(c[e+1]-k))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
|
|
|
|
+THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),e=0,f=c.length,h;h=b?b:a*c[f-1];time=Date.now();for(var k=0,l=f-1,n;k<=l;)if(e=Math.floor(k+(l-k)/2),n=c[e]-h,n<0)k=e+1;else if(n>0)l=e-1;else{l=e;break}e=l;if(c[e]==h)return e/(f-1);k=c[e];return c=(e+(h-k)/(c[e+1]-k))/(f-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+=1.0E-4;b<0&&(b=0);a>1&&(a=1);var b=this.getPoint(b),a=this.getPoint(a),c=new THREE.Vector2;c.sub(a,b);return c.unit()};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,e){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,e))};THREE.LineCurve.prototype=new THREE.Curve;
|
|
THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4;a+=1.0E-4;b<0&&(b=0);a>1&&(a=1);var b=this.getPoint(b),a=this.getPoint(a),c=new THREE.Vector2;c.sub(a,b);return c.unit()};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,e){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,e))};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.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 e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),b=new THREE.Vector2(e[2],e[3]),c=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
|
|
THREE.QuadraticBezierCurve=function(a,b,c){if(!(b instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),b=new THREE.Vector2(e[2],e[3]),c=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
|
|
@@ -394,47 +393,47 @@ THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var
|
|
THREE.CurvePath=function(){this.curves=[];this.bends=[]};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(){};
|
|
THREE.CurvePath=function(){this.curves=[];this.bends=[]};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(){};
|
|
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.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,e=this.curves.length;for(c=0;c<e;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
|
|
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,e=this.curves.length;for(c=0;c<e;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
|
|
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,e,f;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,k,l,m;m=new THREE.Vector2;k=0;for(l=a.length;k<l;k++){h=a[k];if(h.x>b)b=h.x;else if(h.x<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<c)f=h.y;m.addSelf(h.x,h.y)}return{minX:e,minY:f,maxX:b,maxY:c,centroid:m.divideScalar(l)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
|
|
|
|
|
|
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,e,f;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,k,l,n;n=new THREE.Vector2;k=0;for(l=a.length;k<l;k++){h=a[k];if(h.x>b)b=h.x;else if(h.x<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<c)f=h.y;n.addSelf(h.x,h.y)}return{minX:e,minY:f,maxX:b,maxY:c,centroid:n.divideScalar(l)}};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.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),e,f;if(!b)b=this.bends;e=0;for(f=b.length;e<f;e++)c=this.getWrapPoints(c,b[e]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),e,f;if(!b)b=this.bends;e=0;for(f=b.length;e<f;e++)c=this.getWrapPoints(c,b[e]);return c};
|
|
THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),e,f;if(!b)b=this.bends;e=0;for(f=b.length;e<f;e++)c=this.getWrapPoints(c,b[e]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),e,f;if(!b)b=this.bends;e=0;for(f=b.length;e<f;e++)c=this.getWrapPoints(c,b[e]);return c};
|
|
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),e,f,h,k,l,m;e=0;for(f=a.length;e<f;e++)h=a[e],k=h.x,l=h.y,m=k/c.maxX,m=b.getUtoTmapping(m,k),k=b.getPoint(m),l=b.getNormalVector(m).multiplyScalar(l),h.x=k.x+l.x,h.y=k.y+l.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
|
|
|
|
|
|
+THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),e,f,h,k,l,n;e=0;for(f=a.length;e<f;e++)h=a[e],k=h.x,l=h.y,n=k/c.maxX,n=b.getUtoTmapping(n,k),k=b.getPoint(n),l=b.getNormalVector(n).multiplyScalar(l),h.x=k.x+l.x,h.y=k.y+l.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
|
|
THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var b,c=a.length;for(b=1;b<c;b++)this.lineTo(a[b].x,a[b].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
|
|
THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var b,c=a.length;for(b=1;b<c;b++)this.lineTo(a[b].x,a[b].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
|
|
THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,b)));this.actions.push({action:THREE.PathActions.LINE_TO,args:c})};
|
|
THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,b)));this.actions.push({action:THREE.PathActions.LINE_TO,args:c})};
|
|
THREE.Path.prototype.quadraticCurveTo=function(a,b,c,e){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,e)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f})};
|
|
THREE.Path.prototype.quadraticCurveTo=function(a,b,c,e){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,e)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f})};
|
|
THREE.Path.prototype.bezierCurveTo=function(a,b,c,e,f,h){var k=Array.prototype.slice.call(arguments),l=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(l[l.length-2],l[l.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,e),new THREE.Vector2(f,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:k})};
|
|
THREE.Path.prototype.bezierCurveTo=function(a,b,c,e,f,h){var k=Array.prototype.slice.call(arguments),l=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(l[l.length-2],l[l.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,e),new THREE.Vector2(f,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:k})};
|
|
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.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,e,f,h){var k=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,e,f,h));this.actions.push({action:THREE.PathActions.ARC,args:k})};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.arc=function(a,b,c,e,f,h){var k=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,e,f,h));this.actions.push({action:THREE.PathActions.ARC,args:k})};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=[],e,f,h,k,l,m,t,u,p,v,o,z,x;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],k=h.action,h=h.args,k){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:l=h[2];m=h[3];p=h[0];v=h[1];c.length>0?(k=c[c.length-1],o=k.x,z=k.y):(k=this.actions[e-1].args,o=k[k.length-2],z=k[k.length-1]);for(k=1;k<=a;k++)x=k/a,h=THREE.Shape.Utils.b2(x,o,p,l),x=THREE.Shape.Utils.b2(x,z,v,
|
|
|
|
-m),c.push(new THREE.Vector2(h,x));break;case THREE.PathActions.BEZIER_CURVE_TO:l=h[4];m=h[5];p=h[0];v=h[1];t=h[2];u=h[3];c.length>0?(k=c[c.length-1],o=k.x,z=k.y):(k=this.actions[e-1].args,o=k[k.length-2],z=k[k.length-1]);for(k=1;k<=a;k++)x=k/a,h=THREE.Shape.Utils.b3(x,o,p,t,l),x=THREE.Shape.Utils.b3(x,z,v,u,m),c.push(new THREE.Vector2(h,x));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[e-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];x=a*h[0].length;k=k.concat(h[0]);h=new THREE.SplineCurve(k);
|
|
|
|
-for(k=1;k<=x;k++)c.push(h.getPointAt(k/x));break;case THREE.PathActions.ARC:k=this.actions[e-1].args;l=h[0];m=h[1];t=h[2];p=h[3];x=h[4];v=!!h[5];u=k[k.length-2];o=k[k.length-1];k.length==0&&(u=o=0);z=x-p;var w=a*2;for(k=1;k<=w;k++)x=k/w,v||(x=1-x),x=p+x*z,h=u+l+t*Math.cos(x),x=o+m+t*Math.sin(x),c.push(new THREE.Vector2(h,x))}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,e,f,h){var k=this.getPoints(),l,m,t,u,p;l=0;for(m=k.length;l<m;l++)t=k[l],u=t.x,p=t.y,t.x=a*u+b*p+c,t.y=e*p+f*u+h;return k};
|
|
|
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],e,f,h,k,l,n,p,u,t,v,o,y,x;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],k=h.action,h=h.args,k){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:l=h[2];n=h[3];t=h[0];v=h[1];c.length>0?(k=c[c.length-1],o=k.x,y=k.y):(k=this.actions[e-1].args,o=k[k.length-2],y=k[k.length-1]);for(k=1;k<=a;k++)x=k/a,h=THREE.Shape.Utils.b2(x,o,t,l),x=THREE.Shape.Utils.b2(x,y,v,
|
|
|
|
+n),c.push(new THREE.Vector2(h,x));break;case THREE.PathActions.BEZIER_CURVE_TO:l=h[4];n=h[5];t=h[0];v=h[1];p=h[2];u=h[3];c.length>0?(k=c[c.length-1],o=k.x,y=k.y):(k=this.actions[e-1].args,o=k[k.length-2],y=k[k.length-1]);for(k=1;k<=a;k++)x=k/a,h=THREE.Shape.Utils.b3(x,o,t,p,l),x=THREE.Shape.Utils.b3(x,y,v,u,n),c.push(new THREE.Vector2(h,x));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[e-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];x=a*h[0].length;k=k.concat(h[0]);h=new THREE.SplineCurve(k);
|
|
|
|
+for(k=1;k<=x;k++)c.push(h.getPointAt(k/x));break;case THREE.PathActions.ARC:k=this.actions[e-1].args;l=h[0];n=h[1];p=h[2];t=h[3];x=h[4];v=!!h[5];u=k[k.length-2];o=k[k.length-1];k.length==0&&(u=o=0);y=x-t;var w=a*2;for(k=1;k<=w;k++)x=k/w,v||(x=1-x),x=t+x*y,h=u+l+p*Math.cos(x),x=o+n+p*Math.sin(x),c.push(new THREE.Vector2(h,x))}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,e,f,h){var k=this.getPoints(),l,n,p,u,t;l=0;for(n=k.length;l<n;l++)p=k[l],u=p.x,t=p.y,p.x=a*u+b*t+c,p.y=e*t+f*u+h;return k};
|
|
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,e,f,a=0;for(c=this.actions.length;a<c;a++)e=this.actions[a],f=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&b[e].apply(b,f);b.stroke();b.closePath();b.strokeStyle="red";e=
|
|
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,e,f,a=0;for(c=this.actions.length;a<c;a++)e=this.actions[a],f=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&b[e].apply(b,f);b.stroke();b.closePath();b.strokeStyle="red";e=
|
|
this.getPoints();a=0;for(c=e.length;a<c;a++)f=e[a],b.beginPath(),b.arc(f.x,f.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
|
|
this.getPoints();a=0;for(c=e.length;a<c;a++)f=e[a],b.beginPath(),b.arc(f.x,f.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
|
|
THREE.Path.prototype.toShapes=function(){var a,b,c,e,f=[],h=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],e=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(f.push(h),h=new THREE.Path),h[c].apply(h,e);h.actions.length!=0&&f.push(h);if(f.length==0)return[];var k,h=[];if(THREE.Shape.Utils.isClockWise(f[0].getPoints())){a=0;for(b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(k&&h.push(k),k=new THREE.Shape,k.actions=e.actions,k.curves=
|
|
THREE.Path.prototype.toShapes=function(){var a,b,c,e,f=[],h=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],e=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(f.push(h),h=new THREE.Path),h[c].apply(h,e);h.actions.length!=0&&f.push(h);if(f.length==0)return[];var k,h=[];if(THREE.Shape.Utils.isClockWise(f[0].getPoints())){a=0;for(b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(k&&h.push(k),k=new THREE.Shape,k.actions=e.actions,k.curves=
|
|
e.curves):k.holes.push(e);h.push(k)}else{k=new THREE.Shape;a=0;for(b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(k.actions=e.actions,k.curves=e.curves,h.push(k),k=new THREE.Shape):k.holes.push(e)}return h};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)};
|
|
e.curves):k.holes.push(e);h.push(k)}else{k=new THREE.Shape;a=0;for(b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(k.actions=e.actions,k.curves=e.curves,h.push(k),k=new THREE.Shape):k.holes.push(e)}return h};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,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return e};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.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),e=c.concat(),f,h,k,l,m,t,u,p,v,o,z=[];for(m=0;m<b.length;m++){t=b[m];Array.prototype.push.apply(e,t);h=Number.POSITIVE_INFINITY;for(f=0;f<t.length;f++){v=t[f];o=[];for(p=0;p<c.length;p++)u=c[p],u=v.distanceToSquared(u),o.push(u),u<h&&(h=u,k=f,l=p)}f=l-1>=0?l-1:c.length-1;h=k-1>=0?k-1:t.length-1;var x=[t[k],c[l],c[f]];p=THREE.FontUtils.Triangulate.area(x);var w=[t[k],t[h],c[l]];v=THREE.FontUtils.Triangulate.area(w);o=l;u=k;l+=1;k+=-1;l<
|
|
|
|
-0&&(l+=c.length);l%=c.length;k<0&&(k+=t.length);k%=t.length;f=l-1>=0?l-1:c.length-1;h=k-1>=0?k-1:t.length-1;x=[t[k],c[l],c[f]];x=THREE.FontUtils.Triangulate.area(x);w=[t[k],t[h],c[l]];w=THREE.FontUtils.Triangulate.area(w);p+v>x+w&&(l=o,k=u,l<0&&(l+=c.length),l%=c.length,k<0&&(k+=t.length),k%=t.length,f=l-1>=0?l-1:c.length-1,h=k-1>=0?k-1:t.length-1);p=c.slice(0,l);v=c.slice(l);o=t.slice(k);u=t.slice(0,k);h=[t[k],t[h],c[l]];z.push([t[k],c[l],c[f]]);z.push(h);c=p.concat(o).concat(u).concat(v)}return{shape:c,
|
|
|
|
-isolatedPts:z,allpoints:e}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),e=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,k,l,m,t={};h=0;for(k=e.length;h<k;h++)m=e[h].x+":"+e[h].y,t[m]!==void 0&&console.log("Duplicate point",m),t[m]=h;h=0;for(k=c.length;h<k;h++){l=c[h];for(e=0;e<3;e++)m=l[e].x+":"+l[e].y,m=t[m],m!==void 0&&(l[e]=m)}h=0;for(k=f.length;h<k;h++){l=f[h];for(e=0;e<3;e++)m=l[e].x+":"+l[e].y,m=t[m],m!==void 0&&(l[e]=m)}return c.concat(f)},
|
|
|
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),e=c.concat(),f,h,k,l,n,p,u,t,v,o,y=[];for(n=0;n<b.length;n++){p=b[n];Array.prototype.push.apply(e,p);h=Number.POSITIVE_INFINITY;for(f=0;f<p.length;f++){v=p[f];o=[];for(t=0;t<c.length;t++)u=c[t],u=v.distanceToSquared(u),o.push(u),u<h&&(h=u,k=f,l=t)}f=l-1>=0?l-1:c.length-1;h=k-1>=0?k-1:p.length-1;var x=[p[k],c[l],c[f]];t=THREE.FontUtils.Triangulate.area(x);var w=[p[k],p[h],c[l]];v=THREE.FontUtils.Triangulate.area(w);o=l;u=k;l+=1;k+=-1;l<
|
|
|
|
+0&&(l+=c.length);l%=c.length;k<0&&(k+=p.length);k%=p.length;f=l-1>=0?l-1:c.length-1;h=k-1>=0?k-1:p.length-1;x=[p[k],c[l],c[f]];x=THREE.FontUtils.Triangulate.area(x);w=[p[k],p[h],c[l]];w=THREE.FontUtils.Triangulate.area(w);t+v>x+w&&(l=o,k=u,l<0&&(l+=c.length),l%=c.length,k<0&&(k+=p.length),k%=p.length,f=l-1>=0?l-1:c.length-1,h=k-1>=0?k-1:p.length-1);t=c.slice(0,l);v=c.slice(l);o=p.slice(k);u=p.slice(0,k);h=[p[k],p[h],c[l]];y.push([p[k],c[l],c[f]]);y.push(h);c=t.concat(o).concat(u).concat(v)}return{shape:c,
|
|
|
|
+isolatedPts:y,allpoints:e}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),e=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,k,l,n,p={};h=0;for(k=e.length;h<k;h++)n=e[h].x+":"+e[h].y,p[n]!==void 0&&console.log("Duplicate point",n),p[n]=h;h=0;for(k=c.length;h<k;h++){l=c[h];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=p[n],n!==void 0&&(l[e]=n)}h=0;for(k=f.length;h<k;h++){l=f[h];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=p[n],n!==void 0&&(l[e]=n)}return c.concat(f)},
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,e){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,e)},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,e,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,e)+
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,e){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,e)},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,e,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,e)+
|
|
this.b3p3(a,f)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,e=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",h=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=e;THREE.FontUtils.weight=f;THREE.FontUtils.style=h};
|
|
this.b3p3(a,f)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,e=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",h=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=e;THREE.FontUtils.weight=f;THREE.FontUtils.style=h};
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,e=a.length;c<e;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,e=a.length;c<e;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
|
|
THREE.AnimationHandler=function(){var a=[],b={},c={update:function(c){for(var b=0;b<a.length;b++)a[b].update(c)},addToUpdate:function(c){a.indexOf(c)===-1&&a.push(c)},removeFromUpdate:function(c){c=a.indexOf(c);c!==-1&&a.splice(c,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var e=0;e<a.hierarchy[c].keys.length;e++){if(a.hierarchy[c].keys[e].time<
|
|
THREE.AnimationHandler=function(){var a=[],b={},c={update:function(c){for(var b=0;b<a.length;b++)a[b].update(c)},addToUpdate:function(c){a.indexOf(c)===-1&&a.push(c)},removeFromUpdate:function(c){c=a.indexOf(c);c!==-1&&a.splice(c,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var e=0;e<a.hierarchy[c].keys.length;e++){if(a.hierarchy[c].keys[e].time<
|
|
-0)a.hierarchy[c].keys[e].time=0;if(a.hierarchy[c].keys[e].rot!==void 0&&!(a.hierarchy[c].keys[e].rot instanceof THREE.Quaternion)){var l=a.hierarchy[c].keys[e].rot;a.hierarchy[c].keys[e].rot=new THREE.Quaternion(l[0],l[1],l[2],l[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){l={};for(e=0;e<a.hierarchy[c].keys.length;e++)for(var m=0;m<a.hierarchy[c].keys[e].morphTargets.length;m++){var t=a.hierarchy[c].keys[e].morphTargets[m];l[t]=-1}a.hierarchy[c].usedMorphTargets=l;for(e=0;e<a.hierarchy[c].keys.length;e++){var u=
|
|
|
|
-{};for(t in l){for(m=0;m<a.hierarchy[c].keys[e].morphTargets.length;m++)if(a.hierarchy[c].keys[e].morphTargets[m]===t){u[t]=a.hierarchy[c].keys[e].morphTargetsInfluences[m];break}m===a.hierarchy[c].keys[e].morphTargets.length&&(u[t]=0)}a.hierarchy[c].keys[e].morphTargetsInfluences=u}}for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].time===a.hierarchy[c].keys[e-1].time&&(a.hierarchy[c].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].index=e}e=parseInt(a.length*
|
|
|
|
|
|
+0)a.hierarchy[c].keys[e].time=0;if(a.hierarchy[c].keys[e].rot!==void 0&&!(a.hierarchy[c].keys[e].rot instanceof THREE.Quaternion)){var l=a.hierarchy[c].keys[e].rot;a.hierarchy[c].keys[e].rot=new THREE.Quaternion(l[0],l[1],l[2],l[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){l={};for(e=0;e<a.hierarchy[c].keys.length;e++)for(var n=0;n<a.hierarchy[c].keys[e].morphTargets.length;n++){var p=a.hierarchy[c].keys[e].morphTargets[n];l[p]=-1}a.hierarchy[c].usedMorphTargets=l;for(e=0;e<a.hierarchy[c].keys.length;e++){var u=
|
|
|
|
+{};for(p in l){for(n=0;n<a.hierarchy[c].keys[e].morphTargets.length;n++)if(a.hierarchy[c].keys[e].morphTargets[n]===p){u[p]=a.hierarchy[c].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[c].keys[e].morphTargets.length&&(u[p]=0)}a.hierarchy[c].keys[e].morphTargetsInfluences=u}}for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].time===a.hierarchy[c].keys[e-1].time&&(a.hierarchy[c].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].index=e}e=parseInt(a.length*
|
|
a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var c=[];if(a instanceof THREE.SkinnedMesh)for(var b=0;b<a.bones.length;b++)c.push(a.bones[b]);else e(a,c);return c}},e=function(a,c){c.push(a);for(var b=0;b<a.children.length;b++)e(a.children[b],c)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
|
|
a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var c=[];if(a instanceof THREE.SkinnedMesh)for(var b=0;b<a.bones.length;b++)c.push(a.bones[b]);else e(a,c);return c}},e=function(a,c){c.push(a);for(var b=0;b<a.children.length;b++)e(a.children[b],c)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
|
|
2;return c}();THREE.Animation=function(a,b,c,e){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=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
|
|
2;return c}();THREE.Animation=function(a,b,c,e){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=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
|
|
THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,e=this.hierarchy.length,f;for(c=0;c<e;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
|
|
THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,e=this.hierarchy.length,f;for(c=0;c<e;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
|
|
THREE.Bone?f.skinMatrix:f.matrix;var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
THREE.Bone?f.skinMatrix:f.matrix;var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.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.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(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,f,h,k,l,m,t,u=this.data.JIT.hierarchy,p,v;this.currentTime+=a*this.timeScale;v=this.currentTime;p=this.currentTime%=this.data.length;t=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,z=this.hierarchy.length;o<z;o++)if(a=this.hierarchy[o],m=a.animationCache,this.JITCompile&&u[o][t]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=u[o][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
|
-!1):(a.matrix=u[o][t],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 x=0;x<3;x++){c=b[x];k=m.prevKey[c];l=m.nextKey[c];if(l.time<=v){if(p<v)if(this.loop){k=this.data.hierarchy[o].keys[0];for(l=this.getNextKeyWith(c,o,1);l.time<p;)k=l,l=this.getNextKeyWith(c,o,l.index+1)}else{this.stop();return}else{do k=l,l=this.getNextKeyWith(c,o,l.index+1);while(l.time<
|
|
|
|
-p)}m.prevKey[c]=k;m.nextKey[c]=l}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(p-k.time)/(l.time-k.time);f=k[c];h=l[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e;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,e,f,h,k,l,n,p,u=this.data.JIT.hierarchy,t,v;this.currentTime+=a*this.timeScale;v=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,y=this.hierarchy.length;o<y;o++)if(a=this.hierarchy[o],n=a.animationCache,this.JITCompile&&u[o][p]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=u[o][p],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
|
+!1):(a.matrix=u[o][p],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 x=0;x<3;x++){c=b[x];k=n.prevKey[c];l=n.nextKey[c];if(l.time<=v){if(t<v)if(this.loop){k=this.data.hierarchy[o].keys[0];for(l=this.getNextKeyWith(c,o,1);l.time<t;)k=l,l=this.getNextKeyWith(c,o,l.index+1)}else{this.stop();return}else{do k=l,l=this.getNextKeyWith(c,o,l.index+1);while(l.time<
|
|
|
|
+t)}n.prevKey[c]=k;n.nextKey[c]=l}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(t-k.time)/(l.time-k.time);f=k[c];h=l[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
this.getPrevKeyWith("pos",o,k.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",o,l.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(c===
|
|
this.getPrevKeyWith("pos",o,k.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",o,l.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(c===
|
|
-"rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&u[0][t]===void 0){this.hierarchy[0].update(void 0,!0);for(o=0;o<this.hierarchy.length;o++)u[o][t]=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=[],e=[],f,h,k,l,m,t;f=(a.length-1)*b;h=Math.floor(f);f-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];l=a[c[1]];m=a[c[2]];t=a[c[3]];c=f*f;k=f*c;e[0]=this.interpolate(h[0],l[0],m[0],t[0],f,c,k);e[1]=this.interpolate(h[1],l[1],m[1],t[1],f,c,k);e[2]=this.interpolate(h[2],l[2],m[2],t[2],f,c,k);return e};
|
|
|
|
|
|
+"rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&u[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(o=0;o<this.hierarchy.length;o++)u[o][p]=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=[],e=[],f,h,k,l,n,p;f=(a.length-1)*b;h=Math.floor(f);f-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];l=a[c[1]];n=a[c[2]];p=a[c[3]];c=f*f;k=f*c;e[0]=this.interpolate(h[0],l[0],n[0],p[0],f,c,k);e[1]=this.interpolate(h[1],l[1],n[1],p[1],f,c,k);e[2]=this.interpolate(h[2],l[2],n[2],p[2],f,c,k);return e};
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,e,f,h,k){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*k+(-3*(b-c)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,e,f,h,k){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*k+(-3*(b-c)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
|
|
THREE.CubeCamera=function(a,b,c,e){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=
|
|
THREE.CubeCamera=function(a,b,c,e){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=
|
|
@@ -453,7 +452,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
|
|
this.moveUp&&this.object.translateY(c);this.moveDown&&this.object.translateY(-c);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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 a=this.target,b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
|
|
this.moveUp&&this.object.translateY(c);this.moveDown&&this.object.translateY(-c);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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 a=this.target,b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
|
|
(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*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;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta);
|
|
(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*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;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta);
|
|
this.object.lookAt(a)};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)};
|
|
this.object.lookAt(a)};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){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,c){return function(){c.apply(a,arguments)}}function f(a,c,b,e){var k={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),l=c.getLength(),w=f.length,B=0;h=w-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<w-1;h++)B=e*l.chunks[h]/l.total,c.keys[h]={time:B,pos:f[h]};k.hierarchy[0]=
|
|
|
|
|
|
+THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,c){return function(){c.apply(a,arguments)}}function f(a,c,b,e){var k={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),l=c.getLength(),w=f.length,A=0;h=w-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<w-1;h++)A=e*l.chunks[h]/l.total,c.keys[h]={time:A,pos:f[h]};k.hierarchy[0]=
|
|
c;THREE.AnimationHandler.add(k);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,c){var b,e,h=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),h.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return h}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
|
|
c;THREE.AnimationHandler.add(k);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,c){var b,e,h=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),h.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return h}this.object=a;this.domElement=b!==void 0?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=
|
|
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 k=Math.PI*2,l=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)*l;this.theta=this.lon*l;a=this.phi%k;this.phi=a>=0?a:a+k;b=this.verticalAngleMap.srcRange;
|
|
this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var k=Math.PI*2,l=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)*l;this.theta=this.lon*l;a=this.phi%k;this.phi=a>=0?a:a+k;b=this.verticalAngleMap.srcRange;
|
|
@@ -471,199 +470,200 @@ THREE.FlyControls=function(a,b){function c(a,c){return function(){c.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.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.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()};
|
|
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=b!==void 0?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,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Matrix4,k=!1,l=1,m=0,t=0,u=0,p=0,v=0,o=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
|
|
|
|
-this.rotateHorizontally(b*p);this.rotateVertically(b*v)}b=a*this.movementSpeed;this.object.translateZ(-b*(m>0||this.autoForward&&!(m<0)?1:m));this.object.translateX(b*t);this.object.translateY(b*u);k&&(this.roll+=this.rollSpeed*a*l);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();f.copy(this.forward);e.set(0,1,0);c.cross(e,
|
|
|
|
|
|
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?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,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Matrix4,k=!1,l=1,n=0,p=0,u=0,t=0,v=0,o=window.innerWidth/2,y=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
|
|
|
|
+this.rotateHorizontally(b*t);this.rotateVertically(b*v)}b=a*this.movementSpeed;this.object.translateZ(-b*(n>0||this.autoForward&&!(n<0)?1:n));this.object.translateX(b*p);this.object.translateY(b*u);k&&(this.roll+=this.rollSpeed*a*l);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();f.copy(this.forward);e.set(0,1,0);c.cross(e,
|
|
f).normalize();e.cross(f,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=e.x;this.object.matrix.n13=f.x;this.object.matrix.n21=c.y;this.object.matrix.n22=e.y;this.object.matrix.n23=f.y;this.object.matrix.n31=c.z;this.object.matrix.n32=e.z;this.object.matrix.n33=f.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
f).normalize();e.cross(f,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=e.x;this.object.matrix.n13=f.x;this.object.matrix.n21=c.y;this.object.matrix.n22=e.y;this.object.matrix.n23=f.y;this.object.matrix.n31=c.z;this.object.matrix.n32=e.z;this.object.matrix.n33=f.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);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*
|
|
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){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
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){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-o)/window.innerWidth;v=(a.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=1;break;case 2:m=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=0;break;case 2:m=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
|
-function(a){switch(a.keyCode){case 38:case 87:m=1;break;case 37:case 65:t=-1;break;case 40:case 83:m=-1;break;case 39:case 68:t=1;break;case 81:k=!0;l=1;break;case 69:k=!0;l=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:m=0;break;case 37:case 65:t=0;break;case 40:case 83:m=0;break;case 39:case 68:t=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:u=0;break;case 70:u=0}},!1)};
|
|
|
|
|
|
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){t=(a.clientX-o)/window.innerWidth;v=(a.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
|
+function(a){switch(a.keyCode){case 38:case 87:n=1;break;case 37:case 65:p=-1;break;case 40:case 83:n=-1;break;case 39:case 68:p=1;break;case 81:k=!0;l=1;break;case 69:k=!0;l=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:n=0;break;case 37:case 65:p=0;break;case 40:case 83:n=0;break;case 39:case 68:p=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:u=0;break;case 70:u=0}},!1)};
|
|
THREE.TrackballControls=function(a,b){function c(a,c){return function(){c.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;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=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
|
|
THREE.TrackballControls=function(a,b){function c(a,c){return function(){c.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;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=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
|
|
-0,0);var e=!1,f=this.STATE.NONE,h=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector2,t=new THREE.Vector2,u=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var b=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/
|
|
|
|
|
|
+0,0);var e=!1,f=this.STATE.NONE,h=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector2,p=new THREE.Vector2,u=new THREE.Vector2,t=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var b=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/
|
|
this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),e=b.length();e>1?b.normalize():b.z=Math.sqrt(1-e*e);h.copy(this.object.position).subSelf(this.target);e=this.object.up.clone().setLength(b.y);e.addSelf(this.object.up.clone().crossSelf(h).setLength(b.x));e.addSelf(h.setLength(b.z));return e};this.rotateCamera=function(){var a=Math.acos(k.dot(l)/k.length()/l.length());if(a){var c=(new THREE.Vector3).cross(k,l).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,
|
|
this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),e=b.length();e>1?b.normalize():b.z=Math.sqrt(1-e*e);h.copy(this.object.position).subSelf(this.target);e=this.object.up.clone().setLength(b.y);e.addSelf(this.object.up.clone().crossSelf(h).setLength(b.x));e.addSelf(h.setLength(b.z));return e};this.rotateCamera=function(){var a=Math.acos(k.dot(l)/k.length()/l.length());if(a){var c=(new THREE.Vector3).cross(k,l).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,
|
|
--a);b.multiplyVector3(h);b.multiplyVector3(this.object.up);b.multiplyVector3(l);this.staticMoving?k=l:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(t.y-m.y)*this.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),this.staticMoving?m=t:m.y+=(t.y-m.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(u);if(a.lengthSq()){a.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.object.up).setLength(a.x);
|
|
|
|
-c.addSelf(this.object.up.clone().setLength(a.y));this.object.position.addSelf(c);this.target.addSelf(c);this.staticMoving?u=p:u.addSelf(a.sub(p,u).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),h.lengthSq()<this.minDistance*this.minDistance&&this.object.position.add(this.target,h.setLength(this.minDistance))};this.update=function(){h.copy(this.object.position).subSelf(this.target);
|
|
|
|
-this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.object.position.add(this.target,h);this.checkDistances();this.object.lookAt(this.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,function(a){e&&(k=l=this.getMouseProjectionOnBall(a.clientX,a.clientY),m=t=this.getMouseOnScreen(a.clientX,a.clientY),u=p=this.getMouseOnScreen(a.clientX,a.clientY),e=!1);f!==this.STATE.NONE&&
|
|
|
|
-(f===this.STATE.ROTATE?l=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?t=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(p=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(a){a.preventDefault();a.stopPropagation();if(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?k=l=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=t=this.getMouseOnScreen(a.clientX,
|
|
|
|
-a.clientY):this.noPan||(u=p=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(a){a.preventDefault();a.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(a){if(f===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])f=this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==
|
|
|
|
|
|
+-a);b.multiplyVector3(h);b.multiplyVector3(this.object.up);b.multiplyVector3(l);this.staticMoving?k=l:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(p.y-n.y)*this.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),this.staticMoving?n=p:n.y+=(p.y-n.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=t.clone().subSelf(u);if(a.lengthSq()){a.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.object.up).setLength(a.x);
|
|
|
|
+c.addSelf(this.object.up.clone().setLength(a.y));this.object.position.addSelf(c);this.target.addSelf(c);this.staticMoving?u=t:u.addSelf(a.sub(t,u).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),h.lengthSq()<this.minDistance*this.minDistance&&this.object.position.add(this.target,h.setLength(this.minDistance))};this.update=function(){h.copy(this.object.position).subSelf(this.target);
|
|
|
|
+this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.object.position.add(this.target,h);this.checkDistances();this.object.lookAt(this.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,function(a){e&&(k=l=this.getMouseProjectionOnBall(a.clientX,a.clientY),n=p=this.getMouseOnScreen(a.clientX,a.clientY),u=t=this.getMouseOnScreen(a.clientX,a.clientY),e=!1);f!==this.STATE.NONE&&
|
|
|
|
+(f===this.STATE.ROTATE?l=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?p=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(t=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(a){a.preventDefault();a.stopPropagation();if(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?k=l=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=p=this.getMouseOnScreen(a.clientX,
|
|
|
|
+a.clientY):this.noPan||(u=t=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(a){a.preventDefault();a.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(a){if(f===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])f=this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==
|
|
this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
|
|
this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
|
|
-THREE.CubeGeometry=function(a,b,c,e,f,h,k,l){function m(a,c,b,k,l,m,o,p){var u,v,w=e||1,x=f||1,z=l/2,n=m/2,y=t.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")u="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")u="y",x=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")u="x",w=h||1;var A=w+1,B=x+1;l/=w;var ca=m/x;for(v=0;v<B;v++)for(m=0;m<A;m++){var ea=new THREE.Vector3;ea[a]=(m*l-z)*b;ea[c]=(v*ca-n)*k;ea[u]=o;t.vertices.push(new THREE.Vertex(ea))}for(v=0;v<x;v++)for(m=0;m<w;m++)t.faces.push(new THREE.Face4(m+
|
|
|
|
-A*v+y,m+A*(v+1)+y,m+1+A*(v+1)+y,m+1+A*v+y,null,null,p)),t.faceVertexUvs[0].push([new THREE.UV(m/w,v/x),new THREE.UV(m/w,(v+1)/x),new THREE.UV((m+1)/w,(v+1)/x),new THREE.UV((m+1)/w,v/x)])}THREE.Geometry.call(this);var t=this,u=a/2,p=b/2,v=c/2,o,z,x,w,B,y;if(k!==void 0){if(k instanceof Array)this.materials=k;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(k)}o=0;w=1;z=2;B=3;x=4;y=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var A in l)this.sides[A]!=
|
|
|
|
-void 0&&(this.sides[A]=l[A]);this.sides.px&&m("z","y",-1,-1,c,b,u,o);this.sides.nx&&m("z","y",1,-1,c,b,-u,w);this.sides.py&&m("x","z",1,1,a,c,p,z);this.sides.ny&&m("x","z",1,-1,a,c,-p,B);this.sides.pz&&m("x","y",1,-1,a,b,v,x);this.sides.nz&&m("x","y",-1,-1,a,b,-v,y);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
|
-THREE.CylinderGeometry=function(a,b,c,e,f,h){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,k=c/2,e=e||8,f=f||1,l,m,t=[],u=[];for(m=0;m<=f;m++){var p=[],v=[],o=m/f,z=o*(b-a)+a;for(l=0;l<=e;l++){var x=l/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(x*Math.PI*2),-o*c+k,z*Math.cos(x*Math.PI*2))));p.push(this.vertices.length-1);v.push(new THREE.UV(x,o))}t.push(p);u.push(v)}for(m=0;m<f;m++)for(l=0;l<e;l++){var c=t[m][l],p=t[m+1][l],v=t[m+1][l+1],o=t[m][l+1],z=
|
|
|
|
-this.vertices[c].position.clone().setY(0).normalize(),x=this.vertices[p].position.clone().setY(0).normalize(),w=this.vertices[v].position.clone().setY(0).normalize(),B=this.vertices[o].position.clone().setY(0).normalize(),y=u[m][l].clone(),A=u[m+1][l].clone(),E=u[m+1][l+1].clone(),C=u[m][l+1].clone();this.faces.push(new THREE.Face4(c,p,v,o,[z,x,w,B]));this.faceVertexUvs[0].push([y,A,E,C])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(l=0;l<e;l++)c=t[0][l],p=t[0][l+
|
|
|
|
-1],v=this.vertices.length-1,z=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),y=u[0][l].clone(),A=u[0][l+1].clone(),E=new THREE.UV(A.u,0),this.faces.push(new THREE.Face3(c,p,v,[z,x,w])),this.faceVertexUvs[0].push([y,A,E])}if(!h&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(l=0;l<e;l++)c=t[m][l+1],p=t[m][l],v=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),y=u[m][l+1].clone(),A=u[m][l].clone(),
|
|
|
|
-E=new THREE.UV(A.u,1),this.faces.push(new THREE.Face3(c,p,v,[z,x,w])),this.faceVertexUvs[0].push([y,A,E])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
|
|
|
+THREE.CubeGeometry=function(a,b,c,e,f,h,k,l){function n(a,c,b,k,l,n,o,t){var u,v,w=e||1,x=f||1,m=l/2,y=n/2,A=p.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")u="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")u="y",x=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")u="x",w=h||1;var z=w+1,C=x+1;l/=w;var ia=n/x;for(v=0;v<C;v++)for(n=0;n<z;n++){var ha=new THREE.Vector3;ha[a]=(n*l-m)*b;ha[c]=(v*ia-y)*k;ha[u]=o;p.vertices.push(new THREE.Vertex(ha))}for(v=0;v<x;v++)for(n=0;n<w;n++)p.faces.push(new THREE.Face4(n+
|
|
|
|
+z*v+A,n+z*(v+1)+A,n+1+z*(v+1)+A,n+1+z*v+A,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(n/w,v/x),new THREE.UV(n/w,(v+1)/x),new THREE.UV((n+1)/w,(v+1)/x),new THREE.UV((n+1)/w,v/x)])}THREE.Geometry.call(this);var p=this,u=a/2,t=b/2,v=c/2,o,y,x,w,A,z;if(k!==void 0){if(k instanceof Array)this.materials=k;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(k)}o=0;w=1;y=2;A=3;x=4;z=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var C in l)this.sides[C]!=
|
|
|
|
+void 0&&(this.sides[C]=l[C]);this.sides.px&&n("z","y",-1,-1,c,b,u,o);this.sides.nx&&n("z","y",1,-1,c,b,-u,w);this.sides.py&&n("x","z",1,1,a,c,t,y);this.sides.ny&&n("x","z",1,-1,a,c,-t,A);this.sides.pz&&n("x","y",1,-1,a,b,v,x);this.sides.nz&&n("x","y",-1,-1,a,b,-v,z);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
|
+THREE.CylinderGeometry=function(a,b,c,e,f,h){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,k=c/2,e=e||8,f=f||1,l,n,p=[],u=[];for(n=0;n<=f;n++){var t=[],v=[],o=n/f,y=o*(b-a)+a;for(l=0;l<=e;l++){var x=l/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(x*Math.PI*2),-o*c+k,y*Math.cos(x*Math.PI*2))));t.push(this.vertices.length-1);v.push(new THREE.UV(x,o))}p.push(t);u.push(v)}for(n=0;n<f;n++)for(l=0;l<e;l++){var c=p[n][l],t=p[n+1][l],v=p[n+1][l+1],o=p[n][l+1],y=
|
|
|
|
+this.vertices[c].position.clone().setY(0).normalize(),x=this.vertices[t].position.clone().setY(0).normalize(),w=this.vertices[v].position.clone().setY(0).normalize(),A=this.vertices[o].position.clone().setY(0).normalize(),z=u[n][l].clone(),C=u[n+1][l].clone(),B=u[n+1][l+1].clone(),K=u[n][l+1].clone();this.faces.push(new THREE.Face4(c,t,v,o,[y,x,w,A]));this.faceVertexUvs[0].push([z,C,B,K])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(l=0;l<e;l++)c=p[0][l],t=p[0][l+
|
|
|
|
+1],v=this.vertices.length-1,y=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),z=u[0][l].clone(),C=u[0][l+1].clone(),B=new THREE.UV(C.u,0),this.faces.push(new THREE.Face3(c,t,v,[y,x,w])),this.faceVertexUvs[0].push([z,C,B])}if(!h&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(l=0;l<e;l++)c=p[n][l+1],t=p[n][l],v=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),z=u[n][l+1].clone(),C=u[n][l].clone(),
|
|
|
|
+B=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(c,t,v,[y,x,w])),this.faceVertexUvs[0].push([z,C,B])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
THREE.ExtrudeGeometry=function(a,b){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(c=0;c<e;c++)f=a[c],this.addShape(f,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry=function(a,b){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(c=0;c<e;c++)f=a[c],this.addShape(f,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){c||console.log("die");return c.clone().multiplyScalar(b).addSelf(a)}function e(a,c,b){var e=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;e.set(a.x-c.x,a.y-c.y);k.set(a.x-b.x,a.y-b.y);e=e.normalize();k=k.normalize();h.set(-e.y,e.x);f.set(k.y,-k.x);l.copy(a).addSelf(h);m.copy(a).addSelf(f);if(l.equals(m))return f.clone();
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){c||console.log("die");return c.clone().multiplyScalar(b).addSelf(a)}function e(a,c,b){var e=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;e.set(a.x-c.x,a.y-c.y);k.set(a.x-b.x,a.y-b.y);e=e.normalize();k=k.normalize();h.set(-e.y,e.x);f.set(k.y,-k.x);l.copy(a).addSelf(h);m.copy(a).addSelf(f);if(l.equals(m))return f.clone();
|
|
-l.copy(c).addSelf(h);m.copy(b).addSelf(f);h=e.dot(f);f=m.subSelf(l).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(l).subSelf(a).clone()}function f(a){for(H=a.length;--H>=0;){la=H;ka=H-1;ka<0&&(ka=a.length-
|
|
|
|
-1);for(var c=0,b=o+u*2,c=0;c<b;c++){var e=n*c,k=n*(c+1),h=Z+la+e,f=Z+la+k,p=h,e=Z+ka+e,k=Z+ka+k,t=f;p+=R;e+=R;k+=R;t+=R;N.faces.push(new THREE.Face4(p,e,k,t,null,null,E));E&&(p=c/b,e=(c+1)/b,k=l+m*2,h=(N.vertices[h].position.z+m)/k,f=(N.vertices[f].position.z+m)/k,N.faceVertexUvs[0].push([new THREE.UV(h,p),new THREE.UV(f,p),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,c,b){N.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function k(a,c,b){a+=R;c+=R;b+=R;N.faces.push(new THREE.Face3(a,
|
|
|
|
-c,b,null,null,A));if(A){var e=C.maxY,k=C.maxX,h=N.vertices[c].position.x,c=N.vertices[c].position.y,f=N.vertices[b].position.x,b=N.vertices[b].position.y;N.faceVertexUvs[0].push([new THREE.UV(N.vertices[a].position.x/k,N.vertices[a].position.y/e),new THREE.UV(h/k,c/e),new THREE.UV(f/k,b/e)])}}var l=b.amount!==void 0?b.amount:100,m=b.bevelThickness!==void 0?b.bevelThickness:6,t=b.bevelSize!==void 0?b.bevelSize:m-2,u=b.bevelSegments!==void 0?b.bevelSegments:3,p=b.bevelEnabled!==void 0?b.bevelEnabled:
|
|
|
|
-!0,v=b.curveSegments!==void 0?b.curveSegments:12,o=b.steps!==void 0?b.steps:1,z=b.bendPath,x=b.extrudePath,w,B=!1,y=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,A=b.material,E=b.extrudeMaterial,C=this.shapebb;if(x)w=x.getPoints(v),o=w.length,B=!0,p=!1;p||(t=m=u=0);var L,F,G,N=this,R=this.vertices.length;z&&a.addWrapPath(z);v=y?a.extractAllSpacedPoints(v):a.extractAllPoints(v);z=v.shape;v=v.holes;if(x=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();F=0;for(G=v.length;F<G;F++)L=v[F],THREE.Shape.Utils.isClockWise(L)&&
|
|
|
|
-(v[F]=L.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(z,v);y=z;F=0;for(G=v.length;F<G;F++)L=v[F],z=z.concat(L);var H,S,J,V,X,O,n=z.length,U=x.length,$=[];H=0;S=y.length;la=S-1;for(ka=H+1;H<S;H++,la++,ka++)la==S&&(la=0),ka==S&&(ka=0),$[H]=e(y[H],y[la],y[ka]);var aa=[],ca,ea=$.concat();F=0;for(G=v.length;F<G;F++){L=v[F];ca=[];H=0;S=L.length;la=S-1;for(ka=H+1;H<S;H++,la++,ka++)la==S&&(la=0),ka==S&&(ka=0),ca[H]=e(L[H],L[la],L[ka]);aa.push(ca);ea=ea.concat(ca)}for(J=0;J<u;J++){V=J/u;X=m*(1-V);V=
|
|
|
|
-t*Math.sin(V*Math.PI/2);H=0;for(S=y.length;H<S;H++)O=c(y[H],$[H],V),h(O.x,O.y,-X);F=0;for(G=v.length;F<G;F++){L=v[F];ca=aa[F];H=0;for(S=L.length;H<S;H++)O=c(L[H],ca[H],V),h(O.x,O.y,-X)}}V=t;for(H=0;H<n;H++)O=p?c(z[H],ea[H],V):z[H],B?h(O.x,O.y+w[0].y,w[0].x):h(O.x,O.y,0);for(J=1;J<=o;J++)for(H=0;H<n;H++)O=p?c(z[H],ea[H],V):z[H],B?h(O.x,O.y+w[J-1].y,w[J-1].x):h(O.x,O.y,l/o*J);for(J=u-1;J>=0;J--){V=J/u;X=m*(1-V);V=t*Math.sin(V*Math.PI/2);H=0;for(S=y.length;H<S;H++)O=c(y[H],$[H],V),h(O.x,O.y,l+X);F=0;
|
|
|
|
-for(G=v.length;F<G;F++){L=v[F];ca=aa[F];H=0;for(S=L.length;H<S;H++)O=c(L[H],ca[H],V),B?h(O.x,O.y+w[o-1].y,w[o-1].x+X):h(O.x,O.y,l+X)}}if(p){p=n*0;for(H=0;H<U;H++)t=x[H],k(t[2]+p,t[1]+p,t[0]+p);p=n*(o+u*2);for(H=0;H<U;H++)t=x[H],k(t[0]+p,t[1]+p,t[2]+p)}else{for(H=0;H<U;H++)t=x[H],k(t[2],t[1],t[0]);for(H=0;H<U;H++)t=x[H],k(t[0]+n*o,t[1]+n*o,t[2]+n*o)}var la,ka,Z=0;f(y);Z+=y.length;F=0;for(G=v.length;F<G;F++)L=v[F],f(L),Z+=L.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
|
|
|
+l.copy(c).addSelf(h);m.copy(b).addSelf(f);h=e.dot(f);f=m.subSelf(l).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(l).subSelf(a).clone()}function f(a){for(H=a.length;--H>=0;){ja=H;ca=H-1;ca<0&&(ca=a.length-
|
|
|
|
+1);for(var c=0,b=o+u*2,c=0;c<b;c++){var e=aa*c,k=aa*(c+1),h=Z+ja+e,f=Z+ja+k,m=h,e=Z+ca+e,k=Z+ca+k,p=f;m+=V;e+=V;k+=V;p+=V;O.faces.push(new THREE.Face4(m,e,k,p,null,null,B));B&&(m=c/b,e=(c+1)/b,k=l+n*2,h=(O.vertices[h].position.z+n)/k,f=(O.vertices[f].position.z+n)/k,O.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,c,b){O.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function k(a,c,b){a+=V;c+=V;b+=V;O.faces.push(new THREE.Face3(a,
|
|
|
|
+c,b,null,null,C));if(C){var e=K.maxY,k=K.maxX,h=O.vertices[c].position.x,c=O.vertices[c].position.y,f=O.vertices[b].position.x,b=O.vertices[b].position.y;O.faceVertexUvs[0].push([new THREE.UV(O.vertices[a].position.x/k,O.vertices[a].position.y/e),new THREE.UV(h/k,c/e),new THREE.UV(f/k,b/e)])}}var l=b.amount!==void 0?b.amount:100,n=b.bevelThickness!==void 0?b.bevelThickness:6,p=b.bevelSize!==void 0?b.bevelSize:n-2,u=b.bevelSegments!==void 0?b.bevelSegments:3,t=b.bevelEnabled!==void 0?b.bevelEnabled:
|
|
|
|
+!0,v=b.curveSegments!==void 0?b.curveSegments:12,o=b.steps!==void 0?b.steps:1,y=b.bendPath,x=b.extrudePath,w,A=!1,z=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,C=b.material,B=b.extrudeMaterial,K=this.shapebb;if(x)w=x.getPoints(v),o=w.length,A=!0,t=!1;t||(p=n=u=0);var F,M,E,O=this,V=this.vertices.length;y&&a.addWrapPath(y);v=z?a.extractAllSpacedPoints(v):a.extractAllPoints(v);y=v.shape;v=v.holes;if(x=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();M=0;for(E=v.length;M<E;M++)F=v[M],THREE.Shape.Utils.isClockWise(F)&&
|
|
|
|
+(v[M]=F.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(y,v);z=y;M=0;for(E=v.length;M<E;M++)F=v[M],y=y.concat(F);var H,P,L,T,S,m,aa=y.length,U=x.length,ea=[];H=0;P=z.length;ja=P-1;for(ca=H+1;H<P;H++,ja++,ca++)ja==P&&(ja=0),ca==P&&(ca=0),ea[H]=e(z[H],z[ja],z[ca]);var da=[],ia,ha=ea.concat();M=0;for(E=v.length;M<E;M++){F=v[M];ia=[];H=0;P=F.length;ja=P-1;for(ca=H+1;H<P;H++,ja++,ca++)ja==P&&(ja=0),ca==P&&(ca=0),ia[H]=e(F[H],F[ja],F[ca]);da.push(ia);ha=ha.concat(ia)}for(L=0;L<u;L++){T=L/u;S=n*(1-
|
|
|
|
+T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H<P;H++)m=c(z[H],ea[H],T),h(m.x,m.y,-S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];H=0;for(P=F.length;H<P;H++)m=c(F[H],ia[H],T),h(m.x,m.y,-S)}}T=p;for(H=0;H<aa;H++)m=t?c(y[H],ha[H],T):y[H],A?h(m.x,m.y+w[0].y,w[0].x):h(m.x,m.y,0);for(L=1;L<=o;L++)for(H=0;H<aa;H++)m=t?c(y[H],ha[H],T):y[H],A?h(m.x,m.y+w[L-1].y,w[L-1].x):h(m.x,m.y,l/o*L);for(L=u-1;L>=0;L--){T=L/u;S=n*(1-T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H<P;H++)m=c(z[H],ea[H],T),h(m.x,m.y,
|
|
|
|
+l+S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];H=0;for(P=F.length;H<P;H++)m=c(F[H],ia[H],T),A?h(m.x,m.y+w[o-1].y,w[o-1].x+S):h(m.x,m.y,l+S)}}if(t){t=aa*0;for(H=0;H<U;H++)p=x[H],k(p[2]+t,p[1]+t,p[0]+t);t=aa*(o+u*2);for(H=0;H<U;H++)p=x[H],k(p[0]+t,p[1]+t,p[2]+t)}else{for(H=0;H<U;H++)p=x[H],k(p[2],p[1],p[0]);for(H=0;H<U;H++)p=x[H],k(p[0]+aa*o,p[1]+aa*o,p[2]+aa*o)}var ja,ca,Z=0;f(z);Z+=z.length;M=0;for(E=v.length;M<E;M++)F=v[M],f(F),Z+=F.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=f.vertices[a].position,k=f.vertices[c].position;return b((e.x+k.x)/2,(e.y+k.y)/2,(e.z+k.z)/2)}var f=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
|
|
THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=f.vertices[a].position,k=f.vertices[c].position;return b((e.x+k.x)/2,(e.y+k.y)/2,(e.z+k.z)/2)}var f=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
|
|
--a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var k=0;k<this.subdivisions;k++){var a=new THREE.Geometry,l;for(l in h.faces){var m=e(h.faces[l].a,h.faces[l].b),t=e(h.faces[l].b,h.faces[l].c),u=e(h.faces[l].c,h.faces[l].a);c(h.faces[l].a,m,u,a);c(h.faces[l].b,t,
|
|
|
|
-m,a);c(h.faces[l].c,u,t,a);c(m,t,u,a)}h.faces=a.faces}f.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
|
-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=[],e=[],f=[],h=[],k=(new THREE.Matrix4).setRotationZ(b),l=0;l<a.length;l++)this.vertices.push(new THREE.Vertex(a[l])),c[l]=a[l].clone(),e[l]=this.vertices.length-1;for(var m=0;m<=this.angle+0.0010;m+=b){for(l=0;l<c.length;l++)m<this.angle?(c[l]=k.multiplyVector3(c[l].clone()),this.vertices.push(new THREE.Vertex(c[l])),f[l]=this.vertices.length-1):f=h;m==0&&(h=e);
|
|
|
|
-for(l=0;l<e.length-1;l++)this.faces.push(new THREE.Face4(f[l],f[l+1],e[l+1],e[l])),this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,l/a.length),new THREE.UV(1-m/this.angle,(l+1)/a.length),new THREE.UV(1-(m-b)/this.angle,(l+1)/a.length),new THREE.UV(1-(m-b)/this.angle,l/a.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
|
|
|
+-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var k=0;k<this.subdivisions;k++){var a=new THREE.Geometry,l;for(l in h.faces){var n=e(h.faces[l].a,h.faces[l].b),p=e(h.faces[l].b,h.faces[l].c),u=e(h.faces[l].c,h.faces[l].a);c(h.faces[l].a,n,u,a);c(h.faces[l].b,p,
|
|
|
|
+n,a);c(h.faces[l].c,u,p,a);c(n,p,u,a)}h.faces=a.faces}f.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
|
+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=[],e=[],f=[],h=[],k=(new THREE.Matrix4).setRotationZ(b),l=0;l<a.length;l++)this.vertices.push(new THREE.Vertex(a[l])),c[l]=a[l].clone(),e[l]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=b){for(l=0;l<c.length;l++)n<this.angle?(c[l]=k.multiplyVector3(c[l].clone()),this.vertices.push(new THREE.Vertex(c[l])),f[l]=this.vertices.length-1):f=h;n==0&&(h=e);
|
|
|
|
+for(l=0;l<e.length-1;l++)this.faces.push(new THREE.Face4(f[l],f[l+1],e[l+1],e[l])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,l/a.length),new THREE.UV(1-n/this.angle,(l+1)/a.length),new THREE.UV(1-(n-b)/this.angle,(l+1)/a.length),new THREE.UV(1-(n-b)/this.angle,l/a.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
THREE.OctahedronGeometry=function(a,b){function c(c){var b=c.clone().normalize(),b=new THREE.Vertex(b.clone().multiplyScalar(a));b.index=k.vertices.push(b)-1;b.uv=new THREE.UV(Math.atan2(c.z,-c.x)/2/Math.PI+0.5,Math.atan2(-c.y,Math.sqrt(c.x*c.x+c.z*c.z))/Math.PI+0.5);return b}function e(a,c,b,l){l<1?(l=new THREE.Face3(a.index,c.index,b.index,[a.position,c.position,b.position]),l.centroid.addSelf(a.position).addSelf(c.position).addSelf(b.position).divideScalar(3),l.normal=l.centroid.clone().normalize(),
|
|
THREE.OctahedronGeometry=function(a,b){function c(c){var b=c.clone().normalize(),b=new THREE.Vertex(b.clone().multiplyScalar(a));b.index=k.vertices.push(b)-1;b.uv=new THREE.UV(Math.atan2(c.z,-c.x)/2/Math.PI+0.5,Math.atan2(-c.y,Math.sqrt(c.x*c.x+c.z*c.z))/Math.PI+0.5);return b}function e(a,c,b,l){l<1?(l=new THREE.Face3(a.index,c.index,b.index,[a.position,c.position,b.position]),l.centroid.addSelf(a.position).addSelf(c.position).addSelf(b.position).divideScalar(3),l.normal=l.centroid.clone().normalize(),
|
|
k.faces.push(l),l=Math.atan2(l.centroid.z,-l.centroid.x),k.faceVertexUvs[0].push([h(a.uv,a.position,l),h(c.uv,c.position,l),h(b.uv,b.position,l)])):(l-=1,e(a,f(a,c),f(a,b),l),e(f(a,c),c,f(c,b),l),e(f(a,b),f(c,b),b,l),e(f(a,c),f(c,b),f(a,b),l))}function f(a,b){l[a.index]||(l[a.index]=[]);l[b.index]||(l[b.index]=[]);var e=l[a.index][b.index];e===void 0&&(l[a.index][b.index]=l[b.index][a.index]=e=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return e}function h(a,c,b){b<0&&a.u===
|
|
k.faces.push(l),l=Math.atan2(l.centroid.z,-l.centroid.x),k.faceVertexUvs[0].push([h(a.uv,a.position,l),h(c.uv,c.position,l),h(b.uv,b.position,l)])):(l-=1,e(a,f(a,c),f(a,b),l),e(f(a,c),c,f(c,b),l),e(f(a,b),f(c,b),b,l),e(f(a,c),f(c,b),f(a,b),l))}function f(a,b){l[a.index]||(l[a.index]=[]);l[b.index]||(l[b.index]=[]);var e=l[a.index][b.index];e===void 0&&(l[a.index][b.index]=l[b.index][a.index]=e=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return e}function h(a,c,b){b<0&&a.u===
|
|
-1&&(a=new THREE.UV(a.u-1,a.v));c.x===0&&c.z===0&&(a=new THREE.UV(b/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var b=isFinite(b)?b:3,k=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var l=[],m=this.vertices;e(m[0],m[2],m[4],b);e(m[0],m[4],m[3],b);e(m[0],m[3],m[5],b);e(m[0],m[5],m[2],b);e(m[1],m[2],m[5],b);e(m[1],m[5],m[3],b);e(m[1],m[3],m[4],b);e(m[1],m[4],m[2],
|
|
|
|
|
|
+1&&(a=new THREE.UV(a.u-1,a.v));c.x===0&&c.z===0&&(a=new THREE.UV(b/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var b=isFinite(b)?b:3,k=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var l=[],n=this.vertices;e(n[0],n[2],n[4],b);e(n[0],n[4],n[3],b);e(n[0],n[3],n[5],b);e(n[0],n[5],n[2],b);e(n[1],n[2],n[5],b);e(n[1],n[5],n[3],b);e(n[1],n[3],n[4],b);e(n[1],n[4],n[2],
|
|
b);this.boundingSphere={radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
b);this.boundingSphere={radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
-THREE.PlaneGeometry=function(a,b,c,e){THREE.Geometry.call(this);var f,h=a/2,k=b/2,c=c||1,e=e||1,l=c+1,m=e+1;a/=c;var t=b/e;for(f=0;f<m;f++)for(b=0;b<l;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(f*t-k),0)));for(f=0;f<e;f++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+l*f,b+l*(f+1),b+1+l*(f+1),b+1+l*f)),this.faceVertexUvs[0].push([new THREE.UV(b/c,f/e),new THREE.UV(b/c,(f+1)/e),new THREE.UV((b+1)/c,(f+1)/e),new THREE.UV((b+1)/c,f/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
|
|
|
+THREE.PlaneGeometry=function(a,b,c,e){THREE.Geometry.call(this);var f,h=a/2,k=b/2,c=c||1,e=e||1,l=c+1,n=e+1;a/=c;var p=b/e;for(f=0;f<n;f++)for(b=0;b<l;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(f*p-k),0)));for(f=0;f<e;f++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+l*f,b+l*(f+1),b+1+l*(f+1),b+1+l*f)),this.faceVertexUvs[0].push([new THREE.UV(b/c,f/e),new THREE.UV(b/c,(f+1)/e),new THREE.UV((b+1)/c,(f+1)/e),new THREE.UV((b+1)/c,f/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
-THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,b||8),k=Math.max(2,c||6),b=[],c=0;c<k+1;c++){e=c/k;var l=a*Math.cos(e*f),m=a*Math.sin(e*f),t=[],u=0;for(e=0;e<h;e++){var p=2*e/h,v=m*Math.sin(p*f),p=m*Math.cos(p*f);(c==0||c==k)&&e>0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,l,v)))-1);t.push(u)}b.push(t)}for(var o,z,x,f=b.length,c=0;c<f;c++)if(h=b[c].length,c>0)for(e=0;e<h;e++){t=e==h-1;k=b[c][t?0:e+1];l=b[c][t?h-1:e];m=b[c-1][t?
|
|
|
|
-h-1:e];t=b[c-1][t?0:e+1];v=c/(f-1);o=(c-1)/(f-1);z=(e+1)/h;var p=e/h,u=new THREE.UV(1-z,v),v=new THREE.UV(1-p,v),p=new THREE.UV(1-p,o),w=new THREE.UV(1-z,o);c<b.length-1&&(o=this.vertices[k].position.clone(),z=this.vertices[l].position.clone(),x=this.vertices[m].position.clone(),o.normalize(),z.normalize(),x.normalize(),this.faces.push(new THREE.Face3(k,l,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([u,v,p]));c>1&&(o=
|
|
|
|
-this.vertices[k].position.clone(),z=this.vertices[m].position.clone(),x=this.vertices[t].position.clone(),o.normalize(),z.normalize(),x.normalize(),this.faces.push(new THREE.Face3(k,m,t,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([u,p,w]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
|
|
|
+THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,b||8),k=Math.max(2,c||6),b=[],c=0;c<k+1;c++){e=c/k;var l=a*Math.cos(e*f),n=a*Math.sin(e*f),p=[],u=0;for(e=0;e<h;e++){var t=2*e/h,v=n*Math.sin(t*f),t=n*Math.cos(t*f);(c==0||c==k)&&e>0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,l,v)))-1);p.push(u)}b.push(p)}for(var o,y,x,f=b.length,c=0;c<f;c++)if(h=b[c].length,c>0)for(e=0;e<h;e++){p=e==h-1;k=b[c][p?0:e+1];l=b[c][p?h-1:e];n=b[c-1][p?
|
|
|
|
+h-1:e];p=b[c-1][p?0:e+1];v=c/(f-1);o=(c-1)/(f-1);y=(e+1)/h;var t=e/h,u=new THREE.UV(1-y,v),v=new THREE.UV(1-t,v),t=new THREE.UV(1-t,o),w=new THREE.UV(1-y,o);c<b.length-1&&(o=this.vertices[k].position.clone(),y=this.vertices[l].position.clone(),x=this.vertices[n].position.clone(),o.normalize(),y.normalize(),x.normalize(),this.faces.push(new THREE.Face3(k,l,n,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([u,v,t]));c>1&&(o=
|
|
|
|
+this.vertices[k].position.clone(),y=this.vertices[n].position.clone(),x=this.vertices[p].position.clone(),o.normalize(),y.normalize(),x.normalize(),this.faces.push(new THREE.Face3(k,n,p,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([u,t,w]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var e=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var e=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
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]},getTextShapes:function(a,b){return(new TextPath(a,b)).toShapes()},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=
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,b){return(new TextPath(a,b)).toShapes()},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,e=0,f=String(a).split(""),h=f.length,k=[],a=0;a<h;a++){var l=new THREE.Path,l=this.extractGlyphPoints(f[a],b,c,e,l);e+=l.offset;k.push(l.path)}return{paths:k,offset:e/2}},extractGlyphPoints:function(a,b,c,e,f){var h=[],k,l,m,t,u,p,v,o,z,x,w=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(w){if(w.o){b=w._cachedOutline||(w._cachedOutline=w.o.split(" "));m=b.length;for(a=0;a<m;)switch(l=b[a++],l){case "m":l=b[a++]*c+e;t=b[a++]*c;h.push(new THREE.Vector2(l,
|
|
|
|
-t));f.moveTo(l,t);break;case "l":l=b[a++]*c+e;t=b[a++]*c;h.push(new THREE.Vector2(l,t));f.lineTo(l,t);break;case "q":l=b[a++]*c+e;t=b[a++]*c;v=b[a++]*c+e;o=b[a++]*c;f.quadraticCurveTo(v,o,l,t);if(k=h[h.length-1]){u=k.x;p=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var B=k/divisions,y=THREE.Shape.Utils.b2(B,u,v,l),B=THREE.Shape.Utils.b2(B,p,o,t);h.push(new THREE.Vector2(y,B))}}break;case "b":if(l=b[a++]*c+e,t=b[a++]*c,v=b[a++]*c+e,o=b[a++]*-c,z=b[a++]*c+e,x=b[a++]*-c,f.bezierCurveTo(l,t,
|
|
|
|
-v,o,z,x),k=h[h.length-1]){u=k.x;p=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)B=k/divisions,y=THREE.Shape.Utils.b3(B,u,v,z,l),B=THREE.Shape.Utils.b3(B,p,o,x,t),h.push(new THREE.Vector2(y,B))}}}return{offset:w.ha*c,points:h,path:f}}}};
|
|
|
|
-(function(a){var b=function(a){for(var b=a.length,f=0,h=b-1,k=0;k<b;h=k++)f+=a[h].x*a[k].y-a[k].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],k=[],l=[],m,t,u;if(b(a)>0)for(t=0;t<f;t++)k[t]=t;else for(t=0;t<f;t++)k[t]=f-1-t;var p=2*f;for(t=f-1;f>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return h}m=t;f<=m&&(m=0);t=m+1;f<=t&&(t=0);u=t+1;f<=u&&(u=0);var v;a:{v=a;var o=m,z=t,x=u,w=f,B=k,y=void 0,A=void 0,E=void 0,
|
|
|
|
-C=void 0,L=void 0,F=void 0,G=void 0,N=void 0,R=void 0,A=v[B[o]].x,E=v[B[o]].y,C=v[B[z]].x,L=v[B[z]].y,F=v[B[x]].x,G=v[B[x]].y;if(1.0E-10>(C-A)*(G-E)-(L-E)*(F-A))v=!1;else{for(y=0;y<w;y++)if(!(y==o||y==z||y==x)){var N=v[B[y]].x,R=v[B[y]].y,H=void 0,S=void 0,J=void 0,V=void 0,X=void 0,O=void 0,n=void 0,U=void 0,$=void 0,aa=void 0,ca=void 0,ea=void 0,H=J=X=void 0,H=F-C,S=G-L,J=A-F,V=E-G,X=C-A,O=L-E,n=N-A,U=R-E,$=N-C,aa=R-L,ca=N-F,ea=R-G,H=H*aa-S*$,X=X*U-O*n,J=J*ea-V*ca;if(H>=0&&J>=0&&X>=0){v=!1;break a}}v=
|
|
|
|
-!0}}if(v){h.push([a[k[m]],a[k[t]],a[k[u]]]);l.push([k[m],k[t],k[u]]);m=t;for(u=t+1;u<f;m++,u++)k[m]=k[u];f--;p=2*f}}if(e)return l;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
|
|
|
+this.getFace(),c=this.size/b.resolution,e=0,f=String(a).split(""),h=f.length,k=[],a=0;a<h;a++){var l=new THREE.Path,l=this.extractGlyphPoints(f[a],b,c,e,l);e+=l.offset;k.push(l.path)}return{paths:k,offset:e/2}},extractGlyphPoints:function(a,b,c,e,f){var h=[],k,l,n,p,u,t,v,o,y,x,w=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(w){if(w.o){b=w._cachedOutline||(w._cachedOutline=w.o.split(" "));n=b.length;for(a=0;a<n;)switch(l=b[a++],l){case "m":l=b[a++]*c+e;p=b[a++]*c;h.push(new THREE.Vector2(l,
|
|
|
|
+p));f.moveTo(l,p);break;case "l":l=b[a++]*c+e;p=b[a++]*c;h.push(new THREE.Vector2(l,p));f.lineTo(l,p);break;case "q":l=b[a++]*c+e;p=b[a++]*c;v=b[a++]*c+e;o=b[a++]*c;f.quadraticCurveTo(v,o,l,p);if(k=h[h.length-1]){u=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var A=k/divisions,z=THREE.Shape.Utils.b2(A,u,v,l),A=THREE.Shape.Utils.b2(A,t,o,p);h.push(new THREE.Vector2(z,A))}}break;case "b":if(l=b[a++]*c+e,p=b[a++]*c,v=b[a++]*c+e,o=b[a++]*-c,y=b[a++]*c+e,x=b[a++]*-c,f.bezierCurveTo(l,p,
|
|
|
|
+v,o,y,x),k=h[h.length-1]){u=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)A=k/divisions,z=THREE.Shape.Utils.b3(A,u,v,y,l),A=THREE.Shape.Utils.b3(A,t,o,x,p),h.push(new THREE.Vector2(z,A))}}}return{offset:w.ha*c,points:h,path:f}}}};
|
|
|
|
+(function(a){var b=function(a){for(var b=a.length,f=0,h=b-1,k=0;k<b;h=k++)f+=a[h].x*a[k].y-a[k].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],k=[],l=[],n,p,u;if(b(a)>0)for(p=0;p<f;p++)k[p]=p;else for(p=0;p<f;p++)k[p]=f-1-p;var t=2*f;for(p=f-1;f>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return h}n=p;f<=n&&(n=0);p=n+1;f<=p&&(p=0);u=p+1;f<=u&&(u=0);var v;a:{v=a;var o=n,y=p,x=u,w=f,A=k,z=void 0,C=void 0,B=void 0,
|
|
|
|
+K=void 0,F=void 0,M=void 0,E=void 0,O=void 0,V=void 0,C=v[A[o]].x,B=v[A[o]].y,K=v[A[y]].x,F=v[A[y]].y,M=v[A[x]].x,E=v[A[x]].y;if(1.0E-10>(K-C)*(E-B)-(F-B)*(M-C))v=!1;else{for(z=0;z<w;z++)if(!(z==o||z==y||z==x)){var O=v[A[z]].x,V=v[A[z]].y,H=void 0,P=void 0,L=void 0,T=void 0,S=void 0,m=void 0,aa=void 0,U=void 0,ea=void 0,da=void 0,ia=void 0,ha=void 0,H=L=S=void 0,H=M-K,P=E-F,L=C-M,T=B-E,S=K-C,m=F-B,aa=O-C,U=V-B,ea=O-K,da=V-F,ia=O-M,ha=V-E,H=H*da-P*ea,S=S*U-m*aa,L=L*ha-T*ia;if(H>=0&&L>=0&&S>=0){v=!1;
|
|
|
|
+break a}}v=!0}}if(v){h.push([a[k[n]],a[k[p]],a[k[u]]]);l.push([k[n],k[p],k[u]]);n=p;for(u=p+1;u<f;n++,u++)k[n]=k[u];f--;t=2*f}}if(e)return l;return h};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,e,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,k=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(h);f.y=this.radius*Math.sin(h);var l=new THREE.Vector3;l.x=(this.radius+this.tube*Math.cos(k))*Math.cos(h);l.y=(this.radius+this.tube*Math.cos(k))*Math.sin(h);l.z=
|
|
THREE.TorusGeometry=function(a,b,c,e,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,k=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(h);f.y=this.radius*Math.sin(h);var l=new THREE.Vector3;l.x=(this.radius+this.tube*Math.cos(k))*Math.cos(h);l.y=(this.radius+this.tube*Math.cos(k))*Math.sin(h);l.z=
|
|
-this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(l));a.push(new THREE.UV(e/this.segmentsT,1-c/this.segmentsR));b.push(l.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(e=1;e<=this.segmentsT;e++){var f=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,k=(this.segmentsT+1)*(c-1)+e,l=(this.segmentsT+1)*c+e,m=new THREE.Face4(f,h,k,l,[b[f],b[h],b[k],b[l]]);m.normal.addSelf(b[f]);m.normal.addSelf(b[h]);m.normal.addSelf(b[k]);m.normal.addSelf(b[l]);m.normal.normalize();this.faces.push(m);
|
|
|
|
|
|
+this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(l));a.push(new THREE.UV(e/this.segmentsT,1-c/this.segmentsR));b.push(l.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(e=1;e<=this.segmentsT;e++){var f=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,k=(this.segmentsT+1)*(c-1)+e,l=(this.segmentsT+1)*c+e,n=new THREE.Face4(f,h,k,l,[b[f],b[h],b[k],b[l]]);n.normal.addSelf(b[f]);n.normal.addSelf(b[h]);n.normal.addSelf(b[k]);n.normal.addSelf(b[l]);n.normal.normalize();this.faces.push(n);
|
|
this.faceVertexUvs[0].push([a[f].clone(),a[h].clone(),a[k].clone(),a[l].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
this.faceVertexUvs[0].push([a[f].clone(),a[h].clone(),a[k].clone(),a[l].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
THREE.TorusKnotGeometry=function(a,b,c,e,f,h,k){function l(a,c,b,e,k,h){c=b/e*a;b=Math.cos(c);return new THREE.Vector3(k*(2+b)*0.5*Math.cos(a),k*(2+b)*Math.sin(a)*0.5,h*k*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=e||8;this.p=f||2;this.q=h||3;this.heightScale=k||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
|
|
THREE.TorusKnotGeometry=function(a,b,c,e,f,h,k){function l(a,c,b,e,k,h){c=b/e*a;b=Math.cos(c);return new THREE.Vector3(k*(2+b)*0.5*Math.cos(a),k*(2+b)*Math.sin(a)*0.5,h*k*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=e||8;this.p=f||2;this.q=h||3;this.heightScale=k||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
|
|
-this.segmentsT;++b){var m=a/this.segmentsR*2*this.p*Math.PI,k=b/this.segmentsT*2*Math.PI,f=l(m,k,this.q,this.p,this.radius,this.heightScale),m=l(m+0.01,k,this.q,this.p,this.radius,this.heightScale);c.x=m.x-f.x;c.y=m.y-f.y;c.z=m.z-f.z;e.x=m.x+f.x;e.y=m.y+f.y;e.z=m.z+f.z;h.cross(c,e);e.cross(h,c);h.normalize();e.normalize();m=-this.tube*Math.cos(k);k=this.tube*Math.sin(k);f.x+=m*e.x+k*h.x;f.y+=m*e.y+k*h.y;f.z+=m*e.z+k*h.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
|
|
|
|
-f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,h=(b+1)%this.segmentsT,f=this.grid[a][b],c=this.grid[e][b],e=this.grid[e][h],h=this.grid[a][h],k=new THREE.UV(a/this.segmentsR,b/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),u=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,c,e,h));this.faceVertexUvs[0].push([k,m,t,u])}this.computeCentroids();
|
|
|
|
|
|
+this.segmentsT;++b){var n=a/this.segmentsR*2*this.p*Math.PI,k=b/this.segmentsT*2*Math.PI,f=l(n,k,this.q,this.p,this.radius,this.heightScale),n=l(n+0.01,k,this.q,this.p,this.radius,this.heightScale);c.x=n.x-f.x;c.y=n.y-f.y;c.z=n.z-f.z;e.x=n.x+f.x;e.y=n.y+f.y;e.z=n.z+f.z;h.cross(c,e);e.cross(h,c);h.normalize();e.normalize();n=-this.tube*Math.cos(k);k=this.tube*Math.sin(k);f.x+=n*e.x+k*h.x;f.y+=n*e.y+k*h.y;f.z+=n*e.z+k*h.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
|
|
|
|
+f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,h=(b+1)%this.segmentsT,f=this.grid[a][b],c=this.grid[e][b],e=this.grid[e][h],h=this.grid[a][h],k=new THREE.UV(a/this.segmentsR,b/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),p=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),u=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,c,e,h));this.faceVertexUvs[0].push([k,n,p,u])}this.computeCentroids();
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,c,b,e,l,m){var o=new THREE.Face4(a,c,b,e,null,l.color,l.material);if(k.useOldVertexColors){o.vertexColors=[];for(var t,n,u,v=0;v<4;v++){u=m[v];t=new THREE.Color;t.setRGB(0,0,0);for(var w=0;w<u.length;w++)n=l.vertexColors[u[w]-1],t.r+=n.r,t.g+=n.g,t.b+=n.b;t.r/=u.length;t.g/=u.length;t.b/=u.length;o.vertexColors[v]=t}}f.push(o);(!k.supportUVs||p.length!=0)&&h.push([p[a],p[c],p[b],p[e]])}function c(a,c){return Math.min(a,c)+"_"+Math.max(a,
|
|
|
|
-c)}var e=[],f=[],h=[],k=this,l=a.vertices,e=a.faces,m=l.concat(),t=[],u={},p=[],v,o,z,x,w,B=a.faceVertexUvs[0];v=0;for(o=B.length;v<o;v++){z=0;for(x=B[v].length;z<x;z++)w=e[v]["abcd".charAt(z)],p[w]||(p[w]=B[v][z])}var y;v=0;for(o=e.length;v<o;v++)if(w=e[v],t.push(w.centroid),m.push(new THREE.Vertex(w.centroid)),k.supportUVs&&p.length!=0){y=new THREE.UV;if(w instanceof THREE.Face3)y.u=p[w.a].u+p[w.b].u+p[w.c].u,y.v=p[w.a].v+p[w.b].v+p[w.c].v,y.u/=3,y.v/=3;else if(w instanceof THREE.Face4)y.u=p[w.a].u+
|
|
|
|
-p[w.b].u+p[w.c].u+p[w.d].u,y.v=p[w.a].v+p[w.b].v+p[w.c].v+p[w.d].v,y.u/=4,y.v/=4;p.push(y)}x=function(a){function b(a,c,e){a[c]===void 0&&(a[c]=[]);a[c].push(e)}var e,k,h,f,l={};e=0;for(k=a.faces.length;e<k;e++)h=a.faces[e],h instanceof THREE.Face3?(f=c(h.a,h.b),b(l,f,e),f=c(h.b,h.c),b(l,f,e),f=c(h.c,h.a),b(l,f,e)):h instanceof THREE.Face4&&(f=c(h.a,h.b),b(l,f,e),f=c(h.b,h.c),b(l,f,e),f=c(h.c,h.d),b(l,f,e),f=c(h.d,h.a),b(l,f,e));return l}(a);var A,E,C=0,B=l.length,L;for(v in x)if(w=x[v],y=w[0],A=
|
|
|
|
-w[1],L=v.split("_"),o=L[0],L=L[1],E=new THREE.Vector3,w.length!=2?(E.addSelf(l[o].position),E.addSelf(l[L].position),E.multiplyScalar(0.5)):(E.addSelf(t[y]),E.addSelf(t[A]),E.addSelf(l[o].position),E.addSelf(l[L].position),E.multiplyScalar(0.25)),u[v]=B+e.length+C,m.push(new THREE.Vertex(E)),C++,k.supportUVs&&p.length!=0)y=new THREE.UV,y.u=p[o].u+p[L].u,y.v=p[o].v+p[L].v,y.u/=2,y.v/=2,p.push(y);v=0;for(o=t.length;v<o;v++)w=e[v],y=B+v,w instanceof THREE.Face3?(A=c(w.a,w.b),L=c(w.b,w.c),C=c(w.c,w.a),
|
|
|
|
-b(y,u[A],w.b,u[L],w,["123","12","2","23"]),b(y,u[L],w.c,u[C],w,["123","23","3","31"]),b(y,u[C],w.a,u[A],w,["123","31","1","12"])):w instanceof THREE.Face4?(A=c(w.a,w.b),L=c(w.b,w.c),C=c(w.c,w.d),E=c(w.d,w.a),b(y,u[A],w.b,u[L],w,["1234","12","2","23"]),b(y,u[L],w.c,u[C],w,["1234","23","3","34"]),b(y,u[C],w.d,u[E],w,["1234","34","4","41"]),b(y,u[E],w.a,u[A],w,["1234","41","1","12"])):console.log("face should be a face!",w);var e=m,F={},G={},m=function(a,c){F[a]===void 0&&(F[a]=[]);F[a].push(c)},u=function(a,
|
|
|
|
-c){G[a]===void 0&&(G[a]={});G[a][c]=null};for(v in x)w=x[v],L=v.split("_"),o=L[0],L=L[1],m(o,[o,L]),m(L,[o,L]),y=w[0],A=w[1],u(o,y),A?u(o,A):u(o,y),u(L,y),A?u(L,A):u(L,y);m=new THREE.Vector3;u=new THREE.Vector3;v=0;for(o=l.length;v<o;v++)if(F[v]!==void 0){m.set(0,0,0);u.set(0,0,0);x=new THREE.Vector3(0,0,0);B=0;for(z in G[v])m.addSelf(t[z]),B++;m.divideScalar(B);B=F[v].length;for(z=0;z<B;z++)w=F[v][z],w=l[w[0]].position.clone().addSelf(l[w[1]].position).divideScalar(2),u.addSelf(w);u.divideScalar(B);
|
|
|
|
-x.addSelf(l[v].position);x.multiplyScalar(B-3);x.addSelf(m);x.addSelf(u.multiplyScalar(2));x.divideScalar(B);e[v].position=x}a.vertices=e;a.faces=f;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,c,b,e,l,n){var o=new THREE.Face4(a,c,b,e,null,l.color,l.material);if(k.useOldVertexColors){o.vertexColors=[];for(var m,p,u,v=0;v<4;v++){u=n[v];m=new THREE.Color;m.setRGB(0,0,0);for(var w=0;w<u.length;w++)p=l.vertexColors[u[w]-1],m.r+=p.r,m.g+=p.g,m.b+=p.b;m.r/=u.length;m.g/=u.length;m.b/=u.length;o.vertexColors[v]=m}}f.push(o);(!k.supportUVs||t.length!=0)&&h.push([t[a],t[c],t[b],t[e]])}function c(a,c){return Math.min(a,c)+"_"+Math.max(a,
|
|
|
|
+c)}var e=[],f=[],h=[],k=this,l=a.vertices,e=a.faces,n=l.concat(),p=[],u={},t=[],v,o,y,x,w,A=a.faceVertexUvs[0];v=0;for(o=A.length;v<o;v++){y=0;for(x=A[v].length;y<x;y++)w=e[v]["abcd".charAt(y)],t[w]||(t[w]=A[v][y])}var z;v=0;for(o=e.length;v<o;v++)if(w=e[v],p.push(w.centroid),n.push(new THREE.Vertex(w.centroid)),k.supportUVs&&t.length!=0){z=new THREE.UV;if(w instanceof THREE.Face3)z.u=t[w.a].u+t[w.b].u+t[w.c].u,z.v=t[w.a].v+t[w.b].v+t[w.c].v,z.u/=3,z.v/=3;else if(w instanceof THREE.Face4)z.u=t[w.a].u+
|
|
|
|
+t[w.b].u+t[w.c].u+t[w.d].u,z.v=t[w.a].v+t[w.b].v+t[w.c].v+t[w.d].v,z.u/=4,z.v/=4;t.push(z)}x=function(a){function b(a,c,e){a[c]===void 0&&(a[c]=[]);a[c].push(e)}var e,k,h,f,l={};e=0;for(k=a.faces.length;e<k;e++)h=a.faces[e],h instanceof THREE.Face3?(f=c(h.a,h.b),b(l,f,e),f=c(h.b,h.c),b(l,f,e),f=c(h.c,h.a),b(l,f,e)):h instanceof THREE.Face4&&(f=c(h.a,h.b),b(l,f,e),f=c(h.b,h.c),b(l,f,e),f=c(h.c,h.d),b(l,f,e),f=c(h.d,h.a),b(l,f,e));return l}(a);var C,B,K=0,A=l.length,F;for(v in x)if(w=x[v],z=w[0],C=
|
|
|
|
+w[1],F=v.split("_"),o=F[0],F=F[1],B=new THREE.Vector3,w.length!=2?(B.addSelf(l[o].position),B.addSelf(l[F].position),B.multiplyScalar(0.5)):(B.addSelf(p[z]),B.addSelf(p[C]),B.addSelf(l[o].position),B.addSelf(l[F].position),B.multiplyScalar(0.25)),u[v]=A+e.length+K,n.push(new THREE.Vertex(B)),K++,k.supportUVs&&t.length!=0)z=new THREE.UV,z.u=t[o].u+t[F].u,z.v=t[o].v+t[F].v,z.u/=2,z.v/=2,t.push(z);v=0;for(o=p.length;v<o;v++)w=e[v],z=A+v,w instanceof THREE.Face3?(C=c(w.a,w.b),F=c(w.b,w.c),K=c(w.c,w.a),
|
|
|
|
+b(z,u[C],w.b,u[F],w,["123","12","2","23"]),b(z,u[F],w.c,u[K],w,["123","23","3","31"]),b(z,u[K],w.a,u[C],w,["123","31","1","12"])):w instanceof THREE.Face4?(C=c(w.a,w.b),F=c(w.b,w.c),K=c(w.c,w.d),B=c(w.d,w.a),b(z,u[C],w.b,u[F],w,["1234","12","2","23"]),b(z,u[F],w.c,u[K],w,["1234","23","3","34"]),b(z,u[K],w.d,u[B],w,["1234","34","4","41"]),b(z,u[B],w.a,u[C],w,["1234","41","1","12"])):console.log("face should be a face!",w);var e=n,M={},E={},n=function(a,c){M[a]===void 0&&(M[a]=[]);M[a].push(c)},u=function(a,
|
|
|
|
+c){E[a]===void 0&&(E[a]={});E[a][c]=null};for(v in x)w=x[v],F=v.split("_"),o=F[0],F=F[1],n(o,[o,F]),n(F,[o,F]),z=w[0],C=w[1],u(o,z),C?u(o,C):u(o,z),u(F,z),C?u(F,C):u(F,z);n=new THREE.Vector3;u=new THREE.Vector3;v=0;for(o=l.length;v<o;v++)if(M[v]!==void 0){n.set(0,0,0);u.set(0,0,0);x=new THREE.Vector3(0,0,0);A=0;for(y in E[v])n.addSelf(p[y]),A++;n.divideScalar(A);A=M[v].length;for(y=0;y<A;y++)w=M[v][y],w=l[w[0]].position.clone().addSelf(l[w[1]].position).divideScalar(2),u.addSelf(w);u.divideScalar(A);
|
|
|
|
+x.addSelf(l[v].position);x.multiplyScalar(A-3);x.addSelf(n);x.addSelf(u.multiplyScalar(2));x.divideScalar(A);e[v].position=x}a.vertices=e;a.faces=f;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var e=0;e<b.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(b[e],c)},hasNormals:function(a){var b,c,e=a.materials.length;for(c=0;c<e;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)==
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var e=0;e<b.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(b[e],c)},hasNormals:function(a){var b,c,e=a.materials.length;for(c=0;c<e;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 e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));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.src=b}function f(a,c,k,h,f,l){var m=document.createElement("canvas");a[c]=new THREE.Texture(m);a[c].sourceFile=k;if(h){a[c].repeat.set(h[0],h[1]);if(h[0]!=1)a[c].wrapS=THREE.RepeatWrapping;
|
|
|
|
-if(h[1]!=1)a[c].wrapT=THREE.RepeatWrapping}f&&a[c].offset.set(f[0],f[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[c].wrapS=h[l[0]];if(h[l[1]]!==void 0)a[c].wrapT=h[l[1]]}e(a[c],b+"/"+k)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var k,l,m;l="MeshLambertMaterial";k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?l="MeshPhongMaterial":a.shading=="Basic"&&(l="MeshBasicMaterial"));
|
|
|
|
|
|
+a}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));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.src=b}function f(a,c,k,h,f,l){var n=document.createElement("canvas");a[c]=new THREE.Texture(n);a[c].sourceFile=k;if(h){a[c].repeat.set(h[0],h[1]);if(h[0]!=1)a[c].wrapS=THREE.RepeatWrapping;
|
|
|
|
+if(h[1]!=1)a[c].wrapT=THREE.RepeatWrapping}f&&a[c].offset.set(f[0],f[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[c].wrapS=h[l[0]];if(h[l[1]]!==void 0)a[c].wrapT=h[l[1]]}e(a[c],b+"/"+k)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var k,l,n;l="MeshLambertMaterial";k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?l="MeshPhongMaterial":a.shading=="Basic"&&(l="MeshBasicMaterial"));
|
|
if(a.blending)if(a.blending=="Additive")k.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")k.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")k.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;if(a.colorDiffuse)k.color=h(a.colorDiffuse);
|
|
if(a.blending)if(a.blending=="Additive")k.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")k.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")k.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;if(a.colorDiffuse)k.color=h(a.colorDiffuse);
|
|
else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=h(a.colorSpecular);if(a.colorAmbient)k.ambient=h(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=h(a.colorSpecular);if(a.colorAmbient)k.ambient=h(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
-a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var t=THREE.ShaderUtils.lib.normal,u=THREE.UniformsUtils.clone(t.uniforms),p=k.color;l=k.specular;m=k.ambient;var v=k.shininess;u.tNormal.texture=k.normalMap;if(a.mapNormalFactor)u.uNormalScale.value=a.mapNormalFactor;if(k.map)u.tDiffuse.texture=k.map,u.enableDiffuse.value=!0;if(k.specularMap)u.tSpecular.texture=k.specularMap,u.enableSpecular.value=!0;if(k.lightMap)u.tAO.texture=
|
|
|
|
-k.lightMap,u.enableAO.value=!0;u.uDiffuseColor.value.setHex(p);u.uSpecularColor.value.setHex(l);u.uAmbientColor.value.setHex(m);u.uShininess.value=v;if(k.opacity)u.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:u,lights:!0,fog:!0})}else k=new THREE[l](k);return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
|
|
|
+a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var p=THREE.ShaderUtils.lib.normal,u=THREE.UniformsUtils.clone(p.uniforms),t=k.color;l=k.specular;n=k.ambient;var v=k.shininess;u.tNormal.texture=k.normalMap;if(a.mapNormalFactor)u.uNormalScale.value=a.mapNormalFactor;if(k.map)u.tDiffuse.texture=k.map,u.enableDiffuse.value=!0;if(k.specularMap)u.tSpecular.texture=k.specularMap,u.enableSpecular.value=!0;if(k.lightMap)u.tAO.texture=
|
|
|
|
+k.lightMap,u.enableAO.value=!0;u.uDiffuseColor.value.setHex(t);u.uSpecularColor.value.setHex(l);u.uAmbientColor.value.setHex(n);u.uShininess.value=v;if(k.opacity)u.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:u,lights:!0,fog:!0})}else k=new THREE[l](k);return k}};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.supr=THREE.Loader.prototype;
|
|
THREE.BinaryLoader.prototype.load=function(a,b,c,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var f=a,a=f.model,b=f.callback,c=f.texture_path,e=f.bin_path}var c=c?c:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),f=Date.now(),a=new Worker(a),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
|
|
THREE.BinaryLoader.prototype.load=function(a,b,c,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var f=a,a=f.model,b=f.callback,c=f.texture_path,e=f.bin_path}var c=c?c:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),f=Date.now(),a=new Worker(a),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
|
|
b,e,c,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(f)};
|
|
b,e,c,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(f)};
|
|
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,e,f,h){var k=new XMLHttpRequest,l=e+"/"+a,m=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,c,f,b):alert("Couldn't load ["+l+"] ["+k.status+"]"):k.readyState==3?h&&(m==0&&(m=k.getResponseHeader("Content-Length")),h({total:m,loaded:k.responseText.length})):k.readyState==2&&(m=k.getResponseHeader("Content-Length"))};k.open("GET",l,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
|
|
|
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,e,f,h){var k=new XMLHttpRequest,l=e+"/"+a,n=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,c,f,b):alert("Couldn't load ["+l+"] ["+k.status+"]"):k.readyState==3?h&&(n==0&&(n=k.getResponseHeader("Content-Length")),h({total:n,loaded:k.responseText.length})):k.readyState==2&&(n=k.getResponseHeader("Content-Length"))};k.open("GET",l,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
|
|
k.setRequestHeader("Content-Type","text/plain");k.send(null)};
|
|
k.setRequestHeader("Content-Type","text/plain");k.send(null)};
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,e){var f=function(c){function b(a,c){var e=u(a,c),f=u(a,c+1),h=u(a,c+2),k=u(a,c+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function f(a,c){var b=u(a,c),e=u(a,c+1),h=u(a,c+2);return(u(a,c+3)<<24)+(h<<16)+(e<<8)+b}function m(a,c){var b=u(a,c);return(u(a,c+1)<<8)+b}function t(a,c){var b=u(a,c);return b>127?b-256:b}function u(a,c){return a.charCodeAt(c)&255}function p(c){var b,
|
|
|
|
-e,h;b=f(a,c);e=f(a,c+L);h=f(a,c+F);c=m(a,c+G);B.faces.push(new THREE.Face3(b,e,h,null,null,c))}function v(c){var b,e,h,k,n,o,p;b=f(a,c);e=f(a,c+L);h=f(a,c+F);k=m(a,c+G);n=f(a,c+N);o=f(a,c+R);p=f(a,c+H);var c=E[o*3],t=E[o*3+1];o=E[o*3+2];var u=E[p*3],v=E[p*3+1];p=E[p*3+2];B.faces.push(new THREE.Face3(b,e,h,[new THREE.Vector3(E[n*3],E[n*3+1],E[n*3+2]),new THREE.Vector3(c,t,o),new THREE.Vector3(u,v,p)],null,k))}function o(c){var b,e,h,k;b=f(a,c);e=f(a,c+S);h=f(a,c+J);k=f(a,c+V);c=m(a,c+X);B.faces.push(new THREE.Face4(b,
|
|
|
|
-e,h,k,null,null,c))}function z(c){var b,e,h,k,o,p,t,u,v;b=f(a,c);e=f(a,c+S);h=f(a,c+J);k=f(a,c+V);o=m(a,c+X);p=f(a,c+O);t=f(a,c+n);u=f(a,c+U);v=f(a,c+$);var c=E[t*3],w=E[t*3+1];t=E[t*3+2];var M=E[u*3],x=E[u*3+1];u=E[u*3+2];var ia=E[v*3],y=E[v*3+1];v=E[v*3+2];B.faces.push(new THREE.Face4(b,e,h,k,[new THREE.Vector3(E[p*3],E[p*3+1],E[p*3+2]),new THREE.Vector3(c,w,t),new THREE.Vector3(M,x,u),new THREE.Vector3(ia,y,v)],null,o))}function x(c){var b,e,h,k;b=f(a,c);e=f(a,c+aa);h=f(a,c+ca);c=C[b*2];k=C[b*
|
|
|
|
-2+1];b=C[e*2];var m=B.faceVertexUvs[0];e=C[e*2+1];var n=C[h*2];h=C[h*2+1];var o=[];o.push(new THREE.UV(c,k));o.push(new THREE.UV(b,e));o.push(new THREE.UV(n,h));m.push(o)}function w(c){var b,e,h,k,m,n;b=f(a,c);e=f(a,c+ea);h=f(a,c+la);k=f(a,c+ka);c=C[b*2];m=C[b*2+1];b=C[e*2];n=C[e*2+1];e=C[h*2];var o=B.faceVertexUvs[0];h=C[h*2+1];var p=C[k*2];k=C[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(b,n));t.push(new THREE.UV(e,h));t.push(new THREE.UV(p,k));o.push(t)}var B=this,y=0,A,E=[],C=
|
|
|
|
-[],L,F,G,N,R,H,S,J,V,X,O,n,U,$,aa,ca,ea,la,ka,Z,Q,T,fa,ga,qa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(B,e,c);A={signature:a.substr(y,8),header_bytes:u(a,y+8),vertex_coordinate_bytes:u(a,y+9),normal_coordinate_bytes:u(a,y+10),uv_coordinate_bytes:u(a,y+11),vertex_index_bytes:u(a,y+12),normal_index_bytes:u(a,y+13),uv_index_bytes:u(a,y+14),material_index_bytes:u(a,y+15),nvertices:f(a,y+16),nnormals:f(a,y+16+4),nuvs:f(a,y+16+8),ntri_flat:f(a,y+16+12),ntri_smooth:f(a,y+16+16),ntri_flat_uv:f(a,
|
|
|
|
-y+16+20),ntri_smooth_uv:f(a,y+16+24),nquad_flat:f(a,y+16+28),nquad_smooth:f(a,y+16+32),nquad_flat_uv:f(a,y+16+36),nquad_smooth_uv:f(a,y+16+40)};y+=A.header_bytes;L=A.vertex_index_bytes;F=A.vertex_index_bytes*2;G=A.vertex_index_bytes*3;N=A.vertex_index_bytes*3+A.material_index_bytes;R=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;H=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;S=A.vertex_index_bytes;J=A.vertex_index_bytes*2;V=A.vertex_index_bytes*3;X=A.vertex_index_bytes*
|
|
|
|
-4;O=A.vertex_index_bytes*4+A.material_index_bytes;n=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;U=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;$=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;aa=A.uv_index_bytes;ca=A.uv_index_bytes*2;ea=A.uv_index_bytes;la=A.uv_index_bytes*2;ka=A.uv_index_bytes*3;c=A.vertex_index_bytes*3+A.material_index_bytes;qa=A.vertex_index_bytes*4+A.material_index_bytes;Z=A.ntri_flat*c;Q=A.ntri_smooth*(c+A.normal_index_bytes*
|
|
|
|
-3);T=A.ntri_flat_uv*(c+A.uv_index_bytes*3);fa=A.ntri_smooth_uv*(c+A.normal_index_bytes*3+A.uv_index_bytes*3);ga=A.nquad_flat*qa;c=A.nquad_smooth*(qa+A.normal_index_bytes*4);qa=A.nquad_flat_uv*(qa+A.uv_index_bytes*4);y+=function(c){for(var e,h,f,l=A.vertex_coordinate_bytes*3,m=c+A.nvertices*l;c<m;c+=l)e=b(a,c),h=b(a,c+A.vertex_coordinate_bytes),f=b(a,c+A.vertex_coordinate_bytes*2),B.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,f)));return A.nvertices*l}(y);y+=function(c){for(var b,e,h,f=A.normal_coordinate_bytes*
|
|
|
|
-3,k=c+A.nnormals*f;c<k;c+=f)b=t(a,c),e=t(a,c+A.normal_coordinate_bytes),h=t(a,c+A.normal_coordinate_bytes*2),E.push(b/127,e/127,h/127);return A.nnormals*f}(y);y+=function(c){for(var e,h,f=A.uv_coordinate_bytes*2,l=c+A.nuvs*f;c<l;c+=f)e=b(a,c),h=b(a,c+A.uv_coordinate_bytes),C.push(e,h);return A.nuvs*f}(y);Z=y+Z;Q=Z+Q;T=Q+T;fa=T+fa;ga=fa+ga;c=ga+c;qa=c+qa;(function(a){var c,b=A.vertex_index_bytes*3+A.material_index_bytes,e=b+A.uv_index_bytes*3,h=a+A.ntri_flat_uv*e;for(c=a;c<h;c+=e)p(c),x(c+b);return h-
|
|
|
|
-a})(Q);(function(a){var c,b=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,e=b+A.uv_index_bytes*3,h=a+A.ntri_smooth_uv*e;for(c=a;c<h;c+=e)v(c),x(c+b);return h-a})(T);(function(a){var c,b=A.vertex_index_bytes*4+A.material_index_bytes,e=b+A.uv_index_bytes*4,h=a+A.nquad_flat_uv*e;for(c=a;c<h;c+=e)o(c),w(c+b);return h-a})(c);(function(a){var c,b=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,e=b+A.uv_index_bytes*4,h=a+A.nquad_smooth_uv*e;for(c=a;c<h;c+=e)z(c),
|
|
|
|
-w(c+b);return h-a})(qa);(function(a){var c,b=A.vertex_index_bytes*3+A.material_index_bytes,e=a+A.ntri_flat*b;for(c=a;c<e;c+=b)p(c);return e-a})(y);(function(a){var c,b=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,e=a+A.ntri_smooth*b;for(c=a;c<e;c+=b)v(c);return e-a})(Z);(function(a){var c,b=A.vertex_index_bytes*4+A.material_index_bytes,e=a+A.nquad_flat*b;for(c=a;c<e;c+=b)o(c);return e-a})(fa);(function(a){var c,b=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*
|
|
|
|
-4,e=a+A.nquad_smooth*b;for(c=a;c<e;c+=b)z(c);return e-a})(ga);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};
|
|
|
|
-THREE.ColladaLoader=function(){function a(a,e,f){Q=a;e=e||ga;f!==void 0&&(a=f.split("/"),a.pop(),Fa=a.length<1?"":a.join("/")+"/");oa=b("//dae:library_images/dae:image",k,"image");na=b("//dae:library_materials/dae:material",G,"material");pa=b("//dae:library_effects/dae:effect",J,"effect");ma=b("//dae:library_geometries/dae:geometry",w,"geometry");sa=b("//dae:library_controllers/dae:controller",l,"controller");da=b("//dae:library_animations/dae:animation",X,"animation");Ca=b(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
|
-u,"visual_scene");Ea=[];za=[];(a=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,$,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),fa=Ca[a]):fa=null;T=new THREE.Object3D;for(a=0;a<fa.nodes.length;a++)T.add(h(fa.nodes[a]));c();for(var m in da);m={scene:T,morphs:Ea,skins:za,dae:{images:oa,materials:na,effects:pa,geometries:ma,controllers:sa,animations:da,visualScenes:Ca,scene:fa}};e&&e(m);return m}function b(a,c,b){for(var a=Q.evaluate(a,Q,
|
|
|
|
-$,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},h=a.iterateNext(),f=0;h;){h=(new c).parse(h);if(h.id.length==0)h.id=b+f++;e[h.id]=h;h=a.iterateNext()}return e}function c(){var a=1E6,c=-a,b=0,e;for(e in da)for(var h=da[e],f=0;f<h.sampler.length;f++){var k=h.sampler[f];k.create();a=Math.min(a,k.startTime);c=Math.max(c,k.endTime);b=Math.max(b,k.input.length)}return{start:a,end:c,frames:b}}function e(a,c,b,h){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[b];f instanceof THREE.Matrix4&&a.world.copy(f)}h&&a.world.multiply(h,a.world);c.push(a);for(h=0;h<a.nodes.length;h++)e(a.nodes[h],c,b,a.world)}function f(a,b,h){var f=sa[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 k=c(),b=fa.getChildById(b.skeleton[0],!0)||fa.getChildBySid(b.skeleton[0],!0),l,m,n,o,p=new THREE.Vector3,
|
|
|
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,e){var f=function(c){function b(a,c){var e=u(a,c),f=u(a,c+1),h=u(a,c+2),k=u(a,c+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function f(a,c){var b=u(a,c),e=u(a,c+1),h=u(a,c+2);return(u(a,c+3)<<24)+(h<<16)+(e<<8)+b}function n(a,c){var b=u(a,c);return(u(a,c+1)<<8)+b}function p(a,c){var b=u(a,c);return b>127?b-256:b}function u(a,c){return a.charCodeAt(c)&255}function t(c){var b,
|
|
|
|
+e,h;b=f(a,c);e=f(a,c+F);h=f(a,c+M);c=n(a,c+E);A.faces.push(new THREE.Face3(b,e,h,null,null,c))}function v(c){var b,e,h,k,m,o,p;b=f(a,c);e=f(a,c+F);h=f(a,c+M);k=n(a,c+E);m=f(a,c+O);o=f(a,c+V);p=f(a,c+H);var c=B[o*3],t=B[o*3+1];o=B[o*3+2];var u=B[p*3],v=B[p*3+1];p=B[p*3+2];A.faces.push(new THREE.Face3(b,e,h,[new THREE.Vector3(B[m*3],B[m*3+1],B[m*3+2]),new THREE.Vector3(c,t,o),new THREE.Vector3(u,v,p)],null,k))}function o(c){var b,e,h,k;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);c=n(a,c+S);A.faces.push(new THREE.Face4(b,
|
|
|
|
+e,h,k,null,null,c))}function y(c){var b,e,h,k,o,p,t,u,v;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);o=n(a,c+S);p=f(a,c+m);t=f(a,c+aa);u=f(a,c+U);v=f(a,c+ea);var c=B[t*3],w=B[t*3+1];t=B[t*3+2];var G=B[u*3],x=B[u*3+1];u=B[u*3+2];var ma=B[v*3],I=B[v*3+1];v=B[v*3+2];A.faces.push(new THREE.Face4(b,e,h,k,[new THREE.Vector3(B[p*3],B[p*3+1],B[p*3+2]),new THREE.Vector3(c,w,t),new THREE.Vector3(G,x,u),new THREE.Vector3(ma,I,v)],null,o))}function x(c){var b,e,h,k;b=f(a,c);e=f(a,c+da);h=f(a,c+ia);c=K[b*2];k=K[b*
|
|
|
|
+2+1];b=K[e*2];var m=A.faceVertexUvs[0];e=K[e*2+1];var n=K[h*2];h=K[h*2+1];var o=[];o.push(new THREE.UV(c,k));o.push(new THREE.UV(b,e));o.push(new THREE.UV(n,h));m.push(o)}function w(c){var b,e,h,k,m,n;b=f(a,c);e=f(a,c+ha);h=f(a,c+ja);k=f(a,c+ca);c=K[b*2];m=K[b*2+1];b=K[e*2];n=K[e*2+1];e=K[h*2];var o=A.faceVertexUvs[0];h=K[h*2+1];var p=K[k*2];k=K[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(b,n));t.push(new THREE.UV(e,h));t.push(new THREE.UV(p,k));o.push(t)}var A=this,z=0,C,B=[],K=
|
|
|
|
+[],F,M,E,O,V,H,P,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z,R,Y,X,ga,oa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(A,e,c);C={signature:a.substr(z,8),header_bytes:u(a,z+8),vertex_coordinate_bytes:u(a,z+9),normal_coordinate_bytes:u(a,z+10),uv_coordinate_bytes:u(a,z+11),vertex_index_bytes:u(a,z+12),normal_index_bytes:u(a,z+13),uv_index_bytes:u(a,z+14),material_index_bytes:u(a,z+15),nvertices:f(a,z+16),nnormals:f(a,z+16+4),nuvs:f(a,z+16+8),ntri_flat:f(a,z+16+12),ntri_smooth:f(a,z+16+16),ntri_flat_uv:f(a,
|
|
|
|
+z+16+20),ntri_smooth_uv:f(a,z+16+24),nquad_flat:f(a,z+16+28),nquad_smooth:f(a,z+16+32),nquad_flat_uv:f(a,z+16+36),nquad_smooth_uv:f(a,z+16+40)};z+=C.header_bytes;F=C.vertex_index_bytes;M=C.vertex_index_bytes*2;E=C.vertex_index_bytes*3;O=C.vertex_index_bytes*3+C.material_index_bytes;V=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;H=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;P=C.vertex_index_bytes;L=C.vertex_index_bytes*2;T=C.vertex_index_bytes*3;S=C.vertex_index_bytes*
|
|
|
|
+4;m=C.vertex_index_bytes*4+C.material_index_bytes;aa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;U=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ea=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;da=C.uv_index_bytes;ia=C.uv_index_bytes*2;ha=C.uv_index_bytes;ja=C.uv_index_bytes*2;ca=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;oa=C.vertex_index_bytes*4+C.material_index_bytes;Z=C.ntri_flat*c;R=C.ntri_smooth*(c+
|
|
|
|
+C.normal_index_bytes*3);Y=C.ntri_flat_uv*(c+C.uv_index_bytes*3);X=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ga=C.nquad_flat*oa;c=C.nquad_smooth*(oa+C.normal_index_bytes*4);oa=C.nquad_flat_uv*(oa+C.uv_index_bytes*4);z+=function(c){for(var e,h,f,l=C.vertex_coordinate_bytes*3,m=c+C.nvertices*l;c<m;c+=l)e=b(a,c),h=b(a,c+C.vertex_coordinate_bytes),f=b(a,c+C.vertex_coordinate_bytes*2),A.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,f)));return C.nvertices*l}(z);z+=function(c){for(var b,
|
|
|
|
+e,h,f=C.normal_coordinate_bytes*3,k=c+C.nnormals*f;c<k;c+=f)b=p(a,c),e=p(a,c+C.normal_coordinate_bytes),h=p(a,c+C.normal_coordinate_bytes*2),B.push(b/127,e/127,h/127);return C.nnormals*f}(z);z+=function(c){for(var e,h,f=C.uv_coordinate_bytes*2,l=c+C.nuvs*f;c<l;c+=f)e=b(a,c),h=b(a,c+C.uv_coordinate_bytes),K.push(e,h);return C.nuvs*f}(z);Z=z+Z;R=Z+R;Y=R+Y;X=Y+X;ga=X+ga;c=ga+c;oa=c+oa;(function(a){var c,b=C.vertex_index_bytes*3+C.material_index_bytes,e=b+C.uv_index_bytes*3,h=a+C.ntri_flat_uv*e;for(c=
|
|
|
|
+a;c<h;c+=e)t(c),x(c+b);return h-a})(R);(function(a){var c,b=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=b+C.uv_index_bytes*3,h=a+C.ntri_smooth_uv*e;for(c=a;c<h;c+=e)v(c),x(c+b);return h-a})(Y);(function(a){var c,b=C.vertex_index_bytes*4+C.material_index_bytes,e=b+C.uv_index_bytes*4,h=a+C.nquad_flat_uv*e;for(c=a;c<h;c+=e)o(c),w(c+b);return h-a})(c);(function(a){var c,b=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,e=b+C.uv_index_bytes*4,h=a+C.nquad_smooth_uv*
|
|
|
|
+e;for(c=a;c<h;c+=e)y(c),w(c+b);return h-a})(oa);(function(a){var c,b=C.vertex_index_bytes*3+C.material_index_bytes,e=a+C.ntri_flat*b;for(c=a;c<e;c+=b)t(c);return e-a})(z);(function(a){var c,b=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=a+C.ntri_smooth*b;for(c=a;c<e;c+=b)v(c);return e-a})(Z);(function(a){var c,b=C.vertex_index_bytes*4+C.material_index_bytes,e=a+C.nquad_flat*b;for(c=a;c<e;c+=b)o(c);return e-a})(X);(function(a){var c,b=C.vertex_index_bytes*4+C.material_index_bytes+
|
|
|
|
+C.normal_index_bytes*4,e=a+C.nquad_smooth*b;for(c=a;c<e;c+=b)y(c);return e-a})(ga);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};
|
|
|
|
+THREE.ColladaLoader=function(){function a(a,e,f){R=a;e=e||ga;f!==void 0&&(a=f.split("/"),a.pop(),Ea=a.length<1?"":a.join("/")+"/");na=b("//dae:library_images/dae:image",k,"image");ua=b("//dae:library_materials/dae:material",E,"material");sa=b("//dae:library_effects/dae:effect",L,"effect");la=b("//dae:library_geometries/dae:geometry",w,"geometry");qa=b("//dae:library_controllers/dae:controller",l,"controller");fa=b("//dae:library_animations/dae:animation",S,"animation");Da=b(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
|
+u,"visual_scene");za=[];Fa=[];(a=R.evaluate(".//dae:scene/dae:instance_visual_scene",R,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),X=Da[a]):X=null;Y=new THREE.Object3D;for(a=0;a<X.nodes.length;a++)Y.add(h(X.nodes[a]));c();for(var m in fa);m={scene:Y,morphs:za,skins:Fa,dae:{images:na,materials:ua,effects:sa,geometries:la,controllers:qa,animations:fa,visualScenes:Da,scene:X}};e&&e(m);return m}function b(a,c,b){for(var a=R.evaluate(a,R,ea,
|
|
|
|
+XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},h=a.iterateNext(),f=0;h;){h=(new c).parse(h);if(h.id.length==0)h.id=b+f++;e[h.id]=h;h=a.iterateNext()}return e}function c(){var a=1E6,c=-a,b=0,e;for(e in fa)for(var h=fa[e],f=0;f<h.sampler.length;f++){var k=h.sampler[f];k.create();a=Math.min(a,k.startTime);c=Math.max(c,k.endTime);b=Math.max(b,k.input.length)}return{start:a,end:c,frames:b}}function e(a,c,b,h){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[b];f instanceof THREE.Matrix4&&a.world.copy(f)}h&&a.world.multiply(h,a.world);c.push(a);for(h=0;h<a.nodes.length;h++)e(a.nodes[h],c,b,a.world)}function f(a,b,h){var f=qa[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var k=c(),b=X.getChildById(b.skeleton[0],!0)||X.getChildBySid(b.skeleton[0],!0),l,m,n,o,p=new THREE.Vector3,
|
|
t;for(l=0;l<a.vertices.length;l++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(h=0;h<k.frames;h++){var u=[],v=[];for(l=0;l<a.vertices.length;l++)v.push(new THREE.Vertex(new THREE.Vector3));e(b,u,h);l=u;m=f.skin;for(o=0;o<l.length;o++)if(n=l[o],t=-1,n.type=="JOINT"){for(var w=0;w<m.joints.length;w++)if(n.sid==m.joints[w]){t=w;break}if(t>=0){w=m.invBindMatrices[t];n.invBindMatrix=w;n.skinningMatrix=new THREE.Matrix4;n.skinningMatrix.multiply(n.world,w);n.weights=[];for(w=0;w<m.weights.length;w++)for(var x=
|
|
t;for(l=0;l<a.vertices.length;l++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(h=0;h<k.frames;h++){var u=[],v=[];for(l=0;l<a.vertices.length;l++)v.push(new THREE.Vertex(new THREE.Vector3));e(b,u,h);l=u;m=f.skin;for(o=0;o<l.length;o++)if(n=l[o],t=-1,n.type=="JOINT"){for(var w=0;w<m.joints.length;w++)if(n.sid==m.joints[w]){t=w;break}if(t>=0){w=m.invBindMatrices[t];n.invBindMatrix=w;n.skinningMatrix=new THREE.Matrix4;n.skinningMatrix.multiply(n.world,w);n.weights=[];for(w=0;w<m.weights.length;w++)for(var x=
|
|
0;x<m.weights[w].length;x++){var y=m.weights[w][x];y.joint==t&&n.weights.push(y)}}else throw"ColladaLoader: Could not find joint '"+n.sid+"'.";}for(l=0;l<u.length;l++)if(u[l].type=="JOINT")for(m=0;m<u[l].weights.length;m++)n=u[l].weights[m],o=n.index,n=n.weight,t=a.vertices[o],o=v[o],p.x=t.position.x,p.y=t.position.y,p.z=t.position.z,u[l].skinningMatrix.multiplyVector3(p),o.position.x+=p.x*n,o.position.y+=p.y*n,o.position.z+=p.z*n;a.morphTargets.push({name:"target_"+h,vertices:v})}}}function h(a){var c=
|
|
0;x<m.weights[w].length;x++){var y=m.weights[w][x];y.joint==t&&n.weights.push(y)}}else throw"ColladaLoader: Could not find joint '"+n.sid+"'.";}for(l=0;l<u.length;l++)if(u[l].type=="JOINT")for(m=0;m<u[l].weights.length;m++)n=u[l].weights[m],o=n.index,n=n.weight,t=a.vertices[o],o=v[o],p.x=t.position.x,p.y=t.position.y,p.z=t.position.z,u[l].skinningMatrix.multiplyVector3(p),o.position.x+=p.x*n,o.position.y+=p.y*n,o.position.z+=p.z*n;a.morphTargets.push({name:"target_"+h,vertices:v})}}}function h(a){var c=
|
|
-new THREE.Object3D,b,e,k;c.name=a.id||"";c.matrixAutoUpdate=!1;c.matrix=a.matrix;for(k=0;k<a.controllers.length;k++){var l=sa[a.controllers[k].url];switch(l.type){case "skin":if(ma[l.skin.source]){var m=new x;m.url=l.skin.source;m.instance_material=a.controllers[k].instance_material;a.geometries.push(m);b=a.controllers[k]}else if(sa[l.skin.source]&&(e=l=sa[l.skin.source],l.morph&&ma[l.morph.source]))m=new x,m.url=l.morph.source,m.instance_material=a.controllers[k].instance_material,a.geometries.push(m);
|
|
|
|
-break;case "morph":if(ma[l.morph.source])m=new x,m.url=l.morph.source,m.instance_material=a.controllers[k].instance_material,a.geometries.push(m),e=a.controllers[k];console.log("ColladaLoader: Morph-controller partially supported.")}}for(k=0;k<a.geometries.length;k++){var l=a.geometries[k],m=l.instance_material,l=ma[l.url],n={},p=0,t;if(l&&l.mesh&&l.mesh.primitives){if(c.name.length==0)c.name=l.id;if(m)for(j=0;j<m.length;j++){t=m[j];var u=pa[na[t.target].instance_effect.url].shader;u.material.opacity=
|
|
|
|
-!u.material.opacity?1:u.material.opacity;t=n[t.symbol]=u.material;p++}m=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});l=l.mesh.geometry3js;if(p>1){m=new THREE.MeshFaceMaterial;for(j=0;j<l.faces.length;j++)p=l.faces[j],p.materials=[n[p.daeMaterial]]}if(b!==void 0)f(l,b),m.morphTargets=!0,m=new THREE.SkinnedMesh(l,m),m.skeleton=b.skeleton,m.skinController=sa[b.url],m.skinInstanceController=b,m.name="skin_"+za.length,za.push(m);else if(e!==void 0){n=l;p=e instanceof o?
|
|
|
|
-sa[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");else{p=p.morph;for(u=0;u<p.targets.length;u++){var v=ma[p.targets[u]];if(v.mesh&&v.mesh.primitives&&v.mesh.primitives.length)v=v.mesh.primitives[0].geometry,v.vertices.length===n.vertices.length&&n.morphTargets.push({name:"target_1",vertices:v.vertices})}n.morphTargets.push({name:"target_Z",vertices:n.vertices})}m.morphTargets=!0;m=new THREE.Mesh(l,m);m.name="morph_"+Ea.length;Ea.push(m)}else m=new THREE.Mesh(l,m);c.add(m)}}for(k=
|
|
|
|
-0;k<a.nodes.length;k++)c.add(h(a.nodes[k],a));return c}function k(){this.init_from=this.id=""}function l(){this.type=this.name=this.id="";this.morph=this.skin=null}function m(){this.weights=this.targets=this.source=this.method=null}function t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){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 v(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function w(){this.id="";this.mesh=null}function B(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function y(){}function A(){this.material="";this.count=0;this.inputs=
|
|
|
|
-[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function E(){this.source="";this.stride=this.count=0;this.params=[]}function C(){this.input={}}function L(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function G(){this.name=this.id="";this.instance_effect=null}function N(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function R(a,c){this.type=
|
|
|
|
-a;this.effect=c;this.material=null}function H(a){this.effect=a;this.format=this.init_from=null}function S(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function V(){this.url=""}function X(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function O(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
|
|
|
|
-this.sid=null}function n(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function U(a){var c=a.getAttribute("id");if(qa[c]!=void 0)return qa[c];qa[c]=(new F(c)).parse(a);return qa[c]}function $(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function aa(a){for(var a=ea(a),c=[],b=0;b<a.length;b++)c.push(parseFloat(a[b]));return c}function ca(a){for(var a=ea(a),c=[],b=0;b<a.length;b++)c.push(parseInt(a[b],
|
|
|
|
-10));return c}function ea(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function la(a,c,b){return a.hasAttribute(c)?parseInt(a.getAttribute(c),10):b}function ka(a,c){if(a===void 0){for(var b="0.";b.length<c+2;)b+="0";return b}c=c||2;b=a.toString().split(".");for(b[1]=b.length>1?b[1].substr(0,c):"0";b[1].length<c;)b[1]+="0";return b.join(".")}function Z(a,c){var b="";b+=ka(a.x,c)+",";b+=ka(a.y,c)+",";b+=ka(a.z,c);return b}var Q=null,T=null,fa,ga=null,qa={},oa={},da={},sa={},ma={},
|
|
|
|
-na={},pa={},Ca,Fa,Ea,za,Da=THREE.SmoothShading;k.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="init_from")this.init_from=b.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "skin":this.skin=(new t).parse(b);this.type=b.nodeName;break;case "morph":this.morph=
|
|
|
|
-(new m).parse(b),this.type=b.nodeName}}return this};m.prototype.parse=function(a){var c={},b=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var h=a.childNodes[e];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new F).parse(h);c[h.id]=h;break;case "targets":b=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(e=0;e<b.length;e++)switch(a=b[e],h=c[a.source],a.semantic){case "MORPH_TARGET":this.targets=
|
|
|
|
-h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};m.prototype.parseInputs=function(a){for(var c=[],b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":c.push((new L).parse(e))}}return c};t.prototype.parse=function(a){var c={},b,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<a.childNodes.length;h++){var f=a.childNodes[h];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=
|
|
|
|
-aa(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new F).parse(f);c[f.id]=f;break;case "joints":b=f;break;case "vertex_weights":e=f;break;default:console.log(f.nodeName)}}this.parseJoints(b,c);this.parseWeights(e,c);return this};t.prototype.parseJoints=function(a,c){for(var b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":var e=
|
|
|
|
-(new L).parse(e),h=c[e.source];if(e.semantic=="JOINT")this.joints=h.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};t.prototype.parseWeights=function(a,c){for(var b,e,h=[],f=0;f<a.childNodes.length;f++){var k=a.childNodes[f];if(k.nodeType==1)switch(k.nodeName){case "input":h.push((new L).parse(k));break;case "v":b=ca(k.textContent);break;case "vcount":e=ca(k.textContent)}}for(f=k=0;f<e.length;f++){for(var l=e[f],m=[],n=0;n<l;n++){for(var o={},p=0;p<h.length;p++){var t=
|
|
|
|
|
|
+new THREE.Object3D,b,e,k;c.name=a.id||"";c.matrixAutoUpdate=!1;c.matrix=a.matrix;for(k=0;k<a.controllers.length;k++){var l=qa[a.controllers[k].url];switch(l.type){case "skin":if(la[l.skin.source]){var m=new x;m.url=l.skin.source;m.instance_material=a.controllers[k].instance_material;a.geometries.push(m);b=a.controllers[k]}else if(qa[l.skin.source]&&(e=l=qa[l.skin.source],l.morph&&la[l.morph.source]))m=new x,m.url=l.morph.source,m.instance_material=a.controllers[k].instance_material,a.geometries.push(m);
|
|
|
|
+break;case "morph":if(la[l.morph.source])m=new x,m.url=l.morph.source,m.instance_material=a.controllers[k].instance_material,a.geometries.push(m),e=a.controllers[k];console.log("ColladaLoader: Morph-controller partially supported.")}}for(k=0;k<a.geometries.length;k++){var l=a.geometries[k],m=l.instance_material,l=la[l.url],n={},p=0,t;if(l&&l.mesh&&l.mesh.primitives){if(c.name.length==0)c.name=l.id;if(m)for(j=0;j<m.length;j++){t=m[j];var u=sa[ua[t.target].instance_effect.url].shader;u.material.opacity=
|
|
|
|
+!u.material.opacity?1:u.material.opacity;t=n[t.symbol]=u.material;p++}m=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});l=l.mesh.geometry3js;if(p>1){m=new THREE.MeshFaceMaterial;for(j=0;j<l.faces.length;j++)p=l.faces[j],p.materials=[n[p.daeMaterial]]}if(b!==void 0)f(l,b),m.morphTargets=!0,m=new THREE.SkinnedMesh(l,m),m.skeleton=b.skeleton,m.skinController=qa[b.url],m.skinInstanceController=b,m.name="skin_"+Fa.length,Fa.push(m);else if(e!==void 0){n=l;p=e instanceof o?
|
|
|
|
+qa[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");else{p=p.morph;for(u=0;u<p.targets.length;u++){var v=la[p.targets[u]];if(v.mesh&&v.mesh.primitives&&v.mesh.primitives.length)v=v.mesh.primitives[0].geometry,v.vertices.length===n.vertices.length&&n.morphTargets.push({name:"target_1",vertices:v.vertices})}n.morphTargets.push({name:"target_Z",vertices:n.vertices})}m.morphTargets=!0;m=new THREE.Mesh(l,m);m.name="morph_"+za.length;za.push(m)}else m=new THREE.Mesh(l,m);c.add(m)}}for(k=
|
|
|
|
+0;k<a.nodes.length;k++)c.add(h(a.nodes[k],a));return c}function k(){this.init_from=this.id=""}function l(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function t(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=
|
|
|
|
+[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function v(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function y(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function w(){this.id="";this.mesh=null}function A(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function z(){}function C(){this.material="";this.count=0;this.inputs=
|
|
|
|
+[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function B(){this.source="";this.stride=this.count=0;this.params=[]}function K(){this.input={}}function F(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function O(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function V(a,c){this.type=
|
|
|
|
+a;this.effect=c;this.material=null}function H(a){this.effect=a;this.format=this.init_from=null}function P(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function L(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function T(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function m(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
|
|
|
|
+this.sid=null}function aa(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function U(a){var c=a.getAttribute("id");if(oa[c]!=void 0)return oa[c];oa[c]=(new M(c)).parse(a);return oa[c]}function ea(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function da(a){for(var a=ha(a),c=[],b=0;b<a.length;b++)c.push(parseFloat(a[b]));return c}function ia(a){for(var a=ha(a),c=[],b=0;b<a.length;b++)c.push(parseInt(a[b],
|
|
|
|
+10));return c}function ha(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function ja(a,c,b){return a.hasAttribute(c)?parseInt(a.getAttribute(c),10):b}function ca(a,c){if(a===void 0){for(var b="0.";b.length<c+2;)b+="0";return b}c=c||2;b=a.toString().split(".");for(b[1]=b.length>1?b[1].substr(0,c):"0";b[1].length<c;)b[1]+="0";return b.join(".")}function Z(a,c){var b="";b+=ca(a.x,c)+",";b+=ca(a.y,c)+",";b+=ca(a.z,c);return b}var R=null,Y=null,X,ga=null,oa={},na={},fa={},qa={},la={},ua=
|
|
|
|
+{},sa={},Da,Ea,za,Fa,xa=THREE.SmoothShading;k.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="init_from")this.init_from=b.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "skin":this.skin=(new p).parse(b);this.type=b.nodeName;break;case "morph":this.morph=
|
|
|
|
+(new n).parse(b),this.type=b.nodeName}}return this};n.prototype.parse=function(a){var c={},b=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var h=a.childNodes[e];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new M).parse(h);c[h.id]=h;break;case "targets":b=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(e=0;e<b.length;e++)switch(a=b[e],h=c[a.source],a.semantic){case "MORPH_TARGET":this.targets=
|
|
|
|
+h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=function(a){for(var c=[],b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":c.push((new F).parse(e))}}return c};p.prototype.parse=function(a){var c={},b,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<a.childNodes.length;h++){var f=a.childNodes[h];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=
|
|
|
|
+da(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new M).parse(f);c[f.id]=f;break;case "joints":b=f;break;case "vertex_weights":e=f;break;default:console.log(f.nodeName)}}this.parseJoints(b,c);this.parseWeights(e,c);return this};p.prototype.parseJoints=function(a,c){for(var b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":var e=
|
|
|
|
+(new F).parse(e),h=c[e.source];if(e.semantic=="JOINT")this.joints=h.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};p.prototype.parseWeights=function(a,c){for(var b,e,h=[],f=0;f<a.childNodes.length;f++){var k=a.childNodes[f];if(k.nodeType==1)switch(k.nodeName){case "input":h.push((new F).parse(k));break;case "v":b=ia(k.textContent);break;case "vcount":e=ia(k.textContent)}}for(f=k=0;f<e.length;f++){for(var l=e[f],m=[],n=0;n<l;n++){for(var o={},p=0;p<h.length;p++){var t=
|
|
h[p],u=b[k+t.offset];switch(t.semantic){case "JOINT":o.joint=u;break;case "WEIGHT":o.weight=c[t.source].data[u]}}m.push(o);k+=h.length}for(n=0;n<m.length;n++)m[n].index=f;this.weights.push(m)}};u.prototype.getChildById=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};u.prototype.getChildBySid=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};u.prototype.parse=function(a){this.id=
|
|
h[p],u=b[k+t.offset];switch(t.semantic){case "JOINT":o.joint=u;break;case "WEIGHT":o.weight=c[t.source].data[u]}}m.push(o);k+=h.length}for(n=0;n<m.length;n++)m[n].index=f;this.weights.push(m)}};u.prototype.getChildById=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};u.prototype.getChildBySid=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};u.prototype.parse=function(a){this.id=
|
|
-a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b))}}return this};p.prototype.getChannelForTransform=function(a){for(var c=0;c<this.channels.length;c++){var b=this.channels[c],e=b.target.split("/");e.shift();var h=e.shift(),f=h.indexOf(".")>=0,k=h.indexOf("(")>=0,l;if(f)e=h.split("."),h=e.shift(),e.shift();else if(k){l=h.split("(");h=l.shift();
|
|
|
|
-for(e=0;e<l.length;e++)l[e]=parseInt(l[e].replace(/\)/,""))}if(h==a)return b.info={sid:h,dotSyntax:f,arrSyntax:k,arrIndices:l},b}return null};p.prototype.getChildById=function(a,c){if(this.id==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};p.prototype.getChildBySid=function(a,c){if(this.sid==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};p.prototype.getTransformBySid=
|
|
|
|
-function(a){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==a)return this.transforms[c];return null};p.prototype.parse=function(a){var c;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var b=0;b<a.childNodes.length;b++)if(c=a.childNodes[b],c.nodeType==
|
|
|
|
-1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new o).parse(c));break;case "instance_geometry":this.geometries.push((new x).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",Q,$,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new v).parse(c));
|
|
|
|
-break;case "extra":break;default:console.log(c.nodeName)}a=[];b=1E6;c=-1E6;for(var e in da)for(var h=da[e],f=0;f<h.channel.length;f++){var k=h.channel[f],l=h.sampler[f];e=k.target.split("/")[0];if(e==this.id)l.create(),k.sampler=l,b=Math.min(b,l.startTime),c=Math.max(c,l.endTime),a.push(k)}if(a.length)this.startTime=b,this.endTime=c;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(b=0;b<a.input.length-1;b++)e=Math.min(e,a.input[b+
|
|
|
|
-1]-a.input[b])}b=[];for(a=this.startTime;a<this.endTime;a+=e){c=a;for(var h={},m=f=void 0,f=0;f<this.channels.length;f++)m=this.channels[f],h[m.sid]=m;k=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(l=this.transforms[f],m=h[l.sid],m!==void 0){for(var n=m.sampler,t,m=0;m<n.input.length-1;m++)if(n.input[m+1]>c){t=n.output[m];break}k=t!==void 0?t instanceof THREE.Matrix4?k.multiply(k,t):k.multiply(k,l.matrix):k.multiply(k,l.matrix)}else k=k.multiply(k,l.matrix);c=k;b.push({time:a,pos:[c.n14,
|
|
|
|
-c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};v.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=aa(a.textContent);this.updateMatrix();return this};v.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
|
|
|
|
-this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
|
|
|
|
-o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "skeleton":this.skeleton.push(b.textContent.replace(/^#/,""));break;case "bind_material":if(b=Q.evaluate(".//dae:instance_material",b,$,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=b.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=b.iterateNext()}}return this};
|
|
|
|
-z.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};x.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1&&b.nodeName=="bind_material"){if(a=Q.evaluate(".//dae:instance_material",b,$,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=a.iterateNext();c;)this.instance_material.push((new z).parse(c)),
|
|
|
|
-c=a.iterateNext();break}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "mesh":this.mesh=(new B(this)).parse(b)}}return this};B.prototype.parse=function(a){function c(a,b){var e=Z(a.position);h[e]===void 0&&(h[e]={v:a,index:b});return h[e]}this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];switch(e.nodeName){case "source":U(e);break;case "vertices":this.vertices=
|
|
|
|
-(new C).parse(e);break;case "triangles":this.primitives.push((new A).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new y).parse(e))}}var h={};this.geometry3js=new THREE.Geometry;e=qa[this.vertices.input.POSITION.source].data;for(a=b=0;b<e.length;b+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(e[b],e[b+1],e[b+2]));c(f,a);this.geometry3js.vertices.push(f)}for(b=0;b<this.primitives.length;b++)primitive=this.primitives[b],primitive.setVertices(this.vertices),
|
|
|
|
-this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};B.prototype.handlePrimitive=function(a,c,b){var e=0,h,f,k=a.p,l=a.inputs,m,n,o,p=0,t=3,u=[];for(h=0;h<l.length;h++)switch(m=l[h],m.semantic){case "TEXCOORD":u.push(m.set)}for(;e<k.length;){var v=[],w=[],x={},y=[];a.vcount&&(t=a.vcount[p++]);for(h=0;h<t;h++)for(f=0;f<l.length;f++)switch(m=
|
|
|
|
-l[f],source=qa[m.source],n=k[e+h*l.length+m.offset],numParams=source.accessor.params.length,o=n*numParams,m.semantic){case "VERTEX":m=Z(c.vertices[n].position);v.push(b[m].index);break;case "NORMAL":w.push(new THREE.Vector3(source.data[o],source.data[o+1],source.data[o+2]));break;case "TEXCOORD":x[m.set]===void 0&&(x[m.set]=[]);x[m.set].push(new THREE.UV(source.data[o],source.data[o+1]));break;case "COLOR":y.push((new THREE.Color).setRGB(source.data[o],source.data[o+1],source.data[o+2]))}var z;t==
|
|
|
|
-3?z=new THREE.Face3(v[0],v[1],v[2],[w[0],w[1],w[2]],y.length?y:new THREE.Color):t==4&&(z=new THREE.Face4(v[0],v[1],v[2],v[3],[w[0],w[1],w[2],w[3]],y.length?y:new THREE.Color));z.daeMaterial=a.material;c.faces.push(z);for(f=0;f<u.length;f++)h=x[u[f]],c.faceVertexUvs[f].push([h[0],h[1],h[2]]);e+=l.length*t}};y.prototype=new A;y.prototype.constructor=y;A.prototype.setVertices=function(a){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==a.id)this.inputs[c].source=a.input.POSITION.source};
|
|
|
|
-A.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=la(a,"count",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "input":this.inputs.push((new L).parse(a.childNodes[c]));break;case "vcount":this.vcount=ca(b.textContent);break;case "p":this.p=ca(b.textContent)}}return this};E.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(a,"stride",0);for(var c=
|
|
|
|
-0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="param"){var e={};e.name=b.getAttribute("name");e.type=b.getAttribute("type");this.params.push(e)}}return this};C.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++)a.childNodes[c].nodeName=="input"&&(input=(new L).parse(a.childNodes[c]),this.input[input.semantic]=input);return this};L.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
|
-"");this.set=la(a,"set",-1);this.offset=la(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "bool_array":for(var e=ea(b.textContent),h=[],f=0;f<e.length;f++)h.push(e[f]=="true"||e[f]=="1"?!0:!1);this.data=h;this.type=b.nodeName;break;case "float_array":this.data=aa(b.textContent);this.type=b.nodeName;break;case "int_array":this.data=
|
|
|
|
-ca(b.textContent);this.type=b.nodeName;break;case "IDREF_array":case "Name_array":this.data=ea(b.textContent);this.type=b.nodeName;break;case "technique_common":for(e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="accessor"){this.accessor=(new E).parse(b.childNodes[e]);break}}}return this};F.prototype.read=function(){var a=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var b=
|
|
|
|
-this.data.slice(c,c+16),e=new THREE.Matrix4;e.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+c.type+".")}return a};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new V).parse(a.childNodes[c]);break}return this};N.prototype.isColor=
|
|
|
|
-function(){return this.texture==null};N.prototype.isTexture=function(){return this.texture!=null};N.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "color":b=aa(b.textContent);this.color=new THREE.Color(0);this.color.setRGB(b[0],b[1],b[2]);this.color.a=b[3];break;case "texture":this.texture=b.getAttribute("texture"),this.texcoord=b.getAttribute("texcoord")}}return this};R.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=
|
|
|
|
-a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=(new N).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=Q.evaluate(".//dae:float",b,$,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=e.iterateNext(),f=[];h;)f.push(h),h=e.iterateNext();e=f;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};R.prototype.create=function(){var a=
|
|
|
|
-{},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof N)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=oa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Fa+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=
|
|
|
|
-e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=Da;return this.material=new THREE.MeshLambertMaterial(a)};H.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=b.textContent;break;case "format":this.format=b.textContent;break;default:console.log("unhandled Surface prop: "+
|
|
|
|
-b.nodeName)}}return this};S.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":this.source=b.textContent;break;case "minfilter":this.minfilter=b.textContent;break;case "magfilter":this.magfilter=b.textContent;break;case "mipfilter":this.mipfilter=b.textContent;break;case "wrap_s":this.wrap_s=b.textContent;break;case "wrap_t":this.wrap_t=b.textContent;break;default:console.log("unhandled Sampler2D prop: "+b.nodeName)}}return this};
|
|
|
|
-J.prototype.create=function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(b))}}return this};J.prototype.parseNewparam=function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=
|
|
|
|
-(new H(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new S(this)).parse(e);this.sampler.sid=c;break;case "extra":break;default:console.log(e.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var c,b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);break;case "technique":c=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return c};
|
|
|
|
-J.prototype.parseTechnique=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new R(b.nodeName,this)).parse(b)}}};V.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};X.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":b=
|
|
|
|
-(new F).parse(b);this.source[b.id]=b;break;case "sampler":this.sampler.push((new n(this)).parse(b));break;case "channel":this.channel.push((new O(this)).parse(b))}}return this};O.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var c=this.target.split("/");c.shift();var a=c.shift(),b=a.indexOf(".")>=0,e=a.indexOf("(")>=0,h,f;if(b)c=a.split("."),a=c.shift(),f=c.shift();else if(e){h=a.split("(");a=h.shift();for(c=0;c<h.length;c++)h[c]=
|
|
|
|
-parseInt(h[c].replace(/\)/,""))}this.sid=a;this.dotSyntax=b;this.arrSyntax=e;this.arrIndices=h;this.member=f;return this};n.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "input":this.inputs.push((new L).parse(b))}}return this};n.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var c=this.inputs[a],b=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=
|
|
|
|
-b.read();break;case "OUTPUT":this.output=b.read();break;case "INTERPOLATION":this.interpolation=b.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(c,b){if(document.implementation&&
|
|
|
|
-document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);c+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==200))ga=b,a(e.responseXML,void 0,c)};e.open("GET",c,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Da=a},applySkin:f,geometries:ma}};
|
|
|
|
-THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
|
|
|
+a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new t).parse(b))}}return this};t.prototype.getChannelForTransform=function(a){for(var c=0;c<this.channels.length;c++){var b=this.channels[c],e=b.target.split("/");e.shift();var h=e.shift(),f=h.indexOf(".")>=0,k=h.indexOf("(")>=0,l;if(f)e=h.split("."),h=e.shift(),e.shift();else if(k){l=h.split("(");h=l.shift();
|
|
|
|
+for(e=0;e<l.length;e++)l[e]=parseInt(l[e].replace(/\)/,""))}if(h==a)return b.info={sid:h,dotSyntax:f,arrSyntax:k,arrIndices:l},b}return null};t.prototype.getChildById=function(a,c){if(this.id==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};t.prototype.getChildBySid=function(a,c){if(this.sid==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};t.prototype.getTransformBySid=
|
|
|
|
+function(a){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==a)return this.transforms[c];return null};t.prototype.parse=function(a){var c;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var b=0;b<a.childNodes.length;b++)if(c=a.childNodes[b],c.nodeType==
|
|
|
|
+1)switch(c.nodeName){case "node":this.nodes.push((new t).parse(c));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new o).parse(c));break;case "instance_geometry":this.geometries.push((new x).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=R.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",R,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new t).parse(c));break;
|
|
|
|
+case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new v).parse(c));break;case "extra":break;default:console.log(c.nodeName)}a=[];b=1E6;c=-1E6;for(var e in fa)for(var h=fa[e],f=0;f<h.channel.length;f++){var k=h.channel[f],l=h.sampler[f];e=k.target.split("/")[0];if(e==this.id)l.create(),k.sampler=l,b=Math.min(b,l.startTime),c=Math.max(c,l.endTime),a.push(k)}if(a.length)this.startTime=b,this.endTime=c;if((this.channels=a)&&this.channels.length){e=
|
|
|
|
+1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(b=0;b<a.input.length-1;b++)e=Math.min(e,a.input[b+1]-a.input[b])}b=[];for(a=this.startTime;a<this.endTime;a+=e){c=a;for(var h={},m=f=void 0,f=0;f<this.channels.length;f++)m=this.channels[f],h[m.sid]=m;k=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(l=this.transforms[f],m=h[l.sid],m!==void 0){for(var n=m.sampler,p,m=0;m<n.input.length-1;m++)if(n.input[m+1]>c){p=n.output[m];break}k=p!==void 0?p instanceof THREE.Matrix4?
|
|
|
|
+k.multiply(k,p):k.multiply(k,l.matrix):k.multiply(k,l.matrix)}else k=k.multiply(k,l.matrix);c=k;b.push({time:a,pos:[c.n14,c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};t.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};v.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=da(a.textContent);this.updateMatrix();return this};
|
|
|
|
+v.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],
|
|
|
|
+this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "skeleton":this.skeleton.push(b.textContent.replace(/^#/,""));break;case "bind_material":if(b=R.evaluate(".//dae:instance_material",b,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
|
+null))for(var e=b.iterateNext();e;)this.instance_material.push((new y).parse(e)),e=b.iterateNext()}}return this};y.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};x.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1&&b.nodeName=="bind_material"){if(a=R.evaluate(".//dae:instance_material",
|
|
|
|
+b,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=a.iterateNext();c;)this.instance_material.push((new y).parse(c)),c=a.iterateNext();break}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "mesh":this.mesh=(new A(this)).parse(b)}}return this};A.prototype.parse=function(a){function c(a,b){var e=Z(a.position);h[e]===void 0&&(h[e]={v:a,index:b});return h[e]}this.primitives=[];var b;for(b=
|
|
|
|
+0;b<a.childNodes.length;b++){var e=a.childNodes[b];switch(e.nodeName){case "source":U(e);break;case "vertices":this.vertices=(new K).parse(e);break;case "triangles":this.primitives.push((new C).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new z).parse(e))}}var h={};this.geometry3js=new THREE.Geometry;e=oa[this.vertices.input.POSITION.source].data;for(a=b=0;b<e.length;b+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(e[b],e[b+
|
|
|
|
+1],e[b+2]));c(f,a);this.geometry3js.vertices.push(f)}for(b=0;b<this.primitives.length;b++)primitive=this.primitives[b],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(a,c,b){var e=0,h,f,k=a.p,l=a.inputs,m,n,o,p=0,t=3,u=[];for(h=0;h<l.length;h++)switch(m=l[h],
|
|
|
|
+m.semantic){case "TEXCOORD":u.push(m.set)}for(;e<k.length;){var v=[],w=[],x={},y=[];a.vcount&&(t=a.vcount[p++]);for(h=0;h<t;h++)for(f=0;f<l.length;f++)switch(m=l[f],source=oa[m.source],n=k[e+h*l.length+m.offset],numParams=source.accessor.params.length,o=n*numParams,m.semantic){case "VERTEX":m=Z(c.vertices[n].position);v.push(b[m].index);break;case "NORMAL":w.push(new THREE.Vector3(source.data[o],source.data[o+1],source.data[o+2]));break;case "TEXCOORD":x[m.set]===void 0&&(x[m.set]=[]);x[m.set].push(new THREE.UV(source.data[o],
|
|
|
|
+source.data[o+1]));break;case "COLOR":y.push((new THREE.Color).setRGB(source.data[o],source.data[o+1],source.data[o+2]))}var z;t==3?z=new THREE.Face3(v[0],v[1],v[2],[w[0],w[1],w[2]],y.length?y:new THREE.Color):t==4&&(z=new THREE.Face4(v[0],v[1],v[2],v[3],[w[0],w[1],w[2],w[3]],y.length?y:new THREE.Color));z.daeMaterial=a.material;c.faces.push(z);for(f=0;f<u.length;f++)h=x[u[f]],c.faceVertexUvs[f].push([h[0],h[1],h[2]]);e+=l.length*t}};z.prototype=new C;z.prototype.constructor=z;C.prototype.setVertices=
|
|
|
|
+function(a){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==a.id)this.inputs[c].source=a.input.POSITION.source};C.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=ja(a,"count",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "input":this.inputs.push((new F).parse(a.childNodes[c]));break;case "vcount":this.vcount=ia(b.textContent);break;case "p":this.p=ia(b.textContent)}}return this};B.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 c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="param"){var e={};e.name=b.getAttribute("name");e.type=b.getAttribute("type");this.params.push(e)}}return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++)a.childNodes[c].nodeName=="input"&&(input=(new F).parse(a.childNodes[c]),this.input[input.semantic]=
|
|
|
|
+input);return this};F.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(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};M.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "bool_array":for(var e=ha(b.textContent),h=[],f=0;f<e.length;f++)h.push(e[f]=="true"||e[f]=="1"?
|
|
|
|
+!0:!1);this.data=h;this.type=b.nodeName;break;case "float_array":this.data=da(b.textContent);this.type=b.nodeName;break;case "int_array":this.data=ia(b.textContent);this.type=b.nodeName;break;case "IDREF_array":case "Name_array":this.data=ha(b.textContent);this.type=b.nodeName;break;case "technique_common":for(e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="accessor"){this.accessor=(new B).parse(b.childNodes[e]);break}}}return this};M.prototype.read=function(){var a=[],c=this.accessor.params[0];
|
|
|
|
+switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var b=this.data.slice(c,c+16),e=new THREE.Matrix4;e.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+c.type+".")}return a};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeName==
|
|
|
|
+"instance_effect"){this.instance_effect=(new T).parse(a.childNodes[c]);break}return this};O.prototype.isColor=function(){return this.texture==null};O.prototype.isTexture=function(){return this.texture!=null};O.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "color":b=da(b.textContent);this.color=new THREE.Color(0);this.color.setRGB(b[0],b[1],b[2]);this.color.a=b[3];break;case "texture":this.texture=b.getAttribute("texture"),
|
|
|
|
+this.texcoord=b.getAttribute("texcoord")}}return this};V.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=(new O).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=R.evaluate(".//dae:float",b,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=e.iterateNext(),f=[];h;)f.push(h),h=e.iterateNext();
|
|
|
|
+e=f;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};V.prototype.create=function(){var a={},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof O)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=na[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Ea+e.init_from),
|
|
|
|
+a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=xa;return this.material=new THREE.MeshLambertMaterial(a)};H.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=
|
|
|
|
+b.textContent;break;case "format":this.format=b.textContent;break;default:console.log("unhandled Surface prop: "+b.nodeName)}}return this};P.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":this.source=b.textContent;break;case "minfilter":this.minfilter=b.textContent;break;case "magfilter":this.magfilter=b.textContent;break;case "mipfilter":this.mipfilter=b.textContent;break;case "wrap_s":this.wrap_s=b.textContent;
|
|
|
|
+break;case "wrap_t":this.wrap_t=b.textContent;break;default:console.log("unhandled Sampler2D prop: "+b.nodeName)}}return this};L.prototype.create=function(){if(this.shader==null)return null};L.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(b))}}return this};L.prototype.parseNewparam=
|
|
|
|
+function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new H(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new P(this)).parse(e);this.sampler.sid=c;break;case "extra":break;default:console.log(e.nodeName)}}};L.prototype.parseProfileCOMMON=function(a){for(var c,b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
|
|
|
|
+break;case "technique":c=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return c};L.prototype.parseTechnique=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new V(b.nodeName,this)).parse(b)}}};T.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};S.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
|
+this.name=a.getAttribute("name");this.source={};for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":b=(new M).parse(b);this.source[b.id]=b;break;case "sampler":this.sampler.push((new aa(this)).parse(b));break;case "channel":this.channel.push((new m(this)).parse(b))}}return this};m.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var c=this.target.split("/");c.shift();var a=
|
|
|
|
+c.shift(),b=a.indexOf(".")>=0,e=a.indexOf("(")>=0,h,f;if(b)c=a.split("."),a=c.shift(),f=c.shift();else if(e){h=a.split("(");a=h.shift();for(c=0;c<h.length;c++)h[c]=parseInt(h[c].replace(/\)/,""))}this.sid=a;this.dotSyntax=b;this.arrSyntax=e;this.arrIndices=h;this.member=f;return this};aa.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "input":this.inputs.push((new F).parse(b))}}return this};
|
|
|
|
+aa.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var c=this.inputs[a],b=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=b.read();break;case "OUTPUT":this.output=b.read();break;case "INTERPOLATION":this.interpolation=b.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
|
|
|
|
+Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(c,b){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);c+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
|
|
|
|
+200))ga=b,a(e.responseXML,void 0,c)};e.open("GET",c,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){xa=a},applySkin:f,geometries:la}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
THREE.JSONLoader.prototype.load=function(a,b,c){var e,f=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,b=e.callback,c=e.texture_path;e=new Worker(a);c=c?c:this.extractUrlbase(a);e.onmessage=function(a){f.createModel(a.data,b,c);f.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
|
|
THREE.JSONLoader.prototype.load=function(a,b,c){var e,f=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,b=e.callback,c=e.texture_path;e=new Worker(a);c=c?c:this.extractUrlbase(a);e.onmessage=function(a){f.createModel(a.data,b,c);f.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,f,m,t,u,p,v,o,z,x,w,B,y,A,E=a.faces;p=a.vertices;var C=a.normals,L=a.colors,F=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&F++;for(b=0;b<F;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];t=0;for(u=p.length;t<u;)v=new THREE.Vertex,v.position.x=p[t++]*c,v.position.y=
|
|
|
|
-p[t++]*c,v.position.z=p[t++]*c,e.vertices.push(v);t=0;for(u=E.length;t<u;){c=E[t++];p=c&1;m=c&2;b=c&4;f=c&8;o=c&16;v=c&32;x=c&64;c&=128;p?(w=new THREE.Face4,w.a=E[t++],w.b=E[t++],w.c=E[t++],w.d=E[t++],p=4):(w=new THREE.Face3,w.a=E[t++],w.b=E[t++],w.c=E[t++],p=3);if(m)m=E[t++],w.materialIndex=m;m=e.faces.length;if(b)for(b=0;b<F;b++)B=a.uvs[b],z=E[t++],A=B[z*2],z=B[z*2+1],e.faceUvs[b][m]=new THREE.UV(A,z);if(f)for(b=0;b<F;b++){B=a.uvs[b];y=[];for(f=0;f<p;f++)z=E[t++],A=B[z*2],z=B[z*2+1],y[f]=new THREE.UV(A,
|
|
|
|
-z);e.faceVertexUvs[b][m]=y}if(o)o=E[t++]*3,f=new THREE.Vector3,f.x=C[o++],f.y=C[o++],f.z=C[o],w.normal=f;if(v)for(b=0;b<p;b++)o=E[t++]*3,f=new THREE.Vector3,f.x=C[o++],f.y=C[o++],f.z=C[o],w.vertexNormals.push(f);if(x)v=E[t++],v=new THREE.Color(L[v]),w.color=v;if(c)for(b=0;b<p;b++)v=E[t++],v=new THREE.Color(L[v]),w.vertexColors.push(v);e.faces.push(w)}}})(f);(function(){var c,b,f,m;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)f=a.skinWeights[c],m=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
|
|
|
|
-m,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)f=a.skinIndices[c],m=a.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,m,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,f,m,t,u,p,v,o,z;b=0;for(f=a.morphTargets.length;b<f;b++){e.morphTargets[b]={};e.morphTargets[b].name=a.morphTargets[b].name;e.morphTargets[b].vertices=[];o=e.morphTargets[b].vertices;z=a.morphTargets[b].vertices;m=0;for(t=z.length;m<t;m+=3)u=z[m]*c,p=z[m+1]*
|
|
|
|
-c,v=z[m+2]*c,o.push(new THREE.Vertex(new THREE.Vector3(u,p,v)))}}if(a.morphColors!==void 0){b=0;for(f=a.morphColors.length;b<f;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];t=e.morphColors[b].colors;u=a.morphColors[b].colors;c=0;for(m=u.length;c<m;c+=3)p=new THREE.Color(16755200),p.setRGB(u[c],u[c+1],u[c+2]),t.push(p)}}})(f);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};
|
|
|
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,f,n,p,u,t,v,o,y,x,w,A,z,C,B=a.faces;t=a.vertices;var K=a.normals,F=a.colors,M=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&M++;for(b=0;b<M;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];p=0;for(u=t.length;p<u;)v=new THREE.Vertex,v.position.x=t[p++]*c,v.position.y=
|
|
|
|
+t[p++]*c,v.position.z=t[p++]*c,e.vertices.push(v);p=0;for(u=B.length;p<u;){c=B[p++];t=c&1;n=c&2;b=c&4;f=c&8;o=c&16;v=c&32;x=c&64;c&=128;t?(w=new THREE.Face4,w.a=B[p++],w.b=B[p++],w.c=B[p++],w.d=B[p++],t=4):(w=new THREE.Face3,w.a=B[p++],w.b=B[p++],w.c=B[p++],t=3);if(n)n=B[p++],w.materialIndex=n;n=e.faces.length;if(b)for(b=0;b<M;b++)A=a.uvs[b],y=B[p++],C=A[y*2],y=A[y*2+1],e.faceUvs[b][n]=new THREE.UV(C,y);if(f)for(b=0;b<M;b++){A=a.uvs[b];z=[];for(f=0;f<t;f++)y=B[p++],C=A[y*2],y=A[y*2+1],z[f]=new THREE.UV(C,
|
|
|
|
+y);e.faceVertexUvs[b][n]=z}if(o)o=B[p++]*3,f=new THREE.Vector3,f.x=K[o++],f.y=K[o++],f.z=K[o],w.normal=f;if(v)for(b=0;b<t;b++)o=B[p++]*3,f=new THREE.Vector3,f.x=K[o++],f.y=K[o++],f.z=K[o],w.vertexNormals.push(f);if(x)v=B[p++],v=new THREE.Color(F[v]),w.color=v;if(c)for(b=0;b<t;b++)v=B[p++],v=new THREE.Color(F[v]),w.vertexColors.push(v);e.faces.push(w)}}})(f);(function(){var c,b,f,n;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)f=a.skinWeights[c],n=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
|
|
|
|
+n,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)f=a.skinIndices[c],n=a.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,n,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,f,n,p,u,t,v,o,y;b=0;for(f=a.morphTargets.length;b<f;b++){e.morphTargets[b]={};e.morphTargets[b].name=a.morphTargets[b].name;e.morphTargets[b].vertices=[];o=e.morphTargets[b].vertices;y=a.morphTargets[b].vertices;n=0;for(p=y.length;n<p;n+=3)u=y[n]*c,t=y[n+1]*
|
|
|
|
+c,v=y[n+2]*c,o.push(new THREE.Vertex(new THREE.Vector3(u,t,v)))}}if(a.morphColors!==void 0){b=0;for(f=a.morphColors.length;b<f;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];p=e.morphColors[b].colors;u=a.morphColors[b].colors;c=0;for(n=u.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(u[c],u[c+1],u[c+2]),p.push(t)}}})(f);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
-THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:f+"/"+a}function l(){for(o in S.objects)if(!U.objects[o])if(y=S.objects[o],y.geometry!==void 0){if(L=U.geometries[y.geometry]){var a=!1;for(aa=0;aa<y.materials.length;aa++)R=U.materials[y.materials[aa]],a=R instanceof THREE.ShaderMaterial;a&&L.computeTangents();A=y.position;r=y.rotation;q=y.quaternion;
|
|
|
|
-s=y.scale;q=0;R.length==0&&(R=new THREE.MeshFaceMaterial);R.length>1&&(R=new THREE.MeshFaceMaterial);object=new THREE.Mesh(L,R);object.name=o;object.position.set(A[0],A[1],A[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible;U.scene.add(object);U.objects[o]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),U.scene.collisions.colliders.push(a));if(y.castsShadow)a=
|
|
|
|
-new THREE.ShadowVolume(L),U.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},U.triggers[object.name]=a)}}else A=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=o,object.position.set(A[0],A[1],A[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
|
|
|
|
-y.visible!==void 0?y.visible:!1,U.scene.add(object),U.objects[o]=object,U.empties[o]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},U.triggers[object.name]=a)}function m(a){return function(b){U.geometries[a]=b;l();V-=1;c.onLoadComplete();u()}}function t(a){return function(c){U.geometries[a]=c}}function u(){c.callbackProgress({totalModels:O,totalTextures:n,loadedModels:O-V,loadedTextures:n-X},U);c.onLoadProgress();V==0&&X==0&&b(U)}var p,v,o,z,x,w,B,y,A,E,C,L,F,G,N,
|
|
|
|
-R,H,S,J,V,X,O,n,U;S=a.data;N=new THREE.BinaryLoader;J=new THREE.JSONLoader;X=V=0;U={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(o in S.objects)if(y=S.objects[o],y.meshCollider){a=!0;break}if(a)U.scene.collisions=new THREE.CollisionSystem;if(S.transform){a=S.transform.position;E=S.transform.rotation;var $=S.transform.scale;a&&U.scene.position.set(a[0],a[1],a[2]);E&&U.scene.rotation.set(E[0],E[1],E[2]);$&&U.scene.scale.set($[0],
|
|
|
|
-$[1],$[2]);(a||E||$)&&U.scene.updateMatrix()}a=function(){X-=1;u();c.onLoadComplete()};for(x in S.cameras)E=S.cameras[x],E.type=="perspective"?F=new THREE.PerspectiveCamera(E.fov,E.aspect,E.near,E.far):E.type=="ortho"&&(F=new THREE.OrthographicCamera(E.left,E.right,E.top,E.bottom,E.near,E.far)),A=E.position,E=E.target,F.position.set(A[0],A[1],A[2]),F.target=new THREE.Vector3(E[0],E[1],E[2]),U.cameras[x]=F;for(z in S.lights)x=S.lights[z],F=x.color!==void 0?x.color:16777215,E=x.intensity!==void 0?x.intensity:
|
|
|
|
-1,x.type=="directional"?(A=x.direction,H=new THREE.DirectionalLight(F,E),H.position.set(A[0],A[1],A[2]),H.position.normalize()):x.type=="point"?(A=x.position,d=x.distance,H=new THREE.PointLight(F,E,d),H.position.set(A[0],A[1],A[2])):x.type=="ambient"&&(H=new THREE.AmbientLight(F)),U.scene.add(H),U.lights[z]=H;for(w in S.fogs)z=S.fogs[w],z.type=="linear"?G=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(G=new THREE.FogExp2(0,z.density)),E=z.color,G.color.setRGB(E[0],E[1],E[2]),U.fogs[w]=G;if(U.cameras&&
|
|
|
|
-S.defaults.camera)U.currentCamera=U.cameras[S.defaults.camera];if(U.fogs&&S.defaults.fog)U.scene.fog=U.fogs[S.defaults.fog];E=S.defaults.bgcolor;U.bgColor=new THREE.Color;U.bgColor.setRGB(E[0],E[1],E[2]);U.bgColorAlpha=S.defaults.bgalpha;for(p in S.geometries)if(w=S.geometries[p],w.type=="bin_mesh"||w.type=="ascii_mesh")V+=1,c.onLoadStart();O=V;for(p in S.geometries)w=S.geometries[p],w.type=="cube"?(L=new THREE.CubeGeometry(w.width,w.height,w.depth,w.segmentsWidth,w.segmentsHeight,w.segmentsDepth,
|
|
|
|
-null,w.flipped,w.sides),U.geometries[p]=L):w.type=="plane"?(L=new THREE.PlaneGeometry(w.width,w.height,w.segmentsWidth,w.segmentsHeight),U.geometries[p]=L):w.type=="sphere"?(L=new THREE.SphereGeometry(w.radius,w.segmentsWidth,w.segmentsHeight),U.geometries[p]=L):w.type=="cylinder"?(L=new THREE.CylinderGeometry(w.topRad,w.botRad,w.height,w.radSegs,w.heightSegs),U.geometries[p]=L):w.type=="torus"?(L=new THREE.TorusGeometry(w.radius,w.tube,w.segmentsR,w.segmentsT),U.geometries[p]=L):w.type=="icosahedron"?
|
|
|
|
-(L=new THREE.IcosahedronGeometry(w.subdivisions),U.geometries[p]=L):w.type=="bin_mesh"?N.load(e(w.url,S.urlBaseType),m(p)):w.type=="ascii_mesh"?J.load(e(w.url,S.urlBaseType),m(p)):w.type=="embedded_mesh"&&(w=S.embeds[w.id])&&J.createModel(w,t(p),"");for(B in S.textures)if(p=S.textures[B],p.url instanceof Array){X+=p.url.length;for(N=0;N<p.url.length;N++)c.onLoadStart()}else X+=1,c.onLoadStart();n=X;for(B in S.textures){p=S.textures[B];if(p.mapping!=void 0&&THREE[p.mapping]!=void 0)p.mapping=new THREE[p.mapping];
|
|
|
|
-if(p.url instanceof Array){N=[];for(var aa=0;aa<p.url.length;aa++)N[aa]=e(p.url[aa],S.urlBaseType);N=THREE.ImageUtils.loadTextureCube(N,p.mapping,a)}else{N=THREE.ImageUtils.loadTexture(e(p.url,S.urlBaseType),p.mapping,a);if(THREE[p.minFilter]!=void 0)N.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)N.magFilter=THREE[p.magFilter];if(p.repeat){N.repeat.set(p.repeat[0],p.repeat[1]);if(p.repeat[0]!=1)N.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)N.wrapT=THREE.RepeatWrapping}p.offset&&N.offset.set(p.offset[0],
|
|
|
|
-p.offset[1]);if(p.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[p.wrap[0]]!==void 0)N.wrapS=J[p.wrap[0]];if(J[p.wrap[1]]!==void 0)N.wrapT=J[p.wrap[1]]}}U.textures[B]=N}for(v in S.materials){B=S.materials[v];for(C in B.parameters)if(C=="envMap"||C=="map"||C=="lightMap")B.parameters[C]=U.textures[B.parameters[C]];else if(C=="shading")B.parameters[C]=B.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C=="blending")B.parameters[C]=THREE[B.parameters[C]]?
|
|
|
|
-THREE[B.parameters[C]]:THREE.NormalBlending;else if(C=="combine")B.parameters[C]=B.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(B.parameters[C]=="face")B.parameters[C]=THREE.FaceColors;else if(B.parameters[C])B.parameters[C]=THREE.VertexColors;if(B.parameters.opacity!==void 0&&B.parameters.opacity<1)B.parameters.transparent=!0;if(B.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);N=B.parameters.color;
|
|
|
|
-J=B.parameters.specular;w=B.parameters.ambient;G=B.parameters.shininess;a.tNormal.texture=U.textures[B.parameters.normalMap];if(B.parameters.normalMapFactor)a.uNormalScale.value=B.parameters.normalMapFactor;if(B.parameters.map)a.tDiffuse.texture=B.parameters.map,a.enableDiffuse.value=!0;if(B.parameters.lightMap)a.tAO.texture=B.parameters.lightMap,a.enableAO.value=!0;if(B.parameters.specularMap)a.tSpecular.texture=U.textures[B.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(N);
|
|
|
|
-a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(w);a.uShininess.value=G;if(B.parameters.opacity)a.uOpacity.value=B.parameters.opacity;B=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})}else B=new THREE[B.type](B.parameters);U.materials[v]=B}l();c.callbackSync(U)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
|
|
|
+THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:f+"/"+a}function l(){for(o in P.objects)if(!U.objects[o])if(z=P.objects[o],z.geometry!==void 0){if(F=U.geometries[z.geometry]){var a=!1;for(da=0;da<z.materials.length;da++)V=U.materials[z.materials[da]],a=V instanceof THREE.ShaderMaterial;a&&F.computeTangents();C=z.position;r=z.rotation;q=z.quaternion;
|
|
|
|
+s=z.scale;q=0;V.length==0&&(V=new THREE.MeshFaceMaterial);V.length>1&&(V=new THREE.MeshFaceMaterial);object=new THREE.Mesh(F,V);object.name=o;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=z.visible;U.scene.add(object);U.objects[o]=object;z.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),U.scene.collisions.colliders.push(a));if(z.castsShadow)a=
|
|
|
|
+new THREE.ShadowVolume(F),U.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},U.triggers[object.name]=a)}}else C=z.position,r=z.rotation,q=z.quaternion,s=z.scale,q=0,object=new THREE.Object3D,object.name=o,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
|
|
|
|
+z.visible!==void 0?z.visible:!1,U.scene.add(object),U.objects[o]=object,U.empties[o]=object,z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},U.triggers[object.name]=a)}function n(a){return function(b){U.geometries[a]=b;l();T-=1;c.onLoadComplete();u()}}function p(a){return function(c){U.geometries[a]=c}}function u(){c.callbackProgress({totalModels:m,totalTextures:aa,loadedModels:m-T,loadedTextures:aa-S},U);c.onLoadProgress();T==0&&S==0&&b(U)}var t,v,o,y,x,w,A,z,C,B,K,F,M,E,
|
|
|
|
+O,V,H,P,L,T,S,m,aa,U;P=a.data;O=new THREE.BinaryLoader;L=new THREE.JSONLoader;S=T=0;U={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(o in P.objects)if(z=P.objects[o],z.meshCollider){a=!0;break}if(a)U.scene.collisions=new THREE.CollisionSystem;if(P.transform){a=P.transform.position;B=P.transform.rotation;var ea=P.transform.scale;a&&U.scene.position.set(a[0],a[1],a[2]);B&&U.scene.rotation.set(B[0],B[1],B[2]);ea&&
|
|
|
|
+U.scene.scale.set(ea[0],ea[1],ea[2]);(a||B||ea)&&U.scene.updateMatrix()}a=function(){S-=1;u();c.onLoadComplete()};for(x in P.cameras)B=P.cameras[x],B.type=="perspective"?M=new THREE.PerspectiveCamera(B.fov,B.aspect,B.near,B.far):B.type=="ortho"&&(M=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far)),C=B.position,B=B.target,M.position.set(C[0],C[1],C[2]),M.target=new THREE.Vector3(B[0],B[1],B[2]),U.cameras[x]=M;for(y in P.lights)x=P.lights[y],M=x.color!==void 0?x.color:16777215,
|
|
|
|
+B=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(C=x.direction,H=new THREE.DirectionalLight(M,B),H.position.set(C[0],C[1],C[2]),H.position.normalize()):x.type=="point"?(C=x.position,d=x.distance,H=new THREE.PointLight(M,B,d),H.position.set(C[0],C[1],C[2])):x.type=="ambient"&&(H=new THREE.AmbientLight(M)),U.scene.add(H),U.lights[y]=H;for(w in P.fogs)y=P.fogs[w],y.type=="linear"?E=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(E=new THREE.FogExp2(0,y.density)),B=y.color,E.color.setRGB(B[0],
|
|
|
|
+B[1],B[2]),U.fogs[w]=E;if(U.cameras&&P.defaults.camera)U.currentCamera=U.cameras[P.defaults.camera];if(U.fogs&&P.defaults.fog)U.scene.fog=U.fogs[P.defaults.fog];B=P.defaults.bgcolor;U.bgColor=new THREE.Color;U.bgColor.setRGB(B[0],B[1],B[2]);U.bgColorAlpha=P.defaults.bgalpha;for(t in P.geometries)if(w=P.geometries[t],w.type=="bin_mesh"||w.type=="ascii_mesh")T+=1,c.onLoadStart();m=T;for(t in P.geometries)w=P.geometries[t],w.type=="cube"?(F=new THREE.CubeGeometry(w.width,w.height,w.depth,w.segmentsWidth,
|
|
|
|
+w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides),U.geometries[t]=F):w.type=="plane"?(F=new THREE.PlaneGeometry(w.width,w.height,w.segmentsWidth,w.segmentsHeight),U.geometries[t]=F):w.type=="sphere"?(F=new THREE.SphereGeometry(w.radius,w.segmentsWidth,w.segmentsHeight),U.geometries[t]=F):w.type=="cylinder"?(F=new THREE.CylinderGeometry(w.topRad,w.botRad,w.height,w.radSegs,w.heightSegs),U.geometries[t]=F):w.type=="torus"?(F=new THREE.TorusGeometry(w.radius,w.tube,w.segmentsR,w.segmentsT),U.geometries[t]=
|
|
|
|
+F):w.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(w.subdivisions),U.geometries[t]=F):w.type=="bin_mesh"?O.load(e(w.url,P.urlBaseType),n(t)):w.type=="ascii_mesh"?L.load(e(w.url,P.urlBaseType),n(t)):w.type=="embedded_mesh"&&(w=P.embeds[w.id])&&L.createModel(w,p(t),"");for(A in P.textures)if(t=P.textures[A],t.url instanceof Array){S+=t.url.length;for(O=0;O<t.url.length;O++)c.onLoadStart()}else S+=1,c.onLoadStart();aa=S;for(A in P.textures){t=P.textures[A];if(t.mapping!=void 0&&THREE[t.mapping]!=
|
|
|
|
+void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){O=[];for(var da=0;da<t.url.length;da++)O[da]=e(t.url[da],P.urlBaseType);O=THREE.ImageUtils.loadTextureCube(O,t.mapping,a)}else{O=THREE.ImageUtils.loadTexture(e(t.url,P.urlBaseType),t.mapping,a);if(THREE[t.minFilter]!=void 0)O.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)O.magFilter=THREE[t.magFilter];if(t.repeat){O.repeat.set(t.repeat[0],t.repeat[1]);if(t.repeat[0]!=1)O.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)O.wrapT=
|
|
|
|
+THREE.RepeatWrapping}t.offset&&O.offset.set(t.offset[0],t.offset[1]);if(t.wrap){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(L[t.wrap[0]]!==void 0)O.wrapS=L[t.wrap[0]];if(L[t.wrap[1]]!==void 0)O.wrapT=L[t.wrap[1]]}}U.textures[A]=O}for(v in P.materials){A=P.materials[v];for(K in A.parameters)if(K=="envMap"||K=="map"||K=="lightMap")A.parameters[K]=U.textures[A.parameters[K]];else if(K=="shading")A.parameters[K]=A.parameters[K]=="flat"?THREE.FlatShading:THREE.SmoothShading;
|
|
|
|
+else if(K=="blending")A.parameters[K]=THREE[A.parameters[K]]?THREE[A.parameters[K]]:THREE.NormalBlending;else if(K=="combine")A.parameters[K]=A.parameters[K]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(K=="vertexColors")if(A.parameters[K]=="face")A.parameters[K]=THREE.FaceColors;else if(A.parameters[K])A.parameters[K]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=!0;if(A.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;
|
|
|
|
+a=THREE.UniformsUtils.clone(t.uniforms);O=A.parameters.color;L=A.parameters.specular;w=A.parameters.ambient;E=A.parameters.shininess;a.tNormal.texture=U.textures[A.parameters.normalMap];if(A.parameters.normalMapFactor)a.uNormalScale.value=A.parameters.normalMapFactor;if(A.parameters.map)a.tDiffuse.texture=A.parameters.map,a.enableDiffuse.value=!0;if(A.parameters.lightMap)a.tAO.texture=A.parameters.lightMap,a.enableAO.value=!0;if(A.parameters.specularMap)a.tSpecular.texture=U.textures[A.parameters.specularMap],
|
|
|
|
+a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(O);a.uSpecularColor.value.setHex(L);a.uAmbientColor.value.setHex(w);a.uShininess.value=E;if(A.parameters.opacity)a.uOpacity.value=A.parameters.opacity;A=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:a,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);U.materials[v]=A}l();c.callbackSync(U)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
|
|
|
|
+THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var e=new XMLHttpRequest,f=c.scale!==void 0?c.scale:1,h=c.offsetX!==void 0?c.offsetX:0,k=c.offsetY!==void 0?c.offsetY:0,l=c.offsetZ!==void 0?c.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var e=new XMLHttpRequest,f=c.scale!==void 0?c.scale:1,h=c.offsetX!==void 0?c.offsetX:0,k=c.offsetY!==void 0?c.offsetY:0,l=c.offsetZ!==void 0?c.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
|
|
b,f,h,k,l):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,f=0;f<8;f++){for(var h=0,k=0;k<b;++k){var l=a.charCodeAt(k+e);h+=l>>1^-(l&1);c[8*k+f]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(f=k=0;f<b;f++)l=a.charCodeAt(f+e),h[f]=k-l,l==0&&k++;return[c,h]};
|
|
b,f,h,k,l):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,f=0;f<8;f++){for(var h=0,k=0;k<b;++k){var l=a.charCodeAt(k+e);h+=l>>1^-(l&1);c[8*k+f]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(f=k=0;f<b;f++)l=a.charCodeAt(f+e),h[f]=k-l,l==0&&k++;return[c,h]};
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,e,f,h){var k=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(a),t=[],u=[];(function(a,k,m){for(var t,u,w,B=a.length;m<B;m+=k)t=a[m],u=a[m+1],w=a[m+2],t=t/16383*c,u=u/16383*c,w=w/16383*c,t+=e,u+=f,w+=h,b.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,w)))})(k[0],8,0);(function(a,c,b){for(var e,f,h=a.length;b<h;b+=c)e=a[b],f=a[b+1],e/=1023,f/=1023,u.push(e,1-f)})(k[0],8,3);(function(a,
|
|
|
|
-c,b){for(var e,f,h,k=a.length;b<k;b+=c)e=a[b],f=a[b+1],h=a[b+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,t.push(e,f,h)})(k[0],8,5);(function(a){var c,e,f,h,k,m,y,A,E,C=a.length;for(c=0;c<C;c+=3){e=a[c];f=a[c+1];h=a[c+2];k=b;A=e;E=f;m=h;y=e;var L=f,F=h,G=k.materials[0],N=t[L*3],R=t[L*3+1],L=t[L*3+2],H=t[F*3],S=t[F*3+1],F=t[F*3+2];y=new THREE.Vector3(t[y*3],t[y*3+1],t[y*3+2]);L=new THREE.Vector3(N,R,L);F=new THREE.Vector3(H,S,F);k.faces.push(new THREE.Face3(A,E,m,[y,L,F],null,G));k=u[e*2];e=u[e*2+
|
|
|
|
-1];m=u[f*2];y=u[f*2+1];A=u[h*2];E=u[h*2+1];h=b.faceVertexUvs[0];f=m;m=y;y=[];y.push(new THREE.UV(k,e));y.push(new THREE.UV(f,m));y.push(new THREE.UV(A,E));h.push(y)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;b(new k)};
|
|
|
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,e,f,h){var k=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(a),p=[],u=[];(function(a,k,n){for(var p,u,w,A=a.length;n<A;n+=k)p=a[n],u=a[n+1],w=a[n+2],p=p/16383*c,u=u/16383*c,w=w/16383*c,p+=e,u+=f,w+=h,b.vertices.push(new THREE.Vertex(new THREE.Vector3(p,u,w)))})(k[0],8,0);(function(a,c,b){for(var e,f,h=a.length;b<h;b+=c)e=a[b],f=a[b+1],e/=1023,f/=1023,u.push(e,1-f)})(k[0],8,3);(function(a,
|
|
|
|
+c,b){for(var e,f,h,k=a.length;b<k;b+=c)e=a[b],f=a[b+1],h=a[b+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,p.push(e,f,h)})(k[0],8,5);(function(a){var c,e,f,h,k,n,z,C,B,K=a.length;for(c=0;c<K;c+=3){e=a[c];f=a[c+1];h=a[c+2];k=b;C=e;B=f;n=h;z=e;var F=f,M=h,E=k.materials[0],O=p[F*3],V=p[F*3+1],F=p[F*3+2],H=p[M*3],P=p[M*3+1],M=p[M*3+2];z=new THREE.Vector3(p[z*3],p[z*3+1],p[z*3+2]);F=new THREE.Vector3(O,V,F);M=new THREE.Vector3(H,P,M);k.faces.push(new THREE.Face3(C,B,n,[z,F,M],null,E));k=u[e*2];e=u[e*2+
|
|
|
|
+1];n=u[f*2];z=u[f*2+1];C=u[h*2];B=u[h*2+1];h=b.faceVertexUvs[0];f=n;n=z;z=[];z.push(new THREE.UV(k,e));z.push(new THREE.UV(f,n));z.push(new THREE.UV(C,B));h.push(z)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;b(new k)};
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
|
|
c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,h,k,l,m,t,u,p){k=(k-u)/(p-u);u=this.normal_cache;b[h]=l+k*this.delta;b[h+1]=m;b[h+2]=t;f[h]=this.lerp(u[a],u[a+3],k);f[h+1]=this.lerp(u[a+1],u[a+4],k);f[h+2]=this.lerp(u[a+2],u[a+5],k)};this.VIntY=function(a,b,f,h,k,l,m,t,u,p){k=(k-u)/(p-u);u=this.normal_cache;b[h]=l;b[h+1]=m+k*this.delta;b[h+
|
|
|
|
-2]=t;b=a+this.yd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};this.VIntZ=function(a,b,f,h,k,l,m,t,u,p){k=(k-u)/(p-u);u=this.normal_cache;b[h]=l;b[h+1]=m;b[h+2]=t+k*this.delta;b=a+this.zd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
|
|
|
|
-this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,h,k,l){var m=h+1,t=h+this.yd,u=h+this.zd,p=m+this.yd,v=m+this.zd,o=h+this.yd+this.zd,z=m+this.yd+this.zd,x=0,w=this.field[h],B=this.field[m],y=this.field[t],A=this.field[p],E=this.field[u],C=this.field[v],L=this.field[o],F=this.field[z];w<k&&(x|=1);B<k&&(x|=2);y<k&&(x|=8);A<k&&(x|=4);E<k&&(x|=16);C<k&&(x|=32);L<k&&(x|=128);F<k&&(x|=64);var G=THREE.edgeTable[x];if(G==0)return 0;var N=this.delta,
|
|
|
|
-R=a+N,H=b+N,N=f+N;G&1&&(this.compNorm(h),this.compNorm(m),this.VIntX(h*3,this.vlist,this.nlist,0,k,a,b,f,w,B));G&2&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,3,k,R,b,f,B,A));G&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,k,a,H,f,y,A));G&8&&(this.compNorm(h),this.compNorm(t),this.VIntY(h*3,this.vlist,this.nlist,9,k,a,b,f,w,y));G&16&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,12,k,a,b,N,E,C));G&32&&(this.compNorm(v),
|
|
|
|
-this.compNorm(z),this.VIntY(v*3,this.vlist,this.nlist,15,k,R,b,N,C,F));G&64&&(this.compNorm(o),this.compNorm(z),this.VIntX(o*3,this.vlist,this.nlist,18,k,a,H,N,L,F));G&128&&(this.compNorm(u),this.compNorm(o),this.VIntY(u*3,this.vlist,this.nlist,21,k,a,b,N,E,L));G&256&&(this.compNorm(h),this.compNorm(u),this.VIntZ(h*3,this.vlist,this.nlist,24,k,a,b,f,w,E));G&512&&(this.compNorm(m),this.compNorm(v),this.VIntZ(m*3,this.vlist,this.nlist,27,k,R,b,f,B,C));G&1024&&(this.compNorm(p),this.compNorm(z),this.VIntZ(p*
|
|
|
|
-3,this.vlist,this.nlist,30,k,R,H,f,A,F));G&2048&&(this.compNorm(t),this.compNorm(o),this.VIntZ(t*3,this.vlist,this.nlist,33,k,a,H,f,y,L));x<<=4;for(k=h=0;THREE.triTable[x+k]!=-1;)a=x+k,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],l),k+=3,h++;return h};this.posnormtriv=function(a,b,f,h,k,l){var m=this.count*3;this.positionArray[m]=a[f];this.positionArray[m+1]=a[f+1];this.positionArray[m+2]=a[f+2];this.positionArray[m+3]=a[h];this.positionArray[m+
|
|
|
|
-4]=a[h+1];this.positionArray[m+5]=a[h+2];this.positionArray[m+6]=a[k];this.positionArray[m+7]=a[k+1];this.positionArray[m+8]=a[k+2];this.normalArray[m]=b[f];this.normalArray[m+1]=b[f+1];this.normalArray[m+2]=b[f+2];this.normalArray[m+3]=b[h];this.normalArray[m+4]=b[h+1];this.normalArray[m+5]=b[h+2];this.normalArray[m+6]=b[k];this.normalArray[m+7]=b[k+1];this.normalArray[m+8]=b[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&l(this)};this.begin=function(){this.count=0;
|
|
|
|
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,h,k){var l=this.size*Math.sqrt(h/k),m=f*this.size,t=b*this.size,u=a*this.size,p=Math.floor(m-l);p<1&&(p=1);m=Math.floor(m+l);m>this.size-1&&(m=this.size-1);var v=Math.floor(t-l);v<1&&(v=1);t=Math.floor(t+l);t>this.size-1&&(t=this.size-1);var o=Math.floor(u-l);o<1&&(o=1);l=Math.floor(u+l);l>this.size-1&&(l=this.size-
|
|
|
|
-1);for(var z,x,w,B,y,A;p<m;p++){u=this.size2*p;x=p/this.size-f;y=x*x;for(x=v;x<t;x++){w=u+this.size*x;z=x/this.size-b;A=z*z;for(z=o;z<l;z++)B=z/this.size-a,B=h/(1.0E-6+B*B+A+y)-k,B>0&&(this.field[w+z]+=B)}}};this.addPlaneX=function(a,b){var f,h,k,l,m,t=this.size,u=this.yd,p=this.zd,v=this.field,o=t*Math.sqrt(a/b);o>t&&(o=t);for(f=0;f<o;f++)if(h=f/t,h*=h,l=a/(1.0E-4+h)-b,l>0)for(h=0;h<t;h++){m=f+h*u;for(k=0;k<t;k++)v[p*k+m]+=l}};this.addPlaneY=function(a,b){var f,h,k,l,m,t,u=this.size,p=this.yd,v=
|
|
|
|
-this.zd,o=this.field,z=u*Math.sqrt(a/b);z>u&&(z=u);for(h=0;h<z;h++)if(f=h/u,f*=f,l=a/(1.0E-4+f)-b,l>0){m=h*p;for(f=0;f<u;f++){t=m+f;for(k=0;k<u;k++)o[v*k+t]+=l}}};this.addPlaneZ=function(a,b){var f,h,k,l,m,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(k=0;k<dist;k++)if(f=k/size,f*=f,l=a/(1.0E-4+f)-b,l>0){m=zd*k;for(h=0;h<size;h++){t=m+h*yd;for(f=0;f<size;f++)field[t+f]+=l}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
|
|
|
|
-3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,f,h,k,l,m,t,u,p,v=this.size-2;for(k=1;k<v;k++){p=this.size2*k;t=(k-this.halfsize)/this.halfsize;for(h=1;h<v;h++){u=p+this.size*h;m=(h-this.halfsize)/this.halfsize;for(f=1;f<v;f++)l=(f-this.halfsize)/this.halfsize,b=u+f,this.polygonize(l,m,t,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(h){var k,l,m,t,u,p,v,o;for(k=0;k<h.count;k++)v=k*3,u=v+1,o=v+2,l=h.positionArray[v],
|
|
|
|
-m=h.positionArray[u],t=h.positionArray[o],p=new THREE.Vector3(l,m,t),l=h.normalArray[v],m=h.normalArray[u],t=h.normalArray[o],v=new THREE.Vector3(l,m,t),v.normalize(),u=new THREE.Vertex(p),b.vertices.push(u),f.push(v);nfaces=h.count/3;for(k=0;k<nfaces;k++)v=(a+k)*3,u=v+1,o=v+2,p=f[v],l=f[u],m=f[o],v=new THREE.Face3(v,u,o,[p,l,m]),b.faces.push(v);a+=nfaces;h.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
|
|
|
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l+k*this.delta;b[h+1]=n;b[h+2]=p;f[h]=this.lerp(u[a],u[a+3],k);f[h+1]=this.lerp(u[a+1],u[a+4],k);f[h+2]=this.lerp(u[a+2],u[a+5],k)};this.VIntY=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l;b[h+1]=n+k*this.delta;b[h+
|
|
|
|
+2]=p;b=a+this.yd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};this.VIntZ=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l;b[h+1]=n;b[h+2]=p+k*this.delta;b=a+this.zd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
|
|
|
|
+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,h,k,l){var n=h+1,p=h+this.yd,u=h+this.zd,t=n+this.yd,v=n+this.zd,o=h+this.yd+this.zd,y=n+this.yd+this.zd,x=0,w=this.field[h],A=this.field[n],z=this.field[p],C=this.field[t],B=this.field[u],K=this.field[v],F=this.field[o],M=this.field[y];w<k&&(x|=1);A<k&&(x|=2);z<k&&(x|=8);C<k&&(x|=4);B<k&&(x|=16);K<k&&(x|=32);F<k&&(x|=128);M<k&&(x|=64);var E=THREE.edgeTable[x];if(E==0)return 0;var O=this.delta,
|
|
|
|
+V=a+O,H=b+O,O=f+O;E&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,a,b,f,w,A));E&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,V,b,f,A,C));E&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,a,H,f,z,C));E&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,k,a,b,f,w,z));E&16&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,12,k,a,b,O,B,K));E&32&&(this.compNorm(v),
|
|
|
|
+this.compNorm(y),this.VIntY(v*3,this.vlist,this.nlist,15,k,V,b,O,K,M));E&64&&(this.compNorm(o),this.compNorm(y),this.VIntX(o*3,this.vlist,this.nlist,18,k,a,H,O,F,M));E&128&&(this.compNorm(u),this.compNorm(o),this.VIntY(u*3,this.vlist,this.nlist,21,k,a,b,O,B,F));E&256&&(this.compNorm(h),this.compNorm(u),this.VIntZ(h*3,this.vlist,this.nlist,24,k,a,b,f,w,B));E&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,k,V,b,f,A,K));E&1024&&(this.compNorm(t),this.compNorm(y),this.VIntZ(t*
|
|
|
|
+3,this.vlist,this.nlist,30,k,V,H,f,C,M));E&2048&&(this.compNorm(p),this.compNorm(o),this.VIntZ(p*3,this.vlist,this.nlist,33,k,a,H,f,z,F));x<<=4;for(k=h=0;THREE.triTable[x+k]!=-1;)a=x+k,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],l),k+=3,h++;return h};this.posnormtriv=function(a,b,f,h,k,l){var n=this.count*3;this.positionArray[n]=a[f];this.positionArray[n+1]=a[f+1];this.positionArray[n+2]=a[f+2];this.positionArray[n+3]=a[h];this.positionArray[n+
|
|
|
|
+4]=a[h+1];this.positionArray[n+5]=a[h+2];this.positionArray[n+6]=a[k];this.positionArray[n+7]=a[k+1];this.positionArray[n+8]=a[k+2];this.normalArray[n]=b[f];this.normalArray[n+1]=b[f+1];this.normalArray[n+2]=b[f+2];this.normalArray[n+3]=b[h];this.normalArray[n+4]=b[h+1];this.normalArray[n+5]=b[h+2];this.normalArray[n+6]=b[k];this.normalArray[n+7]=b[k+1];this.normalArray[n+8]=b[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&l(this)};this.begin=function(){this.count=0;
|
|
|
|
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,h,k){var l=this.size*Math.sqrt(h/k),n=f*this.size,p=b*this.size,u=a*this.size,t=Math.floor(n-l);t<1&&(t=1);n=Math.floor(n+l);n>this.size-1&&(n=this.size-1);var v=Math.floor(p-l);v<1&&(v=1);p=Math.floor(p+l);p>this.size-1&&(p=this.size-1);var o=Math.floor(u-l);o<1&&(o=1);l=Math.floor(u+l);l>this.size-1&&(l=this.size-
|
|
|
|
+1);for(var y,x,w,A,z,C;t<n;t++){u=this.size2*t;x=t/this.size-f;z=x*x;for(x=v;x<p;x++){w=u+this.size*x;y=x/this.size-b;C=y*y;for(y=o;y<l;y++)A=y/this.size-a,A=h/(1.0E-6+A*A+C+z)-k,A>0&&(this.field[w+y]+=A)}}};this.addPlaneX=function(a,b){var f,h,k,l,n,p=this.size,u=this.yd,t=this.zd,v=this.field,o=p*Math.sqrt(a/b);o>p&&(o=p);for(f=0;f<o;f++)if(h=f/p,h*=h,l=a/(1.0E-4+h)-b,l>0)for(h=0;h<p;h++){n=f+h*u;for(k=0;k<p;k++)v[t*k+n]+=l}};this.addPlaneY=function(a,b){var f,h,k,l,n,p,u=this.size,t=this.yd,v=
|
|
|
|
+this.zd,o=this.field,y=u*Math.sqrt(a/b);y>u&&(y=u);for(h=0;h<y;h++)if(f=h/u,f*=f,l=a/(1.0E-4+f)-b,l>0){n=h*t;for(f=0;f<u;f++){p=n+f;for(k=0;k<u;k++)o[v*k+p]+=l}}};this.addPlaneZ=function(a,b){var f,h,k,l,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(k=0;k<dist;k++)if(f=k/size,f*=f,l=a/(1.0E-4+f)-b,l>0){n=zd*k;for(h=0;h<size;h++){p=n+h*yd;for(f=0;f<size;f++)field[p+f]+=l}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
|
|
|
|
+3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,f,h,k,l,n,p,u,t,v=this.size-2;for(k=1;k<v;k++){t=this.size2*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<v;h++){u=t+this.size*h;n=(h-this.halfsize)/this.halfsize;for(f=1;f<v;f++)l=(f-this.halfsize)/this.halfsize,b=u+f,this.polygonize(l,n,p,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(h){var k,l,n,p,u,t,v,o;for(k=0;k<h.count;k++)v=k*3,u=v+1,o=v+2,l=h.positionArray[v],
|
|
|
|
+n=h.positionArray[u],p=h.positionArray[o],t=new THREE.Vector3(l,n,p),l=h.normalArray[v],n=h.normalArray[u],p=h.normalArray[o],v=new THREE.Vector3(l,n,p),v.normalize(),u=new THREE.Vertex(t),b.vertices.push(u),f.push(v);nfaces=h.count/3;for(k=0;k<nfaces;k++)v=(a+k)*3,u=v+1,o=v+2,t=f[v],l=f[u],n=f[o],v=new THREE.Face3(v,u,o,[t,l,n]),b.faces.push(v);a+=nfaces;h.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,
|
|
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,
|
|
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]);
|
|
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]);
|
|
@@ -692,20 +692,20 @@ THREE.MeshCollider=function(a,b){this.mesh=a;this.box=b;this.numFaces=this.mesh.
|
|
THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var b,c,e,f,h=0;b=0;for(c=this.colliders.length;b<c;b++)if(f=this.colliders[b],e=this.rayCast(a,f),e<Number.MAX_VALUE)f.distance=e,e>h?this.hits.push(f):this.hits.unshift(f),h=e;return this.hits};
|
|
THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var b,c,e,f,h=0;b=0;for(c=this.colliders.length;b<c;b++)if(f=this.colliders[b],e=this.rayCast(a,f),e<Number.MAX_VALUE)f.distance=e,e>h?this.hits.push(f):this.hits.unshift(f),h=e;return this.hits};
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,b[c]);if(e.dist<Number.MAX_VALUE){b[c].distance=e.dist;b[c].faceIndex=e.faceIndex;break}c++}if(c>b.length)return null;return b[c]};
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,b[c]);if(e.dist<Number.MAX_VALUE){b[c].distance=e.dist;b[c].faceIndex=e.faceIndex;break}c++}if(c>b.length)return null;return b[c]};
|
|
THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)};
|
|
THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)};
|
|
-THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),e=Number.MAX_VALUE,f,h=0;h<b.numFaces;h++){var k=b.mesh.geometry.faces[h],l=b.mesh.geometry.vertices[k.a].position,m=b.mesh.geometry.vertices[k.b].position,t=b.mesh.geometry.vertices[k.c].position,u=k instanceof THREE.Face4?b.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(c,l,m,t,e,this.collisionNormal,b.mesh),k<e&&(e=k,f=h,b.normal.copy(this.collisionNormal),b.normal.normalize())):
|
|
|
|
-k instanceof THREE.Face4&&(k=this.rayTriangle(c,l,m,u,e,this.collisionNormal,b.mesh),k<e&&(e=k,f=h,b.normal.copy(this.collisionNormal),b.normal.normalize()),k=this.rayTriangle(c,m,t,u,e,this.collisionNormal,b.mesh),k<e&&(e=k,f=h,b.normal.copy(this.collisionNormal),b.normal.normalize()))}return{dist:e,faceIndex:f}};
|
|
|
|
-THREE.CollisionSystem.prototype.rayTriangle=function(a,b,c,e,f,h,k){var l=THREE.CollisionSystem.__v1,m=THREE.CollisionSystem.__v2;h.set(0,0,0);l.sub(c,b);m.sub(e,c);h.cross(l,m);l=h.dot(a.direction);if(!(l<0))if(k.doubleSided||k.flipSided)h.multiplyScalar(-1),l*=-1;else return Number.MAX_VALUE;k=h.dot(b)-h.dot(a.origin);if(!(k<=0))return Number.MAX_VALUE;if(!(k>=l*f))return Number.MAX_VALUE;k/=l;l=THREE.CollisionSystem.__v3;l.copy(a.direction);l.multiplyScalar(k);l.addSelf(a.origin);Math.abs(h.x)>
|
|
|
|
|
|
+THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),e=Number.MAX_VALUE,f,h=0;h<b.numFaces;h++){var k=b.mesh.geometry.faces[h],l=b.mesh.geometry.vertices[k.a].position,n=b.mesh.geometry.vertices[k.b].position,p=b.mesh.geometry.vertices[k.c].position,u=k instanceof THREE.Face4?b.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(c,l,n,p,e,this.collisionNormal,b.mesh),k<e&&(e=k,f=h,b.normal.copy(this.collisionNormal),b.normal.normalize())):
|
|
|
|
+k instanceof THREE.Face4&&(k=this.rayTriangle(c,l,n,u,e,this.collisionNormal,b.mesh),k<e&&(e=k,f=h,b.normal.copy(this.collisionNormal),b.normal.normalize()),k=this.rayTriangle(c,n,p,u,e,this.collisionNormal,b.mesh),k<e&&(e=k,f=h,b.normal.copy(this.collisionNormal),b.normal.normalize()))}return{dist:e,faceIndex:f}};
|
|
|
|
+THREE.CollisionSystem.prototype.rayTriangle=function(a,b,c,e,f,h,k){var l=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;h.set(0,0,0);l.sub(c,b);n.sub(e,c);h.cross(l,n);l=h.dot(a.direction);if(!(l<0))if(k.doubleSided||k.flipSided)h.multiplyScalar(-1),l*=-1;else return Number.MAX_VALUE;k=h.dot(b)-h.dot(a.origin);if(!(k<=0))return Number.MAX_VALUE;if(!(k>=l*f))return Number.MAX_VALUE;k/=l;l=THREE.CollisionSystem.__v3;l.copy(a.direction);l.multiplyScalar(k);l.addSelf(a.origin);Math.abs(h.x)>
|
|
Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=l.y-b.y,h=c.y-b.y,f=e.y-b.y,l=l.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=l.x-b.x,h=c.x-b.x,f=e.x-b.x,l=l.y-b.y,c=c.y-b.y,e=e.y-b.y):Math.abs(h.y)>Math.abs(h.z)?(a=l.x-b.x,h=c.x-b.x,f=e.x-b.x,l=l.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=l.x-b.x,h=c.x-b.x,f=e.x-b.x,l=l.y-b.y,c=c.y-b.y,e=e.y-b.y);b=h*e-c*f;if(b==0)return Number.MAX_VALUE;b=1/b;e=(a*e-l*f)*b;if(!(e>=0))return Number.MAX_VALUE;b*=h*l-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-e-b>=0))return Number.MAX_VALUE;return k};
|
|
Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=l.y-b.y,h=c.y-b.y,f=e.y-b.y,l=l.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=l.x-b.x,h=c.x-b.x,f=e.x-b.x,l=l.y-b.y,c=c.y-b.y,e=e.y-b.y):Math.abs(h.y)>Math.abs(h.z)?(a=l.x-b.x,h=c.x-b.x,f=e.x-b.x,l=l.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=l.x-b.x,h=c.x-b.x,f=e.x-b.x,l=l.y-b.y,c=c.y-b.y,e=e.y-b.y);b=h*e-c*f;if(b==0)return Number.MAX_VALUE;b=1/b;e=(a*e-l*f)*b;if(!(e>=0))return Number.MAX_VALUE;b*=h*l-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-e-b>=0))return Number.MAX_VALUE;return k};
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);c.multiplyVector3(e.origin);c.rotateAxis(e.direction);e.direction.normalize();return e};
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);c.multiplyVector3(e.origin);c.rotateAxis(e.direction);e.direction.normalize();return e};
|
|
-THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var e=0,f=0,h=0,k=0,l=0,m=0,t=!0;c.origin.x<b.min.x?(e=b.min.x-c.origin.x,e/=c.direction.x,t=!1,k=-1):c.origin.x>b.max.x&&(e=b.max.x-c.origin.x,e/=c.direction.x,t=!1,k=1);c.origin.y<b.min.y?(f=b.min.y-c.origin.y,f/=c.direction.y,t=!1,l=-1):c.origin.y>b.max.y&&(f=b.max.y-c.origin.y,f/=c.direction.y,
|
|
|
|
-t=!1,l=1);c.origin.z<b.min.z?(h=b.min.z-c.origin.z,h/=c.direction.z,t=!1,m=-1):c.origin.z>b.max.z&&(h=b.max.z-c.origin.z,h/=c.direction.z,t=!1,m=1);if(t)return-1;t=0;f>e&&(t=1,e=f);h>e&&(t=2,e=h);switch(t){case 0:l=c.origin.y+c.direction.y*e;if(l<b.min.y||l>b.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(k,0,0);break;case 1:k=c.origin.x+c.direction.x*e;if(k<b.min.x||k>b.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
|
|
|
|
-e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(0,l,0);break;case 2:k=c.origin.x+c.direction.x*e;if(k<b.min.x||k>b.max.x)return Number.MAX_VALUE;l=c.origin.y+c.direction.y*e;if(l<b.min.y||l>b.max.y)return Number.MAX_VALUE;b.normal.set(0,0,m)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),e=b.point.dot(b.normal);if(c<0)c=(e-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
|
|
|
|
|
|
+THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var e=0,f=0,h=0,k=0,l=0,n=0,p=!0;c.origin.x<b.min.x?(e=b.min.x-c.origin.x,e/=c.direction.x,p=!1,k=-1):c.origin.x>b.max.x&&(e=b.max.x-c.origin.x,e/=c.direction.x,p=!1,k=1);c.origin.y<b.min.y?(f=b.min.y-c.origin.y,f/=c.direction.y,p=!1,l=-1):c.origin.y>b.max.y&&(f=b.max.y-c.origin.y,f/=c.direction.y,
|
|
|
|
+p=!1,l=1);c.origin.z<b.min.z?(h=b.min.z-c.origin.z,h/=c.direction.z,p=!1,n=-1):c.origin.z>b.max.z&&(h=b.max.z-c.origin.z,h/=c.direction.z,p=!1,n=1);if(p)return-1;p=0;f>e&&(p=1,e=f);h>e&&(p=2,e=h);switch(p){case 0:l=c.origin.y+c.direction.y*e;if(l<b.min.y||l>b.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(k,0,0);break;case 1:k=c.origin.x+c.direction.x*e;if(k<b.min.x||k>b.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
|
|
|
|
+e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(0,l,0);break;case 2:k=c.origin.x+c.direction.x*e;if(k<b.min.x||k>b.max.x)return Number.MAX_VALUE;l=c.origin.y+c.direction.y*e;if(l<b.min.y||l>b.max.y)return Number.MAX_VALUE;b.normal.set(0,0,n)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),e=b.point.dot(b.normal);if(c<0)c=(e-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
|
|
THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq<b.radiusSq)return-1;var e=c.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;c=b.radiusSq-(c.lengthSq()-e*e);if(c>=0)return Math.abs(e)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq<b.radiusSq)return-1;var e=c.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;c=b.radiusSq-(c.lengthSq()-e*e);if(c>=0)return Math.abs(e)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b};
|
|
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b};
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,f=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,k=new THREE.Matrix4,l=new THREE.Matrix4,m,t,u;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.PerspectiveCamera(53,1,1,1E4);o.position.z=
|
|
|
|
-2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:v}},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}"});
|
|
|
|
-var z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);p.width=a;p.height=e;v.width=a;v.height=e};this.render=function(a,c){c.update(null,!0);if(m!==c.aspect||t!==c.near||u!==c.fov){m=c.aspect;t=c.near;u=c.fov;var B=c.projectionMatrix.clone(),y=125/30*0.5,A=y*t/125,E=t*Math.tan(u*Math.PI/360),C;k.n14=y;l.n14=-y;y=-E*m+A;C=E*m+A;B.n11=2*t/(C-y);B.n13=(C+y)/(C-y);f.projectionMatrix=B.clone();y=-E*m-A;C=E*m-A;B.n11=2*t/(C-y);B.n13=
|
|
|
|
-(C+y)/(C-y);h.projectionMatrix=B.clone()}f.matrix=c.matrixWorld.clone().multiplySelf(l);f.update(null,!0);f.position.copy(c.position);f.near=t;f.far=c.far;e.call(b,a,f,p,!0);h.matrix=c.matrixWorld.clone().multiplySelf(k);h.update(null,!0);h.position.copy(c.position);h.near=t;h.far=c.far;e.call(b,a,h,v,!0);e.call(b,z,o)}};
|
|
|
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,f=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,k=new THREE.Matrix4,l=new THREE.Matrix4,n,p,u;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.PerspectiveCamera(53,1,1,1E4);o.position.z=
|
|
|
|
+2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:v}},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}"});
|
|
|
|
+var y=new THREE.Scene;y.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);t.width=a;t.height=e;v.width=a;v.height=e};this.render=function(a,c){c.update(null,!0);if(n!==c.aspect||p!==c.near||u!==c.fov){n=c.aspect;p=c.near;u=c.fov;var A=c.projectionMatrix.clone(),z=125/30*0.5,C=z*p/125,B=p*Math.tan(u*Math.PI/360),K;k.n14=z;l.n14=-z;z=-B*n+C;K=B*n+C;A.n11=2*p/(K-z);A.n13=(K+z)/(K-z);f.projectionMatrix=A.clone();z=-B*n-C;K=B*n-C;A.n11=2*p/(K-z);A.n13=
|
|
|
|
+(K+z)/(K-z);h.projectionMatrix=A.clone()}f.matrix=c.matrixWorld.clone().multiplySelf(l);f.update(null,!0);f.position.copy(c.position);f.near=p;f.far=c.far;e.call(b,a,f,t,!0);h.matrix=c.matrixWorld.clone().multiplySelf(k);h.update(null,!0);h.position.copy(c.position);h.near=p;h.far=c.far;e.call(b,a,h,v,!0);e.call(b,y,o)}};
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,f,h,k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);var l=new THREE.PerspectiveCamera;l.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,e){c.call(b,a,e);f=a/2;h=e};this.render=function(a,c){this.clear();k.fov=c.fov;k.aspect=0.5*c.aspect;k.near=c.near;k.far=
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,f,h,k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);var l=new THREE.PerspectiveCamera;l.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,e){c.call(b,a,e);f=a/2;h=e};this.render=function(a,c){this.clear();k.fov=c.fov;k.aspect=0.5*c.aspect;k.near=c.near;k.far=
|
|
c.far;k.updateProjectionMatrix();k.position.copy(c.position);k.target.copy(c.target);k.translateX(b.separation);k.lookAt(k.target);l.projectionMatrix=k.projectionMatrix;l.position.copy(c.position);l.target.copy(c.target);l.translateX(-b.separation);l.lookAt(l.target);this.setViewport(0,0,f,h);e.call(b,a,k);this.setViewport(f,0,f,h);e.call(b,a,l,!1)}};
|
|
c.far;k.updateProjectionMatrix();k.position.copy(c.position);k.target.copy(c.target);k.translateX(b.separation);k.lookAt(k.target);l.projectionMatrix=k.projectionMatrix;l.position.copy(c.position);l.target.copy(c.target);l.translateX(-b.separation);l.lookAt(l.target);this.setViewport(0,0,f,h);e.call(b,a,k);this.setViewport(f,0,f,h);e.call(b,a,l,!1)}};
|