|
@@ -26,9 +26,9 @@ THREE.Matrix4=function(b,c,e,f,h,k,m,n,p,t,w,u,x,v,A,z){this.set(b!==void 0?b:1,
|
|
|
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,p,t,w,u,x,v,A,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=p;this.n32=t;this.n33=w;this.n34=u;this.n41=x;this.n42=v;this.n43=A;this.n44=z;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
|
|
|
c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
|
|
|
b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
|
|
|
-e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,t=b.n24,w=b.n31,u=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,D=b.n44,F=c.n11,E=c.n12,
|
|
|
-H=c.n13,L=c.n14,M=c.n21,K=c.n22,G=c.n23,B=c.n24,da=c.n31,J=c.n32,Q=c.n33,R=c.n34,Y=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*F+f*M+h*da+k*Y;this.n12=e*E+f*K+h*J+k*W;this.n13=e*H+f*G+h*Q+k*o;this.n14=e*L+f*B+h*R+k*ea;this.n21=m*F+n*M+p*da+t*Y;this.n22=m*E+n*K+p*J+t*W;this.n23=m*H+n*G+p*Q+t*o;this.n24=m*L+n*B+p*R+t*ea;this.n31=w*F+u*M+x*da+v*Y;this.n32=w*E+u*K+x*J+v*W;this.n33=w*H+u*G+x*Q+v*o;this.n34=w*L+u*B+x*R+v*ea;this.n41=A*F+z*M+y*da+D*Y;this.n42=A*E+z*K+y*J+D*W;this.n43=A*H+z*G+y*Q+D*o;this.n44=
|
|
|
-A*L+z*B+y*R+D*ea;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
|
|
|
+e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,t=b.n24,w=b.n31,u=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,E=b.n44,F=c.n11,D=c.n12,
|
|
|
+G=c.n13,L=c.n14,M=c.n21,K=c.n22,H=c.n23,B=c.n24,ca=c.n31,J=c.n32,P=c.n33,Q=c.n34,T=c.n41,X=c.n42,o=c.n43,da=c.n44;this.n11=e*F+f*M+h*ca+k*T;this.n12=e*D+f*K+h*J+k*X;this.n13=e*G+f*H+h*P+k*o;this.n14=e*L+f*B+h*Q+k*da;this.n21=m*F+n*M+p*ca+t*T;this.n22=m*D+n*K+p*J+t*X;this.n23=m*G+n*H+p*P+t*o;this.n24=m*L+n*B+p*Q+t*da;this.n31=w*F+u*M+x*ca+v*T;this.n32=w*D+u*K+x*J+v*X;this.n33=w*G+u*H+x*P+v*o;this.n34=w*L+u*B+x*Q+v*da;this.n41=A*F+z*M+y*ca+E*T;this.n42=A*D+z*K+y*J+E*X;this.n43=A*G+z*H+y*P+E*o;this.n44=
|
|
|
+A*L+z*B+y*Q+E*da;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
|
|
|
b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,k=this.n22,m=this.n23,n=this.n24,p=this.n31,t=this.n32,w=this.n33,u=this.n34,x=this.n41,v=this.n42,A=this.n43,z=this.n44;return f*m*t*x-e*n*t*x-f*k*w*x+c*n*w*x+e*k*u*x-c*m*u*x-f*m*p*v+e*n*p*v+f*h*w*v-b*n*w*v-e*h*u*v+b*m*u*v+f*k*p*A-c*n*p*A-f*h*t*A+b*n*t*A+c*h*u*A-b*k*u*A-e*k*p*z+c*m*p*z+e*h*t*z-b*m*t*z-c*h*
|
|
|
w*z+b*k*w*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
|
|
|
this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},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(b){b[0]=
|
|
@@ -42,8 +42,8 @@ b.x,e=b.y,f=b.z,h=b.w,k=c+c,m=e+e,n=f+f,b=c*k,p=c*m;c*=n;var t=e*m;e*=n;f*=n;k*=
|
|
|
f.identity();f.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);k.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length();
|
|
|
e.y=h.length();e.z=k.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23=
|
|
|
b.n23*h;this.n33=b.n33*h}};
|
|
|
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,t=b.n24,w=b.n31,u=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,D=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*z-t*x*z+t*u*y-n*v*y-p*u*D+n*x*D;c.n12=k*x*z-h*v*z-k*u*y+f*v*y+h*u*D-f*x*D;c.n13=h*t*z-k*p*z+k*n*y-f*t*y-h*n*D+f*p*D;c.n14=k*p*u-h*t*u-k*n*x+f*t*x+h*n*v-f*p*v;c.n21=t*x*A-p*v*A-t*w*y+m*v*y+p*w*D-m*x*D;c.n22=h*v*A-k*x*A+k*w*y-e*v*y-h*w*D+e*x*D;c.n23=k*p*A-h*t*A-k*m*y+e*t*y+h*m*D-e*p*D;c.n24=
|
|
|
-h*t*w-k*p*w+k*m*x-e*t*x-h*m*v+e*p*v;c.n31=n*v*A-t*u*A+t*w*z-m*v*z-n*w*D+m*u*D;c.n32=k*u*A-f*v*A-k*w*z+e*v*z+f*w*D-e*u*D;c.n33=h*t*A-k*n*A+k*m*z-e*t*z-f*m*D+e*n*D;c.n34=k*n*w-f*t*w-k*m*u+e*t*u+f*m*v-e*n*v;c.n41=p*u*A-n*x*A-p*w*z+m*x*z+n*w*y-m*u*y;c.n42=f*x*A-h*u*A+h*w*z-e*x*z-f*w*y+e*u*y;c.n43=h*n*A-f*p*A-h*m*z+e*p*z+f*m*y-e*n*y;c.n44=f*p*w-h*n*w+h*m*u-e*p*u-f*m*x+e*n*x;c.multiplyScalar(1/b.determinant());return c};
|
|
|
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,t=b.n24,w=b.n31,u=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*z-t*x*z+t*u*y-n*v*y-p*u*E+n*x*E;c.n12=k*x*z-h*v*z-k*u*y+f*v*y+h*u*E-f*x*E;c.n13=h*t*z-k*p*z+k*n*y-f*t*y-h*n*E+f*p*E;c.n14=k*p*u-h*t*u-k*n*x+f*t*x+h*n*v-f*p*v;c.n21=t*x*A-p*v*A-t*w*y+m*v*y+p*w*E-m*x*E;c.n22=h*v*A-k*x*A+k*w*y-e*v*y-h*w*E+e*x*E;c.n23=k*p*A-h*t*A-k*m*y+e*t*y+h*m*E-e*p*E;c.n24=
|
|
|
+h*t*w-k*p*w+k*m*x-e*t*x-h*m*v+e*p*v;c.n31=n*v*A-t*u*A+t*w*z-m*v*z-n*w*E+m*u*E;c.n32=k*u*A-f*v*A-k*w*z+e*v*z+f*w*E-e*u*E;c.n33=h*t*A-k*n*A+k*m*z-e*t*z-f*m*E+e*n*E;c.n34=k*n*w-f*t*w-k*m*u+e*t*u+f*m*v-e*n*v;c.n41=p*u*A-n*x*A-p*w*z+m*x*z+n*w*y-m*u*y;c.n42=f*x*A-h*u*A+h*w*z-e*x*z-f*w*y+e*u*y;c.n43=h*n*A-f*p*A-h*m*z+e*p*z+f*m*y-e*n*y;c.n44=f*p*w-h*n*w+h*m*u-e*p*u-f*m*x+e*n*x;c.multiplyScalar(1/b.determinant());return c};
|
|
|
THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,m=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,t=b.n23*b.n12-b.n22*b.n13,w=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*m+b.n31*t;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*k;e[3]=b*m;e[4]=b*n;e[5]=b*p;e[6]=b*t;e[7]=b*w;e[8]=b*u;return c};
|
|
|
THREE.Matrix4.makeFrustum=function(b,c,e,f,h,k){var m;m=new THREE.Matrix4;m.n11=2*h/(c-b);m.n12=0;m.n13=(c+b)/(c-b);m.n14=0;m.n21=0;m.n22=2*h/(f-e);m.n23=(f+e)/(f-e);m.n24=0;m.n31=0;m.n32=0;m.n33=-(k+h)/(k-h);m.n34=-2*k*h/(k-h);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)};
|
|
|
THREE.Matrix4.makeOrtho=function(b,c,e,f,h,k){var m,n,p,t;m=new THREE.Matrix4;n=c-b;p=e-f;t=k-h;m.n11=2/n;m.n12=0;m.n13=0;m.n14=-((c+b)/n);m.n21=0;m.n22=2/p;m.n23=0;m.n24=-((e+f)/p);m.n31=0;m.n32=0;m.n33=-2/t;m.n34=-((k+h)/t);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};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;
|
|
@@ -54,17 +54,17 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi
|
|
|
b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&
|
|
|
this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
|
|
|
this.remove(b)}};THREE.Object3DCount=0;
|
|
|
-THREE.Projector=function(){function b(){var b=p[n]=p[n]||new THREE.RenderableVertex;n++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,k=b.z+b.w,h=c.z+c.w,m=-b.z+b.w,n=-c.z+c.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,p=[],t,w,u=[],x,v=[],A,z,y=[],D,F,E=[],H=[],L=[],M=new THREE.Vector4,K=new THREE.Vector4,
|
|
|
-G=new THREE.Matrix4,B=new THREE.Matrix4,da=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(b,c){G.multiply(c.projectionMatrix,c.matrixWorldInverse);G.multiplyVector3(b);return b};this.unprojectVector=function(b,c){G.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));G.multiplyVector3(b);return b};this.projectObjects=function(b,e,m){var o,n;h=H.length=
|
|
|
-0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh)if(p=n.frustumCulled){a:{p=void 0;for(var t=n.matrixWorld,v=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(p=da[u].x*t.n14+da[u].y*t.n24+da[u].z*t.n34+da[u].w,p<=v){p=!1;break a}p=!0}p=!p}if(!p)p=k[h]=k[h]||new THREE.RenderableObject,h++,f=p,M.copy(n.position),G.multiplyVector3(M),f.object=n,f.z=M.z,H.push(f)}m&&H.sort(c);return H};this.projectScene=
|
|
|
-function(f,k,h){var o=k.near,H=k.far,M,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra,na,O,oa,qa;F=z=x=w=L.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);G.multiply(k.projectionMatrix,k.matrixWorldInverse);da[0].set(G.n41-G.n11,G.n42-G.n12,G.n43-G.n13,G.n44-G.n14);da[1].set(G.n41+G.n11,G.n42+G.n12,G.n43+G.n13,G.n44+G.n14);da[2].set(G.n41+G.n21,G.n42+G.n22,G.n43+G.n23,G.n44+G.n24);da[3].set(G.n41-G.n21,G.n42-G.n22,G.n43-G.n23,G.n44-G.n24);da[4].set(G.n41-G.n31,G.n42-G.n32,G.n43-G.n33,G.n44-
|
|
|
-G.n34);da[5].set(G.n41+G.n31,G.n42+G.n32,G.n43+G.n33,G.n44+G.n34);for(M=0;M<6;M++)$=da[M],$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z));$=this.projectObjects(f,k,!0);f=0;for(M=$.length;f<M;f++)if(X=$[f].object,X.visible)if(ga=X.matrixWorld,la=X.matrixRotationWorld,ra=X.materials,na=X.overdraw,n=0,X instanceof THREE.Mesh){O=X.geometry;ia=O.vertices;oa=O.faces;O=O.faceVertexUvs;ma=0;for(Z=ia.length;ma<Z;ma++)m=b(),m.positionWorld.copy(ia[ma].position),ga.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),
|
|
|
-G.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<H;ia=0;for(ma=oa.length;ia<ma;ia++){Z=oa[ia];if(Z instanceof THREE.Face3)if(aa=p[Z.a],ka=p[Z.b],fa=p[Z.c],aa.visible&&ka.visible&&fa.visible&&(X.doubleSided||X.flipSided!=(fa.positionScreen.x-aa.positionScreen.x)*(ka.positionScreen.y-aa.positionScreen.y)-(fa.positionScreen.y-aa.positionScreen.y)*(ka.positionScreen.x-aa.positionScreen.x)<
|
|
|
-0))ca=u[w]=u[w]||new THREE.RenderableFace3,w++,t=ca,t.v1.copy(aa),t.v2.copy(ka),t.v3.copy(fa);else continue;else if(Z instanceof THREE.Face4)if(aa=p[Z.a],ka=p[Z.b],fa=p[Z.c],ca=p[Z.d],aa.visible&&ka.visible&&fa.visible&&ca.visible&&(X.doubleSided||X.flipSided!=((ca.positionScreen.x-aa.positionScreen.x)*(ka.positionScreen.y-aa.positionScreen.y)-(ca.positionScreen.y-aa.positionScreen.y)*(ka.positionScreen.x-aa.positionScreen.x)<0||(ka.positionScreen.x-fa.positionScreen.x)*(ca.positionScreen.y-fa.positionScreen.y)-
|
|
|
-(ka.positionScreen.y-fa.positionScreen.y)*(ca.positionScreen.x-fa.positionScreen.x)<0)))qa=v[x]=v[x]||new THREE.RenderableFace4,x++,t=qa,t.v1.copy(aa),t.v2.copy(ka),t.v3.copy(fa),t.v4.copy(ca);else continue;t.normalWorld.copy(Z.normal);la.multiplyVector3(t.normalWorld);t.centroidWorld.copy(Z.centroid);ga.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);G.multiplyVector3(t.centroidScreen);fa=Z.vertexNormals;aa=0;for(ka=fa.length;aa<ka;aa++)ca=t.vertexNormalsWorld[aa],ca.copy(fa[aa]),
|
|
|
-la.multiplyVector3(ca);aa=0;for(ka=O.length;aa<ka;aa++)if(qa=O[aa][ia]){fa=0;for(ca=qa.length;fa<ca;fa++)t.uvs[aa][fa]=qa[fa]}t.meshMaterials=ra;t.faceMaterials=Z.materials;t.overdraw=na;t.z=t.centroidScreen.z;L.push(t)}}else if(X instanceof THREE.Line){B.multiply(G,ga);ia=X.geometry.vertices;aa=b();aa.positionScreen.copy(ia[0].position);B.multiplyVector4(aa.positionScreen);ma=1;for(Z=ia.length;ma<Z;ma++)if(aa=b(),aa.positionScreen.copy(ia[ma].position),B.multiplyVector4(aa.positionScreen),ka=p[n-
|
|
|
-2],J.copy(aa.positionScreen),Q.copy(ka.positionScreen),e(J,Q))J.multiplyScalar(1/J.w),Q.multiplyScalar(1/Q.w),ga=y[z]=y[z]||new THREE.RenderableLine,z++,A=ga,A.v1.positionScreen.copy(J),A.v2.positionScreen.copy(Q),A.z=Math.max(J.z,Q.z),A.materials=X.materials,L.push(A)}else if(X instanceof THREE.Particle&&(K.set(X.matrixWorld.n14,X.matrixWorld.n24,X.matrixWorld.n34,1),G.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ga=E[F]=E[F]||new THREE.RenderableParticle,F++,D=ga,D.x=K.x/K.w,D.y=K.y/K.w,D.z=K.z,D.rotation=
|
|
|
-X.rotation.z,D.scale.x=X.scale.x*Math.abs(D.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),D.scale.y=X.scale.y*Math.abs(D.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),D.materials=X.materials,L.push(D);h&&L.sort(c);return L}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
|
|
|
+THREE.Projector=function(){function b(){var b=p[n]=p[n]||new THREE.RenderableVertex;n++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,k=b.z+b.w,h=c.z+c.w,m=-b.z+b.w,n=-c.z+c.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,p=[],t,w,u=[],x,v=[],A,z,y=[],E,F,D=[],G=[],L=[],M=new THREE.Vector4,K=new THREE.Vector4,
|
|
|
+H=new THREE.Matrix4,B=new THREE.Matrix4,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(b,c){H.multiply(c.projectionMatrix,c.matrixWorldInverse);H.multiplyVector3(b);return b};this.unprojectVector=function(b,c){H.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));H.multiplyVector3(b);return b};this.projectObjects=function(b,e,m){var o,n;h=G.length=
|
|
|
+0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh)if(p=n.frustumCulled){a:{p=void 0;for(var t=n.matrixWorld,v=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(p=ca[u].x*t.n14+ca[u].y*t.n24+ca[u].z*t.n34+ca[u].w,p<=v){p=!1;break a}p=!0}p=!p}if(!p)p=k[h]=k[h]||new THREE.RenderableObject,h++,f=p,M.copy(n.position),H.multiplyVector3(M),f.object=n,f.z=M.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=
|
|
|
+function(f,k,h){var o=k.near,G=k.far,M,la,ha,ka,aa,ma,ea,Z,$,Y,fa,ia,ra,na,O,oa,qa;F=z=x=w=L.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);H.multiply(k.projectionMatrix,k.matrixWorldInverse);ca[0].set(H.n41-H.n11,H.n42-H.n12,H.n43-H.n13,H.n44-H.n14);ca[1].set(H.n41+H.n11,H.n42+H.n12,H.n43+H.n13,H.n44+H.n14);ca[2].set(H.n41+H.n21,H.n42+H.n22,H.n43+H.n23,H.n44+H.n24);ca[3].set(H.n41-H.n21,H.n42-H.n22,H.n43-H.n23,H.n44-H.n24);ca[4].set(H.n41-H.n31,H.n42-H.n32,H.n43-H.n33,H.n44-
|
|
|
+H.n34);ca[5].set(H.n41+H.n31,H.n42+H.n32,H.n43+H.n33,H.n44+H.n34);for(M=0;M<6;M++)$=ca[M],$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z));$=this.projectObjects(f,k,!0);f=0;for(M=$.length;f<M;f++)if(Y=$[f].object,Y.visible)if(fa=Y.matrixWorld,ia=Y.matrixRotationWorld,ra=Y.materials,na=Y.overdraw,n=0,Y instanceof THREE.Mesh){O=Y.geometry;ka=O.vertices;oa=O.faces;O=O.faceVertexUvs;la=0;for(ha=ka.length;la<ha;la++)m=b(),m.positionWorld.copy(ka[la].position),fa.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),
|
|
|
+H.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<G;ka=0;for(la=oa.length;ka<la;ka++){ha=oa[ka];if(ha instanceof THREE.Face3)if(aa=p[ha.a],ma=p[ha.b],ea=p[ha.c],aa.visible&&ma.visible&&ea.visible&&(Y.doubleSided||Y.flipSided!=(ea.positionScreen.x-aa.positionScreen.x)*(ma.positionScreen.y-aa.positionScreen.y)-(ea.positionScreen.y-aa.positionScreen.y)*(ma.positionScreen.x-aa.positionScreen.x)<
|
|
|
+0))Z=u[w]=u[w]||new THREE.RenderableFace3,w++,t=Z,t.v1.copy(aa),t.v2.copy(ma),t.v3.copy(ea);else continue;else if(ha instanceof THREE.Face4)if(aa=p[ha.a],ma=p[ha.b],ea=p[ha.c],Z=p[ha.d],aa.visible&&ma.visible&&ea.visible&&Z.visible&&(Y.doubleSided||Y.flipSided!=((Z.positionScreen.x-aa.positionScreen.x)*(ma.positionScreen.y-aa.positionScreen.y)-(Z.positionScreen.y-aa.positionScreen.y)*(ma.positionScreen.x-aa.positionScreen.x)<0||(ma.positionScreen.x-ea.positionScreen.x)*(Z.positionScreen.y-ea.positionScreen.y)-
|
|
|
+(ma.positionScreen.y-ea.positionScreen.y)*(Z.positionScreen.x-ea.positionScreen.x)<0)))qa=v[x]=v[x]||new THREE.RenderableFace4,x++,t=qa,t.v1.copy(aa),t.v2.copy(ma),t.v3.copy(ea),t.v4.copy(Z);else continue;t.normalWorld.copy(ha.normal);ia.multiplyVector3(t.normalWorld);t.centroidWorld.copy(ha.centroid);fa.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);H.multiplyVector3(t.centroidScreen);ea=ha.vertexNormals;aa=0;for(ma=ea.length;aa<ma;aa++)Z=t.vertexNormalsWorld[aa],Z.copy(ea[aa]),
|
|
|
+ia.multiplyVector3(Z);aa=0;for(ma=O.length;aa<ma;aa++)if(qa=O[aa][ka]){ea=0;for(Z=qa.length;ea<Z;ea++)t.uvs[aa][ea]=qa[ea]}t.meshMaterials=ra;t.faceMaterials=ha.materials;t.overdraw=na;t.z=t.centroidScreen.z;L.push(t)}}else if(Y instanceof THREE.Line){B.multiply(H,fa);ka=Y.geometry.vertices;aa=b();aa.positionScreen.copy(ka[0].position);B.multiplyVector4(aa.positionScreen);la=1;for(ha=ka.length;la<ha;la++)if(aa=b(),aa.positionScreen.copy(ka[la].position),B.multiplyVector4(aa.positionScreen),ma=p[n-
|
|
|
+2],J.copy(aa.positionScreen),P.copy(ma.positionScreen),e(J,P))J.multiplyScalar(1/J.w),P.multiplyScalar(1/P.w),fa=y[z]=y[z]||new THREE.RenderableLine,z++,A=fa,A.v1.positionScreen.copy(J),A.v2.positionScreen.copy(P),A.z=Math.max(J.z,P.z),A.materials=Y.materials,L.push(A)}else if(Y instanceof THREE.Particle&&(K.set(Y.matrixWorld.n14,Y.matrixWorld.n24,Y.matrixWorld.n34,1),H.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))fa=D[F]=D[F]||new THREE.RenderableParticle,F++,E=fa,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=
|
|
|
+Y.rotation.z,E.scale.x=Y.scale.x*Math.abs(E.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),E.scale.y=Y.scale.y*Math.abs(E.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),E.materials=Y.materials,L.push(E);h&&L.sort(c);return L}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),k=Math.cos(e),e=Math.sin(e),m=b*c,n=f*h;this.w=m*k-n*e;this.x=m*e+n*k;this.y=f*c*k+b*h*e;this.z=b*h*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
|
|
|
this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
|
|
@@ -78,9 +78,9 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid
|
|
|
e,f,h,k,m,n=new THREE.Vector3,p=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];if(b&&k.vertexNormals.length){n.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)n.addSelf(k.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],m=this.vertices[k.c],n.sub(m.position,e.position),p.sub(c.position,e.position),n.crossSelf(p);n.isZero()||n.normalize();k.normal.copy(n)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
|
|
|
Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
|
|
|
THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),
|
|
|
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,e,f,k,h,o){n=b.vertices[c].position;p=b.vertices[e].position;t=b.vertices[f].position;w=m[k];u=m[h];x=m[o];v=p.x-n.x;A=t.x-n.x;z=p.y-n.y;y=t.y-n.y;D=p.z-n.z;F=t.z-n.z;E=u.u-w.u;H=x.u-w.u;L=u.v-w.v;M=x.v-w.v;K=1/(E*M-H*L);J.set((M*v-L*A)*K,(M*z-L*y)*K,(M*D-L*F)*K);Q.set((E*A-H*v)*K,(E*y-H*z)*K,(E*F-H*D)*K);B[c].addSelf(J);B[e].addSelf(J);B[f].addSelf(J);da[c].addSelf(Q);
|
|
|
-da[e].addSelf(Q);da[f].addSelf(Q)}var c,e,f,h,k,m,n,p,t,w,u,x,v,A,z,y,D,F,E,H,L,M,K,G,B=[],da=[],J=new THREE.Vector3,Q=new THREE.Vector3,R=new THREE.Vector3,Y=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)B[c]=new THREE.Vector3,da[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=this.faceVertexUvs[0][c],k instanceof THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var o=["a",
|
|
|
-"b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)W.copy(k.vertexNormals[f]),h=k[o[f]],G=B[h],R.copy(G),R.subSelf(W.multiplyScalar(W.dot(G))).normalize(),Y.cross(k.vertexNormals[f],G),h=Y.dot(da[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(R.x,R.y,R.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
|
|
|
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,e,f,k,h,o){n=b.vertices[c].position;p=b.vertices[e].position;t=b.vertices[f].position;w=m[k];u=m[h];x=m[o];v=p.x-n.x;A=t.x-n.x;z=p.y-n.y;y=t.y-n.y;E=p.z-n.z;F=t.z-n.z;D=u.u-w.u;G=x.u-w.u;L=u.v-w.v;M=x.v-w.v;K=1/(D*M-G*L);J.set((M*v-L*A)*K,(M*z-L*y)*K,(M*E-L*F)*K);P.set((D*A-G*v)*K,(D*y-G*z)*K,(D*F-G*E)*K);B[c].addSelf(J);B[e].addSelf(J);B[f].addSelf(J);ca[c].addSelf(P);
|
|
|
+ca[e].addSelf(P);ca[f].addSelf(P)}var c,e,f,h,k,m,n,p,t,w,u,x,v,A,z,y,E,F,D,G,L,M,K,H,B=[],ca=[],J=new THREE.Vector3,P=new THREE.Vector3,Q=new THREE.Vector3,T=new THREE.Vector3,X=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)B[c]=new THREE.Vector3,ca[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=this.faceVertexUvs[0][c],k instanceof THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var o=["a",
|
|
|
+"b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)X.copy(k.vertexNormals[f]),h=k[o[f]],H=B[h],Q.copy(H),Q.subSelf(X.multiplyScalar(X.dot(H))).normalize(),T.cross(k.vertexNormals[f],H),h=T.dot(ca[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(Q.x,Q.y,Q.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;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,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
|
|
|
b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],e=[],f,h=Math.pow(10,4),k,m;k=0;for(m=this.vertices.length;k<m;k++)f=this.vertices[k].position,f=[Math.round(f.x*h),Math.round(f.y*h),Math.round(f.z*h)].join("_"),b[f]===void 0?(b[f]=k,c.push(this.vertices[k]),
|
|
|
e[k]=c.length-1):e[k]=e[b[f]];k=0;for(m=this.faces.length;k<m;k++){b=this.faces[k];if(b instanceof THREE.Face3)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c];if(b instanceof THREE.Face4)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c],b.d=e[b.d]}this.vertices=c}};THREE.GeometryCount=0;
|
|
@@ -146,48 +146,48 @@ THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light
|
|
|
THREE.Scene.prototype.addChild=function(b){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addLight=function(b){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(b)};THREE.Scene.prototype.removeChild=function(b){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(b)};
|
|
|
THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
|
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var p,t,w,u,x,v,A,z;b=c.projectScene(e,f);p=0;for(t=b.length;p<t;p++)if(x=b[p],x instanceof THREE.RenderableParticle){A=x.x*h+h;z=x.y*k+k;w=0;for(u=x.material.length;w<u;w++)if(v=x.material[w],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=A+"px",v.style.top=z+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(b){function c(b){if(y!=b)v.globalAlpha=y=b}function e(b){if(D!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}D=b}}function f(b){if(F!=b)v.strokeStyle=F=b}function h(b){if(E!=b)v.fillStyle=E=b}var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
-t,w,u,x,v=p.getContext("2d"),A=new THREE.Color(0),z=0,y=1,D=0,F=null,E=null,H=null,L=null,M=null,K,G,B,da,J=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,R,Y,W,o,ea,P,ma,Z,ia,aa,ka,fa,ca=new THREE.Color(0),$=new THREE.Color(0),X=new THREE.Color(0),ga=new THREE.Color(0),la=new THREE.Color(0),ra=[],na,O,oa,qa,va,ta,Ea,Aa,Ca,Fa,U=new THREE.Rectangle,T=new THREE.Rectangle,N=new THREE.Rectangle,ua=!1,ha=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,wa=new THREE.Color,pa=new THREE.Vector3,
|
|
|
-Ia,Da,Ka,Ba,Ga,V,b=16;Ia=document.createElement("canvas");Ia.width=Ia.height=2;Da=Ia.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Ba=Ka.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;V=Ga.getContext("2d");V.translate(-b/2,-b/2);V.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){t=b;w=c;u=Math.floor(t/2);x=Math.floor(w/2);p.width=t;
|
|
|
-p.height=w;U.set(-u,-x,u,x);T.set(-u,-x,u,x);y=1;D=0;M=L=H=E=F=null};this.setClearColor=function(b,c){A.copy(b);z=c;T.set(-u,-x,u,x)};this.setClearColorHex=function(b,c){A.setHex(b);z=c;T.set(-u,-x,u,x)};this.clear=function(){v.setTransform(1,0,0,-1,u,x);T.isEmpty()||(T.minSelf(U),T.inflate(2),z<1&&v.clearRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b*
|
|
|
-255)+","+z+")"),v.fillRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight()))),T.empty())};this.render=function(b,p){function t(b){var c,e,f,k=b.lights;ja.setRGB(0,0,0);ya.setRGB(0,0,0);wa.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.AmbientLight?(ja.r+=f.r,ja.g+=f.g,ja.b+=f.b):e instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):e instanceof THREE.PointLight&&(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b)}function w(b,c,e,
|
|
|
+THREE.CanvasRenderer=function(b){function c(b){if(y!=b)v.globalAlpha=y=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}E=b}}function f(b){if(F!=b)v.strokeStyle=F=b}function h(b){if(D!=b)v.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
+t,w,u,x,v=p.getContext("2d"),A=new THREE.Color(0),z=0,y=1,E=0,F=null,D=null,G=null,L=null,M=null,K,H,B,ca,J=new THREE.RenderableVertex,P=new THREE.RenderableVertex,Q,T,X,o,da,V,la,ha,ka,aa,ma,ea,Z=new THREE.Color(0),$=new THREE.Color(0),Y=new THREE.Color(0),fa=new THREE.Color(0),ia=new THREE.Color(0),ra=[],na,O,oa,qa,va,ta,Ea,Aa,Ca,Fa,U=new THREE.Rectangle,S=new THREE.Rectangle,N=new THREE.Rectangle,ua=!1,ga=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,wa=new THREE.Color,pa=new THREE.Vector3,
|
|
|
+Ia,Da,Ka,Ba,Ga,W,b=16;Ia=document.createElement("canvas");Ia.width=Ia.height=2;Da=Ia.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Ba=Ka.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;W=Ga.getContext("2d");W.translate(-b/2,-b/2);W.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){t=b;w=c;u=Math.floor(t/2);x=Math.floor(w/2);p.width=t;
|
|
|
+p.height=w;U.set(-u,-x,u,x);S.set(-u,-x,u,x);y=1;E=0;M=L=G=D=F=null};this.setClearColor=function(b,c){A.copy(b);z=c;S.set(-u,-x,u,x)};this.setClearColorHex=function(b,c){A.setHex(b);z=c;S.set(-u,-x,u,x)};this.clear=function(){v.setTransform(1,0,0,-1,u,x);S.isEmpty()||(S.minSelf(U),S.inflate(2),z<1&&v.clearRect(Math.floor(S.getX()),Math.floor(S.getY()),Math.floor(S.getWidth()),Math.floor(S.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b*
|
|
|
+255)+","+z+")"),v.fillRect(Math.floor(S.getX()),Math.floor(S.getY()),Math.floor(S.getWidth()),Math.floor(S.getHeight()))),S.empty())};this.render=function(b,p){function t(b){var c,e,f,k=b.lights;ja.setRGB(0,0,0);ya.setRGB(0,0,0);wa.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.AmbientLight?(ja.r+=f.r,ja.g+=f.g,ja.b+=f.b):e instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):e instanceof THREE.PointLight&&(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b)}function w(b,c,e,
|
|
|
f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=e.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=e.dot(pa.sub(h.position,c).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(c.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function z(b,k,m){c(m.opacity);e(m.blending);var o,n,p,t,w,xa;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)t=
|
|
|
m.map.image,w=t.width>>1,xa=t.height>>1,m=k.scale.x*u,p=k.scale.y*x,o=m*w,n=p*xa,N.set(b.x-o,b.y-n,b.x+o,b.y+n),U.intersects(N)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-p),v.translate(-w,-xa),v.drawImage(t,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,n=k.scale.y*x,N.set(b.x-o,b.y-n,b.x+o,b.y+n),U.intersects(N)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(o,n),m.program(v),
|
|
|
-v.restore()))}function y(b,k,h,m){c(m.opacity);e(m.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(k.positionScreen.x,k.positionScreen.y);v.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)v.lineWidth=H=b;b=m.linecap;if(L!=b)v.lineCap=L=b;b=m.linejoin;if(M!=b)v.lineJoin=M=b;f(m.color.getContextStyle());v.stroke();N.inflate(m.linewidth*2)}}function A(b,f,h,m,n,t,u,v,x){k.info.render.vertices+=3;k.info.render.faces++;c(v.opacity);e(v.blending);
|
|
|
-R=b.positionScreen.x;Y=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ea=h.positionScreen.x;P=h.positionScreen.y;F(R,Y,W,o,ea,P);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],ab(R,Y,W,o,ea,P,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,pa.copy(u.vertexNormalsWorld[0]),va=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
|
|
|
-ta=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(u.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(u.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Fa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(R,Y,W,o,ea,P,va,ta,Ea,Aa,Ca,Fa,v.envMap)}else v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshLambertMaterial)v.map&&!v.wireframe&&
|
|
|
-(v.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],ab(R,Y,W,o,ea,P,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map)),e(THREE.SubtractiveBlending)),ua?!v.wireframe&&v.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?($.r=X.r=ga.r=ja.r,$.g=X.g=ga.g=ja.g,$.b=X.b=ga.b=ja.b,w(x,u.v1.positionWorld,u.vertexNormalsWorld[0],$),w(x,u.v2.positionWorld,u.vertexNormalsWorld[1],X),w(x,u.v3.positionWorld,u.vertexNormalsWorld[2],ga),$.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)),X.r=Math.max(0,Math.min(v.color.r*X.r,1)),X.g=Math.max(0,Math.min(v.color.g*X.g,1)),X.b=Math.max(0,Math.min(v.color.b*X.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)),la.r=(X.r+ga.r)*0.5,la.g=(X.g+ga.g)*0.5,la.b=(X.b+ga.b)*0.5,oa=Ya($,X,ga,la),Va(R,Y,W,o,ea,P,0,0,1,0,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,u.centroidWorld,u.normalWorld,
|
|
|
-ha),ca.r=Math.max(0,Math.min(v.color.r*ha.r,1)),ca.g=Math.max(0,Math.min(v.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(v.color.b*ha.b,1)),v.wireframe?Na(ca,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(ca)):v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshDepthMaterial)na=p.near,O=p.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,O),ga.r=ga.g=ga.b=1-Ra(h.positionScreen.z,
|
|
|
-na,O),la.r=(X.r+ga.r)*0.5,la.g=(X.g+ga.g)*0.5,la.b=(X.b+ga.b)*0.5,oa=Ya($,X,ga,la),Va(R,Y,W,o,ea,P,0,0,1,0,0,1,oa);else if(v instanceof THREE.MeshNormalMaterial)ca.r=Wa(u.normalWorld.x),ca.g=Wa(u.normalWorld.y),ca.b=Wa(u.normalWorld.z),v.wireframe?Na(ca,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(ca)}function D(b,f,h,m,n,t,v,u,x){k.info.render.vertices+=4;k.info.render.faces++;c(u.opacity);e(u.blending);if(u.map||u.envMap)A(b,f,m,0,1,3,v,u,x),A(n,h,t,1,2,3,v,u,x);else if(R=b.positionScreen.x,
|
|
|
-Y=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ea=h.positionScreen.x,P=h.positionScreen.y,ma=m.positionScreen.x,Z=m.positionScreen.y,ia=n.positionScreen.x,aa=n.positionScreen.y,ka=t.positionScreen.x,fa=t.positionScreen.y,u instanceof THREE.MeshBasicMaterial)E(R,Y,W,o,ea,P,ma,Z),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color);else if(u instanceof THREE.MeshLambertMaterial)ua?!u.wireframe&&u.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==
|
|
|
-4?($.r=X.r=ga.r=la.r=ja.r,$.g=X.g=ga.g=la.g=ja.g,$.b=X.b=ga.b=la.b=ja.b,w(x,v.v1.positionWorld,v.vertexNormalsWorld[0],$),w(x,v.v2.positionWorld,v.vertexNormalsWorld[1],X),w(x,v.v4.positionWorld,v.vertexNormalsWorld[3],ga),w(x,v.v3.positionWorld,v.vertexNormalsWorld[2],la),$.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)),X.r=Math.max(0,Math.min(u.color.r*X.r,1)),X.g=Math.max(0,Math.min(u.color.g*X.g,1)),X.b=Math.max(0,Math.min(u.color.b*
|
|
|
-X.b,1)),ga.r=Math.max(0,Math.min(u.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(u.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(u.color.b*ga.b,1)),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)),oa=Ya($,X,ga,la),F(R,Y,W,o,ma,Z),Va(R,Y,W,o,ma,Z,0,0,1,0,0,1,oa),F(ia,aa,ea,P,ka,fa),Va(ia,aa,ea,P,ka,fa,1,0,1,1,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,v.centroidWorld,v.normalWorld,ha),ca.r=Math.max(0,Math.min(u.color.r*ha.r,
|
|
|
-1)),ca.g=Math.max(0,Math.min(u.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(u.color.b*ha.b,1)),E(R,Y,W,o,ea,P,ma,Z),u.wireframe?Na(ca,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(ca)):(E(R,Y,W,o,ea,P,ma,Z),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color));else if(u instanceof THREE.MeshNormalMaterial)ca.r=Wa(v.normalWorld.x),ca.g=Wa(v.normalWorld.y),ca.b=Wa(v.normalWorld.z),E(R,Y,W,o,ea,P,ma,Z),u.wireframe?Na(ca,u.wireframeLinewidth,u.wireframeLinecap,
|
|
|
-u.wireframeLinejoin):Oa(ca);else if(u instanceof THREE.MeshDepthMaterial)na=p.near,O=p.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,O),ga.r=ga.g=ga.b=1-Ra(m.positionScreen.z,na,O),la.r=la.g=la.b=1-Ra(h.positionScreen.z,na,O),oa=Ya($,X,ga,la),F(R,Y,W,o,ma,Z),Va(R,Y,W,o,ma,Z,0,0,1,0,0,1,oa),F(ia,aa,ea,P,ka,fa),Va(ia,aa,ea,P,ka,fa,1,0,1,1,0,1,oa)}function F(b,c,e,f,k,h){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(b,c);v.closePath()}function E(b,
|
|
|
-c,e,f,k,h,m,o){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(m,o);v.lineTo(b,c);v.closePath()}function Na(b,c,e,k){if(H!=c)v.lineWidth=H=c;if(L!=e)v.lineCap=L=e;if(M!=k)v.lineJoin=M=k;f(b.getContextStyle());v.stroke();N.inflate(c*2)}function Oa(b){h(b.getContextStyle());v.fill()}function ab(b,c,e,f,k,m,o,n,p,t,u,x,w){if(w.image.width!=0){if(w.needsUpdate==!0||ra[w.id]==void 0){var xa=w.wrapS==THREE.RepeatWrapping,z=w.wrapT==THREE.RepeatWrapping;ra[w.id]=v.createPattern(w.image,
|
|
|
+v.restore()))}function y(b,k,h,m){c(m.opacity);e(m.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(k.positionScreen.x,k.positionScreen.y);v.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(G!=b)v.lineWidth=G=b;b=m.linecap;if(L!=b)v.lineCap=L=b;b=m.linejoin;if(M!=b)v.lineJoin=M=b;f(m.color.getContextStyle());v.stroke();N.inflate(m.linewidth*2)}}function A(b,f,h,m,n,t,u,v,x){k.info.render.vertices+=3;k.info.render.faces++;c(v.opacity);e(v.blending);
|
|
|
+Q=b.positionScreen.x;T=b.positionScreen.y;X=f.positionScreen.x;o=f.positionScreen.y;da=h.positionScreen.x;V=h.positionScreen.y;F(Q,T,X,o,da,V);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],ab(Q,T,X,o,da,V,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,pa.copy(u.vertexNormalsWorld[0]),va=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
|
|
|
+ta=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(u.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(u.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Fa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(Q,T,X,o,da,V,va,ta,Ea,Aa,Ca,Fa,v.envMap)}else v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshLambertMaterial)v.map&&!v.wireframe&&
|
|
|
+(v.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],ab(Q,T,X,o,da,V,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map)),e(THREE.SubtractiveBlending)),ua?!v.wireframe&&v.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?($.r=Y.r=fa.r=ja.r,$.g=Y.g=fa.g=ja.g,$.b=Y.b=fa.b=ja.b,w(x,u.v1.positionWorld,u.vertexNormalsWorld[0],$),w(x,u.v2.positionWorld,u.vertexNormalsWorld[1],Y),w(x,u.v3.positionWorld,u.vertexNormalsWorld[2],fa),$.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)),Y.r=Math.max(0,Math.min(v.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(v.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(v.color.b*Y.b,1)),fa.r=Math.max(0,Math.min(v.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(v.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(v.color.b*fa.b,1)),ia.r=(Y.r+fa.r)*0.5,ia.g=(Y.g+fa.g)*0.5,ia.b=(Y.b+fa.b)*0.5,oa=Ya($,Y,fa,ia),Va(Q,T,X,o,da,V,0,0,1,0,0,1,oa)):(ga.r=ja.r,ga.g=ja.g,ga.b=ja.b,w(x,u.centroidWorld,u.normalWorld,
|
|
|
+ga),Z.r=Math.max(0,Math.min(v.color.r*ga.r,1)),Z.g=Math.max(0,Math.min(v.color.g*ga.g,1)),Z.b=Math.max(0,Math.min(v.color.b*ga.b,1)),v.wireframe?Na(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(Z)):v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshDepthMaterial)na=p.near,O=p.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),Y.r=Y.g=Y.b=1-Ra(f.positionScreen.z,na,O),fa.r=fa.g=fa.b=1-Ra(h.positionScreen.z,na,
|
|
|
+O),ia.r=(Y.r+fa.r)*0.5,ia.g=(Y.g+fa.g)*0.5,ia.b=(Y.b+fa.b)*0.5,oa=Ya($,Y,fa,ia),Va(Q,T,X,o,da,V,0,0,1,0,0,1,oa);else if(v instanceof THREE.MeshNormalMaterial)Z.r=Wa(u.normalWorld.x),Z.g=Wa(u.normalWorld.y),Z.b=Wa(u.normalWorld.z),v.wireframe?Na(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(Z)}function E(b,f,h,m,n,t,v,u,x){k.info.render.vertices+=4;k.info.render.faces++;c(u.opacity);e(u.blending);if(u.map||u.envMap)A(b,f,m,0,1,3,v,u,x),A(n,h,t,1,2,3,v,u,x);else if(Q=b.positionScreen.x,
|
|
|
+T=b.positionScreen.y,X=f.positionScreen.x,o=f.positionScreen.y,da=h.positionScreen.x,V=h.positionScreen.y,la=m.positionScreen.x,ha=m.positionScreen.y,ka=n.positionScreen.x,aa=n.positionScreen.y,ma=t.positionScreen.x,ea=t.positionScreen.y,u instanceof THREE.MeshBasicMaterial)D(Q,T,X,o,da,V,la,ha),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color);else if(u instanceof THREE.MeshLambertMaterial)ua?!u.wireframe&&u.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==
|
|
|
+4?($.r=Y.r=fa.r=ia.r=ja.r,$.g=Y.g=fa.g=ia.g=ja.g,$.b=Y.b=fa.b=ia.b=ja.b,w(x,v.v1.positionWorld,v.vertexNormalsWorld[0],$),w(x,v.v2.positionWorld,v.vertexNormalsWorld[1],Y),w(x,v.v4.positionWorld,v.vertexNormalsWorld[3],fa),w(x,v.v3.positionWorld,v.vertexNormalsWorld[2],ia),$.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)),Y.r=Math.max(0,Math.min(u.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(u.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(u.color.b*
|
|
|
+Y.b,1)),fa.r=Math.max(0,Math.min(u.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(u.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(u.color.b*fa.b,1)),ia.r=Math.max(0,Math.min(u.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(u.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(u.color.b*ia.b,1)),oa=Ya($,Y,fa,ia),F(Q,T,X,o,la,ha),Va(Q,T,X,o,la,ha,0,0,1,0,0,1,oa),F(ka,aa,da,V,ma,ea),Va(ka,aa,da,V,ma,ea,1,0,1,1,0,1,oa)):(ga.r=ja.r,ga.g=ja.g,ga.b=ja.b,w(x,v.centroidWorld,v.normalWorld,ga),Z.r=Math.max(0,Math.min(u.color.r*ga.r,
|
|
|
+1)),Z.g=Math.max(0,Math.min(u.color.g*ga.g,1)),Z.b=Math.max(0,Math.min(u.color.b*ga.b,1)),D(Q,T,X,o,da,V,la,ha),u.wireframe?Na(Z,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(Z)):(D(Q,T,X,o,da,V,la,ha),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color));else if(u instanceof THREE.MeshNormalMaterial)Z.r=Wa(v.normalWorld.x),Z.g=Wa(v.normalWorld.y),Z.b=Wa(v.normalWorld.z),D(Q,T,X,o,da,V,la,ha),u.wireframe?Na(Z,u.wireframeLinewidth,u.wireframeLinecap,
|
|
|
+u.wireframeLinejoin):Oa(Z);else if(u instanceof THREE.MeshDepthMaterial)na=p.near,O=p.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),Y.r=Y.g=Y.b=1-Ra(f.positionScreen.z,na,O),fa.r=fa.g=fa.b=1-Ra(m.positionScreen.z,na,O),ia.r=ia.g=ia.b=1-Ra(h.positionScreen.z,na,O),oa=Ya($,Y,fa,ia),F(Q,T,X,o,la,ha),Va(Q,T,X,o,la,ha,0,0,1,0,0,1,oa),F(ka,aa,da,V,ma,ea),Va(ka,aa,da,V,ma,ea,1,0,1,1,0,1,oa)}function F(b,c,e,f,k,h){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(b,c);v.closePath()}function D(b,
|
|
|
+c,e,f,k,h,m,o){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(m,o);v.lineTo(b,c);v.closePath()}function Na(b,c,e,k){if(G!=c)v.lineWidth=G=c;if(L!=e)v.lineCap=L=e;if(M!=k)v.lineJoin=M=k;f(b.getContextStyle());v.stroke();N.inflate(c*2)}function Oa(b){h(b.getContextStyle());v.fill()}function ab(b,c,e,f,k,m,o,n,p,t,u,x,w){if(w.image.width!=0){if(w.needsUpdate==!0||ra[w.id]==void 0){var xa=w.wrapS==THREE.RepeatWrapping,z=w.wrapT==THREE.RepeatWrapping;ra[w.id]=v.createPattern(w.image,
|
|
|
xa&&z?"repeat":xa&&!z?"repeat-x":!xa&&z?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ra[w.id]);var xa=w.offset.x/w.repeat.x,z=w.offset.y/w.repeat.y,U=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+xa)*U,n=(n+z)*w,p=(p+xa)*U,t=(t+z)*w,u=(u+xa)*U,x=(x+z)*w;e-=b;f-=c;k-=b;m-=c;p-=o;t-=n;u-=o;x-=n;xa=1/(p*x-u*t);w=(x*e-t*k)*xa;t=(x*f-t*m)*xa;e=(p*k-u*e)*xa;f=(p*m-u*f)*xa;b=b-w*o-e*n;c=c-t*o-f*n;v.save();v.transform(w,t,e,f,b,c);v.fill();v.restore()}}function Va(b,c,e,f,k,h,m,o,n,p,t,
|
|
|
u,w){var x,xa;x=w.width-1;xa=w.height-1;m*=x;o*=xa;n*=x;p*=xa;t*=x;u*=xa;e-=b;f-=c;k-=b;h-=c;n-=m;p-=o;t-=m;u-=o;xa=1/(n*u-t*p);x=(u*e-p*k)*xa;p=(u*f-p*h)*xa;e=(n*k-t*e)*xa;f=(n*h-t*f)*xa;b=b-x*m-e*o;c=c-p*m-f*o;v.save();v.transform(x,p,e,f,b,c);v.clip();v.drawImage(w,0,0);v.restore()}function Ya(b,c,e,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255),t=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Ba[0]=k<0?0:k>255?255:
|
|
|
-k;Ba[1]=h<0?0:h>255?255:h;Ba[2]=b<0?0:b>255?255:b;Ba[4]=m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=c<0?0:c>255?255:c;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=e<0?0:e>255?255:e;Ba[12]=t<0?0:t>255?255:t;Ba[13]=u<0?0:u>255?255:u;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);V.drawImage(Ia,0,0);return Ga}function Ra(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,c){var e=c.x-b.x,f=c.y-b.y,k=e*e+f*f;k!=0&&(k=1/Math.sqrt(k),e*=
|
|
|
-k,f*=k,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Za,bb,sa,Ha,Qa,Xa,$a,za;this.autoClear?this.clear():v.setTransform(1,0,0,-1,u,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,p,this.sortElements);(ua=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){sa=m[Za];N.empty();if(sa instanceof THREE.RenderableParticle){K=sa;K.x*=u;K.y*=x;Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&z(K,sa,za,b)}else if(sa instanceof THREE.RenderableLine){if(K=sa.v1,G=sa.v2,
|
|
|
-K.positionScreen.x*=u,K.positionScreen.y*=x,G.positionScreen.x*=u,G.positionScreen.y*=x,N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(G.positionScreen.x,G.positionScreen.y),U.intersects(N)){Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&y(K,G,sa,za,b)}}else if(sa instanceof THREE.RenderableFace3){if(K=sa.v1,G=sa.v2,B=sa.v3,K.positionScreen.x*=u,K.positionScreen.y*=x,G.positionScreen.x*=u,G.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,
|
|
|
-sa.overdraw&&(Pa(K.positionScreen,G.positionScreen),Pa(G.positionScreen,B.positionScreen),Pa(B.positionScreen,K.positionScreen)),N.add3Points(K.positionScreen.x,K.positionScreen.y,G.positionScreen.x,G.positionScreen.y,B.positionScreen.x,B.positionScreen.y),U.intersects(N)){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&A(K,G,B,0,1,2,sa,za,b)}else za.opacity!=
|
|
|
-0&&A(K,G,B,0,1,2,sa,za,b)}}else if(sa instanceof THREE.RenderableFace4&&(K=sa.v1,G=sa.v2,B=sa.v3,da=sa.v4,K.positionScreen.x*=u,K.positionScreen.y*=x,G.positionScreen.x*=u,G.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,da.positionScreen.x*=u,da.positionScreen.y*=x,J.positionScreen.copy(G.positionScreen),Q.positionScreen.copy(da.positionScreen),sa.overdraw&&(Pa(K.positionScreen,G.positionScreen),Pa(G.positionScreen,da.positionScreen),Pa(da.positionScreen,K.positionScreen),Pa(B.positionScreen,
|
|
|
-J.positionScreen),Pa(B.positionScreen,Q.positionScreen)),N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(G.positionScreen.x,G.positionScreen.y),N.addPoint(B.positionScreen.x,B.positionScreen.y),N.addPoint(da.positionScreen.x,da.positionScreen.y),U.intersects(N))){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&D(K,G,B,da,J,Q,sa,za,b)}else za.opacity!=
|
|
|
-0&&D(K,G,B,da,J,Q,sa,za,b)}T.addRectangle(N)}v.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function b(b,c,e){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=c.normalWorld.dot(h.position)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m)):h instanceof THREE.PointLight&&(da.sub(h.position,c.centroidWorld),da.normalize(),m=c.normalWorld.dot(da)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m))}function c(c,e,m,o,n,t){k.info.render.vertices+=3;k.info.render.faces++;R=f(Y++);
|
|
|
-R.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?E?(L.r=M.r,L.g=M.g,L.b=M.b,b(t,o,L),H.r=Math.max(0,Math.min(n.color.r*L.r,1)),H.g=Math.max(0,Math.min(n.color.g*L.g,1)),H.b=Math.max(0,Math.min(n.color.b*L.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(B=1-n.__2near/(n.__farPlusNear-
|
|
|
-o.z*n.__farMinusNear),H.setRGB(B,B,B)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);p.appendChild(R)}function e(c,e,m,o,n,t,u){k.info.render.vertices+=
|
|
|
-4;k.info.render.faces++;R=f(Y++);R.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?H.copy(t.color):t instanceof THREE.MeshLambertMaterial?E?(L.r=M.r,L.g=M.g,L.b=M.b,b(u,n,L),H.r=Math.max(0,Math.min(t.color.r*L.r,1)),H.g=Math.max(0,Math.min(t.color.g*L.g,1)),H.b=Math.max(0,Math.min(t.color.b*L.b,1))):
|
|
|
-H.copy(t.color):t instanceof THREE.MeshDepthMaterial?(B=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),H.setRGB(B,B,B)):t instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?R.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):R.setAttribute("style","fill: "+H.getContextStyle()+
|
|
|
-"; fill-opacity: "+t.opacity);p.appendChild(R)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,w,u,x,v,A,z,y,D=new THREE.Rectangle,F=new THREE.Rectangle,E=!1,H=new THREE.Color(16777215),L=new THREE.Color(16777215),M=new THREE.Color(0),
|
|
|
-K=new THREE.Color(0),G=new THREE.Color(0),B,da=new THREE.Vector3,J=[],Q=[],R,Y,W,o=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,c){t=b;w=c;u=t/2;x=w/2;p.setAttribute("viewBox",-u+" "+-x+" "+t+" "+w);p.setAttribute("width",t);p.setAttribute("height",w);D.set(-u,-x,u,x)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};
|
|
|
-this.render=function(b,f){var h,t,w,H,L,J,B,$;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);W=Y=0;if(E=b.lights.length>0){B=b.lights;M.setRGB(0,0,0);K.setRGB(0,0,0);G.setRGB(0,0,0);h=0;for(t=B.length;h<t;h++)w=B[h],H=w.color,w instanceof THREE.AmbientLight?(M.r+=H.r,M.g+=H.g,M.b+=H.b):w instanceof THREE.DirectionalLight?(K.r+=H.r,K.g+=H.g,K.b+=H.b):w instanceof THREE.PointLight&&(G.r+=H.r,G.g+=H.g,G.b+=H.b)}h=0;for(t=m.length;h<
|
|
|
-t;h++)if(B=m[h],F.empty(),B instanceof THREE.RenderableParticle){v=B;v.x*=u;v.y*=-x;w=0;for(H=B.materials.length;w<H;)w++}else if(B instanceof THREE.RenderableLine){if(v=B.v1,A=B.v2,v.positionScreen.x*=u,v.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),D.intersects(F)){w=0;for(H=B.materials.length;w<H;)if(($=B.materials[w++])&&$.opacity!=0){L=v;J=A;var X=W++;Q[X]==null&&(Q[X]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"line"),o==0&&Q[X].setAttribute("shape-rendering","crispEdges"));R=Q[X];R.setAttribute("x1",L.positionScreen.x);R.setAttribute("y1",L.positionScreen.y);R.setAttribute("x2",J.positionScreen.x);R.setAttribute("y2",J.positionScreen.y);$ instanceof THREE.LineBasicMaterial&&(R.setAttribute("style","fill: none; stroke: "+$.color.getContextStyle()+"; stroke-width: "+$.linewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.linecap+"; stroke-linejoin: "+$.linejoin),p.appendChild(R))}}}else if(B instanceof
|
|
|
-THREE.RenderableFace3){if(v=B.v1,A=B.v2,z=B.v3,v.positionScreen.x*=u,v.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),D.intersects(F)){w=0;for(H=B.meshMaterials.length;w<H;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(J=B.faceMaterials.length;L<J;)($=B.faceMaterials[L++])&&
|
|
|
+k;Ba[1]=h<0?0:h>255?255:h;Ba[2]=b<0?0:b>255?255:b;Ba[4]=m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=c<0?0:c>255?255:c;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=e<0?0:e>255?255:e;Ba[12]=t<0?0:t>255?255:t;Ba[13]=u<0?0:u>255?255:u;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);W.drawImage(Ia,0,0);return Ga}function Ra(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,c){var e=c.x-b.x,f=c.y-b.y,k=e*e+f*f;k!=0&&(k=1/Math.sqrt(k),e*=
|
|
|
+k,f*=k,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Za,bb,sa,Ha,Qa,Xa,$a,za;this.autoClear?this.clear():v.setTransform(1,0,0,-1,u,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,p,this.sortElements);(ua=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){sa=m[Za];N.empty();if(sa instanceof THREE.RenderableParticle){K=sa;K.x*=u;K.y*=x;Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&z(K,sa,za,b)}else if(sa instanceof THREE.RenderableLine){if(K=sa.v1,H=sa.v2,
|
|
|
+K.positionScreen.x*=u,K.positionScreen.y*=x,H.positionScreen.x*=u,H.positionScreen.y*=x,N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(H.positionScreen.x,H.positionScreen.y),U.intersects(N)){Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&y(K,H,sa,za,b)}}else if(sa instanceof THREE.RenderableFace3){if(K=sa.v1,H=sa.v2,B=sa.v3,K.positionScreen.x*=u,K.positionScreen.y*=x,H.positionScreen.x*=u,H.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,
|
|
|
+sa.overdraw&&(Pa(K.positionScreen,H.positionScreen),Pa(H.positionScreen,B.positionScreen),Pa(B.positionScreen,K.positionScreen)),N.add3Points(K.positionScreen.x,K.positionScreen.y,H.positionScreen.x,H.positionScreen.y,B.positionScreen.x,B.positionScreen.y),U.intersects(N)){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&A(K,H,B,0,1,2,sa,za,b)}else za.opacity!=
|
|
|
+0&&A(K,H,B,0,1,2,sa,za,b)}}else if(sa instanceof THREE.RenderableFace4&&(K=sa.v1,H=sa.v2,B=sa.v3,ca=sa.v4,K.positionScreen.x*=u,K.positionScreen.y*=x,H.positionScreen.x*=u,H.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,ca.positionScreen.x*=u,ca.positionScreen.y*=x,J.positionScreen.copy(H.positionScreen),P.positionScreen.copy(ca.positionScreen),sa.overdraw&&(Pa(K.positionScreen,H.positionScreen),Pa(H.positionScreen,ca.positionScreen),Pa(ca.positionScreen,K.positionScreen),Pa(B.positionScreen,
|
|
|
+J.positionScreen),Pa(B.positionScreen,P.positionScreen)),N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(H.positionScreen.x,H.positionScreen.y),N.addPoint(B.positionScreen.x,B.positionScreen.y),N.addPoint(ca.positionScreen.x,ca.positionScreen.y),U.intersects(N))){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&E(K,H,B,ca,J,P,sa,za,b)}else za.opacity!=
|
|
|
+0&&E(K,H,B,ca,J,P,sa,za,b)}S.addRectangle(N)}v.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function b(b,c,e){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=c.normalWorld.dot(h.position)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m)):h instanceof THREE.PointLight&&(ca.sub(h.position,c.centroidWorld),ca.normalize(),m=c.normalWorld.dot(ca)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m))}function c(c,e,m,o,n,t){k.info.render.vertices+=3;k.info.render.faces++;Q=f(T++);
|
|
|
+Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(t,o,L),G.r=Math.max(0,Math.min(n.color.r*L.r,1)),G.g=Math.max(0,Math.min(n.color.g*L.g,1)),G.b=Math.max(0,Math.min(n.color.b*L.b,1))):G.copy(n.color):n instanceof THREE.MeshDepthMaterial?(B=1-n.__2near/(n.__farPlusNear-
|
|
|
+o.z*n.__farMinusNear),G.setRGB(B,B,B)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+n.opacity);p.appendChild(Q)}function e(c,e,m,o,n,t,u){k.info.render.vertices+=
|
|
|
+4;k.info.render.faces++;Q=f(T++);Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?G.copy(t.color):t instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(u,n,L),G.r=Math.max(0,Math.min(t.color.r*L.r,1)),G.g=Math.max(0,Math.min(t.color.g*L.g,1)),G.b=Math.max(0,Math.min(t.color.b*L.b,1))):
|
|
|
+G.copy(t.color):t instanceof THREE.MeshDepthMaterial?(B=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),G.setRGB(B,B,B)):t instanceof THREE.MeshNormalMaterial&&G.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+
|
|
|
+"; fill-opacity: "+t.opacity);p.appendChild(Q)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,w,u,x,v,A,z,y,E=new THREE.Rectangle,F=new THREE.Rectangle,D=!1,G=new THREE.Color(16777215),L=new THREE.Color(16777215),M=new THREE.Color(0),
|
|
|
+K=new THREE.Color(0),H=new THREE.Color(0),B,ca=new THREE.Vector3,J=[],P=[],Q,T,X,o=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,c){t=b;w=c;u=t/2;x=w/2;p.setAttribute("viewBox",-u+" "+-x+" "+t+" "+w);p.setAttribute("width",t);p.setAttribute("height",w);E.set(-u,-x,u,x)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};
|
|
|
+this.render=function(b,f){var h,t,w,G,L,J,B,$;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);X=T=0;if(D=b.lights.length>0){B=b.lights;M.setRGB(0,0,0);K.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(t=B.length;h<t;h++)w=B[h],G=w.color,w instanceof THREE.AmbientLight?(M.r+=G.r,M.g+=G.g,M.b+=G.b):w instanceof THREE.DirectionalLight?(K.r+=G.r,K.g+=G.g,K.b+=G.b):w instanceof THREE.PointLight&&(H.r+=G.r,H.g+=G.g,H.b+=G.b)}h=0;for(t=m.length;h<
|
|
|
+t;h++)if(B=m[h],F.empty(),B instanceof THREE.RenderableParticle){v=B;v.x*=u;v.y*=-x;w=0;for(G=B.materials.length;w<G;)w++}else if(B instanceof THREE.RenderableLine){if(v=B.v1,A=B.v2,v.positionScreen.x*=u,v.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),E.intersects(F)){w=0;for(G=B.materials.length;w<G;)if(($=B.materials[w++])&&$.opacity!=0){L=v;J=A;var Y=X++;P[Y]==null&&(P[Y]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"line"),o==0&&P[Y].setAttribute("shape-rendering","crispEdges"));Q=P[Y];Q.setAttribute("x1",L.positionScreen.x);Q.setAttribute("y1",L.positionScreen.y);Q.setAttribute("x2",J.positionScreen.x);Q.setAttribute("y2",J.positionScreen.y);$ instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: "+$.color.getContextStyle()+"; stroke-width: "+$.linewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.linecap+"; stroke-linejoin: "+$.linejoin),p.appendChild(Q))}}}else if(B instanceof
|
|
|
+THREE.RenderableFace3){if(v=B.v1,A=B.v2,z=B.v3,v.positionScreen.x*=u,v.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),E.intersects(F)){w=0;for(G=B.meshMaterials.length;w<G;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(J=B.faceMaterials.length;L<J;)($=B.faceMaterials[L++])&&
|
|
|
$.opacity!=0&&c(v,A,z,B,$,b)}else $&&$.opacity!=0&&c(v,A,z,B,$,b)}}else if(B instanceof THREE.RenderableFace4&&(v=B.v1,A=B.v2,z=B.v3,y=B.v4,v.positionScreen.x*=u,v.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),
|
|
|
-D.intersects(F))){w=0;for(H=B.meshMaterials.length;w<H;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(J=B.faceMaterials.length;L<J;)($=B.faceMaterials[L++])&&$.opacity!=0&&e(v,A,z,y,B,$,b)}else $&&$.opacity!=0&&e(v,A,z,y,B,$,b)}}};
|
|
|
+E.intersects(F))){w=0;for(G=B.meshMaterials.length;w<G;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(J=B.faceMaterials.length;L<J;)($=B.faceMaterials[L++])&&$.opacity!=0&&e(v,A,z,y,B,$,b)}else $&&$.opacity!=0&&e(v,A,z,y,B,$,b)}}};
|
|
|
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 int combine;\n#endif",
|
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
|
|
@@ -223,116 +223,116 @@ THREE.WebGLRenderer=function(b){function c(b,c,e){var f,k,h,m=b.vertices,n=m.len
|
|
|
for(f=0;f<t;f++)h=f*3,color=p[w[f][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(U)for(y in U){f=U[y];p=f.value.length;for(h=0;h<p;h++){index=w[h][1];t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[index];f.size===2?(f.array[t]=A.x,f.array[t+1]=A.y):f.size===3?f.type==="c"?(f.array[t]=A.r,f.array[t+1]=A.g,f.array[t+2]=A.b):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z):(f.array[t]=
|
|
|
A.x,f.array[t+1]=A.y,f.array[t+2]=A.z,f.array[t+3]=A.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(z)for(f=0;f<t;f++)color=p[f],h=f*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(U)for(y in U)if(f=U[y],f.__original.needsUpdate){p=f.value.length;for(h=0;h<p;h++){t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[h];f.size===2?(f.array[t]=
|
|
|
A.x,f.array[t+1]=A.y):f.size===3?f.type==="c"?(f.array[t]=A.r,f.array[t+1]=A.g,f.array[t+2]=A.b):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z,f.array[t+3]=A.w)}f.offset+=f.size}}}if(x||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,c);if(z||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,v,c);if(U)for(y in U)if(f=U[y],f.__original.needsUpdate||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
-f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,k){f.program||W.initMaterial(f,c,e,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var h=0,m=W.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,t=f.uniforms;h!=P&&(o.useProgram(h),P=h,n=!0);if(f.id!=Z)Z=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(e&&f.fog)if(t.fogColor.value=e.color,e instanceof
|
|
|
-THREE.Fog)t.fogNear.value=e.near,t.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)t.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var p,u,v=0,w=0,x=0,z,A,y,N=Fa,T=N.directional.colors,D=N.directional.positions,F=N.point.colors,E=N.point.positions,H=N.point.distances,na=0,ua=0,e=p=y=0,n=c.length;e<n;e++)if(p=c[e],u=p.color,z=p.position,A=p.intensity,y=p.distance,p instanceof THREE.AmbientLight)v+=u.r,w+=u.g,x+=u.b;else if(p instanceof
|
|
|
-THREE.DirectionalLight)y=na*3,T[y]=u.r*A,T[y+1]=u.g*A,T[y+2]=u.b*A,D[y]=z.x,D[y+1]=z.y,D[y+2]=z.z,na+=1;else if(p instanceof THREE.SpotLight)y=na*3,T[y]=u.r*A,T[y+1]=u.g*A,T[y+2]=u.b*A,u=1/z.length(),D[y]=z.x*u,D[y+1]=z.y*u,D[y+2]=z.z*u,na+=1;else if(p instanceof THREE.PointLight)p=ua*3,F[p]=u.r*A,F[p+1]=u.g*A,F[p+2]=u.b*A,E[p]=z.x,E[p+1]=z.y,E[p+2]=z.z,H[ua]=y,ua+=1;e=na*3;for(n=T.length;e<n;e++)T[e]=0;e=ua*3;for(n=F.length;e<n;e++)F[e]=0;N.point.length=ua;N.directional.length=na;N.ambient[0]=v;
|
|
|
+f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,k){f.program||X.initMaterial(f,c,e,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(X.maxMorphTargets);for(var h=0,m=X.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,t=f.uniforms;h!=V&&(o.useProgram(h),V=h,n=!0);if(f.id!=ha)ha=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(e&&f.fog)if(t.fogColor.value=e.color,e instanceof
|
|
|
+THREE.Fog)t.fogNear.value=e.near,t.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)t.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var p,u,v=0,w=0,x=0,z,A,y,N=Fa,S=N.directional.colors,E=N.directional.positions,F=N.point.colors,D=N.point.positions,G=N.point.distances,na=0,ua=0,e=p=y=0,n=c.length;e<n;e++)if(p=c[e],u=p.color,z=p.position,A=p.intensity,y=p.distance,p instanceof THREE.AmbientLight)v+=u.r,w+=u.g,x+=u.b;else if(p instanceof
|
|
|
+THREE.DirectionalLight)y=na*3,S[y]=u.r*A,S[y+1]=u.g*A,S[y+2]=u.b*A,E[y]=z.x,E[y+1]=z.y,E[y+2]=z.z,na+=1;else if(p instanceof THREE.SpotLight)y=na*3,S[y]=u.r*A,S[y+1]=u.g*A,S[y+2]=u.b*A,u=1/z.length(),E[y]=z.x*u,E[y+1]=z.y*u,E[y+2]=z.z*u,na+=1;else if(p instanceof THREE.PointLight)p=ua*3,F[p]=u.r*A,F[p+1]=u.g*A,F[p+2]=u.b*A,D[p]=z.x,D[p+1]=z.y,D[p+2]=z.z,G[ua]=y,ua+=1;e=na*3;for(n=S.length;e<n;e++)S[e]=0;e=ua*3;for(n=F.length;e<n;e++)F[e]=0;N.point.length=ua;N.directional.length=na;N.ambient[0]=v;
|
|
|
N.ambient[1]=w;N.ambient[2]=x;c=Fa;t.enableLighting.value=c.directional.length+c.point.length;t.ambientLightColor.value=c.ambient;t.directionalLightColor.value=c.directional.colors;t.directionalLightDirection.value=c.directional.positions;t.pointLightColor.value=c.point.colors;t.pointLightPosition.value=c.point.positions;t.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)t.diffuse.value=
|
|
|
f.color,t.opacity.value=f.opacity,(t.map.texture=f.map)&&t.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),t.lightMap.texture=f.lightMap,t.envMap.texture=f.envMap,t.reflectivity.value=f.reflectivity,t.refractionRatio.value=f.refractionRatio,t.combine.value=f.combine,t.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)t.diffuse.value=f.color,t.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)t.psColor.value=
|
|
|
f.color,t.opacity.value=f.opacity,t.size.value=f.size,t.scale.value=U.height/2,t.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)t.ambient.value=f.ambient,t.specular.value=f.specular,t.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)t.mNear.value=b.near,t.mFar.value=b.far,t.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)t.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&t.shadowMatrix){for(c=0;c<pa.length;c++)t.shadowMatrix.value[c]=
|
|
|
-pa[c],t.shadowMap.texture[c]=W.shadowMap[c];t.shadowDarkness.value=W.shadowMapDarkness;t.shadowBias.value=W.shadowMapBias}c=f.uniformsList;t=0;for(e=c.length;t<e;t++)if(w=h.uniforms[c[t][1]])if(v=c[t][0],x=v.type,n=v.value,x=="i")o.uniform1i(w,n);else if(x=="f")o.uniform1f(w,n);else if(x=="v2")o.uniform2f(w,n.x,n.y);else if(x=="v3")o.uniform3f(w,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(w,n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(w,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(w,n);else if(x=="fv")o.uniform3fv(w,
|
|
|
+pa[c],t.shadowMap.texture[c]=X.shadowMap[c];t.shadowDarkness.value=X.shadowMapDarkness;t.shadowBias.value=X.shadowMapBias}c=f.uniformsList;t=0;for(e=c.length;t<e;t++)if(w=h.uniforms[c[t][1]])if(v=c[t][0],x=v.type,n=v.value,x=="i")o.uniform1i(w,n);else if(x=="f")o.uniform1f(w,n);else if(x=="v2")o.uniform2f(w,n.x,n.y);else if(x=="v3")o.uniform3f(w,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(w,n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(w,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(w,n);else if(x=="fv")o.uniform3fv(w,
|
|
|
n);else if(x=="v3v"){if(!v._array)v._array=new Float32Array(3*n.length);x=0;for(z=n.length;x<z;x++)N=x*3,v._array[N]=n[x].x,v._array[N+1]=n[x].y,v._array[N+2]=n[x].z;o.uniform3fv(w,v._array)}else if(x=="m4"){if(!v._array)v._array=new Float32Array(16);n.flattenToArray(v._array);o.uniformMatrix4fv(w,!1,v._array)}else if(x=="m4v"){if(!v._array)v._array=new Float32Array(16*n.length);x=0;for(z=n.length;x<z;x++)n[x].flattenToArrayOffset(v._array,x*16);o.uniformMatrix4fv(w,!1,v._array)}else if(x=="t"){if(o.uniform1i(w,
|
|
|
-n),w=v.texture)if(w.image instanceof Array&&w.image.length==6){if(v=w,v.image.length==6)if(v.needsUpdate){if(!v.image.__webglTextureCube)v.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,v.image[n]);G(o.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else w instanceof
|
|
|
+n),w=v.texture)if(w.image instanceof Array&&w.image.length==6){if(v=w,v.image.length==6)if(v.needsUpdate){if(!v.image.__webglTextureCube)v.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,v.image[n]);H(o.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else w instanceof
|
|
|
THREE.WebGLRenderTargetCube?(v=w,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.__webglTexture)):B(w,n)}else if(x=="tv"){if(!v._array){v._array=[];x=0;for(z=v.texture.length;x<z;x++)v._array[x]=n+x}o.uniform1iv(w,v._array);x=0;for(z=v.texture.length;x<z;x++)(w=v.texture[x])&&B(w,v._array[x])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
|
|
|
THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Aa);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Aa),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,k.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&
|
|
|
-m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=ia&&(ia=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),
|
|
|
+m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=ka&&(ka=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),
|
|
|
o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var t=0,p=m.morphTargetForcedOrder,u=m.morphTargetInfluences;t<k.numSupportedMorphTargets&&t<p.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[t]]),o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[t]=u[p[t]],t++;else{var p=[],v=-1,
|
|
|
w=0,u=m.morphTargetInfluences,x,z=u.length,t=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);t<k.numSupportedMorphTargets;){for(x=0;x<z;x++)!p[x]&&u[x]>v&&(w=x,v=u[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[t]=v;p[w]=1;v=-1;t++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=
|
|
|
0&&(f=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,
|
|
|
o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,
|
|
|
-o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):
|
|
|
-m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}}function h(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
+o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),X.info.render.calls++,X.info.render.vertices+=h.__webglFaceCount,X.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),X.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),X.info.render.calls++):
|
|
|
+m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),X.info.render.calls++)}}function h(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,k,m,n,t,p,u,v,w,x=b.count*3;for(w=0;w<x;w+=9)e=b.normalArray,f=e[w],h=e[w+1],k=e[w+2],m=e[w+3],t=e[w+4],u=e[w+5],n=e[w+6],p=e[w+7],v=e[w+8],f=(f+m+n)/3,h=(h+t+p)/3,k=(k+u+v)/3,e[w]=f,e[w+1]=h,e[w+2]=k,e[w+3]=f,e[w+4]=h,e[w+5]=k,e[w+6]=f,e[w+7]=h,e[w+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(c.attributes.normal);o.vertexAttribPointer(c.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
|
|
|
-0,b.count);b.count=0}function k(b){if(ka!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ka=b.doubleSided;if(fa!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),fa=b.flipSided}function m(b){$!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),$=b)}function n(b){X!=b&&(o.depthMask(b),X=b)}function p(b,c,e){ga!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ga=b);if(b&&(la!=c||ra!=e))o.polygonOffset(c,e),la=c,ra=e}function t(b){va[0].set(b.n41-
|
|
|
+0,b.count);b.count=0}function k(b){if(ma!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ma=b.doubleSided;if(ea!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ea=b.flipSided}function m(b){$!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),$=b)}function n(b){Y!=b&&(o.depthMask(b),Y=b)}function p(b,c,e){fa!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),fa=b);if(b&&(ia!=c||ra!=e))o.polygonOffset(c,e),ia=c,ra=e}function t(b){va[0].set(b.n41-
|
|
|
b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);va[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);va[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);va[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);va[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);va[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=va[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function w(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
|
|
|
Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=va[f].x*c.n14+va[f].y*c.n24+va[f].z*c.n34+va[f].w,b<=e)return!1;return!0}function u(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?u(k,e):u(h,e)}function v(b){var c,e,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(c=k.materials[b],c instanceof THREE.MeshFaceMaterial){c=
|
|
|
-0;for(e=m.materials.length;c<e;c++)(h=m.materials[c])&&(h.transparent?u(o,h):u(n,h))}else(h=c)&&(h.transparent?u(o,h):u(n,h))}function A(b,c){return c.z-b.z}function z(b){var c,n,p,u=0,v,x,z,y,U=b.lights;wa||(wa=new THREE.PerspectiveCamera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=U.length;c<n;c++)if(p=U[c],p instanceof THREE.SpotLight&&p.castShadow){Z=-1;W.shadowMap[u]||(W.shadowMap[u]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,
|
|
|
-{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[u]||(pa[u]=new THREE.Matrix4);v=W.shadowMap[u];x=pa[u];wa.position.copy(p.position);wa.lookAt(p.target.position);wa.update(void 0,!0);b.update(void 0,!1,wa);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(wa.projectionMatrix);x.multiplySelf(wa.matrixWorldInverse);wa.matrixWorldInverse.flattenToArray(Aa);wa.projectionMatrix.flattenToArray(Ea);ta.multiply(wa.projectionMatrix,wa.matrixWorldInverse);
|
|
|
-t(ta);W.initWebGLObjects(b);da(v);o.clearColor(1,1,1,1);W.clear();o.clearColor(ha.r,ha.g,ha.b,ja);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)z=b.__webglObjects[v],y=z.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||w(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),D(y,wa,!1),z.render=!0):z.render=!1:z.render=!1;m(!0);K(THREE.NormalBlending);for(v=0;v<x;v++)if(z=b.__webglObjects[v],z.render)y=z.object,buffer=z.buffer,k(y),z=y.customDepthMaterial?
|
|
|
-y.customDepthMaterial:y.geometry.morphTargets.length?Ka:Da,f(wa,U,null,z,buffer,y);for(v=0;v<p;v++)z=b.__webglObjectsImmediate[v],y=z.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),D(y,wa,!1),k(y),program=e(wa,U,null,Da,y),y.immediateRenderCallback?y.immediateRenderCallback(program,o,va):y.render(function(b){h(b,program,Da.shading)}));u++}}function y(b,c){var e,f,h;e=V.attributes;var k=V.uniforms,m=qa/oa,n,t=[],p=oa*0.5,u=qa*0.5,v=!0;o.useProgram(V.program);
|
|
|
-P=V.program;ia=$=ca=-1;Ja||(o.enableVertexAttribArray(V.attributes.position),o.enableVertexAttribArray(V.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.vertexAttribPointer(e.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(e.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);e=0;for(f=b.__webglSprites.length;e<
|
|
|
+0;for(e=m.materials.length;c<e;c++)(h=m.materials[c])&&(h.transparent?u(o,h):u(n,h))}else(h=c)&&(h.transparent?u(o,h):u(n,h))}function A(b,c){return c.z-b.z}function z(b){var c,n,p,u=0,v,x,z,y,U=b.lights;wa||(wa=new THREE.PerspectiveCamera(X.shadowCameraFov,X.shadowMapWidth/X.shadowMapHeight,X.shadowCameraNear,X.shadowCameraFar));c=0;for(n=U.length;c<n;c++)if(p=U[c],p instanceof THREE.SpotLight&&p.castShadow){ha=-1;X.shadowMap[u]||(X.shadowMap[u]=new THREE.WebGLRenderTarget(X.shadowMapWidth,X.shadowMapHeight,
|
|
|
+{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[u]||(pa[u]=new THREE.Matrix4);v=X.shadowMap[u];x=pa[u];wa.position.copy(p.position);wa.lookAt(p.target.position);wa.update(void 0,!0);b.update(void 0,!1,wa);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(wa.projectionMatrix);x.multiplySelf(wa.matrixWorldInverse);wa.matrixWorldInverse.flattenToArray(Aa);wa.projectionMatrix.flattenToArray(Ea);ta.multiply(wa.projectionMatrix,wa.matrixWorldInverse);
|
|
|
+t(ta);X.initWebGLObjects(b);ca(v);o.clearColor(1,1,1,1);X.clear();o.clearColor(ga.r,ga.g,ga.b,ja);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)z=b.__webglObjects[v],y=z.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||w(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),E(y,wa,!1),z.render=!0):z.render=!1:z.render=!1;m(!0);K(THREE.NormalBlending);for(v=0;v<x;v++)if(z=b.__webglObjects[v],z.render)y=z.object,buffer=z.buffer,k(y),z=y.customDepthMaterial?
|
|
|
+y.customDepthMaterial:y.geometry.morphTargets.length?Ka:Da,f(wa,U,null,z,buffer,y);for(v=0;v<p;v++)z=b.__webglObjectsImmediate[v],y=z.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),E(y,wa,!1),k(y),program=e(wa,U,null,Da,y),y.immediateRenderCallback?y.immediateRenderCallback(program,o,va):y.render(function(b){h(b,program,Da.shading)}));u++}}function y(b,c){var e,f,h;e=W.attributes;var k=W.uniforms,m=qa/oa,n,t=[],p=oa*0.5,u=qa*0.5,v=!0;o.useProgram(W.program);
|
|
|
+V=W.program;ka=$=Z=-1;Ja||(o.enableVertexAttribArray(W.attributes.position),o.enableVertexAttribArray(W.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);o.vertexAttribPointer(e.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(e.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);e=0;for(f=b.__webglSprites.length;e<
|
|
|
f;e++)if(h=b.__webglSprites[e],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(A);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-p)/p,(u-h.position.y)/
|
|
|
u,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?qa:1),t[0]=n*m*h.scale.x,t[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,
|
|
|
-h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),K(h.blending),B(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(X)}function D(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
-function F(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function E(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function H(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function L(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}
|
|
|
+h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),K(h.blending),B(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(Y)}function E(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
+function F(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function D(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function G(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function L(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}
|
|
|
var e,f,h,k,m,n,o,t,p={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=c(n),p[o]==void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:u}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],
|
|
|
-materials:n,vertices:0,numMorphTargets:u})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=aa++,b.geometryGroupsList.push(b.geometryGroups[v])}function M(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=ca){switch(b){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)}ca=b}}function G(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,Y(c.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,Y(c.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Y(c.magFilter)),
|
|
|
-o.texParameteri(b,o.TEXTURE_MIN_FILTER,Y(c.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,R(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,R(c.minFilter)))}function B(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+c);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof
|
|
|
-THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(b.format),b.image.width,b.image.height,0,Y(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);G(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function da(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;
|
|
|
-b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(c){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);G(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var e=0;e<6;e++)b.__webglFramebuffer[e]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,Y(b.format),b.width,b.height,0,Y(b.format),Y(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),G(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,Y(b.format),
|
|
|
-b.width,b.height,0,Y(b.format),Y(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(e=0;e<6;++e)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[e]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+e,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,
|
|
|
+materials:n,vertices:0,numMorphTargets:u})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=aa++,b.geometryGroupsList.push(b.geometryGroups[v])}function M(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=Z){switch(b){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)}Z=b}}function H(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,T(c.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,T(c.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,T(c.magFilter)),
|
|
|
+o.texParameteri(b,o.TEXTURE_MIN_FILTER,T(c.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Q(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,Q(c.minFilter)))}function B(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),X.info.memory.textures++;o.activeTexture(o.TEXTURE0+c);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof
|
|
|
+THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,T(b.format),b.image.width,b.image.height,0,T(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);H(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function ca(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;
|
|
|
+b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(c){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);H(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var e=0;e<6;e++)b.__webglFramebuffer[e]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,T(b.format),b.width,b.height,0,T(b.format),T(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),H(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,T(b.format),
|
|
|
+b.width,b.height,0,T(b.format),T(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(e=0;e<6;++e)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[e]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+e,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,
|
|
|
o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):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,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);c?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,
|
|
|
-null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height,h=f=0):(c=null,e=oa,b=qa,f=na,h=O);c!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,c),o.viewport(f,h,e,b),ma=c)}function J(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),
|
|
|
-o.bindTexture(o.TEXTURE_2D,null))}function Q(b,c){var e;b=="fragment"?e=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(e=o.createShader(o.VERTEX_SHADER));o.shaderSource(e,c);o.compileShader(e);if(!o.getShaderParameter(e,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(e)),console.error(c),null;return e}function R(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Y(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;
|
|
|
+null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height,h=f=0):(c=null,e=oa,b=qa,f=na,h=O);c!=la&&(o.bindFramebuffer(o.FRAMEBUFFER,c),o.viewport(f,h,e,b),la=c)}function J(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),
|
|
|
+o.bindTexture(o.TEXTURE_2D,null))}function P(b,c){var e;b=="fragment"?e=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(e=o.createShader(o.VERTEX_SHADER));o.shaderSource(e,c);o.compileShader(e);if(!o.getShaderParameter(e,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(e)),console.error(c),null;return e}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function T(b){switch(b){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 W=this,o,ea=[],P=null,
|
|
|
-ma=null,Z=-1,ia=null,aa=0,ka=null,fa=null,ca=null,$=null,X=null,ga=null,la=null,ra=null,na=0,O=0,oa=0,qa=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ea=new Float32Array(16),Aa=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},U=b.canvas!==void 0?b.canvas:document.createElement("canvas"),T=
|
|
|
-b.stencil!==void 0?b.stencil:!0,N=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ua=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ja=b.clearAlpha!==void 0?b.clearAlpha:0,ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=U;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
|
|
|
+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 X=this,o,da=[],V=null,
|
|
|
+la=null,ha=-1,ka=null,aa=0,ma=null,ea=null,Z=null,$=null,Y=null,fa=null,ia=null,ra=null,na=0,O=0,oa=0,qa=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ea=new Float32Array(16),Aa=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},U=b.canvas!==void 0?b.canvas:document.createElement("canvas"),S=
|
|
|
+b.stencil!==void 0?b.stencil:!0,N=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ua=b.antialias!==void 0?b.antialias:!1,ga=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ja=b.clearAlpha!==void 0?b.clearAlpha:0,ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=U;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
|
|
|
!0;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=!0;var wa,pa=[],b=THREE.ShaderLib.depthRGBA,Ia=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia}),Ka=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
|
|
|
-uniforms:Ia,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=U.getContext("experimental-webgl",{antialias:ua,stencil:T,preserveDrawingBuffer:N})))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(Ba){console.error(Ba)}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(ha.r,ha.g,ha.b,ja);this.context=o;var Ga=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);T=0;V.vertices[T++]=-1;V.vertices[T++]=-1;V.vertices[T++]=0;V.vertices[T++]=1;V.vertices[T++]=1;V.vertices[T++]=-1;V.vertices[T++]=1;V.vertices[T++]=1;V.vertices[T++]=1;V.vertices[T++]=
|
|
|
-1;V.vertices[T++]=1;V.vertices[T++]=0;V.vertices[T++]=-1;V.vertices[T++]=1;V.vertices[T++]=0;T=V.vertices[T++]=0;V.faces[T++]=0;V.faces[T++]=1;V.faces[T++]=2;V.faces[T++]=0;V.faces[T++]=2;V.faces[T++]=3;V.vertexBuffer=o.createBuffer();V.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,V.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,V.faces,o.STATIC_DRAW);V.program=o.createProgram();
|
|
|
-o.attachShader(V.program,Q("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(V.program,Q("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(V.program);V.attributes={};V.uniforms={};V.attributes.position=o.getAttribLocation(V.program,"position");V.attributes.uv=o.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=o.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=o.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=o.getUniformLocation(V.program,"rotation");
|
|
|
-V.uniforms.scale=o.getUniformLocation(V.program,"scale");V.uniforms.alignment=o.getUniformLocation(V.program,"alignment");V.uniforms.color=o.getUniformLocation(V.program,"color");V.uniforms.map=o.getUniformLocation(V.program,"map");V.uniforms.opacity=o.getUniformLocation(V.program,"opacity");V.uniforms.useScreenCoordinates=o.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=o.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=o.getUniformLocation(V.program,
|
|
|
-"screenPosition");V.uniforms.modelViewMatrix=o.getUniformLocation(V.program,"modelViewMatrix");V.uniforms.projectionMatrix=o.getUniformLocation(V.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,c){U.width=b;U.height=c;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(b,c,e,f){na=b;O=c;oa=e;qa=f;o.viewport(na,O,oa,qa)};this.setScissor=function(b,c,e,f){o.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=
|
|
|
-function(b,c){ha.setHex(b);ja=c;o.clearColor(ha.r,ha.g,ha.b,ja)};this.setClearColor=function(b,c){ha.copy(b);ja=c;o.clearColor(ha.r,ha.g,ha.b,ja)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return ja};this.clear=function(b,c,e){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(c==void 0||c)f|=o.DEPTH_BUFFER_BIT;if(e==void 0||e)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,
|
|
|
+uniforms:Ia,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=U.getContext("experimental-webgl",{antialias:ua,stencil:S,preserveDrawingBuffer:N})))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(Ba){console.error(Ba)}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(ga.r,ga.g,ga.b,ja);this.context=o;var Ga=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);S=0;W.vertices[S++]=-1;W.vertices[S++]=-1;W.vertices[S++]=0;W.vertices[S++]=1;W.vertices[S++]=1;W.vertices[S++]=-1;W.vertices[S++]=1;W.vertices[S++]=1;W.vertices[S++]=1;W.vertices[S++]=
|
|
|
+1;W.vertices[S++]=1;W.vertices[S++]=0;W.vertices[S++]=-1;W.vertices[S++]=1;W.vertices[S++]=0;S=W.vertices[S++]=0;W.faces[S++]=0;W.faces[S++]=1;W.faces[S++]=2;W.faces[S++]=0;W.faces[S++]=2;W.faces[S++]=3;W.vertexBuffer=o.createBuffer();W.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,W.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,W.faces,o.STATIC_DRAW);W.program=o.createProgram();
|
|
|
+o.attachShader(W.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(W.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=o.getAttribLocation(W.program,"position");W.attributes.uv=o.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=o.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=o.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=o.getUniformLocation(W.program,"rotation");
|
|
|
+W.uniforms.scale=o.getUniformLocation(W.program,"scale");W.uniforms.alignment=o.getUniformLocation(W.program,"alignment");W.uniforms.color=o.getUniformLocation(W.program,"color");W.uniforms.map=o.getUniformLocation(W.program,"map");W.uniforms.opacity=o.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=o.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=o.getUniformLocation(W.program,"affectedByDistance");W.uniforms.screenPosition=o.getUniformLocation(W.program,
|
|
|
+"screenPosition");W.uniforms.modelViewMatrix=o.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=o.getUniformLocation(W.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,c){U.width=b;U.height=c;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(b,c,e,f){na=b;O=c;oa=e;qa=f;o.viewport(na,O,oa,qa)};this.setScissor=function(b,c,e,f){o.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=
|
|
|
+function(b,c){ga.setHex(b);ja=c;o.clearColor(ga.r,ga.g,ga.b,ja)};this.setClearColor=function(b,c){ga.copy(b);ja=c;o.clearColor(ga.r,ga.g,ga.b,ja)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return ja};this.clear=function(b,c,e){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(c==void 0||c)f|=o.DEPTH_BUFFER_BIT;if(e==void 0||e)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,
|
|
|
delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];o.deleteBuffer(c.__webglVertexBuffer);o.deleteBuffer(c.__webglNormalBuffer);o.deleteBuffer(c.__webglTangentBuffer);o.deleteBuffer(c.__webglColorBuffer);o.deleteBuffer(c.__webglUVBuffer);o.deleteBuffer(c.__webglUV2Buffer);o.deleteBuffer(c.__webglSkinVertexABuffer);o.deleteBuffer(c.__webglSkinVertexBBuffer);o.deleteBuffer(c.__webglSkinIndicesBuffer);
|
|
|
-o.deleteBuffer(c.__webglSkinWeightsBuffer);o.deleteBuffer(c.__webglFaceBuffer);o.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)o.deleteBuffer(c.__webglMorphTargetsBuffers[e]);W.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
|
|
|
-W.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),W.info.memory.textures--};this.initMaterial=function(b,c,e,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
|
|
|
+o.deleteBuffer(c.__webglSkinWeightsBuffer);o.deleteBuffer(c.__webglFaceBuffer);o.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)o.deleteBuffer(c.__webglMorphTargetsBuffers[e]);X.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),X.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
|
|
|
+X.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),X.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),X.info.memory.textures--};this.initMaterial=function(b,c,e,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
|
|
|
b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var t=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(t.uniforms);b.vertexShader=t.vertexShader;b.fragmentShader=t.fragmentShader}var p,u,v;p=v=t=0;for(u=c.length;p<u;p++)m=c[p],m instanceof THREE.SpotLight&&v++,m instanceof THREE.DirectionalLight&&v++,m instanceof THREE.PointLight&&
|
|
|
t++;t+v<=ya?p=v:(p=Math.ceil(ya*v/(t+v)),t=ya-p);m={directional:p,point:t};t=v=0;for(p=c.length;t<p;t++)u=c[t],u instanceof THREE.SpotLight&&u.castShadow&&v++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{p=b.fragmentShader;u=b.vertexShader;var t=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
|
-maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:v,alphaTest:b.alphaTest},y,f=[];n?f.push(n):(f.push(p),f.push(u));for(y in e)f.push(y),f.push(e[y]);n=f.join();y=0;for(f=ea.length;y<f;y++)if(ea[y].code==n){x=ea[y].program;break a}y=o.createProgram();f=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
|
|
|
+maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:v,alphaTest:b.alphaTest},z,f=[];n?f.push(n):(f.push(p),f.push(u));for(z in e)f.push(z),f.push(e[z]);n=f.join();z=0;for(f=da.length;z<f;z++)if(da[z].code==n){x=da[z].program;break a}z=o.createProgram();f=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
|
|
|
"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
m=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",
|
|
|
-e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(y,Q("fragment",m+p));o.attachShader(y,Q("vertex",f+u));o.linkProgram(y);o.getProgramParameter(y,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(y,o.VALIDATE_STATUS)+", gl error ["+
|
|
|
-o.getError()+"]");y.uniforms={};y.attributes={};var z,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(z in t)f.push(z);z=f;f=0;for(t=z.length;f<t;f++)p=z[f],y.uniforms[p]=o.getUniformLocation(y,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(z=0;z<e.maxMorphTargets;z++)f.push("morphTarget"+z);for(x in c)f.push(x);
|
|
|
-x=f;z=0;for(c=x.length;z<c;z++)e=x[z],y.attributes[e]=o.getAttribLocation(y,e);y.id=ea.length;ea.push({program:y,code:n});W.info.memory.programs=ea.length;x=y}b.program=x;x=b.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);b.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(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)z="morphTarget"+k,x[z]>=0&&(o.enableVertexAttribArray(x[z]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){da(b);
|
|
|
-this.clear(c,e,f)};this.render=function(b,c,u,U){var N,T,F,E,H,na,B,G,ua=b.lights,L=b.fog;Z=-1;this.shadowMapEnabled&&z(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);t(ta);this.initWebGLObjects(b);da(u);(this.autoClear||U)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
-H=b.__webglObjects.length;for(U=0;U<H;U++)if(N=b.__webglObjects[U],B=N.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),D(B,c,!0),v(N),N.render=!0,this.sortObjects)N.object.renderDepth?N.z=N.object.renderDepth:(Ca.copy(B.position),ta.multiplyVector3(Ca),N.z=Ca.z)}else N.render=!1;else N.render=!1;this.sortObjects&&b.__webglObjects.sort(A);na=b.__webglObjectsImmediate.length;for(U=0;U<na;U++)N=b.__webglObjectsImmediate[U],
|
|
|
-B=N.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),D(B,c,!0),x(N));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(U=0;U<H;U++)if(N=b.__webglObjects[U],N.render)B=N.object,G=N.buffer,k(B),f(c,ua,L,b.overrideMaterial,G,B);for(U=0;U<na;U++)N=b.__webglObjectsImmediate[U],B=N.object,B.visible&&(k(B),T=e(c,ua,L,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,va):B.render(function(b){h(b,T,
|
|
|
-Da.shading)}))}else{K(THREE.NormalBlending);for(U=H-1;U>=0;U--)if(N=b.__webglObjects[U],N.render){B=N.object;G=N.buffer;F=N.opaque;k(B);for(N=0;N<F.count;N++)E=F.list[N],m(E.depthTest),n(E.depthWrite),p(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,ua,L,E,G,B)}for(U=0;U<na;U++)if(N=b.__webglObjectsImmediate[U],B=N.object,B.visible){F=N.opaque;k(B);for(N=0;N<F.count;N++)E=F.list[N],m(E.depthTest),n(E.depthWrite),p(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),T=e(c,
|
|
|
-ua,L,E,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,va):B.render(function(b){h(b,T,Da.shading)})}for(U=0;U<H;U++)if(N=b.__webglObjects[U],N.render){B=N.object;G=N.buffer;F=N.transparent;k(B);for(N=0;N<F.count;N++)E=F.list[N],K(E.blending),m(E.depthTest),n(E.depthWrite),p(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,ua,L,E,G,B)}for(U=0;U<na;U++)if(N=b.__webglObjectsImmediate[U],B=N.object,B.visible){F=N.transparent;k(B);for(N=0;N<F.count;N++)E=F.list[N],K(E.blending),
|
|
|
-m(E.depthTest),n(E.depthWrite),p(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),T=e(c,ua,L,E,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,va):B.render(function(b){h(b,T,Da.shading)})}}b.__webglSprites.length&&y(b,c);u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter&&J(u)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
|
|
|
+e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(z,P("fragment",m+p));o.attachShader(z,P("vertex",f+u));o.linkProgram(z);o.getProgramParameter(z,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(z,o.VALIDATE_STATUS)+", gl error ["+
|
|
|
+o.getError()+"]");z.uniforms={};z.attributes={};var y,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in t)f.push(y);y=f;f=0;for(t=y.length;f<t;f++)p=y[f],z.uniforms[p]=o.getUniformLocation(z,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<e.maxMorphTargets;y++)f.push("morphTarget"+y);for(x in c)f.push(x);
|
|
|
+x=f;y=0;for(c=x.length;y<c;y++)e=x[y],z.attributes[e]=o.getAttribLocation(z,e);z.id=da.length;da.push({program:z,code:n});X.info.memory.programs=da.length;x=z}b.program=x;x=b.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);b.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(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)y="morphTarget"+k,x[y]>=0&&(o.enableVertexAttribArray(x[y]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){ca(b);
|
|
|
+this.clear(c,e,f)};this.render=function(b,c,u,U){var N,S,F,D,G,na,B,H,ua=b.lights,L=b.fog;ha=-1;this.shadowMapEnabled&&z(b,c);X.info.render.calls=0;X.info.render.vertices=0;X.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);t(ta);this.initWebGLObjects(b);ca(u);(this.autoClear||U)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
+G=b.__webglObjects.length;for(U=0;U<G;U++)if(N=b.__webglObjects[U],B=N.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),v(N),N.render=!0,this.sortObjects)N.object.renderDepth?N.z=N.object.renderDepth:(Ca.copy(B.position),ta.multiplyVector3(Ca),N.z=Ca.z)}else N.render=!1;else N.render=!1;this.sortObjects&&b.__webglObjects.sort(A);na=b.__webglObjectsImmediate.length;for(U=0;U<na;U++)N=b.__webglObjectsImmediate[U],
|
|
|
+B=N.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),x(N));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(U=0;U<G;U++)if(N=b.__webglObjects[U],N.render)B=N.object,H=N.buffer,k(B),f(c,ua,L,b.overrideMaterial,H,B);for(U=0;U<na;U++)N=b.__webglObjectsImmediate[U],B=N.object,B.visible&&(k(B),S=e(c,ua,L,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(S,o,va):B.render(function(b){h(b,S,
|
|
|
+Da.shading)}))}else{K(THREE.NormalBlending);for(U=G-1;U>=0;U--)if(N=b.__webglObjects[U],N.render){B=N.object;H=N.buffer;F=N.opaque;k(B);for(N=0;N<F.count;N++)D=F.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,L,D,H,B)}for(U=0;U<na;U++)if(N=b.__webglObjectsImmediate[U],B=N.object,B.visible){F=N.opaque;k(B);for(N=0;N<F.count;N++)D=F.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),S=e(c,
|
|
|
+ua,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(S,o,va):B.render(function(b){h(b,S,Da.shading)})}for(U=0;U<G;U++)if(N=b.__webglObjects[U],N.render){B=N.object;H=N.buffer;F=N.transparent;k(B);for(N=0;N<F.count;N++)D=F.list[N],K(D.blending),m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,L,D,H,B)}for(U=0;U<na;U++)if(N=b.__webglObjectsImmediate[U],B=N.object,B.visible){F=N.transparent;k(B);for(N=0;N<F.count;N++)D=F.list[N],K(D.blending),
|
|
|
+m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),S=e(c,ua,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(S,o,va):B.render(function(b){h(b,S,Da.shading)})}}b.__webglSprites.length&&y(b,c);u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter&&J(u)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
|
|
|
f=b,h=void 0,k=void 0,m=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)for(h in k=e.geometry,k.geometryGroups==void 0&&L(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;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){var t=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];t=0;for(p=n.numMorphTargets;t<
|
|
|
-p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,u=void 0,v=void 0,x=void 0,w=x=void 0,y=void 0,z=void 0,U=z=t=0,N=x=v=void 0,x=p=N=v=u=void 0,w=n.geometry,y=w.faces,N=m.faces,u=0,v=N.length;u<v;u++)x=N[u],x=y[x],x instanceof THREE.Face3?(t+=3,z+=1,U+=3):x instanceof THREE.Face4&&(t+=4,z+=2,U+=4);for(var u=m,v=n,A=N=y=void 0,T=void 0,A=void 0,x=[],y=0,N=v.materials.length;y<N;y++)if(A=v.materials[y],A instanceof THREE.MeshFaceMaterial){A=0;for(l=u.materials.length;A<
|
|
|
-l;A++)(T=u.materials[A])&&x.push(T)}else(T=A)&&x.push(T);u=x;m.__materials=u;a:{y=v=void 0;N=u.length;for(v=0;v<N;v++)if(y=u[v],y.map||y.lightMap||y instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{N=y=void 0;x=u.length;for(y=0;y<x;y++)if(N=u[y],!(N instanceof THREE.MeshBasicMaterial&&!N.envMap||N instanceof THREE.MeshDepthMaterial)){N=N&&N.shading!=void 0&&N.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}N=!1}a:{x=y=void 0;A=u.length;for(y=0;y<A;y++)if(x=u[y],x.vertexColors){x=
|
|
|
-x.vertexColors;break a}x=!1}m.__vertexArray=new Float32Array(t*3);if(N)m.__normalArray=new Float32Array(t*3);if(w.hasTangents)m.__tangentArray=new Float32Array(t*4);if(x)m.__colorArray=new Float32Array(t*3);if(v){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(t*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=
|
|
|
-new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(U*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(y=m.numMorphTargets;w<y;w++)m.__morphTargetsArrays.push(new Float32Array(t*3))}m.__needsSmoothNormals=N==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=x;m.__normalType=N;m.__webglFaceCount=z*3+(n.geometry.edgeFaces?
|
|
|
-n.geometry.edgeFaces.length*6:0);m.__webglLineCount=U*2;w=0;for(y=u.length;w<y;w++)if(v=u[w],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){x=v.attributes[a];N={};for(p in x)N[p]=x[p];if(!N.__webglInitialized||N.createUniqueBuffers)N.__webglInitialized=!0,z=1,N.type==="v2"?z=2:N.type==="v3"?z=3:N.type==="v4"?z=4:N.type==="c"&&(z=3),N.size=z,N.array=new Float32Array(t*z),N.buffer=o.createBuffer(),N.buffer.belongsToAttribute=a,x.needsUpdate=!0,
|
|
|
-N.__original=x;m.__webglCustomAttributes[a]=N}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=
|
|
|
-n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();
|
|
|
-m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=k;n=e;t=m.vertices.length;m.__vertexArray=new Float32Array(t*3);m.__colorArray=new Float32Array(t*3);m.__sortArray=[];m.__webglParticleCount=t;m.__materials=n.materials;U=z=p=void 0;p=0;for(z=n.materials.length;p<z;p++)if(U=n.materials[p],U.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in U.attributes){originalAttribute=U.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
|
|
|
+p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}X.info.memory.geometries++;for(var n=e,u=void 0,v=void 0,w=void 0,x=w=void 0,z=void 0,y=void 0,U=y=t=0,N=w=v=void 0,w=p=N=v=u=void 0,x=n.geometry,z=x.faces,N=m.faces,u=0,v=N.length;u<v;u++)w=N[u],w=z[w],w instanceof THREE.Face3?(t+=3,y+=1,U+=3):w instanceof THREE.Face4&&(t+=4,y+=2,U+=4);for(var u=m,v=n,A=N=z=void 0,S=void 0,A=void 0,w=[],z=0,N=v.materials.length;z<N;z++)if(A=v.materials[z],A instanceof THREE.MeshFaceMaterial){A=0;for(l=u.materials.length;A<
|
|
|
+l;A++)(S=u.materials[A])&&w.push(S)}else(S=A)&&w.push(S);u=w;m.__materials=u;a:{z=v=void 0;N=u.length;for(v=0;v<N;v++)if(z=u[v],z.map||z.lightMap||z instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{N=z=void 0;w=u.length;for(z=0;z<w;z++)if(N=u[z],!(N instanceof THREE.MeshBasicMaterial&&!N.envMap||N instanceof THREE.MeshDepthMaterial)){N=N&&N.shading!=void 0&&N.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}N=!1}a:{w=z=void 0;A=u.length;for(z=0;z<A;z++)if(w=u[z],w.vertexColors){w=
|
|
|
+w.vertexColors;break a}w=!1}m.__vertexArray=new Float32Array(t*3);if(N)m.__normalArray=new Float32Array(t*3);if(x.hasTangents)m.__tangentArray=new Float32Array(t*4);if(w)m.__colorArray=new Float32Array(t*3);if(v){if(x.faceUvs.length>0||x.faceVertexUvs.length>0)m.__uvArray=new Float32Array(t*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=
|
|
|
+new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(U*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];x=0;for(z=m.numMorphTargets;x<z;x++)m.__morphTargetsArrays.push(new Float32Array(t*3))}m.__needsSmoothNormals=N==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=w;m.__normalType=N;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?
|
|
|
+n.geometry.edgeFaces.length*6:0);m.__webglLineCount=U*2;x=0;for(z=u.length;x<z;x++)if(v=u[x],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){w=v.attributes[a];N={};for(p in w)N[p]=w[p];if(!N.__webglInitialized||N.createUniqueBuffers)N.__webglInitialized=!0,y=1,N.type==="v2"?y=2:N.type==="v3"?y=3:N.type==="v4"?y=4:N.type==="c"&&(y=3),N.size=y,N.array=new Float32Array(t*y),N.buffer=o.createBuffer(),N.buffer.belongsToAttribute=a,w.needsUpdate=!0,
|
|
|
+N.__original=w;m.__webglCustomAttributes[a]=N}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),X.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=
|
|
|
+n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),X.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();
|
|
|
+m.__webglColorBuffer=o.createBuffer();X.info.geometries++;m=k;n=e;t=m.vertices.length;m.__vertexArray=new Float32Array(t*3);m.__colorArray=new Float32Array(t*3);m.__sortArray=[];m.__webglParticleCount=t;m.__materials=n.materials;U=y=p=void 0;p=0;for(y=n.materials.length;p<y;p++)if(U=n.materials[p],U.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in U.attributes){originalAttribute=U.attributes[a];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(t*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=
|
|
|
!0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],M(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,M(f.__webglObjects,k,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);
|
|
|
-e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)H(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;k=void 0;for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&H(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,
|
|
|
-1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=F(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=m,z=o.DYNAMIC_DRAW,U=!h.dynamic,p.__inittedArrays){var D=u=w=void 0,B=void 0,na=D=void 0,G=void 0,ua=void 0,ja=void 0,J=T=A=x=N=y=v=void 0,ha=void 0,K=void 0,
|
|
|
-I=B=ja=B=ua=G=void 0,C=void 0,O=C=I=G=void 0,X=void 0,Q=O=C=I=D=D=na=ja=B=O=C=I=X=O=C=I=X=O=C=I=void 0,R=0,oa=0,$=0,da=0,qa=0,Y=0,P=0,ya=0,V=0,S=0,pa=0,O=I=0,O=void 0,ga=p.__vertexArray,wa=p.__uvArray,va=p.__uv2Array,la=p.__normalArray,ia=p.__tangentArray,ca=p.__colorArray,aa=p.__skinVertexAArray,Z=p.__skinVertexBArray,ea=p.__skinIndexArray,fa=p.__skinWeightArray,Da=p.__morphTargetsArrays,ka=p.__webglCustomAttributes,C=void 0,ma=p.__faceArray,ra=p.__lineArray,Ia=p.__needsSmoothNormals,y=p.__vertexColorType,
|
|
|
-v=p.__uvType,N=p.__normalType,ta=k.geometry,Ea=ta.__dirtyVertices,Ba=ta.__dirtyElements,Aa=ta.__dirtyUvs,Ga=ta.__dirtyNormals,Ka=ta.__dirtyTangents,Ca=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ja=ta.vertices,cb=p.faces,fb=ta.faces,db=ta.faceVertexUvs[0],eb=ta.faceVertexUvs[1],Sa=ta.skinVerticesA,Ta=ta.skinVerticesB,Ua=ta.skinIndices,Ma=ta.skinWeights,La=ta.morphTargets;if(ka)for(Q in ka)ka[Q].offset=0,ka[Q].offsetSrc=0;w=0;for(u=cb.length;w<u;w++)if(D=cb[w],B=fb[D],db&&(x=db[D]),eb&&(A=eb[D]),D=
|
|
|
-B.vertexNormals,na=B.normal,G=B.vertexColors,ua=B.color,ja=B.vertexTangents,B instanceof THREE.Face3){if(Ea)T=Ja[B.a].position,J=Ja[B.b].position,ha=Ja[B.c].position,ga[oa]=T.x,ga[oa+1]=T.y,ga[oa+2]=T.z,ga[oa+3]=J.x,ga[oa+4]=J.y,ga[oa+5]=J.z,ga[oa+6]=ha.x,ga[oa+7]=ha.y,ga[oa+8]=ha.z,oa+=9;if(ka)for(Q in ka)if(C=ka[Q],C.__original.needsUpdate)I=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c]):
|
|
|
-C.boundTo==="faces"?(O=C.value[O],C.array[I]=O,C.array[I+1]=O,C.array[I+2]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[O],C.array[I+1]=C.value[O+1],C.array[I+2]=C.value[O+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(T=C.value[B.a],J=C.value[B.b],ha=C.value[B.c]):C.boundTo==="faces"?(ha=J=T=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(T=C.value[O],J=C.value[O+1],ha=C.value[O+2],C.offsetSrc+=3),C.size===2?(C.array[I]=T.x,C.array[I+1]=
|
|
|
-T.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ha.x,C.array[I+5]=ha.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[I]=T.r,C.array[I+1]=T.g,C.array[I+2]=T.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ha.r,C.array[I+7]=ha.g,C.array[I+8]=ha.b):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ha.x,C.array[I+7]=ha.y,C.array[I+8]=ha.z),C.offset+=9):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=T.w,
|
|
|
-C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ha.x,C.array[I+9]=ha.y,C.array[I+10]=ha.z,C.array[I+11]=ha.w,C.offset+=12));if(Fa){I=0;for(C=La.length;I<C;I++)T=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ha=La[I].vertices[B.c].position,O=Da[I],O[pa]=T.x,O[pa+1]=T.y,O[pa+2]=T.z,O[pa+3]=J.x,O[pa+4]=J.y,O[pa+5]=J.z,O[pa+6]=ha.x,O[pa+7]=ha.y,O[pa+8]=ha.z;pa+=9}if(Ma.length)I=Ma[B.a],C=Ma[B.b],O=Ma[B.c],fa[S]=I.x,fa[S+1]=I.y,fa[S+2]=I.z,fa[S+3]=I.w,fa[S+
|
|
|
-4]=C.x,fa[S+5]=C.y,fa[S+6]=C.z,fa[S+7]=C.w,fa[S+8]=O.x,fa[S+9]=O.y,fa[S+10]=O.z,fa[S+11]=O.w,I=Ua[B.a],C=Ua[B.b],O=Ua[B.c],ea[S]=I.x,ea[S+1]=I.y,ea[S+2]=I.z,ea[S+3]=I.w,ea[S+4]=C.x,ea[S+5]=C.y,ea[S+6]=C.z,ea[S+7]=C.w,ea[S+8]=O.x,ea[S+9]=O.y,ea[S+10]=O.z,ea[S+11]=O.w,I=Sa[B.a],C=Sa[B.b],O=Sa[B.c],aa[S]=I.x,aa[S+1]=I.y,aa[S+2]=I.z,aa[S+3]=1,aa[S+4]=C.x,aa[S+5]=C.y,aa[S+6]=C.z,aa[S+7]=1,aa[S+8]=O.x,aa[S+9]=O.y,aa[S+10]=O.z,aa[S+11]=1,I=Ta[B.a],C=Ta[B.b],O=Ta[B.c],Z[S]=I.x,Z[S+1]=I.y,Z[S+2]=I.z,Z[S+3]=
|
|
|
-1,Z[S+4]=C.x,Z[S+5]=C.y,Z[S+6]=C.z,Z[S+7]=1,Z[S+8]=O.x,Z[S+9]=O.y,Z[S+10]=O.z,Z[S+11]=1,S+=12;if(Ca&&y)G.length==3&&y==THREE.VertexColors?(B=G[0],I=G[1],C=G[2]):C=I=B=ua,ca[V]=B.r,ca[V+1]=B.g,ca[V+2]=B.b,ca[V+3]=I.r,ca[V+4]=I.g,ca[V+5]=I.b,ca[V+6]=C.r,ca[V+7]=C.g,ca[V+8]=C.b,V+=9;if(Ka&&ta.hasTangents)G=ja[0],ua=ja[1],B=ja[2],ia[P]=G.x,ia[P+1]=G.y,ia[P+2]=G.z,ia[P+3]=G.w,ia[P+4]=ua.x,ia[P+5]=ua.y,ia[P+6]=ua.z,ia[P+7]=ua.w,ia[P+8]=B.x,ia[P+9]=B.y,ia[P+10]=B.z,ia[P+11]=B.w,P+=12;if(Ga&&N)if(D.length==
|
|
|
-3&&Ia)for(ja=0;ja<3;ja++)na=D[ja],la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;else for(ja=0;ja<3;ja++)la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;if(Aa&&x!==void 0&&v)for(ja=0;ja<3;ja++)D=x[ja],wa[$]=D.u,wa[$+1]=D.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<3;ja++)D=A[ja],va[da]=D.u,va[da+1]=D.v,da+=2;Ba&&(ma[qa]=R,ma[qa+1]=R+1,ma[qa+2]=R+2,qa+=3,ra[ya]=R,ra[ya+1]=R+1,ra[ya+2]=R,ra[ya+3]=R+2,ra[ya+4]=R+1,ra[ya+5]=R+2,ya+=6,R+=3)}else if(B instanceof THREE.Face4){if(Ea)T=Ja[B.a].position,J=Ja[B.b].position,
|
|
|
-ha=Ja[B.c].position,K=Ja[B.d].position,ga[oa]=T.x,ga[oa+1]=T.y,ga[oa+2]=T.z,ga[oa+3]=J.x,ga[oa+4]=J.y,ga[oa+5]=J.z,ga[oa+6]=ha.x,ga[oa+7]=ha.y,ga[oa+8]=ha.z,ga[oa+9]=K.x,ga[oa+10]=K.y,ga[oa+11]=K.z,oa+=12;if(ka)for(Q in ka)if(C=ka[Q],C.__original.needsUpdate)I=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c],C.array[I+3]=C.value[B.d]):C.boundTo==="faces"?(O=C.value[O],C.array[I]=O,C.array[I+1]=
|
|
|
-O,C.array[I+2]=O,C.array[I+3]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[O],C.array[I+1]=C.value[O+1],C.array[I+2]=C.value[O+2],C.array[I+3]=C.value[O+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(T=C.value[B.a],J=C.value[B.b],ha=C.value[B.c],K=C.value[B.d]):C.boundTo==="faces"?(K=ha=J=T=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(T=C.value[O],J=C.value[O+1],ha=C.value[O+2],K=C.value[O+3],C.offsetSrc+=4),C.size===2?(C.array[I]=T.x,
|
|
|
-C.array[I+1]=T.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ha.x,C.array[I+5]=ha.y,C.array[I+6]=K.x,C.array[I+7]=K.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[I]=T.r,C.array[I+1]=T.g,C.array[I+2]=T.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ha.r,C.array[I+7]=ha.g,C.array[I+8]=ha.b,C.array[I+9]=K.r,C.array[I+10]=K.g,C.array[I+11]=K.b):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ha.x,C.array[I+7]=ha.y,
|
|
|
-C.array[I+8]=ha.z,C.array[I+9]=K.x,C.array[I+10]=K.y,C.array[I+11]=K.z),C.offset+=12):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=T.w,C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ha.x,C.array[I+9]=ha.y,C.array[I+10]=ha.z,C.array[I+11]=ha.w,C.array[I+12]=K.x,C.array[I+13]=K.y,C.array[I+14]=K.z,C.array[I+15]=K.w,C.offset+=16));if(Fa){I=0;for(C=La.length;I<C;I++)T=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ha=La[I].vertices[B.c].position,
|
|
|
-K=La[I].vertices[B.d].position,O=Da[I],O[pa]=T.x,O[pa+1]=T.y,O[pa+2]=T.z,O[pa+3]=J.x,O[pa+4]=J.y,O[pa+5]=J.z,O[pa+6]=ha.x,O[pa+7]=ha.y,O[pa+8]=ha.z,O[pa+9]=K.x,O[pa+10]=K.y,O[pa+11]=K.z;pa+=12}if(Ma.length)I=Ma[B.a],C=Ma[B.b],O=Ma[B.c],X=Ma[B.d],fa[S]=I.x,fa[S+1]=I.y,fa[S+2]=I.z,fa[S+3]=I.w,fa[S+4]=C.x,fa[S+5]=C.y,fa[S+6]=C.z,fa[S+7]=C.w,fa[S+8]=O.x,fa[S+9]=O.y,fa[S+10]=O.z,fa[S+11]=O.w,fa[S+12]=X.x,fa[S+13]=X.y,fa[S+14]=X.z,fa[S+15]=X.w,I=Ua[B.a],C=Ua[B.b],O=Ua[B.c],X=Ua[B.d],ea[S]=I.x,ea[S+1]=I.y,
|
|
|
-ea[S+2]=I.z,ea[S+3]=I.w,ea[S+4]=C.x,ea[S+5]=C.y,ea[S+6]=C.z,ea[S+7]=C.w,ea[S+8]=O.x,ea[S+9]=O.y,ea[S+10]=O.z,ea[S+11]=O.w,ea[S+12]=X.x,ea[S+13]=X.y,ea[S+14]=X.z,ea[S+15]=X.w,I=Sa[B.a],C=Sa[B.b],O=Sa[B.c],X=Sa[B.d],aa[S]=I.x,aa[S+1]=I.y,aa[S+2]=I.z,aa[S+3]=1,aa[S+4]=C.x,aa[S+5]=C.y,aa[S+6]=C.z,aa[S+7]=1,aa[S+8]=O.x,aa[S+9]=O.y,aa[S+10]=O.z,aa[S+11]=1,aa[S+12]=X.x,aa[S+13]=X.y,aa[S+14]=X.z,aa[S+15]=1,I=Ta[B.a],C=Ta[B.b],O=Ta[B.c],B=Ta[B.d],Z[S]=I.x,Z[S+1]=I.y,Z[S+2]=I.z,Z[S+3]=1,Z[S+4]=C.x,Z[S+5]=C.y,
|
|
|
-Z[S+6]=C.z,Z[S+7]=1,Z[S+8]=O.x,Z[S+9]=O.y,Z[S+10]=O.z,Z[S+11]=1,Z[S+12]=B.x,Z[S+13]=B.y,Z[S+14]=B.z,Z[S+15]=1,S+=16;if(Ca&&y)G.length==4&&y==THREE.VertexColors?(B=G[0],I=G[1],C=G[2],G=G[3]):G=C=I=B=ua,ca[V]=B.r,ca[V+1]=B.g,ca[V+2]=B.b,ca[V+3]=I.r,ca[V+4]=I.g,ca[V+5]=I.b,ca[V+6]=C.r,ca[V+7]=C.g,ca[V+8]=C.b,ca[V+9]=G.r,ca[V+10]=G.g,ca[V+11]=G.b,V+=12;if(Ka&&ta.hasTangents)G=ja[0],ua=ja[1],B=ja[2],ja=ja[3],ia[P]=G.x,ia[P+1]=G.y,ia[P+2]=G.z,ia[P+3]=G.w,ia[P+4]=ua.x,ia[P+5]=ua.y,ia[P+6]=ua.z,ia[P+7]=ua.w,
|
|
|
-ia[P+8]=B.x,ia[P+9]=B.y,ia[P+10]=B.z,ia[P+11]=B.w,ia[P+12]=ja.x,ia[P+13]=ja.y,ia[P+14]=ja.z,ia[P+15]=ja.w,P+=16;if(Ga&&N)if(D.length==4&&Ia)for(ja=0;ja<4;ja++)na=D[ja],la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;else for(ja=0;ja<4;ja++)la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;if(Aa&&x!==void 0&&v)for(ja=0;ja<4;ja++)D=x[ja],wa[$]=D.u,wa[$+1]=D.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<4;ja++)D=A[ja],va[da]=D.u,va[da+1]=D.v,da+=2;Ba&&(ma[qa]=R,ma[qa+1]=R+1,ma[qa+2]=R+3,ma[qa+3]=R+1,ma[qa+4]=R+2,ma[qa+
|
|
|
-5]=R+3,qa+=6,ra[ya]=R,ra[ya+1]=R+1,ra[ya+2]=R,ra[ya+3]=R+3,ra[ya+4]=R+1,ra[ya+5]=R+2,ra[ya+6]=R+2,ra[ya+7]=R+3,ya+=8,R+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,z));if(ka)for(Q in ka)C=ka[Q],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,z));if(Fa){I=0;for(C=La.length;I<C;I++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[I]),o.bufferData(o.ARRAY_BUFFER,Da[I],z)}Ca&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
-p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ca,z));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,la,z));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,z));Aa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,z));Aa&&da>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,va,z));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),
|
|
|
-o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,z));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,Z,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
-fa,z));U&&(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)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;E(m)}else if(k instanceof THREE.Ribbon){h=
|
|
|
-k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=U=U=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;y=k.__vertexArray;z=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(U=0;U<v;U++)w=u[U].position,n=U*3,y[n]=w.x,y[n+1]=w.y,y[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}if(N){for(U=0;U<p;U++)color=t[U],n=U*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
|
|
|
-z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=U=U=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;y=k.__vertexArray;z=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(U=0;U<v;U++)w=u[U].position,n=U*3,y[n]=w.x,y[n+1]=w.y,y[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}if(N){for(U=0;U<p;U++)color=t[U],n=U*3,z[n]=color.r,z[n+1]=color.g,
|
|
|
-z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,p=F(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,E(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),
|
|
|
+e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)G(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;k=void 0;for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&G(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,
|
|
|
+1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=F(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=m,y=o.DYNAMIC_DRAW,U=!h.dynamic,p.__inittedArrays){var E=u=x=void 0,B=void 0,na=E=void 0,H=void 0,ua=void 0,ja=void 0,J=S=A=w=N=z=v=void 0,ga=void 0,K=void 0,
|
|
|
+I=B=ja=B=ua=H=void 0,C=void 0,O=C=I=H=void 0,Y=void 0,P=O=C=I=E=E=na=ja=B=O=C=I=Y=O=C=I=Y=O=C=I=void 0,Q=0,oa=0,$=0,ca=0,qa=0,V=0,T=0,ya=0,W=0,R=0,pa=0,O=I=0,O=void 0,fa=p.__vertexArray,wa=p.__uvArray,va=p.__uv2Array,ha=p.__normalArray,ia=p.__tangentArray,ka=p.__colorArray,Z=p.__skinVertexAArray,aa=p.__skinVertexBArray,da=p.__skinIndexArray,ea=p.__skinWeightArray,Da=p.__morphTargetsArrays,la=p.__webglCustomAttributes,C=void 0,ma=p.__faceArray,ra=p.__lineArray,Ia=p.__needsSmoothNormals,z=p.__vertexColorType,
|
|
|
+v=p.__uvType,N=p.__normalType,ta=k.geometry,Ea=ta.__dirtyVertices,Ba=ta.__dirtyElements,Aa=ta.__dirtyUvs,Ga=ta.__dirtyNormals,Ka=ta.__dirtyTangents,Ca=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ja=ta.vertices,cb=p.faces,fb=ta.faces,db=ta.faceVertexUvs[0],eb=ta.faceVertexUvs[1],Sa=ta.skinVerticesA,Ta=ta.skinVerticesB,Ua=ta.skinIndices,Ma=ta.skinWeights,La=ta.morphTargets;if(la)for(P in la)la[P].offset=0,la[P].offsetSrc=0;x=0;for(u=cb.length;x<u;x++)if(E=cb[x],B=fb[E],db&&(w=db[E]),eb&&(A=eb[E]),E=
|
|
|
+B.vertexNormals,na=B.normal,H=B.vertexColors,ua=B.color,ja=B.vertexTangents,B instanceof THREE.Face3){if(Ea)S=Ja[B.a].position,J=Ja[B.b].position,ga=Ja[B.c].position,fa[oa]=S.x,fa[oa+1]=S.y,fa[oa+2]=S.z,fa[oa+3]=J.x,fa[oa+4]=J.y,fa[oa+5]=J.z,fa[oa+6]=ga.x,fa[oa+7]=ga.y,fa[oa+8]=ga.z,oa+=9;if(la)for(P in la)if(C=la[P],C.__original.needsUpdate)I=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c]):
|
|
|
+C.boundTo==="faces"?(O=C.value[O],C.array[I]=O,C.array[I+1]=O,C.array[I+2]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[O],C.array[I+1]=C.value[O+1],C.array[I+2]=C.value[O+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(S=C.value[B.a],J=C.value[B.b],ga=C.value[B.c]):C.boundTo==="faces"?(ga=J=S=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(S=C.value[O],J=C.value[O+1],ga=C.value[O+2],C.offsetSrc+=3),C.size===2?(C.array[I]=S.x,C.array[I+1]=
|
|
|
+S.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ga.x,C.array[I+5]=ga.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[I]=S.r,C.array[I+1]=S.g,C.array[I+2]=S.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ga.r,C.array[I+7]=ga.g,C.array[I+8]=ga.b):(C.array[I]=S.x,C.array[I+1]=S.y,C.array[I+2]=S.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ga.x,C.array[I+7]=ga.y,C.array[I+8]=ga.z),C.offset+=9):(C.array[I]=S.x,C.array[I+1]=S.y,C.array[I+2]=S.z,C.array[I+3]=S.w,
|
|
|
+C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ga.x,C.array[I+9]=ga.y,C.array[I+10]=ga.z,C.array[I+11]=ga.w,C.offset+=12));if(Fa){I=0;for(C=La.length;I<C;I++)S=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ga=La[I].vertices[B.c].position,O=Da[I],O[pa]=S.x,O[pa+1]=S.y,O[pa+2]=S.z,O[pa+3]=J.x,O[pa+4]=J.y,O[pa+5]=J.z,O[pa+6]=ga.x,O[pa+7]=ga.y,O[pa+8]=ga.z;pa+=9}if(Ma.length)I=Ma[B.a],C=Ma[B.b],O=Ma[B.c],ea[R]=I.x,ea[R+1]=I.y,ea[R+2]=I.z,ea[R+3]=I.w,ea[R+
|
|
|
+4]=C.x,ea[R+5]=C.y,ea[R+6]=C.z,ea[R+7]=C.w,ea[R+8]=O.x,ea[R+9]=O.y,ea[R+10]=O.z,ea[R+11]=O.w,I=Ua[B.a],C=Ua[B.b],O=Ua[B.c],da[R]=I.x,da[R+1]=I.y,da[R+2]=I.z,da[R+3]=I.w,da[R+4]=C.x,da[R+5]=C.y,da[R+6]=C.z,da[R+7]=C.w,da[R+8]=O.x,da[R+9]=O.y,da[R+10]=O.z,da[R+11]=O.w,I=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Z[R]=I.x,Z[R+1]=I.y,Z[R+2]=I.z,Z[R+3]=1,Z[R+4]=C.x,Z[R+5]=C.y,Z[R+6]=C.z,Z[R+7]=1,Z[R+8]=O.x,Z[R+9]=O.y,Z[R+10]=O.z,Z[R+11]=1,I=Ta[B.a],C=Ta[B.b],O=Ta[B.c],aa[R]=I.x,aa[R+1]=I.y,aa[R+2]=I.z,aa[R+3]=1,aa[R+
|
|
|
+4]=C.x,aa[R+5]=C.y,aa[R+6]=C.z,aa[R+7]=1,aa[R+8]=O.x,aa[R+9]=O.y,aa[R+10]=O.z,aa[R+11]=1,R+=12;if(Ca&&z)H.length==3&&z==THREE.VertexColors?(B=H[0],I=H[1],C=H[2]):C=I=B=ua,ka[W]=B.r,ka[W+1]=B.g,ka[W+2]=B.b,ka[W+3]=I.r,ka[W+4]=I.g,ka[W+5]=I.b,ka[W+6]=C.r,ka[W+7]=C.g,ka[W+8]=C.b,W+=9;if(Ka&&ta.hasTangents)H=ja[0],ua=ja[1],B=ja[2],ia[T]=H.x,ia[T+1]=H.y,ia[T+2]=H.z,ia[T+3]=H.w,ia[T+4]=ua.x,ia[T+5]=ua.y,ia[T+6]=ua.z,ia[T+7]=ua.w,ia[T+8]=B.x,ia[T+9]=B.y,ia[T+10]=B.z,ia[T+11]=B.w,T+=12;if(Ga&&N)if(E.length==
|
|
|
+3&&Ia)for(ja=0;ja<3;ja++)na=E[ja],ha[V]=na.x,ha[V+1]=na.y,ha[V+2]=na.z,V+=3;else for(ja=0;ja<3;ja++)ha[V]=na.x,ha[V+1]=na.y,ha[V+2]=na.z,V+=3;if(Aa&&w!==void 0&&v)for(ja=0;ja<3;ja++)E=w[ja],wa[$]=E.u,wa[$+1]=E.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<3;ja++)E=A[ja],va[ca]=E.u,va[ca+1]=E.v,ca+=2;Ba&&(ma[qa]=Q,ma[qa+1]=Q+1,ma[qa+2]=Q+2,qa+=3,ra[ya]=Q,ra[ya+1]=Q+1,ra[ya+2]=Q,ra[ya+3]=Q+2,ra[ya+4]=Q+1,ra[ya+5]=Q+2,ya+=6,Q+=3)}else if(B instanceof THREE.Face4){if(Ea)S=Ja[B.a].position,J=Ja[B.b].position,
|
|
|
+ga=Ja[B.c].position,K=Ja[B.d].position,fa[oa]=S.x,fa[oa+1]=S.y,fa[oa+2]=S.z,fa[oa+3]=J.x,fa[oa+4]=J.y,fa[oa+5]=J.z,fa[oa+6]=ga.x,fa[oa+7]=ga.y,fa[oa+8]=ga.z,fa[oa+9]=K.x,fa[oa+10]=K.y,fa[oa+11]=K.z,oa+=12;if(la)for(P in la)if(C=la[P],C.__original.needsUpdate)I=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c],C.array[I+3]=C.value[B.d]):C.boundTo==="faces"?(O=C.value[O],C.array[I]=O,C.array[I+1]=
|
|
|
+O,C.array[I+2]=O,C.array[I+3]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[O],C.array[I+1]=C.value[O+1],C.array[I+2]=C.value[O+2],C.array[I+3]=C.value[O+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(S=C.value[B.a],J=C.value[B.b],ga=C.value[B.c],K=C.value[B.d]):C.boundTo==="faces"?(K=ga=J=S=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(S=C.value[O],J=C.value[O+1],ga=C.value[O+2],K=C.value[O+3],C.offsetSrc+=4),C.size===2?(C.array[I]=S.x,
|
|
|
+C.array[I+1]=S.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ga.x,C.array[I+5]=ga.y,C.array[I+6]=K.x,C.array[I+7]=K.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[I]=S.r,C.array[I+1]=S.g,C.array[I+2]=S.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ga.r,C.array[I+7]=ga.g,C.array[I+8]=ga.b,C.array[I+9]=K.r,C.array[I+10]=K.g,C.array[I+11]=K.b):(C.array[I]=S.x,C.array[I+1]=S.y,C.array[I+2]=S.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ga.x,C.array[I+7]=ga.y,
|
|
|
+C.array[I+8]=ga.z,C.array[I+9]=K.x,C.array[I+10]=K.y,C.array[I+11]=K.z),C.offset+=12):(C.array[I]=S.x,C.array[I+1]=S.y,C.array[I+2]=S.z,C.array[I+3]=S.w,C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ga.x,C.array[I+9]=ga.y,C.array[I+10]=ga.z,C.array[I+11]=ga.w,C.array[I+12]=K.x,C.array[I+13]=K.y,C.array[I+14]=K.z,C.array[I+15]=K.w,C.offset+=16));if(Fa){I=0;for(C=La.length;I<C;I++)S=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ga=La[I].vertices[B.c].position,
|
|
|
+K=La[I].vertices[B.d].position,O=Da[I],O[pa]=S.x,O[pa+1]=S.y,O[pa+2]=S.z,O[pa+3]=J.x,O[pa+4]=J.y,O[pa+5]=J.z,O[pa+6]=ga.x,O[pa+7]=ga.y,O[pa+8]=ga.z,O[pa+9]=K.x,O[pa+10]=K.y,O[pa+11]=K.z;pa+=12}if(Ma.length)I=Ma[B.a],C=Ma[B.b],O=Ma[B.c],Y=Ma[B.d],ea[R]=I.x,ea[R+1]=I.y,ea[R+2]=I.z,ea[R+3]=I.w,ea[R+4]=C.x,ea[R+5]=C.y,ea[R+6]=C.z,ea[R+7]=C.w,ea[R+8]=O.x,ea[R+9]=O.y,ea[R+10]=O.z,ea[R+11]=O.w,ea[R+12]=Y.x,ea[R+13]=Y.y,ea[R+14]=Y.z,ea[R+15]=Y.w,I=Ua[B.a],C=Ua[B.b],O=Ua[B.c],Y=Ua[B.d],da[R]=I.x,da[R+1]=I.y,
|
|
|
+da[R+2]=I.z,da[R+3]=I.w,da[R+4]=C.x,da[R+5]=C.y,da[R+6]=C.z,da[R+7]=C.w,da[R+8]=O.x,da[R+9]=O.y,da[R+10]=O.z,da[R+11]=O.w,da[R+12]=Y.x,da[R+13]=Y.y,da[R+14]=Y.z,da[R+15]=Y.w,I=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Y=Sa[B.d],Z[R]=I.x,Z[R+1]=I.y,Z[R+2]=I.z,Z[R+3]=1,Z[R+4]=C.x,Z[R+5]=C.y,Z[R+6]=C.z,Z[R+7]=1,Z[R+8]=O.x,Z[R+9]=O.y,Z[R+10]=O.z,Z[R+11]=1,Z[R+12]=Y.x,Z[R+13]=Y.y,Z[R+14]=Y.z,Z[R+15]=1,I=Ta[B.a],C=Ta[B.b],O=Ta[B.c],B=Ta[B.d],aa[R]=I.x,aa[R+1]=I.y,aa[R+2]=I.z,aa[R+3]=1,aa[R+4]=C.x,aa[R+5]=C.y,aa[R+6]=
|
|
|
+C.z,aa[R+7]=1,aa[R+8]=O.x,aa[R+9]=O.y,aa[R+10]=O.z,aa[R+11]=1,aa[R+12]=B.x,aa[R+13]=B.y,aa[R+14]=B.z,aa[R+15]=1,R+=16;if(Ca&&z)H.length==4&&z==THREE.VertexColors?(B=H[0],I=H[1],C=H[2],H=H[3]):H=C=I=B=ua,ka[W]=B.r,ka[W+1]=B.g,ka[W+2]=B.b,ka[W+3]=I.r,ka[W+4]=I.g,ka[W+5]=I.b,ka[W+6]=C.r,ka[W+7]=C.g,ka[W+8]=C.b,ka[W+9]=H.r,ka[W+10]=H.g,ka[W+11]=H.b,W+=12;if(Ka&&ta.hasTangents)H=ja[0],ua=ja[1],B=ja[2],ja=ja[3],ia[T]=H.x,ia[T+1]=H.y,ia[T+2]=H.z,ia[T+3]=H.w,ia[T+4]=ua.x,ia[T+5]=ua.y,ia[T+6]=ua.z,ia[T+7]=
|
|
|
+ua.w,ia[T+8]=B.x,ia[T+9]=B.y,ia[T+10]=B.z,ia[T+11]=B.w,ia[T+12]=ja.x,ia[T+13]=ja.y,ia[T+14]=ja.z,ia[T+15]=ja.w,T+=16;if(Ga&&N)if(E.length==4&&Ia)for(ja=0;ja<4;ja++)na=E[ja],ha[V]=na.x,ha[V+1]=na.y,ha[V+2]=na.z,V+=3;else for(ja=0;ja<4;ja++)ha[V]=na.x,ha[V+1]=na.y,ha[V+2]=na.z,V+=3;if(Aa&&w!==void 0&&v)for(ja=0;ja<4;ja++)E=w[ja],wa[$]=E.u,wa[$+1]=E.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<4;ja++)E=A[ja],va[ca]=E.u,va[ca+1]=E.v,ca+=2;Ba&&(ma[qa]=Q,ma[qa+1]=Q+1,ma[qa+2]=Q+3,ma[qa+3]=Q+1,ma[qa+4]=Q+2,ma[qa+
|
|
|
+5]=Q+3,qa+=6,ra[ya]=Q,ra[ya+1]=Q+1,ra[ya+2]=Q,ra[ya+3]=Q+3,ra[ya+4]=Q+1,ra[ya+5]=Q+2,ra[ya+6]=Q+2,ra[ya+7]=Q+3,ya+=8,Q+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,fa,y));if(la)for(P in la)C=la[P],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Fa){I=0;for(C=La.length;I<C;I++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[I]),o.bufferData(o.ARRAY_BUFFER,Da[I],y)}Ca&&W>0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
+p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ka,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ha,y));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));Aa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Aa&&ca>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,va,y));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),
|
|
|
+o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y));R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
+ea,y));U&&(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)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h=
|
|
|
+k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=U=U=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(U=0;U<v;U++)x=u[U].position,n=U*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(U=0;U<p;U++)color=t[U],n=U*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
|
|
|
+y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=U=U=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(U=0;U<v;U++)x=u[U].position,n=U*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(U=0;U<p;U++)color=t[U],n=U*3,y[n]=color.r,y[n+1]=color.g,
|
|
|
+y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,p=F(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,D(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="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 Ga}};
|
|
|
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
|
|
@@ -344,7 +344,7 @@ THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParti
|
|
|
THREE.ColorUtils={adjustHSV:function(b,c,e,f){var h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,h);h.h=THREE.ColorUtils.clamp(h.h+c,0,1);h.s=THREE.ColorUtils.clamp(h.s+e,0,1);h.v=THREE.ColorUtils.clamp(h.v+f,0,1);b.setHSV(h.h,h.s,h.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,h=b.b,k=Math.max(Math.max(e,f),h),m=Math.min(Math.min(e,f),h);if(m==k)m=e=0;else{var n=k-m,m=n/k,e=e==k?(f-h)/n:f==k?2+(h-e)/n:4+(e-f)/n;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=m;c.v=k;return c},
|
|
|
clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
THREE.GeometryUtils={merge:function(b,c){var e,f,h=b.vertices.length,k=c instanceof THREE.Mesh?c.geometry:c,m=b.vertices,n=k.vertices,p=b.faces,t=k.faces,w=b.faceVertexUvs[0],k=k.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var u=0,x=n.length;u<x;u++){var v=new THREE.Vertex(n[u].position.clone());e&&e.multiplyVector3(v.position);m.push(v)}u=0;for(x=t.length;u<x;u++){var v=t[u],A,z,y=v.vertexNormals,
|
|
|
-D=v.vertexColors;v instanceof THREE.Face3?A=new THREE.Face3(v.a+h,v.b+h,v.c+h):v instanceof THREE.Face4&&(A=new THREE.Face4(v.a+h,v.b+h,v.c+h,v.d+h));A.normal.copy(v.normal);f&&f.multiplyVector3(A.normal);m=0;for(n=y.length;m<n;m++)z=y[m].clone(),f&&f.multiplyVector3(z),A.vertexNormals.push(z);A.color.copy(v.color);m=0;for(n=D.length;m<n;m++)z=D[m],A.vertexColors.push(z.clone());A.materials=v.materials.slice();A.centroid.copy(v.centroid);e&&e.multiplyVector3(A.centroid);p.push(A)}u=0;for(x=k.length;u<
|
|
|
+E=v.vertexColors;v instanceof THREE.Face3?A=new THREE.Face3(v.a+h,v.b+h,v.c+h):v instanceof THREE.Face4&&(A=new THREE.Face4(v.a+h,v.b+h,v.c+h,v.d+h));A.normal.copy(v.normal);f&&f.multiplyVector3(A.normal);m=0;for(n=y.length;m<n;m++)z=y[m].clone(),f&&f.multiplyVector3(z),A.vertexNormals.push(z);A.color.copy(v.color);m=0;for(n=E.length;m<n;m++)z=E[m],A.vertexColors.push(z.clone());A.materials=v.materials.slice();A.centroid.copy(v.centroid);e&&e.multiplyVector3(A.centroid);p.push(A)}u=0;for(x=k.length;u<
|
|
|
x;u++){e=k[u];f=[];m=0;for(n=e.length;m<n;m++)f.push(new THREE.UV(e[m].u,e[m].v));w.push(f)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,k=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var m=new THREE.Vertex(f[b].position.clone());c.vertices.push(m)}b=0;for(e=h.length;b<e;b++){var n=h[b],p,t,w=n.vertexNormals,u=n.vertexColors;n instanceof THREE.Face3?p=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(p=new THREE.Face4(n.a,n.b,n.c,n.d));p.normal.copy(n.normal);f=0;
|
|
|
for(m=w.length;f<m;f++)t=w[f],p.vertexNormals.push(t.clone());p.color.copy(n.color);f=0;for(m=u.length;f<m;f++)t=u[f],p.vertexColors.push(t.clone());p.materials=n.materials.slice();p.centroid.copy(n.centroid);c.faces.push(p)}b=0;for(e=k.length;b<e;b++){h=k[b];p=[];f=0;for(m=h.length;f<m;f++)p.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(p)}return c},randomPointInTriangle:function(b,c,e){var f,h,k,m=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();
|
|
|
f+h>1&&(f=1-f,h=1-h);k=1-f-h;m.copy(b);m.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);m.addSelf(n);n.copy(e);n.multiplyScalar(k);m.addSelf(n);return m},randomPointInFace:function(b,c,e){var f,h,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,k);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;k=c.vertices[b.c].position;var c=c.vertices[b.d].position,
|
|
@@ -353,9 +353,9 @@ b?e(c,h-1):t[h]<b?e(h+1,f):h}return e(0,t.length-1)}var f,h,k=b.faces,m=b.vertic
|
|
|
t[h]=p}f=[];m={};for(h=0;h<c;h++)n=THREE.GeometryUtils.random()*p,n=e(n),f[h]=THREE.GeometryUtils.randomPointInFace(k[n],b,!0),m[n]?m[n]+=1:m[n]=1;return f},triangleArea:function(b,c,e){var f,h=THREE.GeometryUtils.__v1;h.sub(b,c);f=h.length();h.sub(b,e);b=h.length();h.sub(c,e);e=h.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},center:function(b){b.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*
|
|
|
(b.boundingBox.x[1]+b.boundingBox.x[0]),-0.5*(b.boundingBox.y[1]+b.boundingBox.y[0]),-0.5*(b.boundingBox.z[1]+b.boundingBox.z[0]));b.applyMatrix(c);b.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,h=new THREE.Texture(f,c);f.onload=function(){h.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return h},loadTextureCube:function(b,c,e){var f,h=[],k=new THREE.Texture(h,c),c=h.loadCount=0;for(f=b.length;c<f;++c)h[c]=new Image,h[c].onload=function(){h.loadCount+=1;if(h.loadCount==6)k.needsUpdate=!0;e&&e(this)},h[c].crossOrigin="",h[c].src=b[c];return k},getNormalMap:function(b,c){var e=function(b){var e=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
|
|
|
-b[2]*b[2]);return[b[0]/e,b[1]/e,b[2]/e]};c|=1;var f=b.width,h=b.height,k=document.createElement("canvas");k.width=f;k.height=h;var m=k.getContext("2d");m.drawImage(b,0,0);for(var n=m.getImageData(0,0,f,h).data,p=m.createImageData(f,h),t=p.data,w=0;w<f;w++)for(var u=1;u<h;u++){var x=u-1<0?h-1:u-1,v=(u+1)%h,A=w-1<0?f-1:w-1,z=(w+1)%f,y=[],D=[0,0,n[(u*f+w)*4]/255*c];y.push([-1,0,n[(u*f+A)*4]/255*c]);y.push([-1,-1,n[(x*f+A)*4]/255*c]);y.push([0,-1,n[(x*f+w)*4]/255*c]);y.push([1,-1,n[(x*f+z)*4]/255*c]);
|
|
|
-y.push([1,0,n[(u*f+z)*4]/255*c]);y.push([1,1,n[(v*f+z)*4]/255*c]);y.push([0,1,n[(v*f+w)*4]/255*c]);y.push([-1,1,n[(v*f+A)*4]/255*c]);x=[];A=y.length;for(v=0;v<A;v++){var z=y[v],F=y[(v+1)%A],z=[z[0]-D[0],z[1]-D[1],z[2]-D[2]],F=[F[0]-D[0],F[1]-D[1],F[2]-D[2]];x.push(e([z[1]*F[2]-z[2]*F[1],z[2]*F[0]-z[0]*F[2],z[0]*F[1]-z[1]*F[0]]))}y=[0,0,0];for(v=0;v<x.length;v++)y[0]+=x[v][0],y[1]+=x[v][1],y[2]+=x[v][2];y[0]/=x.length;y[1]/=x.length;y[2]/=x.length;D=(u*f+w)*4;t[D]=(y[0]+1)/2*255|0;t[D+1]=(y[1]+0.5)*
|
|
|
-255|0;t[D+2]=y[2]*255|0;t[D+3]=255}m.putImageData(p,0,0);return k}};THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,h=b.children.length;for(f=0;f<h;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
|
|
|
+b[2]*b[2]);return[b[0]/e,b[1]/e,b[2]/e]};c|=1;var f=b.width,h=b.height,k=document.createElement("canvas");k.width=f;k.height=h;var m=k.getContext("2d");m.drawImage(b,0,0);for(var n=m.getImageData(0,0,f,h).data,p=m.createImageData(f,h),t=p.data,w=0;w<f;w++)for(var u=1;u<h;u++){var x=u-1<0?h-1:u-1,v=(u+1)%h,A=w-1<0?f-1:w-1,z=(w+1)%f,y=[],E=[0,0,n[(u*f+w)*4]/255*c];y.push([-1,0,n[(u*f+A)*4]/255*c]);y.push([-1,-1,n[(x*f+A)*4]/255*c]);y.push([0,-1,n[(x*f+w)*4]/255*c]);y.push([1,-1,n[(x*f+z)*4]/255*c]);
|
|
|
+y.push([1,0,n[(u*f+z)*4]/255*c]);y.push([1,1,n[(v*f+z)*4]/255*c]);y.push([0,1,n[(v*f+w)*4]/255*c]);y.push([-1,1,n[(v*f+A)*4]/255*c]);x=[];A=y.length;for(v=0;v<A;v++){var z=y[v],F=y[(v+1)%A],z=[z[0]-E[0],z[1]-E[1],z[2]-E[2]],F=[F[0]-E[0],F[1]-E[1],F[2]-E[2]];x.push(e([z[1]*F[2]-z[2]*F[1],z[2]*F[0]-z[0]*F[2],z[0]*F[1]-z[1]*F[0]]))}y=[0,0,0];for(v=0;v<x.length;v++)y[0]+=x[v][0],y[1]+=x[v][1],y[2]+=x[v][2];y[0]/=x.length;y[1]/=x.length;y[2]/=x.length;E=(u*f+w)*4;t[E]=(y[0]+1)/2*255|0;t[E+1]=(y[1]+0.5)*
|
|
|
+255|0;t[E+2]=y[2]*255|0;t[E+3]=255}m.putImageData(p,0,0);return k}};THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,h=b.children.length;for(f=0;f<h;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
|
|
|
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,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
|
|
@@ -441,7 +441,7 @@ b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(b){sw
|
|
|
Math.PI/180;var b=this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-
|
|
|
this.verticalMin)/(Math.PI-0)+this.verticalMin;b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",e(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",e(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",
|
|
|
e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(this,this.onKeyUp),!1)};
|
|
|
-THREE.PathControls=function(b,c){function e(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,e){return function(){e.apply(b,arguments)}}function h(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),y=m.length,D=0;k=y-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<y-1;k++)D=f*n.chunks[k]/n.total,e.keys[k]={time:D,pos:m[k]};h.hierarchy[0]=
|
|
|
+THREE.PathControls=function(b,c){function e(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,e){return function(){e.apply(b,arguments)}}function h(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),y=m.length,E=0;k=y-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<y-1;k++)E=f*n.chunks[k]/n.total,e.keys[k]={time:E,pos:m[k]};h.hierarchy[0]=
|
|
|
e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function k(b,e){var c,f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}this.object=b;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 m=Math.PI*2,n=Math.PI/180;this.update=function(){var b,c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);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)*n;this.theta=this.lon*n;b=this.phi%m;this.phi=b>=0?b:b+m;b=this.verticalAngleMap.srcRange;
|
|
@@ -476,23 +476,23 @@ this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();
|
|
|
(h===this.STATE.ROTATE?n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?t=this.getMouseOnScreen(b.clientX,b.clientY):h===this.STATE.PAN&&!this.noPan&&(u=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",e(this,function(b){b.preventDefault();b.stopPropagation();if(h===this.STATE.NONE)h=b.button,h===this.STATE.ROTATE?m=n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?p=t=this.getMouseOnScreen(b.clientX,
|
|
|
b.clientY):this.noPan||(w=u=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",e(this,function(b){b.preventDefault();b.stopPropagation();h=this.STATE.NONE}),!1);window.addEventListener("keydown",e(this,function(b){if(h===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])h=this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)h=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)h=this.STATE.PAN;h!==
|
|
|
this.STATE.NONE&&(f=!0)}}),!1);window.addEventListener("keyup",e(this,function(){if(h!==this.STATE.NONE)h=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
|
|
|
-THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,p){function t(b,e,c,m,n,t,p,u){var v,x,z=f||1,A=h||1,Q=n/2,R=t/2,Y=w.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",A=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",z=k||1;var W=z+1,o=A+1;n/=z;var ea=t/A;for(x=0;x<o;x++)for(t=0;t<W;t++){var P=new THREE.Vector3;P[b]=(t*n-Q)*c;P[e]=(x*ea-R)*m;P[v]=p;w.vertices.push(new THREE.Vertex(P))}for(x=0;x<A;x++)for(t=0;t<z;t++)w.faces.push(new THREE.Face4(t+W*
|
|
|
-x+Y,t+W*(x+1)+Y,t+1+W*(x+1)+Y,t+1+W*x+Y,null,null,u)),w.faceVertexUvs[0].push([new THREE.UV(t/z,x/A),new THREE.UV(t/z,(x+1)/A),new THREE.UV((t+1)/z,(x+1)/A),new THREE.UV((t+1)/z,x/A)])}THREE.Geometry.call(this);var w=this,u=b/2,x=c/2,v=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var z in p)this.sides[z]!=void 0&&(this.sides[z]=
|
|
|
+THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,p){function t(b,e,c,m,n,t,p,u){var v,x,z=f||1,A=h||1,P=n/2,Q=t/2,T=w.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",A=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",z=k||1;var X=z+1,o=A+1;n/=z;var da=t/A;for(x=0;x<o;x++)for(t=0;t<X;t++){var V=new THREE.Vector3;V[b]=(t*n-P)*c;V[e]=(x*da-Q)*m;V[v]=p;w.vertices.push(new THREE.Vertex(V))}for(x=0;x<A;x++)for(t=0;t<z;t++)w.faces.push(new THREE.Face4(t+X*
|
|
|
+x+T,t+X*(x+1)+T,t+1+X*(x+1)+T,t+1+X*x+T,null,null,u)),w.faceVertexUvs[0].push([new THREE.UV(t/z,x/A),new THREE.UV(t/z,(x+1)/A),new THREE.UV((t+1)/z,(x+1)/A),new THREE.UV((t+1)/z,x/A)])}THREE.Geometry.call(this);var w=this,u=b/2,x=c/2,v=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var z in p)this.sides[z]!=void 0&&(this.sides[z]=
|
|
|
p[z]);this.sides.px&&t("z","y",1*n,-1,e,c,-u,this.materials[0]);this.sides.nx&&t("z","y",-1*n,-1,e,c,u,this.materials[1]);this.sides.py&&t("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&t("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&t("x","y",1*n,-1,b,c,v,this.materials[4]);this.sides.nz&&t("x","y",-1*n,-1,b,c,-v,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
THREE.CylinderGeometry=function(b,c,e,f,h,k){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,m=e/2,f=f||8,h=h||1,n,p,t=[],w=[];for(p=0;p<=h;p++){var u=[],x=[],v=p/h,A=v*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(A*Math.sin(z*Math.PI*2),-v*e+m,A*Math.cos(z*Math.PI*2))));u.push(this.vertices.length-1);x.push(new THREE.UV(z,v))}t.push(u);w.push(x)}for(p=0;p<h;p++)for(n=0;n<f;n++){var e=t[p][n],u=t[p+1][n],x=t[p+1][n+1],v=t[p][n+1],A=
|
|
|
-this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),y=this.vertices[x].position.clone().setY(0).normalize(),D=this.vertices[v].position.clone().setY(0).normalize(),F=w[p][n].clone(),E=w[p+1][n].clone(),H=w[p+1][n+1].clone(),L=w[p][n+1].clone();this.faces.push(new THREE.Face4(e,u,x,v,[A,z,y,D]));this.faceVertexUvs[0].push([F,E,H,L])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=t[0][n],u=t[0][n+
|
|
|
-1],x=this.vertices.length-1,A=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),F=w[0][n].clone(),E=w[0][n+1].clone(),H=new THREE.UV(E.u,0),this.faces.push(new THREE.Face3(e,u,x,[A,z,y])),this.faceVertexUvs[0].push([F,E,H])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=t[p][n+1],u=t[p][n],x=this.vertices.length-1,A=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),F=w[p][n+1].clone(),E=w[p][n].clone(),
|
|
|
-H=new THREE.UV(E.u,1),this.faces.push(new THREE.Face3(e,u,x,[A,z,y])),this.faceVertexUvs[0].push([F,E,H])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),y=this.vertices[x].position.clone().setY(0).normalize(),E=this.vertices[v].position.clone().setY(0).normalize(),F=w[p][n].clone(),D=w[p+1][n].clone(),G=w[p+1][n+1].clone(),L=w[p][n+1].clone();this.faces.push(new THREE.Face4(e,u,x,v,[A,z,y,E]));this.faceVertexUvs[0].push([F,D,G,L])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=t[0][n],u=t[0][n+
|
|
|
+1],x=this.vertices.length-1,A=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),F=w[0][n].clone(),D=w[0][n+1].clone(),G=new THREE.UV(D.u,0),this.faces.push(new THREE.Face3(e,u,x,[A,z,y])),this.faceVertexUvs[0].push([F,D,G])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=t[p][n+1],u=t[p][n],x=this.vertices.length-1,A=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),F=w[p][n+1].clone(),D=w[p][n].clone(),
|
|
|
+G=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,u,x,[A,z,y])),this.faceVertexUvs[0].push([F,D,G])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,h;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)h=b[e],this.addShape(h,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,e,c){e||console.log("die");return e.clone().multiplyScalar(c).addSelf(b)}function f(b,e,c){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,k=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-e.x,b.y-e.y);h.set(b.x-c.x,b.y-c.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
|
|
|
-n.copy(e).addSelf(k);o.copy(c).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return e=Math.atan2(e.y-b.y,e.x-b.x),b=Math.atan2(c.y-b.y,c.x-b.x),e>b&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(J=b.length;--J>=0;){ka=J;fa=J-1;fa<0&&(fa=b.length-
|
|
|
-1);for(var e=0,c=v+w*2,e=0;e<c;e++){var f=ea*e,h=ea*(e+1),k=ca+ka+f,m=ca+ka+h,o=k,f=ca+fa+f,h=ca+fa+h,t=m;o+=da;f+=da;h+=da;t+=da;B.faces.push(new THREE.Face4(o,f,h,t,null,null,H));H&&(o=e/c,f=(e+1)/c,h=n+p*2,k=(B.vertices[k].position.z+p)/h,m=(B.vertices[m].position.z+p)/h,B.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function k(b,e,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=da;e+=da;c+=da;B.faces.push(new THREE.Face3(b,
|
|
|
-e,c,null,null,E));if(E){var f=L.maxY,h=L.maxX,k=B.vertices[e].position.x,e=B.vertices[e].position.y,m=B.vertices[c].position.x,c=B.vertices[c].position.y;B.faceVertexUvs[0].push([new THREE.UV(B.vertices[b].position.x/h,B.vertices[b].position.y/f),new THREE.UV(k/h,e/f),new THREE.UV(m/h,c/f)])}}var n=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:p-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,A=c.bendPath,z=c.extrudePath,y,D=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,E=c.material,H=c.extrudeMaterial,L=this.shapebb;if(z)y=z.getPoints(x),v=y.length,D=!0,u=!1;u||(t=p=w=0);var M,K,G,B=this,da=this.vertices.length;A&&b.addWrapPath(A);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);A=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();K=0;for(G=x.length;K<G;K++)M=x[K],THREE.Shape.Utils.isClockWise(M)&&
|
|
|
-(x[K]=M.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(A,x);F=A;K=0;for(G=x.length;K<G;K++)M=x[K],A=A.concat(M);var J,Q,R,Y,W,o,ea=A.length,P=z.length,ma=[];J=0;Q=F.length;ka=Q-1;for(fa=J+1;J<Q;J++,ka++,fa++)ka==Q&&(ka=0),fa==Q&&(fa=0),ma[J]=f(F[J],F[ka],F[fa]);var Z=[],ia,aa=ma.concat();K=0;for(G=x.length;K<G;K++){M=x[K];ia=[];J=0;Q=M.length;ka=Q-1;for(fa=J+1;J<Q;J++,ka++,fa++)ka==Q&&(ka=0),fa==Q&&(fa=0),ia[J]=f(M[J],M[ka],M[fa]);Z.push(ia);aa=aa.concat(ia)}for(R=0;R<w;R++){Y=R/w;W=p*(1-Y);
|
|
|
-Y=t*Math.sin(Y*Math.PI/2);J=0;for(Q=F.length;J<Q;J++)o=e(F[J],ma[J],Y),k(o.x,o.y,-W);K=0;for(G=x.length;K<G;K++){M=x[K];ia=Z[K];J=0;for(Q=M.length;J<Q;J++)o=e(M[J],ia[J],Y),k(o.x,o.y,-W)}}Y=t;for(J=0;J<ea;J++)o=u?e(A[J],aa[J],Y):A[J],D?k(o.x,o.y+y[0].y,y[0].x):k(o.x,o.y,0);for(R=1;R<=v;R++)for(J=0;J<ea;J++)o=u?e(A[J],aa[J],Y):A[J],D?k(o.x,o.y+y[R-1].y,y[R-1].x):k(o.x,o.y,n/v*R);for(R=w-1;R>=0;R--){Y=R/w;W=p*(1-Y);Y=t*Math.sin(Y*Math.PI/2);J=0;for(Q=F.length;J<Q;J++)o=e(F[J],ma[J],Y),k(o.x,o.y,n+W);
|
|
|
-K=0;for(G=x.length;K<G;K++){M=x[K];ia=Z[K];J=0;for(Q=M.length;J<Q;J++)o=e(M[J],ia[J],Y),D?k(o.x,o.y+y[v-1].y,y[v-1].x+W):k(o.x,o.y,n+W)}}if(u){u=ea*0;for(J=0;J<P;J++)t=z[J],m(t[2]+u,t[1]+u,t[0]+u);u=ea*(v+w*2);for(J=0;J<P;J++)t=z[J],m(t[0]+u,t[1]+u,t[2]+u)}else{for(J=0;J<P;J++)t=z[J],m(t[2],t[1],t[0]);for(J=0;J<P;J++)t=z[J],m(t[0]+ea*v,t[1]+ea*v,t[2]+ea*v)}var ka,fa,ca=0;h(F);ca+=F.length;K=0;for(G=x.length;K<G;K++)M=x[K],h(M),ca+=M.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
+n.copy(e).addSelf(k);o.copy(c).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return e=Math.atan2(e.y-b.y,e.x-b.x),b=Math.atan2(c.y-b.y,c.x-b.x),e>b&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(J=b.length;--J>=0;){ma=J;ea=J-1;ea<0&&(ea=b.length-
|
|
|
+1);for(var e=0,c=v+w*2,e=0;e<c;e++){var f=da*e,h=da*(e+1),k=Z+ma+f,m=Z+ma+h,o=k,f=Z+ea+f,h=Z+ea+h,t=m;o+=ca;f+=ca;h+=ca;t+=ca;B.faces.push(new THREE.Face4(o,f,h,t,null,null,G));G&&(o=e/c,f=(e+1)/c,h=n+p*2,k=(B.vertices[k].position.z+p)/h,m=(B.vertices[m].position.z+p)/h,B.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function k(b,e,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=ca;e+=ca;c+=ca;B.faces.push(new THREE.Face3(b,
|
|
|
+e,c,null,null,D));if(D){var f=L.maxY,h=L.maxX,k=B.vertices[e].position.x,e=B.vertices[e].position.y,m=B.vertices[c].position.x,c=B.vertices[c].position.y;B.faceVertexUvs[0].push([new THREE.UV(B.vertices[b].position.x/h,B.vertices[b].position.y/f),new THREE.UV(k/h,e/f),new THREE.UV(m/h,c/f)])}}var n=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:p-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,A=c.bendPath,z=c.extrudePath,y,E=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,G=c.extrudeMaterial,L=this.shapebb;if(z)y=z.getPoints(x),v=y.length,E=!0,u=!1;u||(t=p=w=0);var M,K,H,B=this,ca=this.vertices.length;A&&b.addWrapPath(A);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);A=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();K=0;for(H=x.length;K<H;K++)M=x[K],THREE.Shape.Utils.isClockWise(M)&&
|
|
|
+(x[K]=M.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(A,x);F=A;K=0;for(H=x.length;K<H;K++)M=x[K],A=A.concat(M);var J,P,Q,T,X,o,da=A.length,V=z.length,la=[];J=0;P=F.length;ma=P-1;for(ea=J+1;J<P;J++,ma++,ea++)ma==P&&(ma=0),ea==P&&(ea=0),la[J]=f(F[J],F[ma],F[ea]);var ha=[],ka,aa=la.concat();K=0;for(H=x.length;K<H;K++){M=x[K];ka=[];J=0;P=M.length;ma=P-1;for(ea=J+1;J<P;J++,ma++,ea++)ma==P&&(ma=0),ea==P&&(ea=0),ka[J]=f(M[J],M[ma],M[ea]);ha.push(ka);aa=aa.concat(ka)}for(Q=0;Q<w;Q++){T=Q/w;X=p*(1-
|
|
|
+T);T=t*Math.sin(T*Math.PI/2);J=0;for(P=F.length;J<P;J++)o=e(F[J],la[J],T),k(o.x,o.y,-X);K=0;for(H=x.length;K<H;K++){M=x[K];ka=ha[K];J=0;for(P=M.length;J<P;J++)o=e(M[J],ka[J],T),k(o.x,o.y,-X)}}T=t;for(J=0;J<da;J++)o=u?e(A[J],aa[J],T):A[J],E?k(o.x,o.y+y[0].y,y[0].x):k(o.x,o.y,0);for(Q=1;Q<=v;Q++)for(J=0;J<da;J++)o=u?e(A[J],aa[J],T):A[J],E?k(o.x,o.y+y[Q-1].y,y[Q-1].x):k(o.x,o.y,n/v*Q);for(Q=w-1;Q>=0;Q--){T=Q/w;X=p*(1-T);T=t*Math.sin(T*Math.PI/2);J=0;for(P=F.length;J<P;J++)o=e(F[J],la[J],T),k(o.x,o.y,
|
|
|
+n+X);K=0;for(H=x.length;K<H;K++){M=x[K];ka=ha[K];J=0;for(P=M.length;J<P;J++)o=e(M[J],ka[J],T),E?k(o.x,o.y+y[v-1].y,y[v-1].x+X):k(o.x,o.y,n+X)}}if(u){u=da*0;for(J=0;J<V;J++)t=z[J],m(t[2]+u,t[1]+u,t[0]+u);u=da*(v+w*2);for(J=0;J<V;J++)t=z[J],m(t[0]+u,t[1]+u,t[2]+u)}else{for(J=0;J<V;J++)t=z[J],m(t[2],t[1],t[0]);for(J=0;J<V;J++)t=z[J],m(t[0]+da*v,t[1]+da*v,t[2]+da*v)}var ma,ea,Z=0;h(F);Z+=F.length;K=0;for(H=x.length;K<H;K++)M=x[K],h(M),Z+=M.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(b){function c(b,e,c){var f=Math.sqrt(b*b+e*e+c*c);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=h.vertices[b].position,k=h.vertices[e].position;return c((f.x+k.x)/2,(f.y+k.y)/2,(f.z+k.z)/2)}var h=this,k=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
|
-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(var m=0;m<this.subdivisions;m++){var b=new THREE.Geometry,n;for(n in k.faces){var p=f(k.faces[n].a,k.faces[n].b),t=f(k.faces[n].b,k.faces[n].c),w=f(k.faces[n].c,k.faces[n].a);e(k.faces[n].a,p,w,b);e(k.faces[n].b,t,
|
|
@@ -513,10 +513,10 @@ THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.am
|
|
|
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(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c=
|
|
|
this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),k=h.length,m=[],b=0;b<k;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;m.push(n.path)}return{paths:m,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var k=[],m,n,p,t,w,u,x,v,A,z,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));p=c.length;for(b=0;b<p;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(n,
|
|
|
-t));h.moveTo(n,t);break;case "l":n=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(n,t));h.lineTo(n,t);break;case "q":n=c[b++]*e+f;t=c[b++]*e;x=c[b++]*e+f;v=c[b++]*e;h.quadraticCurveTo(x,v,n,t);if(m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var D=m/divisions,F=THREE.Shape.Utils.b2(D,w,x,n),D=THREE.Shape.Utils.b2(D,u,v,t);k.push(new THREE.Vector2(F,D))}}break;case "b":if(n=c[b++]*e+f,t=c[b++]*e,x=c[b++]*e+f,v=c[b++]*-e,A=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,t,
|
|
|
-x,v,A,z),m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)D=m/divisions,F=THREE.Shape.Utils.b3(D,w,x,A,n),D=THREE.Shape.Utils.b3(D,u,v,z,t),k.push(new THREE.Vector2(F,D))}}}return{offset:y.ha*e,points:k,path:h}}}};
|
|
|
-(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],p,t,w;if(c(b)>0)for(t=0;t<h;t++)m[t]=t;else for(t=0;t<h;t++)m[t]=h-1-t;var u=2*h;for(t=h-1;h>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}p=t;h<=p&&(p=0);t=p+1;h<=t&&(t=0);w=t+1;h<=w&&(w=0);var x;a:{x=b;var v=p,A=t,z=w,y=h,D=m,F=void 0,E=void 0,H=void 0,
|
|
|
-L=void 0,M=void 0,K=void 0,G=void 0,B=void 0,da=void 0,E=x[D[v]].x,H=x[D[v]].y,L=x[D[A]].x,M=x[D[A]].y,K=x[D[z]].x,G=x[D[z]].y;if(1.0E-10>(L-E)*(G-H)-(M-H)*(K-E))x=!1;else{for(F=0;F<y;F++)if(!(F==v||F==A||F==z)){var B=x[D[F]].x,da=x[D[F]].y,J=void 0,Q=void 0,R=void 0,Y=void 0,W=void 0,o=void 0,ea=void 0,P=void 0,ma=void 0,Z=void 0,ia=void 0,aa=void 0,J=R=W=void 0,J=K-L,Q=G-M,R=E-K,Y=H-G,W=L-E,o=M-H,ea=B-E,P=da-H,ma=B-L,Z=da-M,ia=B-K,aa=da-G,J=J*Z-Q*ma,W=W*P-o*ea,R=R*aa-Y*ia;if(J>=0&&R>=0&&W>=0){x=
|
|
|
+t));h.moveTo(n,t);break;case "l":n=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(n,t));h.lineTo(n,t);break;case "q":n=c[b++]*e+f;t=c[b++]*e;x=c[b++]*e+f;v=c[b++]*e;h.quadraticCurveTo(x,v,n,t);if(m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var E=m/divisions,F=THREE.Shape.Utils.b2(E,w,x,n),E=THREE.Shape.Utils.b2(E,u,v,t);k.push(new THREE.Vector2(F,E))}}break;case "b":if(n=c[b++]*e+f,t=c[b++]*e,x=c[b++]*e+f,v=c[b++]*-e,A=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,t,
|
|
|
+x,v,A,z),m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)E=m/divisions,F=THREE.Shape.Utils.b3(E,w,x,A,n),E=THREE.Shape.Utils.b3(E,u,v,z,t),k.push(new THREE.Vector2(F,E))}}}return{offset:y.ha*e,points:k,path:h}}}};
|
|
|
+(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],p,t,w;if(c(b)>0)for(t=0;t<h;t++)m[t]=t;else for(t=0;t<h;t++)m[t]=h-1-t;var u=2*h;for(t=h-1;h>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}p=t;h<=p&&(p=0);t=p+1;h<=t&&(t=0);w=t+1;h<=w&&(w=0);var x;a:{x=b;var v=p,A=t,z=w,y=h,E=m,F=void 0,D=void 0,G=void 0,
|
|
|
+L=void 0,M=void 0,K=void 0,H=void 0,B=void 0,ca=void 0,D=x[E[v]].x,G=x[E[v]].y,L=x[E[A]].x,M=x[E[A]].y,K=x[E[z]].x,H=x[E[z]].y;if(1.0E-10>(L-D)*(H-G)-(M-G)*(K-D))x=!1;else{for(F=0;F<y;F++)if(!(F==v||F==A||F==z)){var B=x[E[F]].x,ca=x[E[F]].y,J=void 0,P=void 0,Q=void 0,T=void 0,X=void 0,o=void 0,da=void 0,V=void 0,la=void 0,ha=void 0,ka=void 0,aa=void 0,J=Q=X=void 0,J=K-L,P=H-M,Q=D-K,T=G-H,X=L-D,o=M-G,da=B-D,V=ca-G,la=B-L,ha=ca-M,ka=B-K,aa=ca-H,J=J*ha-P*la,X=X*V-o*da,Q=Q*aa-T*ka;if(J>=0&&Q>=0&&X>=0){x=
|
|
|
!1;break a}}x=!0}}if(x){k.push([b[m[p]],b[m[t]],b[m[w]]]);n.push([m[p],m[t],m[w]]);p=t;for(w=t+1;w<h;p++,w++)m[p]=m[w];h--;u=2*h}}if(f)return n;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var k=f/this.segmentsT*this.arc,m=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(k);h.y=this.radius*Math.sin(k);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(m))*Math.cos(k);n.y=(this.radius+this.tube*Math.cos(m))*Math.sin(k);n.z=
|
|
|
this.tube*Math.sin(m);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,k=(this.segmentsT+1)*(e-1)+f-1,m=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,p=new THREE.Face4(h,k,m,n,[c[h],c[k],c[m],c[n]]);p.normal.addSelf(c[h]);p.normal.addSelf(c[k]);p.normal.addSelf(c[m]);p.normal.addSelf(c[n]);p.normal.normalize();this.faces.push(p);
|
|
@@ -524,13 +524,14 @@ this.faceVertexUvs[0].push([b[h].clone(),b[k].clone(),b[m].clone(),b[n].clone()]
|
|
|
THREE.TorusKnotGeometry=function(b,c,e,f,h,k,m){function n(b,e,c,f,h,k){e=c/f*b;c=Math.cos(e);return new THREE.Vector3(h*(2+c)*0.5*Math.cos(b),h*(2+c)*Math.sin(b)*0.5,k*h*Math.sin(e)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=h||2;this.q=k||3;this.heightScale=m||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;k=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
|
this.segmentsT;++c){var p=b/this.segmentsR*2*this.p*Math.PI,m=c/this.segmentsT*2*Math.PI,h=n(p,m,this.q,this.p,this.radius,this.heightScale),p=n(p+0.01,m,this.q,this.p,this.radius,this.heightScale);e.x=p.x-h.x;e.y=p.y-h.y;e.z=p.z-h.z;f.x=p.x+h.x;f.y=p.y+h.y;f.z=p.z+h.z;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();p=-this.tube*Math.cos(m);m=this.tube*Math.sin(m);h.x+=p*f.x+m*k.x;h.y+=p*f.y+m*k.y;h.z+=p*f.z+m*k.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,
|
|
|
h.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,k=(c+1)%this.segmentsT,h=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],m=new THREE.UV(b/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),w=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,e,f,k));this.faceVertexUvs[0].push([m,p,t,w])}this.computeCentroids();
|
|
|
-this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(b){this.subdivisions=b===void 0?1:b;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(b){for(var c=this.subdivisions;c--;)this.smooth(b)};
|
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,e,c,f,n){var t=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors)t.vertexColors=n.vertexColors;h.push(t);(!m.supportUVs||u.length!=0)&&k.push([u[b],u[e],u[c],u[f]])}function e(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,p=n.concat(),t=[],w={},u=[],x,v,A,z,y,D=b.faceVertexUvs[0];x=0;for(v=D.length;x<v;x++){A=0;for(z=D[x].length;A<z;A++)y=f[x]["abcd".charAt(A)],
|
|
|
-u[y]||(u[y]=D[x][A])}var F;x=0;for(v=f.length;x<v;x++)if(y=f[x],t.push(y.centroid),p.push(new THREE.Vertex(y.centroid)),m.supportUVs&&u.length!=0){F=new THREE.UV;if(y instanceof THREE.Face3)F.u=u[y.a].u+u[y.b].u+u[y.c].u,F.v=u[y.a].v+u[y.b].v+u[y.c].v,F.u/=3,F.v/=3;else if(y instanceof THREE.Face4)F.u=u[y.a].u+u[y.b].u+u[y.c].u+u[y.d].u,F.v=u[y.a].v+u[y.b].v+u[y.c].v+u[y.d].v,F.u/=4,F.v/=4;u.push(F)}z=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<
|
|
|
-h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.a),c(n,m,f)):k instanceof THREE.Face4&&(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.d),c(n,m,f),m=e(k.d,k.a),c(n,m,f));return n}(b);var E,H,L=0,D=n.length,M;for(x in z)if(y=z[x],F=y[0],E=y[1],H=new THREE.Vector3,y.length!=2)console.log("warning, edge fail",y);else if(H.addSelf(t[F]),H.addSelf(t[E]),M=x.split("_"),v=M[0],M=M[1],H.addSelf(n[v].position),H.addSelf(n[M].position),H.multiplyScalar(0.25),
|
|
|
-w[x]=D+f.length+L,p.push(new THREE.Vertex(H)),L++,m.supportUVs&&u.length!=0)F=new THREE.UV,F.u=u[v].u+u[M].u,F.v=u[v].v+u[M].v,F.u/=2,F.v/=2,u.push(F);x=0;for(v=t.length;x<v;x++)y=f[x],M=D+x,y instanceof THREE.Face3?(F=e(y.a,y.b),E=e(y.b,y.c),L=e(y.c,y.a),c(M,w[F],y.b,w[E],y),c(M,w[E],y.c,w[L],y),c(M,w[L],y.a,w[F],y)):y instanceof THREE.Face4?(F=e(y.a,y.b),E=e(y.b,y.c),L=e(y.c,y.d),H=e(y.d,y.a),c(M,w[F],y.b,w[E],y),c(M,w[E],y.c,w[L],y),c(M,w[L],y.d,w[H],y),c(M,w[H],y.a,w[F],y)):console.log("face should be a face!",
|
|
|
-y);var f=p,K={},G={},p=function(b,e){K[b]===void 0&&(K[b]=[]);K[b].push(e)},w=function(b,e){G[b]===void 0&&(G[b]={});G[b][e]=null};for(x in z)y=z[x],M=x.split("_"),v=M[0],M=M[1],p(v,[v,M]),p(M,[v,M]),F=y[0],E=y[1],w(v,F),w(v,E),w(M,F),w(M,E);p=new THREE.Vector3;w=new THREE.Vector3;x=0;for(v=n.length;x<v;x++)if(K[x]!==void 0){p.set(0,0,0);w.set(0,0,0);z=new THREE.Vector3(0,0,0);D=0;for(A in G[x])p.addSelf(t[A]),D++;p.divideScalar(D);D=K[x].length;for(A=0;A<D;A++)y=K[x][A],y=n[y[0]].position.clone().addSelf(n[y[1]].position).divideScalar(2),
|
|
|
-w.addSelf(y);w.divideScalar(D);z.addSelf(n[x].position);z.multiplyScalar(D-3);z.addSelf(p);z.addSelf(w.multiplyScalar(2));z.divideScalar(D);f[x].position=z}b.vertices=f;b.faces=h;b.faceVertexUvs[0]=k;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
+this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(b){this.subdivisions=b===void 0?1:b;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(b){for(var c=this.subdivisions;c-- >0;)this.smooth(b)};
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,e,c,f,n,t){var p=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors){p.vertexColors=[];for(var o,v,w,x=0;x<4;x++){w=t[x];o=new THREE.Color;o.setRGB(0,0,0);for(var y=0;y<w.length;y++)v=n.vertexColors[w[y]-1],o.r+=v.r,o.g+=v.g,o.b+=v.b;o.r/=w.length;o.g/=w.length;o.b/=w.length;p.vertexColors[x]=o}}h.push(p);(!m.supportUVs||u.length!=0)&&k.push([u[b],u[e],u[c],u[f]])}function e(b,e){return Math.min(b,e)+"_"+Math.max(b,
|
|
|
+e)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,p=n.concat(),t=[],w={},u=[],x,v,A,z,y,E=b.faceVertexUvs[0];x=0;for(v=E.length;x<v;x++){A=0;for(z=E[x].length;A<z;A++)y=f[x]["abcd".charAt(A)],u[y]||(u[y]=E[x][A])}var F;x=0;for(v=f.length;x<v;x++)if(y=f[x],t.push(y.centroid),p.push(new THREE.Vertex(y.centroid)),m.supportUVs&&u.length!=0){F=new THREE.UV;if(y instanceof THREE.Face3)F.u=u[y.a].u+u[y.b].u+u[y.c].u,F.v=u[y.a].v+u[y.b].v+u[y.c].v,F.u/=3,F.v/=3;else if(y instanceof THREE.Face4)F.u=u[y.a].u+
|
|
|
+u[y.b].u+u[y.c].u+u[y.d].u,F.v=u[y.a].v+u[y.b].v+u[y.c].v+u[y.d].v,F.u/=4,F.v/=4;u.push(F)}z=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.a),c(n,m,f)):k instanceof THREE.Face4&&(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.d),c(n,m,f),m=e(k.d,k.a),c(n,m,f));return n}(b);var D,G,L=0,E=n.length,M;for(x in z)if(y=z[x],F=y[0],D=
|
|
|
+y[1],M=x.split("_"),v=M[0],M=M[1],G=new THREE.Vector3,y.length!=2?(G.addSelf(n[v].position),G.addSelf(n[M].position),G.multiplyScalar(0.5)):(G.addSelf(t[F]),G.addSelf(t[D]),G.addSelf(n[v].position),G.addSelf(n[M].position),G.multiplyScalar(0.25)),w[x]=E+f.length+L,p.push(new THREE.Vertex(G)),L++,m.supportUVs&&u.length!=0)F=new THREE.UV,F.u=u[v].u+u[M].u,F.v=u[v].v+u[M].v,F.u/=2,F.v/=2,u.push(F);x=0;for(v=t.length;x<v;x++)y=f[x],F=E+x,y instanceof THREE.Face3?(D=e(y.a,y.b),M=e(y.b,y.c),L=e(y.c,y.a),
|
|
|
+c(F,w[D],y.b,w[M],y,["123","12","2","23"]),c(F,w[M],y.c,w[L],y,["123","23","3","31"]),c(F,w[L],y.a,w[D],y,["123","31","1","12"])):y instanceof THREE.Face4?(D=e(y.a,y.b),M=e(y.b,y.c),L=e(y.c,y.d),G=e(y.d,y.a),c(F,w[D],y.b,w[M],y,["1234","12","2","23"]),c(F,w[M],y.c,w[L],y,["1234","13","3","34"]),c(F,w[L],y.d,w[G],y,["1234","34","4","41"]),c(F,w[G],y.a,w[D],y,["1234","41","1","12"])):console.log("face should be a face!",y);var f=p,K={},H={},p=function(b,e){K[b]===void 0&&(K[b]=[]);K[b].push(e)},w=function(b,
|
|
|
+e){H[b]===void 0&&(H[b]={});H[b][e]=null};for(x in z)y=z[x],M=x.split("_"),v=M[0],M=M[1],p(v,[v,M]),p(M,[v,M]),F=y[0],D=y[1],w(v,F),D?w(v,D):w(v,F),w(M,F),D?w(M,D):w(M,F);p=new THREE.Vector3;w=new THREE.Vector3;x=0;for(v=n.length;x<v;x++)if(K[x]!==void 0){p.set(0,0,0);w.set(0,0,0);z=new THREE.Vector3(0,0,0);E=0;for(A in H[x])p.addSelf(t[A]),E++;p.divideScalar(E);E=K[x].length;for(A=0;A<E;A++)y=K[x][A],y=n[y[0]].position.clone().addSelf(n[y[1]].position).divideScalar(2),w.addSelf(y);w.divideScalar(E);
|
|
|
+z.addSelf(n[x].position);z.multiplyScalar(E-3);z.addSelf(p);z.addSelf(w.multiplyScalar(2));z.divideScalar(E);f[x].position=z}b.vertices=f;b.faces=h;b.faceVertexUvs[0]=k;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/
|
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.length<1?".":b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==
|
|
|
b}function f(b,c){var f=new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function h(b,e,k,h,m,n){var t=document.createElement("canvas");b[e]=new THREE.Texture(t);b[e].sourceFile=k;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;
|
|
@@ -545,19 +546,19 @@ c.postMessage(b)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,k){var m=new XMLHttpRequest,n=f+"/"+b,p=0;m.onreadystatechange=function(){m.readyState==4?m.status==200||m.status==0?THREE.BinaryLoader.prototype.createBinModel(m.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+m.status+"]"):m.readyState==3?k&&(p==0&&(p=m.getResponseHeader("Content-Length")),k({total:p,loaded:m.responseText.length})):m.readyState==2&&(p=m.getResponseHeader("Content-Length"))};m.open("GET",n,!0);m.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
m.setRequestHeader("Content-Type","text/plain");m.send(null)};
|
|
|
THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=w(b,e),h=w(b,e+1),k=w(b,e+2),m=w(b,e+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,e){var c=w(b,e),f=w(b,e+1),k=w(b,e+2);return(w(b,e+3)<<24)+(k<<16)+(f<<8)+c}function p(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function t(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function u(e){var c,
|
|
|
-f,k;c=h(b,e);f=h(b,e+M);k=h(b,e+K);e=p(b,e+G);D.faces.push(new THREE.Face3(c,f,k,null,null,D.materials[e]))}function x(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+M);k=h(b,e+K);m=p(b,e+G);o=h(b,e+B);t=h(b,e+da);e=h(b,e+J);m=D.materials[m];var u=H[t*3],v=H[t*3+1];t=H[t*3+2];var w=H[e*3],x=H[e*3+1],e=H[e*3+2];D.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,e)],null,m))}function v(e){var c,f,k,m;c=h(b,e);f=h(b,e+Q);k=h(b,e+R);m=h(b,
|
|
|
-e+Y);e=p(b,e+W);D.faces.push(new THREE.Face4(c,f,k,m,null,null,D.materials[e]))}function A(e){var c,f,k,m,t,u,v,w;c=h(b,e);f=h(b,e+Q);k=h(b,e+R);m=h(b,e+Y);t=p(b,e+W);u=h(b,e+o);v=h(b,e+ea);w=h(b,e+P);e=h(b,e+ma);t=D.materials[t];var x=H[v*3],U=H[v*3+1];v=H[v*3+2];var y=H[w*3],N=H[w*3+1];w=H[w*3+2];var z=H[e*3],A=H[e*3+1],e=H[e*3+2];D.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(H[u*3],H[u*3+1],H[u*3+2]),new THREE.Vector3(x,U,v),new THREE.Vector3(y,N,w),new THREE.Vector3(z,A,e)],null,t))}
|
|
|
-function z(e){var c,f,k,m;c=h(b,e);f=h(b,e+Z);k=h(b,e+ia);e=L[c*2];m=L[c*2+1];c=L[f*2];var o=D.faceVertexUvs[0];f=L[f*2+1];var t=L[k*2];k=L[k*2+1];var p=[];p.push(new THREE.UV(e,m));p.push(new THREE.UV(c,f));p.push(new THREE.UV(t,k));o.push(p)}function y(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+aa);k=h(b,e+ka);m=h(b,e+fa);e=L[c*2];o=L[c*2+1];c=L[f*2];t=L[f*2+1];f=L[k*2];var p=D.faceVertexUvs[0];k=L[k*2+1];var u=L[m*2];m=L[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,t));v.push(new THREE.UV(f,
|
|
|
-k));v.push(new THREE.UV(u,m));p.push(v)}var D=this,F=0,E,H=[],L=[],M,K,G,B,da,J,Q,R,Y,W,o,ea,P,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(D,f,e);E={signature:b.substr(F,8),header_bytes:w(b,F+8),vertex_coordinate_bytes:w(b,F+9),normal_coordinate_bytes:w(b,F+10),uv_coordinate_bytes:w(b,F+11),vertex_index_bytes:w(b,F+12),normal_index_bytes:w(b,F+13),uv_index_bytes:w(b,F+14),material_index_bytes:w(b,F+15),nvertices:h(b,F+16),nnormals:h(b,F+16+4),nuvs:h(b,
|
|
|
-F+16+8),ntri_flat:h(b,F+16+12),ntri_smooth:h(b,F+16+16),ntri_flat_uv:h(b,F+16+20),ntri_smooth_uv:h(b,F+16+24),nquad_flat:h(b,F+16+28),nquad_smooth:h(b,F+16+32),nquad_flat_uv:h(b,F+16+36),nquad_smooth_uv:h(b,F+16+40)};F+=E.header_bytes;M=E.vertex_index_bytes;K=E.vertex_index_bytes*2;G=E.vertex_index_bytes*3;B=E.vertex_index_bytes*3+E.material_index_bytes;da=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes;J=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*2;Q=E.vertex_index_bytes;
|
|
|
-R=E.vertex_index_bytes*2;Y=E.vertex_index_bytes*3;W=E.vertex_index_bytes*4;o=E.vertex_index_bytes*4+E.material_index_bytes;ea=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes;P=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*2;ma=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*3;Z=E.uv_index_bytes;ia=E.uv_index_bytes*2;aa=E.uv_index_bytes;ka=E.uv_index_bytes*2;fa=E.uv_index_bytes*3;e=E.vertex_index_bytes*3+E.material_index_bytes;ra=E.vertex_index_bytes*
|
|
|
-4+E.material_index_bytes;ca=E.ntri_flat*e;$=E.ntri_smooth*(e+E.normal_index_bytes*3);X=E.ntri_flat_uv*(e+E.uv_index_bytes*3);ga=E.ntri_smooth_uv*(e+E.normal_index_bytes*3+E.uv_index_bytes*3);la=E.nquad_flat*ra;e=E.nquad_smooth*(ra+E.normal_index_bytes*4);ra=E.nquad_flat_uv*(ra+E.uv_index_bytes*4);F+=function(e){for(var f,h,k,n=E.vertex_coordinate_bytes*3,o=e+E.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+E.vertex_coordinate_bytes),k=c(b,e+E.vertex_coordinate_bytes*2),D.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
|
|
|
-h,k)));return E.nvertices*n}(F);F+=function(e){for(var c,f,h,k=E.normal_coordinate_bytes*3,m=e+E.nnormals*k;e<m;e+=k)c=t(b,e),f=t(b,e+E.normal_coordinate_bytes),h=t(b,e+E.normal_coordinate_bytes*2),H.push(c/127,f/127,h/127);return E.nnormals*k}(F);F+=function(e){for(var f,h,k=E.uv_coordinate_bytes*2,n=e+E.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+E.uv_coordinate_bytes),L.push(f,h);return E.nuvs*k}(F);ca=F+ca;$=ca+$;X=$+X;ga=X+ga;la=ga+la;e=la+e;ra=e+ra;(function(b){var e,c=E.vertex_index_bytes*3+E.material_index_bytes,
|
|
|
-f=c+E.uv_index_bytes*3,h=b+E.ntri_flat_uv*f;for(e=b;e<h;e+=f)u(e),z(e+c);return h-b})($);(function(b){var e,c=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,f=c+E.uv_index_bytes*3,h=b+E.ntri_smooth_uv*f;for(e=b;e<h;e+=f)x(e),z(e+c);return h-b})(X);(function(b){var e,c=E.vertex_index_bytes*4+E.material_index_bytes,f=c+E.uv_index_bytes*4,h=b+E.nquad_flat_uv*f;for(e=b;e<h;e+=f)v(e),y(e+c);return h-b})(e);(function(b){var e,c=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*
|
|
|
-4,f=c+E.uv_index_bytes*4,h=b+E.nquad_smooth_uv*f;for(e=b;e<h;e+=f)A(e),y(e+c);return h-b})(ra);(function(b){var e,c=E.vertex_index_bytes*3+E.material_index_bytes,f=b+E.ntri_flat*c;for(e=b;e<f;e+=c)u(e);return f-b})(F);(function(b){var e,c=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,f=b+E.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(ca);(function(b){var e,c=E.vertex_index_bytes*4+E.material_index_bytes,f=b+E.nquad_flat*c;for(e=b;e<f;e+=c)v(e);return f-b})(ga);(function(b){var e,
|
|
|
-c=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*4,f=b+E.nquad_smooth*c;for(e=b;e<f;e+=c)A(e);return f-b})(la);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
|
|
|
-THREE.ColladaLoader=function(){function b(b,e,c){for(var b=ca.evaluate(b,ca,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new e).parse(h);if(h.id.length==0)h.id=c+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,e=-b,c=0,f;for(f in na)for(var h=na[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}function e(b,c,f,h){b.world=b.world||
|
|
|
-new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=O[f.url];if(!k||!k.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=X.getChildById(f.skeleton[0],!0)||X.getChildBySid(f.skeleton[0],
|
|
|
+f,k;c=h(b,e);f=h(b,e+M);k=h(b,e+K);e=p(b,e+H);E.faces.push(new THREE.Face3(c,f,k,null,null,E.materials[e]))}function x(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+M);k=h(b,e+K);m=p(b,e+H);o=h(b,e+B);t=h(b,e+ca);e=h(b,e+J);m=E.materials[m];var u=G[t*3],v=G[t*3+1];t=G[t*3+2];var w=G[e*3],x=G[e*3+1],e=G[e*3+2];E.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,e)],null,m))}function v(e){var c,f,k,m;c=h(b,e);f=h(b,e+P);k=h(b,e+Q);m=h(b,
|
|
|
+e+T);e=p(b,e+X);E.faces.push(new THREE.Face4(c,f,k,m,null,null,E.materials[e]))}function A(e){var c,f,k,m,t,u,v,w;c=h(b,e);f=h(b,e+P);k=h(b,e+Q);m=h(b,e+T);t=p(b,e+X);u=h(b,e+o);v=h(b,e+da);w=h(b,e+V);e=h(b,e+la);t=E.materials[t];var x=G[v*3],U=G[v*3+1];v=G[v*3+2];var y=G[w*3],N=G[w*3+1];w=G[w*3+2];var z=G[e*3],A=G[e*3+1],e=G[e*3+2];E.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(G[u*3],G[u*3+1],G[u*3+2]),new THREE.Vector3(x,U,v),new THREE.Vector3(y,N,w),new THREE.Vector3(z,A,e)],null,t))}
|
|
|
+function z(e){var c,f,k,m;c=h(b,e);f=h(b,e+ha);k=h(b,e+ka);e=L[c*2];m=L[c*2+1];c=L[f*2];var o=E.faceVertexUvs[0];f=L[f*2+1];var t=L[k*2];k=L[k*2+1];var p=[];p.push(new THREE.UV(e,m));p.push(new THREE.UV(c,f));p.push(new THREE.UV(t,k));o.push(p)}function y(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+aa);k=h(b,e+ma);m=h(b,e+ea);e=L[c*2];o=L[c*2+1];c=L[f*2];t=L[f*2+1];f=L[k*2];var p=E.faceVertexUvs[0];k=L[k*2+1];var u=L[m*2];m=L[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,t));v.push(new THREE.UV(f,
|
|
|
+k));v.push(new THREE.UV(u,m));p.push(v)}var E=this,F=0,D,G=[],L=[],M,K,H,B,ca,J,P,Q,T,X,o,da,V,la,ha,ka,aa,ma,ea,Z,$,Y,fa,ia,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,e);D={signature:b.substr(F,8),header_bytes:w(b,F+8),vertex_coordinate_bytes:w(b,F+9),normal_coordinate_bytes:w(b,F+10),uv_coordinate_bytes:w(b,F+11),vertex_index_bytes:w(b,F+12),normal_index_bytes:w(b,F+13),uv_index_bytes:w(b,F+14),material_index_bytes:w(b,F+15),nvertices:h(b,F+16),nnormals:h(b,F+16+4),nuvs:h(b,
|
|
|
+F+16+8),ntri_flat:h(b,F+16+12),ntri_smooth:h(b,F+16+16),ntri_flat_uv:h(b,F+16+20),ntri_smooth_uv:h(b,F+16+24),nquad_flat:h(b,F+16+28),nquad_smooth:h(b,F+16+32),nquad_flat_uv:h(b,F+16+36),nquad_smooth_uv:h(b,F+16+40)};F+=D.header_bytes;M=D.vertex_index_bytes;K=D.vertex_index_bytes*2;H=D.vertex_index_bytes*3;B=D.vertex_index_bytes*3+D.material_index_bytes;ca=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;J=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;P=D.vertex_index_bytes;
|
|
|
+Q=D.vertex_index_bytes*2;T=D.vertex_index_bytes*3;X=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;da=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;V=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;la=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ha=D.uv_index_bytes;ka=D.uv_index_bytes*2;aa=D.uv_index_bytes;ma=D.uv_index_bytes*2;ea=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;ra=D.vertex_index_bytes*
|
|
|
+4+D.material_index_bytes;Z=D.ntri_flat*e;$=D.ntri_smooth*(e+D.normal_index_bytes*3);Y=D.ntri_flat_uv*(e+D.uv_index_bytes*3);fa=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);ia=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);F+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+D.vertex_coordinate_bytes),k=c(b,e+D.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
|
|
|
+h,k)));return D.nvertices*n}(F);F+=function(e){for(var c,f,h,k=D.normal_coordinate_bytes*3,m=e+D.nnormals*k;e<m;e+=k)c=t(b,e),f=t(b,e+D.normal_coordinate_bytes),h=t(b,e+D.normal_coordinate_bytes*2),G.push(c/127,f/127,h/127);return D.nnormals*k}(F);F+=function(e){for(var f,h,k=D.uv_coordinate_bytes*2,n=e+D.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+D.uv_coordinate_bytes),L.push(f,h);return D.nuvs*k}(F);Z=F+Z;$=Z+$;Y=$+Y;fa=Y+fa;ia=fa+ia;e=ia+e;ra=e+ra;(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,
|
|
|
+f=c+D.uv_index_bytes*3,h=b+D.ntri_flat_uv*f;for(e=b;e<h;e+=f)u(e),z(e+c);return h-b})($);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=c+D.uv_index_bytes*3,h=b+D.ntri_smooth_uv*f;for(e=b;e<h;e+=f)x(e),z(e+c);return h-b})(Y);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,h=b+D.nquad_flat_uv*f;for(e=b;e<h;e+=f)v(e),y(e+c);return h-b})(e);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
|
|
|
+4,f=c+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(e=b;e<h;e+=f)A(e),y(e+c);return h-b})(ra);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*c;for(e=b;e<f;e+=c)u(e);return f-b})(F);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(Z);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*c;for(e=b;e<f;e+=c)v(e);return f-b})(fa);(function(b){var e,
|
|
|
+c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*c;for(e=b;e<f;e+=c)A(e);return f-b})(ia);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
|
|
|
+THREE.ColladaLoader=function(){function b(b,e,c){for(var b=Z.evaluate(b,Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new e).parse(h);if(h.id.length==0)h.id=c+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,e=-b,c=0,f;for(f in na)for(var h=na[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}function e(b,c,f,h){b.world=b.world||
|
|
|
+new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=O[f.url];if(!k||!k.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=Y.getChildById(f.skeleton[0],!0)||Y.getChildBySid(f.skeleton[0],
|
|
|
!0),n,o,t,p,u=new THREE.Vector3,v;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));e(f,w,h);n=w;o=k.skin;for(p=0;p<n.length;p++){t=n[p];v=-1;for(var y=0;y<o.joints.length;y++)if(t.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];t.invBindMatrix=y;t.skinningMatrix=new THREE.Matrix4;t.skinningMatrix.multiply(t.world,y);t.weights=[];
|
|
|
for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&t.weights.push(A)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)t=w[n].weights[o],p=t.index,t=t.weight,v=b.vertices[p],p=x[p],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),p.position.x+=u.x*t,p.position.y+=u.y*t,p.position.z+=u.z*t;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var e=new THREE.Object3D,
|
|
|
c,k,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=O[b.controllers[m].url];switch(n.type){case "skin":if(oa[n.skin.source]){var o=new A;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);c=b.controllers[m]}else if(O[n.skin.source]&&(k=n=O[n.skin.source],n.morph&&oa[n.morph.source]))o=new A,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(oa[n.morph.source])o=
|
|
@@ -565,91 +566,91 @@ new A,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_materia
|
|
|
v.material;p++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(p>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)p=n.faces[j],p.materials=[t[p.daeMaterial]]}if(c!==void 0)f(n,c),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=c.skeleton,o.skinController=O[c.url],o.skinInstanceController=c,o.name="skin_"+Ca.length,Ca.push(o);else if(k!==void 0){t=n;p=k instanceof x?O[k.url]:k;if(!p||!p.morph)console.log("could not find morph controller!");
|
|
|
else{p=p.morph;for(v=0;v<p.targets.length;v++){var w=oa[p.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===t.vertices.length&&t.morphTargets.push({name:"target_1",vertices:w.vertices})}t.morphTargets.push({name:"target_Z",vertices:t.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Aa.length;Aa.push(o)}else o=new THREE.Mesh(n,o);e.add(o)}}for(m=0;m<b.nodes.length;m++)e.add(h(b.nodes[m],b));return e}function k(){this.init_from=
|
|
|
this.id=""}function m(){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 w(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function u(){this.type=
|
|
|
-this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function A(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function y(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function D(){}function F(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function E(){this.source="";
|
|
|
-this.stride=this.count=0;this.params=[]}function H(){this.input={}}function L(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(b){this.id=b;this.type=null}function K(){this.name=this.id="";this.instance_effect=null}function G(){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 B(b,e){this.type=b;this.effect=e;this.material=null}function da(b){this.effect=b;this.format=this.init_from=
|
|
|
-null}function J(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function R(){this.url=""}function Y(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function W(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
|
|
|
-this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ea(b){var e=b.getAttribute("id");if(la[e]!=void 0)return la[e];la[e]=(new M(e)).parse(b);return la[e]}function P(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ma(b){for(var b=ia(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function Z(b){for(var b=ia(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],10));return e}function ia(b){return b.replace(/^\s+/,"").replace(/\s+$/,
|
|
|
-"").split(/\s+/)}function aa(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function ka(b,e){if(b===void 0){for(var c="0.";c.length<e+2;)c+="0";return c}e=e||2;c=b.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,e):"0";c[1].length<e;)c[1]+="0";return c.join(".")}function fa(b,e){var c="";c+=ka(b.x,e)+",";c+=ka(b.y,e)+",";c+=ka(b.z,e);return c}var ca=null,$=null,X,ga=null,la={},ra={},na={},O={},oa={},qa={},va={},ta,Ea,Aa,Ca,Fa=THREE.SmoothShading;k.prototype.parse=function(b){this.id=
|
|
|
+this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function A(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function y(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function E(){}function F(){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 G(){this.input={}}function L(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(b){this.id=b;this.type=null}function K(){this.name=this.id="";this.instance_effect=null}function H(){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 B(b,e){this.type=b;this.effect=e;this.material=null}function ca(b){this.effect=b;this.format=this.init_from=
|
|
|
+null}function J(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function P(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Q(){this.url=""}function T(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function X(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
|
|
|
+this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function da(b){var e=b.getAttribute("id");if(ia[e]!=void 0)return ia[e];ia[e]=(new M(e)).parse(b);return ia[e]}function V(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function la(b){for(var b=ka(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function ha(b){for(var b=ka(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],10));return e}function ka(b){return b.replace(/^\s+/,"").replace(/\s+$/,
|
|
|
+"").split(/\s+/)}function aa(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function ma(b,e){if(b===void 0){for(var c="0.";c.length<e+2;)c+="0";return c}e=e||2;c=b.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,e):"0";c[1].length<e;)c[1]+="0";return c.join(".")}function ea(b,e){var c="";c+=ma(b.x,e)+",";c+=ma(b.y,e)+",";c+=ma(b.z,e);return c}var Z=null,$=null,Y,fa=null,ia={},ra={},na={},O={},oa={},qa={},va={},ta,Ea,Aa,Ca,Fa=THREE.SmoothShading;k.prototype.parse=function(b){this.id=
|
|
|
b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};m.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];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(b){var e=
|
|
|
{},c=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new M).parse(h);e[h.id]=h;break;case "targets":c=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<c.length;f++)switch(b=c[f],h=e[b.source],b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=
|
|
|
-function(b){for(var e=[],c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new L).parse(f))}}return e};p.prototype.parse=function(b){var e={},c,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=ma(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
|
|
|
+function(b){for(var e=[],c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new L).parse(f))}}return e};p.prototype.parse=function(b){var e={},c,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=la(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
|
|
|
k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new M).parse(k);e[k.id]=k;break;case "joints":c=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(c,e);this.parseWeights(f,e);return this};p.prototype.parseJoints=function(b,e){for(var c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new L).parse(f),h=e[f.source];if(f.semantic=="JOINT")this.joints=
|
|
|
-h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};p.prototype.parseWeights=function(b,e){for(var c,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new L).parse(m));break;case "v":c=Z(m.textContent);break;case "vcount":f=Z(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],t=0;t<n;t++){for(var p={},u=0;u<h.length;u++){var v=h[u],w=c[m+v.offset];switch(v.semantic){case "JOINT":p.joint=w;break;
|
|
|
+h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};p.prototype.parseWeights=function(b,e){for(var c,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new L).parse(m));break;case "v":c=ha(m.textContent);break;case "vcount":f=ha(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],t=0;t<n;t++){for(var p={},u=0;u<h.length;u++){var v=h[u],w=c[m+v.offset];switch(v.semantic){case "JOINT":p.joint=w;break;
|
|
|
case "WEIGHT":p.weight=e[v.source].data[w]}}o.push(p);m+=h.length}for(t=0;t<o.length;t++)o[t].index=k;this.weights.push(o)}};t.prototype.getChildById=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};t.prototype.getChildBySid=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};t.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
|
|
|
this.nodes=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new w).parse(c))}}return this};w.prototype.getChannelForTransform=function(b){for(var e=0;e<this.channels.length;e++){var c=this.channels[e],f=c.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
|
|
|
""))}if(h==b)return c.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},c}return null};w.prototype.getChildById=function(b,e){if(this.id==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};w.prototype.getChildBySid=function(b,e){if(this.sid==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};w.prototype.getTransformBySid=function(b){for(var e=0;e<this.transforms.length;e++)if(this.transforms[e].sid==
|
|
|
b)return this.transforms[e];return null};w.prototype.parse=function(b){var e;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.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<b.childNodes.length;c++)if(e=b.childNodes[c],e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new w).parse(e));break;case "instance_camera":break;
|
|
|
-case "instance_controller":this.controllers.push((new x).parse(e));break;case "instance_geometry":this.geometries.push((new A).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=ca.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",ca,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(e));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(e));
|
|
|
+case "instance_controller":this.controllers.push((new x).parse(e));break;case "instance_geometry":this.geometries.push((new A).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=Z.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(e));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(e));
|
|
|
break;case "extra":break;default:console.log(e.nodeName)}b=[];c=1E6;e=-1E6;for(var f in na)for(var h=na[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,c=Math.min(c,n.startTime),e=Math.max(e,n.endTime),b.push(m)}if(b.length)this.startTime=c,this.endTime=e;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(c=0;c<b.input.length-1;c++)f=Math.min(f,b.input[c+
|
|
|
1]-b.input[c])}c=[];for(b=this.startTime;b<this.endTime;b+=f){e=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var t=o.sampler,p,o=0;o<t.input.length-1;o++)if(t.input[o+1]>e){p=t.output[o];break}m=p!==void 0?p instanceof THREE.Matrix4?m.multiply(m,p):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);e=m;c.push({time:b,pos:[e.n14,
|
|
|
-e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};u.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=ma(b.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
|
|
|
+e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};u.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=la(b.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var b=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":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
|
|
|
-x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ca.evaluate(".//dae:instance_material",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new v).parse(f)),f=c.iterateNext()}}return this};
|
|
|
-v.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};A.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=ca.evaluate(".//dae:instance_material",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new v).parse(e)),
|
|
|
-e=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new y(this)).parse(c)}}return this};y.prototype.parse=function(b){function e(b,c){var f=fa(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":ea(f);break;case "vertices":this.vertices=
|
|
|
-(new H).parse(f);break;case "triangles":this.primitives.push((new F).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new D).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=la[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[c],f[c+1],f[c+2]));e(k,b);this.geometry3js.vertices.push(k)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),
|
|
|
+x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Z.evaluate(".//dae:instance_material",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new v).parse(f)),f=c.iterateNext()}}return this};
|
|
|
+v.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};A.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=Z.evaluate(".//dae:instance_material",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new v).parse(e)),
|
|
|
+e=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new y(this)).parse(c)}}return this};y.prototype.parse=function(b){function e(b,c){var f=ea(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":da(f);break;case "vertices":this.vertices=
|
|
|
+(new G).parse(f);break;case "triangles":this.primitives.push((new F).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new E).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ia[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[c],f[c+1],f[c+2]));e(k,b);this.geometry3js.vertices.push(k)}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};y.prototype.handlePrimitive=function(b,e,c){var f=0,h,k,m=b.p,n=b.inputs,o,t,p,u=0,v=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
|
|
|
-n[k],source=la[o.source],t=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,p=t*numParams,o.semantic){case "VERTEX":o=fa(e.vertices[t].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[p],source.data[p+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var B;v==
|
|
|
-3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],A.length?A:new THREE.Color):v==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],A.length?A:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(k=0;k<w.length;k++)h=z[w[k]],e.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*v}};D.prototype=new F;D.prototype.constructor=D;F.prototype.setVertices=function(b){for(var e=0;e<this.inputs.length;e++)if(this.inputs[e].source==b.id)this.inputs[e].source=b.input.POSITION.source};
|
|
|
-F.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=aa(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new L).parse(b.childNodes[e]));break;case "vcount":this.vcount=Z(c.textContent);break;case "p":this.p=Z(c.textContent)}}return this};E.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=aa(b,"count",0);this.stride=aa(b,"stride",0);for(var e=
|
|
|
-0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="param"){var f={};f.name=c.getAttribute("name");f.type=c.getAttribute("type");this.params.push(f)}}return this};H.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++)b.childNodes[e].nodeName=="input"&&(input=(new L).parse(b.childNodes[e]),this.input[input.semantic]=input);return this};L.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
|
|
|
-"");this.set=aa(b,"set",-1);this.offset=aa(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};M.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "bool_array":for(var f=ia(c.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=ma(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
-Z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ia(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new E).parse(c.childNodes[f]);break}}}return this};M.prototype.read=function(){var b=[],e=this.accessor.params[0];switch(e.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(e=0;e<this.data.length;e+=16){var c=
|
|
|
-this.data.slice(e,e+16),f=new THREE.Matrix4;f.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]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+e.type)}return b};K.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="instance_effect"){this.instance_effect=(new R).parse(b.childNodes[e]);break}return this};G.prototype.isColor=
|
|
|
-function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "color":c=ma(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};B.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=
|
|
|
-b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=ca.evaluate(".//dae:float",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};B.prototype.create=function(){var b=
|
|
|
-{},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof G)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ra[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else c=="diffuse"?b.color=
|
|
|
-f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=Fa;return this.material=new THREE.MeshLambertMaterial(b)};da.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];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: "+
|
|
|
+n[k],source=ia[o.source],t=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,p=t*numParams,o.semantic){case "VERTEX":o=ea(e.vertices[t].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[p],source.data[p+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var B;v==
|
|
|
+3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],A.length?A:new THREE.Color):v==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],A.length?A:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(k=0;k<w.length;k++)h=z[w[k]],e.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*v}};E.prototype=new F;E.prototype.constructor=E;F.prototype.setVertices=function(b){for(var e=0;e<this.inputs.length;e++)if(this.inputs[e].source==b.id)this.inputs[e].source=b.input.POSITION.source};
|
|
|
+F.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=aa(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new L).parse(b.childNodes[e]));break;case "vcount":this.vcount=ha(c.textContent);break;case "p":this.p=ha(c.textContent)}}return this};D.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=aa(b,"count",0);this.stride=aa(b,"stride",0);for(var e=
|
|
|
+0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="param"){var f={};f.name=c.getAttribute("name");f.type=c.getAttribute("type");this.params.push(f)}}return this};G.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++)b.childNodes[e].nodeName=="input"&&(input=(new L).parse(b.childNodes[e]),this.input[input.semantic]=input);return this};L.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
|
|
|
+"");this.set=aa(b,"set",-1);this.offset=aa(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};M.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "bool_array":for(var f=ka(c.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=la(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
+ha(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ka(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[f]);break}}}return this};M.prototype.read=function(){var b=[],e=this.accessor.params[0];switch(e.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(e=0;e<this.data.length;e+=16){var c=
|
|
|
+this.data.slice(e,e+16),f=new THREE.Matrix4;f.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]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+e.type)}return b};K.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="instance_effect"){this.instance_effect=(new Q).parse(b.childNodes[e]);break}return this};H.prototype.isColor=
|
|
|
+function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "color":c=la(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};B.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=
|
|
|
+b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new H).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=Z.evaluate(".//dae:float",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};B.prototype.create=function(){var b=
|
|
|
+{},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ra[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else c=="diffuse"?b.color=
|
|
|
+f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=Fa;return this.material=new THREE.MeshLambertMaterial(b)};ca.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];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};J.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];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};
|
|
|
-Q.prototype.create=function(){if(this.shader==null)return null};Q.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};Q.prototype.parseNewparam=function(b){for(var e=b.getAttribute("sid"),c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=
|
|
|
-(new da(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new J(this)).parse(f);this.sampler.sid=e;break;case "extra":break;default:console.log(f.nodeName)}}};Q.prototype.parseProfileCOMMON=function(b){for(var e,c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":e=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return e};
|
|
|
-Q.prototype.parseTechnique=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new B(c.nodeName,this)).parse(c)}}};R.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};Y.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];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 o(this)).parse(c));break;case "channel":this.channel.push((new W(this)).parse(c))}}return this};W.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var e=this.target.split("/");e.shift();var b=e.shift(),c=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e<h.length;e++)h[e]=
|
|
|
+P.prototype.create=function(){if(this.shader==null)return null};P.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};P.prototype.parseNewparam=function(b){for(var e=b.getAttribute("sid"),c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=
|
|
|
+(new ca(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new J(this)).parse(f);this.sampler.sid=e;break;case "extra":break;default:console.log(f.nodeName)}}};P.prototype.parseProfileCOMMON=function(b){for(var e,c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":e=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return e};
|
|
|
+P.prototype.parseTechnique=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new B(c.nodeName,this)).parse(c)}}};Q.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};T.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];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 o(this)).parse(c));break;case "channel":this.channel.push((new X(this)).parse(c))}}return this};X.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var e=this.target.split("/");e.shift();var b=e.shift(),c=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e<h.length;e++)h[e]=
|
|
|
parseInt(h[e].replace(/\)/,""))}this.sid=b;this.dotSyntax=c;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};o.prototype.parse=function(b){this.id=b.getAttribute("id");this.inputs=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new L).parse(c))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var e=this.inputs[b],c=this.animation.source[e.source];switch(e.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(e.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(e,f){if(document.implementation&&
|
|
|
-document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){ga=f;var o,p=e;ca=n.responseXML;o=ga;p!==void 0&&(p=p.split("/"),p.pop(),Ea=p.join("/")+"/");ra=b("//dae:library_images/dae:image",k,"image");qa=b("//dae:library_materials/dae:material",
|
|
|
-K,"material");va=b("//dae:library_effects/dae:effect",Q,"effect");oa=b("//dae:library_geometries/dae:geometry",z,"geometry");O=b("//dae:library_controllers/dae:controller",m,"controller");na=b("//dae:library_animations/dae:animation",Y,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",t,"visual_scene");Aa=[];Ca=[];(p=ca.evaluate(".//dae:scene/dae:instance_visual_scene",ca,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),X=ta[p]):
|
|
|
-X=null;$=new THREE.Object3D;for(p=0;p<X.nodes.length;p++)$.add(h(X.nodes[p]));c();for(var u in na);u={scene:$,morphs:Aa,skins:Ca,dae:{images:ra,materials:qa,effects:va,geometries:oa,controllers:O,animations:na,visualScenes:ta,scene:X}};o&&o(u)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Fa=b},applySkin:f,geometries:oa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
|
|
|
+document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){fa=f;var o,p=e;Z=n.responseXML;o=fa;p!==void 0&&(p=p.split("/"),p.pop(),Ea=p.join("/")+"/");ra=b("//dae:library_images/dae:image",k,"image");qa=b("//dae:library_materials/dae:material",
|
|
|
+K,"material");va=b("//dae:library_effects/dae:effect",P,"effect");oa=b("//dae:library_geometries/dae:geometry",z,"geometry");O=b("//dae:library_controllers/dae:controller",m,"controller");na=b("//dae:library_animations/dae:animation",T,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",t,"visual_scene");Aa=[];Ca=[];(p=Z.evaluate(".//dae:scene/dae:instance_visual_scene",Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),Y=ta[p]):
|
|
|
+Y=null;$=new THREE.Object3D;for(p=0;p<Y.nodes.length;p++)$.add(h(Y.nodes[p]));c();for(var u in na);u={scene:$,morphs:Aa,skins:Ca,dae:{images:ra,materials:qa,effects:va,geometries:oa,controllers:O,animations:na,visualScenes:ta,scene:Y}};o&&o(u)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Fa=b},applySkin:f,geometries:oa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
|
|
|
THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,h,p,t,w,u,x,v,A,z,y,D,F,E,H=b.faces;u=b.vertices;var L=b.normals,M=b.colors,K=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&K++;for(c=0;c<K;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];t=0;for(w=u.length;t<w;)x=new THREE.Vertex,x.position.x=u[t++]*e,x.position.y=
|
|
|
-u[t++]*e,x.position.z=u[t++]*e,f.vertices.push(x);t=0;for(w=H.length;t<w;){e=H[t++];u=e&1;p=e&2;c=e&4;h=e&8;v=e&16;x=e&32;z=e&64;e&=128;u?(y=new THREE.Face4,y.a=H[t++],y.b=H[t++],y.c=H[t++],y.d=H[t++],u=4):(y=new THREE.Face3,y.a=H[t++],y.b=H[t++],y.c=H[t++],u=3);if(p)p=H[t++],y.materials=f.materials[p];p=f.faces.length;if(c)for(c=0;c<K;c++)D=b.uvs[c],A=H[t++],E=D[A*2],A=D[A*2+1],f.faceUvs[c][p]=new THREE.UV(E,A);if(h)for(c=0;c<K;c++){D=b.uvs[c];F=[];for(h=0;h<u;h++)A=H[t++],E=D[A*2],A=D[A*2+1],F[h]=
|
|
|
-new THREE.UV(E,A);f.faceVertexUvs[c][p]=F}if(v)v=H[t++]*3,h=new THREE.Vector3,h.x=L[v++],h.y=L[v++],h.z=L[v],y.normal=h;if(x)for(c=0;c<u;c++)v=H[t++]*3,h=new THREE.Vector3,h.x=L[v++],h.y=L[v++],h.z=L[v],y.vertexNormals.push(h);if(z)x=H[t++],x=new THREE.Color(M[x]),y.color=x;if(e)for(c=0;c<u;c++)x=H[t++],x=new THREE.Color(M[x]),y.vertexColors.push(x);f.faces.push(y)}}})(h);(function(){var e,c,h,p;if(b.skinWeights){e=0;for(c=b.skinWeights.length;e<c;e+=2)h=b.skinWeights[e],p=b.skinWeights[e+1],f.skinWeights.push(new THREE.Vector4(h,
|
|
|
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,h,p,t,w,u,x,v,A,z,y,E,F,D,G=b.faces;u=b.vertices;var L=b.normals,M=b.colors,K=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&K++;for(c=0;c<K;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];t=0;for(w=u.length;t<w;)x=new THREE.Vertex,x.position.x=u[t++]*e,x.position.y=
|
|
|
+u[t++]*e,x.position.z=u[t++]*e,f.vertices.push(x);t=0;for(w=G.length;t<w;){e=G[t++];u=e&1;p=e&2;c=e&4;h=e&8;v=e&16;x=e&32;z=e&64;e&=128;u?(y=new THREE.Face4,y.a=G[t++],y.b=G[t++],y.c=G[t++],y.d=G[t++],u=4):(y=new THREE.Face3,y.a=G[t++],y.b=G[t++],y.c=G[t++],u=3);if(p)p=G[t++],y.materials=f.materials[p];p=f.faces.length;if(c)for(c=0;c<K;c++)E=b.uvs[c],A=G[t++],D=E[A*2],A=E[A*2+1],f.faceUvs[c][p]=new THREE.UV(D,A);if(h)for(c=0;c<K;c++){E=b.uvs[c];F=[];for(h=0;h<u;h++)A=G[t++],D=E[A*2],A=E[A*2+1],F[h]=
|
|
|
+new THREE.UV(D,A);f.faceVertexUvs[c][p]=F}if(v)v=G[t++]*3,h=new THREE.Vector3,h.x=L[v++],h.y=L[v++],h.z=L[v],y.normal=h;if(x)for(c=0;c<u;c++)v=G[t++]*3,h=new THREE.Vector3,h.x=L[v++],h.y=L[v++],h.z=L[v],y.vertexNormals.push(h);if(z)x=G[t++],x=new THREE.Color(M[x]),y.color=x;if(e)for(c=0;c<u;c++)x=G[t++],x=new THREE.Color(M[x]),y.vertexColors.push(x);f.faces.push(y)}}})(h);(function(){var e,c,h,p;if(b.skinWeights){e=0;for(c=b.skinWeights.length;e<c;e+=2)h=b.skinWeights[e],p=b.skinWeights[e+1],f.skinWeights.push(new THREE.Vector4(h,
|
|
|
p,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)h=b.skinIndices[e],p=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(h,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,h,p,t,w,u,x,v,A;c=0;for(h=b.morphTargets.length;c<h;c++){f.morphTargets[c]={};f.morphTargets[c].name=b.morphTargets[c].name;f.morphTargets[c].vertices=[];v=f.morphTargets[c].vertices;A=b.morphTargets[c].vertices;p=0;for(t=A.length;p<t;p+=3)w=A[p]*e,u=A[p+1]*
|
|
|
e,x=A[p+2]*e,v.push(new THREE.Vertex(new THREE.Vector3(w,u,x)))}}if(b.morphColors!==void 0){c=0;for(h=b.morphColors.length;c<h;c++){f.morphColors[c]={};f.morphColors[c].name=b.morphColors[c].name;f.morphColors[c].colors=[];t=f.morphColors[c].colors;w=b.morphColors[c].colors;e=0;for(p=w.length;e<p;e+=3)u=new THREE.Color(16755200),u.setRGB(w[e],w[e+1],w[e+2]),t.push(u)}}})(h);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(v in Q.objects)if(!P.objects[v])if(F=Q.objects[v],F.geometry!==void 0){if(M=P.geometries[F.geometry]){var b=!1;da=[];for(Z=0;Z<F.materials.length;Z++)da[Z]=P.materials[F.materials[Z]],b=da[Z]instanceof THREE.ShaderMaterial;b&&M.computeTangents();E=F.position;r=F.rotation;
|
|
|
-q=F.quaternion;s=F.scale;q=0;da.length==0&&(da[0]=new THREE.MeshFaceMaterial);da.length>1&&(da=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,da);object.name=v;object.position.set(E[0],E[1],E[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=F.visible;P.scene.add(object);P.objects[v]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(b));
|
|
|
-if(F.castsShadow)b=new THREE.ShadowVolume(M),P.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},P.triggers[object.name]=b)}}else E=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(E[0],E[1],E[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=F.visible!==void 0?F.visible:!1,P.scene.add(object),P.objects[v]=object,P.empties[v]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},P.triggers[object.name]=b)}function p(b){return function(c){P.geometries[b]=c;n();Y-=1;e.onLoadComplete();w()}}function t(b){return function(e){P.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-Y,loadedTextures:ea-W},P);e.onLoadProgress();Y==0&&W==0&&c(P)}var u,
|
|
|
-x,v,A,z,y,D,F,E,H,L,M,K,G,B,da,J,Q,R,Y,W,o,ea,P;Q=b.data;B=new THREE.BinaryLoader;R=new THREE.JSONLoader;W=Y=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in Q.objects)if(F=Q.objects[v],F.meshCollider){b=!0;break}if(b)P.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;H=Q.transform.rotation;var ma=Q.transform.scale;b&&P.scene.position.set(b[0],b[1],b[2]);H&&P.scene.rotation.set(H[0],
|
|
|
-H[1],H[2]);ma&&P.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&P.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(z in Q.cameras){H=Q.cameras[z];if(H.type=="perspective")K=new THREE.Camera(H.fov,H.aspect,H.near,H.far),K.useTarget=!0;else if(H.type=="ortho")K=new THREE.Camera,K.useTarget=!0,K.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);E=H.position;H=H.target;K.position.set(E[0],E[1],E[2]);K.target.position.set(H[0],H[1],H[2]);P.cameras[z]=
|
|
|
-K}for(A in Q.lights)z=Q.lights[A],K=z.color!==void 0?z.color:16777215,H=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(E=z.direction,J=new THREE.DirectionalLight(K,H),J.position.set(E[0],E[1],E[2]),J.position.normalize()):z.type=="point"?(E=z.position,d=z.distance,J=new THREE.PointLight(K,H,d),J.position.set(E[0],E[1],E[2])):z.type=="ambient"&&(J=new THREE.AmbientLight(K)),P.scene.add(J),P.lights[A]=J;for(y in Q.fogs)A=Q.fogs[y],A.type=="linear"?G=new THREE.Fog(0,A.near,A.far):A.type==
|
|
|
-"exp2"&&(G=new THREE.FogExp2(0,A.density)),H=A.color,G.color.setRGB(H[0],H[1],H[2]),P.fogs[y]=G;if(P.cameras&&Q.defaults.camera)P.currentCamera=P.cameras[Q.defaults.camera];if(P.fogs&&Q.defaults.fog)P.scene.fog=P.fogs[Q.defaults.fog];H=Q.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(H[0],H[1],H[2]);P.bgColorAlpha=Q.defaults.bgalpha;for(u in Q.geometries)if(y=Q.geometries[u],y.type=="bin_mesh"||y.type=="ascii_mesh")Y+=1,e.onLoadStart();o=Y;for(u in Q.geometries)y=Q.geometries[u],y.type==
|
|
|
-"cube"?(M=new THREE.CubeGeometry(y.width,y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),P.geometries[u]=M):y.type=="plane"?(M=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),P.geometries[u]=M):y.type=="sphere"?(M=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),P.geometries[u]=M):y.type=="cylinder"?(M=new THREE.CylinderGeometry(y.topRad,y.botRad,y.height,y.radSegs,y.heightSegs),P.geometries[u]=M):y.type=="torus"?
|
|
|
-(M=new THREE.TorusGeometry(y.radius,y.tube,y.segmentsR,y.segmentsT),P.geometries[u]=M):y.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(y.subdivisions),P.geometries[u]=M):y.type=="bin_mesh"?B.load({model:f(y.url,Q.urlBaseType),callback:p(u)}):y.type=="ascii_mesh"?R.load({model:f(y.url,Q.urlBaseType),callback:p(u)}):y.type=="embedded_mesh"&&(y=Q.embeds[y.id])&&R.createModel(y,t(u),"");for(D in Q.textures)if(u=Q.textures[D],u.url instanceof Array){W+=u.url.length;for(B=0;B<u.url.length;B++)e.onLoadStart()}else W+=
|
|
|
-1,e.onLoadStart();ea=W;for(D in Q.textures){u=Q.textures[D];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){B=[];for(var Z=0;Z<u.url.length;Z++)B[Z]=f(u.url[Z],Q.urlBaseType);B=THREE.ImageUtils.loadTextureCube(B,u.mapping,b)}else{B=THREE.ImageUtils.loadTexture(f(u.url,Q.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)B.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)B.magFilter=THREE[u.magFilter];if(u.repeat){B.repeat.set(u.repeat[0],
|
|
|
-u.repeat[1]);if(u.repeat[0]!=1)B.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)B.wrapT=THREE.RepeatWrapping}u.offset&&B.offset.set(u.offset[0],u.offset[1]);if(u.wrap){R={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(R[u.wrap[0]]!==void 0)B.wrapS=R[u.wrap[0]];if(R[u.wrap[1]]!==void 0)B.wrapT=R[u.wrap[1]]}}P.textures[D]=B}for(x in Q.materials){D=Q.materials[x];for(L in D.parameters)if(L=="envMap"||L=="map"||L=="lightMap")D.parameters[L]=P.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;b=THREE.UniformsUtils.clone(u.uniforms);B=D.parameters.color;R=D.parameters.specular;y=D.parameters.ambient;G=D.parameters.shininess;b.tNormal.texture=P.textures[D.parameters.normalMap];if(D.parameters.normalMapFactor)b.uNormalScale.value=D.parameters.normalMapFactor;if(D.parameters.map)b.tDiffuse.texture=D.parameters.map,b.enableDiffuse.value=!0;if(D.parameters.lightMap)b.tAO.texture=D.parameters.lightMap,b.enableAO.value=!0;if(D.parameters.specularMap)b.tSpecular.texture=
|
|
|
-P.textures[D.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(B);b.uSpecularColor.value.setHex(R);b.uAmbientColor.value.setHex(y);b.uShininess.value=G;if(D.parameters.opacity)b.uOpacity.value=D.parameters.opacity;D=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else D=new THREE[D.type](D.parameters);P.materials[x]=D}n();e.callbackSync(P)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(v in P.objects)if(!V.objects[v])if(F=P.objects[v],F.geometry!==void 0){if(M=V.geometries[F.geometry]){var b=!1;ca=[];for(ha=0;ha<F.materials.length;ha++)ca[ha]=V.materials[F.materials[ha]],b=ca[ha]instanceof THREE.ShaderMaterial;b&&M.computeTangents();D=F.position;r=F.rotation;
|
|
|
+q=F.quaternion;s=F.scale;q=0;ca.length==0&&(ca[0]=new THREE.MeshFaceMaterial);ca.length>1&&(ca=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,ca);object.name=v;object.position.set(D[0],D[1],D[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=F.visible;V.scene.add(object);V.objects[v]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),V.scene.collisions.colliders.push(b));
|
|
|
+if(F.castsShadow)b=new THREE.ShadowVolume(M),V.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},V.triggers[object.name]=b)}}else D=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(D[0],D[1],D[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=F.visible!==void 0?F.visible:!1,V.scene.add(object),V.objects[v]=object,V.empties[v]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},V.triggers[object.name]=b)}function p(b){return function(c){V.geometries[b]=c;n();T-=1;e.onLoadComplete();w()}}function t(b){return function(e){V.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:da,loadedModels:o-T,loadedTextures:da-X},V);e.onLoadProgress();T==0&&X==0&&c(V)}var u,
|
|
|
+x,v,A,z,y,E,F,D,G,L,M,K,H,B,ca,J,P,Q,T,X,o,da,V;P=b.data;B=new THREE.BinaryLoader;Q=new THREE.JSONLoader;X=T=0;V={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in P.objects)if(F=P.objects[v],F.meshCollider){b=!0;break}if(b)V.scene.collisions=new THREE.CollisionSystem;if(P.transform){b=P.transform.position;G=P.transform.rotation;var la=P.transform.scale;b&&V.scene.position.set(b[0],b[1],b[2]);G&&V.scene.rotation.set(G[0],
|
|
|
+G[1],G[2]);la&&V.scene.scale.set(la[0],la[1],la[2]);(b||G||la)&&V.scene.updateMatrix()}b=function(){X-=1;w();e.onLoadComplete()};for(z in P.cameras){G=P.cameras[z];if(G.type=="perspective")K=new THREE.Camera(G.fov,G.aspect,G.near,G.far),K.useTarget=!0;else if(G.type=="ortho")K=new THREE.Camera,K.useTarget=!0,K.projectionMatrix=THREE.Matrix4.makeOrtho(G.left,G.right,G.top,G.bottom,G.near,G.far);D=G.position;G=G.target;K.position.set(D[0],D[1],D[2]);K.target.position.set(G[0],G[1],G[2]);V.cameras[z]=
|
|
|
+K}for(A in P.lights)z=P.lights[A],K=z.color!==void 0?z.color:16777215,G=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(D=z.direction,J=new THREE.DirectionalLight(K,G),J.position.set(D[0],D[1],D[2]),J.position.normalize()):z.type=="point"?(D=z.position,d=z.distance,J=new THREE.PointLight(K,G,d),J.position.set(D[0],D[1],D[2])):z.type=="ambient"&&(J=new THREE.AmbientLight(K)),V.scene.add(J),V.lights[A]=J;for(y in P.fogs)A=P.fogs[y],A.type=="linear"?H=new THREE.Fog(0,A.near,A.far):A.type==
|
|
|
+"exp2"&&(H=new THREE.FogExp2(0,A.density)),G=A.color,H.color.setRGB(G[0],G[1],G[2]),V.fogs[y]=H;if(V.cameras&&P.defaults.camera)V.currentCamera=V.cameras[P.defaults.camera];if(V.fogs&&P.defaults.fog)V.scene.fog=V.fogs[P.defaults.fog];G=P.defaults.bgcolor;V.bgColor=new THREE.Color;V.bgColor.setRGB(G[0],G[1],G[2]);V.bgColorAlpha=P.defaults.bgalpha;for(u in P.geometries)if(y=P.geometries[u],y.type=="bin_mesh"||y.type=="ascii_mesh")T+=1,e.onLoadStart();o=T;for(u in P.geometries)y=P.geometries[u],y.type==
|
|
|
+"cube"?(M=new THREE.CubeGeometry(y.width,y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),V.geometries[u]=M):y.type=="plane"?(M=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),V.geometries[u]=M):y.type=="sphere"?(M=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),V.geometries[u]=M):y.type=="cylinder"?(M=new THREE.CylinderGeometry(y.topRad,y.botRad,y.height,y.radSegs,y.heightSegs),V.geometries[u]=M):y.type=="torus"?
|
|
|
+(M=new THREE.TorusGeometry(y.radius,y.tube,y.segmentsR,y.segmentsT),V.geometries[u]=M):y.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(y.subdivisions),V.geometries[u]=M):y.type=="bin_mesh"?B.load({model:f(y.url,P.urlBaseType),callback:p(u)}):y.type=="ascii_mesh"?Q.load({model:f(y.url,P.urlBaseType),callback:p(u)}):y.type=="embedded_mesh"&&(y=P.embeds[y.id])&&Q.createModel(y,t(u),"");for(E in P.textures)if(u=P.textures[E],u.url instanceof Array){X+=u.url.length;for(B=0;B<u.url.length;B++)e.onLoadStart()}else X+=
|
|
|
+1,e.onLoadStart();da=X;for(E in P.textures){u=P.textures[E];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){B=[];for(var ha=0;ha<u.url.length;ha++)B[ha]=f(u.url[ha],P.urlBaseType);B=THREE.ImageUtils.loadTextureCube(B,u.mapping,b)}else{B=THREE.ImageUtils.loadTexture(f(u.url,P.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)B.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)B.magFilter=THREE[u.magFilter];if(u.repeat){B.repeat.set(u.repeat[0],
|
|
|
+u.repeat[1]);if(u.repeat[0]!=1)B.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)B.wrapT=THREE.RepeatWrapping}u.offset&&B.offset.set(u.offset[0],u.offset[1]);if(u.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Q[u.wrap[0]]!==void 0)B.wrapS=Q[u.wrap[0]];if(Q[u.wrap[1]]!==void 0)B.wrapT=Q[u.wrap[1]]}}V.textures[E]=B}for(x in P.materials){E=P.materials[x];for(L in E.parameters)if(L=="envMap"||L=="map"||L=="lightMap")E.parameters[L]=V.textures[E.parameters[L]];else if(L=="shading")E.parameters[L]=
|
|
|
+E.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")E.parameters[L]=THREE[E.parameters[L]]?THREE[E.parameters[L]]:THREE.NormalBlending;else if(L=="combine")E.parameters[L]=E.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(E.parameters[L]=="face")E.parameters[L]=THREE.FaceColors;else if(E.parameters[L])E.parameters[L]=THREE.VertexColors;if(E.parameters.opacity!==void 0&&E.parameters.opacity<1)E.parameters.transparent=
|
|
|
+!0;if(E.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);B=E.parameters.color;Q=E.parameters.specular;y=E.parameters.ambient;H=E.parameters.shininess;b.tNormal.texture=V.textures[E.parameters.normalMap];if(E.parameters.normalMapFactor)b.uNormalScale.value=E.parameters.normalMapFactor;if(E.parameters.map)b.tDiffuse.texture=E.parameters.map,b.enableDiffuse.value=!0;if(E.parameters.lightMap)b.tAO.texture=E.parameters.lightMap,b.enableAO.value=!0;if(E.parameters.specularMap)b.tSpecular.texture=
|
|
|
+V.textures[E.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(B);b.uSpecularColor.value.setHex(Q);b.uAmbientColor.value.setHex(y);b.uShininess.value=H;if(E.parameters.opacity)b.uOpacity.value=E.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else E=new THREE[E.type](E.parameters);V.materials[x]=E}n();e.callbackSync(V)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,h=b.scale!==void 0?b.scale:1,k=b.offsetX!==void 0?b.offsetX:0,m=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,h,k,m,n):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)};
|
|
|
THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var k=0,m=0;m<c;++m){var n=b.charCodeAt(m+f);k+=n>>1^-(n&1);e[8*m+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=m=0;h<c;h++)n=b.charCodeAt(h+f),k[h]=m-n,n==0&&m++;return[e,k]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var m=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var m=THREE.UTF8Loader.prototype.decompressMesh(b),t=[],w=[];(function(b,m,t){for(var p,w,y,D=b.length;t<D;t+=m)p=b[t],w=b[t+1],y=b[t+2],p=p/16383*e,w=w/16383*e,y=y/16383*e,p+=f,w+=h,y+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,w,y)))})(m[0],8,0);(function(b,e,c){for(var f,h,k=b.length;c<k;c+=e)f=b[c],h=b[c+1],f/=1023,h/=1023,w.push(f,1-h)})(m[0],8,3);(function(b,
|
|
|
-e,c){for(var f,h,k,m=b.length;c<m;c+=e)f=b[c],h=b[c+1],k=b[c+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,t.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,p,F,E,H,L=b.length;for(e=0;e<L;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;E=f;H=h;p=k;F=f;var M=h,K=k,G=m.materials[0],B=t[M*3],da=t[M*3+1],M=t[M*3+2],J=t[K*3],Q=t[K*3+1],K=t[K*3+2];F=new THREE.Vector3(t[F*3],t[F*3+1],t[F*3+2]);M=new THREE.Vector3(B,da,M);K=new THREE.Vector3(J,Q,K);m.faces.push(new THREE.Face3(E,H,p,[F,M,K],null,G));m=w[f*2];f=w[f*
|
|
|
-2+1];p=w[h*2];F=w[h*2+1];E=w[k*2];H=w[k*2+1];k=c.faceVertexUvs[0];h=p;p=F;F=[];F.push(new THREE.UV(m,f));F.push(new THREE.UV(h,p));F.push(new THREE.UV(E,H));k.push(F)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var m=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var m=THREE.UTF8Loader.prototype.decompressMesh(b),t=[],w=[];(function(b,m,t){for(var p,w,y,E=b.length;t<E;t+=m)p=b[t],w=b[t+1],y=b[t+2],p=p/16383*e,w=w/16383*e,y=y/16383*e,p+=f,w+=h,y+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,w,y)))})(m[0],8,0);(function(b,e,c){for(var f,h,k=b.length;c<k;c+=e)f=b[c],h=b[c+1],f/=1023,h/=1023,w.push(f,1-h)})(m[0],8,3);(function(b,
|
|
|
+e,c){for(var f,h,k,m=b.length;c<m;c+=e)f=b[c],h=b[c+1],k=b[c+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,t.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,p,F,D,G,L=b.length;for(e=0;e<L;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;G=h;p=k;F=f;var M=h,K=k,H=m.materials[0],B=t[M*3],ca=t[M*3+1],M=t[M*3+2],J=t[K*3],P=t[K*3+1],K=t[K*3+2];F=new THREE.Vector3(t[F*3],t[F*3+1],t[F*3+2]);M=new THREE.Vector3(B,ca,M);K=new THREE.Vector3(J,P,K);m.faces.push(new THREE.Face3(D,G,p,[F,M,K],null,H));m=w[f*2];f=w[f*
|
|
|
+2+1];p=w[h*2];F=w[h*2+1];D=w[k*2];G=w[k*2+1];k=c.faceVertexUvs[0];h=p;p=F;F=[];F.push(new THREE.UV(m,f));F.push(new THREE.UV(h,p));F.push(new THREE.UV(D,G));k.push(F)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
|
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vertex);b.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),e=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));e.position.x=100;e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));this.add(e);
|
|
|
e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));e.position.y=100;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));e.rotation.x=Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));e.position.z=100;e.rotation.x=Math.PI/2;this.add(e)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
|
THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;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(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=p;c[k+2]=t;h[k]=this.lerp(w[b],w[b+3],m);h[k+1]=this.lerp(w[b+1],w[b+4],m);h[k+2]=this.lerp(w[b+2],w[b+5],m)};this.VIntY=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=p+m*this.delta;c[k+
|
|
|
2]=t;c=b+this.yd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.VIntZ=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=p;c[k+2]=t+m*this.delta;c=b+this.zd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
|
|
|
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,k,m,n){var p=k+1,t=k+this.yd,w=k+this.zd,u=p+this.yd,x=p+this.zd,v=k+this.yd+this.zd,A=p+this.yd+this.zd,z=0,y=this.field[k],D=this.field[p],F=this.field[t],E=this.field[u],H=this.field[w],L=this.field[x],M=this.field[v],K=this.field[A];y<m&&(z|=1);D<m&&(z|=2);F<m&&(z|=8);E<m&&(z|=4);H<m&&(z|=16);L<m&&(z|=32);M<m&&(z|=128);K<m&&(z|=64);var G=THREE.edgeTable[z];if(G==0)return 0;var B=this.delta,
|
|
|
-da=b+B,J=c+B,B=h+B;G&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,y,D));G&2&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,3,m,da,c,h,D,E));G&4&&(this.compNorm(t),this.compNorm(u),this.VIntX(t*3,this.vlist,this.nlist,6,m,b,J,h,F,E));G&8&&(this.compNorm(k),this.compNorm(t),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,y,F));G&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,B,H,L));G&32&&(this.compNorm(x),
|
|
|
-this.compNorm(A),this.VIntY(x*3,this.vlist,this.nlist,15,m,da,c,B,L,K));G&64&&(this.compNorm(v),this.compNorm(A),this.VIntX(v*3,this.vlist,this.nlist,18,m,b,J,B,M,K));G&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,B,H,M));G&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,y,H));G&512&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*3,this.vlist,this.nlist,27,m,da,c,h,D,L));G&1024&&(this.compNorm(u),this.compNorm(A),this.VIntZ(u*
|
|
|
-3,this.vlist,this.nlist,30,m,da,J,h,E,K));G&2048&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*3,this.vlist,this.nlist,33,m,b,J,h,F,M));z<<=4;for(m=k=0;THREE.triTable[z+m]!=-1;)b=z+m,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){var p=this.count*3;this.positionArray[p]=b[h];this.positionArray[p+1]=b[h+1];this.positionArray[p+2]=b[h+2];this.positionArray[p+3]=b[k];this.positionArray[p+
|
|
|
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,k,m,n){var p=k+1,t=k+this.yd,w=k+this.zd,u=p+this.yd,x=p+this.zd,v=k+this.yd+this.zd,A=p+this.yd+this.zd,z=0,y=this.field[k],E=this.field[p],F=this.field[t],D=this.field[u],G=this.field[w],L=this.field[x],M=this.field[v],K=this.field[A];y<m&&(z|=1);E<m&&(z|=2);F<m&&(z|=8);D<m&&(z|=4);G<m&&(z|=16);L<m&&(z|=32);M<m&&(z|=128);K<m&&(z|=64);var H=THREE.edgeTable[z];if(H==0)return 0;var B=this.delta,
|
|
|
+ca=b+B,J=c+B,B=h+B;H&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,y,E));H&2&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,3,m,ca,c,h,E,D));H&4&&(this.compNorm(t),this.compNorm(u),this.VIntX(t*3,this.vlist,this.nlist,6,m,b,J,h,F,D));H&8&&(this.compNorm(k),this.compNorm(t),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,y,F));H&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,B,G,L));H&32&&(this.compNorm(x),
|
|
|
+this.compNorm(A),this.VIntY(x*3,this.vlist,this.nlist,15,m,ca,c,B,L,K));H&64&&(this.compNorm(v),this.compNorm(A),this.VIntX(v*3,this.vlist,this.nlist,18,m,b,J,B,M,K));H&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,B,G,M));H&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,y,G));H&512&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*3,this.vlist,this.nlist,27,m,ca,c,h,E,L));H&1024&&(this.compNorm(u),this.compNorm(A),this.VIntZ(u*
|
|
|
+3,this.vlist,this.nlist,30,m,ca,J,h,D,K));H&2048&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*3,this.vlist,this.nlist,33,m,b,J,h,F,M));z<<=4;for(m=k=0;THREE.triTable[z+m]!=-1;)b=z+m,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){var p=this.count*3;this.positionArray[p]=b[h];this.positionArray[p+1]=b[h+1];this.positionArray[p+2]=b[h+2];this.positionArray[p+3]=b[k];this.positionArray[p+
|
|
|
4]=b[k+1];this.positionArray[p+5]=b[k+2];this.positionArray[p+6]=b[m];this.positionArray[p+7]=b[m+1];this.positionArray[p+8]=b[m+2];this.normalArray[p]=c[h];this.normalArray[p+1]=c[h+1];this.normalArray[p+2]=c[h+2];this.normalArray[p+3]=c[k];this.normalArray[p+4]=c[k+1];this.normalArray[p+5]=c[k+2];this.normalArray[p+6]=c[m];this.normalArray[p+7]=c[m+1];this.normalArray[p+8]=c[m+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(this)};this.begin=function(){this.count=0;
|
|
|
this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,k,m){var n=this.size*Math.sqrt(k/m),p=h*this.size,t=c*this.size,w=b*this.size,u=Math.floor(p-n);u<1&&(u=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var x=Math.floor(t-n);x<1&&(x=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var v=Math.floor(w-n);v<1&&(v=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
|
|
|
-1);for(var A,z,y,D,F,E;u<p;u++){w=this.size2*u;z=u/this.size-h;F=z*z;for(z=x;z<t;z++){y=w+this.size*z;A=z/this.size-c;E=A*A;for(A=v;A<n;A++)D=A/this.size-b,D=k/(1.0E-6+D*D+E+F)-m,D>0&&(this.field[y+A]+=D)}}};this.addPlaneX=function(b,c){var h,k,m,n,p,t=this.size,w=this.yd,u=this.zd,x=this.field,v=t*Math.sqrt(b/c);v>t&&(v=t);for(h=0;h<v;h++)if(k=h/t,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<t;k++){p=h+k*w;for(m=0;m<t;m++)x[u*m+p]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,p,t,w=this.size,u=this.yd,x=
|
|
|
+1);for(var A,z,y,E,F,D;u<p;u++){w=this.size2*u;z=u/this.size-h;F=z*z;for(z=x;z<t;z++){y=w+this.size*z;A=z/this.size-c;D=A*A;for(A=v;A<n;A++)E=A/this.size-b,E=k/(1.0E-6+E*E+D+F)-m,E>0&&(this.field[y+A]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,p,t=this.size,w=this.yd,u=this.zd,x=this.field,v=t*Math.sqrt(b/c);v>t&&(v=t);for(h=0;h<v;h++)if(k=h/t,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<t;k++){p=h+k*w;for(m=0;m<t;m++)x[u*m+p]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,p,t,w=this.size,u=this.yd,x=
|
|
|
this.zd,v=this.field,A=w*Math.sqrt(b/c);A>w&&(A=w);for(k=0;k<A;k++)if(h=k/w,h*=h,n=b/(1.0E-4+h)-c,n>0){p=k*u;for(h=0;h<w;h++){t=p+h;for(m=0;m<w;m++)v[x*m+t]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,p,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(m=0;m<dist;m++)if(h=m/size,h*=h,n=b/(1.0E-4+h)-c,n>0){p=zd*m;for(k=0;k<size;k++){t=p+k*yd;for(h=0;h<size;h++)field[t+h]+=n}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
|
|
|
3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,h,k,m,n,p,t,w,u,x=this.size-2;for(m=1;m<x;m++){u=this.size2*m;t=(m-this.halfsize)/this.halfsize;for(k=1;k<x;k++){w=u+this.size*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=w+h,this.polygonize(n,p,t,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(k){var m,n,p,t,w,u,x,v;for(m=0;m<k.count;m++)x=m*3,w=x+1,v=x+2,n=k.positionArray[x],
|
|
|
p=k.positionArray[w],t=k.positionArray[v],u=new THREE.Vector3(n,p,t),n=k.normalArray[x],p=k.normalArray[w],t=k.normalArray[v],x=new THREE.Vector3(n,p,t),x.normalize(),w=new THREE.Vertex(u),c.vertices.push(w),h.push(x);nfaces=k.count/3;for(m=0;m<nfaces;m++)x=(b+m)*3,w=x+1,v=x+2,u=h[x],n=h[w],p=h[v],x=new THREE.Face3(x,w,v,[u,n,p]),c.faces.push(x);b+=nfaces;k.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
@@ -694,7 +695,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
|
|
|
THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
|
|
|
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,k=new THREE.Camera,m=new THREE.Matrix4,n=new THREE.Matrix4,p,t,w;h.useTarget=k.useTarget=!1;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z=
|
|
|
2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:x}},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 A=new THREE.Scene;A.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||t!==e.near||w!==e.fov){p=e.aspect;t=e.near;w=e.fov;var D=e.projectionMatrix.clone(),F=125/30*0.5,E=F*t/125,H=t*Math.tan(w*Math.PI/360),L;m.n14=F;n.n14=-F;F=-H*p+E;L=H*p+E;D.n11=2*t/(L-F);D.n13=(L+F)/(L-F);h.projectionMatrix=D.clone();F=-H*p-E;L=H*p-E;D.n11=2*t/(L-F);D.n13=
|
|
|
-(L+F)/(L-F);k.projectionMatrix=D.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=t;h.far=e.far;f.call(c,b,h,u,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=t;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,A,v)}};
|
|
|
+var A=new THREE.Scene;A.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||t!==e.near||w!==e.fov){p=e.aspect;t=e.near;w=e.fov;var E=e.projectionMatrix.clone(),F=125/30*0.5,D=F*t/125,G=t*Math.tan(w*Math.PI/360),L;m.n14=F;n.n14=-F;F=-G*p+D;L=G*p+D;E.n11=2*t/(L-F);E.n13=(L+F)/(L-F);h.projectionMatrix=E.clone();F=-G*p-D;L=G*p-D;E.n11=2*t/(L-F);E.n13=
|
|
|
+(L+F)/(L-F);k.projectionMatrix=E.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=t;h.far=e.far;f.call(c,b,h,u,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=t;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,A,v)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,k,m=new THREE.Camera;m.useTarget=!0;var n=new THREE.Camera;n.useTarget=!0;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;this.setSize=function(b,f){e.call(c,b,f);h=b/2;k=f};this.render=function(b,e){this.clear();m.fov=e.fov;m.aspect=0.5*e.aspect;m.near=e.near;m.far=e.far;m.updateProjectionMatrix();m.position.copy(e.position);
|
|
|
m.target.position.copy(e.target.position);m.translateX(c.separation);n.projectionMatrix=m.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,k);f.call(c,b,m);this.setViewport(h,0,h,k);f.call(c,b,n,!1)}};
|