|
@@ -17,61 +17,61 @@ c.z;this.w=a.w-c.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,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
|
THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,e=[];c=0;for(b=a.length;c<b;c++)Array.prototype.push.apply(e,this.intersectObject(a[c]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function c(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function b(a,b,c,e){var e=e.clone().subSelf(b),
|
|
|
c=c.clone().subSelf(b),k=a.clone().subSelf(b),a=e.dot(e),b=e.dot(c),e=e.dot(k),f=c.dot(c),c=c.dot(k),k=1/(a*f-b*b),f=(f*e-b*c)*k,a=(a*c-b*e)*k;return f>0&&a>0&&f+a<1}for(var e,k=[],h=0,f=a.children.length;h<f;h++)Array.prototype.push.apply(k,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=c(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};k.push(e)}else if(a instanceof THREE.Mesh){h=
|
|
|
-c(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 k;var l,n,u,t,p,w,v,z,x=a.geometry,y=x.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);h=0;for(f=x.faces.length;h<f;h++)if(e=x.faces[h],v=this.origin.clone(),z=this.direction.clone(),t=a.matrixWorld,l=t.multiplyVector3(e.centroid.clone()).subSelf(v),w=l.dot(z),!(w<=0)&&(l=t.multiplyVector3(y[e.a].position.clone()),n=t.multiplyVector3(y[e.b].position.clone()),
|
|
|
-u=t.multiplyVector3(y[e.c].position.clone()),t=e instanceof THREE.Face4?t.multiplyVector3(y[e.d].position.clone()):null,p=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),w=z.dot(p),a.doubleSided||(a.flipSided?w>0:w<0)))if(w=p.dot((new THREE.Vector3).sub(l,v))/w,v=v.addSelf(z.multiplyScalar(w)),e instanceof THREE.Face3)b(v,l,n,u)&&(e={distance:this.origin.distanceTo(v),point:v,face:e,object:a},k.push(e));else if(e instanceof THREE.Face4&&(b(v,l,n,t)||b(v,n,u,t)))e={distance:this.origin.distanceTo(v),
|
|
|
+c(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 k;var l,n,p,t,u,w,v,z,x=a.geometry,y=x.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);h=0;for(f=x.faces.length;h<f;h++)if(e=x.faces[h],v=this.origin.clone(),z=this.direction.clone(),t=a.matrixWorld,l=t.multiplyVector3(e.centroid.clone()).subSelf(v),w=l.dot(z),!(w<=0)&&(l=t.multiplyVector3(y[e.a].position.clone()),n=t.multiplyVector3(y[e.b].position.clone()),
|
|
|
+p=t.multiplyVector3(y[e.c].position.clone()),t=e instanceof THREE.Face4?t.multiplyVector3(y[e.d].position.clone()):null,u=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),w=z.dot(u),a.doubleSided||(a.flipSided?w>0:w<0)))if(w=u.dot((new THREE.Vector3).sub(l,v))/w,v=v.addSelf(z.multiplyScalar(w)),e instanceof THREE.Face3)b(v,l,n,p)&&(e={distance:this.origin.distanceTo(v),point:v,face:e,object:a},k.push(e));else if(e instanceof THREE.Face4&&(b(v,l,n,t)||b(v,n,p,t)))e={distance:this.origin.distanceTo(v),
|
|
|
point:v,face:e,object:a},k.push(e)}return k}};
|
|
|
-THREE.Rectangle=function(){function a(){h=e-c;f=k-b}var c,b,e,k,h,f,l=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return h};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return k};this.set=function(f,h,t,p){l=!1;c=f;b=h;e=t;k=p;a()};this.addPoint=function(f,h){l?(l=!1,c=f,b=h,e=f,k=h):(c=c<f?c:f,b=b<h?b:h,e=e>f?e:f,k=k>h?k:h);a()};this.add3Points=
|
|
|
-function(f,h,t,p,w,v){l?(l=!1,c=f<t?f<w?f:w:t<w?t:w,b=h<p?h<v?h:v:p<v?p:v,e=f>t?f>w?f:w:t>w?t:w,k=h>p?h>v?h:v:p>v?p:v):(c=f<t?f<w?f<c?f:c:w<c?w:c:t<w?t<c?t:c:w<c?w:c,b=h<p?h<v?h<b?h:b:v<b?v:b:p<v?p<b?p:b:v<b?v:b,e=f>t?f>w?f>e?f:e:w>e?w:e:t>w?t>e?t:e:w>e?w:e,k=h>p?h>v?h>k?h:k:v>k?v:k:p>v?p>k?p:k:v>k?v:k);a()};this.addRectangle=function(f){l?(l=!1,c=f.getLeft(),b=f.getTop(),e=f.getRight(),k=f.getBottom()):(c=c<f.getLeft()?c:f.getLeft(),b=b<f.getTop()?b:f.getTop(),e=e>f.getRight()?e:f.getRight(),k=k>
|
|
|
+THREE.Rectangle=function(){function a(){h=e-c;f=k-b}var c,b,e,k,h,f,l=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return h};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return k};this.set=function(f,h,t,u){l=!1;c=f;b=h;e=t;k=u;a()};this.addPoint=function(f,h){l?(l=!1,c=f,b=h,e=f,k=h):(c=c<f?c:f,b=b<h?b:h,e=e>f?e:f,k=k>h?k:h);a()};this.add3Points=
|
|
|
+function(f,h,t,u,w,v){l?(l=!1,c=f<t?f<w?f:w:t<w?t:w,b=h<u?h<v?h:v:u<v?u:v,e=f>t?f>w?f:w:t>w?t:w,k=h>u?h>v?h:v:u>v?u:v):(c=f<t?f<w?f<c?f:c:w<c?w:c:t<w?t<c?t:c:w<c?w:c,b=h<u?h<v?h<b?h:b:v<b?v:b:u<v?u<b?u:b:v<b?v:b,e=f>t?f>w?f>e?f:e:w>e?w:e:t>w?t>e?t:e:w>e?w:e,k=h>u?h>v?h>k?h:k:v>k?v:k:u>v?u>k?u:k:v>k?v:k);a()};this.addRectangle=function(f){l?(l=!1,c=f.getLeft(),b=f.getTop(),e=f.getRight(),k=f.getBottom()):(c=c<f.getLeft()?c:f.getLeft(),b=b<f.getTop()?b:f.getTop(),e=e>f.getRight()?e:f.getRight(),k=k>
|
|
|
f.getBottom()?k:f.getBottom());a()};this.inflate=function(f){c-=f;b-=f;e+=f;k+=f;a()};this.minSelf=function(f){c=c>f.getLeft()?c:f.getLeft();b=b>f.getTop()?b:f.getTop();e=e<f.getRight()?e:f.getRight();k=k<f.getBottom()?k:f.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(k,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){l=!0;k=e=b=c=0;a()};this.isEmpty=function(){return l}};
|
|
|
THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c){return a<c?c:a},mapLinear:function(a,c,b,e,k){return e+(a-c)*(k-e)/(b-c)},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,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
|
|
|
-THREE.Matrix4=function(a,c,b,e,k,h,f,l,n,u,t,p,w,v,z,x){this.set(a!==void 0?a:1,c||0,b||0,e||0,k||0,h!==void 0?h:1,f||0,l||0,n||0,u||0,t!==void 0?t:1,p||0,w||0,v||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,c,b,e,k,h,f,l,n,u,t,p,w,v,z,x){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=k;this.n22=h;this.n23=f;this.n24=l;this.n31=n;this.n32=u;this.n33=t;this.n34=p;this.n41=w;this.n42=v;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,
|
|
|
-c,b){var e=THREE.Matrix4.__v1,k=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;e.cross(b,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(b,h).normalize());k.cross(h,e).normalize();this.n11=e.x;this.n12=k.x;this.n13=h.x;this.n21=e.y;this.n22=k.y;this.n23=h.y;this.n31=e.z;this.n32=k.z;this.n33=h.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,k=a.n13,h=a.n14,f=a.n21,l=a.n22,n=a.n23,u=a.n24,t=a.n31,p=a.n32,w=a.n33,v=a.n34,z=a.n41,x=a.n42,y=a.n43,
|
|
|
-C=a.n44,A=c.n11,B=c.n12,D=c.n13,K=c.n14,H=c.n21,M=c.n22,V=c.n23,L=c.n24,W=c.n31,N=c.n32,O=c.n33,Z=c.n34,Y=c.n41,P=c.n42,o=c.n43,U=c.n44;this.n11=b*A+e*H+k*W+h*Y;this.n12=b*B+e*M+k*N+h*P;this.n13=b*D+e*V+k*O+h*o;this.n14=b*K+e*L+k*Z+h*U;this.n21=f*A+l*H+n*W+u*Y;this.n22=f*B+l*M+n*N+u*P;this.n23=f*D+l*V+n*O+u*o;this.n24=f*K+l*L+n*Z+u*U;this.n31=t*A+p*H+w*W+v*Y;this.n32=t*B+p*M+w*N+v*P;this.n33=t*D+p*V+w*O+v*o;this.n34=t*K+p*L+w*Z+v*U;this.n41=z*A+x*H+y*W+C*Y;this.n42=z*B+x*M+y*N+C*P;this.n43=z*D+x*
|
|
|
-V+y*O+C*o;this.n44=z*K+x*L+y*Z+C*U;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
|
|
|
+THREE.Matrix4=function(a,c,b,e,k,h,f,l,n,p,t,u,w,v,z,x){this.set(a!==void 0?a:1,c||0,b||0,e||0,k||0,h!==void 0?h:1,f||0,l||0,n||0,p||0,t!==void 0?t:1,u||0,w||0,v||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,c,b,e,k,h,f,l,n,p,t,u,w,v,z,x){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=k;this.n22=h;this.n23=f;this.n24=l;this.n31=n;this.n32=p;this.n33=t;this.n34=u;this.n41=w;this.n42=v;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,
|
|
|
+c,b){var e=THREE.Matrix4.__v1,k=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;e.cross(b,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(b,h).normalize());k.cross(h,e).normalize();this.n11=e.x;this.n12=k.x;this.n13=h.x;this.n21=e.y;this.n22=k.y;this.n23=h.y;this.n31=e.z;this.n32=k.z;this.n33=h.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,k=a.n13,h=a.n14,f=a.n21,l=a.n22,n=a.n23,p=a.n24,t=a.n31,u=a.n32,w=a.n33,v=a.n34,z=a.n41,x=a.n42,y=a.n43,
|
|
|
+D=a.n44,B=c.n11,A=c.n12,C=c.n13,L=c.n14,G=c.n21,M=c.n22,V=c.n23,K=c.n24,W=c.n31,N=c.n32,O=c.n33,Z=c.n34,Y=c.n41,P=c.n42,o=c.n43,U=c.n44;this.n11=b*B+e*G+k*W+h*Y;this.n12=b*A+e*M+k*N+h*P;this.n13=b*C+e*V+k*O+h*o;this.n14=b*L+e*K+k*Z+h*U;this.n21=f*B+l*G+n*W+p*Y;this.n22=f*A+l*M+n*N+p*P;this.n23=f*C+l*V+n*O+p*o;this.n24=f*L+l*K+n*Z+p*U;this.n31=t*B+u*G+w*W+v*Y;this.n32=t*A+u*M+w*N+v*P;this.n33=t*C+u*V+w*O+v*o;this.n34=t*L+u*K+w*Z+v*U;this.n41=z*B+x*G+y*W+D*Y;this.n42=z*A+x*M+y*N+D*P;this.n43=z*C+x*
|
|
|
+V+y*O+D*o;this.n44=z*L+x*K+y*Z+D*U;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
|
|
|
a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,k=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*k;a.y=(this.n21*c+this.n22*b+this.n23*e+this.n24)*k;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*k;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,k=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*k;a.y=this.n21*c+this.n22*
|
|
|
b+this.n23*e+this.n24*k;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*k;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*k;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*
|
|
|
-a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,k=this.n21,h=this.n22,f=this.n23,l=this.n24,n=this.n31,u=this.n32,t=this.n33,p=this.n34,w=this.n41,v=this.n42,z=this.n43,x=this.n44;return e*f*u*w-b*l*u*w-e*h*t*w+c*l*t*w+b*h*p*w-c*f*p*w-e*f*n*v+b*l*n*v+e*k*t*v-a*l*t*v-b*k*p*v+a*f*p*v+e*h*n*z-c*l*n*z-e*k*u*z+a*l*u*z+c*k*p*z-a*h*p*z-b*h*n*x+c*f*n*x+b*k*u*x-a*f*u*x-c*k*t*x+a*h*t*x},transpose:function(){var a;
|
|
|
+a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,k=this.n21,h=this.n22,f=this.n23,l=this.n24,n=this.n31,p=this.n32,t=this.n33,u=this.n34,w=this.n41,v=this.n42,z=this.n43,x=this.n44;return e*f*p*w-b*l*p*w-e*h*t*w+c*l*t*w+b*h*u*w-c*f*u*w-e*f*n*v+b*l*n*v+e*k*t*v-a*l*t*v-b*k*u*v+a*f*u*v+e*h*n*z-c*l*n*z-e*k*p*z+a*l*p*z+c*k*u*z-a*h*u*z-b*h*n*x+c*f*n*x+b*k*p*x-a*f*p*x-c*k*t*x+a*h*t*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,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},
|
|
|
setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},
|
|
|
-setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),k=1-b,h=a.x,f=a.y,l=a.z,n=k*h,u=k*f;this.set(n*h+b,n*f-e*l,n*l+e*f,0,n*f+e*l,u*f+b,u*l-e*h,0,n*l-e*f,u*l+e*h,k*l*l+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
|
|
|
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,e=a.n13,k=a.n14,h=a.n21,f=a.n22,l=a.n23,n=a.n24,u=a.n31,t=a.n32,p=a.n33,w=a.n34,v=a.n41,z=a.n42,x=a.n43,y=a.n44;this.n11=l*w*z-n*p*z+n*t*x-f*w*x-l*t*y+f*p*y;this.n12=k*p*z-e*w*z-k*t*x+b*w*x+e*t*y-b*p*y;this.n13=e*n*z-k*l*z+k*f*x-b*n*x-e*f*y+b*l*y;this.n14=k*l*t-e*n*t-k*f*p+b*n*p+e*f*w-b*l*w;this.n21=n*p*v-l*w*v-n*u*x+h*w*x+l*u*y-h*p*y;this.n22=e*w*v-k*p*v+
|
|
|
-k*u*x-c*w*x-e*u*y+c*p*y;this.n23=k*l*v-e*n*v-k*h*x+c*n*x+e*h*y-c*l*y;this.n24=e*n*u-k*l*u+k*h*p-c*n*p-e*h*w+c*l*w;this.n31=f*w*v-n*t*v+n*u*z-h*w*z-f*u*y+h*t*y;this.n32=k*t*v-b*w*v-k*u*z+c*w*z+b*u*y-c*t*y;this.n33=e*n*v-k*f*v+k*h*z-c*n*z-b*h*y+c*f*y;this.n34=k*f*u-b*n*u-k*h*t+c*n*t+b*h*w-c*f*w;this.n41=l*t*v-f*p*v-l*u*z+h*p*z+f*u*x-h*t*x;this.n42=b*p*v-e*t*v+e*u*z-c*p*z-b*u*x+c*t*x;this.n43=e*f*v-b*l*v-e*h*z+c*l*z+b*h*x-c*f*x;this.n44=b*l*u-e*f*u+e*h*t-c*l*t-b*h*p+c*f*p;this.multiplyScalar(1/a.determinant());
|
|
|
-return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,k=a.z,h=Math.cos(b),b=Math.sin(b),f=Math.cos(e),e=Math.sin(e),l=Math.cos(k),k=Math.sin(k);switch(c){case "YXZ":var n=f*l,u=f*k,t=e*l,p=e*k;this.n11=n+p*b;this.n12=t*b-u;this.n13=h*e;this.n21=h*k;this.n22=h*l;this.n23=-b;this.n31=u*b-t;this.n32=p+n*b;this.n33=h*f;break;case "ZXY":n=f*l;u=f*k;t=e*l;p=e*k;this.n11=n-p*b;this.n12=-h*k;this.n13=t+u*b;this.n21=u+t*b;this.n22=h*l;this.n23=p-n*b;this.n31=-h*e;this.n32=b;this.n33=h*f;break;case "ZYX":n=
|
|
|
-h*l;u=h*k;t=b*l;p=b*k;this.n11=f*l;this.n12=t*e-u;this.n13=n*e+p;this.n21=f*k;this.n22=p*e+n;this.n23=u*e-t;this.n31=-e;this.n32=b*f;this.n33=h*f;break;case "YZX":n=h*f;u=h*e;t=b*f;p=b*e;this.n11=f*l;this.n12=p-n*k;this.n13=t*k+u;this.n21=k;this.n22=h*l;this.n23=-b*l;this.n31=-e*l;this.n32=u*k+t;this.n33=n-p*k;break;case "XZY":n=h*f;u=h*e;t=b*f;p=b*e;this.n11=f*l;this.n12=-k;this.n13=e*l;this.n21=n*k+p;this.n22=h*l;this.n23=u*k-t;this.n31=t*k-u;this.n32=b*l;this.n33=p*k+n;break;default:n=h*l,u=h*
|
|
|
-k,t=b*l,p=b*k,this.n11=f*l,this.n12=-f*k,this.n13=e,this.n21=u+t*e,this.n22=n-p*e,this.n23=-b*f,this.n31=p-n*e,this.n32=t+u*e,this.n33=h*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,k=a.w,h=c+c,f=b+b,l=e+e,a=c*h,n=c*f;c*=l;var u=b*f;b*=l;e*=l;h*=k;f*=k;k*=l;this.n11=1-(u+e);this.n12=n-k;this.n13=c+f;this.n21=n+k;this.n22=1-(a+e);this.n23=b-h;this.n31=c-f;this.n32=b+h;this.n33=1-(a+u);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
|
|
|
+setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),k=1-b,h=a.x,f=a.y,l=a.z,n=k*h,p=k*f;this.set(n*h+b,n*f-e*l,n*l+e*f,0,n*f+e*l,p*f+b,p*l-e*h,0,n*l-e*f,p*l+e*h,k*l*l+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
|
|
|
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,e=a.n13,k=a.n14,h=a.n21,f=a.n22,l=a.n23,n=a.n24,p=a.n31,t=a.n32,u=a.n33,w=a.n34,v=a.n41,z=a.n42,x=a.n43,y=a.n44;this.n11=l*w*z-n*u*z+n*t*x-f*w*x-l*t*y+f*u*y;this.n12=k*u*z-e*w*z-k*t*x+b*w*x+e*t*y-b*u*y;this.n13=e*n*z-k*l*z+k*f*x-b*n*x-e*f*y+b*l*y;this.n14=k*l*t-e*n*t-k*f*u+b*n*u+e*f*w-b*l*w;this.n21=n*u*v-l*w*v-n*p*x+h*w*x+l*p*y-h*u*y;this.n22=e*w*v-k*u*v+
|
|
|
+k*p*x-c*w*x-e*p*y+c*u*y;this.n23=k*l*v-e*n*v-k*h*x+c*n*x+e*h*y-c*l*y;this.n24=e*n*p-k*l*p+k*h*u-c*n*u-e*h*w+c*l*w;this.n31=f*w*v-n*t*v+n*p*z-h*w*z-f*p*y+h*t*y;this.n32=k*t*v-b*w*v-k*p*z+c*w*z+b*p*y-c*t*y;this.n33=e*n*v-k*f*v+k*h*z-c*n*z-b*h*y+c*f*y;this.n34=k*f*p-b*n*p-k*h*t+c*n*t+b*h*w-c*f*w;this.n41=l*t*v-f*u*v-l*p*z+h*u*z+f*p*x-h*t*x;this.n42=b*u*v-e*t*v+e*p*z-c*u*z-b*p*x+c*t*x;this.n43=e*f*v-b*l*v-e*h*z+c*l*z+b*h*x-c*f*x;this.n44=b*l*p-e*f*p+e*h*t-c*l*t-b*h*u+c*f*u;this.multiplyScalar(1/a.determinant());
|
|
|
+return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,k=a.z,h=Math.cos(b),b=Math.sin(b),f=Math.cos(e),e=Math.sin(e),l=Math.cos(k),k=Math.sin(k);switch(c){case "YXZ":var n=f*l,p=f*k,t=e*l,u=e*k;this.n11=n+u*b;this.n12=t*b-p;this.n13=h*e;this.n21=h*k;this.n22=h*l;this.n23=-b;this.n31=p*b-t;this.n32=u+n*b;this.n33=h*f;break;case "ZXY":n=f*l;p=f*k;t=e*l;u=e*k;this.n11=n-u*b;this.n12=-h*k;this.n13=t+p*b;this.n21=p+t*b;this.n22=h*l;this.n23=u-n*b;this.n31=-h*e;this.n32=b;this.n33=h*f;break;case "ZYX":n=
|
|
|
+h*l;p=h*k;t=b*l;u=b*k;this.n11=f*l;this.n12=t*e-p;this.n13=n*e+u;this.n21=f*k;this.n22=u*e+n;this.n23=p*e-t;this.n31=-e;this.n32=b*f;this.n33=h*f;break;case "YZX":n=h*f;p=h*e;t=b*f;u=b*e;this.n11=f*l;this.n12=u-n*k;this.n13=t*k+p;this.n21=k;this.n22=h*l;this.n23=-b*l;this.n31=-e*l;this.n32=p*k+t;this.n33=n-u*k;break;case "XZY":n=h*f;p=h*e;t=b*f;u=b*e;this.n11=f*l;this.n12=-k;this.n13=e*l;this.n21=n*k+u;this.n22=h*l;this.n23=p*k-t;this.n31=t*k-p;this.n32=b*l;this.n33=u*k+n;break;default:n=h*l,p=h*
|
|
|
+k,t=b*l,u=b*k,this.n11=f*l,this.n12=-f*k,this.n13=e,this.n21=p+t*e,this.n22=n-u*e,this.n23=-b*f,this.n31=u-n*e,this.n32=t+p*e,this.n33=h*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,k=a.w,h=c+c,f=b+b,l=e+e,a=c*h,n=c*f;c*=l;var p=b*f;b*=l;e*=l;h*=k;f*=k;k*=l;this.n11=1-(p+e);this.n12=n-k;this.n13=c+f;this.n21=n+k;this.n22=1-(a+e);this.n23=b-h;this.n31=c-f;this.n32=b+h;this.n33=1-(a+p);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
|
|
|
a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},compose:function(a,c,b){var e=THREE.Matrix4.__m1,k=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(c);k.setScale(b.x,b.y,b.z);this.multiply(e,k);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,c,b){var e=THREE.Matrix4.__v1,k=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);k.set(this.n12,this.n22,this.n32);h.set(this.n13,
|
|
|
this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;b=b instanceof THREE.Vector3?b:new THREE.Vector3;b.x=e.length();b.y=k.length();b.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=b.x;e.n21/=b.x;e.n31/=b.x;e.n12/=b.y;e.n22/=b.y;e.n32/=b.y;e.n13/=b.z;e.n23/=b.z;e.n33/=b.z;c.setFromRotationMatrix(e);return[a,c,b]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
|
|
|
return this},extractRotation:function(a){var c=THREE.Matrix4.__v1,b=1/c.set(a.n11,a.n21,a.n31).length(),e=1/c.set(a.n12,a.n22,a.n32).length(),c=1/c.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*c;this.n23=a.n23*c;this.n33=a.n33*c;return this}};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,k=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,f=-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,u=a.n23*a.n12-a.n22*a.n13,t=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*f+a.n31*u;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*e;b[1]=a*k;b[2]=a*h;b[3]=a*f;b[4]=a*l;b[5]=a*n;b[6]=a*u;b[7]=a*t;b[8]=a*p;return c};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,k=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,f=-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,t=-a.n23*a.n11+a.n21*a.n13,u=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*f+a.n31*p;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*e;b[1]=a*k;b[2]=a*h;b[3]=a*f;b[4]=a*l;b[5]=a*n;b[6]=a*p;b[7]=a*t;b[8]=a*u;return c};
|
|
|
THREE.Matrix4.makeFrustum=function(a,c,b,e,k,h){var f;f=new THREE.Matrix4;f.n11=2*k/(c-a);f.n12=0;f.n13=(c+a)/(c-a);f.n14=0;f.n21=0;f.n22=2*k/(e-b);f.n23=(e+b)/(e-b);f.n24=0;f.n31=0;f.n32=0;f.n33=-(h+k)/(h-k);f.n34=-2*h*k/(h-k);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,c,b,e){var k,a=b*Math.tan(a*Math.PI/360);k=-a;return THREE.Matrix4.makeFrustum(k*c,a*c,k,a,b,e)};
|
|
|
-THREE.Matrix4.makeOrtho=function(a,c,b,e,k,h){var f,l,n,u;f=new THREE.Matrix4;l=c-a;n=b-e;u=h-k;f.n11=2/l;f.n12=0;f.n13=0;f.n14=-((c+a)/l);f.n21=0;f.n22=2/n;f.n23=0;f.n24=-((b+e)/n);f.n31=0;f.n32=0;f.n33=-2/u;f.n34=-((h+k)/u);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
+THREE.Matrix4.makeOrtho=function(a,c,b,e,k,h){var f,l,n,p;f=new THREE.Matrix4;l=c-a;n=b-e;p=h-k;f.n11=2/l;f.n12=0;f.n13=0;f.n14=-((c+a)/l);f.n21=0;f.n22=2/n;f.n23=0;f.n24=-((b+e)/n);f.n31=0;f.n32=0;f.n33=-2/p;f.n34=-((h+k)/p);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
THREE.Object3D=function(){this.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};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.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)===
|
|
|
-1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,e,k;b=0;for(e=this.children.length;b<e;b++){k=this.children[b];if(k.name===a)return k;
|
|
|
if(c&&(k=k.getChildByName(a,c),k!==void 0))return k}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
|
|
|
this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
|
-THREE.Projector=function(){function a(){var a=h[k]=h[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function b(a,b){var c=0,e=1,f=a.z+a.w,k=b.z+b.w,h=-a.z+a.w,l=-b.z+b.w;return f>=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?c=Math.max(c,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?c=Math.max(c,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var e,k,h=[],f,l,n=[],u,t=[],p,w,v=[],z,x,y=[],C={objects:[],sprites:[],lights:[],elements:[]};
|
|
|
-new THREE.Vector3;var A=new THREE.Vector4,B=new THREE.Matrix4,D=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,M=new THREE.Vector4;this.computeFrustum=function(a){K[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);K[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);K[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);K[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);K[4].set(a.n41-
|
|
|
-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);K[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=K[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,b.projectionMatrixInverse);B.multiplyVector3(a);
|
|
|
-return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(a){C.objects.length=0;C.sprites.length=0;C.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var e=a.matrixWorld,f=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),k=0;k<6;k++)if(c=
|
|
|
-K[k].x*e.n14+K[k].y*e.n24+K[k].z*e.n34+K[k].w,c<=f){c=!1;break a}c=!0}c?C.objects.push(a):a instanceof THREE.Line?C.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?C.sprites.push(a):a instanceof THREE.Light&&C.lights.push(a);c=0;for(e=a.children.length;c<e;c++)b(a.children[c])}};b(a);return C};this.projectScene=function(K,L,W){var N=L.near,O=L.far,Z,Y,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la,ea;x=w=u=l=0;C.elements.length=0;L.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
|
|
|
-K.add(L));K.updateMatrixWorld();L.matrixWorldInverse.getInverse(L.matrixWorld);B.multiply(L.projectionMatrix,L.matrixWorldInverse);this.computeFrustum(B);C=this.projectGraph(K);K=0;for(Z=C.objects.length;K<Z;K++)if(J=C.objects[K],ra=J.matrixWorld,na=J.material,k=0,J instanceof THREE.Mesh){pa=J.geometry;qa=J.geometry.materials;o=pa.vertices;ja=pa.faces;la=pa.faceVertexUvs;pa=J.matrixRotationWorld.extractRotation(ra);Y=0;for(P=o.length;Y<P;Y++)e=a(),e.positionWorld.copy(o[Y].position),ra.multiplyVector3(e.positionWorld),
|
|
|
-e.positionScreen.copy(e.positionWorld),B.multiplyVector4(e.positionScreen),e.positionScreen.x/=e.positionScreen.w,e.positionScreen.y/=e.positionScreen.w,e.visible=e.positionScreen.z>N&&e.positionScreen.z<O;o=0;for(Y=ja.length;o<Y;o++){P=ja[o];if(P instanceof THREE.Face3)if(U=h[P.a],Q=h[P.b],aa=h[P.c],U.visible&&Q.visible&&aa.visible&&(J.doubleSided||J.flipSided!=(aa.positionScreen.x-U.positionScreen.x)*(Q.positionScreen.y-U.positionScreen.y)-(aa.positionScreen.y-U.positionScreen.y)*(Q.positionScreen.x-
|
|
|
+THREE.Projector=function(){function a(){var a=h[k]=h[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function b(a,b){var c=0,e=1,f=a.z+a.w,k=b.z+b.w,h=-a.z+a.w,l=-b.z+b.w;return f>=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?c=Math.max(c,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?c=Math.max(c,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var e,k,h=[],f,l,n=[],p,t=[],u,w,v=[],z,x,y=[],D={objects:[],sprites:[],lights:[],elements:[]};
|
|
|
+new THREE.Vector3;var B=new THREE.Vector4,A=new THREE.Matrix4,C=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,M=new THREE.Vector4;this.computeFrustum=function(a){L[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);L[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);L[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);L[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);L[4].set(a.n41-
|
|
|
+a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);L[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=L[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);A.multiply(b.projectionMatrix,b.matrixWorldInverse);A.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);A.multiply(b.matrixWorld,b.projectionMatrixInverse);A.multiplyVector3(a);
|
|
|
+return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(a){D.objects.length=0;D.sprites.length=0;D.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var e=a.matrixWorld,f=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),k=0;k<6;k++)if(c=
|
|
|
+L[k].x*e.n14+L[k].y*e.n24+L[k].z*e.n34+L[k].w,c<=f){c=!1;break a}c=!0}c?D.objects.push(a):a instanceof THREE.Line?D.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?D.sprites.push(a):a instanceof THREE.Light&&D.lights.push(a);c=0;for(e=a.children.length;c<e;c++)b(a.children[c])}};b(a);return D};this.projectScene=function(L,K,W){var N=K.near,O=K.far,Z,Y,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la,ea;x=w=p=l=0;D.elements.length=0;K.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
|
|
|
+L.add(K));L.updateMatrixWorld();K.matrixWorldInverse.getInverse(K.matrixWorld);A.multiply(K.projectionMatrix,K.matrixWorldInverse);this.computeFrustum(A);D=this.projectGraph(L);L=0;for(Z=D.objects.length;L<Z;L++)if(J=D.objects[L],ra=J.matrixWorld,na=J.material,k=0,J instanceof THREE.Mesh){pa=J.geometry;qa=J.geometry.materials;o=pa.vertices;ja=pa.faces;la=pa.faceVertexUvs;pa=J.matrixRotationWorld.extractRotation(ra);Y=0;for(P=o.length;Y<P;Y++)e=a(),e.positionWorld.copy(o[Y].position),ra.multiplyVector3(e.positionWorld),
|
|
|
+e.positionScreen.copy(e.positionWorld),A.multiplyVector4(e.positionScreen),e.positionScreen.x/=e.positionScreen.w,e.positionScreen.y/=e.positionScreen.w,e.visible=e.positionScreen.z>N&&e.positionScreen.z<O;o=0;for(Y=ja.length;o<Y;o++){P=ja[o];if(P instanceof THREE.Face3)if(U=h[P.a],Q=h[P.b],aa=h[P.c],U.visible&&Q.visible&&aa.visible&&(J.doubleSided||J.flipSided!=(aa.positionScreen.x-U.positionScreen.x)*(Q.positionScreen.y-U.positionScreen.y)-(aa.positionScreen.y-U.positionScreen.y)*(Q.positionScreen.x-
|
|
|
U.positionScreen.x)<0))T=n[l]=n[l]||new THREE.RenderableFace3,l++,f=T,f.v1.copy(U),f.v2.copy(Q),f.v3.copy(aa);else continue;else if(P instanceof THREE.Face4)if(U=h[P.a],Q=h[P.b],aa=h[P.c],T=h[P.d],U.visible&&Q.visible&&aa.visible&&T.visible&&(J.doubleSided||J.flipSided!=((T.positionScreen.x-U.positionScreen.x)*(Q.positionScreen.y-U.positionScreen.y)-(T.positionScreen.y-U.positionScreen.y)*(Q.positionScreen.x-U.positionScreen.x)<0||(Q.positionScreen.x-aa.positionScreen.x)*(T.positionScreen.y-aa.positionScreen.y)-
|
|
|
-(Q.positionScreen.y-aa.positionScreen.y)*(T.positionScreen.x-aa.positionScreen.x)<0)))ea=t[u]=t[u]||new THREE.RenderableFace4,u++,f=ea,f.v1.copy(U),f.v2.copy(Q),f.v3.copy(aa),f.v4.copy(T);else continue;f.normalWorld.copy(P.normal);pa.multiplyVector3(f.normalWorld);f.centroidWorld.copy(P.centroid);ra.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);B.multiplyVector3(f.centroidScreen);aa=P.vertexNormals;U=0;for(Q=aa.length;U<Q;U++)T=f.vertexNormalsWorld[U],T.copy(aa[U]),pa.multiplyVector3(T);
|
|
|
-U=0;for(Q=la.length;U<Q;U++)if(ea=la[U][o]){aa=0;for(T=ea.length;aa<T;aa++)f.uvs[U][aa]=ea[aa]}f.material=na;f.faceMaterial=P.materialIndex!==null?qa[P.materialIndex]:null;f.z=f.centroidScreen.z;C.elements.push(f)}}else if(J instanceof THREE.Line){D.multiply(B,ra);o=J.geometry.vertices;U=a();U.positionScreen.copy(o[0].position);D.multiplyVector4(U.positionScreen);Y=1;for(P=o.length;Y<P;Y++)if(U=a(),U.positionScreen.copy(o[Y].position),D.multiplyVector4(U.positionScreen),Q=h[k-2],H.copy(U.positionScreen),
|
|
|
-M.copy(Q.positionScreen),b(H,M))H.multiplyScalar(1/H.w),M.multiplyScalar(1/M.w),J=v[w]=v[w]||new THREE.RenderableLine,w++,p=J,p.v1.positionScreen.copy(H),p.v2.positionScreen.copy(M),p.z=Math.max(H.z,M.z),p.material=na,C.elements.push(p)}K=0;for(Z=C.sprites.length;K<Z;K++)if(J=C.sprites[K],ra=J.matrixWorld,J instanceof THREE.Particle&&(A.set(ra.n14,ra.n24,ra.n34,1),B.multiplyVector4(A),A.z/=A.w,A.z>0&&A.z<1))N=y[x]=y[x]||new THREE.RenderableParticle,x++,z=N,z.x=A.x/A.w,z.y=A.y/A.w,z.z=A.z,z.rotation=
|
|
|
-J.rotation.z,z.scale.x=J.scale.x*Math.abs(z.x-(A.x+L.projectionMatrix.n11)/(A.w+L.projectionMatrix.n14)),z.scale.y=J.scale.y*Math.abs(z.y-(A.y+L.projectionMatrix.n22)/(A.w+L.projectionMatrix.n24)),z.material=J.material,C.elements.push(z);W&&C.elements.sort(c);return C}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
|
|
|
+(Q.positionScreen.y-aa.positionScreen.y)*(T.positionScreen.x-aa.positionScreen.x)<0)))ea=t[p]=t[p]||new THREE.RenderableFace4,p++,f=ea,f.v1.copy(U),f.v2.copy(Q),f.v3.copy(aa),f.v4.copy(T);else continue;f.normalWorld.copy(P.normal);pa.multiplyVector3(f.normalWorld);f.centroidWorld.copy(P.centroid);ra.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);A.multiplyVector3(f.centroidScreen);aa=P.vertexNormals;U=0;for(Q=aa.length;U<Q;U++)T=f.vertexNormalsWorld[U],T.copy(aa[U]),pa.multiplyVector3(T);
|
|
|
+U=0;for(Q=la.length;U<Q;U++)if(ea=la[U][o]){aa=0;for(T=ea.length;aa<T;aa++)f.uvs[U][aa]=ea[aa]}f.material=na;f.faceMaterial=P.materialIndex!==null?qa[P.materialIndex]:null;f.z=f.centroidScreen.z;D.elements.push(f)}}else if(J instanceof THREE.Line){C.multiply(A,ra);o=J.geometry.vertices;U=a();U.positionScreen.copy(o[0].position);C.multiplyVector4(U.positionScreen);Y=1;for(P=o.length;Y<P;Y++)if(U=a(),U.positionScreen.copy(o[Y].position),C.multiplyVector4(U.positionScreen),Q=h[k-2],G.copy(U.positionScreen),
|
|
|
+M.copy(Q.positionScreen),b(G,M))G.multiplyScalar(1/G.w),M.multiplyScalar(1/M.w),J=v[w]=v[w]||new THREE.RenderableLine,w++,u=J,u.v1.positionScreen.copy(G),u.v2.positionScreen.copy(M),u.z=Math.max(G.z,M.z),u.material=na,D.elements.push(u)}L=0;for(Z=D.sprites.length;L<Z;L++)if(J=D.sprites[L],ra=J.matrixWorld,J instanceof THREE.Particle&&(B.set(ra.n14,ra.n24,ra.n34,1),A.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))N=y[x]=y[x]||new THREE.RenderableParticle,x++,z=N,z.x=B.x/B.w,z.y=B.y/B.w,z.z=B.z,z.rotation=
|
|
|
+J.rotation.z,z.scale.x=J.scale.x*Math.abs(z.x-(B.x+K.projectionMatrix.n11)/(B.w+K.projectionMatrix.n14)),z.scale.y=J.scale.y*Math.abs(z.y-(B.y+K.projectionMatrix.n22)/(B.w+K.projectionMatrix.n24)),z.material=J.material,D.elements.push(z);W&&D.elements.sort(c);return D}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;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 c=Math.PI/360,b=a.x*c,e=a.y*c,k=a.z*c,a=Math.cos(e),e=Math.sin(e),c=Math.cos(-k),k=Math.sin(-k),h=Math.cos(b),b=Math.sin(b),f=a*c,l=e*k;this.w=f*h-l*b;this.x=f*b+l*h;this.y=e*c*h+a*k*b;this.z=a*k*h-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b);
|
|
|
this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-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 c=
|
|
|
-this.x,b=this.y,e=this.z,k=this.w,h=a.x,f=a.y,l=a.z,a=a.w;this.x=c*a+k*h+b*l-e*f;this.y=b*a+k*f+e*h-c*l;this.z=e*a+k*l+c*f-b*h;this.w=k*a-c*h-b*f-e*l;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,k=a.z,h=this.x,f=this.y,l=this.z,n=this.w,u=n*b+f*k-l*e,t=n*e+l*b-h*k,p=n*k+h*e-f*b,b=-h*
|
|
|
-b-f*e-l*k;c.x=u*n+b*-h+t*-l-p*-f;c.y=t*n+b*-f+p*-h-u*-l;c.z=p*n+b*-l+u*-f-t*-h;return c}};
|
|
|
+this.x,b=this.y,e=this.z,k=this.w,h=a.x,f=a.y,l=a.z,a=a.w;this.x=c*a+k*h+b*l-e*f;this.y=b*a+k*f+e*h-c*l;this.z=e*a+k*l+c*f-b*h;this.w=k*a-c*h-b*f-e*l;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,k=a.z,h=this.x,f=this.y,l=this.z,n=this.w,p=n*b+f*k-l*e,t=n*e+l*b-h*k,u=n*k+h*e-f*b,b=-h*
|
|
|
+b-f*e-l*k;c.x=p*n+b*-h+t*-l-u*-f;c.y=t*n+b*-f+u*-h-p*-l;c.z=u*n+b*-l+p*-f-t*-h;return c}};
|
|
|
THREE.Quaternion.slerp=function(a,c,b,e){var k=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;k<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,k=-k):b.copy(c);if(Math.abs(k)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var h=Math.acos(k),k=Math.sqrt(1-k*k);if(Math.abs(k)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;b.w=a.w*c+b.w*e;b.x=a.x*c+b.x*e;b.y=a.y*c+b.y*e;b.z=a.z*c+b.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
THREE.Face3=function(a,c,b,e,k,h){this.a=a;this.b=c;this.c=b;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(a,c,b,e,k,h,f){this.a=a;this.b=c;this.c=b;this.d=e;this.normal=k instanceof THREE.Vector3?k:new THREE.Vector3;this.vertexNormals=k instanceof Array?k:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
|
|
@@ -82,15 +82,15 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid
|
|
|
b,e,k,h,f,l=new THREE.Vector3,n=new THREE.Vector3;e=0;for(k=this.faces.length;e<k;e++){h=this.faces[e];if(a&&h.vertexNormals.length){l.set(0,0,0);c=0;for(b=h.vertexNormals.length;c<b;c++)l.addSelf(h.vertexNormals[c]);l.divideScalar(3)}else c=this.vertices[h.a],b=this.vertices[h.b],f=this.vertices[h.c],l.sub(f.position,b.position),n.sub(c.position,b.position),l.crossSelf(n);l.isZero()||l.normalize();h.normal.copy(l)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
|
|
|
Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
|
|
|
THREE.Face3?(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal),e[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(e[b.a]),b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(e[b.a]),
|
|
|
-b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,k,h,o){l=a.vertices[b].position;n=a.vertices[c].position;u=a.vertices[e].position;t=f[k];p=f[h];w=f[o];v=n.x-l.x;z=u.x-l.x;x=n.y-l.y;y=u.y-l.y;C=n.z-l.z;A=u.z-l.z;B=p.u-t.u;D=w.u-t.u;K=p.v-t.v;H=w.v-t.v;M=1/(B*H-D*K);N.set((H*v-K*z)*M,(H*x-K*y)*M,(H*C-K*A)*M);O.set((B*z-D*v)*M,(B*y-D*x)*M,(B*A-D*C)*M);L[b].addSelf(N);L[c].addSelf(N);L[e].addSelf(N);W[b].addSelf(O);
|
|
|
-W[c].addSelf(O);W[e].addSelf(O)}var c,b,e,k,h,f,l,n,u,t,p,w,v,z,x,y,C,A,B,D,K,H,M,V,L=[],W=[],N=new THREE.Vector3,O=new THREE.Vector3,Z=new THREE.Vector3,Y=new THREE.Vector3,P=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)L[c]=new THREE.Vector3,W[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)h=this.faces[c],f=this.faceVertexUvs[0][c],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"];c=0;for(b=this.faces.length;c<b;c++){h=this.faces[c];for(e=0;e<h.vertexNormals.length;e++)P.copy(h.vertexNormals[e]),k=h[o[e]],V=L[k],Z.copy(V),Z.subSelf(P.multiplyScalar(P.dot(V))).normalize(),Y.cross(h.vertexNormals[e],V),k=Y.dot(W[k]),k=k<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(Z.x,Z.y,Z.z,k)}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,
|
|
|
+b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,k,h,o){l=a.vertices[b].position;n=a.vertices[c].position;p=a.vertices[e].position;t=f[k];u=f[h];w=f[o];v=n.x-l.x;z=p.x-l.x;x=n.y-l.y;y=p.y-l.y;D=n.z-l.z;B=p.z-l.z;A=u.u-t.u;C=w.u-t.u;L=u.v-t.v;G=w.v-t.v;M=1/(A*G-C*L);N.set((G*v-L*z)*M,(G*x-L*y)*M,(G*D-L*B)*M);O.set((A*z-C*v)*M,(A*y-C*x)*M,(A*B-C*D)*M);K[b].addSelf(N);K[c].addSelf(N);K[e].addSelf(N);W[b].addSelf(O);
|
|
|
+W[c].addSelf(O);W[e].addSelf(O)}var c,b,e,k,h,f,l,n,p,t,u,w,v,z,x,y,D,B,A,C,L,G,M,V,K=[],W=[],N=new THREE.Vector3,O=new THREE.Vector3,Z=new THREE.Vector3,Y=new THREE.Vector3,P=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)K[c]=new THREE.Vector3,W[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)h=this.faces[c],f=this.faceVertexUvs[0][c],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"];c=0;for(b=this.faces.length;c<b;c++){h=this.faces[c];for(e=0;e<h.vertexNormals.length;e++)P.copy(h.vertexNormals[e]),k=h[o[e]],V=K[k],Z.copy(V),Z.subSelf(P.multiplyScalar(P.dot(V))).normalize(),Y.cross(h.vertexNormals[e],V),k=Y.dot(W[k]),k=k<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(Z.x,Z.y,Z.z,k)}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 c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];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,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],e,k=Math.pow(10,4),h,f;h=0;for(f=this.vertices.length;h<f;h++)e=this.vertices[h].position,e=[Math.round(e.x*k),Math.round(e.y*k),Math.round(e.z*k)].join("_"),a[e]===void 0?(a[e]=h,c.push(this.vertices[h]),
|
|
|
b[h]=c.length-1):b[h]=b[a[e]];h=0;for(f=this.faces.length;h<f;h++)if(a=this.faces[h],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
|
|
|
-THREE.Spline=function(a){function c(a,b,c,e,f,k,h){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*h+(-3*(b-c)-2*a-e)*k+a*f+b}this.points=a;var b=[],e={x:0,y:0,z:0},k,h,f,l,n,u,t,p,w;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){k=(this.points.length-1)*a;h=Math.floor(k);f=k-h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>this.points.length-2?h:h+1;b[3]=h>this.points.length-3?h:h+2;u=this.points[b[0]];t=this.points[b[1]];
|
|
|
-p=this.points[b[2]];w=this.points[b[3]];l=f*f;n=f*l;e.x=c(u.x,t.x,p.x,w.x,f,l,n);e.y=c(u.y,t.y,p.y,w.y,f,l,n);e.z=c(u.z,t.z,p.z,w.z,f,l,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,f=new THREE.Vector3,k=new THREE.Vector3,h=[],l=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),k.copy(position),
|
|
|
-l+=k.distanceTo(f),f.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=l,e=b);h[h.length]=l;return{chunks:h,total:l}};this.reparametrizeByArcLength=function(a){var b,c,e,f,k,h,l=[],n=new THREE.Vector3,u=this.getLength();l.push(n.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=u.chunks[b]-u.chunks[b-1];h=Math.ceil(a*c/u.total);f=(b-1)/(this.points.length-1);k=b/(this.points.length-1);for(c=1;c<h-1;c++)e=f+c*(1/h)*(k-f),position=this.getPoint(e),l.push(n.copy(position).clone());
|
|
|
+THREE.Spline=function(a){function c(a,b,c,e,f,k,h){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*h+(-3*(b-c)-2*a-e)*k+a*f+b}this.points=a;var b=[],e={x:0,y:0,z:0},k,h,f,l,n,p,t,u,w;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){k=(this.points.length-1)*a;h=Math.floor(k);f=k-h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>this.points.length-2?h:h+1;b[3]=h>this.points.length-3?h:h+2;p=this.points[b[0]];t=this.points[b[1]];
|
|
|
+u=this.points[b[2]];w=this.points[b[3]];l=f*f;n=f*l;e.x=c(p.x,t.x,u.x,w.x,f,l,n);e.y=c(p.y,t.y,u.y,w.y,f,l,n);e.z=c(p.z,t.z,u.z,w.z,f,l,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,f=new THREE.Vector3,k=new THREE.Vector3,h=[],l=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),k.copy(position),
|
|
|
+l+=k.distanceTo(f),f.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=l,e=b);h[h.length]=l;return{chunks:h,total:l}};this.reparametrizeByArcLength=function(a){var b,c,e,f,k,h,l=[],n=new THREE.Vector3,p=this.getLength();l.push(n.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=p.chunks[b]-p.chunks[b-1];h=Math.ceil(a*c/p.total);f=(b-1)/(this.points.length-1);k=b/(this.points.length-1);for(c=1;c<h-1;c++)e=f+c*(1/h)*(k-f),position=this.getPoint(e),l.push(n.copy(position).clone());
|
|
|
l.push(n.copy(this.points[b]).clone())}this.points=l}};THREE.Edge=function(a,c,b,e){this.vertices=[a,c];this.vertexIndices=[b,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;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
|
|
|
THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,c,b,e,k,h){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=e;this.near=k!==void 0?k:0.1;this.far=h!==void 0?h:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
|
|
@@ -148,47 +148,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
|
|
|
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
|
|
|
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
|
|
|
THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,k,h;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;k=b/2;h=e/2};this.render=function(b,e){var n,u,t,p,w,v,z,x;a=c.projectScene(b,e);n=0;for(u=a.length;n<u;n++)if(w=a[n],w instanceof THREE.RenderableParticle){z=w.x*k+k;x=w.y*h+h;t=0;for(p=w.material.length;t<p;t++)if(v=w.material[t],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=z+"px",v.style.top=x+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(a){function c(a){if(A!=a)x.globalAlpha=A=a}function b(a){if(B!=a){switch(a){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}B=a}}function e(a){if(D!=a)x.strokeStyle=D=a}function k(a){if(K!=a)x.fillStyle=K=a}var h=this,f,l,n,u=new THREE.Projector,a=a||{},t=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
-p,w,v,z,x=t.getContext("2d"),y=new THREE.Color(0),C=0,A=1,B=0,D=null,K=null,H=null,M=null,V=null,L,W,N,O,Z=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la=new THREE.Color,ea=new THREE.Color,ca=new THREE.Color,$=new THREE.Color,ga=new THREE.Color,ha=[],oa,ma,ka,sa,Da,Ea,Ca,Fa,za,F,fa=new THREE.Rectangle,ia=new THREE.Rectangle,G=new THREE.Rectangle,da=!1,ua=new THREE.Color,va=new THREE.Color,ta=new THREE.Color,wa=new THREE.Vector3,Ga,Ba,Ka,ya,X,Ia,a=16;Ga=document.createElement("canvas");
|
|
|
-Ga.width=Ga.height=2;Ba=Ga.getContext("2d");Ba.fillStyle="rgba(0,0,0,1)";Ba.fillRect(0,0,2,2);Ka=Ba.getImageData(0,0,2,2);ya=Ka.data;X=document.createElement("canvas");X.width=X.height=a;Ia=X.getContext("2d");Ia.translate(-a/2,-a/2);Ia.scale(a,a);a--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;w=b;v=Math.floor(p/2);z=Math.floor(w/2);t.width=p;t.height=w;fa.set(-v,-z,v,z);ia.set(-v,-z,v,z);A=1;B=0;V=M=
|
|
|
-H=K=D=null};this.setClearColor=function(a,b){y.copy(a);C=b;ia.set(-v,-z,v,z)};this.setClearColorHex=function(a,b){y.setHex(a);C=b;ia.set(-v,-z,v,z)};this.clear=function(){x.setTransform(1,0,0,-1,v,z);ia.isEmpty()||(ia.minSelf(fa),ia.inflate(2),C<1&&x.clearRect(Math.floor(ia.getX()),Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight())),C>0&&(b(THREE.NormalBlending),c(1),k("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+C+")"),x.fillRect(Math.floor(ia.getX()),
|
|
|
-Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight()))),ia.empty())};this.render=function(a,t){function p(a){var b,c,e,f;ua.setRGB(0,0,0);va.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],f=e.color,e instanceof THREE.AmbientLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):e instanceof THREE.DirectionalLight?(va.r+=f.r,va.g+=f.g,va.b+=f.b):e instanceof THREE.PointLight&&(ta.r+=f.r,ta.g+=f.g,ta.b+=f.b)}function w(a,b,c,e){var f,k,h,o,l,n;f=0;for(k=a.length;f<k;f++)h=a[f],
|
|
|
-o=h.color,h instanceof THREE.DirectionalLight?(l=h.matrixWorld.getPosition(),n=c.dot(l),n<=0||(n*=h.intensity,e.r+=o.r*n,e.g+=o.g*n,e.b+=o.b*n)):h instanceof THREE.PointLight&&(l=h.matrixWorld.getPosition(),n=c.dot(wa.sub(l,b).normalize()),n<=0||(n*=h.distance==0?1:1-Math.min(b.distanceTo(l)/h.distance,1),n!=0&&(n*=h.intensity,e.r+=o.r*n,e.g+=o.g*n,e.b+=o.b*n)))}function y(a,f,h){c(h.opacity);b(h.blending);var o,l,n,u,t,p;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)u=h.map.image,t=u.width>>
|
|
|
-1,p=u.height>>1,h=f.scale.x*v,n=f.scale.y*z,o=h*t,l=n*p,G.set(a.x-o,a.y-l,a.x+o,a.y+l),fa.intersects(G)&&(x.save(),x.translate(a.x,a.y),x.rotate(-f.rotation),x.scale(h,-n),x.translate(-t,-p),x.drawImage(u,0,0),x.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(o=f.scale.x*v,l=f.scale.y*z,G.set(a.x-o,a.y-l,a.x+o,a.y+l),fa.intersects(G)&&(e(h.color.getContextStyle()),k(h.color.getContextStyle()),x.save(),x.translate(a.x,a.y),x.rotate(-f.rotation),x.scale(o,l),h.program(x),x.restore()))}function ab(a,
|
|
|
-f,h,k){c(k.opacity);b(k.blending);x.beginPath();x.moveTo(a.positionScreen.x,a.positionScreen.y);x.lineTo(f.positionScreen.x,f.positionScreen.y);x.closePath();if(k instanceof THREE.LineBasicMaterial){a=k.linewidth;if(H!=a)x.lineWidth=H=a;a=k.linecap;if(M!=a)x.lineCap=M=a;a=k.linejoin;if(V!=a)x.lineJoin=V=a;e(k.color.getContextStyle());x.stroke();G.inflate(k.linewidth*2)}}function A(a,e,f,k,l,u,v,p){h.info.render.vertices+=3;h.info.render.faces++;c(p.opacity);b(p.blending);P=a.positionScreen.x;o=a.positionScreen.y;
|
|
|
-U=e.positionScreen.x;Q=e.positionScreen.y;aa=f.positionScreen.x;T=f.positionScreen.y;C(P,o,U,Q,aa,T);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(sa=v.uvs[0],Wa(P,o,U,Q,aa,T,sa[k].u,sa[k].v,sa[l].u,sa[l].v,sa[u].u,sa[u].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=t.matrixWorldInverse,wa.copy(v.vertexNormalsWorld[k]),Da=(wa.x*a.n11+wa.y*a.n12+wa.z*a.n13)*0.5+0.5,Ea=-(wa.x*a.n21+wa.y*a.n22+wa.z*a.n23)*0.5+
|
|
|
-0.5,wa.copy(v.vertexNormalsWorld[l]),Ca=(wa.x*a.n11+wa.y*a.n12+wa.z*a.n13)*0.5+0.5,Fa=-(wa.x*a.n21+wa.y*a.n22+wa.z*a.n23)*0.5+0.5,wa.copy(v.vertexNormalsWorld[u]),za=(wa.x*a.n11+wa.y*a.n12+wa.z*a.n13)*0.5+0.5,F=-(wa.x*a.n21+wa.y*a.n22+wa.z*a.n23)*0.5+0.5,Wa(P,o,U,Q,aa,T,Da,Ea,Ca,Fa,za,F,p.envMap)}else p.wireframe?K(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&
|
|
|
-(sa=v.uvs[0],Wa(P,o,U,Q,aa,T,sa[k].u,sa[k].v,sa[l].u,sa[l].v,sa[u].u,sa[u].v,p.map)),b(THREE.SubtractiveBlending)),da?!p.wireframe&&p.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3?(ea.r=ca.r=$.r=ua.r,ea.g=ca.g=$.g=ua.g,ea.b=ca.b=$.b=ua.b,w(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ea),w(n,v.v2.positionWorld,v.vertexNormalsWorld[1],ca),w(n,v.v3.positionWorld,v.vertexNormalsWorld[2],$),ea.r=Math.max(0,Math.min(p.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(p.color.g*ea.g,1)),ea.b=Math.max(0,
|
|
|
-Math.min(p.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(p.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ca.b,1)),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),ga.r=(ca.r+$.r)*0.5,ga.g=(ca.g+$.g)*0.5,ga.b=(ca.b+$.b)*0.5,ka=Ua(ea,ca,$,ga),Sa(P,o,U,Q,aa,T,0,0,1,0,0,1,ka)):(la.r=ua.r,la.g=ua.g,la.b=ua.b,w(n,v.centroidWorld,v.normalWorld,la),la.r=Math.max(0,Math.min(p.color.r*
|
|
|
-la.r,1)),la.g=Math.max(0,Math.min(p.color.g*la.g,1)),la.b=Math.max(0,Math.min(p.color.b*la.b,1)),p.wireframe?K(la,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(la)):p.wireframe?K(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(p.color);else if(p instanceof THREE.MeshDepthMaterial)oa=t.near,ma=t.far,ea.r=ea.g=ea.b=1-Oa(a.positionScreen.z,oa,ma),ca.r=ca.g=ca.b=1-Oa(e.positionScreen.z,oa,ma),$.r=$.g=$.b=1-Oa(f.positionScreen.z,oa,ma),ga.r=(ca.r+$.r)*0.5,ga.g=
|
|
|
-(ca.g+$.g)*0.5,ga.b=(ca.b+$.b)*0.5,ka=Ua(ea,ca,$,ga),Sa(P,o,U,Q,aa,T,0,0,1,0,0,1,ka);else if(p instanceof THREE.MeshNormalMaterial)la.r=Ta(v.normalWorld.x),la.g=Ta(v.normalWorld.y),la.b=Ta(v.normalWorld.z),p.wireframe?K(la,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(la)}function B(a,e,f,k,l,u,p,v,xa){h.info.render.vertices+=4;h.info.render.faces++;c(v.opacity);b(v.blending);if(v.map||v.envMap)A(a,e,k,0,1,3,p,v,xa),A(l,f,u,1,2,3,p,v,xa);else if(P=a.positionScreen.x,o=a.positionScreen.y,
|
|
|
-U=e.positionScreen.x,Q=e.positionScreen.y,aa=f.positionScreen.x,T=f.positionScreen.y,J=k.positionScreen.x,ra=k.positionScreen.y,pa=l.positionScreen.x,na=l.positionScreen.y,qa=u.positionScreen.x,ja=u.positionScreen.y,v instanceof THREE.MeshBasicMaterial)D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(v.color);else if(v instanceof THREE.MeshLambertMaterial)da?!v.wireframe&&v.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==4?(ea.r=
|
|
|
-ca.r=$.r=ga.r=ua.r,ea.g=ca.g=$.g=ga.g=ua.g,ea.b=ca.b=$.b=ga.b=ua.b,w(n,p.v1.positionWorld,p.vertexNormalsWorld[0],ea),w(n,p.v2.positionWorld,p.vertexNormalsWorld[1],ca),w(n,p.v4.positionWorld,p.vertexNormalsWorld[3],$),w(n,p.v3.positionWorld,p.vertexNormalsWorld[2],ga),ea.r=Math.max(0,Math.min(v.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(v.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(v.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(v.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(v.color.g*ca.g,1)),ca.b=Math.max(0,
|
|
|
-Math.min(v.color.b*ca.b,1)),$.r=Math.max(0,Math.min(v.color.r*$.r,1)),$.g=Math.max(0,Math.min(v.color.g*$.g,1)),$.b=Math.max(0,Math.min(v.color.b*$.b,1)),ga.r=Math.max(0,Math.min(v.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(v.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(v.color.b*ga.b,1)),ka=Ua(ea,ca,$,ga),C(P,o,U,Q,J,ra),Sa(P,o,U,Q,J,ra,0,0,1,0,0,1,ka),C(pa,na,aa,T,qa,ja),Sa(pa,na,aa,T,qa,ja,1,0,1,1,0,1,ka)):(la.r=ua.r,la.g=ua.g,la.b=ua.b,w(n,p.centroidWorld,p.normalWorld,la),la.r=Math.max(0,Math.min(v.color.r*
|
|
|
-la.r,1)),la.g=Math.max(0,Math.min(v.color.g*la.g,1)),la.b=Math.max(0,Math.min(v.color.b*la.b,1)),D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(la,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(la)):(D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(v.color));else if(v instanceof THREE.MeshNormalMaterial)la.r=Ta(p.normalWorld.x),la.g=Ta(p.normalWorld.y),la.b=Ta(p.normalWorld.z),D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(la,v.wireframeLinewidth,
|
|
|
-v.wireframeLinecap,v.wireframeLinejoin):Ma(la);else if(v instanceof THREE.MeshDepthMaterial)oa=t.near,ma=t.far,ea.r=ea.g=ea.b=1-Oa(a.positionScreen.z,oa,ma),ca.r=ca.g=ca.b=1-Oa(e.positionScreen.z,oa,ma),$.r=$.g=$.b=1-Oa(k.positionScreen.z,oa,ma),ga.r=ga.g=ga.b=1-Oa(f.positionScreen.z,oa,ma),ka=Ua(ea,ca,$,ga),C(P,o,U,Q,J,ra),Sa(P,o,U,Q,J,ra,0,0,1,0,0,1,ka),C(pa,na,aa,T,qa,ja),Sa(pa,na,aa,T,qa,ja,1,0,1,1,0,1,ka)}function C(a,b,c,e,f,k){x.beginPath();x.moveTo(a,b);x.lineTo(c,e);x.lineTo(f,k);x.lineTo(a,
|
|
|
-b);x.closePath()}function D(a,b,c,e,f,k,h,o){x.beginPath();x.moveTo(a,b);x.lineTo(c,e);x.lineTo(f,k);x.lineTo(h,o);x.lineTo(a,b);x.closePath()}function K(a,b,c,f){if(H!=b)x.lineWidth=H=b;if(M!=c)x.lineCap=M=c;if(V!=f)x.lineJoin=V=f;e(a.getContextStyle());x.stroke();G.inflate(b*2)}function Ma(a){k(a.getContextStyle());x.fill()}function Wa(a,b,c,e,f,h,o,l,n,v,p,u,t){if(t.image.width!=0){if(t.needsUpdate==!0||ha[t.id]==void 0){var xa=t.wrapS==THREE.RepeatWrapping,w=t.wrapT==THREE.RepeatWrapping;ha[t.id]=
|
|
|
-x.createPattern(t.image,xa&&w?"repeat":xa&&!w?"repeat-x":!xa&&w?"repeat-y":"no-repeat");t.needsUpdate=!1}k(ha[t.id]);var xa=t.offset.x/t.repeat.x,w=t.offset.y/t.repeat.y,F=(t.image.width-1)*t.repeat.x,t=(t.image.height-1)*t.repeat.y,o=(o+xa)*F,l=(l+w)*t,n=(n+xa)*F,v=(v+w)*t,p=(p+xa)*F,u=(u+w)*t;c-=a;e-=b;f-=a;h-=b;n-=o;v-=l;p-=o;u-=l;xa=1/(n*u-p*v);t=(u*c-v*f)*xa;v=(u*e-v*h)*xa;c=(n*f-p*c)*xa;e=(n*h-p*e)*xa;a=a-t*o-c*l;b=b-v*o-e*l;x.save();x.transform(t,v,c,e,a,b);x.fill();x.restore()}}function Sa(a,
|
|
|
-b,c,e,f,k,h,o,l,n,v,p,u){var t,xa;t=u.width-1;xa=u.height-1;h*=t;o*=xa;l*=t;n*=xa;v*=t;p*=xa;c-=a;e-=b;f-=a;k-=b;l-=h;n-=o;v-=h;p-=o;xa=1/(l*p-v*n);t=(p*c-n*f)*xa;n=(p*e-n*k)*xa;c=(l*f-v*c)*xa;e=(l*k-v*e)*xa;a=a-t*h-c*o;b=b-n*h-e*o;x.save();x.transform(t,n,c,e,a,b);x.clip();x.drawImage(u,0,0);x.restore()}function Ua(a,b,c,e){var f=~~(a.r*255),k=~~(a.g*255),a=~~(a.b*255),h=~~(b.r*255),o=~~(b.g*255),b=~~(b.b*255),l=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),v=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255);ya[0]=
|
|
|
-f<0?0:f>255?255:f;ya[1]=k<0?0:k>255?255:k;ya[2]=a<0?0:a>255?255:a;ya[4]=h<0?0:h>255?255:h;ya[5]=o<0?0:o>255?255:o;ya[6]=b<0?0:b>255?255:b;ya[8]=l<0?0:l>255?255:l;ya[9]=n<0?0:n>255?255:n;ya[10]=c<0?0:c>255?255:c;ya[12]=v<0?0:v>255?255:v;ya[13]=p<0?0:p>255?255:p;ya[14]=e<0?0:e>255?255:e;Ba.putImageData(Ka,0,0);Ia.drawImage(Ga,0,0);return X}function Oa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ta(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Na(a,b){var c=b.x-a.x,e=b.y-a.y,f=c*c+e*e;f!=0&&(f=1/
|
|
|
-Math.sqrt(f),c*=f,e*=f,b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Va,Xa,Aa,Ha;this.autoClear?this.clear():x.setTransform(1,0,0,-1,v,z);h.info.render.vertices=0;h.info.render.faces=0;f=u.projectScene(a,t,this.sortElements);l=f.elements;n=f.lights;(da=n.length>0)&&p(n);Va=0;for(Xa=l.length;Va<Xa;Va++)if(Aa=l[Va],Ha=Aa.material,Ha=Ha instanceof THREE.MeshFaceMaterial?Aa.faceMaterial:Ha,!(Ha==null||Ha.opacity==0)){G.empty();if(Aa instanceof THREE.RenderableParticle)L=Aa,L.x*=v,L.y*=z,y(L,Aa,Ha,a);else if(Aa instanceof
|
|
|
-THREE.RenderableLine)L=Aa.v1,W=Aa.v2,L.positionScreen.x*=v,L.positionScreen.y*=z,W.positionScreen.x*=v,W.positionScreen.y*=z,G.addPoint(L.positionScreen.x,L.positionScreen.y),G.addPoint(W.positionScreen.x,W.positionScreen.y),fa.intersects(G)&&ab(L,W,Aa,Ha,a);else if(Aa instanceof THREE.RenderableFace3)L=Aa.v1,W=Aa.v2,N=Aa.v3,L.positionScreen.x*=v,L.positionScreen.y*=z,W.positionScreen.x*=v,W.positionScreen.y*=z,N.positionScreen.x*=v,N.positionScreen.y*=z,Ha.overdraw&&(Na(L.positionScreen,W.positionScreen),
|
|
|
-Na(W.positionScreen,N.positionScreen),Na(N.positionScreen,L.positionScreen)),G.add3Points(L.positionScreen.x,L.positionScreen.y,W.positionScreen.x,W.positionScreen.y,N.positionScreen.x,N.positionScreen.y),fa.intersects(G)&&A(L,W,N,0,1,2,Aa,Ha,a);else if(Aa instanceof THREE.RenderableFace4)L=Aa.v1,W=Aa.v2,N=Aa.v3,O=Aa.v4,L.positionScreen.x*=v,L.positionScreen.y*=z,W.positionScreen.x*=v,W.positionScreen.y*=z,N.positionScreen.x*=v,N.positionScreen.y*=z,O.positionScreen.x*=v,O.positionScreen.y*=z,Z.positionScreen.copy(W.positionScreen),
|
|
|
-Y.positionScreen.copy(O.positionScreen),Ha.overdraw&&(Na(L.positionScreen,W.positionScreen),Na(W.positionScreen,O.positionScreen),Na(O.positionScreen,L.positionScreen),Na(N.positionScreen,Z.positionScreen),Na(N.positionScreen,Y.positionScreen)),G.addPoint(L.positionScreen.x,L.positionScreen.y),G.addPoint(W.positionScreen.x,W.positionScreen.y),G.addPoint(N.positionScreen.x,N.positionScreen.y),G.addPoint(O.positionScreen.x,O.positionScreen.y),fa.intersects(G)&&Ha.opacity!=0&&B(L,W,N,O,Z,Y,Aa,Ha,a);
|
|
|
-ia.addRectangle(G)}x.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,e){var f,k,h,l,n,v;f=0;for(k=a.length;f<k;f++)h=a[f],l=h.color,h instanceof THREE.DirectionalLight?(n=h.matrixWorld.getPosition(),v=c.dot(n),v<=0||(v*=h.intensity,e.r+=l.r*v,e.g+=l.g*v,e.b+=l.b*v)):h instanceof THREE.PointLight&&(n=h.matrixWorld.getPosition(),v=c.dot(L.sub(n,b).normalize()),v<=0||(v*=h.distance==0?1:1-Math.min(b.distanceTo(n)/h.distance,1),v!=0&&(v*=h.intensity,e.r+=l.r*v,e.g+=l.g*v,e.b+=l.b*v)))}function c(a){W[a]==null&&(W[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"path"),P==0&&W[a].setAttribute("shape-rendering","crispEdges"));return W[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,k,h,f,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,t,p,w,v,z,x,y,C=new THREE.Rectangle,A=new THREE.Rectangle,B=!1,D=new THREE.Color,K=new THREE.Color,H=new THREE.Color,M=new THREE.Color,V,L=new THREE.Vector3,W=[],N=[],O,Z,Y,P=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":P=1;break;case "low":P=0}};this.setSize=function(a,b){u=a;t=b;p=u/2;w=t/2;n.setAttribute("viewBox",-p+" "+-w+" "+u+" "+t);n.setAttribute("width",u);n.setAttribute("height",t);C.set(-p,-w,p,w)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(o,u){var t,L,T,J;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;k=l.projectScene(o,u,this.sortElements);h=k.elements;
|
|
|
-f=k.lights;Y=Z=0;if(B=f.length>0){K.setRGB(0,0,0);H.setRGB(0,0,0);M.setRGB(0,0,0);t=0;for(L=f.length;t<L;t++)J=f[t],T=J.color,J instanceof THREE.AmbientLight?(K.r+=T.r,K.g+=T.g,K.b+=T.b):J instanceof THREE.DirectionalLight?(H.r+=T.r,H.g+=T.g,H.b+=T.b):J instanceof THREE.PointLight&&(M.r+=T.r,M.g+=T.g,M.b+=T.b)}t=0;for(L=h.length;t<L;t++)if(T=h[t],J=T.material,J=J instanceof THREE.MeshFaceMaterial?T.faceMaterial:J,!(J==null||J.opacity==0))if(A.empty(),T instanceof THREE.RenderableParticle)v=T,v.x*=
|
|
|
-p,v.y*=-w,m=0,ml=T.materials.length;else if(T instanceof THREE.RenderableLine){if(v=T.v1,z=T.v2,v.positionScreen.x*=p,v.positionScreen.y*=-w,z.positionScreen.x*=p,z.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),C.intersects(A)){T=v;var W=z,pa=Y++;N[pa]==null&&(N[pa]=document.createElementNS("http://www.w3.org/2000/svg","line"),P==0&&N[pa].setAttribute("shape-rendering","crispEdges"));O=N[pa];O.setAttribute("x1",T.positionScreen.x);
|
|
|
-O.setAttribute("y1",T.positionScreen.y);O.setAttribute("x2",W.positionScreen.x);O.setAttribute("y2",W.positionScreen.y);J instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+J.color.getContextStyle()+"; stroke-width: "+J.linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.linecap+"; stroke-linejoin: "+J.linejoin),n.appendChild(O))}}else if(T instanceof THREE.RenderableFace3){if(v=T.v1,z=T.v2,x=T.v3,v.positionScreen.x*=p,v.positionScreen.y*=-w,z.positionScreen.x*=
|
|
|
-p,z.positionScreen.y*=-w,x.positionScreen.x*=p,x.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),C.intersects(A)){var W=v,pa=z,na=x;e.info.render.vertices+=3;e.info.render.faces++;O=c(Z++);O.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+pa.positionScreen.x+" "+pa.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+"z");J instanceof THREE.MeshBasicMaterial?
|
|
|
-D.copy(J.color):J instanceof THREE.MeshLambertMaterial?B?(D.r=K.r,D.g=K.g,D.b=K.b,a(f,T.centroidWorld,T.normalWorld,D),D.r=Math.max(0,Math.min(J.color.r*D.r,1)),D.g=Math.max(0,Math.min(J.color.g*D.g,1)),D.b=Math.max(0,Math.min(J.color.b*D.b,1))):D.copy(J.color):J instanceof THREE.MeshDepthMaterial?(V=1-J.__2near/(J.__farPlusNear-T.z*J.__farMinusNear),D.setRGB(V,V,V)):J instanceof THREE.MeshNormalMaterial&&D.setRGB(b(T.normalWorld.x),b(T.normalWorld.y),b(T.normalWorld.z));J.wireframe?O.setAttribute("style",
|
|
|
-"fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+J.wireframeLinewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframeLinecap+"; stroke-linejoin: "+J.wireframeLinejoin):O.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+J.opacity);n.appendChild(O)}}else if(T instanceof THREE.RenderableFace4&&(v=T.v1,z=T.v2,x=T.v3,y=T.v4,v.positionScreen.x*=p,v.positionScreen.y*=-w,z.positionScreen.x*=p,z.positionScreen.y*=-w,x.positionScreen.x*=p,x.positionScreen.y*=
|
|
|
--w,y.positionScreen.x*=p,y.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),A.addPoint(y.positionScreen.x,y.positionScreen.y),C.intersects(A))){var W=v,pa=z,na=x,qa=y;e.info.render.vertices+=4;e.info.render.faces++;O=c(Z++);O.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+pa.positionScreen.x+" "+pa.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+
|
|
|
-" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");J instanceof THREE.MeshBasicMaterial?D.copy(J.color):J instanceof THREE.MeshLambertMaterial?B?(D.r=K.r,D.g=K.g,D.b=K.b,a(f,T.centroidWorld,T.normalWorld,D),D.r=Math.max(0,Math.min(J.color.r*D.r,1)),D.g=Math.max(0,Math.min(J.color.g*D.g,1)),D.b=Math.max(0,Math.min(J.color.b*D.b,1))):D.copy(J.color):J instanceof THREE.MeshDepthMaterial?(V=1-J.__2near/(J.__farPlusNear-T.z*J.__farMinusNear),D.setRGB(V,V,V)):J instanceof THREE.MeshNormalMaterial&&
|
|
|
-D.setRGB(b(T.normalWorld.x),b(T.normalWorld.y),b(T.normalWorld.z));J.wireframe?O.setAttribute("style","fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+J.wireframeLinewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframeLinecap+"; stroke-linejoin: "+J.wireframeLinejoin):O.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+J.opacity);n.appendChild(O)}}};
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,k,h;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;k=b/2;h=e/2};this.render=function(b,e){var n,p,t,u,w,v,z,x;a=c.projectScene(b,e);n=0;for(p=a.length;n<p;n++)if(w=a[n],w instanceof THREE.RenderableParticle){z=w.x*k+k;x=w.y*h+h;t=0;for(u=w.material.length;t<u;t++)if(v=w.material[t],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=z+"px",v.style.top=x+"px"}}};
|
|
|
+THREE.CanvasRenderer=function(a){function c(a){if(B!=a)x.globalAlpha=B=a}function b(a){if(A!=a){switch(a){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}A=a}}function e(a){if(C!=a)x.strokeStyle=C=a}function k(a){if(L!=a)x.fillStyle=L=a}var h=this,f,l,n,p=new THREE.Projector,a=a||{},t=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
+u,w,v,z,x=t.getContext("2d"),y=new THREE.Color(0),D=0,B=1,A=0,C=null,L=null,G=null,M=null,V=null,K,W,N,O,Z=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la=new THREE.Color,ea=new THREE.Color,ca=new THREE.Color,$=new THREE.Color,ga=new THREE.Color,ha=[],oa,ma,ka,ta,Da,Ea,Ca,Fa,za,F,fa=new THREE.Rectangle,ia=new THREE.Rectangle,H=new THREE.Rectangle,da=!1,sa=new THREE.Color,va=new THREE.Color,ua=new THREE.Color,wa=new THREE.Vector3,Ga,Ba,Ka,ya,X,Ia,a=16;Ga=document.createElement("canvas");
|
|
|
+Ga.width=Ga.height=2;Ba=Ga.getContext("2d");Ba.fillStyle="rgba(0,0,0,1)";Ba.fillRect(0,0,2,2);Ka=Ba.getImageData(0,0,2,2);ya=Ka.data;X=document.createElement("canvas");X.width=X.height=a;Ia=X.getContext("2d");Ia.translate(-a/2,-a/2);Ia.scale(a,a);a--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){u=a;w=b;v=Math.floor(u/2);z=Math.floor(w/2);t.width=u;t.height=w;fa.set(-v,-z,v,z);ia.set(-v,-z,v,z);B=1;A=0;V=M=
|
|
|
+G=L=C=null};this.setClearColor=function(a,b){y.copy(a);D=b;ia.set(-v,-z,v,z)};this.setClearColorHex=function(a,b){y.setHex(a);D=b;ia.set(-v,-z,v,z)};this.clear=function(){x.setTransform(1,0,0,-1,v,z);ia.isEmpty()||(ia.minSelf(fa),ia.inflate(2),D<1&&x.clearRect(Math.floor(ia.getX()),Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight())),D>0&&(b(THREE.NormalBlending),c(1),k("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+D+")"),x.fillRect(Math.floor(ia.getX()),
|
|
|
+Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight()))),ia.empty())};this.render=function(a,t){function u(a){var b,c,e,f;sa.setRGB(0,0,0);va.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],f=e.color,e instanceof THREE.AmbientLight?(sa.r+=f.r,sa.g+=f.g,sa.b+=f.b):e instanceof THREE.DirectionalLight?(va.r+=f.r,va.g+=f.g,va.b+=f.b):e instanceof THREE.PointLight&&(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b)}function w(a,b,c,e){var f,k,h,o,l,n;f=0;for(k=a.length;f<k;f++)h=a[f],
|
|
|
+o=h.color,h instanceof THREE.DirectionalLight?(l=h.matrixWorld.getPosition(),n=c.dot(l),n<=0||(n*=h.intensity,e.r+=o.r*n,e.g+=o.g*n,e.b+=o.b*n)):h instanceof THREE.PointLight&&(l=h.matrixWorld.getPosition(),n=c.dot(wa.sub(l,b).normalize()),n<=0||(n*=h.distance==0?1:1-Math.min(b.distanceTo(l)/h.distance,1),n!=0&&(n*=h.intensity,e.r+=o.r*n,e.g+=o.g*n,e.b+=o.b*n)))}function y(a,f,h){c(h.opacity);b(h.blending);var o,l,n,p,t,u;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)p=h.map.image,t=p.width>>
|
|
|
+1,u=p.height>>1,h=f.scale.x*v,n=f.scale.y*z,o=h*t,l=n*u,H.set(a.x-o,a.y-l,a.x+o,a.y+l),fa.intersects(H)&&(x.save(),x.translate(a.x,a.y),x.rotate(-f.rotation),x.scale(h,-n),x.translate(-t,-u),x.drawImage(p,0,0),x.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(o=f.scale.x*v,l=f.scale.y*z,H.set(a.x-o,a.y-l,a.x+o,a.y+l),fa.intersects(H)&&(e(h.color.getContextStyle()),k(h.color.getContextStyle()),x.save(),x.translate(a.x,a.y),x.rotate(-f.rotation),x.scale(o,l),h.program(x),x.restore()))}function ab(a,
|
|
|
+f,h,k){c(k.opacity);b(k.blending);x.beginPath();x.moveTo(a.positionScreen.x,a.positionScreen.y);x.lineTo(f.positionScreen.x,f.positionScreen.y);x.closePath();if(k instanceof THREE.LineBasicMaterial){a=k.linewidth;if(G!=a)x.lineWidth=G=a;a=k.linecap;if(M!=a)x.lineCap=M=a;a=k.linejoin;if(V!=a)x.lineJoin=V=a;e(k.color.getContextStyle());x.stroke();H.inflate(k.linewidth*2)}}function A(a,e,f,k,l,p,v,u){h.info.render.vertices+=3;h.info.render.faces++;c(u.opacity);b(u.blending);P=a.positionScreen.x;o=a.positionScreen.y;
|
|
|
+U=e.positionScreen.x;Q=e.positionScreen.y;aa=f.positionScreen.x;T=f.positionScreen.y;D(P,o,U,Q,aa,T);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(ta=v.uvs[0],Wa(P,o,U,Q,aa,T,ta[k].u,ta[k].v,ta[l].u,ta[l].v,ta[p].u,ta[p].v,u.map));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=t.matrixWorldInverse,wa.copy(v.vertexNormalsWorld[k]),Da=(wa.x*a.n11+wa.y*a.n12+wa.z*a.n13)*0.5+0.5,Ea=-(wa.x*a.n21+wa.y*a.n22+wa.z*a.n23)*0.5+
|
|
|
+0.5,wa.copy(v.vertexNormalsWorld[l]),Ca=(wa.x*a.n11+wa.y*a.n12+wa.z*a.n13)*0.5+0.5,Fa=-(wa.x*a.n21+wa.y*a.n22+wa.z*a.n23)*0.5+0.5,wa.copy(v.vertexNormalsWorld[p]),za=(wa.x*a.n11+wa.y*a.n12+wa.z*a.n13)*0.5+0.5,F=-(wa.x*a.n21+wa.y*a.n22+wa.z*a.n23)*0.5+0.5,Wa(P,o,U,Q,aa,T,Da,Ea,Ca,Fa,za,F,u.envMap)}else u.wireframe?L(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ma(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof THREE.UVMapping&&
|
|
|
+(ta=v.uvs[0],Wa(P,o,U,Q,aa,T,ta[k].u,ta[k].v,ta[l].u,ta[l].v,ta[p].u,ta[p].v,u.map)),b(THREE.SubtractiveBlending)),da?!u.wireframe&&u.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3?(ea.r=ca.r=$.r=sa.r,ea.g=ca.g=$.g=sa.g,ea.b=ca.b=$.b=sa.b,w(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ea),w(n,v.v2.positionWorld,v.vertexNormalsWorld[1],ca),w(n,v.v3.positionWorld,v.vertexNormalsWorld[2],$),ea.r=Math.max(0,Math.min(u.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(u.color.g*ea.g,1)),ea.b=Math.max(0,
|
|
|
+Math.min(u.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(u.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(u.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(u.color.b*ca.b,1)),$.r=Math.max(0,Math.min(u.color.r*$.r,1)),$.g=Math.max(0,Math.min(u.color.g*$.g,1)),$.b=Math.max(0,Math.min(u.color.b*$.b,1)),ga.r=(ca.r+$.r)*0.5,ga.g=(ca.g+$.g)*0.5,ga.b=(ca.b+$.b)*0.5,ka=Ua(ea,ca,$,ga),Sa(P,o,U,Q,aa,T,0,0,1,0,0,1,ka)):(la.r=sa.r,la.g=sa.g,la.b=sa.b,w(n,v.centroidWorld,v.normalWorld,la),la.r=Math.max(0,Math.min(u.color.r*
|
|
|
+la.r,1)),la.g=Math.max(0,Math.min(u.color.g*la.g,1)),la.b=Math.max(0,Math.min(u.color.b*la.b,1)),u.wireframe?L(la,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ma(la)):u.wireframe?L(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ma(u.color);else if(u instanceof THREE.MeshDepthMaterial)oa=t.near,ma=t.far,ea.r=ea.g=ea.b=1-Oa(a.positionScreen.z,oa,ma),ca.r=ca.g=ca.b=1-Oa(e.positionScreen.z,oa,ma),$.r=$.g=$.b=1-Oa(f.positionScreen.z,oa,ma),ga.r=(ca.r+$.r)*0.5,ga.g=
|
|
|
+(ca.g+$.g)*0.5,ga.b=(ca.b+$.b)*0.5,ka=Ua(ea,ca,$,ga),Sa(P,o,U,Q,aa,T,0,0,1,0,0,1,ka);else if(u instanceof THREE.MeshNormalMaterial)la.r=Ta(v.normalWorld.x),la.g=Ta(v.normalWorld.y),la.b=Ta(v.normalWorld.z),u.wireframe?L(la,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ma(la)}function B(a,e,f,k,l,p,u,v,xa){h.info.render.vertices+=4;h.info.render.faces++;c(v.opacity);b(v.blending);if(v.map||v.envMap)A(a,e,k,0,1,3,u,v,xa),A(l,f,p,1,2,3,u,v,xa);else if(P=a.positionScreen.x,o=a.positionScreen.y,
|
|
|
+U=e.positionScreen.x,Q=e.positionScreen.y,aa=f.positionScreen.x,T=f.positionScreen.y,J=k.positionScreen.x,ra=k.positionScreen.y,pa=l.positionScreen.x,na=l.positionScreen.y,qa=p.positionScreen.x,ja=p.positionScreen.y,v instanceof THREE.MeshBasicMaterial)C(P,o,U,Q,aa,T,J,ra),v.wireframe?L(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(v.color);else if(v instanceof THREE.MeshLambertMaterial)da?!v.wireframe&&v.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==4?(ea.r=
|
|
|
+ca.r=$.r=ga.r=sa.r,ea.g=ca.g=$.g=ga.g=sa.g,ea.b=ca.b=$.b=ga.b=sa.b,w(n,u.v1.positionWorld,u.vertexNormalsWorld[0],ea),w(n,u.v2.positionWorld,u.vertexNormalsWorld[1],ca),w(n,u.v4.positionWorld,u.vertexNormalsWorld[3],$),w(n,u.v3.positionWorld,u.vertexNormalsWorld[2],ga),ea.r=Math.max(0,Math.min(v.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(v.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(v.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(v.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(v.color.g*ca.g,1)),ca.b=Math.max(0,
|
|
|
+Math.min(v.color.b*ca.b,1)),$.r=Math.max(0,Math.min(v.color.r*$.r,1)),$.g=Math.max(0,Math.min(v.color.g*$.g,1)),$.b=Math.max(0,Math.min(v.color.b*$.b,1)),ga.r=Math.max(0,Math.min(v.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(v.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(v.color.b*ga.b,1)),ka=Ua(ea,ca,$,ga),D(P,o,U,Q,J,ra),Sa(P,o,U,Q,J,ra,0,0,1,0,0,1,ka),D(pa,na,aa,T,qa,ja),Sa(pa,na,aa,T,qa,ja,1,0,1,1,0,1,ka)):(la.r=sa.r,la.g=sa.g,la.b=sa.b,w(n,u.centroidWorld,u.normalWorld,la),la.r=Math.max(0,Math.min(v.color.r*
|
|
|
+la.r,1)),la.g=Math.max(0,Math.min(v.color.g*la.g,1)),la.b=Math.max(0,Math.min(v.color.b*la.b,1)),C(P,o,U,Q,aa,T,J,ra),v.wireframe?L(la,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(la)):(C(P,o,U,Q,aa,T,J,ra),v.wireframe?L(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(v.color));else if(v instanceof THREE.MeshNormalMaterial)la.r=Ta(u.normalWorld.x),la.g=Ta(u.normalWorld.y),la.b=Ta(u.normalWorld.z),C(P,o,U,Q,aa,T,J,ra),v.wireframe?L(la,v.wireframeLinewidth,
|
|
|
+v.wireframeLinecap,v.wireframeLinejoin):Ma(la);else if(v instanceof THREE.MeshDepthMaterial)oa=t.near,ma=t.far,ea.r=ea.g=ea.b=1-Oa(a.positionScreen.z,oa,ma),ca.r=ca.g=ca.b=1-Oa(e.positionScreen.z,oa,ma),$.r=$.g=$.b=1-Oa(k.positionScreen.z,oa,ma),ga.r=ga.g=ga.b=1-Oa(f.positionScreen.z,oa,ma),ka=Ua(ea,ca,$,ga),D(P,o,U,Q,J,ra),Sa(P,o,U,Q,J,ra,0,0,1,0,0,1,ka),D(pa,na,aa,T,qa,ja),Sa(pa,na,aa,T,qa,ja,1,0,1,1,0,1,ka)}function D(a,b,c,e,f,k){x.beginPath();x.moveTo(a,b);x.lineTo(c,e);x.lineTo(f,k);x.lineTo(a,
|
|
|
+b);x.closePath()}function C(a,b,c,e,f,k,h,o){x.beginPath();x.moveTo(a,b);x.lineTo(c,e);x.lineTo(f,k);x.lineTo(h,o);x.lineTo(a,b);x.closePath()}function L(a,b,c,f){if(G!=b)x.lineWidth=G=b;if(M!=c)x.lineCap=M=c;if(V!=f)x.lineJoin=V=f;e(a.getContextStyle());x.stroke();H.inflate(b*2)}function Ma(a){k(a.getContextStyle());x.fill()}function Wa(a,b,c,e,f,h,o,l,n,v,u,p,t){if(t.image.width!=0){if(t.needsUpdate==!0||ha[t.id]==void 0){var xa=t.wrapS==THREE.RepeatWrapping,w=t.wrapT==THREE.RepeatWrapping;ha[t.id]=
|
|
|
+x.createPattern(t.image,xa&&w?"repeat":xa&&!w?"repeat-x":!xa&&w?"repeat-y":"no-repeat");t.needsUpdate=!1}k(ha[t.id]);var xa=t.offset.x/t.repeat.x,w=t.offset.y/t.repeat.y,F=(t.image.width-1)*t.repeat.x,t=(t.image.height-1)*t.repeat.y,o=(o+xa)*F,l=(l+w)*t,n=(n+xa)*F,v=(v+w)*t,u=(u+xa)*F,p=(p+w)*t;c-=a;e-=b;f-=a;h-=b;n-=o;v-=l;u-=o;p-=l;xa=1/(n*p-u*v);t=(p*c-v*f)*xa;v=(p*e-v*h)*xa;c=(n*f-u*c)*xa;e=(n*h-u*e)*xa;a=a-t*o-c*l;b=b-v*o-e*l;x.save();x.transform(t,v,c,e,a,b);x.fill();x.restore()}}function Sa(a,
|
|
|
+b,c,e,f,k,h,o,l,n,v,u,p){var t,xa;t=p.width-1;xa=p.height-1;h*=t;o*=xa;l*=t;n*=xa;v*=t;u*=xa;c-=a;e-=b;f-=a;k-=b;l-=h;n-=o;v-=h;u-=o;xa=1/(l*u-v*n);t=(u*c-n*f)*xa;n=(u*e-n*k)*xa;c=(l*f-v*c)*xa;e=(l*k-v*e)*xa;a=a-t*h-c*o;b=b-n*h-e*o;x.save();x.transform(t,n,c,e,a,b);x.clip();x.drawImage(p,0,0);x.restore()}function Ua(a,b,c,e){var f=~~(a.r*255),k=~~(a.g*255),a=~~(a.b*255),h=~~(b.r*255),o=~~(b.g*255),b=~~(b.b*255),l=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),v=~~(e.r*255),u=~~(e.g*255),e=~~(e.b*255);ya[0]=
|
|
|
+f<0?0:f>255?255:f;ya[1]=k<0?0:k>255?255:k;ya[2]=a<0?0:a>255?255:a;ya[4]=h<0?0:h>255?255:h;ya[5]=o<0?0:o>255?255:o;ya[6]=b<0?0:b>255?255:b;ya[8]=l<0?0:l>255?255:l;ya[9]=n<0?0:n>255?255:n;ya[10]=c<0?0:c>255?255:c;ya[12]=v<0?0:v>255?255:v;ya[13]=u<0?0:u>255?255:u;ya[14]=e<0?0:e>255?255:e;Ba.putImageData(Ka,0,0);Ia.drawImage(Ga,0,0);return X}function Oa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ta(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Na(a,b){var c=b.x-a.x,e=b.y-a.y,f=c*c+e*e;f!=0&&(f=1/
|
|
|
+Math.sqrt(f),c*=f,e*=f,b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Va,Xa,Aa,Ha;this.autoClear?this.clear():x.setTransform(1,0,0,-1,v,z);h.info.render.vertices=0;h.info.render.faces=0;f=p.projectScene(a,t,this.sortElements);l=f.elements;n=f.lights;(da=n.length>0)&&u(n);Va=0;for(Xa=l.length;Va<Xa;Va++)if(Aa=l[Va],Ha=Aa.material,Ha=Ha instanceof THREE.MeshFaceMaterial?Aa.faceMaterial:Ha,!(Ha==null||Ha.opacity==0)){H.empty();if(Aa instanceof THREE.RenderableParticle)K=Aa,K.x*=v,K.y*=z,y(K,Aa,Ha,a);else if(Aa instanceof
|
|
|
+THREE.RenderableLine)K=Aa.v1,W=Aa.v2,K.positionScreen.x*=v,K.positionScreen.y*=z,W.positionScreen.x*=v,W.positionScreen.y*=z,H.addPoint(K.positionScreen.x,K.positionScreen.y),H.addPoint(W.positionScreen.x,W.positionScreen.y),fa.intersects(H)&&ab(K,W,Aa,Ha,a);else if(Aa instanceof THREE.RenderableFace3)K=Aa.v1,W=Aa.v2,N=Aa.v3,K.positionScreen.x*=v,K.positionScreen.y*=z,W.positionScreen.x*=v,W.positionScreen.y*=z,N.positionScreen.x*=v,N.positionScreen.y*=z,Ha.overdraw&&(Na(K.positionScreen,W.positionScreen),
|
|
|
+Na(W.positionScreen,N.positionScreen),Na(N.positionScreen,K.positionScreen)),H.add3Points(K.positionScreen.x,K.positionScreen.y,W.positionScreen.x,W.positionScreen.y,N.positionScreen.x,N.positionScreen.y),fa.intersects(H)&&A(K,W,N,0,1,2,Aa,Ha,a);else if(Aa instanceof THREE.RenderableFace4)K=Aa.v1,W=Aa.v2,N=Aa.v3,O=Aa.v4,K.positionScreen.x*=v,K.positionScreen.y*=z,W.positionScreen.x*=v,W.positionScreen.y*=z,N.positionScreen.x*=v,N.positionScreen.y*=z,O.positionScreen.x*=v,O.positionScreen.y*=z,Z.positionScreen.copy(W.positionScreen),
|
|
|
+Y.positionScreen.copy(O.positionScreen),Ha.overdraw&&(Na(K.positionScreen,W.positionScreen),Na(W.positionScreen,O.positionScreen),Na(O.positionScreen,K.positionScreen),Na(N.positionScreen,Z.positionScreen),Na(N.positionScreen,Y.positionScreen)),H.addPoint(K.positionScreen.x,K.positionScreen.y),H.addPoint(W.positionScreen.x,W.positionScreen.y),H.addPoint(N.positionScreen.x,N.positionScreen.y),H.addPoint(O.positionScreen.x,O.positionScreen.y),fa.intersects(H)&&Ha.opacity!=0&&B(K,W,N,O,Z,Y,Aa,Ha,a);
|
|
|
+ia.addRectangle(H)}x.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,e){var f,k,h,l,n,v;f=0;for(k=a.length;f<k;f++)h=a[f],l=h.color,h instanceof THREE.DirectionalLight?(n=h.matrixWorld.getPosition(),v=c.dot(n),v<=0||(v*=h.intensity,e.r+=l.r*v,e.g+=l.g*v,e.b+=l.b*v)):h instanceof THREE.PointLight&&(n=h.matrixWorld.getPosition(),v=c.dot(K.sub(n,b).normalize()),v<=0||(v*=h.distance==0?1:1-Math.min(b.distanceTo(n)/h.distance,1),v!=0&&(v*=h.intensity,e.r+=l.r*v,e.g+=l.g*v,e.b+=l.b*v)))}function c(a){W[a]==null&&(W[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"path"),P==0&&W[a].setAttribute("shape-rendering","crispEdges"));return W[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,k,h,f,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,t,u,w,v,z,x,y,D=new THREE.Rectangle,B=new THREE.Rectangle,A=!1,C=new THREE.Color,L=new THREE.Color,G=new THREE.Color,M=new THREE.Color,V,K=new THREE.Vector3,W=[],N=[],O,Z,Y,P=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":P=1;break;case "low":P=0}};this.setSize=function(a,b){p=a;t=b;u=p/2;w=t/2;n.setAttribute("viewBox",-u+" "+-w+" "+p+" "+t);n.setAttribute("width",p);n.setAttribute("height",t);D.set(-u,-w,u,w)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(o,p){var t,K,T,J;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;k=l.projectScene(o,p,this.sortElements);h=k.elements;
|
|
|
+f=k.lights;Y=Z=0;if(A=f.length>0){L.setRGB(0,0,0);G.setRGB(0,0,0);M.setRGB(0,0,0);t=0;for(K=f.length;t<K;t++)J=f[t],T=J.color,J instanceof THREE.AmbientLight?(L.r+=T.r,L.g+=T.g,L.b+=T.b):J instanceof THREE.DirectionalLight?(G.r+=T.r,G.g+=T.g,G.b+=T.b):J instanceof THREE.PointLight&&(M.r+=T.r,M.g+=T.g,M.b+=T.b)}t=0;for(K=h.length;t<K;t++)if(T=h[t],J=T.material,J=J instanceof THREE.MeshFaceMaterial?T.faceMaterial:J,!(J==null||J.opacity==0))if(B.empty(),T instanceof THREE.RenderableParticle)v=T,v.x*=
|
|
|
+u,v.y*=-w,m=0,ml=T.materials.length;else if(T instanceof THREE.RenderableLine){if(v=T.v1,z=T.v2,v.positionScreen.x*=u,v.positionScreen.y*=-w,z.positionScreen.x*=u,z.positionScreen.y*=-w,B.addPoint(v.positionScreen.x,v.positionScreen.y),B.addPoint(z.positionScreen.x,z.positionScreen.y),D.intersects(B)){T=v;var W=z,pa=Y++;N[pa]==null&&(N[pa]=document.createElementNS("http://www.w3.org/2000/svg","line"),P==0&&N[pa].setAttribute("shape-rendering","crispEdges"));O=N[pa];O.setAttribute("x1",T.positionScreen.x);
|
|
|
+O.setAttribute("y1",T.positionScreen.y);O.setAttribute("x2",W.positionScreen.x);O.setAttribute("y2",W.positionScreen.y);J instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+J.color.getContextStyle()+"; stroke-width: "+J.linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.linecap+"; stroke-linejoin: "+J.linejoin),n.appendChild(O))}}else if(T instanceof THREE.RenderableFace3){if(v=T.v1,z=T.v2,x=T.v3,v.positionScreen.x*=u,v.positionScreen.y*=-w,z.positionScreen.x*=
|
|
|
+u,z.positionScreen.y*=-w,x.positionScreen.x*=u,x.positionScreen.y*=-w,B.addPoint(v.positionScreen.x,v.positionScreen.y),B.addPoint(z.positionScreen.x,z.positionScreen.y),B.addPoint(x.positionScreen.x,x.positionScreen.y),D.intersects(B)){var W=v,pa=z,na=x;e.info.render.vertices+=3;e.info.render.faces++;O=c(Z++);O.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+pa.positionScreen.x+" "+pa.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+"z");J instanceof THREE.MeshBasicMaterial?
|
|
|
+C.copy(J.color):J instanceof THREE.MeshLambertMaterial?A?(C.r=L.r,C.g=L.g,C.b=L.b,a(f,T.centroidWorld,T.normalWorld,C),C.r=Math.max(0,Math.min(J.color.r*C.r,1)),C.g=Math.max(0,Math.min(J.color.g*C.g,1)),C.b=Math.max(0,Math.min(J.color.b*C.b,1))):C.copy(J.color):J instanceof THREE.MeshDepthMaterial?(V=1-J.__2near/(J.__farPlusNear-T.z*J.__farMinusNear),C.setRGB(V,V,V)):J instanceof THREE.MeshNormalMaterial&&C.setRGB(b(T.normalWorld.x),b(T.normalWorld.y),b(T.normalWorld.z));J.wireframe?O.setAttribute("style",
|
|
|
+"fill: none; stroke: "+C.getContextStyle()+"; stroke-width: "+J.wireframeLinewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframeLinecap+"; stroke-linejoin: "+J.wireframeLinejoin):O.setAttribute("style","fill: "+C.getContextStyle()+"; fill-opacity: "+J.opacity);n.appendChild(O)}}else if(T instanceof THREE.RenderableFace4&&(v=T.v1,z=T.v2,x=T.v3,y=T.v4,v.positionScreen.x*=u,v.positionScreen.y*=-w,z.positionScreen.x*=u,z.positionScreen.y*=-w,x.positionScreen.x*=u,x.positionScreen.y*=
|
|
|
+-w,y.positionScreen.x*=u,y.positionScreen.y*=-w,B.addPoint(v.positionScreen.x,v.positionScreen.y),B.addPoint(z.positionScreen.x,z.positionScreen.y),B.addPoint(x.positionScreen.x,x.positionScreen.y),B.addPoint(y.positionScreen.x,y.positionScreen.y),D.intersects(B))){var W=v,pa=z,na=x,qa=y;e.info.render.vertices+=4;e.info.render.faces++;O=c(Z++);O.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+pa.positionScreen.x+" "+pa.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+
|
|
|
+" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");J instanceof THREE.MeshBasicMaterial?C.copy(J.color):J instanceof THREE.MeshLambertMaterial?A?(C.r=L.r,C.g=L.g,C.b=L.b,a(f,T.centroidWorld,T.normalWorld,C),C.r=Math.max(0,Math.min(J.color.r*C.r,1)),C.g=Math.max(0,Math.min(J.color.g*C.g,1)),C.b=Math.max(0,Math.min(J.color.b*C.b,1))):C.copy(J.color):J instanceof THREE.MeshDepthMaterial?(V=1-J.__2near/(J.__farPlusNear-T.z*J.__farMinusNear),C.setRGB(V,V,V)):J instanceof THREE.MeshNormalMaterial&&
|
|
|
+C.setRGB(b(T.normalWorld.x),b(T.normalWorld.y),b(T.normalWorld.z));J.wireframe?O.setAttribute("style","fill: none; stroke: "+C.getContextStyle()+"; stroke-width: "+J.wireframeLinewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframeLinecap+"; stroke-linejoin: "+J.wireframeLinejoin):O.setAttribute("style","fill: "+C.getContextStyle()+"; fill-opacity: "+J.opacity);n.appendChild(O)}}};
|
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\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",
|
|
@@ -223,69 +223,69 @@ 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.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
|
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
|
-THREE.WebGLRenderer=function(a){function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function b(a,b,c){var e,f,h,k=a.vertices,l=k.length,n=a.colors,v=n.length,p=a.__vertexArray,u=a.__colorArray,t=a.__sortArray,x=a.__dirtyVertices,w=a.__dirtyColors,F=a.__webglCustomAttributesList,y;if(F){h=0;for(e=F.length;h<e;h++)F[h].offset=0}if(c.sortParticles){sa.multiplySelf(c.matrixWorld);for(e=
|
|
|
-0;e<l;e++)f=k[e].position,Ca.copy(f),sa.multiplyVector3(Ca),t[e]=[Ca.z,e];t.sort(function(a,b){return b[0]-a[0]});for(e=0;e<l;e++)f=k[t[e][1]].position,h=e*3,p[h]=f.x,p[h+1]=f.y,p[h+2]=f.z;for(e=0;e<v;e++)h=e*3,color=n[t[e][1]],u[h]=color.r,u[h+1]=color.g,u[h+2]=color.b;if(F){h=0;for(e=F.length;h<e;h++){l=F[h];v=l.value.length;for(n=0;n<v;n++){index=t[n][1];k=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[k]=l.value[index]}else{if(l.boundTo===void 0||l.boundTo==="vertices")y=
|
|
|
-l.value[index];l.size===2?(l.array[k]=y.x,l.array[k+1]=y.y):l.size===3?l.type==="c"?(l.array[k]=y.r,l.array[k+1]=y.g,l.array[k+2]=y.b):(l.array[k]=y.x,l.array[k+1]=y.y,l.array[k+2]=y.z):(l.array[k]=y.x,l.array[k+1]=y.y,l.array[k+2]=y.z,l.array[k+3]=y.w)}l.offset+=l.size}}}}else{if(x)for(e=0;e<l;e++)f=k[e].position,h=e*3,p[h]=f.x,p[h+1]=f.y,p[h+2]=f.z;if(w)for(e=0;e<v;e++)color=n[e],h=e*3,u[h]=color.r,u[h+1]=color.g,u[h+2]=color.b;if(F){h=0;for(e=F.length;h<e;h++)if(l=F[h],l.__original.needsUpdate){v=
|
|
|
+THREE.WebGLRenderer=function(a){function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function b(a,b,c){var e,f,h,k=a.vertices,l=k.length,n=a.colors,v=n.length,u=a.__vertexArray,p=a.__colorArray,t=a.__sortArray,x=a.__dirtyVertices,w=a.__dirtyColors,F=a.__webglCustomAttributesList,y;if(F){h=0;for(e=F.length;h<e;h++)F[h].offset=0}if(c.sortParticles){ta.multiplySelf(c.matrixWorld);for(e=
|
|
|
+0;e<l;e++)f=k[e].position,Ca.copy(f),ta.multiplyVector3(Ca),t[e]=[Ca.z,e];t.sort(function(a,b){return b[0]-a[0]});for(e=0;e<l;e++)f=k[t[e][1]].position,h=e*3,u[h]=f.x,u[h+1]=f.y,u[h+2]=f.z;for(e=0;e<v;e++)h=e*3,color=n[t[e][1]],p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(F){h=0;for(e=F.length;h<e;h++){l=F[h];v=l.value.length;for(n=0;n<v;n++){index=t[n][1];k=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[k]=l.value[index]}else{if(l.boundTo===void 0||l.boundTo==="vertices")y=
|
|
|
+l.value[index];l.size===2?(l.array[k]=y.x,l.array[k+1]=y.y):l.size===3?l.type==="c"?(l.array[k]=y.r,l.array[k+1]=y.g,l.array[k+2]=y.b):(l.array[k]=y.x,l.array[k+1]=y.y,l.array[k+2]=y.z):(l.array[k]=y.x,l.array[k+1]=y.y,l.array[k+2]=y.z,l.array[k+3]=y.w)}l.offset+=l.size}}}}else{if(x)for(e=0;e<l;e++)f=k[e].position,h=e*3,u[h]=f.x,u[h+1]=f.y,u[h+2]=f.z;if(w)for(e=0;e<v;e++)color=n[e],h=e*3,p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(F){h=0;for(e=F.length;h<e;h++)if(l=F[h],l.__original.needsUpdate){v=
|
|
|
l.value.length;for(n=0;n<v;n++){k=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[k]=l.value[n]}else{if(l.boundTo===void 0||l.boundTo==="vertices")y=l.value[n];l.size===2?(l.array[k]=y.x,l.array[k+1]=y.y):l.size===3?l.type==="c"?(l.array[k]=y.r,l.array[k+1]=y.g,l.array[k+2]=y.b):(l.array[k]=y.x,l.array[k+1]=y.y,l.array[k+2]=y.z):(l.array[k]=y.x,l.array[k+1]=y.y,l.array[k+2]=y.z,l.array[k+3]=y.w)}l.offset+=l.size}}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),
|
|
|
-o.bufferData(o.ARRAY_BUFFER,p,b);if(w||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,u,b);if(F){h=0;for(e=F.length;h<e;h++)if(l=F[h],l.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,l.buffer),o.bufferData(o.ARRAY_BUFFER,l.array,b)}}function e(a,b,c,e,f){e.program||P.initMaterial(e,b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(P.maxMorphTargets);for(var h=0,k=P.maxMorphTargets;h<
|
|
|
-k;h++)f.__webglMorphTargetInfluences[h]=0}var l=!1,h=e.program,k=h.uniforms,n=e.uniforms;h!==Q&&(o.useProgram(h),Q=h,l=!0);if(e.id!==T)T=e.id,l=!0;if(l){o.uniformMatrix4fv(k.projectionMatrix,!1,Da);if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var v,p,u=0,t=0,x=0,w,F,y,z=Fa,ia=z.directional.colors,
|
|
|
-fa=z.directional.positions,A=z.point.colors,B=z.point.positions,C=z.point.distances,D=0,G=0,c=v=y=0,l=b.length;c<l;c++)if(v=b[c],p=v.color,w=v.position,F=v.intensity,y=v.distance,v instanceof THREE.AmbientLight)P.gammaInput?(u+=p.r*p.r,t+=p.g*p.g,x+=p.b*p.b):(u+=p.r,t+=p.g,x+=p.b);else if(v instanceof THREE.DirectionalLight)y=D*3,P.gammaInput?(ia[y]=p.r*p.r*F*F,ia[y+1]=p.g*p.g*F*F,ia[y+2]=p.b*p.b*F*F):(ia[y]=p.r*F,ia[y+1]=p.g*F,ia[y+2]=p.b*F),fa[y]=w.x,fa[y+1]=w.y,fa[y+2]=w.z,D+=1;else if(v instanceof
|
|
|
-THREE.SpotLight)y=D*3,P.gammaInput?(ia[y]=p.r*p.r*F*F,ia[y+1]=p.g*p.g*F*F,ia[y+2]=p.b*p.b*F*F):(ia[y]=p.r*F,ia[y+1]=p.g*F,ia[y+2]=p.b*F),p=1/w.length(),fa[y]=w.x*p,fa[y+1]=w.y*p,fa[y+2]=w.z*p,D+=1;else if(v instanceof THREE.PointLight)v=G*3,P.gammaInput?(A[v]=p.r*p.r*F*F,A[v+1]=p.g*p.g*F*F,A[v+2]=p.b*p.b*F*F):(A[v]=p.r*F,A[v+1]=p.g*F,A[v+2]=p.b*F),B[v]=w.x,B[v+1]=w.y,B[v+2]=w.z,C[G]=y,G+=1;c=D*3;for(l=ia.length;c<l;c++)ia[c]=0;c=G*3;for(l=A.length;c<l;c++)A[c]=0;z.point.length=G;z.directional.length=
|
|
|
-D;z.ambient[0]=u;z.ambient[1]=t;z.ambient[2]=x;b=Fa;n.enableLighting.value=b.directional.length+b.point.length;n.ambientLightColor.value=b.ambient;n.directionalLightColor.value=b.directional.colors;n.directionalLightDirection.value=b.directional.positions;n.pointLightColor.value=b.point.colors;n.pointLightPosition.value=b.point.positions;n.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=
|
|
|
+o.bufferData(o.ARRAY_BUFFER,u,b);if(w||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,p,b);if(F){h=0;for(e=F.length;h<e;h++)if(l=F[h],l.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,l.buffer),o.bufferData(o.ARRAY_BUFFER,l.array,b)}}function e(a,b,c,e,f){e.program||P.initMaterial(e,b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(P.maxMorphTargets);for(var h=0,k=P.maxMorphTargets;h<
|
|
|
+k;h++)f.__webglMorphTargetInfluences[h]=0}var l=!1,h=e.program,k=h.uniforms,n=e.uniforms;h!==Q&&(o.useProgram(h),Q=h,l=!0);if(e.id!==T)T=e.id,l=!0;if(l){o.uniformMatrix4fv(k.projectionMatrix,!1,Da);if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var v,u,p=0,t=0,x=0,w,F,y,z=Fa,ia=z.directional.colors,
|
|
|
+fa=z.directional.positions,A=z.point.colors,B=z.point.positions,D=z.point.distances,C=0,H=0,c=v=y=0,l=b.length;c<l;c++)if(v=b[c],u=v.color,w=v.position,F=v.intensity,y=v.distance,v instanceof THREE.AmbientLight)P.gammaInput?(p+=u.r*u.r,t+=u.g*u.g,x+=u.b*u.b):(p+=u.r,t+=u.g,x+=u.b);else if(v instanceof THREE.DirectionalLight)y=C*3,P.gammaInput?(ia[y]=u.r*u.r*F*F,ia[y+1]=u.g*u.g*F*F,ia[y+2]=u.b*u.b*F*F):(ia[y]=u.r*F,ia[y+1]=u.g*F,ia[y+2]=u.b*F),fa[y]=w.x,fa[y+1]=w.y,fa[y+2]=w.z,C+=1;else if(v instanceof
|
|
|
+THREE.SpotLight)y=C*3,P.gammaInput?(ia[y]=u.r*u.r*F*F,ia[y+1]=u.g*u.g*F*F,ia[y+2]=u.b*u.b*F*F):(ia[y]=u.r*F,ia[y+1]=u.g*F,ia[y+2]=u.b*F),u=1/w.length(),fa[y]=w.x*u,fa[y+1]=w.y*u,fa[y+2]=w.z*u,C+=1;else if(v instanceof THREE.PointLight)v=H*3,P.gammaInput?(A[v]=u.r*u.r*F*F,A[v+1]=u.g*u.g*F*F,A[v+2]=u.b*u.b*F*F):(A[v]=u.r*F,A[v+1]=u.g*F,A[v+2]=u.b*F),B[v]=w.x,B[v+1]=w.y,B[v+2]=w.z,D[H]=y,H+=1;c=C*3;for(l=ia.length;c<l;c++)ia[c]=0;c=H*3;for(l=A.length;c<l;c++)A[c]=0;z.point.length=H;z.directional.length=
|
|
|
+C;z.ambient[0]=p;z.ambient[1]=t;z.ambient[2]=x;b=Fa;n.enableLighting.value=b.directional.length+b.point.length;n.ambientLightColor.value=b.ambient;n.directionalLightColor.value=b.directional.colors;n.directionalLightDirection.value=b.directional.positions;n.pointLightColor.value=b.point.colors;n.pointLightPosition.value=b.point.positions;n.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=
|
|
|
e.opacity,P.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=za.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,P.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)P.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(f.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<ta.length;b++)n.shadowMatrix.value[b]=ta[b],n.shadowMap.texture[b]=P.shadowMap[b];n.shadowDarkness.value=P.shadowMapDarkness;n.shadowBias.value=P.shadowMapBias}b=
|
|
|
-e.uniformsList;n=0;for(c=b.length;n<c;n++)if(t=h.uniforms[b[n][1]])if(u=b[n][0],x=u.type,l=u.value,x==="i")o.uniform1i(t,l);else if(x==="f")o.uniform1f(t,l);else if(x==="v2")o.uniform2f(t,l.x,l.y);else if(x==="v3")o.uniform3f(t,l.x,l.y,l.z);else if(x==="v4")o.uniform4f(t,l.x,l.y,l.z,l.w);else if(x==="c")o.uniform3f(t,l.r,l.g,l.b);else if(x==="fv1")o.uniform1fv(t,l);else if(x==="fv")o.uniform3fv(t,l);else if(x==="v3v"){if(!u._array)u._array=new Float32Array(3*l.length);x=0;for(w=l.length;x<w;x++)z=
|
|
|
-x*3,u._array[z]=l[x].x,u._array[z+1]=l[x].y,u._array[z+2]=l[x].z;o.uniform3fv(t,u._array)}else if(x==="m4"){if(!u._array)u._array=new Float32Array(16);l.flattenToArray(u._array);o.uniformMatrix4fv(t,!1,u._array)}else if(x==="m4v"){if(!u._array)u._array=new Float32Array(16*l.length);x=0;for(w=l.length;x<w;x++)l[x].flattenToArrayOffset(u._array,x*16);o.uniformMatrix4fv(t,!1,u._array)}else if(x==="t"){if(o.uniform1i(t,l),t=u.texture)if(t.image instanceof Array&&t.image.length===6){if(u=t,u.image.length===
|
|
|
-6)if(u.needsUpdate){if(!u.image.__webglTextureCube)u.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+l);o.bindTexture(o.TEXTURE_CUBE_MAP,u.image.__webglTextureCube);for(l=0;l<6;l++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,u.image[l]);M(o.TEXTURE_CUBE_MAP,u,u.image[0]);u.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+l),o.bindTexture(o.TEXTURE_CUBE_MAP,u.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(u=t,o.activeTexture(o.TEXTURE0+
|
|
|
-l),o.bindTexture(o.TEXTURE_CUBE_MAP,u.__webglTexture)):V(t,l)}else if(x==="tv"){if(!u._array){u._array=[];x=0;for(w=u.texture.length;x<w;x++)u._array[x]=l+x}o.uniform1iv(t,u._array);x=0;for(w=u.texture.length;x<w;x++)(t=u.texture[x])&&V(t,u._array[x])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&k.cameraPosition!==null&&o.uniform3f(k.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||
|
|
|
+THREE.MeshLambertMaterial)P.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(f.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<ua.length;b++)n.shadowMatrix.value[b]=ua[b],n.shadowMap.texture[b]=P.shadowMap[b];n.shadowDarkness.value=P.shadowMapDarkness;n.shadowBias.value=P.shadowMapBias}b=
|
|
|
+e.uniformsList;n=0;for(c=b.length;n<c;n++)if(t=h.uniforms[b[n][1]])if(p=b[n][0],x=p.type,l=p.value,x==="i")o.uniform1i(t,l);else if(x==="f")o.uniform1f(t,l);else if(x==="v2")o.uniform2f(t,l.x,l.y);else if(x==="v3")o.uniform3f(t,l.x,l.y,l.z);else if(x==="v4")o.uniform4f(t,l.x,l.y,l.z,l.w);else if(x==="c")o.uniform3f(t,l.r,l.g,l.b);else if(x==="fv1")o.uniform1fv(t,l);else if(x==="fv")o.uniform3fv(t,l);else if(x==="v3v"){if(!p._array)p._array=new Float32Array(3*l.length);x=0;for(w=l.length;x<w;x++)z=
|
|
|
+x*3,p._array[z]=l[x].x,p._array[z+1]=l[x].y,p._array[z+2]=l[x].z;o.uniform3fv(t,p._array)}else if(x==="m4"){if(!p._array)p._array=new Float32Array(16);l.flattenToArray(p._array);o.uniformMatrix4fv(t,!1,p._array)}else if(x==="m4v"){if(!p._array)p._array=new Float32Array(16*l.length);x=0;for(w=l.length;x<w;x++)l[x].flattenToArrayOffset(p._array,x*16);o.uniformMatrix4fv(t,!1,p._array)}else if(x==="t"){if(o.uniform1i(t,l),t=p.texture)if(t.image instanceof Array&&t.image.length===6){if(p=t,p.image.length===
|
|
|
+6)if(p.needsUpdate){if(!p.image.__webglTextureCube)p.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+l);o.bindTexture(o.TEXTURE_CUBE_MAP,p.image.__webglTextureCube);for(l=0;l<6;l++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,p.image[l]);M(o.TEXTURE_CUBE_MAP,p,p.image[0]);p.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+l),o.bindTexture(o.TEXTURE_CUBE_MAP,p.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(p=t,o.activeTexture(o.TEXTURE0+
|
|
|
+l),o.bindTexture(o.TEXTURE_CUBE_MAP,p.__webglTexture)):V(t,l)}else if(x==="tv"){if(!p._array){p._array=[];x=0;for(w=p.texture.length;x<w;x++)p._array[x]=l+x}o.uniform1iv(t,p._array);x=0;for(w=p.texture.length;x<w;x++)(t=p.texture[x])&&V(t,p._array[x])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&k.cameraPosition!==null&&o.uniform3f(k.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||
|
|
|
e instanceof THREE.ShaderMaterial||e.skinning)&&k.viewMatrix!==null&&o.uniformMatrix4fv(k.viewMatrix,!1,Ea);e.skinning&&(o.uniformMatrix4fv(k.cameraInverseMatrix,!1,Ea),o.uniformMatrix4fv(k.boneGlobalMatrices,!1,f.boneMatrices))}o.uniformMatrix4fv(k.modelViewMatrix,!1,f._modelViewMatrixArray);k.normalMatrix&&o.uniformMatrix3fv(k.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||f.receiveShadow)&&k.objectMatrix!==null&&o.uniformMatrix4fv(k.objectMatrix,
|
|
|
!1,f._objectMatrixArray);return h}function k(a,b,c,f,k,h){if(f.opacity!==0){var l,n,c=e(a,b,c,f,h),a=c.attributes,b=!1,c=k.id*16777215+c.id*2+(f.wireframe?1:0);c!==J&&(J=c,b=!0);if(!f.morphTargets&&a.position>=0)b&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(a.position,3,o.FLOAT,!1,0,0));else if(h.morphTargetBase){c=f.program.attributes;h.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[h.morphTargetBase]),o.vertexAttribPointer(c.position,
|
|
|
-3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){l=0;var v=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;l<f.numSupportedMorphTargets&&l<v.length;)o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[v[l]]),o.vertexAttribPointer(c["morphTarget"+l],3,o.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[l]=n[v[l]],l++}else{var v=[],p=-1,u=0;n=h.morphTargetInfluences;var t,
|
|
|
-x=n.length;l=0;for(h.morphTargetBase!==-1&&(v[h.morphTargetBase]=!0);l<f.numSupportedMorphTargets;){for(t=0;t<x;t++)!v[t]&&n[t]>p&&(u=t,p=n[u]);o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[u]);o.vertexAttribPointer(c["morphTarget"+l],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[l]=p;v[u]=1;p=-1;l++}}f.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(f.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(b){if(k.__webglCustomAttributesList){l=0;for(n=
|
|
|
+3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){l=0;var v=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;l<f.numSupportedMorphTargets&&l<v.length;)o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[v[l]]),o.vertexAttribPointer(c["morphTarget"+l],3,o.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[l]=n[v[l]],l++}else{var v=[],u=-1,p=0;n=h.morphTargetInfluences;var t,
|
|
|
+x=n.length;l=0;for(h.morphTargetBase!==-1&&(v[h.morphTargetBase]=!0);l<f.numSupportedMorphTargets;){for(t=0;t<x;t++)!v[t]&&n[t]>u&&(p=t,u=n[p]);o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[p]);o.vertexAttribPointer(c["morphTarget"+l],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[l]=u;v[p]=1;u=-1;l++}}f.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(f.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(b){if(k.__webglCustomAttributesList){l=0;for(n=
|
|
|
k.__webglCustomAttributesList.length;l<n;l++)c=k.__webglCustomAttributesList[l],a[c.buffer.belongsToAttribute]>=0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,o.FLOAT,!1,0,0))}a.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer),o.vertexAttribPointer(a.color,3,o.FLOAT,!1,0,0));a.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglNormalBuffer),o.vertexAttribPointer(a.normal,3,o.FLOAT,!1,0,0));a.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
k.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>=0&&(k.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUVBuffer),o.vertexAttribPointer(a.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv)):o.disableVertexAttribArray(a.uv));a.uv2>=0&&(k.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUV2Buffer),o.vertexAttribPointer(a.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv2)):o.disableVertexAttribArray(a.uv2));f.skinning&&a.skinVertexA>=0&&a.skinVertexB>=
|
|
|
0&&a.skinIndex>=0&&a.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexABuffer),o.vertexAttribPointer(a.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),o.vertexAttribPointer(a.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),o.vertexAttribPointer(a.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinWeightsBuffer),o.vertexAttribPointer(a.skinWeight,4,o.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(f.wireframe?
|
|
|
(o.lineWidth(f.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer),o.drawElements(o.LINES,k.__webglLineCount,o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),o.drawElements(o.TRIANGLES,k.__webglFaceCount,o.UNSIGNED_SHORT,0)),P.info.render.calls++,P.info.render.vertices+=k.__webglFaceCount,P.info.render.faces+=k.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(f.linewidth),o.drawArrays(h,
|
|
|
0,k.__webglLineCount),P.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,k.__webglParticleCount),P.info.render.calls++):h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,k.__webglVertexCount),P.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,
|
|
|
-o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,k,h,l,n,v,p,u,t,x=a.count*3;for(t=0;t<x;t+=9)c=a.normalArray,e=c[t],f=c[t+1],k=c[t+2],h=c[t+3],n=c[t+4],p=c[t+5],l=c[t+6],v=c[t+7],u=c[t+8],e=(e+h+l)/3,f=(f+n+v)/3,k=(k+p+u)/3,c[t]=e,c[t+1]=f,c[t+2]=k,c[t+3]=e,c[t+4]=f,c[t+5]=k,c[t+6]=e,c[t+7]=f,c[t+8]=k}o.bufferData(o.ARRAY_BUFFER,
|
|
|
+o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,k,h,l,n,v,u,p,t,x=a.count*3;for(t=0;t<x;t+=9)c=a.normalArray,e=c[t],f=c[t+1],k=c[t+2],h=c[t+3],n=c[t+4],u=c[t+5],l=c[t+6],v=c[t+7],p=c[t+8],e=(e+h+l)/3,f=(f+n+v)/3,k=(k+u+p)/3,c[t]=e,c[t+1]=f,c[t+2]=k,c[t+3]=e,c[t+4]=f,c[t+5]=k,c[t+6]=e,c[t+7]=f,c[t+8]=k}o.bufferData(o.ARRAY_BUFFER,
|
|
|
a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,a.count);a.count=0}function f(a){if(pa!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),pa=a.doubleSided;if(na!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),na=a.flipSided}function l(a){ja!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ja=a)}function n(a){la!==a&&(o.depthMask(a),la=a)}
|
|
|
-function u(a,b,c){ea!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ea=a);if(a&&(ca!==b||$!==c))o.polygonOffset(b,c),ca=b,$=c}function t(a){ka[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ka[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ka[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ka[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ka[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ka[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+
|
|
|
-a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ka[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function p(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ka[e].x*b.n14+ka[e].y*b.n24+ka[e].z*b.n34+ka[e].w,a<=c)return!1;return!0}function w(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function v(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=
|
|
|
-c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a,b){return b.z-a.z}function x(a){var b,c,n,v=0,u,x,w,F,y=a.lights;va||(va=new THREE.PerspectiveCamera(P.shadowCameraFov,P.shadowMapWidth/P.shadowMapHeight,P.shadowCameraNear,P.shadowCameraFar));b=0;for(c=y.length;b<c;b++)if(n=y[b],n instanceof THREE.SpotLight&&n.castShadow){T=
|
|
|
--1;P.shadowMap[v]||(P.shadowMap[v]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ta[v]||(ta[v]=new THREE.Matrix4);u=P.shadowMap[v];x=ta[v];va.position.copy(n.position);va.lookAt(n.target.position);va.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(va));this.autoUpdateScene&&a.updateMatrixWorld();va.matrixWorldInverse.getInverse(va.matrixWorld);x.set(0.5,0,0,0.5,0,0.5,
|
|
|
-0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(va.projectionMatrix);x.multiplySelf(va.matrixWorldInverse);va.matrixWorldInverse.flattenToArray(Ea);va.projectionMatrix.flattenToArray(Da);sa.multiply(va.projectionMatrix,va.matrixWorldInverse);t(sa);W(u);o.clearColor(1,1,1,1);P.clear();o.clearColor(G.r,G.g,G.b,da);x=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(u=0;u<x;u++)w=a.__webglObjects[u],F=w.object,F.visible&&F.castShadow?!(F instanceof THREE.Mesh)||!F.frustumCulled||p(F)?(F.matrixWorld.flattenToArray(F._objectMatrixArray),
|
|
|
-C(F,va,!1),w.render=!0):w.render=!1:w.render=!1;l(!0);H(THREE.NormalBlending);for(u=0;u<x;u++)if(w=a.__webglObjects[u],w.render)F=w.object,buffer=w.buffer,f(F),w=F.customDepthMaterial?F.customDepthMaterial:F.geometry.morphTargets.length?Ba:Ga,k(va,y,null,w,buffer,F);for(u=0;u<n;u++)w=a.__webglObjectsImmediate[u],F=w.object,F.visible&&F.castShadow&&(F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray),J=-1,C(F,va,!1),f(F),program=e(va,y,null,Ga,F),F.immediateRenderCallback?F.immediateRenderCallback(program,
|
|
|
+function p(a,b,c){ea!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ea=a);if(a&&(ca!==b||$!==c))o.polygonOffset(b,c),ca=b,$=c}function t(a){ka[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ka[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ka[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ka[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ka[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ka[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+
|
|
|
+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ka[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function u(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ka[e].x*b.n14+ka[e].y*b.n24+ka[e].z*b.n34+ka[e].w,a<=c)return!1;return!0}function w(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function v(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=
|
|
|
+c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a,b){return b.z-a.z}function x(a){var b,c,n,v=0,p,x,w,F,y=a.lights;va||(va=new THREE.PerspectiveCamera(P.shadowCameraFov,P.shadowMapWidth/P.shadowMapHeight,P.shadowCameraNear,P.shadowCameraFar));b=0;for(c=y.length;b<c;b++)if(n=y[b],n instanceof THREE.SpotLight&&n.castShadow){T=
|
|
|
+-1;P.shadowMap[v]||(P.shadowMap[v]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ua[v]||(ua[v]=new THREE.Matrix4);p=P.shadowMap[v];x=ua[v];va.position.copy(n.position);va.lookAt(n.target.position);va.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(va));this.autoUpdateScene&&a.updateMatrixWorld();va.matrixWorldInverse.getInverse(va.matrixWorld);x.set(0.5,0,0,0.5,0,0.5,
|
|
|
+0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(va.projectionMatrix);x.multiplySelf(va.matrixWorldInverse);va.matrixWorldInverse.flattenToArray(Ea);va.projectionMatrix.flattenToArray(Da);ta.multiply(va.projectionMatrix,va.matrixWorldInverse);t(ta);W(p);o.clearColor(1,1,1,1);P.clear();o.clearColor(H.r,H.g,H.b,da);x=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(p=0;p<x;p++)w=a.__webglObjects[p],F=w.object,F.visible&&F.castShadow?!(F instanceof THREE.Mesh)||!F.frustumCulled||u(F)?(F.matrixWorld.flattenToArray(F._objectMatrixArray),
|
|
|
+D(F,va,!1),w.render=!0):w.render=!1:w.render=!1;l(!0);G(THREE.NormalBlending);for(p=0;p<x;p++)if(w=a.__webglObjects[p],w.render)F=w.object,buffer=w.buffer,f(F),w=F.customDepthMaterial?F.customDepthMaterial:F.geometry.morphTargets.length?Ba:Ga,k(va,y,null,w,buffer,F);for(p=0;p<n;p++)w=a.__webglObjectsImmediate[p],F=w.object,F.visible&&F.castShadow&&(F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray),J=-1,D(F,va,!1),f(F),program=e(va,y,null,Ga,F),F.immediateRenderCallback?F.immediateRenderCallback(program,
|
|
|
o,ka):F.render(function(a){h(a,program,Ga.shading)}));v++}}function y(a,b){var c,e,f;c=X.attributes;var k=X.uniforms,h=ma/oa,l,n=[],v=oa*0.5,u=ma*0.5,p=!0;o.useProgram(X.program);Q=X.program;J=ja=qa=-1;Ia||(o.enableVertexAttribArray(X.attributes.position),o.enableVertexAttribArray(X.attributes.uv),Ia=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,
|
|
|
8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Da);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(z);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&
|
|
|
f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(f.position.x-v)/v,(u-f.position.y)/u,Math.max(0,Math.min(1,f.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,f.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?ma:1),n[0]=l*h*f.scale.x,n[1]=l*f.scale.y,o.uniform2f(k.uvScale,f.uvScale.x,
|
|
|
-f.uvScale.y),o.uniform2f(k.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(k.alignment,f.alignment.x,f.alignment.y),o.uniform1f(k.opacity,f.opacity),o.uniform3f(k.color,f.color.r,f.color.g,f.color.b),o.uniform1f(k.rotation,f.rotation),o.uniform2fv(k.scale,n),f.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),H(f.blending),V(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(la)}function C(a,
|
|
|
-b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function A(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function B(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function D(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function K(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
-function H(a){if(a!==qa){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}qa=a}}function M(a,b,c){(c.width&c.width-
|
|
|
+f.uvScale.y),o.uniform2f(k.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(k.alignment,f.alignment.x,f.alignment.y),o.uniform1f(k.opacity,f.opacity),o.uniform3f(k.color,f.color.r,f.color.g,f.color.b),o.uniform1f(k.rotation,f.rotation),o.uniform2fv(k.scale,n),f.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),G(f.blending),V(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(la)}function D(a,
|
|
|
+b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function B(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function A(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function C(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function L(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
+function G(a){if(a!==qa){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}qa=a}}function M(a,b,c){(c.width&c.width-
|
|
|
1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,Y(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,Y(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Y(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,Y(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Z(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,Z(b.minFilter)))}function V(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
|
|
|
-!0,a.__webglTexture=o.createTexture(),P.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.image.width,a.image.height,0,Y(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);M(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function L(a,b){o.bindRenderbuffer(o.RENDERBUFFER,
|
|
|
+!0,a.__webglTexture=o.createTexture(),P.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.image.width,a.image.height,0,Y(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);M(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function K(a,b){o.bindRenderbuffer(o.RENDERBUFFER,
|
|
|
a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function W(a){var b=a instanceof THREE.WebGLRenderTargetCube;
|
|
|
if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);M(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),
|
|
|
-null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,f,e.__webglTexture,0);L(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),M(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
-a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),L(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=oa,a=ma,e=ga,f=ha);b!==aa&&(o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
+null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,f,e.__webglTexture,0);K(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),M(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
+a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),K(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=oa,a=ma,e=ga,f=ha);b!==aa&&(o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
b),o.viewport(e,f,c,a),aa=b)}function N(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function O(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,
|
|
|
o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function Z(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Y(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;
|
|
|
case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;
|
|
|
-case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var P=this,o,U=[],Q=null,aa=null,T=-1,J=null,ra=0,pa=null,na=null,qa=null,ja=null,la=null,ea=null,ca=null,$=null,ga=0,ha=0,oa=0,ma=0,ka=[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),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},za=a.canvas!==void 0?a.canvas:document.createElement("canvas"),F=a.stencil!==void 0?a.stencil:!0,fa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ia=a.antialias!==void 0?a.antialias:!1,G=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),da=a.clearAlpha!==void 0?a.clearAlpha:0,ua=a.maxLights!==
|
|
|
+case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var P=this,o,U=[],Q=null,aa=null,T=-1,J=null,ra=0,pa=null,na=null,qa=null,ja=null,la=null,ea=null,ca=null,$=null,ga=0,ha=0,oa=0,ma=0,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Da=new Float32Array(16),
|
|
|
+Ea=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},za=a.canvas!==void 0?a.canvas:document.createElement("canvas"),F=a.stencil!==void 0?a.stencil:!0,fa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ia=a.antialias!==void 0?a.antialias:!1,H=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),da=a.clearAlpha!==void 0?a.clearAlpha:0,sa=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=za;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=
|
|
|
-5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var va,ta=[],a=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(a.uniforms),Ga=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:wa}),Ba=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:wa,morphTargets:!0});Ga._shadowPass=!0;Ba._shadowPass=!0;try{if(!(o=za.getContext("experimental-webgl",
|
|
|
+5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var va,ua=[],a=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(a.uniforms),Ga=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:wa}),Ba=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:wa,morphTargets:!0});Ga._shadowPass=!0;Ba._shadowPass=!0;try{if(!(o=za.getContext("experimental-webgl",
|
|
|
{antialias:ia,stencil:F,preserveDrawingBuffer:fa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ka){console.error(Ka)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);
|
|
|
-o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(G.r,G.g,G.b,da);this.context=o;var ya=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);F=0;X.vertices[F++]=-1;X.vertices[F++]=-1;X.vertices[F++]=0;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=-1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=0;X.vertices[F++]=-1;X.vertices[F++]=1;X.vertices[F++]=0;F=X.vertices[F++]=
|
|
|
+o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(H.r,H.g,H.b,da);this.context=o;var ya=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);F=0;X.vertices[F++]=-1;X.vertices[F++]=-1;X.vertices[F++]=0;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=-1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=0;X.vertices[F++]=-1;X.vertices[F++]=1;X.vertices[F++]=0;F=X.vertices[F++]=
|
|
|
0;X.faces[F++]=0;X.faces[F++]=1;X.faces[F++]=2;X.faces[F++]=0;X.faces[F++]=2;X.faces[F++]=3;X.vertexBuffer=o.createBuffer();X.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,X.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,X.faces,o.STATIC_DRAW);X.program=o.createProgram();o.attachShader(X.program,O("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(X.program,O("vertex",
|
|
|
THREE.ShaderLib.sprite.vertexShader));o.linkProgram(X.program);X.attributes={};X.uniforms={};X.attributes.position=o.getAttribLocation(X.program,"position");X.attributes.uv=o.getAttribLocation(X.program,"uv");X.uniforms.uvOffset=o.getUniformLocation(X.program,"uvOffset");X.uniforms.uvScale=o.getUniformLocation(X.program,"uvScale");X.uniforms.rotation=o.getUniformLocation(X.program,"rotation");X.uniforms.scale=o.getUniformLocation(X.program,"scale");X.uniforms.alignment=o.getUniformLocation(X.program,
|
|
|
"alignment");X.uniforms.color=o.getUniformLocation(X.program,"color");X.uniforms.map=o.getUniformLocation(X.program,"map");X.uniforms.opacity=o.getUniformLocation(X.program,"opacity");X.uniforms.useScreenCoordinates=o.getUniformLocation(X.program,"useScreenCoordinates");X.uniforms.affectedByDistance=o.getUniformLocation(X.program,"affectedByDistance");X.uniforms.screenPosition=o.getUniformLocation(X.program,"screenPosition");X.uniforms.modelViewMatrix=o.getUniformLocation(X.program,"modelViewMatrix");
|
|
|
-X.uniforms.projectionMatrix=o.getUniformLocation(X.program,"projectionMatrix");var Ia=!1;this.setSize=function(a,b){za.width=a;za.height=b;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(a,b,c,e){ga=a;ha=b;oa=c;ma=e;o.viewport(ga,ha,oa,ma)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){G.setHex(a);da=b;o.clearColor(G.r,G.g,G.b,da)};this.setClearColor=
|
|
|
-function(a,b){G.copy(a);da=b;o.clearColor(G.r,G.g,G.b,da)};this.getClearColor=function(){return G};this.getClearAlpha=function(){return da};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,
|
|
|
+X.uniforms.projectionMatrix=o.getUniformLocation(X.program,"projectionMatrix");var Ia=!1;this.setSize=function(a,b){za.width=a;za.height=b;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(a,b,c,e){ga=a;ha=b;oa=c;ma=e;o.viewport(ga,ha,oa,ma)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){H.setHex(a);da=b;o.clearColor(H.r,H.g,H.b,da)};this.setClearColor=
|
|
|
+function(a,b){H.copy(a);da=b;o.clearColor(H.r,H.g,H.b,da)};this.getClearColor=function(){return H};this.getClearAlpha=function(){return da};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};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 b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer);
|
|
|
o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);P.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),P.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),P.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=
|
|
|
a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),P.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),P.info.memory.textures--};this.initMaterial=function(a,b,c,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 v,p,u;v=u=n=0;for(p=b.length;v<p;v++)h=b[v],h instanceof THREE.SpotLight&&u++,h instanceof THREE.DirectionalLight&&u++,h instanceof THREE.PointLight&&n++;n+u<=ua?v=u:(v=Math.ceil(ua*u/(n+u)),n=ua-v);h={directional:v,point:n};n=u=0;for(v=
|
|
|
+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 v,p,u;v=u=n=0;for(p=b.length;v<p;v++)h=b[v],h instanceof THREE.SpotLight&&u++,h instanceof THREE.DirectionalLight&&u++,h instanceof THREE.PointLight&&n++;n+u<=sa?v=u:(v=Math.ceil(sa*u/(n+u)),n=sa-v);h={directional:v,point:n};n=u=0;for(v=
|
|
|
b.length;n<v;n++)p=b[n],p instanceof THREE.SpotLight&&p.castShadow&&u++;var t=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)t=e.bones.length;var x;a:{v=a.fragmentShader;p=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:t,
|
|
|
shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},F,e=[];l?e.push(l):(e.push(v),e.push(p));for(F in c)e.push(F),e.push(c[F]);l=e.join();F=0;for(e=U.length;F<e;F++)if(U[F].code===l){x=U[F].program;break a}F=o.createProgram();e=[ya?"#define VERTEX_TEXTURES":"",P.gammaInput?"#define GAMMA_INPUT":"",P.gammaOutput?"#define GAMMA_OUTPUT":
|
|
|
"",P.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":
|
|
@@ -295,51 +295,51 @@ h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.ma
|
|
|
O("vertex",e+p));o.linkProgram(F);o.getProgramParameter(F,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(F,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");F.uniforms={};F.attributes={};var w,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in n)e.push(w);w=e;e=0;for(n=w.length;e<n;e++)v=w[e],F.uniforms[v]=o.getUniformLocation(F,
|
|
|
v);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)e.push("morphTarget"+w);for(x in b)e.push(x);x=e;w=0;for(b=x.length;w<b;w++)c=x[w],F.attributes[c]=o.getAttribLocation(F,c);F.id=U.length;U.push({program:F,code:l});P.info.memory.programs=U.length;x=F}a.program=x;x=a.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);
|
|
|
x.tangent>=0&&o.enableVertexAttribArray(x.tangent);a.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(a.attributes)for(k in a.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(a.morphTargets)for(k=a.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)w="morphTarget"+k,x[w]>=0&&(o.enableVertexAttribArray(x[w]),
|
|
|
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){W(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){x(a,b)};this.render=function(a,b,c,F){var ia,fa,A,B,D,G,ga,L=a.lights,K=a.fog;T=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,b);P.info.render.calls=0;P.info.render.vertices=0;P.info.render.faces=0;b.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
|
|
|
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ea);b.projectionMatrix.flattenToArray(Da);sa.multiply(b.projectionMatrix,b.matrixWorldInverse);t(sa);W(c);(this.autoClear||F)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);A=a.__webglObjects.length;for(F=0;F<A;F++)if(D=a.__webglObjects[F],G=D.object,G.visible)if(!(G instanceof THREE.Mesh)||!G.frustumCulled||p(G)){if(G.matrixWorld.flattenToArray(G._objectMatrixArray),
|
|
|
-C(G,b,!0),v(D),D.render=!0,this.sortObjects)G.renderDepth?D.z=G.renderDepth:(Ca.copy(G.position),sa.multiplyVector3(Ca),D.z=Ca.z)}else D.render=!1;else D.render=!1;this.sortObjects&&a.__webglObjects.sort(z);B=a.__webglObjectsImmediate.length;for(F=0;F<B;F++)D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(G.matrixAutoUpdate&&G.matrixWorld.flattenToArray(G._objectMatrixArray),C(G,b,!0),w(D));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);H(a.overrideMaterial.blending);for(F=0;F<A;F++)if(D=
|
|
|
-a.__webglObjects[F],D.render)G=D.object,ga=D.buffer,f(G),k(b,L,K,a.overrideMaterial,ga,G);for(F=0;F<B;F++)D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,f(G),ia=e(b,L,K,a.overrideMaterial,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(b){h(b,ia,a.overrideMaterial.shading)}))}else{H(THREE.NormalBlending);for(F=A-1;F>=0;F--)if(D=a.__webglObjects[F],D.render&&(G=D.object,ga=D.buffer,fa=D.opaque))f(G),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,
|
|
|
-fa.polygonOffsetUnits),k(b,L,K,fa,ga,G);for(F=0;F<B;F++)if(D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,fa=D.opaque))f(G),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,fa.polygonOffsetUnits),ia=e(b,L,K,fa,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(a){h(a,ia,fa.shading)});for(F=0;F<A;F++)if(D=a.__webglObjects[F],D.render&&(G=D.object,ga=D.buffer,fa=D.transparent))f(G),H(fa.blending),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,
|
|
|
-fa.polygonOffsetFactor,fa.polygonOffsetUnits),k(b,L,K,fa,ga,G);for(F=0;F<B;F++)if(D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,fa=D.transparent))f(G),H(fa.blending),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,fa.polygonOffsetUnits),ia=e(b,L,K,fa,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(a){h(a,ia,fa.shading)})}a.__webglSprites.length&&y(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
|
|
|
-N(c)};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,v=void 0,u=void 0,p=void 0,t=u=void 0,F=void 0,x={},w=l.morphTargets.length;l.geometryGroups={};n=0;for(v=l.faces.length;n<v;n++)u=l.faces[n],p=u.materialIndex,t=p!==void 0?p:-1,x[t]===void 0&&(x[t]={hash:t,counter:0}),F=x[t].hash+"_"+x[t].counter,l.geometryGroups[F]===void 0&&(l.geometryGroups[F]={faces:[],materialIndex:p,vertices:0,numMorphTargets:w}),u=u instanceof THREE.Face3?3:4,l.geometryGroups[F].vertices+u>65535&&(x[t].counter+=1,F=x[t].hash+
|
|
|
-"_"+x[t].counter,l.geometryGroups[F]===void 0&&(l.geometryGroups[F]={faces:[],materialIndex:p,vertices:0,numMorphTargets:w})),l.geometryGroups[F].faces.push(n),l.geometryGroups[F].vertices+=u;l.geometryGroupsList=[];n=void 0;for(n in l.geometryGroups)l.geometryGroups[n].id=ra++,l.geometryGroupsList.push(l.geometryGroups[n])}for(k in h.geometryGroups)if(l=h.geometryGroups[k],!l.__webglVertexBuffer){n=l;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=
|
|
|
-o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){p=v=void 0;n.__webglMorphTargetsBuffers=[];v=0;for(p=n.numMorphTargets;v<p;v++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}P.info.memory.geometries++;
|
|
|
-for(var p=e,y=u=x=void 0,t=y=w=y=void 0,F=t=n=0,z=u=void 0,ia=void 0,u=v=w=x=void 0,w=p.geometry,z=w.faces,ia=l.faces,x=0,u=ia.length;x<u;x++)y=ia[x],y=z[y],y instanceof THREE.Face3?(n+=3,t+=1,F+=3):y instanceof THREE.Face4&&(n+=4,t+=2,F+=4);x=c(p,l);u=x.map||x.lightMap||x instanceof THREE.ShaderMaterial?!0:!1;ia=x instanceof THREE.MeshBasicMaterial&&!x.envMap||x instanceof THREE.MeshDepthMaterial?!1:x&&x.shading!==void 0&&x.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;z=x.vertexColors?
|
|
|
-x.vertexColors:!1;l.__vertexArray=new Float32Array(n*3);if(ia)l.__normalArray=new Float32Array(n*3);if(w.hasTangents)l.__tangentArray=new Float32Array(n*4);if(z)l.__colorArray=new Float32Array(n*3);if(u){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(p.geometry.skinWeights.length&&p.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(t*3);l.__lineArray=new Uint16Array(F*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];w=0;for(y=l.numMorphTargets;w<y;w++)l.__morphTargetsArrays.push(new Float32Array(n*3))}l.__needsSmoothNormals=ia===THREE.SmoothShading;l.__uvType=u;l.__vertexColorType=z;l.__normalType=ia;l.__webglFaceCount=t*3;l.__webglLineCount=F*2;if(x.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=
|
|
|
-[];p=void 0;for(p in x.attributes){u=x.attributes[p];w={};for(v in u)w[v]=u[v];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,t=1,w.type==="v2"?t=2:w.type==="v3"?t=3:w.type==="v4"?t=4:w.type==="c"&&(t=3),w.size=t,w.array=new Float32Array(n*t),w.buffer=o.createBuffer(),w.buffer.belongsToAttribute=p,u.needsUpdate=!0,w.__original=u;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=o.createBuffer(),l.__webglColorBuffer=o.createBuffer(),P.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=o.createBuffer(),
|
|
|
-l.__webglColorBuffer=o.createBuffer(),P.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=o.createBuffer();l.__webglColorBuffer=o.createBuffer();P.info.geometries++;l=h;v=e;n=l.vertices.length;l.__vertexArray=new Float32Array(n*3);l.__colorArray=new Float32Array(n*
|
|
|
-3);l.__sortArray=[];l.__webglParticleCount=n;v=v.material;if(v.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=[];p=void 0;for(p in v.attributes){originalAttribute=v.attributes[p];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=o.createBuffer(),attribute.buffer.belongsToAttribute=p,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)D(f.__webglObjects,
|
|
|
-e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;for(h=f.length-1;h>=0;h--)f[h]===k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&D(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,k=h.geometry,l=t=p=void 0,h instanceof THREE.Mesh){n=0;for(v=k.geometryGroupsList.length;n<v;n++)if(p=k.geometryGroupsList[n],l=c(h,p),t=l.attributes&&A(l),k.__dirtyVertices||
|
|
|
-k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||t)if(t=o.DYNAMIC_DRAW,F=!k.dynamic,p.__inittedArrays){var fa=w=x=void 0,G=void 0,C=fa=void 0,ga=void 0,L=void 0,ua=void 0,N=y=ia=z=u=void 0,J=void 0,H=void 0,ha=void 0,O=void 0,R=G=ua=G=L=ga=void 0,da=void 0,I=da=R=ga=void 0,E=void 0,I=da=R=fa=fa=C=da=R=G=I=da=R=E=I=da=R=E=I=da=R=void 0,M=0,Q=0,T=0,W=0,va=0,Z=0,oa=0,X=0,Y=0,S=0,U=0,ma=I=0,ma=void 0,V=p.__vertexArray,wa=p.__uvArray,la=p.__uv2Array,
|
|
|
-aa=p.__normalArray,ka=p.__tangentArray,ea=p.__colorArray,$=p.__skinVertexAArray,ca=p.__skinVertexBArray,ta=p.__skinIndexArray,ja=p.__skinWeightArray,pa=p.__morphTargetsArrays,sa=p.__webglCustomAttributesList,E=void 0,Ba=p.__faceArray,na=p.__lineArray,Ga=p.__needsSmoothNormals,z=p.__vertexColorType,u=p.__uvType,ia=p.__normalType,qa=h.geometry,Da=qa.__dirtyVertices,Ea=qa.__dirtyElements,ya=qa.__dirtyUvs,Ka=qa.__dirtyNormals,Ca=qa.__dirtyTangents,Fa=qa.__dirtyColors,Ia=qa.__dirtyMorphTargets,za=qa.vertices,
|
|
|
-Ya=p.faces,bb=qa.faces,Za=qa.faceVertexUvs[0],$a=qa.faceVertexUvs[1],Pa=qa.skinVerticesA,Qa=qa.skinVerticesB,Ra=qa.skinIndices,La=qa.skinWeights,Ja=qa.morphTargets;if(sa){R=0;for(da=sa.length;R<da;R++)sa[R].offset=0,sa[R].offsetSrc=0}x=0;for(w=Ya.length;x<w;x++)if(fa=Ya[x],G=bb[fa],Za&&(y=Za[fa]),$a&&(N=$a[fa]),fa=G.vertexNormals,C=G.normal,ga=G.vertexColors,L=G.color,ua=G.vertexTangents,G instanceof THREE.Face3){if(Da)J=za[G.a].position,H=za[G.b].position,ha=za[G.c].position,V[Q]=J.x,V[Q+1]=J.y,
|
|
|
-V[Q+2]=J.z,V[Q+3]=H.x,V[Q+4]=H.y,V[Q+5]=H.z,V[Q+6]=ha.x,V[Q+7]=ha.y,V[Q+8]=ha.z,Q+=9;if(sa){R=0;for(da=sa.length;R<da;R++)if(E=sa[R],E.__original.needsUpdate)I=E.offset,ma=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[G.a],E.array[I+1]=E.value[G.b],E.array[I+2]=E.value[G.c]):E.boundTo==="faces"?(ma=E.value[ma],E.array[I]=ma,E.array[I+1]=ma,E.array[I+2]=ma,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[ma],E.array[I+1]=E.value[ma+1],E.array[I+
|
|
|
-2]=E.value[ma+2],E.offsetSrc+=3),E.offset+=3):(E.boundTo===void 0||E.boundTo==="vertices"?(J=E.value[G.a],H=E.value[G.b],ha=E.value[G.c]):E.boundTo==="faces"?(ha=H=J=ma=E.value[ma],E.offsetSrc++):E.boundTo==="faceVertices"&&(J=E.value[ma],H=E.value[ma+1],ha=E.value[ma+2],E.offsetSrc+=3),E.size===2?(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=H.x,E.array[I+3]=H.y,E.array[I+4]=ha.x,E.array[I+5]=ha.y,E.offset+=6):E.size===3?(E.type==="c"?(E.array[I]=J.r,E.array[I+1]=J.g,E.array[I+2]=J.b,E.array[I+3]=
|
|
|
-H.r,E.array[I+4]=H.g,E.array[I+5]=H.b,E.array[I+6]=ha.r,E.array[I+7]=ha.g,E.array[I+8]=ha.b):(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=J.z,E.array[I+3]=H.x,E.array[I+4]=H.y,E.array[I+5]=H.z,E.array[I+6]=ha.x,E.array[I+7]=ha.y,E.array[I+8]=ha.z),E.offset+=9):(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=J.z,E.array[I+3]=J.w,E.array[I+4]=H.x,E.array[I+5]=H.y,E.array[I+6]=H.z,E.array[I+7]=H.w,E.array[I+8]=ha.x,E.array[I+9]=ha.y,E.array[I+10]=ha.z,E.array[I+11]=ha.w,E.offset+=12))}if(Ia){R=0;for(da=
|
|
|
-Ja.length;R<da;R++)J=Ja[R].vertices[G.a].position,H=Ja[R].vertices[G.b].position,ha=Ja[R].vertices[G.c].position,I=pa[R],I[U]=J.x,I[U+1]=J.y,I[U+2]=J.z,I[U+3]=H.x,I[U+4]=H.y,I[U+5]=H.z,I[U+6]=ha.x,I[U+7]=ha.y,I[U+8]=ha.z;U+=9}if(La.length)R=La[G.a],da=La[G.b],I=La[G.c],ja[S]=R.x,ja[S+1]=R.y,ja[S+2]=R.z,ja[S+3]=R.w,ja[S+4]=da.x,ja[S+5]=da.y,ja[S+6]=da.z,ja[S+7]=da.w,ja[S+8]=I.x,ja[S+9]=I.y,ja[S+10]=I.z,ja[S+11]=I.w,R=Ra[G.a],da=Ra[G.b],I=Ra[G.c],ta[S]=R.x,ta[S+1]=R.y,ta[S+2]=R.z,ta[S+3]=R.w,ta[S+4]=
|
|
|
-da.x,ta[S+5]=da.y,ta[S+6]=da.z,ta[S+7]=da.w,ta[S+8]=I.x,ta[S+9]=I.y,ta[S+10]=I.z,ta[S+11]=I.w,R=Pa[G.a],da=Pa[G.b],I=Pa[G.c],$[S]=R.x,$[S+1]=R.y,$[S+2]=R.z,$[S+3]=1,$[S+4]=da.x,$[S+5]=da.y,$[S+6]=da.z,$[S+7]=1,$[S+8]=I.x,$[S+9]=I.y,$[S+10]=I.z,$[S+11]=1,R=Qa[G.a],da=Qa[G.b],I=Qa[G.c],ca[S]=R.x,ca[S+1]=R.y,ca[S+2]=R.z,ca[S+3]=1,ca[S+4]=da.x,ca[S+5]=da.y,ca[S+6]=da.z,ca[S+7]=1,ca[S+8]=I.x,ca[S+9]=I.y,ca[S+10]=I.z,ca[S+11]=1,S+=12;if(Fa&&z)ga.length===3&&z===THREE.VertexColors?(G=ga[0],R=ga[1],da=ga[2]):
|
|
|
-da=R=G=L,ea[Y]=G.r,ea[Y+1]=G.g,ea[Y+2]=G.b,ea[Y+3]=R.r,ea[Y+4]=R.g,ea[Y+5]=R.b,ea[Y+6]=da.r,ea[Y+7]=da.g,ea[Y+8]=da.b,Y+=9;if(Ca&&qa.hasTangents)ga=ua[0],L=ua[1],G=ua[2],ka[oa]=ga.x,ka[oa+1]=ga.y,ka[oa+2]=ga.z,ka[oa+3]=ga.w,ka[oa+4]=L.x,ka[oa+5]=L.y,ka[oa+6]=L.z,ka[oa+7]=L.w,ka[oa+8]=G.x,ka[oa+9]=G.y,ka[oa+10]=G.z,ka[oa+11]=G.w,oa+=12;if(Ka&&ia)if(fa.length===3&&Ga)for(R=0;R<3;R++)C=fa[R],aa[Z]=C.x,aa[Z+1]=C.y,aa[Z+2]=C.z,Z+=3;else for(R=0;R<3;R++)aa[Z]=C.x,aa[Z+1]=C.y,aa[Z+2]=C.z,Z+=3;if(ya&&y!==
|
|
|
-void 0&&u)for(R=0;R<3;R++)fa=y[R],wa[T]=fa.u,wa[T+1]=fa.v,T+=2;if(ya&&N!==void 0&&u)for(R=0;R<3;R++)fa=N[R],la[W]=fa.u,la[W+1]=fa.v,W+=2;Ea&&(Ba[va]=M,Ba[va+1]=M+1,Ba[va+2]=M+2,va+=3,na[X]=M,na[X+1]=M+1,na[X+2]=M,na[X+3]=M+2,na[X+4]=M+1,na[X+5]=M+2,X+=6,M+=3)}else if(G instanceof THREE.Face4){if(Da)J=za[G.a].position,H=za[G.b].position,ha=za[G.c].position,O=za[G.d].position,V[Q]=J.x,V[Q+1]=J.y,V[Q+2]=J.z,V[Q+3]=H.x,V[Q+4]=H.y,V[Q+5]=H.z,V[Q+6]=ha.x,V[Q+7]=ha.y,V[Q+8]=ha.z,V[Q+9]=O.x,V[Q+10]=O.y,V[Q+
|
|
|
-11]=O.z,Q+=12;if(sa){R=0;for(da=sa.length;R<da;R++)if(E=sa[R],E.__original.needsUpdate)I=E.offset,ma=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[G.a],E.array[I+1]=E.value[G.b],E.array[I+2]=E.value[G.c],E.array[I+3]=E.value[G.d]):E.boundTo==="faces"?(ma=E.value[ma],E.array[I]=ma,E.array[I+1]=ma,E.array[I+2]=ma,E.array[I+3]=ma,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[ma],E.array[I+1]=E.value[ma+1],E.array[I+2]=E.value[ma+2],E.array[I+
|
|
|
-3]=E.value[ma+3],E.offsetSrc+=4),E.offset+=4):(E.boundTo===void 0||E.boundTo==="vertices"?(J=E.value[G.a],H=E.value[G.b],ha=E.value[G.c],O=E.value[G.d]):E.boundTo==="faces"?(O=ha=H=J=ma=E.value[ma],E.offsetSrc++):E.boundTo==="faceVertices"&&(J=E.value[ma],H=E.value[ma+1],ha=E.value[ma+2],O=E.value[ma+3],E.offsetSrc+=4),E.size===2?(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=H.x,E.array[I+3]=H.y,E.array[I+4]=ha.x,E.array[I+5]=ha.y,E.array[I+6]=O.x,E.array[I+7]=O.y,E.offset+=8):E.size===3?(E.type===
|
|
|
-"c"?(E.array[I]=J.r,E.array[I+1]=J.g,E.array[I+2]=J.b,E.array[I+3]=H.r,E.array[I+4]=H.g,E.array[I+5]=H.b,E.array[I+6]=ha.r,E.array[I+7]=ha.g,E.array[I+8]=ha.b,E.array[I+9]=O.r,E.array[I+10]=O.g,E.array[I+11]=O.b):(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=J.z,E.array[I+3]=H.x,E.array[I+4]=H.y,E.array[I+5]=H.z,E.array[I+6]=ha.x,E.array[I+7]=ha.y,E.array[I+8]=ha.z,E.array[I+9]=O.x,E.array[I+10]=O.y,E.array[I+11]=O.z),E.offset+=12):(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=J.z,E.array[I+3]=J.w,
|
|
|
-E.array[I+4]=H.x,E.array[I+5]=H.y,E.array[I+6]=H.z,E.array[I+7]=H.w,E.array[I+8]=ha.x,E.array[I+9]=ha.y,E.array[I+10]=ha.z,E.array[I+11]=ha.w,E.array[I+12]=O.x,E.array[I+13]=O.y,E.array[I+14]=O.z,E.array[I+15]=O.w,E.offset+=16))}if(Ia){R=0;for(da=Ja.length;R<da;R++)J=Ja[R].vertices[G.a].position,H=Ja[R].vertices[G.b].position,ha=Ja[R].vertices[G.c].position,O=Ja[R].vertices[G.d].position,I=pa[R],I[U]=J.x,I[U+1]=J.y,I[U+2]=J.z,I[U+3]=H.x,I[U+4]=H.y,I[U+5]=H.z,I[U+6]=ha.x,I[U+7]=ha.y,I[U+8]=ha.z,I[U+
|
|
|
-9]=O.x,I[U+10]=O.y,I[U+11]=O.z;U+=12}if(La.length)R=La[G.a],da=La[G.b],I=La[G.c],E=La[G.d],ja[S]=R.x,ja[S+1]=R.y,ja[S+2]=R.z,ja[S+3]=R.w,ja[S+4]=da.x,ja[S+5]=da.y,ja[S+6]=da.z,ja[S+7]=da.w,ja[S+8]=I.x,ja[S+9]=I.y,ja[S+10]=I.z,ja[S+11]=I.w,ja[S+12]=E.x,ja[S+13]=E.y,ja[S+14]=E.z,ja[S+15]=E.w,R=Ra[G.a],da=Ra[G.b],I=Ra[G.c],E=Ra[G.d],ta[S]=R.x,ta[S+1]=R.y,ta[S+2]=R.z,ta[S+3]=R.w,ta[S+4]=da.x,ta[S+5]=da.y,ta[S+6]=da.z,ta[S+7]=da.w,ta[S+8]=I.x,ta[S+9]=I.y,ta[S+10]=I.z,ta[S+11]=I.w,ta[S+12]=E.x,ta[S+13]=
|
|
|
-E.y,ta[S+14]=E.z,ta[S+15]=E.w,R=Pa[G.a],da=Pa[G.b],I=Pa[G.c],E=Pa[G.d],$[S]=R.x,$[S+1]=R.y,$[S+2]=R.z,$[S+3]=1,$[S+4]=da.x,$[S+5]=da.y,$[S+6]=da.z,$[S+7]=1,$[S+8]=I.x,$[S+9]=I.y,$[S+10]=I.z,$[S+11]=1,$[S+12]=E.x,$[S+13]=E.y,$[S+14]=E.z,$[S+15]=1,R=Qa[G.a],da=Qa[G.b],I=Qa[G.c],G=Qa[G.d],ca[S]=R.x,ca[S+1]=R.y,ca[S+2]=R.z,ca[S+3]=1,ca[S+4]=da.x,ca[S+5]=da.y,ca[S+6]=da.z,ca[S+7]=1,ca[S+8]=I.x,ca[S+9]=I.y,ca[S+10]=I.z,ca[S+11]=1,ca[S+12]=G.x,ca[S+13]=G.y,ca[S+14]=G.z,ca[S+15]=1,S+=16;if(Fa&&z)ga.length===
|
|
|
-4&&z===THREE.VertexColors?(G=ga[0],R=ga[1],da=ga[2],ga=ga[3]):ga=da=R=G=L,ea[Y]=G.r,ea[Y+1]=G.g,ea[Y+2]=G.b,ea[Y+3]=R.r,ea[Y+4]=R.g,ea[Y+5]=R.b,ea[Y+6]=da.r,ea[Y+7]=da.g,ea[Y+8]=da.b,ea[Y+9]=ga.r,ea[Y+10]=ga.g,ea[Y+11]=ga.b,Y+=12;if(Ca&&qa.hasTangents)ga=ua[0],L=ua[1],G=ua[2],ua=ua[3],ka[oa]=ga.x,ka[oa+1]=ga.y,ka[oa+2]=ga.z,ka[oa+3]=ga.w,ka[oa+4]=L.x,ka[oa+5]=L.y,ka[oa+6]=L.z,ka[oa+7]=L.w,ka[oa+8]=G.x,ka[oa+9]=G.y,ka[oa+10]=G.z,ka[oa+11]=G.w,ka[oa+12]=ua.x,ka[oa+13]=ua.y,ka[oa+14]=ua.z,ka[oa+15]=
|
|
|
-ua.w,oa+=16;if(Ka&&ia)if(fa.length===4&&Ga)for(R=0;R<4;R++)C=fa[R],aa[Z]=C.x,aa[Z+1]=C.y,aa[Z+2]=C.z,Z+=3;else for(R=0;R<4;R++)aa[Z]=C.x,aa[Z+1]=C.y,aa[Z+2]=C.z,Z+=3;if(ya&&y!==void 0&&u)for(R=0;R<4;R++)fa=y[R],wa[T]=fa.u,wa[T+1]=fa.v,T+=2;if(ya&&N!==void 0&&u)for(R=0;R<4;R++)fa=N[R],la[W]=fa.u,la[W+1]=fa.v,W+=2;Ea&&(Ba[va]=M,Ba[va+1]=M+1,Ba[va+2]=M+3,Ba[va+3]=M+1,Ba[va+4]=M+2,Ba[va+5]=M+3,va+=6,na[X]=M,na[X+1]=M+1,na[X+2]=M,na[X+3]=M+3,na[X+4]=M+1,na[X+5]=M+2,na[X+6]=M+2,na[X+7]=M+3,X+=8,M+=4)}Da&&
|
|
|
-(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,V,t));if(sa){R=0;for(da=sa.length;R<da;R++)E=sa[R],E.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,E.buffer),o.bufferData(o.ARRAY_BUFFER,E.array,t))}if(Ia){R=0;for(da=Ja.length;R<da;R++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[R]),o.bufferData(o.ARRAY_BUFFER,pa[R],t)}Fa&&Y>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ea,t));Ka&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),
|
|
|
-o.bufferData(o.ARRAY_BUFFER,aa,t));Ca&&qa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ka,t));ya&&T>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,t));ya&&W>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,la,t));Ea&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Ba,t),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,
|
|
|
-na,t));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,$,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ca,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ta,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ja,t));F&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,
|
|
|
-delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyColors=!1;k.__dirtyTangents=!1;l.attributes&&B(l)}else if(h instanceof THREE.Ribbon){if(k.__dirtyVertices||k.__dirtyColors){h=k;l=o.DYNAMIC_DRAW;n=x=F=F=void 0;w=h.vertices;v=h.colors;u=w.length;p=v.length;z=h.__vertexArray;
|
|
|
-t=h.__colorArray;ia=h.__dirtyColors;if(h.__dirtyVertices){for(F=0;F<u;F++)x=w[F].position,n=F*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,l)}if(ia){for(F=0;F<p;F++)color=v[F],n=F*3,t[n]=color.r,t[n+1]=color.g,t[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,t,l)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){if(k.__dirtyVertices||k.__dirtyColors){h=k;l=o.DYNAMIC_DRAW;
|
|
|
-n=x=F=F=void 0;w=h.vertices;v=h.colors;u=w.length;p=v.length;z=h.__vertexArray;t=h.__colorArray;ia=h.__dirtyColors;if(h.__dirtyVertices){for(F=0;F<u;F++)x=w[F].position,n=F*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,l)}if(ia){for(F=0;F<p;F++)color=v[F],n=F*3,t[n]=color.r,t[n+1]=color.g,t[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,t,l)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof
|
|
|
-THREE.ParticleSystem)l=c(h,p),t=l.attributes&&A(l),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||t)&&b(k,o.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,l.attributes&&B(l)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),a==="back"?o.cullFace(o.BACK):a==="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return ya}};
|
|
|
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){W(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){x(a,b)};this.render=function(a,b,c,F){var ia,fa,A,B,C,H,ga,K=a.lights,sa=a.fog;T=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,b);P.info.render.calls=0;P.info.render.vertices=0;P.info.render.faces=0;b.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
|
|
|
+a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ea);b.projectionMatrix.flattenToArray(Da);ta.multiply(b.projectionMatrix,b.matrixWorldInverse);t(ta);W(c);(this.autoClear||F)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);A=a.__webglObjects.length;for(F=0;F<A;F++)if(C=a.__webglObjects[F],H=C.object,H.visible)if(!(H instanceof THREE.Mesh)||!H.frustumCulled||u(H)){if(H.matrixWorld.flattenToArray(H._objectMatrixArray),
|
|
|
+D(H,b,!0),v(C),C.render=!0,this.sortObjects)H.renderDepth?C.z=H.renderDepth:(Ca.copy(H.position),ta.multiplyVector3(Ca),C.z=Ca.z)}else C.render=!1;else C.render=!1;this.sortObjects&&a.__webglObjects.sort(z);B=a.__webglObjectsImmediate.length;for(F=0;F<B;F++)C=a.__webglObjectsImmediate[F],H=C.object,H.visible&&(H.matrixAutoUpdate&&H.matrixWorld.flattenToArray(H._objectMatrixArray),D(H,b,!0),w(C));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);G(a.overrideMaterial.blending);for(F=0;F<A;F++)if(C=
|
|
|
+a.__webglObjects[F],C.render)H=C.object,ga=C.buffer,f(H),k(b,K,sa,a.overrideMaterial,ga,H);for(F=0;F<B;F++)C=a.__webglObjectsImmediate[F],H=C.object,H.visible&&(J=-1,f(H),ia=e(b,K,sa,a.overrideMaterial,H),H.immediateRenderCallback?H.immediateRenderCallback(ia,o,ka):H.render(function(b){h(b,ia,a.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);for(F=A-1;F>=0;F--)if(C=a.__webglObjects[F],C.render&&(H=C.object,ga=C.buffer,fa=C.opaque))f(H),l(fa.depthTest),n(fa.depthWrite),p(fa.polygonOffset,
|
|
|
+fa.polygonOffsetFactor,fa.polygonOffsetUnits),k(b,K,sa,fa,ga,H);for(F=0;F<B;F++)if(C=a.__webglObjectsImmediate[F],H=C.object,H.visible&&(J=-1,fa=C.opaque))f(H),l(fa.depthTest),n(fa.depthWrite),p(fa.polygonOffset,fa.polygonOffsetFactor,fa.polygonOffsetUnits),ia=e(b,K,sa,fa,H),H.immediateRenderCallback?H.immediateRenderCallback(ia,o,ka):H.render(function(a){h(a,ia,fa.shading)});for(F=0;F<A;F++)if(C=a.__webglObjects[F],C.render&&(H=C.object,ga=C.buffer,fa=C.transparent))f(H),G(fa.blending),l(fa.depthTest),
|
|
|
+n(fa.depthWrite),p(fa.polygonOffset,fa.polygonOffsetFactor,fa.polygonOffsetUnits),k(b,K,sa,fa,ga,H);for(F=0;F<B;F++)if(C=a.__webglObjectsImmediate[F],H=C.object,H.visible&&(J=-1,fa=C.transparent))f(H),G(fa.blending),l(fa.depthTest),n(fa.depthWrite),p(fa.polygonOffset,fa.polygonOffsetFactor,fa.polygonOffsetUnits),ia=e(b,K,sa,fa,H),H.immediateRenderCallback?H.immediateRenderCallback(ia,o,ka):H.render(function(a){h(a,ia,fa.shading)})}a.__webglSprites.length&&y(a,b);c&&c.minFilter!==THREE.NearestFilter&&
|
|
|
+c.minFilter!==THREE.LinearFilter&&N(c)};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,v=void 0,u=void 0,p=void 0,t=u=void 0,F=void 0,x={},w=l.morphTargets.length;l.geometryGroups={};n=0;for(v=l.faces.length;n<v;n++)u=l.faces[n],p=u.materialIndex,t=p!==void 0?p:-1,x[t]===void 0&&(x[t]={hash:t,counter:0}),F=x[t].hash+"_"+x[t].counter,l.geometryGroups[F]===void 0&&(l.geometryGroups[F]={faces:[],materialIndex:p,vertices:0,numMorphTargets:w}),u=u instanceof THREE.Face3?3:4,l.geometryGroups[F].vertices+
|
|
|
+u>65535&&(x[t].counter+=1,F=x[t].hash+"_"+x[t].counter,l.geometryGroups[F]===void 0&&(l.geometryGroups[F]={faces:[],materialIndex:p,vertices:0,numMorphTargets:w})),l.geometryGroups[F].faces.push(n),l.geometryGroups[F].vertices+=u;l.geometryGroupsList=[];n=void 0;for(n in l.geometryGroups)l.geometryGroups[n].id=ra++,l.geometryGroupsList.push(l.geometryGroups[n])}for(k in h.geometryGroups)if(l=h.geometryGroups[k],!l.__webglVertexBuffer){n=l;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=
|
|
|
+o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){p=v=void 0;n.__webglMorphTargetsBuffers=[];v=0;for(p=n.numMorphTargets;v<
|
|
|
+p;v++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}P.info.memory.geometries++;for(var p=e,y=u=x=void 0,t=y=w=y=void 0,F=t=n=0,z=u=void 0,ia=void 0,u=v=w=x=void 0,w=p.geometry,z=w.faces,ia=l.faces,x=0,u=ia.length;x<u;x++)y=ia[x],y=z[y],y instanceof THREE.Face3?(n+=3,t+=1,F+=3):y instanceof THREE.Face4&&(n+=4,t+=2,F+=4);x=c(p,l);u=x.map||x.lightMap||x instanceof THREE.ShaderMaterial?!0:!1;ia=x instanceof THREE.MeshBasicMaterial&&!x.envMap||x instanceof THREE.MeshDepthMaterial?!1:x&&x.shading!==
|
|
|
+void 0&&x.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;z=x.vertexColors?x.vertexColors:!1;l.__vertexArray=new Float32Array(n*3);if(ia)l.__normalArray=new Float32Array(n*3);if(w.hasTangents)l.__tangentArray=new Float32Array(n*4);if(z)l.__colorArray=new Float32Array(n*3);if(u){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(p.geometry.skinWeights.length&&p.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(t*3);l.__lineArray=new Uint16Array(F*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];w=0;for(y=l.numMorphTargets;w<y;w++)l.__morphTargetsArrays.push(new Float32Array(n*3))}l.__needsSmoothNormals=ia===THREE.SmoothShading;l.__uvType=u;l.__vertexColorType=z;l.__normalType=ia;l.__webglFaceCount=t*3;l.__webglLineCount=F*2;if(x.attributes){if(l.__webglCustomAttributesList===
|
|
|
+void 0)l.__webglCustomAttributesList=[];p=void 0;for(p in x.attributes){u=x.attributes[p];w={};for(v in u)w[v]=u[v];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,t=1,w.type==="v2"?t=2:w.type==="v3"?t=3:w.type==="v4"?t=4:w.type==="c"&&(t=3),w.size=t,w.array=new Float32Array(n*t),w.buffer=o.createBuffer(),w.buffer.belongsToAttribute=p,u.needsUpdate=!0,w.__original=u;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=o.createBuffer(),l.__webglColorBuffer=o.createBuffer(),P.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=
|
|
|
+o.createBuffer(),l.__webglColorBuffer=o.createBuffer(),P.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=o.createBuffer();l.__webglColorBuffer=o.createBuffer();P.info.geometries++;l=h;v=e;n=l.vertices.length;l.__vertexArray=new Float32Array(n*3);l.__colorArray=
|
|
|
+new Float32Array(n*3);l.__sortArray=[];l.__webglParticleCount=n;v=v.material;if(v.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=[];p=void 0;for(p in v.attributes){originalAttribute=v.attributes[p];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=o.createBuffer(),attribute.buffer.belongsToAttribute=p,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: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)C(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;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,k=h.geometry,l=t=p=void 0,h instanceof THREE.Mesh){n=0;for(v=k.geometryGroupsList.length;n<v;n++)if(p=k.geometryGroupsList[n],l=c(h,p),t=l.attributes&&
|
|
|
+B(l),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||t)if(t=o.DYNAMIC_DRAW,F=!k.dynamic,p.__inittedArrays){var fa=w=x=void 0,H=void 0,D=fa=void 0,ga=void 0,K=void 0,sa=void 0,N=y=ia=z=u=void 0,G=void 0,J=void 0,ha=void 0,O=void 0,R=H=sa=H=K=ga=void 0,da=void 0,I=da=R=ga=void 0,E=void 0,I=da=R=fa=fa=D=da=R=H=I=da=R=E=I=da=R=E=I=da=R=void 0,M=0,Q=0,T=0,W=0,va=0,Z=0,oa=0,X=0,Y=0,S=0,U=0,ma=I=0,ma=void 0,V=p.__vertexArray,
|
|
|
+wa=p.__uvArray,la=p.__uv2Array,aa=p.__normalArray,ka=p.__tangentArray,ea=p.__colorArray,$=p.__skinVertexAArray,ca=p.__skinVertexBArray,ua=p.__skinIndexArray,ja=p.__skinWeightArray,pa=p.__morphTargetsArrays,ta=p.__webglCustomAttributesList,E=void 0,Ba=p.__faceArray,na=p.__lineArray,Ga=p.__needsSmoothNormals,z=p.__vertexColorType,u=p.__uvType,ia=p.__normalType,qa=h.geometry,Da=qa.__dirtyVertices,Ea=qa.__dirtyElements,ya=qa.__dirtyUvs,Ka=qa.__dirtyNormals,Ca=qa.__dirtyTangents,Fa=qa.__dirtyColors,Ia=
|
|
|
+qa.__dirtyMorphTargets,za=qa.vertices,Ya=p.faces,bb=qa.faces,Za=qa.faceVertexUvs[0],$a=qa.faceVertexUvs[1],Pa=qa.skinVerticesA,Qa=qa.skinVerticesB,Ra=qa.skinIndices,La=qa.skinWeights,Ja=qa.morphTargets;if(ta){R=0;for(da=ta.length;R<da;R++)ta[R].offset=0,ta[R].offsetSrc=0}x=0;for(w=Ya.length;x<w;x++)if(fa=Ya[x],H=bb[fa],Za&&(y=Za[fa]),$a&&(N=$a[fa]),fa=H.vertexNormals,D=H.normal,ga=H.vertexColors,K=H.color,sa=H.vertexTangents,H instanceof THREE.Face3){if(Da)G=za[H.a].position,J=za[H.b].position,ha=
|
|
|
+za[H.c].position,V[Q]=G.x,V[Q+1]=G.y,V[Q+2]=G.z,V[Q+3]=J.x,V[Q+4]=J.y,V[Q+5]=J.z,V[Q+6]=ha.x,V[Q+7]=ha.y,V[Q+8]=ha.z,Q+=9;if(ta){R=0;for(da=ta.length;R<da;R++)if(E=ta[R],E.__original.needsUpdate)I=E.offset,ma=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[H.a],E.array[I+1]=E.value[H.b],E.array[I+2]=E.value[H.c]):E.boundTo==="faces"?(ma=E.value[ma],E.array[I]=ma,E.array[I+1]=ma,E.array[I+2]=ma,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[ma],
|
|
|
+E.array[I+1]=E.value[ma+1],E.array[I+2]=E.value[ma+2],E.offsetSrc+=3),E.offset+=3):(E.boundTo===void 0||E.boundTo==="vertices"?(G=E.value[H.a],J=E.value[H.b],ha=E.value[H.c]):E.boundTo==="faces"?(ha=J=G=ma=E.value[ma],E.offsetSrc++):E.boundTo==="faceVertices"&&(G=E.value[ma],J=E.value[ma+1],ha=E.value[ma+2],E.offsetSrc+=3),E.size===2?(E.array[I]=G.x,E.array[I+1]=G.y,E.array[I+2]=J.x,E.array[I+3]=J.y,E.array[I+4]=ha.x,E.array[I+5]=ha.y,E.offset+=6):E.size===3?(E.type==="c"?(E.array[I]=G.r,E.array[I+
|
|
|
+1]=G.g,E.array[I+2]=G.b,E.array[I+3]=J.r,E.array[I+4]=J.g,E.array[I+5]=J.b,E.array[I+6]=ha.r,E.array[I+7]=ha.g,E.array[I+8]=ha.b):(E.array[I]=G.x,E.array[I+1]=G.y,E.array[I+2]=G.z,E.array[I+3]=J.x,E.array[I+4]=J.y,E.array[I+5]=J.z,E.array[I+6]=ha.x,E.array[I+7]=ha.y,E.array[I+8]=ha.z),E.offset+=9):(E.array[I]=G.x,E.array[I+1]=G.y,E.array[I+2]=G.z,E.array[I+3]=G.w,E.array[I+4]=J.x,E.array[I+5]=J.y,E.array[I+6]=J.z,E.array[I+7]=J.w,E.array[I+8]=ha.x,E.array[I+9]=ha.y,E.array[I+10]=ha.z,E.array[I+11]=
|
|
|
+ha.w,E.offset+=12))}if(Ia){R=0;for(da=Ja.length;R<da;R++)G=Ja[R].vertices[H.a].position,J=Ja[R].vertices[H.b].position,ha=Ja[R].vertices[H.c].position,I=pa[R],I[U]=G.x,I[U+1]=G.y,I[U+2]=G.z,I[U+3]=J.x,I[U+4]=J.y,I[U+5]=J.z,I[U+6]=ha.x,I[U+7]=ha.y,I[U+8]=ha.z;U+=9}if(La.length)R=La[H.a],da=La[H.b],I=La[H.c],ja[S]=R.x,ja[S+1]=R.y,ja[S+2]=R.z,ja[S+3]=R.w,ja[S+4]=da.x,ja[S+5]=da.y,ja[S+6]=da.z,ja[S+7]=da.w,ja[S+8]=I.x,ja[S+9]=I.y,ja[S+10]=I.z,ja[S+11]=I.w,R=Ra[H.a],da=Ra[H.b],I=Ra[H.c],ua[S]=R.x,ua[S+
|
|
|
+1]=R.y,ua[S+2]=R.z,ua[S+3]=R.w,ua[S+4]=da.x,ua[S+5]=da.y,ua[S+6]=da.z,ua[S+7]=da.w,ua[S+8]=I.x,ua[S+9]=I.y,ua[S+10]=I.z,ua[S+11]=I.w,R=Pa[H.a],da=Pa[H.b],I=Pa[H.c],$[S]=R.x,$[S+1]=R.y,$[S+2]=R.z,$[S+3]=1,$[S+4]=da.x,$[S+5]=da.y,$[S+6]=da.z,$[S+7]=1,$[S+8]=I.x,$[S+9]=I.y,$[S+10]=I.z,$[S+11]=1,R=Qa[H.a],da=Qa[H.b],I=Qa[H.c],ca[S]=R.x,ca[S+1]=R.y,ca[S+2]=R.z,ca[S+3]=1,ca[S+4]=da.x,ca[S+5]=da.y,ca[S+6]=da.z,ca[S+7]=1,ca[S+8]=I.x,ca[S+9]=I.y,ca[S+10]=I.z,ca[S+11]=1,S+=12;if(Fa&&z)ga.length===3&&z===THREE.VertexColors?
|
|
|
+(H=ga[0],R=ga[1],da=ga[2]):da=R=H=K,ea[Y]=H.r,ea[Y+1]=H.g,ea[Y+2]=H.b,ea[Y+3]=R.r,ea[Y+4]=R.g,ea[Y+5]=R.b,ea[Y+6]=da.r,ea[Y+7]=da.g,ea[Y+8]=da.b,Y+=9;if(Ca&&qa.hasTangents)ga=sa[0],K=sa[1],H=sa[2],ka[oa]=ga.x,ka[oa+1]=ga.y,ka[oa+2]=ga.z,ka[oa+3]=ga.w,ka[oa+4]=K.x,ka[oa+5]=K.y,ka[oa+6]=K.z,ka[oa+7]=K.w,ka[oa+8]=H.x,ka[oa+9]=H.y,ka[oa+10]=H.z,ka[oa+11]=H.w,oa+=12;if(Ka&&ia)if(fa.length===3&&Ga)for(R=0;R<3;R++)D=fa[R],aa[Z]=D.x,aa[Z+1]=D.y,aa[Z+2]=D.z,Z+=3;else for(R=0;R<3;R++)aa[Z]=D.x,aa[Z+1]=D.y,
|
|
|
+aa[Z+2]=D.z,Z+=3;if(ya&&y!==void 0&&u)for(R=0;R<3;R++)fa=y[R],wa[T]=fa.u,wa[T+1]=fa.v,T+=2;if(ya&&N!==void 0&&u)for(R=0;R<3;R++)fa=N[R],la[W]=fa.u,la[W+1]=fa.v,W+=2;Ea&&(Ba[va]=M,Ba[va+1]=M+1,Ba[va+2]=M+2,va+=3,na[X]=M,na[X+1]=M+1,na[X+2]=M,na[X+3]=M+2,na[X+4]=M+1,na[X+5]=M+2,X+=6,M+=3)}else if(H instanceof THREE.Face4){if(Da)G=za[H.a].position,J=za[H.b].position,ha=za[H.c].position,O=za[H.d].position,V[Q]=G.x,V[Q+1]=G.y,V[Q+2]=G.z,V[Q+3]=J.x,V[Q+4]=J.y,V[Q+5]=J.z,V[Q+6]=ha.x,V[Q+7]=ha.y,V[Q+8]=ha.z,
|
|
|
+V[Q+9]=O.x,V[Q+10]=O.y,V[Q+11]=O.z,Q+=12;if(ta){R=0;for(da=ta.length;R<da;R++)if(E=ta[R],E.__original.needsUpdate)I=E.offset,ma=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[H.a],E.array[I+1]=E.value[H.b],E.array[I+2]=E.value[H.c],E.array[I+3]=E.value[H.d]):E.boundTo==="faces"?(ma=E.value[ma],E.array[I]=ma,E.array[I+1]=ma,E.array[I+2]=ma,E.array[I+3]=ma,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[ma],E.array[I+1]=E.value[ma+1],E.array[I+
|
|
|
+2]=E.value[ma+2],E.array[I+3]=E.value[ma+3],E.offsetSrc+=4),E.offset+=4):(E.boundTo===void 0||E.boundTo==="vertices"?(G=E.value[H.a],J=E.value[H.b],ha=E.value[H.c],O=E.value[H.d]):E.boundTo==="faces"?(O=ha=J=G=ma=E.value[ma],E.offsetSrc++):E.boundTo==="faceVertices"&&(G=E.value[ma],J=E.value[ma+1],ha=E.value[ma+2],O=E.value[ma+3],E.offsetSrc+=4),E.size===2?(E.array[I]=G.x,E.array[I+1]=G.y,E.array[I+2]=J.x,E.array[I+3]=J.y,E.array[I+4]=ha.x,E.array[I+5]=ha.y,E.array[I+6]=O.x,E.array[I+7]=O.y,E.offset+=
|
|
|
+8):E.size===3?(E.type==="c"?(E.array[I]=G.r,E.array[I+1]=G.g,E.array[I+2]=G.b,E.array[I+3]=J.r,E.array[I+4]=J.g,E.array[I+5]=J.b,E.array[I+6]=ha.r,E.array[I+7]=ha.g,E.array[I+8]=ha.b,E.array[I+9]=O.r,E.array[I+10]=O.g,E.array[I+11]=O.b):(E.array[I]=G.x,E.array[I+1]=G.y,E.array[I+2]=G.z,E.array[I+3]=J.x,E.array[I+4]=J.y,E.array[I+5]=J.z,E.array[I+6]=ha.x,E.array[I+7]=ha.y,E.array[I+8]=ha.z,E.array[I+9]=O.x,E.array[I+10]=O.y,E.array[I+11]=O.z),E.offset+=12):(E.array[I]=G.x,E.array[I+1]=G.y,E.array[I+
|
|
|
+2]=G.z,E.array[I+3]=G.w,E.array[I+4]=J.x,E.array[I+5]=J.y,E.array[I+6]=J.z,E.array[I+7]=J.w,E.array[I+8]=ha.x,E.array[I+9]=ha.y,E.array[I+10]=ha.z,E.array[I+11]=ha.w,E.array[I+12]=O.x,E.array[I+13]=O.y,E.array[I+14]=O.z,E.array[I+15]=O.w,E.offset+=16))}if(Ia){R=0;for(da=Ja.length;R<da;R++)G=Ja[R].vertices[H.a].position,J=Ja[R].vertices[H.b].position,ha=Ja[R].vertices[H.c].position,O=Ja[R].vertices[H.d].position,I=pa[R],I[U]=G.x,I[U+1]=G.y,I[U+2]=G.z,I[U+3]=J.x,I[U+4]=J.y,I[U+5]=J.z,I[U+6]=ha.x,I[U+
|
|
|
+7]=ha.y,I[U+8]=ha.z,I[U+9]=O.x,I[U+10]=O.y,I[U+11]=O.z;U+=12}if(La.length)R=La[H.a],da=La[H.b],I=La[H.c],E=La[H.d],ja[S]=R.x,ja[S+1]=R.y,ja[S+2]=R.z,ja[S+3]=R.w,ja[S+4]=da.x,ja[S+5]=da.y,ja[S+6]=da.z,ja[S+7]=da.w,ja[S+8]=I.x,ja[S+9]=I.y,ja[S+10]=I.z,ja[S+11]=I.w,ja[S+12]=E.x,ja[S+13]=E.y,ja[S+14]=E.z,ja[S+15]=E.w,R=Ra[H.a],da=Ra[H.b],I=Ra[H.c],E=Ra[H.d],ua[S]=R.x,ua[S+1]=R.y,ua[S+2]=R.z,ua[S+3]=R.w,ua[S+4]=da.x,ua[S+5]=da.y,ua[S+6]=da.z,ua[S+7]=da.w,ua[S+8]=I.x,ua[S+9]=I.y,ua[S+10]=I.z,ua[S+11]=I.w,
|
|
|
+ua[S+12]=E.x,ua[S+13]=E.y,ua[S+14]=E.z,ua[S+15]=E.w,R=Pa[H.a],da=Pa[H.b],I=Pa[H.c],E=Pa[H.d],$[S]=R.x,$[S+1]=R.y,$[S+2]=R.z,$[S+3]=1,$[S+4]=da.x,$[S+5]=da.y,$[S+6]=da.z,$[S+7]=1,$[S+8]=I.x,$[S+9]=I.y,$[S+10]=I.z,$[S+11]=1,$[S+12]=E.x,$[S+13]=E.y,$[S+14]=E.z,$[S+15]=1,R=Qa[H.a],da=Qa[H.b],I=Qa[H.c],H=Qa[H.d],ca[S]=R.x,ca[S+1]=R.y,ca[S+2]=R.z,ca[S+3]=1,ca[S+4]=da.x,ca[S+5]=da.y,ca[S+6]=da.z,ca[S+7]=1,ca[S+8]=I.x,ca[S+9]=I.y,ca[S+10]=I.z,ca[S+11]=1,ca[S+12]=H.x,ca[S+13]=H.y,ca[S+14]=H.z,ca[S+15]=1,S+=
|
|
|
+16;if(Fa&&z)ga.length===4&&z===THREE.VertexColors?(H=ga[0],R=ga[1],da=ga[2],ga=ga[3]):ga=da=R=H=K,ea[Y]=H.r,ea[Y+1]=H.g,ea[Y+2]=H.b,ea[Y+3]=R.r,ea[Y+4]=R.g,ea[Y+5]=R.b,ea[Y+6]=da.r,ea[Y+7]=da.g,ea[Y+8]=da.b,ea[Y+9]=ga.r,ea[Y+10]=ga.g,ea[Y+11]=ga.b,Y+=12;if(Ca&&qa.hasTangents)ga=sa[0],K=sa[1],H=sa[2],sa=sa[3],ka[oa]=ga.x,ka[oa+1]=ga.y,ka[oa+2]=ga.z,ka[oa+3]=ga.w,ka[oa+4]=K.x,ka[oa+5]=K.y,ka[oa+6]=K.z,ka[oa+7]=K.w,ka[oa+8]=H.x,ka[oa+9]=H.y,ka[oa+10]=H.z,ka[oa+11]=H.w,ka[oa+12]=sa.x,ka[oa+13]=sa.y,ka[oa+
|
|
|
+14]=sa.z,ka[oa+15]=sa.w,oa+=16;if(Ka&&ia)if(fa.length===4&&Ga)for(R=0;R<4;R++)D=fa[R],aa[Z]=D.x,aa[Z+1]=D.y,aa[Z+2]=D.z,Z+=3;else for(R=0;R<4;R++)aa[Z]=D.x,aa[Z+1]=D.y,aa[Z+2]=D.z,Z+=3;if(ya&&y!==void 0&&u)for(R=0;R<4;R++)fa=y[R],wa[T]=fa.u,wa[T+1]=fa.v,T+=2;if(ya&&N!==void 0&&u)for(R=0;R<4;R++)fa=N[R],la[W]=fa.u,la[W+1]=fa.v,W+=2;Ea&&(Ba[va]=M,Ba[va+1]=M+1,Ba[va+2]=M+3,Ba[va+3]=M+1,Ba[va+4]=M+2,Ba[va+5]=M+3,va+=6,na[X]=M,na[X+1]=M+1,na[X+2]=M,na[X+3]=M+3,na[X+4]=M+1,na[X+5]=M+2,na[X+6]=M+2,na[X+
|
|
|
+7]=M+3,X+=8,M+=4)}Da&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,V,t));if(ta){R=0;for(da=ta.length;R<da;R++)E=ta[R],E.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,E.buffer),o.bufferData(o.ARRAY_BUFFER,E.array,t))}if(Ia){R=0;for(da=Ja.length;R<da;R++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[R]),o.bufferData(o.ARRAY_BUFFER,pa[R],t)}Fa&&Y>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ea,t));Ka&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
+p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,aa,t));Ca&&qa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ka,t));ya&&T>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,t));ya&&W>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,la,t));Ea&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Ba,t),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),
|
|
|
+o.bufferData(o.ELEMENT_ARRAY_BUFFER,na,t));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,$,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ca,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ua,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ja,t));F&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,
|
|
|
+delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyColors=!1;k.__dirtyTangents=!1;l.attributes&&A(l)}else if(h instanceof THREE.Ribbon){if(k.__dirtyVertices||k.__dirtyColors){h=k;l=o.DYNAMIC_DRAW;n=x=F=F=void 0;w=h.vertices;v=
|
|
|
+h.colors;u=w.length;p=v.length;z=h.__vertexArray;t=h.__colorArray;ia=h.__dirtyColors;if(h.__dirtyVertices){for(F=0;F<u;F++)x=w[F].position,n=F*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,l)}if(ia){for(F=0;F<p;F++)color=v[F],n=F*3,t[n]=color.r,t[n+1]=color.g,t[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,t,l)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){if(k.__dirtyVertices||
|
|
|
+k.__dirtyColors){h=k;l=o.DYNAMIC_DRAW;n=x=F=F=void 0;w=h.vertices;v=h.colors;u=w.length;p=v.length;z=h.__vertexArray;t=h.__colorArray;ia=h.__dirtyColors;if(h.__dirtyVertices){for(F=0;F<u;F++)x=w[F].position,n=F*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,l)}if(ia){for(F=0;F<p;F++)color=v[F],n=F*3,t[n]=color.r,t[n+1]=color.g,t[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,t,l)}}k.__dirtyVertices=
|
|
|
+!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)l=c(h,p),t=l.attributes&&B(l),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||t)&&b(k,o.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,l.attributes&&A(l)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),a==="back"?o.cullFace(o.BACK):a==="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return ya}};
|
|
|
THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.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,c,b){THREE.WebGLRenderTarget.call(this,a,c,b);this.activeCubeFace=0};
|
|
@@ -349,19 +349,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
|
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
|
|
|
THREE.ColorUtils={adjustHSV:function(a,c,b,e){var k=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,k);k.h=THREE.Math.clamp(k.h+c,0,1);k.s=THREE.Math.clamp(k.s+b,0,1);k.v=THREE.Math.clamp(k.v+e,0,1);a.setHSV(k.h,k.s,k.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,k=a.b,h=Math.max(Math.max(b,e),k),f=Math.min(Math.min(b,e),k);if(f===h)f=b=0;else{var l=h-f,f=l/h,b=b===h?(e-k)/l:e===h?2+(k-b)/l:4+(b-e)/l;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=h;return c}};
|
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(a,c){for(var b,e,k=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,l=h.vertices,n=a.faces,u=h.faces,t=a.faceVertexUvs[0],p=h.faceVertexUvs[0],w={},v=0;v<a.materials.length;v++)w[a.materials[v].id]=v;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var v=0,z=l.length;v<z;v++){var x=new THREE.Vertex(l[v].position.clone());b&&b.multiplyVector3(x.position);f.push(x)}v=
|
|
|
-0;for(z=u.length;v<z;v++){var f=u[v],y,C,A=f.vertexNormals,B=f.vertexColors;f instanceof THREE.Face3?y=new THREE.Face3(f.a+k,f.b+k,f.c+k):f instanceof THREE.Face4&&(y=new THREE.Face4(f.a+k,f.b+k,f.c+k,f.d+k));y.normal.copy(f.normal);e&&e.multiplyVector3(y.normal);l=0;for(x=A.length;l<x;l++)C=A[l].clone(),e&&e.multiplyVector3(C),y.vertexNormals.push(C);y.color.copy(f.color);l=0;for(x=B.length;l<x;l++)C=B[l],y.vertexColors.push(C.clone());if(f.materialIndex!==void 0){l=h.materials[f.materialIndex];
|
|
|
-x=w[l.id];if(x===void 0)x=a.materials.length,a.materials.push(l);y.materialIndex=x}y.centroid.copy(f.centroid);b&&b.multiplyVector3(y.centroid);n.push(y)}v=0;for(z=p.length;v<z;v++){b=p[v];e=[];l=0;for(x=b.length;l<x;l++)e.push(new THREE.UV(b[l].u,b[l].v));t.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,k=a.faces,h=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;
|
|
|
-for(b=k.length;a<b;a++){var l=k[a],n,u,t=l.vertexNormals,p=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(f=t.length;e<f;e++)u=t[e],n.vertexNormals.push(u.clone());n.color.copy(l.color);e=0;for(f=p.length;e<f;e++)u=p[e],n.vertexColors.push(u.clone());n.materialIndex=l.materialIndex;n.centroid.copy(l.centroid);c.faces.push(n)}a=0;for(b=h.length;a<b;a++){k=h[a];n=[];e=0;for(f=k.length;e<
|
|
|
+THREE.GeometryUtils={merge:function(a,c){for(var b,e,k=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,l=h.vertices,n=a.faces,p=h.faces,t=a.faceVertexUvs[0],u=h.faceVertexUvs[0],w={},v=0;v<a.materials.length;v++)w[a.materials[v].id]=v;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var v=0,z=l.length;v<z;v++){var x=new THREE.Vertex(l[v].position.clone());b&&b.multiplyVector3(x.position);f.push(x)}v=
|
|
|
+0;for(z=p.length;v<z;v++){var f=p[v],y,D,B=f.vertexNormals,A=f.vertexColors;f instanceof THREE.Face3?y=new THREE.Face3(f.a+k,f.b+k,f.c+k):f instanceof THREE.Face4&&(y=new THREE.Face4(f.a+k,f.b+k,f.c+k,f.d+k));y.normal.copy(f.normal);e&&e.multiplyVector3(y.normal);l=0;for(x=B.length;l<x;l++)D=B[l].clone(),e&&e.multiplyVector3(D),y.vertexNormals.push(D);y.color.copy(f.color);l=0;for(x=A.length;l<x;l++)D=A[l],y.vertexColors.push(D.clone());if(f.materialIndex!==void 0){l=h.materials[f.materialIndex];
|
|
|
+x=w[l.id];if(x===void 0)x=a.materials.length,a.materials.push(l);y.materialIndex=x}y.centroid.copy(f.centroid);b&&b.multiplyVector3(y.centroid);n.push(y)}v=0;for(z=u.length;v<z;v++){b=u[v];e=[];l=0;for(x=b.length;l<x;l++)e.push(new THREE.UV(b[l].u,b[l].v));t.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,k=a.faces,h=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;
|
|
|
+for(b=k.length;a<b;a++){var l=k[a],n,p,t=l.vertexNormals,u=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(f=t.length;e<f;e++)p=t[e],n.vertexNormals.push(p.clone());n.color.copy(l.color);e=0;for(f=u.length;e<f;e++)p=u[e],n.vertexColors.push(p.clone());n.materialIndex=l.materialIndex;n.centroid.copy(l.centroid);c.faces.push(n)}a=0;for(b=h.length;a<b;a++){k=h[a];n=[];e=0;for(f=k.length;e<
|
|
|
f;e++)n.push(new THREE.UV(k[e].u,k[e].v));c.faceVertexUvs[0].push(n)}return c},randomPointInTriangle:function(a,c,b){var e,k,h,f=new THREE.Vector3,l=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();k=THREE.GeometryUtils.random();e+k>1&&(e=1-e,k=1-k);h=1-e-k;f.copy(a);f.multiplyScalar(e);l.copy(c);l.multiplyScalar(k);f.addSelf(l);l.copy(b);l.multiplyScalar(h);f.addSelf(l);return f},randomPointInFace:function(a,c,b){var e,k,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,k=c.vertices[a.b].position,
|
|
|
h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,k,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;k=c.vertices[a.b].position;h=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(e,k,c),f=THREE.GeometryUtils.triangleArea(k,h,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(e,k,c),f=THREE.GeometryUtils.triangleArea(k,h,c));return THREE.GeometryUtils.random()*(b+
|
|
|
-f)<b?THREE.GeometryUtils.randomPointInTriangle(e,k,c):THREE.GeometryUtils.randomPointInTriangle(k,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,e){if(e<c)return c;var f=c+Math.floor((e-c)/2);return u[f]>a?b(c,f-1):u[f]<a?b(f+1,e):f}return b(0,u.length-1)}var e,k,h=a.faces,f=a.vertices,l=h.length,n=0,u=[],t,p,w,v;for(k=0;k<l;k++){e=h[k];if(e instanceof THREE.Face3)t=f[e.a].position,p=f[e.b].position,w=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(t,p,w);else if(e instanceof
|
|
|
-THREE.Face4)t=f[e.a].position,p=f[e.b].position,w=f[e.c].position,v=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(t,p,v),e._area2=THREE.GeometryUtils.triangleArea(p,w,v),e._area=e._area1+e._area2;n+=e._area;u[k]=n}e=[];f={};for(k=0;k<c;k++)l=THREE.GeometryUtils.random()*n,l=b(l),e[k]=THREE.GeometryUtils.randomPointInFace(h[l],a,!0),f[l]?f[l]+=1:f[l]=1;return e},triangleArea:function(a,c,b){var e,k=THREE.GeometryUtils.__v1;k.sub(a,c);e=k.length();k.sub(a,b);a=k.length();k.sub(c,b);b=k.length();
|
|
|
+f)<b?THREE.GeometryUtils.randomPointInTriangle(e,k,c):THREE.GeometryUtils.randomPointInTriangle(k,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,e){if(e<c)return c;var f=c+Math.floor((e-c)/2);return p[f]>a?b(c,f-1):p[f]<a?b(f+1,e):f}return b(0,p.length-1)}var e,k,h=a.faces,f=a.vertices,l=h.length,n=0,p=[],t,u,w,v;for(k=0;k<l;k++){e=h[k];if(e instanceof THREE.Face3)t=f[e.a].position,u=f[e.b].position,w=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(t,u,w);else if(e instanceof
|
|
|
+THREE.Face4)t=f[e.a].position,u=f[e.b].position,w=f[e.c].position,v=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(t,u,v),e._area2=THREE.GeometryUtils.triangleArea(u,w,v),e._area=e._area1+e._area2;n+=e._area;p[k]=n}e=[];f={};for(k=0;k<c;k++)l=THREE.GeometryUtils.random()*n,l=b(l),e[k]=THREE.GeometryUtils.randomPointInFace(h[l],a,!0),f[l]?f[l]+=1:f[l]=1;return e},triangleArea:function(a,c,b){var e,k=THREE.GeometryUtils.__v1;k.sub(a,c);e=k.length();k.sub(a,b);a=k.length();k.sub(c,b);b=k.length();
|
|
|
c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.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(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,k=new THREE.Texture(e,c);e.onload=function(){k.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return k},loadTextureCube:function(a,c,b){var e,k=[],h=new THREE.Texture(k,c),c=k.loadCount=0;for(e=a.length;c<e;++c)k[c]=new Image,k[c].onload=function(){k.loadCount+=1;if(k.loadCount===6)h.needsUpdate=!0;b&&b(this)},k[c].crossOrigin="",k[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
|
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,k=a.height,h=document.createElement("canvas");h.width=e;h.height=k;var f=h.getContext("2d");f.drawImage(a,0,0);for(var l=f.getImageData(0,0,e,k).data,n=f.createImageData(e,k),u=n.data,t=0;t<e;t++)for(var p=1;p<k;p++){var w=p-1<0?k-1:p-1,v=(p+1)%k,z=t-1<0?e-1:t-1,x=(t+1)%e,y=[],C=[0,0,l[(p*e+t)*4]/255*c];y.push([-1,0,l[(p*e+z)*4]/255*c]);y.push([-1,-1,l[(w*e+z)*4]/255*c]);y.push([0,-1,l[(w*e+t)*4]/255*c]);y.push([1,-1,l[(w*e+x)*4]/255*c]);
|
|
|
-y.push([1,0,l[(p*e+x)*4]/255*c]);y.push([1,1,l[(v*e+x)*4]/255*c]);y.push([0,1,l[(v*e+t)*4]/255*c]);y.push([-1,1,l[(v*e+z)*4]/255*c]);w=[];z=y.length;for(v=0;v<z;v++){var x=y[v],A=y[(v+1)%z],x=[x[0]-C[0],x[1]-C[1],x[2]-C[2]],A=[A[0]-C[0],A[1]-C[1],A[2]-C[2]];w.push(b([x[1]*A[2]-x[2]*A[1],x[2]*A[0]-x[0]*A[2],x[0]*A[1]-x[1]*A[0]]))}y=[0,0,0];for(v=0;v<w.length;v++)y[0]+=w[v][0],y[1]+=w[v][1],y[2]+=w[v][2];y[0]/=w.length;y[1]/=w.length;y[2]/=w.length;C=(p*e+t)*4;u[C]=(y[0]+1)/2*255|0;u[C+1]=(y[1]+0.5)*
|
|
|
-255|0;u[C+2]=y[2]*255|0;u[C+3]=255}f.putImageData(n,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,k=a.children.length;for(e=0;e<k;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,k=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);k.add(h)}return k}};
|
|
|
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,k=a.height,h=document.createElement("canvas");h.width=e;h.height=k;var f=h.getContext("2d");f.drawImage(a,0,0);for(var l=f.getImageData(0,0,e,k).data,n=f.createImageData(e,k),p=n.data,t=0;t<e;t++)for(var u=1;u<k;u++){var w=u-1<0?k-1:u-1,v=(u+1)%k,z=t-1<0?e-1:t-1,x=(t+1)%e,y=[],D=[0,0,l[(u*e+t)*4]/255*c];y.push([-1,0,l[(u*e+z)*4]/255*c]);y.push([-1,-1,l[(w*e+z)*4]/255*c]);y.push([0,-1,l[(w*e+t)*4]/255*c]);y.push([1,-1,l[(w*e+x)*4]/255*c]);
|
|
|
+y.push([1,0,l[(u*e+x)*4]/255*c]);y.push([1,1,l[(v*e+x)*4]/255*c]);y.push([0,1,l[(v*e+t)*4]/255*c]);y.push([-1,1,l[(v*e+z)*4]/255*c]);w=[];z=y.length;for(v=0;v<z;v++){var x=y[v],B=y[(v+1)%z],x=[x[0]-D[0],x[1]-D[1],x[2]-D[2]],B=[B[0]-D[0],B[1]-D[1],B[2]-D[2]];w.push(b([x[1]*B[2]-x[2]*B[1],x[2]*B[0]-x[0]*B[2],x[0]*B[1]-x[1]*B[0]]))}y=[0,0,0];for(v=0;v<w.length;v++)y[0]+=w[v][0],y[1]+=w[v][1],y[2]+=w[v][2];y[0]/=w.length;y[1]/=w.length;y[2]/=w.length;D=(u*e+t)*4;p[D]=(y[0]+1)/2*255|0;p[D+1]=(y[1]+0.5)*
|
|
|
+255|0;p[D+2]=y[2]*255|0;p[D+3]=255}f.putImageData(n,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,k=a.children.length;for(e=0;e<k;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,k=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);k.add(h)}return k}};
|
|
|
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}"},
|
|
|
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",
|
|
@@ -400,37 +400,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var k=Array.prototype.sl
|
|
|
THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,k,h){var f=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,c),new THREE.Vector2(b,e),new THREE.Vector2(k,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
|
|
|
THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
|
|
|
THREE.Path.prototype.arc=function(a,c,b,e,k,h){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,k,h));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
|
|
|
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,k,h,f,l,n,u,t,p,w,v,z,x;e=0;for(k=this.actions.length;e<k;e++)switch(h=this.actions[e],f=h.action,h=h.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:l=h[2];n=h[3];p=h[0];w=h[1];b.length>0?(f=b[b.length-1],v=f.x,z=f.y):(f=this.actions[e-1].args,v=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)x=f/a,h=THREE.Shape.Utils.b2(x,v,p,l),x=THREE.Shape.Utils.b2(x,z,w,
|
|
|
-n),b.push(new THREE.Vector2(h,x));break;case THREE.PathActions.BEZIER_CURVE_TO:l=h[4];n=h[5];p=h[0];w=h[1];u=h[2];t=h[3];b.length>0?(f=b[b.length-1],v=f.x,z=f.y):(f=this.actions[e-1].args,v=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)x=f/a,h=THREE.Shape.Utils.b3(x,v,p,u,l),x=THREE.Shape.Utils.b3(x,z,w,t,n),b.push(new THREE.Vector2(h,x));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];x=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
|
|
|
-for(f=1;f<=x;f++)b.push(h.getPointAt(f/x));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;l=h[0];n=h[1];u=h[2];p=h[3];x=h[4];w=!!h[5];t=f[f.length-2];v=f[f.length-1];f.length==0&&(t=v=0);z=x-p;var y=a*2;for(f=1;f<=y;f++)x=f/y,w||(x=1-x),x=p+x*z,h=t+l+u*Math.cos(x),x=v+n+u*Math.sin(x),b.push(new THREE.Vector2(h,x))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
|
|
|
-THREE.Path.prototype.nltransform=function(a,c,b,e,k,h){var f=this.getPoints(),l,n,u,t,p;l=0;for(n=f.length;l<n;l++)u=f[l],t=u.x,p=u.y,u.x=a*t+c*p+b,u.y=e*p+k*t+h;return f};
|
|
|
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,k,h,f,l,n,p,t,u,w,v,z,x;e=0;for(k=this.actions.length;e<k;e++)switch(h=this.actions[e],f=h.action,h=h.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:l=h[2];n=h[3];u=h[0];w=h[1];b.length>0?(f=b[b.length-1],v=f.x,z=f.y):(f=this.actions[e-1].args,v=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)x=f/a,h=THREE.Shape.Utils.b2(x,v,u,l),x=THREE.Shape.Utils.b2(x,z,w,
|
|
|
+n),b.push(new THREE.Vector2(h,x));break;case THREE.PathActions.BEZIER_CURVE_TO:l=h[4];n=h[5];u=h[0];w=h[1];p=h[2];t=h[3];b.length>0?(f=b[b.length-1],v=f.x,z=f.y):(f=this.actions[e-1].args,v=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)x=f/a,h=THREE.Shape.Utils.b3(x,v,u,p,l),x=THREE.Shape.Utils.b3(x,z,w,t,n),b.push(new THREE.Vector2(h,x));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];x=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
|
|
|
+for(f=1;f<=x;f++)b.push(h.getPointAt(f/x));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;l=h[0];n=h[1];p=h[2];u=h[3];x=h[4];w=!!h[5];t=f[f.length-2];v=f[f.length-1];f.length==0&&(t=v=0);z=x-u;var y=a*2;for(f=1;f<=y;f++)x=f/y,w||(x=1-x),x=u+x*z,h=t+l+p*Math.cos(x),x=v+n+p*Math.sin(x),b.push(new THREE.Vector2(h,x))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
|
|
|
+THREE.Path.prototype.nltransform=function(a,c,b,e,k,h){var f=this.getPoints(),l,n,p,t,u;l=0;for(n=f.length;l<n;l++)p=f[l],t=p.x,u=p.y,p.x=a*t+c*u+b,p.y=e*u+k*t+h;return f};
|
|
|
THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,k,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],k=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,k);c.stroke();c.closePath();c.strokeStyle="red";e=
|
|
|
this.getPoints();a=0;for(b=e.length;a<b;a++)k=e[a],c.beginPath(),c.arc(k.x,k.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
|
THREE.Path.prototype.toShapes=function(){var a,c,b,e,k=[],h=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(k.push(h),h=new THREE.Path),h[b].apply(h,e);h.actions.length!=0&&k.push(h);if(k.length==0)return[];var f,h=[];if(THREE.Shape.Utils.isClockWise(k[0].getPoints())){a=0;for(c=k.length;a<c;a++)e=k[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f&&h.push(f),f=new THREE.Shape,f.actions=e.actions,f.curves=
|
|
|
e.curves):f.holes.push(e);h.push(f)}else{f=new THREE.Shape;a=0;for(c=k.length;a<c;a++)e=k[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f.actions=e.actions,f.curves=e.curves,h.push(f),f=new THREE.Shape):f.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 c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].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.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),k,h,f,l,n,u,t,p,w,v,z=[];for(n=0;n<c.length;n++){u=c[n];Array.prototype.push.apply(e,u);h=Number.POSITIVE_INFINITY;for(k=0;k<u.length;k++){w=u[k];v=[];for(p=0;p<b.length;p++)t=b[p],t=w.distanceToSquared(t),v.push(t),t<h&&(h=t,f=k,l=p)}k=l-1>=0?l-1:b.length-1;h=f-1>=0?f-1:u.length-1;var x=[u[f],b[l],b[k]];p=THREE.FontUtils.Triangulate.area(x);var y=[u[f],u[h],b[l]];w=THREE.FontUtils.Triangulate.area(y);v=l;t=f;l+=1;f+=-1;l<
|
|
|
-0&&(l+=b.length);l%=b.length;f<0&&(f+=u.length);f%=u.length;k=l-1>=0?l-1:b.length-1;h=f-1>=0?f-1:u.length-1;x=[u[f],b[l],b[k]];x=THREE.FontUtils.Triangulate.area(x);y=[u[f],u[h],b[l]];y=THREE.FontUtils.Triangulate.area(y);p+w>x+y&&(l=v,f=t,l<0&&(l+=b.length),l%=b.length,f<0&&(f+=u.length),f%=u.length,k=l-1>=0?l-1:b.length-1,h=f-1>=0?f-1:u.length-1);p=b.slice(0,l);w=b.slice(l);v=u.slice(f);t=u.slice(0,f);h=[u[f],u[h],b[l]];z.push([u[f],b[l],b[k]]);z.push(h);b=p.concat(v).concat(t).concat(w)}return{shape:b,
|
|
|
-isolatedPts:z,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,k=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,f,l,n,u={};h=0;for(f=e.length;h<f;h++)n=e[h].x+":"+e[h].y,u[n]!==void 0&&console.log("Duplicate point",n),u[n]=h;h=0;for(f=b.length;h<f;h++){l=b[h];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=u[n],n!==void 0&&(l[e]=n)}h=0;for(f=k.length;h<f;h++){l=k[h];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=u[n],n!==void 0&&(l[e]=n)}return b.concat(k)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),k,h,f,l,n,p,t,u,w,v,z=[];for(n=0;n<c.length;n++){p=c[n];Array.prototype.push.apply(e,p);h=Number.POSITIVE_INFINITY;for(k=0;k<p.length;k++){w=p[k];v=[];for(u=0;u<b.length;u++)t=b[u],t=w.distanceToSquared(t),v.push(t),t<h&&(h=t,f=k,l=u)}k=l-1>=0?l-1:b.length-1;h=f-1>=0?f-1:p.length-1;var x=[p[f],b[l],b[k]];u=THREE.FontUtils.Triangulate.area(x);var y=[p[f],p[h],b[l]];w=THREE.FontUtils.Triangulate.area(y);v=l;t=f;l+=1;f+=-1;l<
|
|
|
+0&&(l+=b.length);l%=b.length;f<0&&(f+=p.length);f%=p.length;k=l-1>=0?l-1:b.length-1;h=f-1>=0?f-1:p.length-1;x=[p[f],b[l],b[k]];x=THREE.FontUtils.Triangulate.area(x);y=[p[f],p[h],b[l]];y=THREE.FontUtils.Triangulate.area(y);u+w>x+y&&(l=v,f=t,l<0&&(l+=b.length),l%=b.length,f<0&&(f+=p.length),f%=p.length,k=l-1>=0?l-1:b.length-1,h=f-1>=0?f-1:p.length-1);u=b.slice(0,l);w=b.slice(l);v=p.slice(f);t=p.slice(0,f);h=[p[f],p[h],b[l]];z.push([p[f],b[l],b[k]]);z.push(h);b=u.concat(v).concat(t).concat(w)}return{shape:b,
|
|
|
+isolatedPts:z,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,k=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,f,l,n,p={};h=0;for(f=e.length;h<f;h++)n=e[h].x+":"+e[h].y,p[n]!==void 0&&console.log("Duplicate point",n),p[n]=h;h=0;for(f=b.length;h<f;h++){l=b[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(f=k.length;h<f;h++){l=k[h];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=p[n],n!==void 0&&(l[e]=n)}return b.concat(k)},
|
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,k){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
|
|
|
this.b3p3(a,k)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",k=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=k;THREE.FontUtils.style=h};
|
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
|
|
|
THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
|
|
|
-0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var l=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(l[0],l[1],l[2],l[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){l={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++){var u=a.hierarchy[b].keys[e].morphTargets[n];l[u]=-1}a.hierarchy[b].usedMorphTargets=l;for(e=0;e<a.hierarchy[b].keys.length;e++){var t=
|
|
|
-{};for(u in l){for(n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++)if(a.hierarchy[b].keys[e].morphTargets[n]===u){t[u]=a.hierarchy[b].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[b].keys[e].morphTargets.length&&(t[u]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=t}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
|
|
|
+0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var l=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(l[0],l[1],l[2],l[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){l={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++){var p=a.hierarchy[b].keys[e].morphTargets[n];l[p]=-1}a.hierarchy[b].usedMorphTargets=l;for(e=0;e<a.hierarchy[b].keys.length;e++){var t=
|
|
|
+{};for(p in l){for(n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++)if(a.hierarchy[b].keys[e].morphTargets[n]===p){t[p]=a.hierarchy[b].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[b].keys[e].morphTargets.length&&(t[p]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=t}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
|
|
|
a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else e(a,b);return b}},e=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)e(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
|
|
|
2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,k;for(b=0;b<e;b++){k=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)k.useQuaternion=!0;k.matrixAutoUpdate=!0;if(k.animationCache===void 0)k.animationCache={},k.animationCache.prevKey={pos:0,rot:0,scl:0},k.animationCache.nextKey={pos:0,rot:0,scl:0},k.animationCache.originalMatrix=k instanceof
|
|
|
THREE.Bone?k.skinMatrix:k.matrix;var h=k.animationCache.prevKey;k=k.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];k.pos=this.getNextKeyWith("pos",b,1);k.rot=this.getNextKeyWith("rot",b,1);k.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(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 c=["pos","rot","scl"],b,e,k,h,f,l,n,u,t=this.data.JIT.hierarchy,p,w;this.currentTime+=a*this.timeScale;w=this.currentTime;p=this.currentTime%=this.data.length;u=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,z=this.hierarchy.length;v<z;v++)if(a=this.hierarchy[v],n=a.animationCache,this.JITCompile&&t[v][u]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=t[v][u],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
-!1):(a.matrix=t[v][u],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++){b=c[x];f=n.prevKey[b];l=n.nextKey[b];if(l.time<=w){if(p<w)if(this.loop){f=this.data.hierarchy[v].keys[0];for(l=this.getNextKeyWith(b,v,1);l.time<p;)f=l,l=this.getNextKeyWith(b,v,l.index+1)}else{this.stop();return}else{do f=l,l=this.getNextKeyWith(b,v,l.index+1);while(l.time<
|
|
|
-p)}n.prevKey[b]=f;n.nextKey[b]=l}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(p-f.time)/(l.time-f.time);k=f[b];h=l[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+v),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=k[0]+(h[0]-k[0])*e,b.y=k[1]+(h[1]-k[1])*e,b.z=k[2]+(h[2]-k[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 c=["pos","rot","scl"],b,e,k,h,f,l,n,p,t=this.data.JIT.hierarchy,u,w;this.currentTime+=a*this.timeScale;w=this.currentTime;u=this.currentTime%=this.data.length;p=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,z=this.hierarchy.length;v<z;v++)if(a=this.hierarchy[v],n=a.animationCache,this.JITCompile&&t[v][p]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=t[v][p],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
+!1):(a.matrix=t[v][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++){b=c[x];f=n.prevKey[b];l=n.nextKey[b];if(l.time<=w){if(u<w)if(this.loop){f=this.data.hierarchy[v].keys[0];for(l=this.getNextKeyWith(b,v,1);l.time<u;)f=l,l=this.getNextKeyWith(b,v,l.index+1)}else{this.stop();return}else{do f=l,l=this.getNextKeyWith(b,v,l.index+1);while(l.time<
|
|
|
+u)}n.prevKey[b]=f;n.nextKey[b]=l}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(u-f.time)/(l.time-f.time);k=f[b];h=l[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+v),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=k[0]+(h[0]-k[0])*e,b.y=k[1]+(h[1]-k[1])*e,b.z=k[2]+(h[2]-k[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
this.getPrevKeyWith("pos",v,f.index-1).pos,this.points[1]=k,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",v,l.index+1).pos,e=e*0.33+0.33,k=this.interpolateCatmullRom(this.points,e),b.x=k[0],b.y=k[1],b.z=k[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(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
|
|
|
-"rot")THREE.Quaternion.slerp(k,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=k[0]+(h[0]-k[0])*e,b.y=k[1]+(h[1]-k[1])*e,b.z=k[2]+(h[2]-k[2])*e}}if(this.JITCompile&&t[0][u]===void 0){this.hierarchy[0].update(null,!0);for(v=0;v<this.hierarchy.length;v++)t[v][u]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],k,h,f,l,n,u;k=(a.length-1)*c;h=Math.floor(k);k-=h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];l=a[b[1]];n=a[b[2]];u=a[b[3]];b=k*k;f=k*b;e[0]=this.interpolate(h[0],l[0],n[0],u[0],k,b,f);e[1]=this.interpolate(h[1],l[1],n[1],u[1],k,b,f);e[2]=this.interpolate(h[2],l[2],n[2],u[2],k,b,f);return e};
|
|
|
+"rot")THREE.Quaternion.slerp(k,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=k[0]+(h[0]-k[0])*e,b.y=k[1]+(h[1]-k[1])*e,b.z=k[2]+(h[2]-k[2])*e}}if(this.JITCompile&&t[0][p]===void 0){this.hierarchy[0].update(null,!0);for(v=0;v<this.hierarchy.length;v++)t[v][p]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],k,h,f,l,n,p;k=(a.length-1)*c;h=Math.floor(k);k-=h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];l=a[b[1]];n=a[b[2]];p=a[b[3]];b=k*k;f=k*b;e[0]=this.interpolate(h[0],l[0],n[0],p[0],k,b,f);e[1]=this.interpolate(h[1],l[1],n[1],p[1],k,b,f);e[2]=this.interpolate(h[2],l[2],n[2],p[2],k,b,f);return e};
|
|
|
THREE.Animation.prototype.interpolate=function(a,c,b,e,k,h,f){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*f+(-3*(c-b)-2*a-e)*h+a*k+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
|
|
|
THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
@@ -449,7 +449,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
|
|
|
this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.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*b;this.lookVertical&&(this.lat-=this.mouseY*b*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;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.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",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
|
|
|
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function k(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,k=b.getControlPointsArray(),l=b.getLength(),y=k.length,C=0;h=y-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:k[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<y-1;h++)C=e*l.chunks[h]/l.total,b.keys[h]={time:C,pos:k[h]};f.hierarchy[0]=
|
|
|
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function k(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,k=b.getControlPointsArray(),l=b.getLength(),y=k.length,D=0;h=y-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:k[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<y-1;h++)D=e*l.chunks[h]/l.total,b.keys[h]={time:D,pos:k[h]};f.hierarchy[0]=
|
|
|
b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
|
|
|
new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
|
|
|
this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,l=Math.PI/180;this.update=function(a){var c;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%f;this.phi=a>=0?a:a+f;c=this.verticalAngleMap.srcRange;
|
|
@@ -467,199 +467,199 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
|
|
|
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
|
|
|
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
|
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
|
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c: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 b=new THREE.Vector3,e=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Matrix4,f=!1,l=1,n=0,u=0,t=0,p=0,w=0,v=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
|
|
|
-this.rotateHorizontally(c*p);this.rotateVertically(c*w)}c=a*this.movementSpeed;this.object.translateZ(-c*(n>0||this.autoForward&&!(n<0)?1:n));this.object.translateX(c*u);this.object.translateY(c*t);f&&(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();k.copy(this.forward);e.set(0,1,0);b.cross(e,
|
|
|
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c: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 b=new THREE.Vector3,e=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Matrix4,f=!1,l=1,n=0,p=0,t=0,u=0,w=0,v=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
|
|
|
+this.rotateHorizontally(c*u);this.rotateVertically(c*w)}c=a*this.movementSpeed;this.object.translateZ(-c*(n>0||this.autoForward&&!(n<0)?1:n));this.object.translateX(c*p);this.object.translateY(c*t);f&&(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();k.copy(this.forward);e.set(0,1,0);b.cross(e,
|
|
|
k).normalize();e.cross(k,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=k.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=k.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=k.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*
|
|
|
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);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-v)/window.innerWidth;w=(a.clientY-z)/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:u=-1;break;case 40:case 83:n=-1;break;case 39:case 68:u=1;break;case 81:f=!0;l=1;break;case 69:f=!0;l=-1;break;case 82:t=1;break;case 70:t=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:n=0;break;case 37:case 65:u=0;break;case 40:case 83:n=0;break;case 39:case 68:u=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:t=0;break;case 70:t=0}},!1)};
|
|
|
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){u=(a.clientX-v)/window.innerWidth;w=(a.clientY-z)/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:f=!0;l=1;break;case 69:f=!0;l=-1;break;case 82:t=1;break;case 70:t=-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:f=!1;break;case 69:f=!1;break;case 82:t=0;break;case 70:t=0}},!1)};
|
|
|
THREE.TrackballControls=function(a,c){var b=this,e={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!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 k=!1,h=e.NONE,f=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,u=new THREE.Vector2,t=new THREE.Vector2,p=new THREE.Vector2,w=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-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
|
|
|
+new THREE.Vector3(0,0,0);var k=!1,h=e.NONE,f=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector2,t=new THREE.Vector2,u=new THREE.Vector2,w=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-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
|
|
|
b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),h=e.length();h>1?e.normalize():e.z=Math.sqrt(1-h*h);f.copy(b.object.position).subSelf(b.target);h=b.object.up.clone().setLength(e.y);h.addSelf(b.object.up.clone().crossSelf(f).setLength(e.x));h.addSelf(f.setLength(e.z));return h};this.rotateCamera=function(){var a=Math.acos(l.dot(n)/l.length()/n.length());if(a){var c=(new THREE.Vector3).cross(l,n).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(f);
|
|
|
-e.multiplyVector3(b.object.up);e.multiplyVector3(n);b.staticMoving?l=n:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(l))}};this.zoomCamera=function(){var a=1+(t.y-u.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?u=t:u.y+=(t.y-u.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=w.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
|
|
|
-b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?p=w:p.addSelf(a.sub(w,p).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
|
|
|
-b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(k&&(l=n=b.getMouseProjectionOnBall(a.clientX,a.clientY),u=t=b.getMouseOnScreen(a.clientX,a.clientY),p=w=b.getMouseOnScreen(a.clientX,a.clientY),k=!1),h!==e.NONE&&(h===e.ROTATE?n=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?t=b.getMouseOnScreen(a.clientX,
|
|
|
-a.clientY):h===e.PAN&&!b.noPan&&(w=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),h===e.NONE))h=a.button,h===e.ROTATE?l=n=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?u=t=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=w=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
|
+e.multiplyVector3(b.object.up);e.multiplyVector3(n);b.staticMoving?l=n:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(l))}};this.zoomCamera=function(){var a=1+(t.y-p.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?p=t:p.y+=(t.y-p.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=w.clone().subSelf(u);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
|
|
|
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?u=w:u.addSelf(a.sub(w,u).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
|
|
|
+b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(k&&(l=n=b.getMouseProjectionOnBall(a.clientX,a.clientY),p=t=b.getMouseOnScreen(a.clientX,a.clientY),u=w=b.getMouseOnScreen(a.clientX,a.clientY),k=!1),h!==e.NONE&&(h===e.ROTATE?n=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?t=b.getMouseOnScreen(a.clientX,
|
|
|
+a.clientY):h===e.PAN&&!b.noPan&&(w=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),h===e.NONE))h=a.button,h===e.ROTATE?l=n=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?p=t=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(u=w=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
|
h=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&h===e.NONE){if(a.keyCode===b.keys[e.ROTATE])h=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)h=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)h=e.PAN;h!==e.NONE&&(k=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&h!==e.NONE)h=e.NONE},!1)};
|
|
|
-THREE.CubeGeometry=function(a,c,b,e,k,h,f,l){function n(a,b,c,f,l,n,p,t){var v,w,x=e||1,y=k||1,o=l/2,z=n/2,A=u.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")v="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")v="y",y=h||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")v="x",x=h||1;var C=x+1,B=y+1;l/=x;var J=n/y;for(w=0;w<B;w++)for(n=0;n<C;n++){var ra=new THREE.Vector3;ra[a]=(n*l-o)*c;ra[b]=(w*J-z)*f;ra[v]=p;u.vertices.push(new THREE.Vertex(ra))}for(w=0;w<y;w++)for(n=0;n<x;n++)u.faces.push(new THREE.Face4(n+
|
|
|
-C*w+A,n+C*(w+1)+A,n+1+C*(w+1)+A,n+1+C*w+A,null,null,t)),u.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var u=this,t=a/2,p=c/2,w=b/2,v,z,x,y,C,A;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(v=0;v<6;v++)this.materials.push(f)}v=0;y=1;z=2;C=3;x=4;A=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var B in l)this.sides[B]!=
|
|
|
-void 0&&(this.sides[B]=l[B]);this.sides.px&&n("z","y",-1,-1,b,c,t,v);this.sides.nx&&n("z","y",1,-1,b,c,-t,y);this.sides.py&&n("x","z",1,1,a,b,p,z);this.sides.ny&&n("x","z",1,-1,a,b,-p,C);this.sides.pz&&n("x","y",1,-1,a,c,w,x);this.sides.nz&&n("x","y",-1,-1,a,c,-w,A);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(a,c,b,e,k,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,k=k||1,l,n,u=[],t=[];for(n=0;n<=k;n++){var p=[],w=[],v=n/k,z=v*(c-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),-v*b+f,z*Math.cos(x*Math.PI*2))));p.push(this.vertices.length-1);w.push(new THREE.UV(x,v))}u.push(p);t.push(w)}for(n=0;n<k;n++)for(l=0;l<e;l++){var b=u[n][l],p=u[n+1][l],w=u[n+1][l+1],v=u[n][l+1],z=
|
|
|
-this.vertices[b].position.clone().setY(0).normalize(),x=this.vertices[p].position.clone().setY(0).normalize(),y=this.vertices[w].position.clone().setY(0).normalize(),C=this.vertices[v].position.clone().setY(0).normalize(),A=t[n][l].clone(),B=t[n+1][l].clone(),D=t[n+1][l+1].clone(),K=t[n][l+1].clone();this.faces.push(new THREE.Face4(b,p,w,v,[z,x,y,C]));this.faceVertexUvs[0].push([A,B,D,K])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(l=0;l<e;l++)b=u[0][l],p=u[0][l+
|
|
|
-1],w=this.vertices.length-1,z=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),A=t[0][l].clone(),B=t[0][l+1].clone(),D=new THREE.UV(B.u,0),this.faces.push(new THREE.Face3(b,p,w,[z,x,y])),this.faceVertexUvs[0].push([A,B,D])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(l=0;l<e;l++)b=u[n][l+1],p=u[n][l],w=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),A=t[n][l+1].clone(),B=t[n][l].clone(),
|
|
|
-D=new THREE.UV(B.u,1),this.faces.push(new THREE.Face3(b,p,w,[z,x,y])),this.faceVertexUvs[0].push([A,B,D])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.CubeGeometry=function(a,c,b,e,k,h,f,l){function n(a,b,c,f,l,n,u,t){var v,w,x=e||1,y=k||1,o=l/2,z=n/2,D=p.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")v="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")v="y",y=h||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")v="x",x=h||1;var A=x+1,B=y+1;l/=x;var J=n/y;for(w=0;w<B;w++)for(n=0;n<A;n++){var ra=new THREE.Vector3;ra[a]=(n*l-o)*c;ra[b]=(w*J-z)*f;ra[v]=u;p.vertices.push(new THREE.Vertex(ra))}for(w=0;w<y;w++)for(n=0;n<x;n++)p.faces.push(new THREE.Face4(n+
|
|
|
+A*w+D,n+A*(w+1)+D,n+1+A*(w+1)+D,n+1+A*w+D,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var p=this,t=a/2,u=c/2,w=b/2,v,z,x,y,D,B;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(v=0;v<6;v++)this.materials.push(f)}v=0;y=1;z=2;D=3;x=4;B=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&&n("z","y",-1,-1,b,c,t,v);this.sides.nx&&n("z","y",1,-1,b,c,-t,y);this.sides.py&&n("x","z",1,1,a,b,u,z);this.sides.ny&&n("x","z",1,-1,a,b,-u,D);this.sides.pz&&n("x","y",1,-1,a,c,w,x);this.sides.nz&&n("x","y",-1,-1,a,c,-w,B);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
+THREE.CylinderGeometry=function(a,c,b,e,k,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,k=k||1,l,n,p=[],t=[];for(n=0;n<=k;n++){var u=[],w=[],v=n/k,z=v*(c-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),-v*b+f,z*Math.cos(x*Math.PI*2))));u.push(this.vertices.length-1);w.push(new THREE.UV(x,v))}p.push(u);t.push(w)}for(n=0;n<k;n++)for(l=0;l<e;l++){var b=p[n][l],u=p[n+1][l],w=p[n+1][l+1],v=p[n][l+1],z=
|
|
|
+this.vertices[b].position.clone().setY(0).normalize(),x=this.vertices[u].position.clone().setY(0).normalize(),y=this.vertices[w].position.clone().setY(0).normalize(),D=this.vertices[v].position.clone().setY(0).normalize(),B=t[n][l].clone(),A=t[n+1][l].clone(),C=t[n+1][l+1].clone(),L=t[n][l+1].clone();this.faces.push(new THREE.Face4(b,u,w,v,[z,x,y,D]));this.faceVertexUvs[0].push([B,A,C,L])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(l=0;l<e;l++)b=p[0][l],u=p[0][l+
|
|
|
+1],w=this.vertices.length-1,z=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),B=t[0][l].clone(),A=t[0][l+1].clone(),C=new THREE.UV(A.u,0),this.faces.push(new THREE.Face3(b,u,w,[z,x,y])),this.faceVertexUvs[0].push([B,A,C])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(l=0;l<e;l++)b=p[n][l+1],u=p[n][l],w=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),B=t[n][l+1].clone(),A=t[n][l].clone(),
|
|
|
+C=new THREE.UV(A.u,1),this.faces.push(new THREE.Face3(b,u,w,[z,x,y])),this.faceVertexUvs[0].push([B,A,C])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,k;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)k=a[b],this.addShape(k,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,k=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);k.set(f.y,-f.x);l.copy(a).addSelf(h);n.copy(a).addSelf(k);if(l.equals(n))return k.clone();
|
|
|
l.copy(b).addSelf(h);n.copy(c).addSelf(k);h=e.dot(k);k=n.subSelf(l).dot(k);h===0&&(console.log("Either infinite or no solutions!"),k===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));k/=h;if(k<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(k).addSelf(l).subSelf(a).clone()}function k(a){for(N=a.length;--N>=0;){pa=N;na=N-1;na<0&&(na=a.length-
|
|
|
-1);for(var b=0,c=v+t*2,b=0;b<c;b++){var e=U*b,f=U*(b+1),h=qa+pa+e,k=qa+pa+f,o=h,e=qa+na+e,f=qa+na+f,p=k;o+=W;e+=W;f+=W;p+=W;L.faces.push(new THREE.Face4(o,e,f,p,null,null,D));D&&(o=b/c,e=(b+1)/c,f=l+n*2,h=(L.vertices[h].position.z+n)/f,k=(L.vertices[k].position.z+n)/f,L.faceVertexUvs[0].push([new THREE.UV(h,o),new THREE.UV(k,o),new THREE.UV(k,e),new THREE.UV(h,e)]))}}}function h(a,b,c){L.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=W;b+=W;c+=W;L.faces.push(new THREE.Face3(a,
|
|
|
-b,c,null,null,B));if(B){var e=K.maxY,f=K.maxX,h=L.vertices[b].position.x,b=L.vertices[b].position.y,k=L.vertices[c].position.x,c=L.vertices[c].position.y;L.faceVertexUvs[0].push([new THREE.UV(L.vertices[a].position.x/f,L.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(k/f,c/e)])}}var l=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:n-2,t=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
-!0,w=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,z=c.bendPath,x=c.extrudePath,y,C=!1,A=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,B=c.material,D=c.extrudeMaterial,K=this.shapebb;if(x)y=x.getPoints(w),v=y.length,C=!0,p=!1;p||(u=n=t=0);var H,M,V,L=this,W=this.vertices.length;z&&a.addWrapPath(z);w=A?a.extractAllSpacedPoints(w):a.extractAllPoints(w);z=w.shape;w=w.holes;if(x=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();M=0;for(V=w.length;M<V;M++)H=w[M],THREE.Shape.Utils.isClockWise(H)&&
|
|
|
-(w[M]=H.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(z,w);A=z;M=0;for(V=w.length;M<V;M++)H=w[M],z=z.concat(H);var N,O,Z,Y,P,o,U=z.length,Q=x.length,aa=[];N=0;O=A.length;pa=O-1;for(na=N+1;N<O;N++,pa++,na++)pa===O&&(pa=0),na===O&&(na=0),aa[N]=e(A[N],A[pa],A[na]);var T=[],J,ra=aa.concat();M=0;for(V=w.length;M<V;M++){H=w[M];J=[];N=0;O=H.length;pa=O-1;for(na=N+1;N<O;N++,pa++,na++)pa===O&&(pa=0),na===O&&(na=0),J[N]=e(H[N],H[pa],H[na]);T.push(J);ra=ra.concat(J)}for(Z=0;Z<t;Z++){Y=Z/t;P=n*(1-Y);Y=
|
|
|
-u*Math.sin(Y*Math.PI/2);N=0;for(O=A.length;N<O;N++)o=b(A[N],aa[N],Y),h(o.x,o.y,-P);M=0;for(V=w.length;M<V;M++){H=w[M];J=T[M];N=0;for(O=H.length;N<O;N++)o=b(H[N],J[N],Y),h(o.x,o.y,-P)}}Y=u;for(N=0;N<U;N++)o=p?b(z[N],ra[N],Y):z[N],C?h(o.x,o.y+y[0].y,y[0].x):h(o.x,o.y,0);for(Z=1;Z<=v;Z++)for(N=0;N<U;N++)o=p?b(z[N],ra[N],Y):z[N],C?h(o.x,o.y+y[Z-1].y,y[Z-1].x):h(o.x,o.y,l/v*Z);for(Z=t-1;Z>=0;Z--){Y=Z/t;P=n*(1-Y);Y=u*Math.sin(Y*Math.PI/2);N=0;for(O=A.length;N<O;N++)o=b(A[N],aa[N],Y),h(o.x,o.y,l+P);M=0;
|
|
|
-for(V=w.length;M<V;M++){H=w[M];J=T[M];N=0;for(O=H.length;N<O;N++)o=b(H[N],J[N],Y),C?h(o.x,o.y+y[v-1].y,y[v-1].x+P):h(o.x,o.y,l+P)}}if(p){p=U*0;for(N=0;N<Q;N++)u=x[N],f(u[2]+p,u[1]+p,u[0]+p);p=U*(v+t*2);for(N=0;N<Q;N++)u=x[N],f(u[0]+p,u[1]+p,u[2]+p)}else{for(N=0;N<Q;N++)u=x[N],f(u[2],u[1],u[0]);for(N=0;N<Q;N++)u=x[N],f(u[0]+U*v,u[1]+U*v,u[2]+U*v)}var pa,na,qa=0;k(A);qa+=A.length;M=0;for(V=w.length;M<V;M++)H=w[M],k(H),qa+=H.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
+1);for(var b=0,c=v+t*2,b=0;b<c;b++){var e=U*b,f=U*(b+1),h=qa+pa+e,k=qa+pa+f,o=h,e=qa+na+e,f=qa+na+f,p=k;o+=W;e+=W;f+=W;p+=W;K.faces.push(new THREE.Face4(o,e,f,p,null,null,C));C&&(o=b/c,e=(b+1)/c,f=l+n*2,h=(K.vertices[h].position.z+n)/f,k=(K.vertices[k].position.z+n)/f,K.faceVertexUvs[0].push([new THREE.UV(h,o),new THREE.UV(k,o),new THREE.UV(k,e),new THREE.UV(h,e)]))}}}function h(a,b,c){K.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=W;b+=W;c+=W;K.faces.push(new THREE.Face3(a,
|
|
|
+b,c,null,null,A));if(A){var e=L.maxY,f=L.maxX,h=K.vertices[b].position.x,b=K.vertices[b].position.y,k=K.vertices[c].position.x,c=K.vertices[c].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[a].position.x/f,K.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(k/f,c/e)])}}var l=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,p=c.bevelSize!==void 0?c.bevelSize:n-2,t=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
+!0,w=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,z=c.bendPath,x=c.extrudePath,y,D=!1,B=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,A=c.material,C=c.extrudeMaterial,L=this.shapebb;if(x)y=x.getPoints(w),v=y.length,D=!0,u=!1;u||(p=n=t=0);var G,M,V,K=this,W=this.vertices.length;z&&a.addWrapPath(z);w=B?a.extractAllSpacedPoints(w):a.extractAllPoints(w);z=w.shape;w=w.holes;if(x=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();M=0;for(V=w.length;M<V;M++)G=w[M],THREE.Shape.Utils.isClockWise(G)&&
|
|
|
+(w[M]=G.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(z,w);B=z;M=0;for(V=w.length;M<V;M++)G=w[M],z=z.concat(G);var N,O,Z,Y,P,o,U=z.length,Q=x.length,aa=[];N=0;O=B.length;pa=O-1;for(na=N+1;N<O;N++,pa++,na++)pa===O&&(pa=0),na===O&&(na=0),aa[N]=e(B[N],B[pa],B[na]);var T=[],J,ra=aa.concat();M=0;for(V=w.length;M<V;M++){G=w[M];J=[];N=0;O=G.length;pa=O-1;for(na=N+1;N<O;N++,pa++,na++)pa===O&&(pa=0),na===O&&(na=0),J[N]=e(G[N],G[pa],G[na]);T.push(J);ra=ra.concat(J)}for(Z=0;Z<t;Z++){Y=Z/t;P=n*(1-Y);Y=
|
|
|
+p*Math.sin(Y*Math.PI/2);N=0;for(O=B.length;N<O;N++)o=b(B[N],aa[N],Y),h(o.x,o.y,-P);M=0;for(V=w.length;M<V;M++){G=w[M];J=T[M];N=0;for(O=G.length;N<O;N++)o=b(G[N],J[N],Y),h(o.x,o.y,-P)}}Y=p;for(N=0;N<U;N++)o=u?b(z[N],ra[N],Y):z[N],D?h(o.x,o.y+y[0].y,y[0].x):h(o.x,o.y,0);for(Z=1;Z<=v;Z++)for(N=0;N<U;N++)o=u?b(z[N],ra[N],Y):z[N],D?h(o.x,o.y+y[Z-1].y,y[Z-1].x):h(o.x,o.y,l/v*Z);for(Z=t-1;Z>=0;Z--){Y=Z/t;P=n*(1-Y);Y=p*Math.sin(Y*Math.PI/2);N=0;for(O=B.length;N<O;N++)o=b(B[N],aa[N],Y),h(o.x,o.y,l+P);M=0;
|
|
|
+for(V=w.length;M<V;M++){G=w[M];J=T[M];N=0;for(O=G.length;N<O;N++)o=b(G[N],J[N],Y),D?h(o.x,o.y+y[v-1].y,y[v-1].x+P):h(o.x,o.y,l+P)}}if(u){u=U*0;for(N=0;N<Q;N++)p=x[N],f(p[2]+u,p[1]+u,p[0]+u);u=U*(v+t*2);for(N=0;N<Q;N++)p=x[N],f(p[0]+u,p[1]+u,p[2]+u)}else{for(N=0;N<Q;N++)p=x[N],f(p[2],p[1],p[0]);for(N=0;N<Q;N++)p=x[N],f(p[0]+U*v,p[1]+U*v,p[2]+U*v)}var pa,na,qa=0;k(B);qa+=B.length;M=0;for(V=w.length;M<V;M++)G=w[M],k(G),qa+=G.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
|
THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return k.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=k.vertices[a].position,f=k.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var k=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
|
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,l;for(l in h.faces){var n=e(h.faces[l].a,h.faces[l].b),u=e(h.faces[l].b,h.faces[l].c),t=e(h.faces[l].c,h.faces[l].a);b(h.faces[l].a,n,t,a);b(h.faces[l].b,u,
|
|
|
-n,a);b(h.faces[l].c,t,u,a);b(n,u,t,a)}h.faces=a.faces}k.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
+-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){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),t=e(h.faces[l].c,h.faces[l].a);b(h.faces[l].a,n,t,a);b(h.faces[l].b,p,
|
|
|
+n,a);b(h.faces[l].c,t,p,a);b(n,p,t,a)}h.faces=a.faces}k.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,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],k=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),l=0;l<a.length;l++)this.vertices.push(new THREE.Vertex(a[l])),b[l]=a[l].clone(),e[l]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(l=0;l<b.length;l++)n<this.angle?(b[l]=f.multiplyVector3(b[l].clone()),this.vertices.push(new THREE.Vertex(b[l])),k[l]=this.vertices.length-1):k=h;n==0&&(h=e);
|
|
|
for(l=0;l<e.length-1;l++)this.faces.push(new THREE.Face4(k[l],k[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-c)/this.angle,(l+1)/a.length),new THREE.UV(1-(n-c)/this.angle,l/a.length)]);e=k;k=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,l){l<1?(l=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),l.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),l.normal=l.centroid.clone().normalize(),
|
|
|
f.faces.push(l),l=Math.atan2(l.centroid.z,-l.centroid.x),f.faceVertexUvs[0].push([h(a.uv,a.position,l),h(b.uv,b.position,l),h(c.uv,c.position,l)])):(l-=1,e(a,k(a,b),k(a,c),l),e(k(a,b),b,k(b,c),l),e(k(a,c),k(b,c),c,l),e(k(a,b),k(b,c),k(a,c),l))}function k(a,c){l[a.index]||(l[a.index]=[]);l[c.index]||(l[c.index]=[]);var e=l[a.index][c.index];e===void 0&&(l[a.index][c.index]=l[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(a,b,c){c<0&&a.u===
|
|
|
1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,f=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var l=[],n=this.vertices;e(n[0],n[2],n[4],c);e(n[0],n[4],n[3],c);e(n[0],n[3],n[5],c);e(n[0],n[5],n[2],c);e(n[1],n[2],n[5],c);e(n[1],n[5],n[3],c);e(n[1],n[3],n[4],c);e(n[1],n[4],n[2],c);this.boundingSphere=
|
|
|
{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
|
-THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var k,h=a/2,f=c/2,b=b||1,e=e||1,l=b+1,n=e+1;a/=b;var u=c/e;for(k=0;k<n;k++)for(c=0;c<l;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(k*u-f),0)));for(k=0;k<e;k++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+l*k,c+l*(k+1),c+1+l*(k+1),c+1+l*k)),this.faceVertexUvs[0].push([new THREE.UV(c/b,k/e),new THREE.UV(c/b,(k+1)/e),new THREE.UV((c+1)/b,(k+1)/e),new THREE.UV((c+1)/b,k/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
+THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var k,h=a/2,f=c/2,b=b||1,e=e||1,l=b+1,n=e+1;a/=b;var p=c/e;for(k=0;k<n;k++)for(c=0;c<l;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(k*p-f),0)));for(k=0;k<e;k++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+l*k,c+l*(k+1),c+1+l*(k+1),c+1+l*k)),this.faceVertexUvs[0].push([new THREE.UV(c/b,k/e),new THREE.UV(c/b,(k+1)/e),new THREE.UV((c+1)/b,(k+1)/e),new THREE.UV((c+1)/b,k/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,k=Math.PI,h=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var l=a*Math.cos(e*k),n=a*Math.sin(e*k),u=[],t=0;for(e=0;e<h;e++){var p=2*e/h,w=n*Math.sin(p*k),p=n*Math.cos(p*k);(b==0||b==f)&&e>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,l,w)))-1);u.push(t)}c.push(u)}for(var v,z,x,k=c.length,b=0;b<k;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){u=e==h-1;f=c[b][u?0:e+1];l=c[b][u?h-1:e];n=c[b-1][u?
|
|
|
-h-1:e];u=c[b-1][u?0:e+1];w=b/(k-1);v=(b-1)/(k-1);z=(e+1)/h;var p=e/h,t=new THREE.UV(1-z,w),w=new THREE.UV(1-p,w),p=new THREE.UV(1-p,v),y=new THREE.UV(1-z,v);b<c.length-1&&(v=this.vertices[f].position.clone(),z=this.vertices[l].position.clone(),x=this.vertices[n].position.clone(),v.normalize(),z.normalize(),x.normalize(),this.faces.push(new THREE.Face3(f,l,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,w,p]));b>1&&(v=
|
|
|
-this.vertices[f].position.clone(),z=this.vertices[n].position.clone(),x=this.vertices[u].position.clone(),v.normalize(),z.normalize(),x.normalize(),this.faces.push(new THREE.Face3(f,n,u,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,p,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,k=Math.PI,h=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var l=a*Math.cos(e*k),n=a*Math.sin(e*k),p=[],t=0;for(e=0;e<h;e++){var u=2*e/h,w=n*Math.sin(u*k),u=n*Math.cos(u*k);(b==0||b==f)&&e>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,l,w)))-1);p.push(t)}c.push(p)}for(var v,z,x,k=c.length,b=0;b<k;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){p=e==h-1;f=c[b][p?0:e+1];l=c[b][p?h-1:e];n=c[b-1][p?
|
|
|
+h-1:e];p=c[b-1][p?0:e+1];w=b/(k-1);v=(b-1)/(k-1);z=(e+1)/h;var u=e/h,t=new THREE.UV(1-z,w),w=new THREE.UV(1-u,w),u=new THREE.UV(1-u,v),y=new THREE.UV(1-z,v);b<c.length-1&&(v=this.vertices[f].position.clone(),z=this.vertices[l].position.clone(),x=this.vertices[n].position.clone(),v.normalize(),z.normalize(),x.normalize(),this.faces.push(new THREE.Face3(f,l,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,w,u]));b>1&&(v=
|
|
|
+this.vertices[f].position.clone(),z=this.vertices[n].position.clone(),x=this.vertices[p].position.clone(),v.normalize(),z.normalize(),x.normalize(),this.faces.push(new THREE.Face3(f,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,u,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
|
|
|
-this.getFace(),b=this.size/c.resolution,e=0,k=String(a).split(""),h=k.length,f=[],a=0;a<h;a++){var l=new THREE.Path,l=this.extractGlyphPoints(k[a],c,b,e,l);e+=l.offset;f.push(l.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,k){var h=[],f,l,n,u,t,p,w,v,z,x,y=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));n=c.length;for(a=0;a<n;)switch(l=c[a++],l){case "m":l=c[a++]*b+e;u=c[a++]*b;h.push(new THREE.Vector2(l,
|
|
|
-u));k.moveTo(l,u);break;case "l":l=c[a++]*b+e;u=c[a++]*b;h.push(new THREE.Vector2(l,u));k.lineTo(l,u);break;case "q":l=c[a++]*b+e;u=c[a++]*b;w=c[a++]*b+e;v=c[a++]*b;k.quadraticCurveTo(w,v,l,u);if(f=h[h.length-1]){t=f.x;p=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var C=f/divisions,A=THREE.Shape.Utils.b2(C,t,w,l),C=THREE.Shape.Utils.b2(C,p,v,u);h.push(new THREE.Vector2(A,C))}}break;case "b":if(l=c[a++]*b+e,u=c[a++]*b,w=c[a++]*b+e,v=c[a++]*-b,z=c[a++]*b+e,x=c[a++]*-b,k.bezierCurveTo(l,u,
|
|
|
-w,v,z,x),f=h[h.length-1]){t=f.x;p=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)C=f/divisions,A=THREE.Shape.Utils.b3(C,t,w,z,l),C=THREE.Shape.Utils.b3(C,p,v,x,u),h.push(new THREE.Vector2(A,C))}}}return{offset:y.ha*b,points:h,path:k}}}};
|
|
|
-(function(a){var c=function(a){for(var c=a.length,k=0,h=c-1,f=0;f<c;h=f++)k+=a[h].x*a[f].y-a[f].x*a[h].y;return k*0.5};a.Triangulate=function(a,e){var k=a.length;if(k<3)return null;var h=[],f=[],l=[],n,u,t;if(c(a)>0)for(u=0;u<k;u++)f[u]=u;else for(u=0;u<k;u++)f[u]=k-1-u;var p=2*k;for(u=k-1;k>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return h}n=u;k<=n&&(n=0);u=n+1;k<=u&&(u=0);t=u+1;k<=t&&(t=0);var w;a:{w=a;var v=n,z=u,x=t,y=k,C=f,A=void 0,B=void 0,D=void 0,
|
|
|
-K=void 0,H=void 0,M=void 0,V=void 0,L=void 0,W=void 0,B=w[C[v]].x,D=w[C[v]].y,K=w[C[z]].x,H=w[C[z]].y,M=w[C[x]].x,V=w[C[x]].y;if(1.0E-10>(K-B)*(V-D)-(H-D)*(M-B))w=!1;else{for(A=0;A<y;A++)if(!(A==v||A==z||A==x)){var L=w[C[A]].x,W=w[C[A]].y,N=void 0,O=void 0,Z=void 0,Y=void 0,P=void 0,o=void 0,U=void 0,Q=void 0,aa=void 0,T=void 0,J=void 0,ra=void 0,N=Z=P=void 0,N=M-K,O=V-H,Z=B-M,Y=D-V,P=K-B,o=H-D,U=L-B,Q=W-D,aa=L-K,T=W-H,J=L-M,ra=W-V,N=N*T-O*aa,P=P*Q-o*U,Z=Z*ra-Y*J;if(N>=0&&Z>=0&&P>=0){w=!1;break a}}w=
|
|
|
-!0}}if(w){h.push([a[f[n]],a[f[u]],a[f[t]]]);l.push([f[n],f[u],f[t]]);n=u;for(t=u+1;t<k;n++,t++)f[n]=f[t];k--;p=2*k}}if(e)return l;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
+this.getFace(),b=this.size/c.resolution,e=0,k=String(a).split(""),h=k.length,f=[],a=0;a<h;a++){var l=new THREE.Path,l=this.extractGlyphPoints(k[a],c,b,e,l);e+=l.offset;f.push(l.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,k){var h=[],f,l,n,p,t,u,w,v,z,x,y=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));n=c.length;for(a=0;a<n;)switch(l=c[a++],l){case "m":l=c[a++]*b+e;p=c[a++]*b;h.push(new THREE.Vector2(l,
|
|
|
+p));k.moveTo(l,p);break;case "l":l=c[a++]*b+e;p=c[a++]*b;h.push(new THREE.Vector2(l,p));k.lineTo(l,p);break;case "q":l=c[a++]*b+e;p=c[a++]*b;w=c[a++]*b+e;v=c[a++]*b;k.quadraticCurveTo(w,v,l,p);if(f=h[h.length-1]){t=f.x;u=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var D=f/divisions,B=THREE.Shape.Utils.b2(D,t,w,l),D=THREE.Shape.Utils.b2(D,u,v,p);h.push(new THREE.Vector2(B,D))}}break;case "b":if(l=c[a++]*b+e,p=c[a++]*b,w=c[a++]*b+e,v=c[a++]*-b,z=c[a++]*b+e,x=c[a++]*-b,k.bezierCurveTo(l,p,
|
|
|
+w,v,z,x),f=h[h.length-1]){t=f.x;u=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)D=f/divisions,B=THREE.Shape.Utils.b3(D,t,w,z,l),D=THREE.Shape.Utils.b3(D,u,v,x,p),h.push(new THREE.Vector2(B,D))}}}return{offset:y.ha*b,points:h,path:k}}}};
|
|
|
+(function(a){var c=function(a){for(var c=a.length,k=0,h=c-1,f=0;f<c;h=f++)k+=a[h].x*a[f].y-a[f].x*a[h].y;return k*0.5};a.Triangulate=function(a,e){var k=a.length;if(k<3)return null;var h=[],f=[],l=[],n,p,t;if(c(a)>0)for(p=0;p<k;p++)f[p]=p;else for(p=0;p<k;p++)f[p]=k-1-p;var u=2*k;for(p=k-1;k>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return h}n=p;k<=n&&(n=0);p=n+1;k<=p&&(p=0);t=p+1;k<=t&&(t=0);var w;a:{w=a;var v=n,z=p,x=t,y=k,D=f,B=void 0,A=void 0,C=void 0,
|
|
|
+L=void 0,G=void 0,M=void 0,V=void 0,K=void 0,W=void 0,A=w[D[v]].x,C=w[D[v]].y,L=w[D[z]].x,G=w[D[z]].y,M=w[D[x]].x,V=w[D[x]].y;if(1.0E-10>(L-A)*(V-C)-(G-C)*(M-A))w=!1;else{for(B=0;B<y;B++)if(!(B==v||B==z||B==x)){var K=w[D[B]].x,W=w[D[B]].y,N=void 0,O=void 0,Z=void 0,Y=void 0,P=void 0,o=void 0,U=void 0,Q=void 0,aa=void 0,T=void 0,J=void 0,ra=void 0,N=Z=P=void 0,N=M-L,O=V-G,Z=A-M,Y=C-V,P=L-A,o=G-C,U=K-A,Q=W-C,aa=K-L,T=W-G,J=K-M,ra=W-V,N=N*T-O*aa,P=P*Q-o*U,Z=Z*ra-Y*J;if(N>=0&&Z>=0&&P>=0){w=!1;break a}}w=
|
|
|
+!0}}if(w){h.push([a[f[n]],a[f[p]],a[f[t]]]);l.push([f[n],f[p],f[t]]);n=p;for(t=p+1;t<k;n++,t++)f[n]=f[t];k--;u=2*k}}if(e)return l;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(a,c,b,e,k){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=k||Math.PI*2;k=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;k.x=this.radius*Math.cos(h);k.y=this.radius*Math.sin(h);var l=new THREE.Vector3;l.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);l.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);l.z=
|
|
|
this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(l));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(l.clone().subSelf(k).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var k=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,l=(this.segmentsT+1)*b+e,n=new THREE.Face4(k,h,f,l,[c[k],c[h],c[f],c[l]]);n.normal.addSelf(c[k]);n.normal.addSelf(c[h]);n.normal.addSelf(c[f]);n.normal.addSelf(c[l]);n.normal.normalize();this.faces.push(n);
|
|
|
this.faceVertexUvs[0].push([a[k].clone(),a[h].clone(),a[f].clone(),a[l].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
THREE.TorusKnotGeometry=function(a,c,b,e,k,h,f){function l(a,b,c,e,f,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,h*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=k||2;this.q=h||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=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(c=0;c<
|
|
|
this.segmentsT;++c){var n=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,k=l(n,f,this.q,this.p,this.radius,this.heightScale),n=l(n+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=n.x-k.x;b.y=n.y-k.y;b.z=n.z-k.z;e.x=n.x+k.x;e.y=n.y+k.y;e.z=n.z+k.z;h.cross(b,e);e.cross(h,b);h.normalize();e.normalize();n=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);k.x+=n*e.x+f*h.x;k.y+=n*e.y+f*h.y;k.z+=n*e.z+f*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(k.x,k.y,
|
|
|
-k.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,k=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),u=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),t=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(k,b,e,h));this.faceVertexUvs[0].push([f,n,u,t])}this.computeCentroids();
|
|
|
+k.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,k=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),t=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(k,b,e,h));this.faceVertexUvs[0].push([f,n,p,t])}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 c=this.subdivisions;c-- >0;)this.smooth(a)};
|
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,l,n){var v=new THREE.Face4(a,b,c,e,null,l.color,l.material);if(f.useOldVertexColors){v.vertexColors=[];for(var o,u,t,x=0;x<4;x++){t=n[x];o=new THREE.Color;o.setRGB(0,0,0);for(var w=0;w<t.length;w++)u=l.vertexColors[t[w]-1],o.r+=u.r,o.g+=u.g,o.b+=u.b;o.r/=t.length;o.g/=t.length;o.b/=t.length;v.vertexColors[x]=o}}k.push(v);(!f.supportUVs||p.length!=0)&&h.push([p[a],p[b],p[c],p[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
-b)}var e=[],k=[],h=[],f=this,l=a.vertices,e=a.faces,n=l.concat(),u=[],t={},p=[],w,v,z,x,y,C=a.faceVertexUvs[0];w=0;for(v=C.length;w<v;w++){z=0;for(x=C[w].length;z<x;z++)y=e[w]["abcd".charAt(z)],p[y]||(p[y]=C[w][z])}var A;w=0;for(v=e.length;w<v;w++)if(y=e[w],u.push(y.centroid),n.push(new THREE.Vertex(y.centroid)),f.supportUVs&&p.length!=0){A=new THREE.UV;if(y instanceof THREE.Face3)A.u=p[y.a].u+p[y.b].u+p[y.c].u,A.v=p[y.a].v+p[y.b].v+p[y.c].v,A.u/=3,A.v/=3;else if(y instanceof THREE.Face4)A.u=p[y.a].u+
|
|
|
-p[y.b].u+p[y.c].u+p[y.d].u,A.v=p[y.a].v+p[y.b].v+p[y.c].v+p[y.d].v,A.u/=4,A.v/=4;p.push(A)}x=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,k,l={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.a),c(l,k,e)):h instanceof THREE.Face4&&(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.d),c(l,k,e),k=b(h.d,h.a),c(l,k,e));return l}(a);var B,D,K=0,C=l.length,H;for(w in x)if(y=x[w],A=y[0],B=
|
|
|
-y[1],H=w.split("_"),v=H[0],H=H[1],D=new THREE.Vector3,y.length!=2?(D.addSelf(l[v].position),D.addSelf(l[H].position),D.multiplyScalar(0.5)):(D.addSelf(u[A]),D.addSelf(u[B]),D.addSelf(l[v].position),D.addSelf(l[H].position),D.multiplyScalar(0.25)),t[w]=C+e.length+K,n.push(new THREE.Vertex(D)),K++,f.supportUVs&&p.length!=0)A=new THREE.UV,A.u=p[v].u+p[H].u,A.v=p[v].v+p[H].v,A.u/=2,A.v/=2,p.push(A);w=0;for(v=u.length;w<v;w++)y=e[w],A=C+w,y instanceof THREE.Face3?(B=b(y.a,y.b),H=b(y.b,y.c),K=b(y.c,y.a),
|
|
|
-c(A,t[B],y.b,t[H],y,["123","12","2","23"]),c(A,t[H],y.c,t[K],y,["123","23","3","31"]),c(A,t[K],y.a,t[B],y,["123","31","1","12"])):y instanceof THREE.Face4?(B=b(y.a,y.b),H=b(y.b,y.c),K=b(y.c,y.d),D=b(y.d,y.a),c(A,t[B],y.b,t[H],y,["1234","12","2","23"]),c(A,t[H],y.c,t[K],y,["1234","23","3","34"]),c(A,t[K],y.d,t[D],y,["1234","34","4","41"]),c(A,t[D],y.a,t[B],y,["1234","41","1","12"])):console.log("face should be a face!",y);var e=n,M={},V={},n=function(a,b){M[a]===void 0&&(M[a]=[]);M[a].push(b)},t=function(a,
|
|
|
-b){V[a]===void 0&&(V[a]={});V[a][b]=null};for(w in x)y=x[w],H=w.split("_"),v=H[0],H=H[1],n(v,[v,H]),n(H,[v,H]),A=y[0],B=y[1],t(v,A),B?t(v,B):t(v,A),t(H,A),B?t(H,B):t(H,A);n=new THREE.Vector3;t=new THREE.Vector3;w=0;for(v=l.length;w<v;w++)if(M[w]!==void 0){n.set(0,0,0);t.set(0,0,0);x=new THREE.Vector3(0,0,0);C=0;for(z in V[w])n.addSelf(u[z]),C++;n.divideScalar(C);C=M[w].length;for(z=0;z<C;z++)y=M[w][z],y=l[y[0]].position.clone().addSelf(l[y[1]].position).divideScalar(2),t.addSelf(y);t.divideScalar(C);
|
|
|
-x.addSelf(l[w].position);x.multiplyScalar(C-3);x.addSelf(n);x.addSelf(t.multiplyScalar(2));x.divideScalar(C);e[w].position=x}a.vertices=e;a.faces=k;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 c(a,b,c,e,l,n){var p=new THREE.Face4(a,b,c,e,null,l.color,l.material);if(f.useOldVertexColors){p.vertexColors=[];for(var o,v,t,x=0;x<4;x++){t=n[x];o=new THREE.Color;o.setRGB(0,0,0);for(var w=0;w<t.length;w++)v=l.vertexColors[t[w]-1],o.r+=v.r,o.g+=v.g,o.b+=v.b;o.r/=t.length;o.g/=t.length;o.b/=t.length;p.vertexColors[x]=o}}k.push(p);(!f.supportUVs||u.length!=0)&&h.push([u[a],u[b],u[c],u[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
+b)}var e=[],k=[],h=[],f=this,l=a.vertices,e=a.faces,n=l.concat(),p=[],t={},u=[],w,v,z,x,y,D=a.faceVertexUvs[0];w=0;for(v=D.length;w<v;w++){z=0;for(x=D[w].length;z<x;z++)y=e[w]["abcd".charAt(z)],u[y]||(u[y]=D[w][z])}var B;w=0;for(v=e.length;w<v;w++)if(y=e[w],p.push(y.centroid),n.push(new THREE.Vertex(y.centroid)),f.supportUVs&&u.length!=0){B=new THREE.UV;if(y instanceof THREE.Face3)B.u=u[y.a].u+u[y.b].u+u[y.c].u,B.v=u[y.a].v+u[y.b].v+u[y.c].v,B.u/=3,B.v/=3;else if(y instanceof THREE.Face4)B.u=u[y.a].u+
|
|
|
+u[y.b].u+u[y.c].u+u[y.d].u,B.v=u[y.a].v+u[y.b].v+u[y.c].v+u[y.d].v,B.u/=4,B.v/=4;u.push(B)}x=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,k,l={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.a),c(l,k,e)):h instanceof THREE.Face4&&(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.d),c(l,k,e),k=b(h.d,h.a),c(l,k,e));return l}(a);var A,C,L=0,D=l.length,G;for(w in x)if(y=x[w],B=y[0],A=
|
|
|
+y[1],G=w.split("_"),v=G[0],G=G[1],C=new THREE.Vector3,y.length!=2?(C.addSelf(l[v].position),C.addSelf(l[G].position),C.multiplyScalar(0.5)):(C.addSelf(p[B]),C.addSelf(p[A]),C.addSelf(l[v].position),C.addSelf(l[G].position),C.multiplyScalar(0.25)),t[w]=D+e.length+L,n.push(new THREE.Vertex(C)),L++,f.supportUVs&&u.length!=0)B=new THREE.UV,B.u=u[v].u+u[G].u,B.v=u[v].v+u[G].v,B.u/=2,B.v/=2,u.push(B);w=0;for(v=p.length;w<v;w++)y=e[w],B=D+w,y instanceof THREE.Face3?(A=b(y.a,y.b),G=b(y.b,y.c),L=b(y.c,y.a),
|
|
|
+c(B,t[A],y.b,t[G],y,["123","12","2","23"]),c(B,t[G],y.c,t[L],y,["123","23","3","31"]),c(B,t[L],y.a,t[A],y,["123","31","1","12"])):y instanceof THREE.Face4?(A=b(y.a,y.b),G=b(y.b,y.c),L=b(y.c,y.d),C=b(y.d,y.a),c(B,t[A],y.b,t[G],y,["1234","12","2","23"]),c(B,t[G],y.c,t[L],y,["1234","23","3","34"]),c(B,t[L],y.d,t[C],y,["1234","34","4","41"]),c(B,t[C],y.a,t[A],y,["1234","41","1","12"])):console.log("face should be a face!",y);var e=n,M={},V={},n=function(a,b){M[a]===void 0&&(M[a]=[]);M[a].push(b)},t=function(a,
|
|
|
+b){V[a]===void 0&&(V[a]={});V[a][b]=null};for(w in x)y=x[w],G=w.split("_"),v=G[0],G=G[1],n(v,[v,G]),n(G,[v,G]),B=y[0],A=y[1],t(v,B),A?t(v,A):t(v,B),t(G,B),A?t(G,A):t(G,B);n=new THREE.Vector3;t=new THREE.Vector3;w=0;for(v=l.length;w<v;w++)if(M[w]!==void 0){n.set(0,0,0);t.set(0,0,0);x=new THREE.Vector3(0,0,0);D=0;for(z in V[w])n.addSelf(p[z]),D++;n.divideScalar(D);D=M[w].length;for(z=0;z<D;z++)y=M[w][z],y=l[y[0]].position.clone().addSelf(l[y[1]].position).divideScalar(2),t.addSelf(y);t.divideScalar(D);
|
|
|
+x.addSelf(l[w].position);x.multiplyScalar(D-3);x.addSelf(n);x.addSelf(t.multiplyScalar(2));x.divideScalar(D);e[w].position=x}a.vertices=e;a.faces=k;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 c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
|
a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=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=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function k(a,b,f,h,k,l){var n=document.createElement("canvas");a[b]=new THREE.Texture(n);a[b].sourceFile=f;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
|
|
|
if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}k&&a[b].offset.set(k[0],k[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[b].wrapS=h[l[0]];if(h[l[1]]!==void 0)a[b].wrapT=h[l[1]]}e(a[b],c+"/"+f)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,l,n;l="MeshLambertMaterial";f={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")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=h(a.colorDiffuse);
|
|
|
else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=h(a.colorSpecular);if(a.colorAmbient)f.ambient=h(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&k(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&k(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&k(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
|
-a.mapSpecular&&c&&k(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var u=THREE.ShaderUtils.lib.normal,t=THREE.UniformsUtils.clone(u.uniforms),p=f.color;l=f.specular;n=f.ambient;var w=f.shininess;t.tNormal.texture=f.normalMap;if(a.mapNormalFactor)t.uNormalScale.value=a.mapNormalFactor;if(f.map)t.tDiffuse.texture=f.map,t.enableDiffuse.value=!0;if(f.specularMap)t.tSpecular.texture=f.specularMap,t.enableSpecular.value=!0;if(f.lightMap)t.tAO.texture=
|
|
|
-f.lightMap,t.enableAO.value=!0;t.uDiffuseColor.value.setHex(p);t.uSpecularColor.value.setHex(l);t.uAmbientColor.value.setHex(n);t.uShininess.value=w;if(f.opacity)t.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:t,lights:!0,fog:!0})}else f=new THREE[l](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
+a.mapSpecular&&c&&k(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var p=THREE.ShaderUtils.lib.normal,t=THREE.UniformsUtils.clone(p.uniforms),u=f.color;l=f.specular;n=f.ambient;var w=f.shininess;t.tNormal.texture=f.normalMap;if(a.mapNormalFactor)t.uNormalScale.value=a.mapNormalFactor;if(f.map)t.tDiffuse.texture=f.map,t.enableDiffuse.value=!0;if(f.specularMap)t.tSpecular.texture=f.specularMap,t.enableSpecular.value=!0;if(f.lightMap)t.tAO.texture=
|
|
|
+f.lightMap,t.enableAO.value=!0;t.uDiffuseColor.value.setHex(u);t.uSpecularColor.value.setHex(l);t.uAmbientColor.value.setHex(n);t.uShininess.value=w;if(f.opacity)t.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:t,lights:!0,fog:!0})}else f=new THREE[l](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var k=a,a=k.model,c=k.callback,b=k.texture_path,e=k.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),k=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,
|
|
|
c,e,b,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(k)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,k,h){var f=new XMLHttpRequest,l=e+"/"+a,n=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,k,c):alert("Couldn't load ["+l+"] ["+f.status+"]"):f.readyState==3?h&&(n==0&&(n=f.getResponseHeader("Content-Length")),h({total:n,loaded:f.responseText.length})):f.readyState==2&&(n=f.getResponseHeader("Content-Length"))};f.open("GET",l,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var k=function(b){function c(a,b){var e=t(a,b),h=t(a,b+1),f=t(a,b+2),k=t(a,b+3),l=(k<<1&255|f>>7)-127;e|=(f&127)<<16|h<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=t(a,b),e=t(a,b+1),h=t(a,b+2);return(t(a,b+3)<<24)+(h<<16)+(e<<8)+c}function n(a,b){var c=t(a,b);return(t(a,b+1)<<8)+c}function u(a,b){var c=t(a,b);return c>127?c-256:c}function t(a,b){return a.charCodeAt(b)&255}function p(b){var c,
|
|
|
-e,h;c=k(a,b);e=k(a,b+H);h=k(a,b+M);b=n(a,b+V);C.faces.push(new THREE.Face3(c,e,h,null,null,b))}function w(b){var c,e,h,f,o,p,u;c=k(a,b);e=k(a,b+H);h=k(a,b+M);f=n(a,b+V);o=k(a,b+L);p=k(a,b+W);u=k(a,b+N);var b=D[p*3],t=D[p*3+1];p=D[p*3+2];var v=D[u*3],x=D[u*3+1];u=D[u*3+2];C.faces.push(new THREE.Face3(c,e,h,[new THREE.Vector3(D[o*3],D[o*3+1],D[o*3+2]),new THREE.Vector3(b,t,p),new THREE.Vector3(v,x,u)],null,f))}function v(b){var c,e,h,f;c=k(a,b);e=k(a,b+O);h=k(a,b+Z);f=k(a,b+Y);b=n(a,b+P);C.faces.push(new THREE.Face4(c,
|
|
|
-e,h,f,null,null,b))}function z(b){var c,e,h,f,p,u,t,v,x;c=k(a,b);e=k(a,b+O);h=k(a,b+Z);f=k(a,b+Y);p=n(a,b+P);u=k(a,b+o);t=k(a,b+U);v=k(a,b+Q);x=k(a,b+aa);var b=D[t*3],w=D[t*3+1];t=D[t*3+2];var F=D[v*3],y=D[v*3+1];v=D[v*3+2];var ia=D[x*3],G=D[x*3+1];x=D[x*3+2];C.faces.push(new THREE.Face4(c,e,h,f,[new THREE.Vector3(D[u*3],D[u*3+1],D[u*3+2]),new THREE.Vector3(b,w,t),new THREE.Vector3(F,y,v),new THREE.Vector3(ia,G,x)],null,p))}function x(b){var c,e,h,f;c=k(a,b);e=k(a,b+T);h=k(a,b+J);b=K[c*2];f=K[c*2+
|
|
|
-1];c=K[e*2];var n=C.faceVertexUvs[0];e=K[e*2+1];var o=K[h*2];h=K[h*2+1];var p=[];p.push(new THREE.UV(b,f));p.push(new THREE.UV(c,e));p.push(new THREE.UV(o,h));n.push(p)}function y(b){var c,e,h,f,n,o;c=k(a,b);e=k(a,b+ra);h=k(a,b+pa);f=k(a,b+na);b=K[c*2];n=K[c*2+1];c=K[e*2];o=K[e*2+1];e=K[h*2];var p=C.faceVertexUvs[0];h=K[h*2+1];var u=K[f*2];f=K[f*2+1];var t=[];t.push(new THREE.UV(b,n));t.push(new THREE.UV(c,o));t.push(new THREE.UV(e,h));t.push(new THREE.UV(u,f));p.push(t)}var C=this,A=0,B,D=[],K=[],
|
|
|
-H,M,V,L,W,N,O,Z,Y,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la,ea,ca,$;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(C,e,b);B={signature:a.substr(A,8),header_bytes:t(a,A+8),vertex_coordinate_bytes:t(a,A+9),normal_coordinate_bytes:t(a,A+10),uv_coordinate_bytes:t(a,A+11),vertex_index_bytes:t(a,A+12),normal_index_bytes:t(a,A+13),uv_index_bytes:t(a,A+14),material_index_bytes:t(a,A+15),nvertices:k(a,A+16),nnormals:k(a,A+16+4),nuvs:k(a,A+16+8),ntri_flat:k(a,A+16+12),ntri_smooth:k(a,A+16+16),ntri_flat_uv:k(a,
|
|
|
-A+16+20),ntri_smooth_uv:k(a,A+16+24),nquad_flat:k(a,A+16+28),nquad_smooth:k(a,A+16+32),nquad_flat_uv:k(a,A+16+36),nquad_smooth_uv:k(a,A+16+40)};A+=B.header_bytes;H=B.vertex_index_bytes;M=B.vertex_index_bytes*2;V=B.vertex_index_bytes*3;L=B.vertex_index_bytes*3+B.material_index_bytes;W=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;N=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;O=B.vertex_index_bytes;Z=B.vertex_index_bytes*2;Y=B.vertex_index_bytes*3;P=B.vertex_index_bytes*
|
|
|
-4;o=B.vertex_index_bytes*4+B.material_index_bytes;U=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;Q=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;aa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;T=B.uv_index_bytes;J=B.uv_index_bytes*2;ra=B.uv_index_bytes;pa=B.uv_index_bytes*2;na=B.uv_index_bytes*3;b=B.vertex_index_bytes*3+B.material_index_bytes;$=B.vertex_index_bytes*4+B.material_index_bytes;qa=B.ntri_flat*b;ja=B.ntri_smooth*(b+B.normal_index_bytes*
|
|
|
-3);la=B.ntri_flat_uv*(b+B.uv_index_bytes*3);ea=B.ntri_smooth_uv*(b+B.normal_index_bytes*3+B.uv_index_bytes*3);ca=B.nquad_flat*$;b=B.nquad_smooth*($+B.normal_index_bytes*4);$=B.nquad_flat_uv*($+B.uv_index_bytes*4);A+=function(b){for(var e,h,k,l=B.vertex_coordinate_bytes*3,n=b+B.nvertices*l;b<n;b+=l)e=c(a,b),h=c(a,b+B.vertex_coordinate_bytes),k=c(a,b+B.vertex_coordinate_bytes*2),C.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,k)));return B.nvertices*l}(A);A+=function(b){for(var c,e,h,f=B.normal_coordinate_bytes*
|
|
|
-3,k=b+B.nnormals*f;b<k;b+=f)c=u(a,b),e=u(a,b+B.normal_coordinate_bytes),h=u(a,b+B.normal_coordinate_bytes*2),D.push(c/127,e/127,h/127);return B.nnormals*f}(A);A+=function(b){for(var e,h,k=B.uv_coordinate_bytes*2,l=b+B.nuvs*k;b<l;b+=k)e=c(a,b),h=c(a,b+B.uv_coordinate_bytes),K.push(e,h);return B.nuvs*k}(A);qa=A+qa;ja=qa+ja;la=ja+la;ea=la+ea;ca=ea+ca;b=ca+b;$=b+$;(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=c+B.uv_index_bytes*3,h=a+B.ntri_flat_uv*e;for(b=a;b<h;b+=e)p(b),x(b+c);
|
|
|
-return h-a})(ja);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=c+B.uv_index_bytes*3,h=a+B.ntri_smooth_uv*e;for(b=a;b<h;b+=e)w(b),x(b+c);return h-a})(la);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=c+B.uv_index_bytes*4,h=a+B.nquad_flat_uv*e;for(b=a;b<h;b+=e)v(b),y(b+c);return h-a})(b);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,e=c+B.uv_index_bytes*4,h=a+B.nquad_smooth_uv*e;for(b=a;b<
|
|
|
-h;b+=e)z(b),y(b+c);return h-a})($);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=a+B.ntri_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(A);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=a+B.ntri_smooth*c;for(b=a;b<e;b+=c)w(b);return e-a})(qa);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=a+B.nquad_flat*c;for(b=a;b<e;b+=c)v(b);return e-a})(ea);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*
|
|
|
-4,e=a+B.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})(ca);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k(b))};
|
|
|
-THREE.ColladaLoader=function(){function a(a,e,k){ja=a;e=e||ca;k!==void 0&&(a=k.split("/"),a.pop(),Ea=a.length<1?"":a.join("/")+"/");ga=c("//dae:library_images/dae:image",f,"image");ka=c("//dae:library_materials/dae:material",V,"material");sa=c("//dae:library_effects/dae:effect",Z,"effect");ma=c("//dae:library_geometries/dae:geometry",y,"geometry");oa=c("//dae:library_controllers/dae:controller",l,"controller");ha=c("//dae:library_animations/dae:animation",P,"animation");Da=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
-t,"visual_scene");Ca=[];Fa=[];(a=ja.evaluate(".//dae:scene/dae:instance_visual_scene",ja,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ea=Da[a]):ea=null;la=new THREE.Object3D;for(a=0;a<ea.nodes.length;a++)la.add(h(ea.nodes[a]));b();for(var n in ha);n={scene:la,morphs:Ca,skins:Fa,dae:{images:ga,materials:ka,effects:sa,geometries:ma,controllers:oa,animations:ha,visualScenes:Da,scene:ea}};e&&e(n);return n}function c(a,b,c){for(var a=ja.evaluate(a,
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var k=function(b){function c(a,b){var e=t(a,b),h=t(a,b+1),f=t(a,b+2),k=t(a,b+3),l=(k<<1&255|f>>7)-127;e|=(f&127)<<16|h<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=t(a,b),e=t(a,b+1),h=t(a,b+2);return(t(a,b+3)<<24)+(h<<16)+(e<<8)+c}function n(a,b){var c=t(a,b);return(t(a,b+1)<<8)+c}function p(a,b){var c=t(a,b);return c>127?c-256:c}function t(a,b){return a.charCodeAt(b)&255}function u(b){var c,
|
|
|
+e,h;c=k(a,b);e=k(a,b+G);h=k(a,b+M);b=n(a,b+V);D.faces.push(new THREE.Face3(c,e,h,null,null,b))}function w(b){var c,e,h,f,o,p,u;c=k(a,b);e=k(a,b+G);h=k(a,b+M);f=n(a,b+V);o=k(a,b+K);p=k(a,b+W);u=k(a,b+N);var b=C[p*3],t=C[p*3+1];p=C[p*3+2];var v=C[u*3],x=C[u*3+1];u=C[u*3+2];D.faces.push(new THREE.Face3(c,e,h,[new THREE.Vector3(C[o*3],C[o*3+1],C[o*3+2]),new THREE.Vector3(b,t,p),new THREE.Vector3(v,x,u)],null,f))}function v(b){var c,e,h,f;c=k(a,b);e=k(a,b+O);h=k(a,b+Z);f=k(a,b+Y);b=n(a,b+P);D.faces.push(new THREE.Face4(c,
|
|
|
+e,h,f,null,null,b))}function z(b){var c,e,h,f,p,u,t,v,x;c=k(a,b);e=k(a,b+O);h=k(a,b+Z);f=k(a,b+Y);p=n(a,b+P);u=k(a,b+o);t=k(a,b+U);v=k(a,b+Q);x=k(a,b+aa);var b=C[t*3],w=C[t*3+1];t=C[t*3+2];var F=C[v*3],y=C[v*3+1];v=C[v*3+2];var ia=C[x*3],H=C[x*3+1];x=C[x*3+2];D.faces.push(new THREE.Face4(c,e,h,f,[new THREE.Vector3(C[u*3],C[u*3+1],C[u*3+2]),new THREE.Vector3(b,w,t),new THREE.Vector3(F,y,v),new THREE.Vector3(ia,H,x)],null,p))}function x(b){var c,e,h,f;c=k(a,b);e=k(a,b+T);h=k(a,b+J);b=L[c*2];f=L[c*2+
|
|
|
+1];c=L[e*2];var n=D.faceVertexUvs[0];e=L[e*2+1];var o=L[h*2];h=L[h*2+1];var p=[];p.push(new THREE.UV(b,f));p.push(new THREE.UV(c,e));p.push(new THREE.UV(o,h));n.push(p)}function y(b){var c,e,h,f,n,o;c=k(a,b);e=k(a,b+ra);h=k(a,b+pa);f=k(a,b+na);b=L[c*2];n=L[c*2+1];c=L[e*2];o=L[e*2+1];e=L[h*2];var p=D.faceVertexUvs[0];h=L[h*2+1];var u=L[f*2];f=L[f*2+1];var t=[];t.push(new THREE.UV(b,n));t.push(new THREE.UV(c,o));t.push(new THREE.UV(e,h));t.push(new THREE.UV(u,f));p.push(t)}var D=this,B=0,A,C=[],L=[],
|
|
|
+G,M,V,K,W,N,O,Z,Y,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la,ea,ca,$;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(D,e,b);A={signature:a.substr(B,8),header_bytes:t(a,B+8),vertex_coordinate_bytes:t(a,B+9),normal_coordinate_bytes:t(a,B+10),uv_coordinate_bytes:t(a,B+11),vertex_index_bytes:t(a,B+12),normal_index_bytes:t(a,B+13),uv_index_bytes:t(a,B+14),material_index_bytes:t(a,B+15),nvertices:k(a,B+16),nnormals:k(a,B+16+4),nuvs:k(a,B+16+8),ntri_flat:k(a,B+16+12),ntri_smooth:k(a,B+16+16),ntri_flat_uv:k(a,
|
|
|
+B+16+20),ntri_smooth_uv:k(a,B+16+24),nquad_flat:k(a,B+16+28),nquad_smooth:k(a,B+16+32),nquad_flat_uv:k(a,B+16+36),nquad_smooth_uv:k(a,B+16+40)};B+=A.header_bytes;G=A.vertex_index_bytes;M=A.vertex_index_bytes*2;V=A.vertex_index_bytes*3;K=A.vertex_index_bytes*3+A.material_index_bytes;W=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;N=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;O=A.vertex_index_bytes;Z=A.vertex_index_bytes*2;Y=A.vertex_index_bytes*3;P=A.vertex_index_bytes*
|
|
|
+4;o=A.vertex_index_bytes*4+A.material_index_bytes;U=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;Q=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;aa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;T=A.uv_index_bytes;J=A.uv_index_bytes*2;ra=A.uv_index_bytes;pa=A.uv_index_bytes*2;na=A.uv_index_bytes*3;b=A.vertex_index_bytes*3+A.material_index_bytes;$=A.vertex_index_bytes*4+A.material_index_bytes;qa=A.ntri_flat*b;ja=A.ntri_smooth*(b+A.normal_index_bytes*
|
|
|
+3);la=A.ntri_flat_uv*(b+A.uv_index_bytes*3);ea=A.ntri_smooth_uv*(b+A.normal_index_bytes*3+A.uv_index_bytes*3);ca=A.nquad_flat*$;b=A.nquad_smooth*($+A.normal_index_bytes*4);$=A.nquad_flat_uv*($+A.uv_index_bytes*4);B+=function(b){for(var e,h,k,l=A.vertex_coordinate_bytes*3,n=b+A.nvertices*l;b<n;b+=l)e=c(a,b),h=c(a,b+A.vertex_coordinate_bytes),k=c(a,b+A.vertex_coordinate_bytes*2),D.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,k)));return A.nvertices*l}(B);B+=function(b){for(var c,e,h,f=A.normal_coordinate_bytes*
|
|
|
+3,k=b+A.nnormals*f;b<k;b+=f)c=p(a,b),e=p(a,b+A.normal_coordinate_bytes),h=p(a,b+A.normal_coordinate_bytes*2),C.push(c/127,e/127,h/127);return A.nnormals*f}(B);B+=function(b){for(var e,h,k=A.uv_coordinate_bytes*2,l=b+A.nuvs*k;b<l;b+=k)e=c(a,b),h=c(a,b+A.uv_coordinate_bytes),L.push(e,h);return A.nuvs*k}(B);qa=B+qa;ja=qa+ja;la=ja+la;ea=la+ea;ca=ea+ca;b=ca+b;$=b+$;(function(a){var b,c=A.vertex_index_bytes*3+A.material_index_bytes,e=c+A.uv_index_bytes*3,h=a+A.ntri_flat_uv*e;for(b=a;b<h;b+=e)u(b),x(b+c);
|
|
|
+return h-a})(ja);(function(a){var b,c=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,e=c+A.uv_index_bytes*3,h=a+A.ntri_smooth_uv*e;for(b=a;b<h;b+=e)w(b),x(b+c);return h-a})(la);(function(a){var b,c=A.vertex_index_bytes*4+A.material_index_bytes,e=c+A.uv_index_bytes*4,h=a+A.nquad_flat_uv*e;for(b=a;b<h;b+=e)v(b),y(b+c);return h-a})(b);(function(a){var b,c=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,e=c+A.uv_index_bytes*4,h=a+A.nquad_smooth_uv*e;for(b=a;b<
|
|
|
+h;b+=e)z(b),y(b+c);return h-a})($);(function(a){var b,c=A.vertex_index_bytes*3+A.material_index_bytes,e=a+A.ntri_flat*c;for(b=a;b<e;b+=c)u(b);return e-a})(B);(function(a){var b,c=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,e=a+A.ntri_smooth*c;for(b=a;b<e;b+=c)w(b);return e-a})(qa);(function(a){var b,c=A.vertex_index_bytes*4+A.material_index_bytes,e=a+A.nquad_flat*c;for(b=a;b<e;b+=c)v(b);return e-a})(ea);(function(a){var b,c=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*
|
|
|
+4,e=a+A.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})(ca);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k(b))};
|
|
|
+THREE.ColladaLoader=function(){function a(a,e,k){ja=a;e=e||ca;k!==void 0&&(a=k.split("/"),a.pop(),Ea=a.length<1?"":a.join("/")+"/");ga=c("//dae:library_images/dae:image",f,"image");ka=c("//dae:library_materials/dae:material",V,"material");ta=c("//dae:library_effects/dae:effect",Z,"effect");ma=c("//dae:library_geometries/dae:geometry",y,"geometry");oa=c("//dae:library_controllers/dae:controller",l,"controller");ha=c("//dae:library_animations/dae:animation",P,"animation");Da=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
+t,"visual_scene");Ca=[];Fa=[];(a=ja.evaluate(".//dae:scene/dae:instance_visual_scene",ja,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ea=Da[a]):ea=null;la=new THREE.Object3D;for(a=0;a<ea.nodes.length;a++)la.add(h(ea.nodes[a]));b();for(var n in ha);n={scene:la,morphs:Ca,skins:Fa,dae:{images:ga,materials:ka,effects:ta,geometries:ma,controllers:oa,animations:ha,visualScenes:Da,scene:ea}};e&&e(n);return n}function c(a,b,c){for(var a=ja.evaluate(a,
|
|
|
ja,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},h=a.iterateNext(),f=0;h;){h=(new b).parse(h);if(h.id.length==0)h.id=c+f++;e[h.id]=h;h=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ha)for(var h=ha[e],f=0;f<h.sampler.length;f++){var k=h.sampler[f];k.create();a=Math.min(a,k.startTime);b=Math.max(b,k.endTime);c=Math.max(c,k.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,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[c];f instanceof THREE.Matrix4&&a.world.copy(f)}h&&a.world.multiply(h,a.world);b.push(a);for(h=0;h<a.nodes.length;h++)e(a.nodes[h],b,c,a.world)}function k(a,c,h){var f=oa[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var k=b(),c=ea.getChildById(c.skeleton[0],!0)||ea.getChildBySid(c.skeleton[0],!0),l,n,o,p,u=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 v=[],x=[];for(l=0;l<a.vertices.length;l++)x.push(new THREE.Vertex(new THREE.Vector3));e(c,v,h);l=v;n=f.skin;for(p=0;p<l.length;p++)if(o=l[p],t=-1,o.type=="JOINT"){for(var w=0;w<n.joints.length;w++)if(o.sid==n.joints[w]){t=w;break}if(t>=0){w=n.invBindMatrices[t];o.invBindMatrix=w;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,w);o.weights=[];for(w=0;w<n.weights.length;w++)for(var y=
|
|
|
0;y<n.weights[w].length;y++){var z=n.weights[w][y];z.joint==t&&o.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+o.sid+"'.";}for(l=0;l<v.length;l++)if(v[l].type=="JOINT")for(n=0;n<v[l].weights.length;n++)o=v[l].weights[n],p=o.index,o=o.weight,t=a.vertices[p],p=x[p],u.x=t.position.x,u.y=t.position.y,u.z=t.position.z,v[l].skinningMatrix.multiplyVector3(u),p.position.x+=u.x*o,p.position.y+=u.y*o,p.position.z+=u.z*o;a.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(a){var b=
|
|
|
new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var l=oa[a.controllers[f].url];switch(l.type){case "skin":if(ma[l.skin.source]){var n=new x;n.url=l.skin.source;n.instance_material=a.controllers[f].instance_material;a.geometries.push(n);c=a.controllers[f]}else if(oa[l.skin.source]&&(e=l=oa[l.skin.source],l.morph&&ma[l.morph.source]))n=new x,n.url=l.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n);break;case "morph":if(ma[l.morph.source])n=new x,
|
|
|
-n.url=l.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var l=a.geometries[f],n=l.instance_material,l=ma[l.url],o={},p=0,t;if(l&&l.mesh&&l.mesh.primitives){if(b.name.length==0)b.name=l.id;if(n)for(j=0;j<n.length;j++){t=n[j];var u=sa[ka[t.target].instance_effect.url].shader;u.material.opacity=!u.material.opacity?1:u.material.opacity;t=o[t.symbol]=
|
|
|
-u.material;p++}n=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});l=l.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<l.faces.length;j++)p=l.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)k(l,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(l,n),n.skeleton=c.skeleton,n.skinController=oa[c.url],n.skinInstanceController=c,n.name="skin_"+Fa.length,Fa.push(n);else if(e!==void 0){o=l;p=e instanceof v?oa[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 w=ma[p.targets[u]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:w.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(l,n);n.name="morph_"+Ca.length;Ca.push(n)}else n=new THREE.Mesh(l,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
|
|
|
-b.scale);for(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){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 u(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function t(){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 w(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function v(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function C(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function A(){}function B(){this.material="";this.count=
|
|
|
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";this.stride=this.count=0;this.params=[]}function K(){this.input={}}function H(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(a){this.id=a;this.type=null}function V(){this.name=this.id="";this.instance_effect=null}function L(){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 W(a,
|
|
|
+n.url=l.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var l=a.geometries[f],n=l.instance_material,l=ma[l.url],o={},p=0,u;if(l&&l.mesh&&l.mesh.primitives){if(b.name.length==0)b.name=l.id;if(n)for(j=0;j<n.length;j++){u=n[j];var t=ta[ka[u.target].instance_effect.url].shader;t.material.opacity=!t.material.opacity?1:t.material.opacity;u=o[u.symbol]=
|
|
|
+t.material;p++}n=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});l=l.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<l.faces.length;j++)p=l.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)k(l,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(l,n),n.skeleton=c.skeleton,n.skinController=oa[c.url],n.skinInstanceController=c,n.name="skin_"+Fa.length,Fa.push(n);else if(e!==void 0){o=l;p=e instanceof v?oa[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");
|
|
|
+else{p=p.morph;for(t=0;t<p.targets.length;t++){var w=ma[p.targets[t]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:w.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(l,n);n.name="morph_"+Ca.length;Ca.push(n)}else n=new THREE.Mesh(l,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
|
|
|
+b.scale);for(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){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 t(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function u(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
|
+[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function w(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function v(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function D(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function B(){}function A(){this.material="";this.count=
|
|
|
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function C(){this.source="";this.stride=this.count=0;this.params=[]}function L(){this.input={}}function G(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(a){this.id=a;this.type=null}function V(){this.name=this.id="";this.instance_effect=null}function K(){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 W(a,
|
|
|
b){this.type=a;this.effect=b;this.material=null}function N(a){this.effect=a;this.format=this.init_from=null}function O(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Z(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Y(){this.url=""}function P(){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 U(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function Q(a){var b=a.getAttribute("id");if($[b]!=void 0)return $[b];$[b]=(new M(b)).parse(a);return $[b]}function aa(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function T(a){for(var a=ra(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function J(a){for(var a=ra(a),b=[],c=0;c<
|
|
|
a.length;c++)b.push(parseInt(a[c],10));return b}function ra(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function pa(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function na(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function qa(a,b){var c="";c+=na(a.x,b)+",";c+=na(a.y,b)+",";c+=na(a.z,b);return c}var ja=null,la=null,ea,ca=
|
|
|
-null,$={},ga={},ha={},oa={},ma={},ka={},sa={},Da,Ea,Ca,Fa,za=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new u).parse(c);this.type=
|
|
|
+null,$={},ga={},ha={},oa={},ma={},ka={},ta={},Da,Ea,Ca,Fa,za=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new p).parse(c);this.type=
|
|
|
c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],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);b[h.id]=h;break;case "targets":c=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],h=b[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 b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new H).parse(e))}}return b};u.prototype.parse=function(a){var b={},c,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=
|
|
|
-T(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);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":e=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};u.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=
|
|
|
-(new H).parse(e),h=b[e.source];if(e.semantic=="JOINT")this.joints=h.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};u.prototype.parseWeights=function(a,b){for(var c,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 H).parse(k));break;case "v":c=J(k.textContent);break;case "vcount":e=J(k.textContent)}}for(f=k=0;f<e.length;f++){for(var l=e[f],n=[],o=0;o<l;o++){for(var p={},u=0;u<h.length;u++){var t=
|
|
|
+h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new G).parse(e))}}return b};p.prototype.parse=function(a){var b={},c,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=
|
|
|
+T(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);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":e=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};p.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=
|
|
|
+(new G).parse(e),h=b[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,b){for(var c,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 G).parse(k));break;case "v":c=J(k.textContent);break;case "vcount":e=J(k.textContent)}}for(f=k=0;f<e.length;f++){for(var l=e[f],n=[],o=0;o<l;o++){for(var p={},u=0;u<h.length;u++){var t=
|
|
|
h[u],v=c[k+t.offset];switch(t.semantic){case "JOINT":p.joint=v;break;case "WEIGHT":p.weight=b[t.source].data[v]}}n.push(p);k+=h.length}for(o=0;o<n.length;o++)n[o].index=f;this.weights.push(n)}};t.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};t.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};t.prototype.parse=function(a){this.id=
|
|
|
-a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.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 c.info={sid:h,dotSyntax:f,arrSyntax:k,arrIndices:l},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};p.prototype.getTransformBySid=
|
|
|
-function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
|
|
|
-1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new v).parse(b));break;case "instance_geometry":this.geometries.push((new x).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ja.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ja,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;
|
|
|
+a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new u).parse(c))}}return this};u.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.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 c.info={sid:h,dotSyntax:f,arrSyntax:k,arrIndices:l},c}return null};u.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};u.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};u.prototype.getTransformBySid=
|
|
|
+function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};u.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
|
|
|
+1)switch(b.nodeName){case "node":this.nodes.push((new u).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new v).parse(b));break;case "instance_geometry":this.geometries.push((new x).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ja.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ja,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new u).parse(b));break;
|
|
|
case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new w).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in ha)for(var h=ha[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,c=Math.min(c,l.startTime),b=Math.max(b,l.endTime),a.push(k)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=
|
|
|
-1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var h={},n=f=void 0,f=0;f<this.channels.length;f++)n=this.channels[f],h[n.sid]=n;k=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(l=this.transforms[f],n=h[l.sid],n!==void 0){for(var o=n.sampler,u,n=0;n<o.input.length-1;n++)if(o.input[n+1]>b){u=o.output[n];break}k=u!==void 0?u instanceof THREE.Matrix4?
|
|
|
-k.multiply(k,u):k.multiply(k,l.matrix):k.multiply(k,l.matrix)}else k=k.multiply(k,l.matrix);b=k;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};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)};w.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=T(a.textContent);this.updateMatrix();return this};
|
|
|
+1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var h={},n=f=void 0,f=0;f<this.channels.length;f++)n=this.channels[f],h[n.sid]=n;k=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(l=this.transforms[f],n=h[l.sid],n!==void 0){for(var o=n.sampler,p,n=0;n<o.input.length-1;n++)if(o.input[n+1]>b){p=o.output[n];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);b=k;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};u.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};w.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=T(a.textContent);this.updateMatrix();return this};
|
|
|
w.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};v.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ja.evaluate(".//dae:instance_material",c,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
null))for(var e=c.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=c.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 b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=ja.evaluate(".//dae:instance_material",
|
|
|
-c,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new C(this)).parse(c)}}return this};C.prototype.parse=function(a){function b(a,c){var e=qa(a.position);h[e]===void 0&&(h[e]={v:a,index:c});return h[e]}this.primitives=[];var c;for(c=
|
|
|
-0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":Q(e);break;case "vertices":this.vertices=(new K).parse(e);break;case "triangles":this.primitives.push((new B).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new A).parse(e))}}var h={};this.geometry3js=new THREE.Geometry;e=$[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(e[c],e[c+
|
|
|
-1],e[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};C.prototype.handlePrimitive=function(a,b,c){var e=0,h,f,k=a.p,l=a.inputs,n,o,p,u=0,t=3,v=[];for(h=0;h<l.length;h++)switch(n=l[h],
|
|
|
+c,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new D(this)).parse(c)}}return this};D.prototype.parse=function(a){function b(a,c){var e=qa(a.position);h[e]===void 0&&(h[e]={v:a,index:c});return h[e]}this.primitives=[];var c;for(c=
|
|
|
+0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":Q(e);break;case "vertices":this.vertices=(new L).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 B).parse(e))}}var h={};this.geometry3js=new THREE.Geometry;e=$[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(e[c],e[c+
|
|
|
+1],e[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};D.prototype.handlePrimitive=function(a,b,c){var e=0,h,f,k=a.p,l=a.inputs,n,o,p,u=0,t=3,v=[];for(h=0;h<l.length;h++)switch(n=l[h],
|
|
|
n.semantic){case "TEXCOORD":v.push(n.set)}for(;e<k.length;){var w=[],x=[],y={},z=[];a.vcount&&(t=a.vcount[u++]);for(h=0;h<t;h++)for(f=0;f<l.length;f++)switch(n=l[f],source=$[n.source],o=k[e+h*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=qa(b.vertices[o].position);w.push(c[n].index);break;case "NORMAL":x.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":y[n.set]===void 0&&(y[n.set]=[]);y[n.set].push(new THREE.UV(source.data[p],
|
|
|
-source.data[p+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var A;t==3?A=new THREE.Face3(w[0],w[1],w[2],[x[0],x[1],x[2]],z.length?z:new THREE.Color):t==4&&(A=new THREE.Face4(w[0],w[1],w[2],w[3],[x[0],x[1],x[2],x[3]],z.length?z:new THREE.Color));A.daeMaterial=a.material;b.faces.push(A);for(f=0;f<v.length;f++)h=y[v[f]],b.faceVertexUvs[f].push([h[0],h[1],h[2]]);e+=l.length*t}};A.prototype=new B;A.prototype.constructor=A;B.prototype.setVertices=
|
|
|
-function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};B.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=pa(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new H).parse(a.childNodes[b]));break;case "vcount":this.vcount=J(c.textContent);break;case "p":this.p=J(c.textContent)}}return this};D.prototype.parse=
|
|
|
-function(a){this.params=[];this.source=a.getAttribute("source");this.count=pa(a,"count",0);this.stride=pa(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName=="input"&&(input=(new H).parse(a.childNodes[b]),this.input[input.semantic]=
|
|
|
-input);return this};H.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=pa(a,"set",-1);this.offset=pa(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 b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=ra(c.textContent),h=[],f=0;f<e.length;f++)h.push(e[f]=="true"||e[f]=="1"?
|
|
|
-!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=T(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=J(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ra(c.textContent);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[e]);break}}}return this};M.prototype.read=function(){var a=[],b=this.accessor.params[0];
|
|
|
+source.data[p+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var D;t==3?D=new THREE.Face3(w[0],w[1],w[2],[x[0],x[1],x[2]],z.length?z:new THREE.Color):t==4&&(D=new THREE.Face4(w[0],w[1],w[2],w[3],[x[0],x[1],x[2],x[3]],z.length?z:new THREE.Color));D.daeMaterial=a.material;b.faces.push(D);for(f=0;f<v.length;f++)h=y[v[f]],b.faceVertexUvs[f].push([h[0],h[1],h[2]]);e+=l.length*t}};B.prototype=new A;B.prototype.constructor=B;A.prototype.setVertices=
|
|
|
+function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};A.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=pa(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new G).parse(a.childNodes[b]));break;case "vcount":this.vcount=J(c.textContent);break;case "p":this.p=J(c.textContent)}}return this};C.prototype.parse=
|
|
|
+function(a){this.params=[];this.source=a.getAttribute("source");this.count=pa(a,"count",0);this.stride=pa(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};L.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName=="input"&&(input=(new G).parse(a.childNodes[b]),this.input[input.semantic]=
|
|
|
+input);return this};G.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=pa(a,"set",-1);this.offset=pa(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 b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=ra(c.textContent),h=[],f=0;f<e.length;f++)h.push(e[f]=="true"||e[f]=="1"?
|
|
|
+!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=T(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=J(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ra(c.textContent);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new C).parse(c.childNodes[e]);break}}}return this};M.prototype.read=function(){var a=[],b=this.accessor.params[0];
|
|
|
switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};V.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
|
|
|
-"instance_effect"){this.instance_effect=(new Y).parse(a.childNodes[b]);break}return this};L.prototype.isColor=function(){return this.texture==null};L.prototype.isTexture=function(){return this.texture!=null};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=T(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),
|
|
|
-this.texcoord=c.getAttribute("texcoord")}}return this};W.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new L).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=ja.evaluate(".//dae:float",c,aa,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[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};W.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof L)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=ga[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Ea+e.init_from),
|
|
|
+"instance_effect"){this.instance_effect=(new Y).parse(a.childNodes[b]);break}return this};K.prototype.isColor=function(){return this.texture==null};K.prototype.isTexture=function(){return this.texture!=null};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=T(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),
|
|
|
+this.texcoord=c.getAttribute("texcoord")}}return this};W.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new K).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=ja.evaluate(".//dae:float",c,aa,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[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};W.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof K)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=ga[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 c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=za;return this.material=new THREE.MeshLambertMaterial(a)};N.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=
|
|
|
c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};O.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;
|
|
|
break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};Z.prototype.create=function(){if(this.shader==null)return null};Z.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};Z.prototype.parseNewparam=
|
|
|
function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new N(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new O(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};Z.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
|
|
|
break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};Z.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new W(c.nodeName,this)).parse(c)}}};Y.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};P.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new M).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new U(this)).parse(c));break;case "channel":this.channel.push((new o(this)).parse(c))}}return this};o.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
|
|
|
-b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,h,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(e){h=a.split("(");a=h.shift();for(b=0;b<h.length;b++)h[b]=parseInt(h[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=h;this.member=f;return this};U.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new H).parse(c))}}return this};
|
|
|
+b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,h,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(e){h=a.split("(");a=h.shift();for(b=0;b<h.length;b++)h[b]=parseInt(h[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=h;this.member=f;return this};U.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new G).parse(c))}}return this};
|
|
|
U.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
|
|
|
Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
|
|
|
200))ca=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){za=a},applySkin:k,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;
|
|
|
THREE.JSONLoader.prototype.load=function(a,c,b){var e,k=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){k.createModel(a.data,c,b);k.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,k=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,k,n,u,t,p,w,v,z,x,y,C,A,B,D=a.faces;p=a.vertices;var K=a.normals,H=a.colors,M=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&M++;for(c=0;c<M;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];u=0;for(t=p.length;u<t;)w=new THREE.Vertex,w.position.x=p[u++]*b,w.position.y=
|
|
|
-p[u++]*b,w.position.z=p[u++]*b,e.vertices.push(w);u=0;for(t=D.length;u<t;){b=D[u++];p=b&1;n=b&2;c=b&4;k=b&8;v=b&16;w=b&32;x=b&64;b&=128;p?(y=new THREE.Face4,y.a=D[u++],y.b=D[u++],y.c=D[u++],y.d=D[u++],p=4):(y=new THREE.Face3,y.a=D[u++],y.b=D[u++],y.c=D[u++],p=3);if(n)n=D[u++],y.materialIndex=n;n=e.faces.length;if(c)for(c=0;c<M;c++)C=a.uvs[c],z=D[u++],B=C[z*2],z=C[z*2+1],e.faceUvs[c][n]=new THREE.UV(B,z);if(k)for(c=0;c<M;c++){C=a.uvs[c];A=[];for(k=0;k<p;k++)z=D[u++],B=C[z*2],z=C[z*2+1],A[k]=new THREE.UV(B,
|
|
|
-z);e.faceVertexUvs[c][n]=A}if(v)v=D[u++]*3,k=new THREE.Vector3,k.x=K[v++],k.y=K[v++],k.z=K[v],y.normal=k;if(w)for(c=0;c<p;c++)v=D[u++]*3,k=new THREE.Vector3,k.x=K[v++],k.y=K[v++],k.z=K[v],y.vertexNormals.push(k);if(x)w=D[u++],w=new THREE.Color(H[w]),y.color=w;if(b)for(c=0;c<p;c++)w=D[u++],w=new THREE.Color(H[w]),y.vertexColors.push(w);e.faces.push(y)}}})(k);(function(){var b,c,k,n;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)k=a.skinWeights[b],n=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(k,
|
|
|
-n,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)k=a.skinIndices[b],n=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(k,n,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,k,n,u,t,p,w,v,z;c=0;for(k=a.morphTargets.length;c<k;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];v=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;n=0;for(u=z.length;n<u;n+=3)t=z[n]*b,p=z[n+1]*
|
|
|
-b,w=z[n+2]*b,v.push(new THREE.Vertex(new THREE.Vector3(t,p,w)))}}if(a.morphColors!==void 0){c=0;for(k=a.morphColors.length;c<k;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];u=e.morphColors[c].colors;t=a.morphColors[c].colors;b=0;for(n=t.length;b<n;b+=3)p=new THREE.Color(16755200),p.setRGB(t[b],t[b+1],t[b+2]),u.push(p)}}})(k);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,k=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,k,n,p,t,u,w,v,z,x,y,D,B,A,C=a.faces;u=a.vertices;var L=a.normals,G=a.colors,M=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&M++;for(c=0;c<M;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];p=0;for(t=u.length;p<t;)w=new THREE.Vertex,w.position.x=u[p++]*b,w.position.y=
|
|
|
+u[p++]*b,w.position.z=u[p++]*b,e.vertices.push(w);p=0;for(t=C.length;p<t;){b=C[p++];u=b&1;n=b&2;c=b&4;k=b&8;v=b&16;w=b&32;x=b&64;b&=128;u?(y=new THREE.Face4,y.a=C[p++],y.b=C[p++],y.c=C[p++],y.d=C[p++],u=4):(y=new THREE.Face3,y.a=C[p++],y.b=C[p++],y.c=C[p++],u=3);if(n)n=C[p++],y.materialIndex=n;n=e.faces.length;if(c)for(c=0;c<M;c++)D=a.uvs[c],z=C[p++],A=D[z*2],z=D[z*2+1],e.faceUvs[c][n]=new THREE.UV(A,z);if(k)for(c=0;c<M;c++){D=a.uvs[c];B=[];for(k=0;k<u;k++)z=C[p++],A=D[z*2],z=D[z*2+1],B[k]=new THREE.UV(A,
|
|
|
+z);e.faceVertexUvs[c][n]=B}if(v)v=C[p++]*3,k=new THREE.Vector3,k.x=L[v++],k.y=L[v++],k.z=L[v],y.normal=k;if(w)for(c=0;c<u;c++)v=C[p++]*3,k=new THREE.Vector3,k.x=L[v++],k.y=L[v++],k.z=L[v],y.vertexNormals.push(k);if(x)w=C[p++],w=new THREE.Color(G[w]),y.color=w;if(b)for(c=0;c<u;c++)w=C[p++],w=new THREE.Color(G[w]),y.vertexColors.push(w);e.faces.push(y)}}})(k);(function(){var b,c,k,n;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)k=a.skinWeights[b],n=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(k,
|
|
|
+n,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)k=a.skinIndices[b],n=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(k,n,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,k,n,p,t,u,w,v,z;c=0;for(k=a.morphTargets.length;c<k;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];v=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;n=0;for(p=z.length;n<p;n+=3)t=z[n]*b,u=z[n+1]*
|
|
|
+b,w=z[n+2]*b,v.push(new THREE.Vertex(new THREE.Vector3(t,u,w)))}}if(a.morphColors!==void 0){c=0;for(k=a.morphColors.length;c<k;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];p=e.morphColors[c].colors;t=a.morphColors[c].colors;b=0;for(n=t.length;b<n;b+=3)u=new THREE.Color(16755200),u.setRGB(t[b],t[b+1],t[b+2]),p.push(u)}}})(k);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var k=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:k+"/"+a}function l(){for(v in O.objects)if(!Q.objects[v])if(A=O.objects[v],A.geometry!==void 0){if(H=Q.geometries[A.geometry]){var a=!1;for(T=0;T<A.materials.length;T++)W=Q.materials[A.materials[T]],a=W instanceof THREE.ShaderMaterial;a&&H.computeTangents();B=A.position;r=A.rotation;q=A.quaternion;
|
|
|
-s=A.scale;q=0;W.length==0&&(W=new THREE.MeshFaceMaterial);W.length>1&&(W=new THREE.MeshFaceMaterial);object=new THREE.Mesh(H,W);object.name=v;object.position.set(B[0],B[1],B[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=A.visible;Q.scene.add(object);Q.objects[v]=object;A.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(a));if(A.castsShadow)a=
|
|
|
-new THREE.ShadowVolume(H),Q.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;A.trigger&&A.trigger.toLowerCase()!="none"&&(a={type:A.trigger,object:A},Q.triggers[object.name]=a)}}else B=A.position,r=A.rotation,q=A.quaternion,s=A.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(B[0],B[1],B[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=
|
|
|
-A.visible!==void 0?A.visible:!1,Q.scene.add(object),Q.objects[v]=object,Q.empties[v]=object,A.trigger&&A.trigger.toLowerCase()!="none"&&(a={type:A.trigger,object:A},Q.triggers[object.name]=a)}function n(a){return function(c){Q.geometries[a]=c;l();Y-=1;b.onLoadComplete();t()}}function u(a){return function(b){Q.geometries[a]=b}}function t(){b.callbackProgress({totalModels:o,totalTextures:U,loadedModels:o-Y,loadedTextures:U-P},Q);b.onLoadProgress();Y==0&&P==0&&c(Q)}var p,w,v,z,x,y,C,A,B,D,K,H,M,V,L,
|
|
|
-W,N,O,Z,Y,P,o,U,Q;O=a.data;L=new THREE.BinaryLoader;Z=new THREE.JSONLoader;P=Y=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(v in O.objects)if(A=O.objects[v],A.meshCollider){a=!0;break}if(a)Q.scene.collisions=new THREE.CollisionSystem;if(O.transform){a=O.transform.position;D=O.transform.rotation;var aa=O.transform.scale;a&&Q.scene.position.set(a[0],a[1],a[2]);D&&Q.scene.rotation.set(D[0],D[1],D[2]);aa&&Q.scene.scale.set(aa[0],
|
|
|
-aa[1],aa[2]);(a||D||aa)&&Q.scene.updateMatrix()}a=function(){P-=1;t();b.onLoadComplete()};for(x in O.cameras)D=O.cameras[x],D.type=="perspective"?M=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):D.type=="ortho"&&(M=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far)),B=D.position,D=D.target,M.position.set(B[0],B[1],B[2]),M.target=new THREE.Vector3(D[0],D[1],D[2]),Q.cameras[x]=M;for(z in O.lights)x=O.lights[z],M=x.color!==void 0?x.color:16777215,D=x.intensity!==void 0?
|
|
|
-x.intensity:1,x.type=="directional"?(B=x.direction,N=new THREE.DirectionalLight(M,D),N.position.set(B[0],B[1],B[2]),N.position.normalize()):x.type=="point"?(B=x.position,d=x.distance,N=new THREE.PointLight(M,D,d),N.position.set(B[0],B[1],B[2])):x.type=="ambient"&&(N=new THREE.AmbientLight(M)),Q.scene.add(N),Q.lights[z]=N;for(y in O.fogs)z=O.fogs[y],z.type=="linear"?V=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(V=new THREE.FogExp2(0,z.density)),D=z.color,V.color.setRGB(D[0],D[1],D[2]),Q.fogs[y]=
|
|
|
-V;if(Q.cameras&&O.defaults.camera)Q.currentCamera=Q.cameras[O.defaults.camera];if(Q.fogs&&O.defaults.fog)Q.scene.fog=Q.fogs[O.defaults.fog];D=O.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(D[0],D[1],D[2]);Q.bgColorAlpha=O.defaults.bgalpha;for(p in O.geometries)if(y=O.geometries[p],y.type=="bin_mesh"||y.type=="ascii_mesh")Y+=1,b.onLoadStart();o=Y;for(p in O.geometries)y=O.geometries[p],y.type=="cube"?(H=new THREE.CubeGeometry(y.width,y.height,y.depth,y.segmentsWidth,y.segmentsHeight,
|
|
|
-y.segmentsDepth,null,y.flipped,y.sides),Q.geometries[p]=H):y.type=="plane"?(H=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),Q.geometries[p]=H):y.type=="sphere"?(H=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),Q.geometries[p]=H):y.type=="cylinder"?(H=new THREE.CylinderGeometry(y.topRad,y.botRad,y.height,y.radSegs,y.heightSegs),Q.geometries[p]=H):y.type=="torus"?(H=new THREE.TorusGeometry(y.radius,y.tube,y.segmentsR,y.segmentsT),Q.geometries[p]=H):
|
|
|
-y.type=="icosahedron"?(H=new THREE.IcosahedronGeometry(y.subdivisions),Q.geometries[p]=H):y.type=="bin_mesh"?L.load(e(y.url,O.urlBaseType),n(p)):y.type=="ascii_mesh"?Z.load(e(y.url,O.urlBaseType),n(p)):y.type=="embedded_mesh"&&(y=O.embeds[y.id])&&Z.createModel(y,u(p),"");for(C in O.textures)if(p=O.textures[C],p.url instanceof Array){P+=p.url.length;for(L=0;L<p.url.length;L++)b.onLoadStart()}else P+=1,b.onLoadStart();U=P;for(C in O.textures){p=O.textures[C];if(p.mapping!=void 0&&THREE[p.mapping]!=
|
|
|
-void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){L=[];for(var T=0;T<p.url.length;T++)L[T]=e(p.url[T],O.urlBaseType);L=THREE.ImageUtils.loadTextureCube(L,p.mapping,a)}else{L=THREE.ImageUtils.loadTexture(e(p.url,O.urlBaseType),p.mapping,a);if(THREE[p.minFilter]!=void 0)L.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)L.magFilter=THREE[p.magFilter];if(p.repeat){L.repeat.set(p.repeat[0],p.repeat[1]);if(p.repeat[0]!=1)L.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)L.wrapT=THREE.RepeatWrapping}p.offset&&
|
|
|
-L.offset.set(p.offset[0],p.offset[1]);if(p.wrap){Z={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Z[p.wrap[0]]!==void 0)L.wrapS=Z[p.wrap[0]];if(Z[p.wrap[1]]!==void 0)L.wrapT=Z[p.wrap[1]]}}Q.textures[C]=L}for(w in O.materials){C=O.materials[w];for(K in C.parameters)if(K=="envMap"||K=="map"||K=="lightMap")C.parameters[K]=Q.textures[C.parameters[K]];else if(K=="shading")C.parameters[K]=C.parameters[K]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(K=="blending")C.parameters[K]=
|
|
|
-THREE[C.parameters[K]]?THREE[C.parameters[K]]:THREE.NormalBlending;else if(K=="combine")C.parameters[K]=C.parameters[K]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(K=="vertexColors")if(C.parameters[K]=="face")C.parameters[K]=THREE.FaceColors;else if(C.parameters[K])C.parameters[K]=THREE.VertexColors;if(C.parameters.opacity!==void 0&&C.parameters.opacity<1)C.parameters.transparent=!0;if(C.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);
|
|
|
-L=C.parameters.color;Z=C.parameters.specular;y=C.parameters.ambient;V=C.parameters.shininess;a.tNormal.texture=Q.textures[C.parameters.normalMap];if(C.parameters.normalMapFactor)a.uNormalScale.value=C.parameters.normalMapFactor;if(C.parameters.map)a.tDiffuse.texture=C.parameters.map,a.enableDiffuse.value=!0;if(C.parameters.lightMap)a.tAO.texture=C.parameters.lightMap,a.enableAO.value=!0;if(C.parameters.specularMap)a.tSpecular.texture=Q.textures[C.parameters.specularMap],a.enableSpecular.value=!0;
|
|
|
-a.uDiffuseColor.value.setHex(L);a.uSpecularColor.value.setHex(Z);a.uAmbientColor.value.setHex(y);a.uShininess.value=V;if(C.parameters.opacity)a.uOpacity.value=C.parameters.opacity;C=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})}else C=new THREE[C.type](C.parameters);Q.materials[w]=C}l();b.callbackSync(Q);t()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
|
|
|
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var k=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:k+"/"+a}function l(){for(v in O.objects)if(!Q.objects[v])if(B=O.objects[v],B.geometry!==void 0){if(G=Q.geometries[B.geometry]){var a=!1;for(T=0;T<B.materials.length;T++)W=Q.materials[B.materials[T]],a=W instanceof THREE.ShaderMaterial;a&&G.computeTangents();A=B.position;r=B.rotation;q=B.quaternion;
|
|
|
+s=B.scale;q=0;W.length==0&&(W=new THREE.MeshFaceMaterial);W.length>1&&(W=new THREE.MeshFaceMaterial);object=new THREE.Mesh(G,W);object.name=v;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=B.visible;Q.scene.add(object);Q.objects[v]=object;B.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(a));if(B.castsShadow)a=
|
|
|
+new THREE.ShadowVolume(G),Q.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;B.trigger&&B.trigger.toLowerCase()!="none"&&(a={type:B.trigger,object:B},Q.triggers[object.name]=a)}}else A=B.position,r=B.rotation,q=B.quaternion,s=B.scale,q=0,object=new THREE.Object3D,object.name=v,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=
|
|
|
+B.visible!==void 0?B.visible:!1,Q.scene.add(object),Q.objects[v]=object,Q.empties[v]=object,B.trigger&&B.trigger.toLowerCase()!="none"&&(a={type:B.trigger,object:B},Q.triggers[object.name]=a)}function n(a){return function(c){Q.geometries[a]=c;l();Y-=1;b.onLoadComplete();t()}}function p(a){return function(b){Q.geometries[a]=b}}function t(){b.callbackProgress({totalModels:o,totalTextures:U,loadedModels:o-Y,loadedTextures:U-P},Q);b.onLoadProgress();Y==0&&P==0&&c(Q)}var u,w,v,z,x,y,D,B,A,C,L,G,M,V,K,
|
|
|
+W,N,O,Z,Y,P,o,U,Q;O=a.data;K=new THREE.BinaryLoader;Z=new THREE.JSONLoader;P=Y=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(v in O.objects)if(B=O.objects[v],B.meshCollider){a=!0;break}if(a)Q.scene.collisions=new THREE.CollisionSystem;if(O.transform){a=O.transform.position;C=O.transform.rotation;var aa=O.transform.scale;a&&Q.scene.position.set(a[0],a[1],a[2]);C&&Q.scene.rotation.set(C[0],C[1],C[2]);aa&&Q.scene.scale.set(aa[0],
|
|
|
+aa[1],aa[2]);(a||C||aa)&&Q.scene.updateMatrix()}a=function(){P-=1;t();b.onLoadComplete()};for(x in O.cameras)C=O.cameras[x],C.type=="perspective"?M=new THREE.PerspectiveCamera(C.fov,C.aspect,C.near,C.far):C.type=="ortho"&&(M=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far)),A=C.position,C=C.target,M.position.set(A[0],A[1],A[2]),M.target=new THREE.Vector3(C[0],C[1],C[2]),Q.cameras[x]=M;for(z in O.lights)x=O.lights[z],M=x.color!==void 0?x.color:16777215,C=x.intensity!==void 0?
|
|
|
+x.intensity:1,x.type=="directional"?(A=x.direction,N=new THREE.DirectionalLight(M,C),N.position.set(A[0],A[1],A[2]),N.position.normalize()):x.type=="point"?(A=x.position,d=x.distance,N=new THREE.PointLight(M,C,d),N.position.set(A[0],A[1],A[2])):x.type=="ambient"&&(N=new THREE.AmbientLight(M)),Q.scene.add(N),Q.lights[z]=N;for(y in O.fogs)z=O.fogs[y],z.type=="linear"?V=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(V=new THREE.FogExp2(0,z.density)),C=z.color,V.color.setRGB(C[0],C[1],C[2]),Q.fogs[y]=
|
|
|
+V;if(Q.cameras&&O.defaults.camera)Q.currentCamera=Q.cameras[O.defaults.camera];if(Q.fogs&&O.defaults.fog)Q.scene.fog=Q.fogs[O.defaults.fog];C=O.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(C[0],C[1],C[2]);Q.bgColorAlpha=O.defaults.bgalpha;for(u in O.geometries)if(y=O.geometries[u],y.type=="bin_mesh"||y.type=="ascii_mesh")Y+=1,b.onLoadStart();o=Y;for(u in O.geometries)y=O.geometries[u],y.type=="cube"?(G=new THREE.CubeGeometry(y.width,y.height,y.depth,y.segmentsWidth,y.segmentsHeight,
|
|
|
+y.segmentsDepth,null,y.flipped,y.sides),Q.geometries[u]=G):y.type=="plane"?(G=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),Q.geometries[u]=G):y.type=="sphere"?(G=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),Q.geometries[u]=G):y.type=="cylinder"?(G=new THREE.CylinderGeometry(y.topRad,y.botRad,y.height,y.radSegs,y.heightSegs),Q.geometries[u]=G):y.type=="torus"?(G=new THREE.TorusGeometry(y.radius,y.tube,y.segmentsR,y.segmentsT),Q.geometries[u]=G):
|
|
|
+y.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(y.subdivisions),Q.geometries[u]=G):y.type=="bin_mesh"?K.load(e(y.url,O.urlBaseType),n(u)):y.type=="ascii_mesh"?Z.load(e(y.url,O.urlBaseType),n(u)):y.type=="embedded_mesh"&&(y=O.embeds[y.id])&&Z.createModel(y,p(u),"");for(D in O.textures)if(u=O.textures[D],u.url instanceof Array){P+=u.url.length;for(K=0;K<u.url.length;K++)b.onLoadStart()}else P+=1,b.onLoadStart();U=P;for(D in O.textures){u=O.textures[D];if(u.mapping!=void 0&&THREE[u.mapping]!=
|
|
|
+void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){K=[];for(var T=0;T<u.url.length;T++)K[T]=e(u.url[T],O.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,u.mapping,a)}else{K=THREE.ImageUtils.loadTexture(e(u.url,O.urlBaseType),u.mapping,a);if(THREE[u.minFilter]!=void 0)K.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)K.magFilter=THREE[u.magFilter];if(u.repeat){K.repeat.set(u.repeat[0],u.repeat[1]);if(u.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}u.offset&&
|
|
|
+K.offset.set(u.offset[0],u.offset[1]);if(u.wrap){Z={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Z[u.wrap[0]]!==void 0)K.wrapS=Z[u.wrap[0]];if(Z[u.wrap[1]]!==void 0)K.wrapT=Z[u.wrap[1]]}}Q.textures[D]=K}for(w in O.materials){D=O.materials[w];for(L in D.parameters)if(L=="envMap"||L=="map"||L=="lightMap")D.parameters[L]=Q.textures[D.parameters[L]];else if(L=="shading")D.parameters[L]=D.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")D.parameters[L]=
|
|
|
+THREE[D.parameters[L]]?THREE[D.parameters[L]]:THREE.NormalBlending;else if(L=="combine")D.parameters[L]=D.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(D.parameters[L]=="face")D.parameters[L]=THREE.FaceColors;else if(D.parameters[L])D.parameters[L]=THREE.VertexColors;if(D.parameters.opacity!==void 0&&D.parameters.opacity<1)D.parameters.transparent=!0;if(D.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(u.uniforms);
|
|
|
+K=D.parameters.color;Z=D.parameters.specular;y=D.parameters.ambient;V=D.parameters.shininess;a.tNormal.texture=Q.textures[D.parameters.normalMap];if(D.parameters.normalMapFactor)a.uNormalScale.value=D.parameters.normalMapFactor;if(D.parameters.map)a.tDiffuse.texture=D.parameters.map,a.enableDiffuse.value=!0;if(D.parameters.lightMap)a.tAO.texture=D.parameters.lightMap,a.enableAO.value=!0;if(D.parameters.specularMap)a.tSpecular.texture=Q.textures[D.parameters.specularMap],a.enableSpecular.value=!0;
|
|
|
+a.uDiffuseColor.value.setHex(K);a.uSpecularColor.value.setHex(Z);a.uAmbientColor.value.setHex(y);a.uShininess.value=V;if(D.parameters.opacity)a.uOpacity.value=D.parameters.opacity;D=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:a,lights:!0,fog:!0})}else D=new THREE[D.type](D.parameters);Q.materials[w]=D}l();b.callbackSync(Q);t()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,k=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,l=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
|
|
|
c,k,h,f,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 c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,k=0;k<8;k++){for(var h=0,f=0;f<c;++f){var l=a.charCodeAt(f+e);h+=l>>1^-(l&1);b[8*f+k]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(k=f=0;k<c;k++)l=a.charCodeAt(k+e),h[k]=f-l,l==0&&f++;return[b,h]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,k,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),u=[],t=[];(function(a,f,n){for(var u,t,y,C=a.length;n<C;n+=f)u=a[n],t=a[n+1],y=a[n+2],u=u/16383*b,t=t/16383*b,y=y/16383*b,u+=e,t+=k,y+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,t,y)))})(f[0],8,0);(function(a,b,c){for(var e,f,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,t.push(e,1-f)})(f[0],8,3);(function(a,
|
|
|
-b,c){for(var e,f,h,k=a.length;c<k;c+=b)e=a[c],f=a[c+1],h=a[c+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,u.push(e,f,h)})(f[0],8,5);(function(a){var b,e,f,h,k,n,A,B,D,K=a.length;for(b=0;b<K;b+=3){e=a[b];f=a[b+1];h=a[b+2];k=c;B=e;D=f;n=h;A=e;var H=f,M=h,V=k.materials[0],L=u[H*3],W=u[H*3+1],H=u[H*3+2],N=u[M*3],O=u[M*3+1],M=u[M*3+2];A=new THREE.Vector3(u[A*3],u[A*3+1],u[A*3+2]);H=new THREE.Vector3(L,W,H);M=new THREE.Vector3(N,O,M);k.faces.push(new THREE.Face3(B,D,n,[A,H,M],null,V));k=t[e*2];e=t[e*2+
|
|
|
-1];n=t[f*2];A=t[f*2+1];B=t[h*2];D=t[h*2+1];h=c.faceVertexUvs[0];f=n;n=A;A=[];A.push(new THREE.UV(k,e));A.push(new THREE.UV(f,n));A.push(new THREE.UV(B,D));h.push(A)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,k,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),p=[],t=[];(function(a,f,n){for(var p,t,y,D=a.length;n<D;n+=f)p=a[n],t=a[n+1],y=a[n+2],p=p/16383*b,t=t/16383*b,y=y/16383*b,p+=e,t+=k,y+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,t,y)))})(f[0],8,0);(function(a,b,c){for(var e,f,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,t.push(e,1-f)})(f[0],8,3);(function(a,
|
|
|
+b,c){for(var e,f,h,k=a.length;c<k;c+=b)e=a[c],f=a[c+1],h=a[c+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,p.push(e,f,h)})(f[0],8,5);(function(a){var b,e,f,h,k,n,B,A,C,L=a.length;for(b=0;b<L;b+=3){e=a[b];f=a[b+1];h=a[b+2];k=c;A=e;C=f;n=h;B=e;var G=f,M=h,V=k.materials[0],K=p[G*3],W=p[G*3+1],G=p[G*3+2],N=p[M*3],O=p[M*3+1],M=p[M*3+2];B=new THREE.Vector3(p[B*3],p[B*3+1],p[B*3+2]);G=new THREE.Vector3(K,W,G);M=new THREE.Vector3(N,O,M);k.faces.push(new THREE.Face3(A,C,n,[B,G,M],null,V));k=t[e*2];e=t[e*2+
|
|
|
+1];n=t[f*2];B=t[f*2+1];A=t[h*2];C=t[h*2+1];h=c.faceVertexUvs[0];f=n;n=B;B=[];B.push(new THREE.UV(k,e));B.push(new THREE.UV(f,n));B.push(new THREE.UV(A,C));h.push(B)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
|
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
|
|
|
b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];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,c,k){return a+(c-a)*k};this.VIntX=function(a,c,k,h,f,l,n,u,t,p){f=(f-t)/(p-t);t=this.normal_cache;c[h]=l+f*this.delta;c[h+1]=n;c[h+2]=u;k[h]=this.lerp(t[a],t[a+3],f);k[h+1]=this.lerp(t[a+1],t[a+4],f);k[h+2]=this.lerp(t[a+2],t[a+5],f)};this.VIntY=function(a,c,k,h,f,l,n,u,t,p){f=(f-t)/(p-t);t=this.normal_cache;c[h]=l;c[h+1]=n+f*this.delta;c[h+
|
|
|
-2]=u;c=a+this.yd*3;k[h]=this.lerp(t[a],t[c],f);k[h+1]=this.lerp(t[a+1],t[c+1],f);k[h+2]=this.lerp(t[a+2],t[c+2],f)};this.VIntZ=function(a,c,k,h,f,l,n,u,t,p){f=(f-t)/(p-t);t=this.normal_cache;c[h]=l;c[h+1]=n;c[h+2]=u+f*this.delta;c=a+this.zd*3;k[h]=this.lerp(t[a],t[c],f);k[h+1]=this.lerp(t[a+1],t[c+1],f);k[h+2]=this.lerp(t[a+2],t[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
|
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,k,h,f,l){var n=h+1,u=h+this.yd,t=h+this.zd,p=n+this.yd,w=n+this.zd,v=h+this.yd+this.zd,z=n+this.yd+this.zd,x=0,y=this.field[h],C=this.field[n],A=this.field[u],B=this.field[p],D=this.field[t],K=this.field[w],H=this.field[v],M=this.field[z];y<f&&(x|=1);C<f&&(x|=2);A<f&&(x|=8);B<f&&(x|=4);D<f&&(x|=16);K<f&&(x|=32);H<f&&(x|=128);M<f&&(x|=64);var V=THREE.edgeTable[x];if(V===0)return 0;
|
|
|
-var L=this.delta,W=a+L,N=c+L,L=k+L;V&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,k,y,C));V&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,f,W,c,k,C,B));V&4&&(this.compNorm(u),this.compNorm(p),this.VIntX(u*3,this.vlist,this.nlist,6,f,a,N,k,A,B));V&8&&(this.compNorm(h),this.compNorm(u),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,k,y,A));V&16&&(this.compNorm(t),this.compNorm(w),this.VIntX(t*3,this.vlist,this.nlist,12,f,a,c,L,D,K));
|
|
|
-V&32&&(this.compNorm(w),this.compNorm(z),this.VIntY(w*3,this.vlist,this.nlist,15,f,W,c,L,K,M));V&64&&(this.compNorm(v),this.compNorm(z),this.VIntX(v*3,this.vlist,this.nlist,18,f,a,N,L,H,M));V&128&&(this.compNorm(t),this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,21,f,a,c,L,D,H));V&256&&(this.compNorm(h),this.compNorm(t),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,k,y,D));V&512&&(this.compNorm(n),this.compNorm(w),this.VIntZ(n*3,this.vlist,this.nlist,27,f,W,c,k,C,K));V&1024&&(this.compNorm(p),
|
|
|
-this.compNorm(z),this.VIntZ(p*3,this.vlist,this.nlist,30,f,W,N,k,B,M));V&2048&&(this.compNorm(u),this.compNorm(v),this.VIntZ(u*3,this.vlist,this.nlist,33,f,a,N,k,A,H));x<<=4;for(f=h=0;THREE.triTable[x+f]!=-1;)a=x+f,c=a+1,k=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[k],l),f+=3,h++;return h};this.posnormtriv=function(a,c,k,h,f,l){var n=this.count*3;this.positionArray[n]=a[k];this.positionArray[n+1]=a[k+1];this.positionArray[n+2]=a[k+2];this.positionArray[n+
|
|
|
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,k){return a+(c-a)*k};this.VIntX=function(a,c,k,h,f,l,n,p,t,u){f=(f-t)/(u-t);t=this.normal_cache;c[h]=l+f*this.delta;c[h+1]=n;c[h+2]=p;k[h]=this.lerp(t[a],t[a+3],f);k[h+1]=this.lerp(t[a+1],t[a+4],f);k[h+2]=this.lerp(t[a+2],t[a+5],f)};this.VIntY=function(a,c,k,h,f,l,n,p,t,u){f=(f-t)/(u-t);t=this.normal_cache;c[h]=l;c[h+1]=n+f*this.delta;c[h+
|
|
|
+2]=p;c=a+this.yd*3;k[h]=this.lerp(t[a],t[c],f);k[h+1]=this.lerp(t[a+1],t[c+1],f);k[h+2]=this.lerp(t[a+2],t[c+2],f)};this.VIntZ=function(a,c,k,h,f,l,n,p,t,u){f=(f-t)/(u-t);t=this.normal_cache;c[h]=l;c[h+1]=n;c[h+2]=p+f*this.delta;c=a+this.zd*3;k[h]=this.lerp(t[a],t[c],f);k[h+1]=this.lerp(t[a+1],t[c+1],f);k[h+2]=this.lerp(t[a+2],t[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
|
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,k,h,f,l){var n=h+1,p=h+this.yd,t=h+this.zd,u=n+this.yd,w=n+this.zd,v=h+this.yd+this.zd,z=n+this.yd+this.zd,x=0,y=this.field[h],D=this.field[n],B=this.field[p],A=this.field[u],C=this.field[t],L=this.field[w],G=this.field[v],M=this.field[z];y<f&&(x|=1);D<f&&(x|=2);B<f&&(x|=8);A<f&&(x|=4);C<f&&(x|=16);L<f&&(x|=32);G<f&&(x|=128);M<f&&(x|=64);var V=THREE.edgeTable[x];if(V===0)return 0;
|
|
|
+var K=this.delta,W=a+K,N=c+K,K=k+K;V&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,k,y,D));V&2&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,3,f,W,c,k,D,A));V&4&&(this.compNorm(p),this.compNorm(u),this.VIntX(p*3,this.vlist,this.nlist,6,f,a,N,k,B,A));V&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,k,y,B));V&16&&(this.compNorm(t),this.compNorm(w),this.VIntX(t*3,this.vlist,this.nlist,12,f,a,c,K,C,L));
|
|
|
+V&32&&(this.compNorm(w),this.compNorm(z),this.VIntY(w*3,this.vlist,this.nlist,15,f,W,c,K,L,M));V&64&&(this.compNorm(v),this.compNorm(z),this.VIntX(v*3,this.vlist,this.nlist,18,f,a,N,K,G,M));V&128&&(this.compNorm(t),this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,21,f,a,c,K,C,G));V&256&&(this.compNorm(h),this.compNorm(t),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,k,y,C));V&512&&(this.compNorm(n),this.compNorm(w),this.VIntZ(n*3,this.vlist,this.nlist,27,f,W,c,k,D,L));V&1024&&(this.compNorm(u),
|
|
|
+this.compNorm(z),this.VIntZ(u*3,this.vlist,this.nlist,30,f,W,N,k,A,M));V&2048&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,33,f,a,N,k,B,G));x<<=4;for(f=h=0;THREE.triTable[x+f]!=-1;)a=x+f,c=a+1,k=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[k],l),f+=3,h++;return h};this.posnormtriv=function(a,c,k,h,f,l){var n=this.count*3;this.positionArray[n]=a[k];this.positionArray[n+1]=a[k+1];this.positionArray[n+2]=a[k+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[f];this.positionArray[n+7]=a[f+1];this.positionArray[n+8]=a[f+2];this.normalArray[n]=c[k];this.normalArray[n+1]=c[k+1];this.normalArray[n+2]=c[k+2];this.normalArray[n+3]=c[h];this.normalArray[n+4]=c[h+1];this.normalArray[n+5]=c[h+2];this.normalArray[n+6]=c[f];this.normalArray[n+7]=c[f+1];this.normalArray[n+8]=c[f+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 c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,k,h,f){var l=this.size*Math.sqrt(h/f),n=k*this.size,u=c*this.size,t=a*this.size,p=Math.floor(n-l);p<1&&(p=1);n=Math.floor(n+l);n>this.size-1&&(n=this.size-1);var w=Math.floor(u-l);w<1&&(w=1);u=Math.floor(u+l);u>this.size-1&&(u=this.size-1);var v=Math.floor(t-l);v<1&&(v=1);l=Math.floor(t+l);
|
|
|
-l>this.size-1&&(l=this.size-1);for(var z,x,y,C,A,B;p<n;p++){t=this.size2*p;x=p/this.size-k;A=x*x;for(x=w;x<u;x++){y=t+this.size*x;z=x/this.size-c;B=z*z;for(z=v;z<l;z++)C=z/this.size-a,C=h/(1.0E-6+C*C+B+A)-f,C>0&&(this.field[y+z]+=C)}}};this.addPlaneX=function(a,c){var k,h,f,l,n,u=this.size,t=this.yd,p=this.zd,w=this.field,v=u*Math.sqrt(a/c);v>u&&(v=u);for(k=0;k<v;k++)if(h=k/u,h*=h,l=a/(1.0E-4+h)-c,l>0)for(h=0;h<u;h++){n=k+h*t;for(f=0;f<u;f++)w[p*f+n]+=l}};this.addPlaneY=function(a,c){var k,h,f,l,
|
|
|
-n,u,t=this.size,p=this.yd,w=this.zd,v=this.field,z=t*Math.sqrt(a/c);z>t&&(z=t);for(h=0;h<z;h++)if(k=h/t,k*=k,l=a/(1.0E-4+k)-c,l>0){n=h*p;for(k=0;k<t;k++){u=n+k;for(f=0;f<t;f++)v[w*f+u]+=l}}};this.addPlaneZ=function(a,c){var k,h,f,l,n,u;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(k=f/size,k*=k,l=a/(1.0E-4+k)-c,l>0){n=zd*f;for(h=0;h<size;h++){u=n+h*yd;for(k=0;k<size;k++)field[u+k]+=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 c,k,h,f,l,n,u,t,p,w=this.size-2;for(f=1;f<w;f++){p=this.size2*f;u=(f-this.halfsize)/this.halfsize;for(h=1;h<w;h++){t=p+this.size*h;n=(h-this.halfsize)/this.halfsize;for(k=1;k<w;k++)l=(k-this.halfsize)/this.halfsize,c=t+k,this.polygonize(l,n,u,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,k=[];this.render(function(h){var f,l,n,u,t,p,w,v;for(f=0;f<h.count;f++)w=
|
|
|
-f*3,t=w+1,v=w+2,l=h.positionArray[w],n=h.positionArray[t],u=h.positionArray[v],p=new THREE.Vector3(l,n,u),l=h.normalArray[w],n=h.normalArray[t],u=h.normalArray[v],w=new THREE.Vector3(l,n,u),w.normalize(),t=new THREE.Vertex(p),c.vertices.push(t),k.push(w);nfaces=h.count/3;for(f=0;f<nfaces;f++)w=(a+f)*3,t=w+1,v=w+2,p=k[w],l=k[t],n=k[v],w=new THREE.Face3(w,t,v,[p,l,n]),c.faces.push(w);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
|
|
|
+function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,k,h,f){var l=this.size*Math.sqrt(h/f),n=k*this.size,p=c*this.size,t=a*this.size,u=Math.floor(n-l);u<1&&(u=1);n=Math.floor(n+l);n>this.size-1&&(n=this.size-1);var w=Math.floor(p-l);w<1&&(w=1);p=Math.floor(p+l);p>this.size-1&&(p=this.size-1);var v=Math.floor(t-l);v<1&&(v=1);l=Math.floor(t+l);
|
|
|
+l>this.size-1&&(l=this.size-1);for(var z,x,y,D,B,A;u<n;u++){t=this.size2*u;x=u/this.size-k;B=x*x;for(x=w;x<p;x++){y=t+this.size*x;z=x/this.size-c;A=z*z;for(z=v;z<l;z++)D=z/this.size-a,D=h/(1.0E-6+D*D+A+B)-f,D>0&&(this.field[y+z]+=D)}}};this.addPlaneX=function(a,c){var k,h,f,l,n,p=this.size,t=this.yd,u=this.zd,w=this.field,v=p*Math.sqrt(a/c);v>p&&(v=p);for(k=0;k<v;k++)if(h=k/p,h*=h,l=a/(1.0E-4+h)-c,l>0)for(h=0;h<p;h++){n=k+h*t;for(f=0;f<p;f++)w[u*f+n]+=l}};this.addPlaneY=function(a,c){var k,h,f,l,
|
|
|
+n,p,t=this.size,u=this.yd,w=this.zd,v=this.field,z=t*Math.sqrt(a/c);z>t&&(z=t);for(h=0;h<z;h++)if(k=h/t,k*=k,l=a/(1.0E-4+k)-c,l>0){n=h*u;for(k=0;k<t;k++){p=n+k;for(f=0;f<t;f++)v[w*f+p]+=l}}};this.addPlaneZ=function(a,c){var k,h,f,l,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(k=f/size,k*=k,l=a/(1.0E-4+k)-c,l>0){n=zd*f;for(h=0;h<size;h++){p=n+h*yd;for(k=0;k<size;k++)field[p+k]+=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 c,k,h,f,l,n,p,t,u,w=this.size-2;for(f=1;f<w;f++){u=this.size2*f;p=(f-this.halfsize)/this.halfsize;for(h=1;h<w;h++){t=u+this.size*h;n=(h-this.halfsize)/this.halfsize;for(k=1;k<w;k++)l=(k-this.halfsize)/this.halfsize,c=t+k,this.polygonize(l,n,p,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,k=[];this.render(function(h){var f,l,n,p,t,u,w,v;for(f=0;f<h.count;f++)w=
|
|
|
+f*3,t=w+1,v=w+2,l=h.positionArray[w],n=h.positionArray[t],p=h.positionArray[v],u=new THREE.Vector3(l,n,p),l=h.normalArray[w],n=h.normalArray[t],p=h.normalArray[v],w=new THREE.Vector3(l,n,p),w.normalize(),t=new THREE.Vertex(u),c.vertices.push(t),k.push(w);nfaces=h.count/3;for(f=0;f<nfaces;f++)w=(a+f)*3,t=w+1,v=w+2,u=k[w],l=k[t],n=k[v],w=new THREE.Face3(w,t,v,[u,l,n]),c.faces.push(w);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
|
|
|
THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
@@ -689,20 +689,20 @@ THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.
|
|
|
THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,k,h=0;c=0;for(b=this.colliders.length;c<b;c++)if(k=this.colliders[c],e=this.rayCast(a,k),e<Number.MAX_VALUE)k.distance=e,e>h?this.hits.push(k):this.hits.unshift(k),h=e;return this.hits};
|
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.dist<Number.MAX_VALUE){c[b].distance=e.dist;c[b].faceIndex=e.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
|
|
|
THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
|
|
|
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,k,h=0;h<c.numFaces;h++){var f=c.mesh.geometry.faces[h],l=c.mesh.geometry.vertices[f.a].position,n=c.mesh.geometry.vertices[f.b].position,u=c.mesh.geometry.vertices[f.c].position,t=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,l,n,u,e,this.collisionNormal,c.mesh),f<e&&(e=f,k=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
-f instanceof THREE.Face4&&(f=this.rayTriangle(b,l,n,t,e,this.collisionNormal,c.mesh),f<e&&(e=f,k=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,n,u,t,e,this.collisionNormal,c.mesh),f<e&&(e=f,k=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:k}};
|
|
|
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,k,h=0;h<c.numFaces;h++){var f=c.mesh.geometry.faces[h],l=c.mesh.geometry.vertices[f.a].position,n=c.mesh.geometry.vertices[f.b].position,p=c.mesh.geometry.vertices[f.c].position,t=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,l,n,p,e,this.collisionNormal,c.mesh),f<e&&(e=f,k=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
+f instanceof THREE.Face4&&(f=this.rayTriangle(b,l,n,t,e,this.collisionNormal,c.mesh),f<e&&(e=f,k=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,n,p,t,e,this.collisionNormal,c.mesh),f<e&&(e=f,k=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:k}};
|
|
|
THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,k,h,f){var l=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;h.set(0,0,0);l.sub(b,c);n.sub(e,b);h.cross(l,n);l=h.dot(a.direction);if(!(l<0))if(f.doubleSided||f.flipSided)h.multiplyScalar(-1),l*=-1;else return Number.MAX_VALUE;f=h.dot(c)-h.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=l*k))return Number.MAX_VALUE;f/=l;l=THREE.CollisionSystem.__v3;l.copy(a.direction);l.multiplyScalar(f);l.addSelf(a.origin);Math.abs(h.x)>
|
|
|
Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=l.y-c.y,h=b.y-c.y,k=e.y-c.y,l=l.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=l.x-c.x,h=b.x-c.x,k=e.x-c.x,l=l.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(a=l.x-c.x,h=b.x-c.x,k=e.x-c.x,l=l.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=l.x-c.x,h=b.x-c.x,k=e.x-c.x,l=l.y-c.y,b=b.y-c.y,e=e.y-c.y);c=h*e-b*k;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-l*k)*c;if(!(e>=0))return Number.MAX_VALUE;c*=h*l-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return f};
|
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,b);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
|
|
|
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,k=0,h=0,f=0,l=0,n=0,u=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,u=!1,f=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,u=!1,f=1);b.origin.y<c.min.y?(k=c.min.y-b.origin.y,k/=b.direction.y,u=!1,l=-1):b.origin.y>c.max.y&&(k=c.max.y-b.origin.y,k/=b.direction.y,
|
|
|
-u=!1,l=1);b.origin.z<c.min.z?(h=c.min.z-b.origin.z,h/=b.direction.z,u=!1,n=-1):b.origin.z>c.max.z&&(h=c.max.z-b.origin.z,h/=b.direction.z,u=!1,n=1);if(u)return-1;u=0;k>e&&(u=1,e=k);h>e&&(u=2,e=h);switch(u){case 0:l=b.origin.y+b.direction.y*e;if(l<c.min.y||l>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
|
|
|
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,k=0,h=0,f=0,l=0,n=0,p=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,p=!1,f=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,p=!1,f=1);b.origin.y<c.min.y?(k=c.min.y-b.origin.y,k/=b.direction.y,p=!1,l=-1):b.origin.y>c.max.y&&(k=c.max.y-b.origin.y,k/=b.direction.y,
|
|
|
+p=!1,l=1);b.origin.z<c.min.z?(h=c.min.z-b.origin.z,h/=b.direction.z,p=!1,n=-1):b.origin.z>c.max.z&&(h=c.max.z-b.origin.z,h/=b.direction.z,p=!1,n=1);if(p)return-1;p=0;k>e&&(p=1,e=k);h>e&&(p=2,e=h);switch(p){case 0:l=b.origin.y+b.direction.y*e;if(l<c.min.y||l>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
|
|
|
e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,l,0);break;case 2:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;l=b.origin.y+b.direction.y*e;if(l<c.min.y||l>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
|
|
|
THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);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 c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
|
|
|
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 c=this,b=this.setSize,e=this.render,k=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,f=new THREE.Matrix4,l=new THREE.Matrix4,n,u,t;k.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),w=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.PerspectiveCamera(53,1,1,1E4);v.position.z=
|
|
|
-2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:w}},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){b.call(c,a,e);p.width=a;p.height=e;w.width=a;w.height=e};this.render=function(a,b){if(n!==b.aspect||u!==b.near||t!==b.fov){n=b.aspect;u=b.near;t=b.fov;var C=b.projectionMatrix.clone(),A=125/30*0.5,B=A*u/125,D=u*Math.tan(t*Math.PI/360),K;f.n14=A;l.n14=-A;A=-D*n+B;K=D*n+B;C.n11=2*u/(K-A);C.n13=(K+A)/(K-A);k.projectionMatrix=C.clone();A=-D*n-B;K=D*n-B;C.n11=2*u/(K-A);C.n13=(K+A)/(K-A);h.projectionMatrix=
|
|
|
-C.clone()}k.matrix=b.matrixWorld.clone().multiplySelf(l);k.position.copy(b.position);k.near=u;k.far=b.far;e.call(c,a,k,p,!0);h.matrix=b.matrixWorld.clone().multiplySelf(f);h.position.copy(b.position);h.near=u;h.far=b.far;e.call(c,a,h,w,!0);e.call(c,z,v)}};
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,k=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,f=new THREE.Matrix4,l=new THREE.Matrix4,n,p,t,u;k.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},w=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.WebGLRenderTarget(512,512,a),z=new THREE.PerspectiveCamera(53,
|
|
|
+1,1,1E4);z.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:w},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 x=new THREE.Scene;x.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));x.add(z);this.setSize=function(a,e){b.call(c,a,e);w.width=a;w.height=e;v.width=a;v.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||p!==b.near||t!==b.far||u!==b.fov){n=b.aspect;p=b.near;t=b.far;u=b.fov;var B=b.projectionMatrix.clone(),A=125/30*0.5,C=A*p/125,L=p*Math.tan(u*Math.PI/360),G;f.n14=A;l.n14=-A;A=-L*n+C;G=L*n+C;B.n11=2*p/(G-A);B.n13=(G+A)/(G-A);k.projectionMatrix.copy(B);A=-L*n-C;
|
|
|
+G=L*n-C;B.n11=2*p/(G-A);B.n13=(G+A)/(G-A);h.projectionMatrix.copy(B)}k.matrixWorld.copy(b.matrixWorld).multiplySelf(l);k.position.copy(b.position);k.near=b.near;k.far=b.far;e.call(c,a,k,w,!0);h.matrixWorld.copy(b.matrixWorld).multiplySelf(f);h.position.copy(b.position);h.near=b.near;h.far=b.far;e.call(c,a,h,v,!0);x.updateMatrixWorld();e.call(c,x,z)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,k,h,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var l=new THREE.PerspectiveCamera;l.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);k=a/2;h=e};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
|
|
|
b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);l.projectionMatrix=f.projectionMatrix;l.position.copy(b.position);l.target.copy(b.target);l.translateX(-c.separation);l.lookAt(l.target);this.setViewport(0,0,k,h);e.call(c,a,f);this.setViewport(k,0,k,h);e.call(c,a,l,!1)}};
|