|
@@ -26,9 +26,9 @@ THREE.Matrix4=function(b,c,e,f,h,k,m,n,t,v,w,u,x,p,y,A){this.set(b!==void 0?b:1,
|
|
|
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,t,v,w,u,x,p,y,A){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=t;this.n32=v;this.n33=w;this.n34=u;this.n41=x;this.n42=p;this.n43=y;this.n44=A;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,t=b.n23,v=b.n24,w=b.n31,u=b.n32,x=b.n33,p=b.n34,y=b.n41,A=b.n42,z=b.n43,E=b.n44,F=c.n11,D=c.n12,
|
|
|
-H=c.n13,N=c.n14,O=c.n21,K=c.n22,G=c.n23,B=c.n24,da=c.n31,J=c.n32,R=c.n33,S=c.n34,Y=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*F+f*O+h*da+k*Y;this.n12=e*D+f*K+h*J+k*W;this.n13=e*H+f*G+h*R+k*o;this.n14=e*N+f*B+h*S+k*ea;this.n21=m*F+n*O+t*da+v*Y;this.n22=m*D+n*K+t*J+v*W;this.n23=m*H+n*G+t*R+v*o;this.n24=m*N+n*B+t*S+v*ea;this.n31=w*F+u*O+x*da+p*Y;this.n32=w*D+u*K+x*J+p*W;this.n33=w*H+u*G+x*R+p*o;this.n34=w*N+u*B+x*S+p*ea;this.n41=y*F+A*O+z*da+E*Y;this.n42=y*D+A*K+z*J+E*W;this.n43=y*H+A*G+z*R+E*o;this.n44=
|
|
|
-y*N+A*B+z*S+E*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,t=b.n23,v=b.n24,w=b.n31,u=b.n32,x=b.n33,p=b.n34,y=b.n41,A=b.n42,z=b.n43,F=b.n44,E=c.n11,D=c.n12,
|
|
|
+G=c.n13,N=c.n14,O=c.n21,K=c.n22,H=c.n23,B=c.n24,da=c.n31,J=c.n32,R=c.n33,S=c.n34,Y=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*E+f*O+h*da+k*Y;this.n12=e*D+f*K+h*J+k*W;this.n13=e*G+f*H+h*R+k*o;this.n14=e*N+f*B+h*S+k*ea;this.n21=m*E+n*O+t*da+v*Y;this.n22=m*D+n*K+t*J+v*W;this.n23=m*G+n*H+t*R+v*o;this.n24=m*N+n*B+t*S+v*ea;this.n31=w*E+u*O+x*da+p*Y;this.n32=w*D+u*K+x*J+p*W;this.n33=w*G+u*H+x*R+p*o;this.n34=w*N+u*B+x*S+p*ea;this.n41=y*E+A*O+z*da+F*Y;this.n42=y*D+A*K+z*J+F*W;this.n43=y*G+A*H+z*R+F*o;this.n44=
|
|
|
+y*N+A*B+z*S+F*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*=
|
|
|
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,t=this.n31,v=this.n32,w=this.n33,u=this.n34,x=this.n41,p=this.n42,y=this.n43,A=this.n44;return f*m*v*x-e*n*v*x-f*k*w*x+c*n*w*x+e*k*u*x-c*m*u*x-f*m*t*p+e*n*t*p+f*h*w*p-b*n*w*p-e*h*u*p+b*m*u*p+f*k*t*y-c*n*t*y-f*h*v*y+b*n*v*y+c*h*u*y-b*k*u*y-e*k*t*A+c*m*t*A+e*h*v*A-b*m*v*A-c*h*
|
|
|
w*A+b*k*w*A},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,t=c*m;c*=n;var v=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,t=b.n23,v=b.n24,w=b.n31,u=b.n32,x=b.n33,p=b.n34,y=b.n41,A=b.n42,z=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*p*A-v*x*A+v*u*z-n*p*z-t*u*E+n*x*E;c.n12=k*x*A-h*p*A-k*u*z+f*p*z+h*u*E-f*x*E;c.n13=h*v*A-k*t*A+k*n*z-f*v*z-h*n*E+f*t*E;c.n14=k*t*u-h*v*u-k*n*x+f*v*x+h*n*p-f*t*p;c.n21=v*x*y-t*p*y-v*w*z+m*p*z+t*w*E-m*x*E;c.n22=h*p*y-k*x*y+k*w*z-e*p*z-h*w*E+e*x*E;c.n23=k*t*y-h*v*y-k*m*z+e*v*z+h*m*E-e*t*E;c.n24=
|
|
|
-h*v*w-k*t*w+k*m*x-e*v*x-h*m*p+e*t*p;c.n31=n*p*y-v*u*y+v*w*A-m*p*A-n*w*E+m*u*E;c.n32=k*u*y-f*p*y-k*w*A+e*p*A+f*w*E-e*u*E;c.n33=h*v*y-k*n*y+k*m*A-e*v*A-f*m*E+e*n*E;c.n34=k*n*w-f*v*w-k*m*u+e*v*u+f*m*p-e*n*p;c.n41=t*u*y-n*x*y-t*w*A+m*x*A+n*w*z-m*u*z;c.n42=f*x*y-h*u*y+h*w*A-e*x*A-f*w*z+e*u*z;c.n43=h*n*y-f*t*y-h*m*A+e*t*A+f*m*z-e*n*z;c.n44=f*t*w-h*n*w+h*m*u-e*t*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,t=b.n23,v=b.n24,w=b.n31,u=b.n32,x=b.n33,p=b.n34,y=b.n41,A=b.n42,z=b.n43,F=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*p*A-v*x*A+v*u*z-n*p*z-t*u*F+n*x*F;c.n12=k*x*A-h*p*A-k*u*z+f*p*z+h*u*F-f*x*F;c.n13=h*v*A-k*t*A+k*n*z-f*v*z-h*n*F+f*t*F;c.n14=k*t*u-h*v*u-k*n*x+f*v*x+h*n*p-f*t*p;c.n21=v*x*y-t*p*y-v*w*z+m*p*z+t*w*F-m*x*F;c.n22=h*p*y-k*x*y+k*w*z-e*p*z-h*w*F+e*x*F;c.n23=k*t*y-h*v*y-k*m*z+e*v*z+h*m*F-e*t*F;c.n24=
|
|
|
+h*v*w-k*t*w+k*m*x-e*v*x-h*m*p+e*t*p;c.n31=n*p*y-v*u*y+v*w*A-m*p*A-n*w*F+m*u*F;c.n32=k*u*y-f*p*y-k*w*A+e*p*A+f*w*F-e*u*F;c.n33=h*v*y-k*n*y+k*m*A-e*v*A-f*m*F+e*n*F;c.n34=k*n*w-f*v*w-k*m*u+e*v*u+f*m*p-e*n*p;c.n41=t*u*y-n*x*y-t*w*A+m*x*A+n*w*z-m*u*z;c.n42=f*x*y-h*u*y+h*w*A-e*x*A-f*w*z+e*u*z;c.n43=h*n*y-f*t*y-h*m*A+e*t*A+f*m*z-e*n*z;c.n44=f*t*w-h*n*w+h*m*u-e*t*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,t=-b.n32*b.n11+b.n31*b.n12,v=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*v;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*t;e[6]=b*v;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,t,v;m=new THREE.Matrix4;n=c-b;t=e-f;v=k-h;m.n11=2/n;m.n12=0;m.n13=0;m.n14=-((c+b)/n);m.n21=0;m.n22=2/t;m.n23=0;m.n24=-((e+f)/t);m.n31=0;m.n32=0;m.n33=-2/v;m.n34=-((k+h)/v);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=t[n]=t[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,t=[],v,w,u=[],x,p=[],y,A,z=[],E,F,D=[],H=[],N=[],O=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,R=new THREE.Vector4;this.projectVector=function(b,e){G.multiply(e.projectionMatrix,e.matrixWorldInverse);G.multiplyVector3(b);return b};this.unprojectVector=function(b,e){G.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.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 u;if(!(u=!n.visible))if(u=n instanceof THREE.Mesh)if(u=n.frustumCulled){a:{u=void 0;for(var v=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),t=0;t<6;t++)if(u=da[t].x*v.n14+da[t].y*v.n24+da[t].z*v.n34+da[t].w,u<=p){u=!1;break a}u=!0}u=!u}if(!u)u=k[h]=k[h]||new THREE.RenderableObject,h++,f=u,O.copy(n.position),G.multiplyVector3(O),f.object=n,f.z=O.z,H.push(f)}m&&H.sort(c);return H};this.projectScene=
|
|
|
-function(f,k,h){var o=k.near,H=k.far,O,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra,na,P,oa,qa;F=A=x=w=N.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(O=0;O<6;O++)$=da[O],$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z));$=this.projectObjects(f,k,!0);f=0;for(O=$.length;f<O;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){P=X.geometry;ia=P.vertices;oa=P.faces;P=P.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=t[Z.a],ka=t[Z.b],fa=t[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)<
|
|
|
+THREE.Projector=function(){function b(){var b=t[n]=t[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,t=[],v,w,u=[],x,p=[],y,A,z=[],F,E,D=[],G=[],N=[],O=new THREE.Vector4,K=new THREE.Vector4,
|
|
|
+H=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,R=new THREE.Vector4;this.projectVector=function(b,e){H.multiply(e.projectionMatrix,e.matrixWorldInverse);H.multiplyVector3(b);return b};this.unprojectVector=function(b,e){H.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.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 u;if(!(u=!n.visible))if(u=n instanceof THREE.Mesh)if(u=n.frustumCulled){a:{u=void 0;for(var v=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),t=0;t<6;t++)if(u=da[t].x*v.n14+da[t].y*v.n24+da[t].z*v.n34+da[t].w,u<=p){u=!1;break a}u=!0}u=!u}if(!u)u=k[h]=k[h]||new THREE.RenderableObject,h++,f=u,O.copy(n.position),H.multiplyVector3(O),f.object=n,f.z=O.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=
|
|
|
+function(f,k,h){var o=k.near,G=k.far,O,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra,na,P,oa,qa;E=A=x=w=N.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);H.multiply(k.projectionMatrix,k.matrixWorldInverse);da[0].set(H.n41-H.n11,H.n42-H.n12,H.n43-H.n13,H.n44-H.n14);da[1].set(H.n41+H.n11,H.n42+H.n12,H.n43+H.n13,H.n44+H.n14);da[2].set(H.n41+H.n21,H.n42+H.n22,H.n43+H.n23,H.n44+H.n24);da[3].set(H.n41-H.n21,H.n42-H.n22,H.n43-H.n23,H.n44-H.n24);da[4].set(H.n41-H.n31,H.n42-H.n32,H.n43-H.n33,H.n44-
|
|
|
+H.n34);da[5].set(H.n41+H.n31,H.n42+H.n32,H.n43+H.n33,H.n44+H.n34);for(O=0;O<6;O++)$=da[O],$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z));$=this.projectObjects(f,k,!0);f=0;for(O=$.length;f<O;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){P=X.geometry;ia=P.vertices;oa=P.faces;P=P.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),
|
|
|
+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;ia=0;for(ma=oa.length;ia<ma;ia++){Z=oa[ia];if(Z instanceof THREE.Face3)if(aa=t[Z.a],ka=t[Z.b],fa=t[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++,v=ca,v.v1.copy(aa),v.v2.copy(ka),v.v3.copy(fa);else continue;else if(Z instanceof THREE.Face4)if(aa=t[Z.a],ka=t[Z.b],fa=t[Z.c],ca=t[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=p[x]=p[x]||new THREE.RenderableFace4,x++,v=qa,v.v1.copy(aa),v.v2.copy(ka),v.v3.copy(fa),v.v4.copy(ca);else continue;v.normalWorld.copy(Z.normal);la.multiplyVector3(v.normalWorld);v.centroidWorld.copy(Z.centroid);ga.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);G.multiplyVector3(v.centroidScreen);fa=Z.vertexNormals;aa=0;for(ka=fa.length;aa<ka;aa++)ca=v.vertexNormalsWorld[aa],ca.copy(fa[aa]),
|
|
|
-la.multiplyVector3(ca);aa=0;for(ka=P.length;aa<ka;aa++)if(qa=P[aa][ia]){fa=0;for(ca=qa.length;fa<ca;fa++)v.uvs[aa][fa]=qa[fa]}v.meshMaterials=ra;v.faceMaterials=Z.materials;v.overdraw=na;v.z=v.centroidScreen.z;N.push(v)}}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=t[n-
|
|
|
-2],J.copy(aa.positionScreen),R.copy(ka.positionScreen),e(J,R))J.multiplyScalar(1/J.w),R.multiplyScalar(1/R.w),ga=z[A]=z[A]||new THREE.RenderableLine,A++,y=ga,y.v1.positionScreen.copy(J),y.v2.positionScreen.copy(R),y.z=Math.max(J.z,R.z),y.materials=X.materials,N.push(y)}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=D[F]=D[F]||new THREE.RenderableParticle,F++,E=ga,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=
|
|
|
-X.rotation.z,E.scale.x=X.scale.x*Math.abs(E.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),E.scale.y=X.scale.y*Math.abs(E.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),E.materials=X.materials,N.push(E);h&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
|
|
|
+(ka.positionScreen.y-fa.positionScreen.y)*(ca.positionScreen.x-fa.positionScreen.x)<0)))qa=p[x]=p[x]||new THREE.RenderableFace4,x++,v=qa,v.v1.copy(aa),v.v2.copy(ka),v.v3.copy(fa),v.v4.copy(ca);else continue;v.normalWorld.copy(Z.normal);la.multiplyVector3(v.normalWorld);v.centroidWorld.copy(Z.centroid);ga.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);H.multiplyVector3(v.centroidScreen);fa=Z.vertexNormals;aa=0;for(ka=fa.length;aa<ka;aa++)ca=v.vertexNormalsWorld[aa],ca.copy(fa[aa]),
|
|
|
+la.multiplyVector3(ca);aa=0;for(ka=P.length;aa<ka;aa++)if(qa=P[aa][ia]){fa=0;for(ca=qa.length;fa<ca;fa++)v.uvs[aa][fa]=qa[fa]}v.meshMaterials=ra;v.faceMaterials=Z.materials;v.overdraw=na;v.z=v.centroidScreen.z;N.push(v)}}else if(X instanceof THREE.Line){B.multiply(H,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=t[n-
|
|
|
+2],J.copy(aa.positionScreen),R.copy(ka.positionScreen),e(J,R))J.multiplyScalar(1/J.w),R.multiplyScalar(1/R.w),ga=z[A]=z[A]||new THREE.RenderableLine,A++,y=ga,y.v1.positionScreen.copy(J),y.v2.positionScreen.copy(R),y.z=Math.max(J.z,R.z),y.materials=X.materials,N.push(y)}else if(X instanceof THREE.Particle&&(K.set(X.matrixWorld.n14,X.matrixWorld.n24,X.matrixWorld.n34,1),H.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ga=D[E]=D[E]||new THREE.RenderableParticle,E++,F=ga,F.x=K.x/K.w,F.y=K.y/K.w,F.z=K.z,F.rotation=
|
|
|
+X.rotation.z,F.scale.x=X.scale.x*Math.abs(F.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),F.scale.y=X.scale.y*Math.abs(F.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),F.materials=X.materials,N.push(F);h&&N.sort(c);return N}};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,t=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),t.sub(c.position,e.position),n.crossSelf(t);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,e,c,f,k,h,o){n=b.vertices[e].position;t=b.vertices[c].position;v=b.vertices[f].position;w=m[k];u=m[h];x=m[o];p=t.x-n.x;y=v.x-n.x;A=t.y-n.y;z=v.y-n.y;E=t.z-n.z;F=v.z-n.z;D=u.u-w.u;H=x.u-w.u;N=u.v-w.v;O=x.v-w.v;K=1/(D*O-H*N);J.set((O*p-N*y)*K,(O*A-N*z)*K,(O*E-N*F)*K);R.set((D*y-H*p)*K,(D*z-H*A)*K,(D*F-H*E)*K);B[e].addSelf(J);B[c].addSelf(J);B[f].addSelf(J);da[e].addSelf(R);
|
|
|
-da[c].addSelf(R);da[f].addSelf(R)}var c,e,f,h,k,m,n,t,v,w,u,x,p,y,A,z,E,F,D,H,N,O,K,G,B=[],da=[],J=new THREE.Vector3,R=new THREE.Vector3,S=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],S.copy(G),S.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(S.x,S.y,S.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,e,c,f,k,h,o){n=b.vertices[e].position;t=b.vertices[c].position;v=b.vertices[f].position;w=m[k];u=m[h];x=m[o];p=t.x-n.x;y=v.x-n.x;A=t.y-n.y;z=v.y-n.y;F=t.z-n.z;E=v.z-n.z;D=u.u-w.u;G=x.u-w.u;N=u.v-w.v;O=x.v-w.v;K=1/(D*O-G*N);J.set((O*p-N*y)*K,(O*A-N*z)*K,(O*F-N*E)*K);R.set((D*y-G*p)*K,(D*z-G*A)*K,(D*E-G*F)*K);B[e].addSelf(J);B[c].addSelf(J);B[f].addSelf(J);da[e].addSelf(R);
|
|
|
+da[c].addSelf(R);da[f].addSelf(R)}var c,e,f,h,k,m,n,t,v,w,u,x,p,y,A,z,F,E,D,G,N,O,K,H,B=[],da=[],J=new THREE.Vector3,R=new THREE.Vector3,S=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]],H=B[h],S.copy(H),S.subSelf(W.multiplyScalar(W.dot(H))).normalize(),Y.cross(k.vertexNormals[f],H),h=Y.dot(da[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(S.x,S.y,S.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 t,v,w,u,x,p,y,A;b=c.projectScene(e,f);t=0;for(v=b.length;t<v;t++)if(x=b[t],x instanceof THREE.RenderableParticle){y=x.x*h+h;A=x.y*k+k;w=0;for(u=x.material.length;w<u;w++)if(p=x.material[w],p instanceof THREE.ParticleDOMMaterial)p=p.domElement,p.style.left=y+"px",p.style.top=A+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(b){function c(b){if(z!=b)p.globalAlpha=z=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}E=b}}function f(b){if(F!=b)p.strokeStyle=F=b}function h(b){if(D!=b)p.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
-v,w,u,x,p=t.getContext("2d"),y=new THREE.Color(0),A=0,z=1,E=0,F=null,D=null,H=null,N=null,O=null,K,G,B,da,J=new THREE.RenderableVertex,R=new THREE.RenderableVertex,S,Y,W,o,ea,Q,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,P,oa,qa,wa,ta,Ea,Aa,Ca,Fa,L=new THREE.Rectangle,U=new THREE.Rectangle,M=new THREE.Rectangle,ua=!1,ha=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,xa=new THREE.Color,pa=new THREE.Vector3,
|
|
|
+THREE.CanvasRenderer=function(b){function c(b){if(z!=b)p.globalAlpha=z=b}function e(b){if(F!=b){switch(b){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}F=b}}function f(b){if(E!=b)p.strokeStyle=E=b}function h(b){if(D!=b)p.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
+v,w,u,x,p=t.getContext("2d"),y=new THREE.Color(0),A=0,z=1,F=0,E=null,D=null,G=null,N=null,O=null,K,H,B,da,J=new THREE.RenderableVertex,R=new THREE.RenderableVertex,S,Y,W,o,ea,Q,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,P,oa,qa,wa,ta,Ea,Aa,Ca,Fa,L=new THREE.Rectangle,U=new THREE.Rectangle,M=new THREE.Rectangle,ua=!1,ha=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,xa=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=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,e){v=b;w=e;u=Math.floor(v/2);x=Math.floor(w/2);t.width=v;
|
|
|
-t.height=w;L.set(-u,-x,u,x);U.set(-u,-x,u,x);z=1;E=0;O=N=H=D=F=null};this.setClearColor=function(b,e){y.copy(b);A=e;U.set(-u,-x,u,x)};this.setClearColorHex=function(b,e){y.setHex(b);A=e;U.set(-u,-x,u,x)};this.clear=function(){p.setTransform(1,0,0,-1,u,x);U.isEmpty()||(U.minSelf(L),U.inflate(2),A<1&&p.clearRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight())),A>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
|
|
|
+t.height=w;L.set(-u,-x,u,x);U.set(-u,-x,u,x);z=1;F=0;O=N=G=D=E=null};this.setClearColor=function(b,e){y.copy(b);A=e;U.set(-u,-x,u,x)};this.setClearColorHex=function(b,e){y.setHex(b);A=e;U.set(-u,-x,u,x)};this.clear=function(){p.setTransform(1,0,0,-1,u,x);U.isEmpty()||(U.minSelf(L),U.inflate(2),A<1&&p.clearRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight())),A>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
|
|
|
255)+","+A+")"),p.fillRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight()))),U.empty())};this.render=function(b,v){function t(b){var e,c,f,k=b.lights;ja.setRGB(0,0,0);ya.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b<e;b++)c=k[b],f=c.color,c instanceof THREE.AmbientLight?(ja.r+=f.r,ja.g+=f.g,ja.b+=f.b):c instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):c instanceof THREE.PointLight&&(xa.r+=f.r,xa.g+=f.g,xa.b+=f.b)}function w(b,e,c,
|
|
|
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=c.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=c.dot(pa.sub(h.position,e).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(e.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 y(b,k,m){c(m.opacity);e(m.blending);var o,n,v,t,w,va;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)t=
|
|
|
m.map.image,w=t.width>>1,va=t.height>>1,m=k.scale.x*u,v=k.scale.y*x,o=m*w,n=v*va,M.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(M)&&(p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(m,-v),p.translate(-w,-va),p.drawImage(t,0,0),p.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,n=k.scale.y*x,M.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(M)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(o,n),m.program(p),
|
|
|
-p.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);p.beginPath();p.moveTo(b.positionScreen.x,b.positionScreen.y);p.lineTo(k.positionScreen.x,k.positionScreen.y);p.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)p.lineWidth=H=b;b=m.linecap;if(N!=b)p.lineCap=N=b;b=m.linejoin;if(O!=b)p.lineJoin=O=b;f(m.color.getContextStyle());p.stroke();M.inflate(m.linewidth*2)}}function A(b,f,h,m,n,u,t,p,x){k.info.render.vertices+=3;k.info.render.faces++;c(p.opacity);e(p.blending);
|
|
|
-S=b.positionScreen.x;Y=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ea=h.positionScreen.x;Q=h.positionScreen.y;F(S,Y,W,o,ea,Q);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(S,Y,W,o,ea,Q,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=v.matrixWorldInverse,pa.copy(t.vertexNormalsWorld[0]),wa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
|
|
|
+p.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);p.beginPath();p.moveTo(b.positionScreen.x,b.positionScreen.y);p.lineTo(k.positionScreen.x,k.positionScreen.y);p.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(G!=b)p.lineWidth=G=b;b=m.linecap;if(N!=b)p.lineCap=N=b;b=m.linejoin;if(O!=b)p.lineJoin=O=b;f(m.color.getContextStyle());p.stroke();M.inflate(m.linewidth*2)}}function A(b,f,h,m,n,u,t,p,x){k.info.render.vertices+=3;k.info.render.faces++;c(p.opacity);e(p.blending);
|
|
|
+S=b.positionScreen.x;Y=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ea=h.positionScreen.x;Q=h.positionScreen.y;E(S,Y,W,o,ea,Q);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(S,Y,W,o,ea,Q,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=v.matrixWorldInverse,pa.copy(t.vertexNormalsWorld[0]),wa=(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(t.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(t.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(S,Y,W,o,ea,Q,wa,ta,Ea,Aa,Ca,Fa,p.envMap)}else p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&
|
|
|
(p.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(S,Y,W,o,ea,Q,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,p.map)),e(THREE.SubtractiveBlending)),ua?!p.wireframe&&p.shading==THREE.SmoothShading&&t.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,t.v1.positionWorld,t.vertexNormalsWorld[0],$),w(x,t.v2.positionWorld,t.vertexNormalsWorld[1],X),w(x,t.v3.positionWorld,t.vertexNormalsWorld[2],ga),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,
|
|
|
Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),X.r=Math.max(0,Math.min(p.color.r*X.r,1)),X.g=Math.max(0,Math.min(p.color.g*X.g,1)),X.b=Math.max(0,Math.min(p.color.b*X.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),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(S,Y,W,o,ea,Q,0,0,1,0,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,t.centroidWorld,t.normalWorld,
|
|
|
ha),ca.r=Math.max(0,Math.min(p.color.r*ha.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ha.b,1)),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)):p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshDepthMaterial)na=v.near,P=v.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,P),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,P),ga.r=ga.g=ga.b=1-Ra(h.positionScreen.z,
|
|
|
-na,P),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(S,Y,W,o,ea,Q,0,0,1,0,0,1,oa);else if(p instanceof THREE.MeshNormalMaterial)ca.r=Wa(t.normalWorld.x),ca.g=Wa(t.normalWorld.y),ca.b=Wa(t.normalWorld.z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)}function E(b,f,h,m,n,u,t,p,x){k.info.render.vertices+=4;k.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)A(b,f,m,0,1,3,t,p,x),A(n,h,u,1,2,3,t,p,x);else if(S=b.positionScreen.x,
|
|
|
+na,P),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(S,Y,W,o,ea,Q,0,0,1,0,0,1,oa);else if(p instanceof THREE.MeshNormalMaterial)ca.r=Wa(t.normalWorld.x),ca.g=Wa(t.normalWorld.y),ca.b=Wa(t.normalWorld.z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)}function F(b,f,h,m,n,u,t,p,x){k.info.render.vertices+=4;k.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)A(b,f,m,0,1,3,t,p,x),A(n,h,u,1,2,3,t,p,x);else if(S=b.positionScreen.x,
|
|
|
Y=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ea=h.positionScreen.x,Q=h.positionScreen.y,ma=m.positionScreen.x,Z=m.positionScreen.y,ia=n.positionScreen.x,aa=n.positionScreen.y,ka=u.positionScreen.x,fa=u.positionScreen.y,p instanceof THREE.MeshBasicMaterial)D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)ua?!p.wireframe&&p.shading==THREE.SmoothShading&&t.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,t.v1.positionWorld,t.vertexNormalsWorld[0],$),w(x,t.v2.positionWorld,t.vertexNormalsWorld[1],X),w(x,t.v4.positionWorld,t.vertexNormalsWorld[3],ga),w(x,t.v3.positionWorld,t.vertexNormalsWorld[2],la),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),X.r=Math.max(0,Math.min(p.color.r*X.r,1)),X.g=Math.max(0,Math.min(p.color.g*X.g,1)),X.b=Math.max(0,Math.min(p.color.b*
|
|
|
-X.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),la.r=Math.max(0,Math.min(p.color.r*la.r,1)),la.g=Math.max(0,Math.min(p.color.g*la.g,1)),la.b=Math.max(0,Math.min(p.color.b*la.b,1)),oa=Ya($,X,ga,la),F(S,Y,W,o,ma,Z),Va(S,Y,W,o,ma,Z,0,0,1,0,0,1,oa),F(ia,aa,ea,Q,ka,fa),Va(ia,aa,ea,Q,ka,fa,1,0,1,1,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,t.centroidWorld,t.normalWorld,ha),ca.r=Math.max(0,Math.min(p.color.r*ha.r,
|
|
|
+X.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),la.r=Math.max(0,Math.min(p.color.r*la.r,1)),la.g=Math.max(0,Math.min(p.color.g*la.g,1)),la.b=Math.max(0,Math.min(p.color.b*la.b,1)),oa=Ya($,X,ga,la),E(S,Y,W,o,ma,Z),Va(S,Y,W,o,ma,Z,0,0,1,0,0,1,oa),E(ia,aa,ea,Q,ka,fa),Va(ia,aa,ea,Q,ka,fa,1,0,1,1,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,t.centroidWorld,t.normalWorld,ha),ca.r=Math.max(0,Math.min(p.color.r*ha.r,
|
|
|
1)),ca.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ha.b,1)),D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)):(D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color));else if(p instanceof THREE.MeshNormalMaterial)ca.r=Wa(t.normalWorld.x),ca.g=Wa(t.normalWorld.y),ca.b=Wa(t.normalWorld.z),D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,
|
|
|
-p.wireframeLinejoin):Oa(ca);else if(p instanceof THREE.MeshDepthMaterial)na=v.near,P=v.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,P),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,P),ga.r=ga.g=ga.b=1-Ra(m.positionScreen.z,na,P),la.r=la.g=la.b=1-Ra(h.positionScreen.z,na,P),oa=Ya($,X,ga,la),F(S,Y,W,o,ma,Z),Va(S,Y,W,o,ma,Z,0,0,1,0,0,1,oa),F(ia,aa,ea,Q,ka,fa),Va(ia,aa,ea,Q,ka,fa,1,0,1,1,0,1,oa)}function F(b,e,c,f,k,h){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(b,e);p.closePath()}function D(b,
|
|
|
-e,c,f,k,h,m,o){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(m,o);p.lineTo(b,e);p.closePath()}function Na(b,e,c,k){if(H!=e)p.lineWidth=H=e;if(N!=c)p.lineCap=N=c;if(O!=k)p.lineJoin=O=k;f(b.getContextStyle());p.stroke();M.inflate(e*2)}function Oa(b){h(b.getContextStyle());p.fill()}function ab(b,e,c,f,k,m,o,n,u,t,v,w,va){if(va.image.width!=0){if(va.needsUpdate==!0||ra[va.id]==void 0){var x=va.wrapS==THREE.RepeatWrapping,y=va.wrapT==THREE.RepeatWrapping;ra[va.id]=p.createPattern(va.image,
|
|
|
+p.wireframeLinejoin):Oa(ca);else if(p instanceof THREE.MeshDepthMaterial)na=v.near,P=v.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,P),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,P),ga.r=ga.g=ga.b=1-Ra(m.positionScreen.z,na,P),la.r=la.g=la.b=1-Ra(h.positionScreen.z,na,P),oa=Ya($,X,ga,la),E(S,Y,W,o,ma,Z),Va(S,Y,W,o,ma,Z,0,0,1,0,0,1,oa),E(ia,aa,ea,Q,ka,fa),Va(ia,aa,ea,Q,ka,fa,1,0,1,1,0,1,oa)}function E(b,e,c,f,k,h){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(b,e);p.closePath()}function D(b,
|
|
|
+e,c,f,k,h,m,o){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(m,o);p.lineTo(b,e);p.closePath()}function Na(b,e,c,k){if(G!=e)p.lineWidth=G=e;if(N!=c)p.lineCap=N=c;if(O!=k)p.lineJoin=O=k;f(b.getContextStyle());p.stroke();M.inflate(e*2)}function Oa(b){h(b.getContextStyle());p.fill()}function ab(b,e,c,f,k,m,o,n,u,t,v,w,va){if(va.image.width!=0){if(va.needsUpdate==!0||ra[va.id]==void 0){var x=va.wrapS==THREE.RepeatWrapping,y=va.wrapT==THREE.RepeatWrapping;ra[va.id]=p.createPattern(va.image,
|
|
|
x&&y?"repeat":x&&!y?"repeat-x":!x&&y?"repeat-y":"no-repeat");va.needsUpdate=!1}h(ra[va.id]);var x=va.offset.x/va.repeat.x,y=va.offset.y/va.repeat.y,L=(va.image.width-1)*va.repeat.x,va=(va.image.height-1)*va.repeat.y,o=(o+x)*L,n=(n+y)*va,u=(u+x)*L,t=(t+y)*va,v=(v+x)*L,w=(w+y)*va;c-=b;f-=e;k-=b;m-=e;u-=o;t-=n;v-=o;w-=n;x=1/(u*w-v*t);va=(w*c-t*k)*x;t=(w*f-t*m)*x;c=(u*k-v*c)*x;f=(u*m-v*f)*x;b=b-va*o-c*n;e=e-t*o-f*n;p.save();p.transform(va,t,c,f,b,e);p.fill();p.restore()}}function Va(b,e,c,f,k,m,h,o,n,
|
|
|
u,t,v,va){var w,x;w=va.width-1;x=va.height-1;h*=w;o*=x;n*=w;u*=x;t*=w;v*=x;c-=b;f-=e;k-=b;m-=e;n-=h;u-=o;t-=h;v-=o;x=1/(n*v-t*u);w=(v*c-u*k)*x;u=(v*f-u*m)*x;c=(n*k-t*c)*x;f=(n*m-t*f)*x;b=b-w*h-c*o;e=e-u*h-f*o;p.save();p.transform(w,u,c,f,b,e);p.clip();p.drawImage(va,0,0);p.restore()}function Ya(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),u=~~(f.r*255),t=~~(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]=e<0?0:e>255?255:e;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=c<0?0:c>255?255:c;Ba[12]=u<0?0:u>255?255:u;Ba[13]=t<0?0:t>255?255:t;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);V.drawImage(Ia,0,0);return Ga}function Ra(b,e,c){b=(b-e)/(c-e);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,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,
|
|
|
-f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Za,bb,sa,Ha,Qa,Xa,$a,za;this.autoClear?this.clear():p.setTransform(1,0,0,-1,u,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,v,this.sortElements);(ua=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){sa=m[Za];M.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&&y(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,M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(G.positionScreen.x,G.positionScreen.y),L.intersects(M)){Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&z(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)),M.add3Points(K.positionScreen.x,K.positionScreen.y,G.positionScreen.x,G.positionScreen.y,B.positionScreen.x,B.positionScreen.y),L.intersects(M)){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),R.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,R.positionScreen)),M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(G.positionScreen.x,G.positionScreen.y),M.addPoint(B.positionScreen.x,B.positionScreen.y),M.addPoint(da.positionScreen.x,da.positionScreen.y),L.intersects(M))){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,G,B,da,J,R,sa,za,b)}else za.opacity!=
|
|
|
-0&&E(K,G,B,da,J,R,sa,za,b)}U.addRectangle(M)}p.setTransform(1,0,0,1,0,0)}};
|
|
|
+f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Za,bb,sa,Ha,Qa,Xa,$a,za;this.autoClear?this.clear():p.setTransform(1,0,0,-1,u,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,v,this.sortElements);(ua=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){sa=m[Za];M.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&&y(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,M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(H.positionScreen.x,H.positionScreen.y),L.intersects(M)){Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&z(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)),M.add3Points(K.positionScreen.x,K.positionScreen.y,H.positionScreen.x,H.positionScreen.y,B.positionScreen.x,B.positionScreen.y),L.intersects(M)){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,da=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,da.positionScreen.x*=u,da.positionScreen.y*=x,J.positionScreen.copy(H.positionScreen),R.positionScreen.copy(da.positionScreen),sa.overdraw&&(Pa(K.positionScreen,H.positionScreen),Pa(H.positionScreen,da.positionScreen),Pa(da.positionScreen,K.positionScreen),Pa(B.positionScreen,
|
|
|
+J.positionScreen),Pa(B.positionScreen,R.positionScreen)),M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(H.positionScreen.x,H.positionScreen.y),M.addPoint(B.positionScreen.x,B.positionScreen.y),M.addPoint(da.positionScreen.x,da.positionScreen.y),L.intersects(M))){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&&F(K,H,B,da,J,R,sa,za,b)}else za.opacity!=
|
|
|
+0&&F(K,H,B,da,J,R,sa,za,b)}U.addRectangle(M)}p.setTransform(1,0,0,1,0,0)}};
|
|
|
THREE.SVGRenderer=function(){function b(b,e,c){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=e.normalWorld.dot(h.position)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(da.sub(h.position,e.centroidWorld),da.normalize(),m=e.normalWorld.dot(da)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,m,o,n,p){k.info.render.vertices+=3;k.info.render.faces++;S=f(Y++);
|
|
|
-S.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(N.r=O.r,N.g=O.g,N.b=O.b,b(p,o,N),H.r=Math.max(0,Math.min(n.color.r*N.r,1)),H.g=Math.max(0,Math.min(n.color.g*N.g,1)),H.b=Math.max(0,Math.min(n.color.b*N.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?S.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):S.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(S)}function e(e,c,m,n,o,p,u){k.info.render.vertices+=
|
|
|
-4;k.info.render.faces++;S=f(Y++);S.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?H.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(N.r=O.r,N.g=O.g,N.b=O.b,b(u,o,N),H.r=Math.max(0,Math.min(p.color.r*N.r,1)),H.g=Math.max(0,Math.min(p.color.g*N.g,1)),H.b=Math.max(0,Math.min(p.color.b*N.b,1))):
|
|
|
-H.copy(p.color):p instanceof THREE.MeshDepthMaterial?(B=1-p.__2near/(p.__farPlusNear-o.z*p.__farMinusNear),H.setRGB(B,B,B)):p instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));p.wireframe?S.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):S.setAttribute("style","fill: "+H.getContextStyle()+
|
|
|
-"; fill-opacity: "+p.opacity);t.appendChild(S)}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,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),v,w,u,x,p,y,A,z,E=new THREE.Rectangle,F=new THREE.Rectangle,D=!1,H=new THREE.Color(16777215),N=new THREE.Color(16777215),O=new THREE.Color(0),
|
|
|
-K=new THREE.Color(0),G=new THREE.Color(0),B,da=new THREE.Vector3,J=[],R=[],S,Y,W,o=1;this.domElement=t;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,e){v=b;w=e;u=v/2;x=w/2;t.setAttribute("viewBox",-u+" "+-x+" "+v+" "+w);t.setAttribute("width",v);t.setAttribute("height",w);E.set(-u,-x,u,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};
|
|
|
-this.render=function(b,f){var h,v,w,H,N,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(D=b.lights.length>0){B=b.lights;O.setRGB(0,0,0);K.setRGB(0,0,0);G.setRGB(0,0,0);h=0;for(v=B.length;h<v;h++)w=B[h],H=w.color,w instanceof THREE.AmbientLight?(O.r+=H.r,O.g+=H.g,O.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(v=m.length;h<
|
|
|
-v;h++)if(B=m[h],F.empty(),B instanceof THREE.RenderableParticle){p=B;p.x*=u;p.y*=-x;w=0;for(H=B.materials.length;w<H;)w++}else if(B instanceof THREE.RenderableLine){if(p=B.v1,y=B.v2,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,F.addPoint(p.positionScreen.x,p.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),E.intersects(F)){w=0;for(H=B.materials.length;w<H;)if(($=B.materials[w++])&&$.opacity!=0){N=p;J=y;var X=W++;R[X]==null&&(R[X]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+S.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(N.r=O.r,N.g=O.g,N.b=O.b,b(p,o,N),G.r=Math.max(0,Math.min(n.color.r*N.r,1)),G.g=Math.max(0,Math.min(n.color.g*N.g,1)),G.b=Math.max(0,Math.min(n.color.b*N.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?S.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):S.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(S)}function e(e,c,m,n,o,p,u){k.info.render.vertices+=
|
|
|
+4;k.info.render.faces++;S=f(Y++);S.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?G.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(N.r=O.r,N.g=O.g,N.b=O.b,b(u,o,N),G.r=Math.max(0,Math.min(p.color.r*N.r,1)),G.g=Math.max(0,Math.min(p.color.g*N.g,1)),G.b=Math.max(0,Math.min(p.color.b*N.b,1))):
|
|
|
+G.copy(p.color):p instanceof THREE.MeshDepthMaterial?(B=1-p.__2near/(p.__farPlusNear-o.z*p.__farMinusNear),G.setRGB(B,B,B)):p instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));p.wireframe?S.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):S.setAttribute("style","fill: "+G.getContextStyle()+
|
|
|
+"; fill-opacity: "+p.opacity);t.appendChild(S)}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,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),v,w,u,x,p,y,A,z,F=new THREE.Rectangle,E=new THREE.Rectangle,D=!1,G=new THREE.Color(16777215),N=new THREE.Color(16777215),O=new THREE.Color(0),
|
|
|
+K=new THREE.Color(0),H=new THREE.Color(0),B,da=new THREE.Vector3,J=[],R=[],S,Y,W,o=1;this.domElement=t;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,e){v=b;w=e;u=v/2;x=w/2;t.setAttribute("viewBox",-u+" "+-x+" "+v+" "+w);t.setAttribute("width",v);t.setAttribute("height",w);F.set(-u,-x,u,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};
|
|
|
+this.render=function(b,f){var h,v,w,G,N,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(D=b.lights.length>0){B=b.lights;O.setRGB(0,0,0);K.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(v=B.length;h<v;h++)w=B[h],G=w.color,w instanceof THREE.AmbientLight?(O.r+=G.r,O.g+=G.g,O.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(v=m.length;h<
|
|
|
+v;h++)if(B=m[h],E.empty(),B instanceof THREE.RenderableParticle){p=B;p.x*=u;p.y*=-x;w=0;for(G=B.materials.length;w<G;)w++}else if(B instanceof THREE.RenderableLine){if(p=B.v1,y=B.v2,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),F.intersects(E)){w=0;for(G=B.materials.length;w<G;)if(($=B.materials[w++])&&$.opacity!=0){N=p;J=y;var X=W++;R[X]==null&&(R[X]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
"line"),o==0&&R[X].setAttribute("shape-rendering","crispEdges"));S=R[X];S.setAttribute("x1",N.positionScreen.x);S.setAttribute("y1",N.positionScreen.y);S.setAttribute("x2",J.positionScreen.x);S.setAttribute("y2",J.positionScreen.y);$ instanceof THREE.LineBasicMaterial&&(S.setAttribute("style","fill: none; stroke: "+$.color.getContextStyle()+"; stroke-width: "+$.linewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.linecap+"; stroke-linejoin: "+$.linejoin),t.appendChild(S))}}}else if(B instanceof
|
|
|
-THREE.RenderableFace3){if(p=B.v1,y=B.v2,A=B.v3,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,F.addPoint(p.positionScreen.x,p.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),E.intersects(F)){w=0;for(H=B.meshMaterials.length;w<H;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){N=0;for(J=B.faceMaterials.length;N<J;)($=B.faceMaterials[N++])&&
|
|
|
-$.opacity!=0&&c(p,y,A,B,$,b)}else $&&$.opacity!=0&&c(p,y,A,B,$,b)}}else if(B instanceof THREE.RenderableFace4&&(p=B.v1,y=B.v2,A=B.v3,z=B.v4,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,F.addPoint(p.positionScreen.x,p.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),
|
|
|
-E.intersects(F))){w=0;for(H=B.meshMaterials.length;w<H;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){N=0;for(J=B.faceMaterials.length;N<J;)($=B.faceMaterials[N++])&&$.opacity!=0&&e(p,y,A,z,B,$,b)}else $&&$.opacity!=0&&e(p,y,A,z,B,$,b)}}};
|
|
|
+THREE.RenderableFace3){if(p=B.v1,y=B.v2,A=B.v3,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(A.positionScreen.x,A.positionScreen.y),F.intersects(E)){w=0;for(G=B.meshMaterials.length;w<G;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){N=0;for(J=B.faceMaterials.length;N<J;)($=B.faceMaterials[N++])&&
|
|
|
+$.opacity!=0&&c(p,y,A,B,$,b)}else $&&$.opacity!=0&&c(p,y,A,B,$,b)}}else if(B instanceof THREE.RenderableFace4&&(p=B.v1,y=B.v2,A=B.v3,z=B.v4,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(A.positionScreen.x,A.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),
|
|
|
+F.intersects(E))){w=0;for(G=B.meshMaterials.length;w<G;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){N=0;for(J=B.faceMaterials.length;N<J;)($=B.faceMaterials[N++])&&$.opacity!=0&&e(p,y,A,z,B,$,b)}else $&&$.opacity!=0&&e(p,y,A,z,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,44 +223,44 @@ THREE.WebGLRenderer=function(b){function c(b,e,c){var f,k,h,m=b.vertices,n=m.len
|
|
|
for(f=0;f<u;f++)h=f*3,color=p[w[f][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(L)for(z in L){f=L[z];p=f.value.length;for(h=0;h<p;h++){index=w[h][1];u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")M=f.value[index];f.size===2?(f.array[u]=M.x,f.array[u+1]=M.y):f.size===3?f.type==="c"?(f.array[u]=M.r,f.array[u+1]=M.g,f.array[u+2]=M.b):(f.array[u]=M.x,f.array[u+1]=M.y,f.array[u+2]=M.z):(f.array[u]=
|
|
|
M.x,f.array[u+1]=M.y,f.array[u+2]=M.z,f.array[u+3]=M.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,t[h]=k.x,t[h+1]=k.y,t[h+2]=k.z;if(y)for(f=0;f<u;f++)color=p[f],h=f*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(L)for(z in L)if(f=L[z],f.__original.needsUpdate){p=f.value.length;for(h=0;h<p;h++){u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")M=f.value[h];f.size===2?(f.array[u]=
|
|
|
M.x,f.array[u+1]=M.y):f.size===3?f.type==="c"?(f.array[u]=M.r,f.array[u+1]=M.g,f.array[u+2]=M.b):(f.array[u]=M.x,f.array[u+1]=M.y,f.array[u+2]=M.z):(f.array[u]=M.x,f.array[u+1]=M.y,f.array[u+2]=M.z,f.array[u+3]=M.w)}f.offset+=f.size}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,t,e);if(y||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,v,e);if(L)for(z in L)if(f=L[z],f.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
-f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,k){f.program||W.initMaterial(f,e,c,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,u=f.uniforms;h!=Q&&(o.useProgram(h),Q=h,n=!0);if(f.id!=Z)Z=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(c&&f.fog)if(u.fogColor.value=c.color,c instanceof
|
|
|
-THREE.Fog)u.fogNear.value=c.near,u.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)u.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var p,t,v=0,w=0,x=0,y,z,M,A=Fa,U=A.directional.colors,E=A.directional.positions,F=A.point.colors,D=A.point.positions,H=A.point.distances,na=0,ua=0,c=p=M=0,n=e.length;c<n;c++)if(p=e[c],t=p.color,y=p.position,z=p.intensity,M=p.distance,p instanceof THREE.AmbientLight)v+=t.r,w+=t.g,x+=t.b;else if(p instanceof
|
|
|
-THREE.DirectionalLight)M=na*3,U[M]=t.r*z,U[M+1]=t.g*z,U[M+2]=t.b*z,E[M]=y.x,E[M+1]=y.y,E[M+2]=y.z,na+=1;else if(p instanceof THREE.SpotLight)M=na*3,U[M]=t.r*z,U[M+1]=t.g*z,U[M+2]=t.b*z,t=1/y.length(),E[M]=y.x*t,E[M+1]=y.y*t,E[M+2]=y.z*t,na+=1;else if(p instanceof THREE.PointLight)p=ua*3,F[p]=t.r*z,F[p+1]=t.g*z,F[p+2]=t.b*z,D[p]=y.x,D[p+1]=y.y,D[p+2]=y.z,H[ua]=M,ua+=1;c=na*3;for(n=U.length;c<n;c++)U[c]=0;c=ua*3;for(n=F.length;c<n;c++)F[c]=0;A.point.length=ua;A.directional.length=na;A.ambient[0]=v;
|
|
|
-A.ambient[1]=w;A.ambient[2]=x;e=Fa;u.enableLighting.value=e.directional.length+e.point.length;u.ambientLightColor.value=e.ambient;u.directionalLightColor.value=e.directional.colors;u.directionalLightDirection.value=e.directional.positions;u.pointLightColor.value=e.point.colors;u.pointLightPosition.value=e.point.positions;u.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)u.diffuse.value=
|
|
|
-f.color,u.opacity.value=f.opacity,(u.map.texture=f.map)&&u.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),u.lightMap.texture=f.lightMap,u.envMap.texture=f.envMap,u.reflectivity.value=f.reflectivity,u.refractionRatio.value=f.refractionRatio,u.combine.value=f.combine,u.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)u.diffuse.value=f.color,u.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)u.psColor.value=
|
|
|
-f.color,u.opacity.value=f.opacity,u.size.value=f.size,u.scale.value=L.height/2,u.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)u.ambient.value=f.ambient,u.specular.value=f.specular,u.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)u.mNear.value=b.near,u.mFar.value=b.far,u.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)u.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&u.shadowMatrix){for(e=0;e<pa.length;e++)u.shadowMatrix.value[e]=
|
|
|
-pa[e],u.shadowMap.texture[e]=W.shadowMap[e];u.shadowDarkness.value=W.shadowMapDarkness;u.shadowBias.value=W.shadowMapBias}e=f.uniformsList;u=0;for(c=e.length;u<c;u++)if(w=h.uniforms[e[u][1]])if(v=e[u][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,
|
|
|
+f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,k){f.program||W.initMaterial(f,e,c,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,p=f.uniforms;h!=Q&&(o.useProgram(h),Q=h,n=!0);if(f.id!=Z)Z=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(c&&f.fog)if(p.fogColor.value=c.color,c instanceof
|
|
|
+THREE.Fog)p.fogNear.value=c.near,p.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)p.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var u,t,v=0,w=0,x=0,y,z,M,A=Fa,U=A.directional.colors,F=A.directional.positions,E=A.point.colors,D=A.point.positions,G=A.point.distances,na=0,ua=0,c=u=M=0,n=e.length;c<n;c++)if(u=e[c],t=u.color,y=u.position,z=u.intensity,M=u.distance,u instanceof THREE.AmbientLight)v+=t.r,w+=t.g,x+=t.b;else if(u instanceof
|
|
|
+THREE.DirectionalLight)M=na*3,U[M]=t.r*z,U[M+1]=t.g*z,U[M+2]=t.b*z,F[M]=y.x,F[M+1]=y.y,F[M+2]=y.z,na+=1;else if(u instanceof THREE.SpotLight)M=na*3,U[M]=t.r*z,U[M+1]=t.g*z,U[M+2]=t.b*z,t=1/y.length(),F[M]=y.x*t,F[M+1]=y.y*t,F[M+2]=y.z*t,na+=1;else if(u instanceof THREE.PointLight)u=ua*3,E[u]=t.r*z,E[u+1]=t.g*z,E[u+2]=t.b*z,D[u]=y.x,D[u+1]=y.y,D[u+2]=y.z,G[ua]=M,ua+=1;c=na*3;for(n=U.length;c<n;c++)U[c]=0;c=ua*3;for(n=E.length;c<n;c++)E[c]=0;A.point.length=ua;A.directional.length=na;A.ambient[0]=v;
|
|
|
+A.ambient[1]=w;A.ambient[2]=x;e=Fa;p.enableLighting.value=e.directional.length+e.point.length;p.ambientLightColor.value=e.ambient;p.directionalLightColor.value=e.directional.colors;p.directionalLightDirection.value=e.directional.positions;p.pointLightColor.value=e.point.colors;p.pointLightPosition.value=e.point.positions;p.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)p.diffuse.value=
|
|
|
+f.color,p.opacity.value=f.opacity,(p.map.texture=f.map)&&p.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),p.lightMap.texture=f.lightMap,p.envMap.texture=f.envMap,p.reflectivity.value=f.reflectivity,p.refractionRatio.value=f.refractionRatio,p.combine.value=f.combine,p.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)p.diffuse.value=f.color,p.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)p.psColor.value=
|
|
|
+f.color,p.opacity.value=f.opacity,p.size.value=f.size,p.scale.value=L.height/2,p.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)p.ambient.value=f.ambient,p.specular.value=f.specular,p.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)p.mNear.value=b.near,p.mFar.value=b.far,p.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)p.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&p.shadowMatrix){for(e=0;e<pa.length;e++)p.shadowMatrix.value[e]=
|
|
|
+pa[e],p.shadowMap.texture[e]=W.shadowMap[e];p.shadowDarkness.value=W.shadowMapDarkness;p.shadowBias.value=W.shadowMapBias}e=f.uniformsList;p=0;for(c=e.length;p<c;p++)if(w=h.uniforms[e[p][1]])if(v=e[p][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(y=n.length;x<y;x++)A=x*3,v._array[A]=n[x].x,v._array[A+1]=n[x].y,v._array[A+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(y=n.length;x<y;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(y=v.texture.length;x<y;x++)v._array[x]=n+x}o.uniform1iv(w,v._array);x=0;for(y=v.texture.length;x<y;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]),
|
|
|
-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 u=0,p=m.morphTargetForcedOrder,v=m.morphTargetInfluences;u<k.numSupportedMorphTargets&&u<p.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[u]]),o.vertexAttribPointer(f["morphTarget"+u],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[u]=v[p[u]],u++;else{var p=[],t=-1,
|
|
|
-w=0,v=m.morphTargetInfluences,x,y=v.length,u=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);u<k.numSupportedMorphTargets;){for(x=0;x<y;x++)!p[x]&&v[x]>t&&(w=x,t=v[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+u],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[u]=t;p[w]=1;t=-1;u++}}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]>=
|
|
|
+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 p=0,u=m.morphTargetForcedOrder,v=m.morphTargetInfluences;p<k.numSupportedMorphTargets&&p<u.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u[p]]),o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[p]=v[u[p]],p++;else{var u=[],t=-1,
|
|
|
+w=0,v=m.morphTargetInfluences,x,y=v.length,p=0;for(m.morphTargetBase!==-1&&(u[m.morphTargetBase]=!0);p<k.numSupportedMorphTargets;){for(x=0;x<y;x++)!u[x]&&v[x]>t&&(w=x,t=v[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[p]=t;u[w]=1;t=-1;p++}}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,e,c){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(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
-b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,u,p,v,t,w,x=b.count*3;for(w=0;w<x;w+=9)c=b.normalArray,f=c[w],h=c[w+1],k=c[w+2],m=c[w+3],u=c[w+4],v=c[w+5],n=c[w+6],p=c[w+7],t=c[w+8],f=(f+m+n)/3,h=(h+u+p)/3,k=(k+v+t)/3,c[w]=f,c[w+1]=h,c[w+2]=k,c[w+3]=f,c[w+4]=h,c[w+5]=k,c[w+6]=f,c[w+7]=h,c[w+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(e.attributes.normal);o.vertexAttribPointer(e.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
|
|
|
+b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,p,u,v,t,w,x=b.count*3;for(w=0;w<x;w+=9)c=b.normalArray,f=c[w],h=c[w+1],k=c[w+2],m=c[w+3],p=c[w+4],v=c[w+5],n=c[w+6],u=c[w+7],t=c[w+8],f=(f+m+n)/3,h=(h+p+u)/3,k=(k+v+t)/3,c[w]=f,c[w+1]=h,c[w+2]=k,c[w+3]=f,c[w+4]=h,c[w+5]=k,c[w+6]=f,c[w+7]=h,c[w+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(e.attributes.normal);o.vertexAttribPointer(e.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 t(b,e,c){ga!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ga=b);if(b&&(la!=e||ra!=c))o.polygonOffset(e,c),la=e,ra=c}function v(b){wa[0].set(b.n41-
|
|
|
b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);wa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);wa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);wa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);wa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);wa[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=wa[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function w(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
|
|
|
Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=wa[f].x*e.n14+wa[f].y*e.n24+wa[f].z*e.n34+wa[f].w,b<=c)return!1;return!0}function u(b,e){b.list[b.count]=e;b.count+=1}function x(b){var e,c,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?u(k,c):u(h,c)}function p(b){var e,c,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(e=k.materials[b],e instanceof THREE.MeshFaceMaterial){e=
|
|
|
-0;for(c=m.materials.length;e<c;e++)(h=m.materials[e])&&(h.transparent?u(o,h):u(n,h))}else(h=e)&&(h.transparent?u(o,h):u(n,h))}function y(b,e){return e.z-b.z}function A(b){var c,n,u,p=0,t,x,y,L,z=b.lights;if(!xa)xa=new THREE.Camera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar),xa.useTarget=!0;c=0;for(n=z.length;c<n;c++)if(u=z[c],u instanceof THREE.SpotLight&&u.castShadow){Z=-1;W.shadowMap[p]||(W.shadowMap[p]=new THREE.WebGLRenderTarget(W.shadowMapWidth,
|
|
|
-W.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[p]||(pa[p]=new THREE.Matrix4);t=W.shadowMap[p];x=pa[p];xa.position.copy(u.position);xa.target.position.copy(u.target.position);xa.update(void 0,!0);b.update(void 0,!1,xa);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(xa.projectionMatrix);x.multiplySelf(xa.matrixWorldInverse);xa.matrixWorldInverse.flattenToArray(Aa);xa.projectionMatrix.flattenToArray(Ea);ta.multiply(xa.projectionMatrix,
|
|
|
-xa.matrixWorldInverse);v(ta);W.initWebGLObjects(b);da(t);o.clearColor(1,1,1,1);W.clear();o.clearColor(ha.r,ha.g,ha.b,ja);x=b.__webglObjects.length;u=b.__webglObjectsImmediate.length;for(t=0;t<x;t++)y=b.__webglObjects[t],L=y.object,L.visible&&L.castShadow?!(L instanceof THREE.Mesh)||!L.frustumCulled||w(L)?(L.matrixWorld.flattenToArray(L._objectMatrixArray),E(L,xa,!1),y.render=!0):y.render=!1:y.render=!1;m(!0);K(THREE.NormalBlending);for(t=0;t<x;t++)if(y=b.__webglObjects[t],y.render)L=y.object,buffer=
|
|
|
-y.buffer,k(L),y=L.customDepthMaterial?L.customDepthMaterial:L.geometry.morphTargets.length?Ka:Da,f(xa,z,null,y,buffer,L);for(t=0;t<u;t++)y=b.__webglObjectsImmediate[t],L=y.object,L.visible&&L.castShadow&&(L.matrixAutoUpdate&&L.matrixWorld.flattenToArray(L._objectMatrixArray),E(L,xa,!1),k(L),program=e(xa,z,null,Da,L),L.immediateRenderCallback?L.immediateRenderCallback(program,o,wa):L.render(function(b){h(b,program,Da.shading)}));p++}}function z(b,e){var c,f,h;c=V.attributes;var k=V.uniforms,m=qa/oa,
|
|
|
-n,u=[],p=oa*0.5,t=qa*0.5,v=!0;o.useProgram(V.program);Q=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(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.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);
|
|
|
+0;for(c=m.materials.length;e<c;e++)(h=m.materials[e])&&(h.transparent?u(o,h):u(n,h))}else(h=e)&&(h.transparent?u(o,h):u(n,h))}function y(b,e){return e.z-b.z}function A(b){var c,n,p,u=0,t,x,y,L,z=b.lights;if(!xa)xa=new THREE.Camera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar),xa.useTarget=!0;c=0;for(n=z.length;c<n;c++)if(p=z[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);t=W.shadowMap[u];x=pa[u];xa.position.copy(p.position);xa.target.position.copy(p.target.position);xa.update(void 0,!0);b.update(void 0,!1,xa);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(xa.projectionMatrix);x.multiplySelf(xa.matrixWorldInverse);xa.matrixWorldInverse.flattenToArray(Aa);xa.projectionMatrix.flattenToArray(Ea);ta.multiply(xa.projectionMatrix,
|
|
|
+xa.matrixWorldInverse);v(ta);W.initWebGLObjects(b);da(t);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(t=0;t<x;t++)y=b.__webglObjects[t],L=y.object,L.visible&&L.castShadow?!(L instanceof THREE.Mesh)||!L.frustumCulled||w(L)?(L.matrixWorld.flattenToArray(L._objectMatrixArray),F(L,xa,!1),y.render=!0):y.render=!1:y.render=!1;m(!0);K(THREE.NormalBlending);for(t=0;t<x;t++)if(y=b.__webglObjects[t],y.render)L=y.object,buffer=
|
|
|
+y.buffer,k(L),y=L.customDepthMaterial?L.customDepthMaterial:L.geometry.morphTargets.length?Ka:Da,f(xa,z,null,y,buffer,L);for(t=0;t<p;t++)y=b.__webglObjectsImmediate[t],L=y.object,L.visible&&L.castShadow&&(L.matrixAutoUpdate&&L.matrixWorld.flattenToArray(L._objectMatrixArray),F(L,xa,!1),k(L),program=e(xa,z,null,Da,L),L.immediateRenderCallback?L.immediateRenderCallback(program,o,wa):L.render(function(b){h(b,program,Da.shading)}));u++}}function z(b,e){var c,f,h;c=V.attributes;var k=V.uniforms,m=qa/oa,
|
|
|
+n,p=[],u=oa*0.5,t=qa*0.5,v=!0;o.useProgram(V.program);Q=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(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.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);c=0;for(f=b.__webglSprites.length;c<f;c++)if(h=b.__webglSprites[c],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(y);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],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,(t-h.position.y)/t,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),u[0]=n*m*h.scale.x,u[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,u),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 E(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
-function F(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function D(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function H(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function N(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}
|
|
|
-var c,f,h,k,m,n,o,u,p={},t=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=e(n),p[o]==void 0&&(p[o]={hash:o,counter:0}),u=p[o].hash+"_"+p[o].counter,b.geometryGroups[u]==void 0&&(b.geometryGroups[u]={faces:[],materials:n,vertices:0,numMorphTargets:t}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[u].vertices+m>65535&&(p[o].counter+=1,u=p[o].hash+"_"+p[o].counter,b.geometryGroups[u]==void 0&&(b.geometryGroups[u]={faces:[],
|
|
|
-materials:n,vertices:0,numMorphTargets:t})),b.geometryGroups[u].faces.push(h),b.geometryGroups[u].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=aa++,b.geometryGroupsList.push(b.geometryGroups[v])}function O(b,e,c){b.push({buffer:e,object:c,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,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,Y(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,Y(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Y(e.magFilter)),
|
|
|
+(h.position.x-u)/u,(t-h.position.y)/t,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),p[0]=n*m*h.scale.x,p[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,p),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 F(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
+function E(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function D(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function G(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function N(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}
|
|
|
+var c,f,h,k,m,n,o,p,u={},t=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=e(n),u[o]==void 0&&(u[o]={hash:o,counter:0}),p=u[o].hash+"_"+u[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:t}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+m>65535&&(u[o].counter+=1,p=u[o].hash+"_"+u[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],
|
|
|
+materials:n,vertices:0,numMorphTargets:t})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=aa++,b.geometryGroupsList.push(b.geometryGroups[v])}function O(b,e,c){b.push({buffer:e,object:c,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 H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,Y(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,Y(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Y(e.magFilter)),
|
|
|
o.texParameteri(b,o.TEXTURE_MIN_FILTER,Y(e.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,S(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,S(e.minFilter)))}function B(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);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+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function da(b){var e=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(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);G(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,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),
|
|
|
+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);H(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function da(b){var e=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(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);H(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,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),H(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(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+c,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);e?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?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=oa,b=qa,f=na,h=P);e!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ma=e)}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),
|
|
@@ -280,59 +280,59 @@ function(b,e){ha.setHex(b);ja=e;o.clearColor(ha.r,ha.g,ha.b,ja)};this.setClearCo
|
|
|
delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);o.deleteBuffer(e.__webglTangentBuffer);o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer);o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);o.deleteBuffer(e.__webglSkinVertexBBuffer);o.deleteBuffer(e.__webglSkinIndicesBuffer);
|
|
|
o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c<f;c++)o.deleteBuffer(e.__webglMorphTargetsBuffers[c]);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,e,c,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 u=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(u.uniforms);b.vertexShader=u.vertexShader;b.fragmentShader=u.fragmentShader}var p,t,v;p=v=u=0;for(t=e.length;p<t;p++)m=e[p],m instanceof THREE.SpotLight&&v++,m instanceof THREE.DirectionalLight&&v++,m instanceof THREE.PointLight&&
|
|
|
-u++;u+v<=ya?p=v:(p=Math.ceil(ya*v/(u+v)),u=ya-p);m={directional:p,point:u};u=v=0;for(p=e.length;u<p;u++)t=e[u],t instanceof THREE.SpotLight&&t.castShadow&&v++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{p=b.fragmentShader;t=b.vertexShader;var u=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,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(t));for(y in c)f.push(y),f.push(c[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 "+c.maxDirLights,
|
|
|
+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 p=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(p.uniforms);b.vertexShader=p.vertexShader;b.fragmentShader=p.fragmentShader}var u,t,v;u=v=p=0;for(t=e.length;u<t;u++)m=e[u],m instanceof THREE.SpotLight&&v++,m instanceof THREE.DirectionalLight&&v++,m instanceof THREE.PointLight&&
|
|
|
+p++;p+v<=ya?u=v:(u=Math.ceil(ya*v/(p+v)),p=ya-u);m={directional:u,point:p};p=v=0;for(u=e.length;p<u;p++)t=e[p],t instanceof THREE.SpotLight&&t.castShadow&&v++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{u=b.fragmentShader;t=b.vertexShader;var p=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,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(u),f.push(t));for(y in c)f.push(y),f.push(c[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 "+c.maxDirLights,
|
|
|
"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.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 "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",
|
|
|
-c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(y,R("fragment",m+p));o.attachShader(y,R("vertex",f+t));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 L,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in u)f.push(L);L=f;f=0;for(u=L.length;f<u;f++)p=L[f],y.uniforms[p]=o.getUniformLocation(y,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<c.maxMorphTargets;L++)f.push("morphTarget"+L);for(x in e)f.push(x);
|
|
|
+c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(y,R("fragment",m+u));o.attachShader(y,R("vertex",f+t));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 L,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in p)f.push(L);L=f;f=0;for(p=L.length;f<p;f++)u=L[f],y.uniforms[u]=o.getUniformLocation(y,u);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<c.maxMorphTargets;L++)f.push("morphTarget"+L);for(x in e)f.push(x);
|
|
|
x=f;L=0;for(e=x.length;L<e;L++)c=x[L],y.attributes[c]=o.getAttribLocation(y,c);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++)L="morphTarget"+k,x[L]>=0&&(o.enableVertexAttribArray(x[L]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,e,c,f){da(b);
|
|
|
-this.clear(e,c,f)};this.render=function(b,c,u,L){var M,U,F,D,H,na,B,G,ua=b.lights,N=b.fog;Z=-1;this.shadowMapEnabled&&A(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);v(ta);this.initWebGLObjects(b);da(u);(this.autoClear||L)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
-H=b.__webglObjects.length;for(L=0;L<H;L++)if(M=b.__webglObjects[L],B=M.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),p(M),M.render=!0,this.sortObjects)M.object.renderDepth?M.z=M.object.renderDepth:(Ca.copy(B.position),ta.multiplyVector3(Ca),M.z=Ca.z)}else M.render=!1;else M.render=!1;this.sortObjects&&b.__webglObjects.sort(y);na=b.__webglObjectsImmediate.length;for(L=0;L<na;L++)M=b.__webglObjectsImmediate[L],
|
|
|
-B=M.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),x(M));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(L=0;L<H;L++)if(M=b.__webglObjects[L],M.render)B=M.object,G=M.buffer,k(B),f(c,ua,N,b.overrideMaterial,G,B);for(L=0;L<na;L++)M=b.__webglObjectsImmediate[L],B=M.object,B.visible&&(k(B),U=e(c,ua,N,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,wa):B.render(function(b){h(b,U,
|
|
|
-Da.shading)}))}else{K(THREE.NormalBlending);for(L=H-1;L>=0;L--)if(M=b.__webglObjects[L],M.render){B=M.object;G=M.buffer;F=M.opaque;k(B);for(M=0;M<F.count;M++)D=F.list[M],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,N,D,G,B)}for(L=0;L<na;L++)if(M=b.__webglObjectsImmediate[L],B=M.object,B.visible){F=M.opaque;k(B);for(M=0;M<F.count;M++)D=F.list[M],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),U=e(c,
|
|
|
-ua,N,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,wa):B.render(function(b){h(b,U,Da.shading)})}for(L=0;L<H;L++)if(M=b.__webglObjects[L],M.render){B=M.object;G=M.buffer;F=M.transparent;k(B);for(M=0;M<F.count;M++)D=F.list[M],K(D.blending),m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,N,D,G,B)}for(L=0;L<na;L++)if(M=b.__webglObjectsImmediate[L],B=M.object,B.visible){F=M.transparent;k(B);for(M=0;M<F.count;M++)D=F.list[M],K(D.blending),
|
|
|
+this.clear(e,c,f)};this.render=function(b,c,u,L){var M,U,E,D,G,na,B,H,ua=b.lights,N=b.fog;Z=-1;this.shadowMapEnabled&&A(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);v(ta);this.initWebGLObjects(b);da(u);(this.autoClear||L)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
+G=b.__webglObjects.length;for(L=0;L<G;L++)if(M=b.__webglObjects[L],B=M.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,c,!0),p(M),M.render=!0,this.sortObjects)M.object.renderDepth?M.z=M.object.renderDepth:(Ca.copy(B.position),ta.multiplyVector3(Ca),M.z=Ca.z)}else M.render=!1;else M.render=!1;this.sortObjects&&b.__webglObjects.sort(y);na=b.__webglObjectsImmediate.length;for(L=0;L<na;L++)M=b.__webglObjectsImmediate[L],
|
|
|
+B=M.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,c,!0),x(M));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(L=0;L<G;L++)if(M=b.__webglObjects[L],M.render)B=M.object,H=M.buffer,k(B),f(c,ua,N,b.overrideMaterial,H,B);for(L=0;L<na;L++)M=b.__webglObjectsImmediate[L],B=M.object,B.visible&&(k(B),U=e(c,ua,N,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,wa):B.render(function(b){h(b,U,
|
|
|
+Da.shading)}))}else{K(THREE.NormalBlending);for(L=G-1;L>=0;L--)if(M=b.__webglObjects[L],M.render){B=M.object;H=M.buffer;E=M.opaque;k(B);for(M=0;M<E.count;M++)D=E.list[M],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,N,D,H,B)}for(L=0;L<na;L++)if(M=b.__webglObjectsImmediate[L],B=M.object,B.visible){E=M.opaque;k(B);for(M=0;M<E.count;M++)D=E.list[M],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),U=e(c,
|
|
|
+ua,N,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,wa):B.render(function(b){h(b,U,Da.shading)})}for(L=0;L<G;L++)if(M=b.__webglObjects[L],M.render){B=M.object;H=M.buffer;E=M.transparent;k(B);for(M=0;M<E.count;M++)D=E.list[M],K(D.blending),m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,N,D,H,B)}for(L=0;L<na;L++)if(M=b.__webglObjectsImmediate[L],B=M.object,B.visible){E=M.transparent;k(B);for(M=0;M<E.count;M++)D=E.list[M],K(D.blending),
|
|
|
m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),U=e(c,ua,N,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,wa):B.render(function(b){h(b,U,Da.shading)})}}b.__webglSprites.length&&z(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&&N(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 u=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];u=0;for(p=n.numMorphTargets;u<
|
|
|
-p;u++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,t=void 0,v=void 0,x=void 0,w=x=void 0,L=void 0,y=void 0,M=y=u=0,z=x=v=void 0,x=p=z=v=t=void 0,w=n.geometry,L=w.faces,z=m.faces,t=0,v=z.length;t<v;t++)x=z[t],x=L[x],x instanceof THREE.Face3?(u+=3,y+=1,M+=3):x instanceof THREE.Face4&&(u+=4,y+=2,M+=4);for(var t=m,v=n,A=z=L=void 0,U=void 0,A=void 0,x=[],L=0,z=v.materials.length;L<z;L++)if(A=v.materials[L],A instanceof THREE.MeshFaceMaterial){A=0;for(l=t.materials.length;A<
|
|
|
+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 p=void 0,u=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(u=n.numMorphTargets;p<
|
|
|
+u;p++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,t=void 0,v=void 0,x=void 0,w=x=void 0,L=void 0,y=void 0,M=y=p=0,z=x=v=void 0,x=u=z=v=t=void 0,w=n.geometry,L=w.faces,z=m.faces,t=0,v=z.length;t<v;t++)x=z[t],x=L[x],x instanceof THREE.Face3?(p+=3,y+=1,M+=3):x instanceof THREE.Face4&&(p+=4,y+=2,M+=4);for(var t=m,v=n,A=z=L=void 0,U=void 0,A=void 0,x=[],L=0,z=v.materials.length;L<z;L++)if(A=v.materials[L],A instanceof THREE.MeshFaceMaterial){A=0;for(l=t.materials.length;A<
|
|
|
l;A++)(U=t.materials[A])&&x.push(U)}else(U=A)&&x.push(U);t=x;m.__materials=t;a:{L=v=void 0;z=t.length;for(v=0;v<z;v++)if(L=t[v],L.map||L.lightMap||L instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{z=L=void 0;x=t.length;for(L=0;L<x;L++)if(z=t[L],!(z instanceof THREE.MeshBasicMaterial&&!z.envMap||z instanceof THREE.MeshDepthMaterial)){z=z&&z.shading!=void 0&&z.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}z=!1}a:{x=L=void 0;A=t.length;for(L=0;L<A;L++)if(x=t[L],x.vertexColors){x=
|
|
|
-x.vertexColors;break a}x=!1}m.__vertexArray=new Float32Array(u*3);if(z)m.__normalArray=new Float32Array(u*3);if(w.hasTangents)m.__tangentArray=new Float32Array(u*4);if(x)m.__colorArray=new Float32Array(u*3);if(v){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(u*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(u*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(u*4),m.__skinVertexBArray=
|
|
|
-new Float32Array(u*4),m.__skinIndexArray=new Float32Array(u*4),m.__skinWeightArray=new Float32Array(u*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(M*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(L=m.numMorphTargets;w<L;w++)m.__morphTargetsArrays.push(new Float32Array(u*3))}m.__needsSmoothNormals=z==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=x;m.__normalType=z;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?
|
|
|
-n.geometry.edgeFaces.length*6:0);m.__webglLineCount=M*2;w=0;for(L=t.length;w<L;w++)if(v=t[w],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){x=v.attributes[a];z={};for(p in x)z[p]=x[p];if(!z.__webglInitialized||z.createUniqueBuffers)z.__webglInitialized=!0,y=1,z.type==="v2"?y=2:z.type==="v3"?y=3:z.type==="v4"?y=4:z.type==="c"&&(y=3),z.size=y,z.array=new Float32Array(u*y),z.buffer=o.createBuffer(),z.buffer.belongsToAttribute=a,x.needsUpdate=!0,
|
|
|
+x.vertexColors;break a}x=!1}m.__vertexArray=new Float32Array(p*3);if(z)m.__normalArray=new Float32Array(p*3);if(w.hasTangents)m.__tangentArray=new Float32Array(p*4);if(x)m.__colorArray=new Float32Array(p*3);if(v){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(p*4),m.__skinVertexBArray=
|
|
|
+new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(M*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(L=m.numMorphTargets;w<L;w++)m.__morphTargetsArrays.push(new Float32Array(p*3))}m.__needsSmoothNormals=z==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=x;m.__normalType=z;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?
|
|
|
+n.geometry.edgeFaces.length*6:0);m.__webglLineCount=M*2;w=0;for(L=t.length;w<L;w++)if(v=t[w],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){x=v.attributes[a];z={};for(u in x)z[u]=x[u];if(!z.__webglInitialized||z.createUniqueBuffers)z.__webglInitialized=!0,y=1,z.type==="v2"?y=2:z.type==="v3"?y=3:z.type==="v4"?y=4:z.type==="c"&&(y=3),z.size=y,z.array=new Float32Array(p*y),z.buffer=o.createBuffer(),z.buffer.belongsToAttribute=a,x.needsUpdate=!0,
|
|
|
z.__original=x;m.__webglCustomAttributes[a]=z}}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;u=m.vertices.length;m.__vertexArray=new Float32Array(u*3);m.__colorArray=new Float32Array(u*3);m.__sortArray=[];m.__webglParticleCount=u;m.__materials=n.materials;M=y=p=void 0;p=0;for(y=n.materials.length;p<y;p++)if(M=n.materials[p],M.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in M.attributes){originalAttribute=M.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(u*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=
|
|
|
+m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=k;n=e;p=m.vertices.length;m.__vertexArray=new Float32Array(p*3);m.__colorArray=new Float32Array(p*3);m.__sortArray=[];m.__webglParticleCount=p;m.__materials=n.materials;M=y=u=void 0;u=0;for(y=n.materials.length;u<y;u++)if(M=n.materials[u],M.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in M.attributes){originalAttribute=M.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(p*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],O(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,O(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(u=h.geometryGroupsList.length;n<u;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,M=!h.dynamic,p.__inittedArrays){var E=t=w=void 0,B=void 0,na=E=void 0,G=void 0,ua=void 0,ja=void 0,J=U=A=x=z=L=v=void 0,ha=void 0,K=void 0,
|
|
|
-I=B=ja=B=ua=G=void 0,C=void 0,P=C=I=G=void 0,X=void 0,R=P=C=I=E=E=na=ja=B=P=C=I=X=P=C=I=X=P=C=I=void 0,S=0,oa=0,$=0,da=0,qa=0,Y=0,Q=0,ya=0,V=0,T=0,pa=0,P=I=0,P=void 0,ga=p.__vertexArray,xa=p.__uvArray,wa=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,L=p.__vertexColorType,
|
|
|
-v=p.__uvType,z=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(R in ka)ka[R].offset=0,ka[R].offsetSrc=0;w=0;for(t=cb.length;w<t;w++)if(E=cb[w],B=fb[E],db&&(x=db[E]),eb&&(A=eb[E]),E=
|
|
|
-B.vertexNormals,na=B.normal,G=B.vertexColors,ua=B.color,ja=B.vertexTangents,B instanceof THREE.Face3){if(Ea)U=Ja[B.a].position,J=Ja[B.b].position,ha=Ja[B.c].position,ga[oa]=U.x,ga[oa+1]=U.y,ga[oa+2]=U.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(R in ka)if(C=ka[R],C.__original.needsUpdate)I=C.offset,P=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]):
|
|
|
+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,u=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(p=h.geometryGroupsList.length;n<p;n++)if(m=h.geometryGroupsList[n],u=E(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||u)if(u=m,y=o.DYNAMIC_DRAW,M=!h.dynamic,u.__inittedArrays){var F=t=w=void 0,B=void 0,na=F=void 0,H=void 0,ua=void 0,ja=void 0,J=U=A=x=z=L=v=void 0,ha=void 0,K=void 0,
|
|
|
+I=B=ja=B=ua=H=void 0,C=void 0,P=C=I=H=void 0,X=void 0,R=P=C=I=F=F=na=ja=B=P=C=I=X=P=C=I=X=P=C=I=void 0,S=0,oa=0,$=0,da=0,qa=0,Y=0,Q=0,ya=0,V=0,T=0,pa=0,P=I=0,P=void 0,ga=u.__vertexArray,xa=u.__uvArray,wa=u.__uv2Array,la=u.__normalArray,ia=u.__tangentArray,ca=u.__colorArray,aa=u.__skinVertexAArray,Z=u.__skinVertexBArray,ea=u.__skinIndexArray,fa=u.__skinWeightArray,Da=u.__morphTargetsArrays,ka=u.__webglCustomAttributes,C=void 0,ma=u.__faceArray,ra=u.__lineArray,Ia=u.__needsSmoothNormals,L=u.__vertexColorType,
|
|
|
+v=u.__uvType,z=u.__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=u.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(R in ka)ka[R].offset=0,ka[R].offsetSrc=0;w=0;for(t=cb.length;w<t;w++)if(F=cb[w],B=fb[F],db&&(x=db[F]),eb&&(A=eb[F]),F=
|
|
|
+B.vertexNormals,na=B.normal,H=B.vertexColors,ua=B.color,ja=B.vertexTangents,B instanceof THREE.Face3){if(Ea)U=Ja[B.a].position,J=Ja[B.b].position,ha=Ja[B.c].position,ga[oa]=U.x,ga[oa+1]=U.y,ga[oa+2]=U.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(R in ka)if(C=ka[R],C.__original.needsUpdate)I=C.offset,P=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"?(P=C.value[P],C.array[I]=P,C.array[I+1]=P,C.array[I+2]=P,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[P],C.array[I+1]=C.value[P+1],C.array[I+2]=C.value[P+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(U=C.value[B.a],J=C.value[B.b],ha=C.value[B.c]):C.boundTo==="faces"?(ha=J=U=P=C.value[P],C.offsetSrc++):C.boundTo==="faceVertices"&&(U=C.value[P],J=C.value[P+1],ha=C.value[P+2],C.offsetSrc+=3),C.size===2?(C.array[I]=U.x,C.array[I+1]=
|
|
|
U.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]=U.r,C.array[I+1]=U.g,C.array[I+2]=U.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]=U.x,C.array[I+1]=U.y,C.array[I+2]=U.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]=U.x,C.array[I+1]=U.y,C.array[I+2]=U.z,C.array[I+3]=U.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++)U=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ha=La[I].vertices[B.c].position,P=Da[I],P[pa]=U.x,P[pa+1]=U.y,P[pa+2]=U.z,P[pa+3]=J.x,P[pa+4]=J.y,P[pa+5]=J.z,P[pa+6]=ha.x,P[pa+7]=ha.y,P[pa+8]=ha.z;pa+=9}if(Ma.length)I=Ma[B.a],C=Ma[B.b],P=Ma[B.c],fa[T]=I.x,fa[T+1]=I.y,fa[T+2]=I.z,fa[T+3]=I.w,fa[T+
|
|
|
4]=C.x,fa[T+5]=C.y,fa[T+6]=C.z,fa[T+7]=C.w,fa[T+8]=P.x,fa[T+9]=P.y,fa[T+10]=P.z,fa[T+11]=P.w,I=Ua[B.a],C=Ua[B.b],P=Ua[B.c],ea[T]=I.x,ea[T+1]=I.y,ea[T+2]=I.z,ea[T+3]=I.w,ea[T+4]=C.x,ea[T+5]=C.y,ea[T+6]=C.z,ea[T+7]=C.w,ea[T+8]=P.x,ea[T+9]=P.y,ea[T+10]=P.z,ea[T+11]=P.w,I=Sa[B.a],C=Sa[B.b],P=Sa[B.c],aa[T]=I.x,aa[T+1]=I.y,aa[T+2]=I.z,aa[T+3]=1,aa[T+4]=C.x,aa[T+5]=C.y,aa[T+6]=C.z,aa[T+7]=1,aa[T+8]=P.x,aa[T+9]=P.y,aa[T+10]=P.z,aa[T+11]=1,I=Ta[B.a],C=Ta[B.b],P=Ta[B.c],Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,Z[T+3]=
|
|
|
-1,Z[T+4]=C.x,Z[T+5]=C.y,Z[T+6]=C.z,Z[T+7]=1,Z[T+8]=P.x,Z[T+9]=P.y,Z[T+10]=P.z,Z[T+11]=1,T+=12;if(Ca&&L)G.length==3&&L==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[Q]=G.x,ia[Q+1]=G.y,ia[Q+2]=G.z,ia[Q+3]=G.w,ia[Q+4]=ua.x,ia[Q+5]=ua.y,ia[Q+6]=ua.z,ia[Q+7]=ua.w,ia[Q+8]=B.x,ia[Q+9]=B.y,ia[Q+10]=B.z,ia[Q+11]=B.w,Q+=12;if(Ga&&z)if(E.length==
|
|
|
-3&&Ia)for(ja=0;ja<3;ja++)na=E[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++)E=x[ja],xa[$]=E.u,xa[$+1]=E.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<3;ja++)E=A[ja],wa[da]=E.u,wa[da+1]=E.v,da+=2;Ba&&(ma[qa]=S,ma[qa+1]=S+1,ma[qa+2]=S+2,qa+=3,ra[ya]=S,ra[ya+1]=S+1,ra[ya+2]=S,ra[ya+3]=S+2,ra[ya+4]=S+1,ra[ya+5]=S+2,ya+=6,S+=3)}else if(B instanceof THREE.Face4){if(Ea)U=Ja[B.a].position,J=Ja[B.b].position,
|
|
|
+1,Z[T+4]=C.x,Z[T+5]=C.y,Z[T+6]=C.z,Z[T+7]=1,Z[T+8]=P.x,Z[T+9]=P.y,Z[T+10]=P.z,Z[T+11]=1,T+=12;if(Ca&&L)H.length==3&&L==THREE.VertexColors?(B=H[0],I=H[1],C=H[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)H=ja[0],ua=ja[1],B=ja[2],ia[Q]=H.x,ia[Q+1]=H.y,ia[Q+2]=H.z,ia[Q+3]=H.w,ia[Q+4]=ua.x,ia[Q+5]=ua.y,ia[Q+6]=ua.z,ia[Q+7]=ua.w,ia[Q+8]=B.x,ia[Q+9]=B.y,ia[Q+10]=B.z,ia[Q+11]=B.w,Q+=12;if(Ga&&z)if(F.length==
|
|
|
+3&&Ia)for(ja=0;ja<3;ja++)na=F[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++)F=x[ja],xa[$]=F.u,xa[$+1]=F.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<3;ja++)F=A[ja],wa[da]=F.u,wa[da+1]=F.v,da+=2;Ba&&(ma[qa]=S,ma[qa+1]=S+1,ma[qa+2]=S+2,qa+=3,ra[ya]=S,ra[ya+1]=S+1,ra[ya+2]=S,ra[ya+3]=S+2,ra[ya+4]=S+1,ra[ya+5]=S+2,ya+=6,S+=3)}else if(B instanceof THREE.Face4){if(Ea)U=Ja[B.a].position,J=Ja[B.b].position,
|
|
|
ha=Ja[B.c].position,K=Ja[B.d].position,ga[oa]=U.x,ga[oa+1]=U.y,ga[oa+2]=U.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(R in ka)if(C=ka[R],C.__original.needsUpdate)I=C.offset,P=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"?(P=C.value[P],C.array[I]=P,C.array[I+1]=
|
|
|
P,C.array[I+2]=P,C.array[I+3]=P,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[P],C.array[I+1]=C.value[P+1],C.array[I+2]=C.value[P+2],C.array[I+3]=C.value[P+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(U=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=U=P=C.value[P],C.offsetSrc++):C.boundTo==="faceVertices"&&(U=C.value[P],J=C.value[P+1],ha=C.value[P+2],K=C.value[P+3],C.offsetSrc+=4),C.size===2?(C.array[I]=U.x,
|
|
|
C.array[I+1]=U.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]=U.r,C.array[I+1]=U.g,C.array[I+2]=U.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]=U.x,C.array[I+1]=U.y,C.array[I+2]=U.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]=U.x,C.array[I+1]=U.y,C.array[I+2]=U.z,C.array[I+3]=U.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++)U=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,P=Da[I],P[pa]=U.x,P[pa+1]=U.y,P[pa+2]=U.z,P[pa+3]=J.x,P[pa+4]=J.y,P[pa+5]=J.z,P[pa+6]=ha.x,P[pa+7]=ha.y,P[pa+8]=ha.z,P[pa+9]=K.x,P[pa+10]=K.y,P[pa+11]=K.z;pa+=12}if(Ma.length)I=Ma[B.a],C=Ma[B.b],P=Ma[B.c],X=Ma[B.d],fa[T]=I.x,fa[T+1]=I.y,fa[T+2]=I.z,fa[T+3]=I.w,fa[T+4]=C.x,fa[T+5]=C.y,fa[T+6]=C.z,fa[T+7]=C.w,fa[T+8]=P.x,fa[T+9]=P.y,fa[T+10]=P.z,fa[T+11]=P.w,fa[T+12]=X.x,fa[T+13]=X.y,fa[T+14]=X.z,fa[T+15]=X.w,I=Ua[B.a],C=Ua[B.b],P=Ua[B.c],X=Ua[B.d],ea[T]=I.x,ea[T+1]=I.y,
|
|
|
ea[T+2]=I.z,ea[T+3]=I.w,ea[T+4]=C.x,ea[T+5]=C.y,ea[T+6]=C.z,ea[T+7]=C.w,ea[T+8]=P.x,ea[T+9]=P.y,ea[T+10]=P.z,ea[T+11]=P.w,ea[T+12]=X.x,ea[T+13]=X.y,ea[T+14]=X.z,ea[T+15]=X.w,I=Sa[B.a],C=Sa[B.b],P=Sa[B.c],X=Sa[B.d],aa[T]=I.x,aa[T+1]=I.y,aa[T+2]=I.z,aa[T+3]=1,aa[T+4]=C.x,aa[T+5]=C.y,aa[T+6]=C.z,aa[T+7]=1,aa[T+8]=P.x,aa[T+9]=P.y,aa[T+10]=P.z,aa[T+11]=1,aa[T+12]=X.x,aa[T+13]=X.y,aa[T+14]=X.z,aa[T+15]=1,I=Ta[B.a],C=Ta[B.b],P=Ta[B.c],B=Ta[B.d],Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,Z[T+3]=1,Z[T+4]=C.x,Z[T+5]=C.y,
|
|
|
-Z[T+6]=C.z,Z[T+7]=1,Z[T+8]=P.x,Z[T+9]=P.y,Z[T+10]=P.z,Z[T+11]=1,Z[T+12]=B.x,Z[T+13]=B.y,Z[T+14]=B.z,Z[T+15]=1,T+=16;if(Ca&&L)G.length==4&&L==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[Q]=G.x,ia[Q+1]=G.y,ia[Q+2]=G.z,ia[Q+3]=G.w,ia[Q+4]=ua.x,ia[Q+5]=ua.y,ia[Q+6]=ua.z,ia[Q+7]=ua.w,
|
|
|
-ia[Q+8]=B.x,ia[Q+9]=B.y,ia[Q+10]=B.z,ia[Q+11]=B.w,ia[Q+12]=ja.x,ia[Q+13]=ja.y,ia[Q+14]=ja.z,ia[Q+15]=ja.w,Q+=16;if(Ga&&z)if(E.length==4&&Ia)for(ja=0;ja<4;ja++)na=E[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++)E=x[ja],xa[$]=E.u,xa[$+1]=E.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<4;ja++)E=A[ja],wa[da]=E.u,wa[da+1]=E.v,da+=2;Ba&&(ma[qa]=S,ma[qa+1]=S+1,ma[qa+2]=S+3,ma[qa+3]=S+1,ma[qa+4]=S+2,ma[qa+
|
|
|
-5]=S+3,qa+=6,ra[ya]=S,ra[ya+1]=S+1,ra[ya+2]=S,ra[ya+3]=S+3,ra[ya+4]=S+1,ra[ya+5]=S+2,ra[ya+6]=S+2,ra[ya+7]=S+3,ya+=8,S+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,y));if(ka)for(R in ka)C=ka[R],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&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
-p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ca,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,la,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,xa,y));Aa&&da>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,wa,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));T>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
-fa,y));M&&(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=w=M=M=void 0;t=k.vertices;u=k.colors;v=t.length;p=u.length;L=k.__vertexArray;y=k.__colorArray;z=k.__dirtyColors;if(k.__dirtyVertices){for(M=0;M<v;M++)w=t[M].position,n=M*3,L[n]=w.x,L[n+1]=w.y,L[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(z){for(M=0;M<p;M++)color=u[M],n=M*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=w=M=M=void 0;t=k.vertices;u=k.colors;v=t.length;p=u.length;L=k.__vertexArray;y=k.__colorArray;z=k.__dirtyColors;if(k.__dirtyVertices){for(M=0;M<v;M++)w=t[M].position,n=M*3,L[n]=w.x,L[n+1]=w.y,L[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(z){for(M=0;M<p;M++)color=u[M],n=M*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),
|
|
|
+Z[T+6]=C.z,Z[T+7]=1,Z[T+8]=P.x,Z[T+9]=P.y,Z[T+10]=P.z,Z[T+11]=1,Z[T+12]=B.x,Z[T+13]=B.y,Z[T+14]=B.z,Z[T+15]=1,T+=16;if(Ca&&L)H.length==4&&L==THREE.VertexColors?(B=H[0],I=H[1],C=H[2],H=H[3]):H=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]=H.r,ca[V+10]=H.g,ca[V+11]=H.b,V+=12;if(Ka&&ta.hasTangents)H=ja[0],ua=ja[1],B=ja[2],ja=ja[3],ia[Q]=H.x,ia[Q+1]=H.y,ia[Q+2]=H.z,ia[Q+3]=H.w,ia[Q+4]=ua.x,ia[Q+5]=ua.y,ia[Q+6]=ua.z,ia[Q+7]=ua.w,
|
|
|
+ia[Q+8]=B.x,ia[Q+9]=B.y,ia[Q+10]=B.z,ia[Q+11]=B.w,ia[Q+12]=ja.x,ia[Q+13]=ja.y,ia[Q+14]=ja.z,ia[Q+15]=ja.w,Q+=16;if(Ga&&z)if(F.length==4&&Ia)for(ja=0;ja<4;ja++)na=F[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++)F=x[ja],xa[$]=F.u,xa[$+1]=F.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<4;ja++)F=A[ja],wa[da]=F.u,wa[da+1]=F.v,da+=2;Ba&&(ma[qa]=S,ma[qa+1]=S+1,ma[qa+2]=S+3,ma[qa+3]=S+1,ma[qa+4]=S+2,ma[qa+
|
|
|
+5]=S+3,qa+=6,ra[ya]=S,ra[ya+1]=S+1,ra[ya+2]=S,ra[ya+3]=S+3,ra[ya+4]=S+1,ra[ya+5]=S+2,ra[ya+6]=S+2,ra[ya+7]=S+3,ya+=8,S+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,y));if(ka)for(R in ka)C=ka[R],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,u.__webglMorphTargetsBuffers[I]),o.bufferData(o.ARRAY_BUFFER,Da[I],y)}Ca&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
+u.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ca,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,la,y));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));Aa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,xa,y));Aa&&da>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u.__webglFaceBuffer),
|
|
|
+o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y));T>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y),o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
+fa,y));M&&(delete u.__inittedArrays,delete u.__colorArray,delete u.__normalArray,delete u.__tangentArray,delete u.__uvArray,delete u.__uv2Array,delete u.__faceArray,delete u.__vertexArray,delete u.__lineArray,delete u.__skinVertexAArray,delete u.__skinVertexBArray,delete u.__skinIndexArray,delete u.__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=w=M=M=void 0;t=k.vertices;p=k.colors;v=t.length;u=p.length;L=k.__vertexArray;y=k.__colorArray;z=k.__dirtyColors;if(k.__dirtyVertices){for(M=0;M<v;M++)w=t[M].position,n=M*3,L[n]=w.x,L[n+1]=w.y,L[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(z){for(M=0;M<u;M++)color=p[M],n=M*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=w=M=M=void 0;t=k.vertices;p=k.colors;v=t.length;u=p.length;L=k.__vertexArray;y=k.__colorArray;z=k.__dirtyColors;if(k.__dirtyVertices){for(M=0;M<v;M++)w=t[M].position,n=M*3,L[n]=w.x,L[n+1]=w.y,L[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(z){for(M=0;M<u;M++)color=p[M],n=M*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,u=E(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||u)&&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,t=b.faces,v=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 p=new THREE.Vertex(n[u].position.clone());e&&e.multiplyVector3(p.position);m.push(p)}u=0;for(x=v.length;u<x;u++){var p=v[u],y,A,z=p.vertexNormals,
|
|
|
-E=p.vertexColors;p instanceof THREE.Face3?y=new THREE.Face3(p.a+h,p.b+h,p.c+h):p instanceof THREE.Face4&&(y=new THREE.Face4(p.a+h,p.b+h,p.c+h,p.d+h));y.normal.copy(p.normal);f&&f.multiplyVector3(y.normal);m=0;for(n=z.length;m<n;m++)A=z[m].clone(),f&&f.multiplyVector3(A),y.vertexNormals.push(A);y.color.copy(p.color);m=0;for(n=E.length;m<n;m++)A=E[m],y.vertexColors.push(A.clone());y.materials=p.materials.slice();y.centroid.copy(p.centroid);e&&e.multiplyVector3(y.centroid);t.push(y)}u=0;for(x=k.length;u<
|
|
|
+F=p.vertexColors;p instanceof THREE.Face3?y=new THREE.Face3(p.a+h,p.b+h,p.c+h):p instanceof THREE.Face4&&(y=new THREE.Face4(p.a+h,p.b+h,p.c+h,p.d+h));y.normal.copy(p.normal);f&&f.multiplyVector3(y.normal);m=0;for(n=z.length;m<n;m++)A=z[m].clone(),f&&f.multiplyVector3(A),y.vertexNormals.push(A);y.color.copy(p.color);m=0;for(n=F.length;m<n;m++)A=F[m],y.vertexColors.push(A.clone());y.materials=p.materials.slice();y.centroid.copy(p.centroid);e&&e.multiplyVector3(y.centroid);t.push(y)}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],t,v,w=n.vertexNormals,u=n.vertexColors;n instanceof THREE.Face3?t=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(t=new THREE.Face4(n.a,n.b,n.c,n.d));t.normal.copy(n.normal);f=0;
|
|
|
for(m=w.length;f<m;f++)v=w[f],t.vertexNormals.push(v.clone());t.color.copy(n.color);f=0;for(m=u.length;f<m;f++)v=u[f],t.vertexColors.push(v.clone());t.materials=n.materials.slice();t.centroid.copy(n.centroid);c.faces.push(t)}b=0;for(e=k.length;b<e;b++){h=k[b];t=[];f=0;for(m=h.length;f<m;f++)t.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(t)}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):v[h]<b?e(h+1,f):h}return e(0,v.length-1)}var f,h,k=b.faces,m=b.vertic
|
|
|
v[h]=t}f=[];m={};for(h=0;h<c;h++)n=THREE.GeometryUtils.random()*t,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,t=m.createImageData(f,h),v=t.data,w=0;w<f;w++)for(var u=1;u<h;u++){var x=u-1<0?h-1:u-1,p=(u+1)%h,y=w-1<0?f-1:w-1,A=(w+1)%f,z=[],E=[0,0,n[(u*f+w)*4]/255*c];z.push([-1,0,n[(u*f+y)*4]/255*c]);z.push([-1,-1,n[(x*f+y)*4]/255*c]);z.push([0,-1,n[(x*f+w)*4]/255*c]);z.push([1,-1,n[(x*f+A)*4]/255*c]);
|
|
|
-z.push([1,0,n[(u*f+A)*4]/255*c]);z.push([1,1,n[(p*f+A)*4]/255*c]);z.push([0,1,n[(p*f+w)*4]/255*c]);z.push([-1,1,n[(p*f+y)*4]/255*c]);x=[];y=z.length;for(p=0;p<y;p++){var A=z[p],F=z[(p+1)%y],A=[A[0]-E[0],A[1]-E[1],A[2]-E[2]],F=[F[0]-E[0],F[1]-E[1],F[2]-E[2]];x.push(e([A[1]*F[2]-A[2]*F[1],A[2]*F[0]-A[0]*F[2],A[0]*F[1]-A[1]*F[0]]))}z=[0,0,0];for(p=0;p<x.length;p++)z[0]+=x[p][0],z[1]+=x[p][1],z[2]+=x[p][2];z[0]/=x.length;z[1]/=x.length;z[2]/=x.length;E=(u*f+w)*4;v[E]=(z[0]+1)/2*255|0;v[E+1]=(z[1]+0.5)*
|
|
|
-255|0;v[E+2]=z[2]*255|0;v[E+3]=255}m.putImageData(t,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,t=m.createImageData(f,h),v=t.data,w=0;w<f;w++)for(var u=1;u<h;u++){var x=u-1<0?h-1:u-1,p=(u+1)%h,y=w-1<0?f-1:w-1,A=(w+1)%f,z=[],F=[0,0,n[(u*f+w)*4]/255*c];z.push([-1,0,n[(u*f+y)*4]/255*c]);z.push([-1,-1,n[(x*f+y)*4]/255*c]);z.push([0,-1,n[(x*f+w)*4]/255*c]);z.push([1,-1,n[(x*f+A)*4]/255*c]);
|
|
|
+z.push([1,0,n[(u*f+A)*4]/255*c]);z.push([1,1,n[(p*f+A)*4]/255*c]);z.push([0,1,n[(p*f+w)*4]/255*c]);z.push([-1,1,n[(p*f+y)*4]/255*c]);x=[];y=z.length;for(p=0;p<y;p++){var A=z[p],E=z[(p+1)%y],A=[A[0]-F[0],A[1]-F[1],A[2]-F[2]],E=[E[0]-F[0],E[1]-F[1],E[2]-F[2]];x.push(e([A[1]*E[2]-A[2]*E[1],A[2]*E[0]-A[0]*E[2],A[0]*E[1]-A[1]*E[0]]))}z=[0,0,0];for(p=0;p<x.length;p++)z[0]+=x[p][0],z[1]+=x[p][1],z[2]+=x[p][2];z[0]/=x.length;z[1]/=x.length;z[2]/=x.length;F=(u*f+w)*4;v[F]=(z[0]+1)/2*255|0;v[F+1]=(z[1]+0.5)*
|
|
|
+255|0;v[F+2]=z[2]*255|0;v[F+3]=255}m.putImageData(t,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",
|
|
@@ -440,7 +440,7 @@ this.autoForward&&!this.moveBackward)&&this.translateZ(-(c+this.autoSpeedFactor)
|
|
|
h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.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*c;this.lookVertical&&(this.lat-=this.mouseY*c*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.position;h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,
|
|
|
this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
|
|
|
-THREE.PathControls=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),t=m.length,F=0;k=t-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<t-1;k++)F=f*n.chunks[k]/n.total,e.keys[k]={time:F,pos:m[k]};h.hierarchy[0]=e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
|
|
|
+THREE.PathControls=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),t=m.length,E=0;k=t-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<t-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 e(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}function f(b,c){var f=e(c,10),h=e(c,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,k);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
|
|
|
16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,k),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}this.object=b;this.id="PathCamera"+THREE.PathCameraIdCounter++;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.domElement=document;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 h=Math.PI*2,k=Math.PI/180;this.update=function(b,e,
|
|
@@ -479,18 +479,18 @@ x+Y,p+W*(x+1)+Y,p+1+W*(x+1)+Y,p+1+W*x+Y,null,null,t)),w.faceVertexUvs[0].push([n
|
|
|
t[A]);this.sides.px&&v("z","y",1*n,-1,e,c,-u,this.materials[0]);this.sides.nx&&v("z","y",-1*n,-1,e,c,u,this.materials[1]);this.sides.py&&v("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&v("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&v("x","y",1*n,-1,b,c,p,this.materials[4]);this.sides.nz&&v("x","y",-1*n,-1,b,c,-p,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,t,v=[],w=[];for(t=0;t<=h;t++){var u=[],x=[],p=t/h,y=p*(c-b)+b;for(n=0;n<=f;n++){var A=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(A*Math.PI*2),-p*e+m,y*Math.cos(A*Math.PI*2))));u.push(this.vertices.length-1);x.push(new THREE.UV(A,p))}v.push(u);w.push(x)}for(t=0;t<h;t++)for(n=0;n<f;n++){var e=v[t][n],u=v[t+1][n],x=v[t+1][n+1],p=v[t][n+1],y=
|
|
|
-this.vertices[e].position.clone().setY(0).normalize(),A=this.vertices[u].position.clone().setY(0).normalize(),z=this.vertices[x].position.clone().setY(0).normalize(),E=this.vertices[p].position.clone().setY(0).normalize(),F=w[t][n].clone(),D=w[t+1][n].clone(),H=w[t+1][n+1].clone(),N=w[t][n+1].clone();this.faces.push(new THREE.Face4(e,u,x,p,[y,A,z,E]));this.faceVertexUvs[0].push([F,D,H,N])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=v[0][n],u=v[0][n+
|
|
|
-1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),F=w[0][n].clone(),D=w[0][n+1].clone(),H=new THREE.UV(D.u,0),this.faces.push(new THREE.Face3(e,u,x,[y,A,z])),this.faceVertexUvs[0].push([F,D,H])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=v[t][n+1],u=v[t][n],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),F=w[t][n+1].clone(),D=w[t][n].clone(),
|
|
|
-H=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,u,x,[y,A,z])),this.faceVertexUvs[0].push([F,D,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(),A=this.vertices[u].position.clone().setY(0).normalize(),z=this.vertices[x].position.clone().setY(0).normalize(),F=this.vertices[p].position.clone().setY(0).normalize(),E=w[t][n].clone(),D=w[t+1][n].clone(),G=w[t+1][n+1].clone(),N=w[t][n+1].clone();this.faces.push(new THREE.Face4(e,u,x,p,[y,A,z,F]));this.faceVertexUvs[0].push([E,D,G,N])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=v[0][n],u=v[0][n+
|
|
|
+1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),E=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,[y,A,z])),this.faceVertexUvs[0].push([E,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=v[t][n+1],u=v[t][n],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),E=w[t][n+1].clone(),D=w[t][n].clone(),
|
|
|
+G=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,u,x,[y,A,z])),this.faceVertexUvs[0].push([E,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=p+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,u=m;o+=da;f+=da;h+=da;u+=da;B.faces.push(new THREE.Face4(o,f,h,u,null,null,H));H&&(o=e/c,f=(e+1)/c,h=n+t*2,k=(B.vertices[k].position.z+t)/h,m=(B.vertices[m].position.z+t)/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,
|
|
|
+1);for(var e=0,c=p+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,u=m;o+=da;f+=da;h+=da;u+=da;B.faces.push(new THREE.Face4(o,f,h,u,null,null,G));G&&(o=e/c,f=(e+1)/c,h=n+t*2,k=(B.vertices[k].position.z+t)/h,m=(B.vertices[m].position.z+t)/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,D));if(D){var f=N.maxY,h=N.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,t=c.bevelThickness!==void 0?c.bevelThickness:6,v=c.bevelSize!==void 0?c.bevelSize:t-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,p=c.steps!==void 0?c.steps:1,y=c.bendPath,A=c.extrudePath,z,E=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,H=c.extrudeMaterial,N=this.shapebb;if(A)z=A.getPoints(x),p=z.length,E=!0,u=!1;u||(v=t=w=0);var O,K,G,B=this,da=this.vertices.length;y&&b.addWrapPath(y);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(A=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();K=0;for(G=x.length;K<G;K++)O=x[K],THREE.Shape.Utils.isClockWise(O)&&
|
|
|
-(x[K]=O.reverse());A=!1}A=THREE.Shape.Utils.triangulateShape(y,x);F=y;K=0;for(G=x.length;K<G;K++)O=x[K],y=y.concat(O);var J,R,S,Y,W,o,ea=y.length,Q=A.length,ma=[];J=0;R=F.length;ka=R-1;for(fa=J+1;J<R;J++,ka++,fa++)ka==R&&(ka=0),fa==R&&(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++){O=x[K];ia=[];J=0;R=O.length;ka=R-1;for(fa=J+1;J<R;J++,ka++,fa++)ka==R&&(ka=0),fa==R&&(fa=0),ia[J]=f(O[J],O[ka],O[fa]);Z.push(ia);aa=aa.concat(ia)}for(S=0;S<w;S++){Y=S/w;W=t*(1-Y);
|
|
|
-Y=v*Math.sin(Y*Math.PI/2);J=0;for(R=F.length;J<R;J++)o=e(F[J],ma[J],Y),k(o.x,o.y,-W);K=0;for(G=x.length;K<G;K++){O=x[K];ia=Z[K];J=0;for(R=O.length;J<R;J++)o=e(O[J],ia[J],Y),k(o.x,o.y,-W)}}Y=v;for(J=0;J<ea;J++)o=u?e(y[J],aa[J],Y):y[J],E?k(o.x,o.y+z[0].y,z[0].x):k(o.x,o.y,0);for(S=1;S<=p;S++)for(J=0;J<ea;J++)o=u?e(y[J],aa[J],Y):y[J],E?k(o.x,o.y+z[S-1].y,z[S-1].x):k(o.x,o.y,n/p*S);for(S=w-1;S>=0;S--){Y=S/w;W=t*(1-Y);Y=v*Math.sin(Y*Math.PI/2);J=0;for(R=F.length;J<R;J++)o=e(F[J],ma[J],Y),k(o.x,o.y,n+W);
|
|
|
-K=0;for(G=x.length;K<G;K++){O=x[K];ia=Z[K];J=0;for(R=O.length;J<R;J++)o=e(O[J],ia[J],Y),E?k(o.x,o.y+z[p-1].y,z[p-1].x+W):k(o.x,o.y,n+W)}}if(u){u=ea*0;for(J=0;J<Q;J++)v=A[J],m(v[2]+u,v[1]+u,v[0]+u);u=ea*(p+w*2);for(J=0;J<Q;J++)v=A[J],m(v[0]+u,v[1]+u,v[2]+u)}else{for(J=0;J<Q;J++)v=A[J],m(v[2],v[1],v[0]);for(J=0;J<Q;J++)v=A[J],m(v[0]+ea*p,v[1]+ea*p,v[2]+ea*p)}var ka,fa,ca=0;h(F);ca+=F.length;K=0;for(G=x.length;K<G;K++)O=x[K],h(O),ca+=O.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,p=c.steps!==void 0?c.steps:1,y=c.bendPath,A=c.extrudePath,z,F=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,G=c.extrudeMaterial,N=this.shapebb;if(A)z=A.getPoints(x),p=z.length,F=!0,u=!1;u||(v=t=w=0);var O,K,H,B=this,da=this.vertices.length;y&&b.addWrapPath(y);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(A=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();K=0;for(H=x.length;K<H;K++)O=x[K],THREE.Shape.Utils.isClockWise(O)&&
|
|
|
+(x[K]=O.reverse());A=!1}A=THREE.Shape.Utils.triangulateShape(y,x);E=y;K=0;for(H=x.length;K<H;K++)O=x[K],y=y.concat(O);var J,R,S,Y,W,o,ea=y.length,Q=A.length,ma=[];J=0;R=E.length;ka=R-1;for(fa=J+1;J<R;J++,ka++,fa++)ka==R&&(ka=0),fa==R&&(fa=0),ma[J]=f(E[J],E[ka],E[fa]);var Z=[],ia,aa=ma.concat();K=0;for(H=x.length;K<H;K++){O=x[K];ia=[];J=0;R=O.length;ka=R-1;for(fa=J+1;J<R;J++,ka++,fa++)ka==R&&(ka=0),fa==R&&(fa=0),ia[J]=f(O[J],O[ka],O[fa]);Z.push(ia);aa=aa.concat(ia)}for(S=0;S<w;S++){Y=S/w;W=t*(1-Y);
|
|
|
+Y=v*Math.sin(Y*Math.PI/2);J=0;for(R=E.length;J<R;J++)o=e(E[J],ma[J],Y),k(o.x,o.y,-W);K=0;for(H=x.length;K<H;K++){O=x[K];ia=Z[K];J=0;for(R=O.length;J<R;J++)o=e(O[J],ia[J],Y),k(o.x,o.y,-W)}}Y=v;for(J=0;J<ea;J++)o=u?e(y[J],aa[J],Y):y[J],F?k(o.x,o.y+z[0].y,z[0].x):k(o.x,o.y,0);for(S=1;S<=p;S++)for(J=0;J<ea;J++)o=u?e(y[J],aa[J],Y):y[J],F?k(o.x,o.y+z[S-1].y,z[S-1].x):k(o.x,o.y,n/p*S);for(S=w-1;S>=0;S--){Y=S/w;W=t*(1-Y);Y=v*Math.sin(Y*Math.PI/2);J=0;for(R=E.length;J<R;J++)o=e(E[J],ma[J],Y),k(o.x,o.y,n+W);
|
|
|
+K=0;for(H=x.length;K<H;K++){O=x[K];ia=Z[K];J=0;for(R=O.length;J<R;J++)o=e(O[J],ia[J],Y),F?k(o.x,o.y+z[p-1].y,z[p-1].x+W):k(o.x,o.y,n+W)}}if(u){u=ea*0;for(J=0;J<Q;J++)v=A[J],m(v[2]+u,v[1]+u,v[0]+u);u=ea*(p+w*2);for(J=0;J<Q;J++)v=A[J],m(v[0]+u,v[1]+u,v[2]+u)}else{for(J=0;J<Q;J++)v=A[J],m(v[2],v[1],v[0]);for(J=0;J<Q;J++)v=A[J],m(v[0]+ea*p,v[1]+ea*p,v[2]+ea*p)}var ka,fa,ca=0;h(E);ca+=E.length;K=0;for(H=x.length;K<H;K++)O=x[K],h(O),ca+=O.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 t=f(k.faces[n].a,k.faces[n].b),v=f(k.faces[n].b,k.faces[n].c),w=f(k.faces[n].c,k.faces[n].a);e(k.faces[n].a,t,w,b);e(k.faces[n].b,v,
|
|
@@ -511,10 +511,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,t,v,w,u,x,p,y,A,z=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(z){if(z.o){c=z._cachedOutline||(z._cachedOutline=z.o.split(" "));t=c.length;for(b=0;b<t;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;v=c[b++]*e;k.push(new THREE.Vector2(n,
|
|
|
-v));h.moveTo(n,v);break;case "l":n=c[b++]*e+f;v=c[b++]*e;k.push(new THREE.Vector2(n,v));h.lineTo(n,v);break;case "q":n=c[b++]*e+f;v=c[b++]*e;x=c[b++]*e+f;p=c[b++]*e;h.quadraticCurveTo(x,p,n,v);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,p,v);k.push(new THREE.Vector2(F,E))}}break;case "b":if(n=c[b++]*e+f,v=c[b++]*e,x=c[b++]*e+f,p=c[b++]*-e,y=c[b++]*e+f,A=c[b++]*-e,h.bezierCurveTo(n,v,
|
|
|
-x,p,y,A),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,y,n),E=THREE.Shape.Utils.b3(E,u,p,A,v),k.push(new THREE.Vector2(F,E))}}}return{offset:z.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=[],t,v,w;if(c(b)>0)for(v=0;v<h;v++)m[v]=v;else for(v=0;v<h;v++)m[v]=h-1-v;var u=2*h;for(v=h-1;h>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}t=v;h<=t&&(t=0);v=t+1;h<=v&&(v=0);w=v+1;h<=w&&(w=0);var x;a:{x=b;var p=t,y=v,A=w,z=h,E=m,F=void 0,D=void 0,H=void 0,
|
|
|
-N=void 0,O=void 0,K=void 0,G=void 0,B=void 0,da=void 0,D=x[E[p]].x,H=x[E[p]].y,N=x[E[y]].x,O=x[E[y]].y,K=x[E[A]].x,G=x[E[A]].y;if(1.0E-10>(N-D)*(G-H)-(O-H)*(K-D))x=!1;else{for(F=0;F<z;F++)if(!(F==p||F==y||F==A)){var B=x[E[F]].x,da=x[E[F]].y,J=void 0,R=void 0,S=void 0,Y=void 0,W=void 0,o=void 0,ea=void 0,Q=void 0,ma=void 0,Z=void 0,ia=void 0,aa=void 0,J=S=W=void 0,J=K-N,R=G-O,S=D-K,Y=H-G,W=N-D,o=O-H,ea=B-D,Q=da-H,ma=B-N,Z=da-O,ia=B-K,aa=da-G,J=J*Z-R*ma,W=W*Q-o*ea,S=S*aa-Y*ia;if(J>=0&&S>=0&&W>=0){x=
|
|
|
+v));h.moveTo(n,v);break;case "l":n=c[b++]*e+f;v=c[b++]*e;k.push(new THREE.Vector2(n,v));h.lineTo(n,v);break;case "q":n=c[b++]*e+f;v=c[b++]*e;x=c[b++]*e+f;p=c[b++]*e;h.quadraticCurveTo(x,p,n,v);if(m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var F=m/divisions,E=THREE.Shape.Utils.b2(F,w,x,n),F=THREE.Shape.Utils.b2(F,u,p,v);k.push(new THREE.Vector2(E,F))}}break;case "b":if(n=c[b++]*e+f,v=c[b++]*e,x=c[b++]*e+f,p=c[b++]*-e,y=c[b++]*e+f,A=c[b++]*-e,h.bezierCurveTo(n,v,
|
|
|
+x,p,y,A),m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)F=m/divisions,E=THREE.Shape.Utils.b3(F,w,x,y,n),F=THREE.Shape.Utils.b3(F,u,p,A,v),k.push(new THREE.Vector2(E,F))}}}return{offset:z.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=[],t,v,w;if(c(b)>0)for(v=0;v<h;v++)m[v]=v;else for(v=0;v<h;v++)m[v]=h-1-v;var u=2*h;for(v=h-1;h>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}t=v;h<=t&&(t=0);v=t+1;h<=v&&(v=0);w=v+1;h<=w&&(w=0);var x;a:{x=b;var p=t,y=v,A=w,z=h,F=m,E=void 0,D=void 0,G=void 0,
|
|
|
+N=void 0,O=void 0,K=void 0,H=void 0,B=void 0,da=void 0,D=x[F[p]].x,G=x[F[p]].y,N=x[F[y]].x,O=x[F[y]].y,K=x[F[A]].x,H=x[F[A]].y;if(1.0E-10>(N-D)*(H-G)-(O-G)*(K-D))x=!1;else{for(E=0;E<z;E++)if(!(E==p||E==y||E==A)){var B=x[F[E]].x,da=x[F[E]].y,J=void 0,R=void 0,S=void 0,Y=void 0,W=void 0,o=void 0,ea=void 0,Q=void 0,ma=void 0,Z=void 0,ia=void 0,aa=void 0,J=S=W=void 0,J=K-N,R=H-O,S=D-K,Y=G-H,W=N-D,o=O-G,ea=B-D,Q=da-G,ma=B-N,Z=da-O,ia=B-K,aa=da-H,J=J*Z-R*ma,W=W*Q-o*ea,S=S*aa-Y*ia;if(J>=0&&S>=0&&W>=0){x=
|
|
|
!1;break a}}x=!0}}if(x){k.push([b[m[t]],b[m[v]],b[m[w]]]);n.push([m[t],m[v],m[w]]);t=v;for(w=v+1;w<h;t++,w++)m[t]=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,t=new THREE.Face4(h,k,m,n,[c[h],c[k],c[m],c[n]]);t.normal.addSelf(c[h]);t.normal.addSelf(c[k]);t.normal.addSelf(c[m]);t.normal.addSelf(c[n]);t.normal.normalize();this.faces.push(t);
|
|
@@ -522,13 +522,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 t=b/this.segmentsR*2*this.p*Math.PI,m=c/this.segmentsT*2*Math.PI,h=n(t,m,this.q,this.p,this.radius,this.heightScale),t=n(t+0.01,m,this.q,this.p,this.radius,this.heightScale);e.x=t.x-h.x;e.y=t.y-h.y;e.z=t.z-h.z;f.x=t.x+h.x;f.y=t.y+h.y;f.z=t.z+h.z;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();t=-this.tube*Math.cos(m);m=this.tube*Math.sin(m);h.x+=t*f.x+m*k.x;h.y+=t*f.y+m*k.y;h.z+=t*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),t=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),v=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,t,v,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 p=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors)p.vertexColors=n.vertexColors;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,t=n.concat(),v=[],w={},u=[],x,p,y,A,z,E=b.faceVertexUvs[0];x=0;for(p=E.length;x<p;x++){y=0;for(A=E[x].length;y<A;y++)z=f[x]["abcd".charAt(y)],
|
|
|
-u[z]||(u[z]=E[x][y])}var F;x=0;for(p=f.length;x<p;x++)if(z=f[x],v.push(z.centroid),t.push(new THREE.Vertex(z.centroid)),m.supportUVs&&u.length!=0){F=new THREE.UV;if(z instanceof THREE.Face3)F.u=u[z.a].u+u[z.b].u+u[z.c].u,F.v=u[z.a].v+u[z.b].v+u[z.c].v,F.u/=3,F.v/=3;else if(z instanceof THREE.Face4)F.u=u[z.a].u+u[z.b].u+u[z.c].u+u[z.d].u,F.v=u[z.a].v+u[z.b].v+u[z.c].v+u[z.d].v,F.u/=4,F.v/=4;u.push(F)}A=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,H,N=0,E=n.length,O;for(x in A)if(z=A[x],F=z[0],D=z[1],H=new THREE.Vector3,z.length!=2)console.log("warning, edge fail",z);else if(H.addSelf(v[F]),H.addSelf(v[D]),O=x.split("_"),p=O[0],O=O[1],H.addSelf(n[p].position),H.addSelf(n[O].position),H.multiplyScalar(0.25),
|
|
|
-w[x]=E+f.length+N,t.push(new THREE.Vertex(H)),N++,m.supportUVs&&u.length!=0)F=new THREE.UV,F.u=u[p].u+u[O].u,F.v=u[p].v+u[O].v,F.u/=2,F.v/=2,u.push(F);x=0;for(p=v.length;x<p;x++)z=f[x],O=E+x,z instanceof THREE.Face3?(F=e(z.a,z.b),D=e(z.b,z.c),N=e(z.c,z.a),c(O,w[F],z.b,w[D],z),c(O,w[D],z.c,w[N],z),c(O,w[N],z.a,w[F],z)):z instanceof THREE.Face4?(F=e(z.a,z.b),D=e(z.b,z.c),N=e(z.c,z.d),H=e(z.d,z.a),c(O,w[F],z.b,w[D],z),c(O,w[D],z.c,w[N],z),c(O,w[N],z.d,w[H],z),c(O,w[H],z.a,w[F],z)):console.log("face should be a face!",
|
|
|
-z);var f=t,K={},G={},t=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 A)z=A[x],O=x.split("_"),p=O[0],O=O[1],t(p,[p,O]),t(O,[p,O]),F=z[0],D=z[1],w(p,F),w(p,D),w(O,F),w(O,D);t=new THREE.Vector3;w=new THREE.Vector3;x=0;for(p=n.length;x<p;x++)if(K[x]!==void 0){t.set(0,0,0);w.set(0,0,0);A=new THREE.Vector3(0,0,0);E=0;for(y in G[x])t.addSelf(v[y]),E++;t.divideScalar(E);E=K[x].length;for(y=0;y<E;y++)z=K[x][y],z=n[z[0]].position.clone().addSelf(n[z[1]].position).divideScalar(2),
|
|
|
-w.addSelf(z);w.divideScalar(E);A.addSelf(n[x].position);A.multiplyScalar(E-3);A.addSelf(t);A.addSelf(w.multiplyScalar(2));A.divideScalar(E);f[x].position=A}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){var p=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors)p.vertexColors=n.vertexColors;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,t=n.concat(),v=[],w={},u=[],x,p,y,A,z,F=b.faceVertexUvs[0];x=0;for(p=F.length;x<p;x++){y=0;for(A=F[x].length;y<A;y++)z=f[x]["abcd".charAt(y)],
|
|
|
+u[z]||(u[z]=F[x][y])}var E;x=0;for(p=f.length;x<p;x++)if(z=f[x],v.push(z.centroid),t.push(new THREE.Vertex(z.centroid)),m.supportUVs&&u.length!=0){E=new THREE.UV;if(z instanceof THREE.Face3)E.u=u[z.a].u+u[z.b].u+u[z.c].u,E.v=u[z.a].v+u[z.b].v+u[z.c].v,E.u/=3,E.v/=3;else if(z instanceof THREE.Face4)E.u=u[z.a].u+u[z.b].u+u[z.c].u+u[z.d].u,E.v=u[z.a].v+u[z.b].v+u[z.c].v+u[z.d].v,E.u/=4,E.v/=4;u.push(E)}A=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,N=0,F=n.length,O;for(x in A)if(z=A[x],E=z[0],D=z[1],O=x.split("_"),p=O[0],O=O[1],G=new THREE.Vector3,z.length!=2?(G.addSelf(n[p].position),G.addSelf(n[O].position),G.multiplyScalar(0.5)):(G.addSelf(v[E]),G.addSelf(v[D]),G.addSelf(n[p].position),G.addSelf(n[O].position),
|
|
|
+G.multiplyScalar(0.25)),w[x]=F+f.length+N,t.push(new THREE.Vertex(G)),N++,m.supportUVs&&u.length!=0)E=new THREE.UV,E.u=u[p].u+u[O].u,E.v=u[p].v+u[O].v,E.u/=2,E.v/=2,u.push(E);x=0;for(p=v.length;x<p;x++)z=f[x],E=F+x,z instanceof THREE.Face3?(D=e(z.a,z.b),O=e(z.b,z.c),N=e(z.c,z.a),c(E,w[D],z.b,w[O],z),c(E,w[O],z.c,w[N],z),c(E,w[N],z.a,w[D],z)):z instanceof THREE.Face4?(D=e(z.a,z.b),O=e(z.b,z.c),N=e(z.c,z.d),G=e(z.d,z.a),c(E,w[D],z.b,w[O],z),c(E,w[O],z.c,w[N],z),c(E,w[N],z.d,w[G],z),c(E,w[G],z.a,w[D],
|
|
|
+z)):console.log("face should be a face!",z);var f=t,K={},H={},t=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 A)z=A[x],O=x.split("_"),p=O[0],O=O[1],t(p,[p,O]),t(O,[p,O]),E=z[0],D=z[1],w(p,E),D?w(p,D):w(p,E),w(O,E),D?w(O,D):w(O,E);t=new THREE.Vector3;w=new THREE.Vector3;x=0;for(p=n.length;x<p;x++)if(K[x]!==void 0){t.set(0,0,0);w.set(0,0,0);A=new THREE.Vector3(0,0,0);F=0;for(y in H[x])t.addSelf(v[y]),F++;t.divideScalar(F);F=K[x].length;
|
|
|
+for(y=0;y<F;y++)z=K[x][y],z=n[z[0]].position.clone().addSelf(n[z[1]].position).divideScalar(2),w.addSelf(z);w.divideScalar(F);A.addSelf(n[x].position);A.multiplyScalar(F-3);A.addSelf(t);A.addSelf(w.multiplyScalar(2));A.divideScalar(F);f[x].position=A}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;
|
|
@@ -543,16 +544,16 @@ c.postMessage(b)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,k){var m=new XMLHttpRequest,n=f+"/"+b,t=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&&(t==0&&(t=m.getResponseHeader("Content-Length")),k({total:t,loaded:m.responseText.length})):m.readyState==2&&(t=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 t(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function v(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+O);k=h(b,e+K);e=t(b,e+G);E.faces.push(new THREE.Face3(c,f,k,null,null,E.materials[e]))}function x(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+O);k=h(b,e+K);m=t(b,e+G);o=h(b,e+B);p=h(b,e+da);e=h(b,e+J);m=E.materials[m];var u=H[p*3],v=H[p*3+1];p=H[p*3+2];var w=H[e*3],x=H[e*3+1],e=H[e*3+2];E.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,p),new THREE.Vector3(w,x,e)],null,m))}function p(e){var c,f,k,m;c=h(b,e);f=h(b,e+R);k=h(b,e+S);m=h(b,
|
|
|
-e+Y);e=t(b,e+W);E.faces.push(new THREE.Face4(c,f,k,m,null,null,E.materials[e]))}function y(e){var c,f,k,m,p,u,v,w;c=h(b,e);f=h(b,e+R);k=h(b,e+S);m=h(b,e+Y);p=t(b,e+W);u=h(b,e+o);v=h(b,e+ea);w=h(b,e+Q);e=h(b,e+ma);p=E.materials[p];var x=H[v*3],L=H[v*3+1];v=H[v*3+2];var y=H[w*3],M=H[w*3+1];w=H[w*3+2];var z=H[e*3],A=H[e*3+1],e=H[e*3+2];E.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,L,v),new THREE.Vector3(y,M,w),new THREE.Vector3(z,A,e)],null,p))}
|
|
|
-function A(e){var c,f,k,m;c=h(b,e);f=h(b,e+Z);k=h(b,e+ia);e=N[c*2];m=N[c*2+1];c=N[f*2];var o=E.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(e,m));t.push(new THREE.UV(c,f));t.push(new THREE.UV(p,k));o.push(t)}function z(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+aa);k=h(b,e+ka);m=h(b,e+fa);e=N[c*2];o=N[c*2+1];c=N[f*2];p=N[f*2+1];f=N[k*2];var t=E.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,p));v.push(new THREE.UV(f,
|
|
|
-k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,F=0,D,H=[],N=[],O,K,G,B,da,J,R,S,Y,W,o,ea,Q,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,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;O=D.vertex_index_bytes;K=D.vertex_index_bytes*2;G=D.vertex_index_bytes*3;B=D.vertex_index_bytes*3+D.material_index_bytes;da=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;R=D.vertex_index_bytes;
|
|
|
+f,k;c=h(b,e);f=h(b,e+O);k=h(b,e+K);e=t(b,e+H);F.faces.push(new THREE.Face3(c,f,k,null,null,F.materials[e]))}function x(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+O);k=h(b,e+K);m=t(b,e+H);o=h(b,e+B);p=h(b,e+da);e=h(b,e+J);m=F.materials[m];var u=G[p*3],v=G[p*3+1];p=G[p*3+2];var w=G[e*3],x=G[e*3+1],e=G[e*3+2];F.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,p),new THREE.Vector3(w,x,e)],null,m))}function p(e){var c,f,k,m;c=h(b,e);f=h(b,e+R);k=h(b,e+S);m=h(b,
|
|
|
+e+Y);e=t(b,e+W);F.faces.push(new THREE.Face4(c,f,k,m,null,null,F.materials[e]))}function y(e){var c,f,k,m,p,u,v,w;c=h(b,e);f=h(b,e+R);k=h(b,e+S);m=h(b,e+Y);p=t(b,e+W);u=h(b,e+o);v=h(b,e+ea);w=h(b,e+Q);e=h(b,e+ma);p=F.materials[p];var x=G[v*3],L=G[v*3+1];v=G[v*3+2];var y=G[w*3],M=G[w*3+1];w=G[w*3+2];var z=G[e*3],A=G[e*3+1],e=G[e*3+2];F.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,L,v),new THREE.Vector3(y,M,w),new THREE.Vector3(z,A,e)],null,p))}
|
|
|
+function A(e){var c,f,k,m;c=h(b,e);f=h(b,e+Z);k=h(b,e+ia);e=N[c*2];m=N[c*2+1];c=N[f*2];var o=F.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(e,m));t.push(new THREE.UV(c,f));t.push(new THREE.UV(p,k));o.push(t)}function z(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+aa);k=h(b,e+ka);m=h(b,e+fa);e=N[c*2];o=N[c*2+1];c=N[f*2];p=N[f*2+1];f=N[k*2];var t=F.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,p));v.push(new THREE.UV(f,
|
|
|
+k));v.push(new THREE.UV(u,m));t.push(v)}var F=this,E=0,D,G=[],N=[],O,K,H,B,da,J,R,S,Y,W,o,ea,Q,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,f,e);D={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b,
|
|
|
+E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=D.header_bytes;O=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;da=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;R=D.vertex_index_bytes;
|
|
|
S=D.vertex_index_bytes*2;Y=D.vertex_index_bytes*3;W=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;ea=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;Q=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;ma=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;Z=D.uv_index_bytes;ia=D.uv_index_bytes*2;aa=D.uv_index_bytes;ka=D.uv_index_bytes*2;fa=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;ca=D.ntri_flat*e;$=D.ntri_smooth*(e+D.normal_index_bytes*3);X=D.ntri_flat_uv*(e+D.uv_index_bytes*3);ga=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);la=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=v(b,e),f=v(b,e+D.normal_coordinate_bytes),h=v(b,e+D.normal_coordinate_bytes*2),H.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),N.push(f,h);return D.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=D.vertex_index_bytes*3+D.material_index_bytes,
|
|
|
+4+D.material_index_bytes;ca=D.ntri_flat*e;$=D.ntri_smooth*(e+D.normal_index_bytes*3);X=D.ntri_flat_uv*(e+D.uv_index_bytes*3);ga=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);la=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);E+=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),F.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
|
|
|
+h,k)));return D.nvertices*n}(E);E+=function(e){for(var c,f,h,k=D.normal_coordinate_bytes*3,m=e+D.nnormals*k;e<m;e+=k)c=v(b,e),f=v(b,e+D.normal_coordinate_bytes),h=v(b,e+D.normal_coordinate_bytes*2),G.push(c/127,f/127,h/127);return D.nnormals*k}(E);E+=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),N.push(f,h);return D.nuvs*k}(E);ca=E+ca;$=ca+$;X=$+X;ga=X+ga;la=ga+la;e=la+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),A(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),A(e+c);return h-b})(X);(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)p(e),z(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)y(e),z(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})(ca);(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)p(e);return f-b})(ga);(function(b){var e,
|
|
|
+4,f=c+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(e=b;e<h;e+=f)y(e),z(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})(E);(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})(ca);(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)p(e);return f-b})(ga);(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)y(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,Q,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=P[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],
|
|
@@ -563,8 +564,8 @@ new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_materia
|
|
|
v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(c!==void 0)f(n,c),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=c.skeleton,o.skinController=P[c.url],o.skinInstanceController=c,o.name="skin_"+Ca.length,Ca.push(o);else if(k!==void 0){p=n;t=k instanceof x?P[k.url]:k;if(!t||!t.morph)console.log("could not find morph controller!");
|
|
|
else{t=t.morph;for(v=0;v<t.targets.length;v++){var w=oa[t.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:w.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.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 t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function v(){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 p(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function A(){this.id="";this.mesh=null}function z(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 H(){this.input={}}function N(){this.semantic="";this.offset=0;this.source="";this.set=0}function O(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=
|
|
|
+this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function A(){this.id="";this.mesh=null}function z(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function F(){}function E(){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 N(){this.semantic="";this.offset=0;this.source="";this.set=0}function O(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 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 R(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function S(){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 O(e)).parse(b);return la[e]}function Q(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={},P={},oa={},qa={},wa={},ta,Ea,Aa,Ca,Fa=THREE.SmoothShading;k.prototype.parse=function(b){this.id=
|
|
@@ -585,18 +586,18 @@ this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],th
|
|
|
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,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new p).parse(f)),f=c.iterateNext()}}return this};
|
|
|
p.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};y.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,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new p).parse(e)),
|
|
|
e=b.iterateNext();break}}return this};A.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 z(this)).parse(c)}}return this};z.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 E).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),
|
|
|
+(new G).parse(f);break;case "triangles":this.primitives.push((new E).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new F).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),
|
|
|
this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};z.prototype.handlePrimitive=function(b,e,c){var f=0,h,k,m=b.p,n=b.inputs,o,p,t,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],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=fa(e.vertices[p].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t],source.data[t+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+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 N).parse(b.childNodes[e]));break;case "vcount":this.vcount=Z(c.textContent);break;case "p":this.p=Z(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};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 N).parse(b.childNodes[e]),this.input[input.semantic]=input);return this};N.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
|
|
|
+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}};F.prototype=new E;F.prototype.constructor=F;E.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};
|
|
|
+E.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 N).parse(b.childNodes[e]));break;case "vcount":this.vcount=Z(c.textContent);break;case "p":this.p=Z(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 N).parse(b.childNodes[e]),this.input[input.semantic]=input);return this};N.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};O.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 D).parse(c.childNodes[f]);break}}}return this};O.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 S).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,Q,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=
|
|
|
+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 S).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=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 H).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=ca.evaluate(".//dae:float",c,Q,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)};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: "+
|
|
|
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};
|
|
|
R.prototype.create=function(){if(this.shader==null)return null};R.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};R.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=
|
|
@@ -609,45 +610,45 @@ document.implementation.createDocument){document.implementation.createDocument("
|
|
|
K,"material");wa=b("//dae:library_effects/dae:effect",R,"effect");oa=b("//dae:library_geometries/dae:geometry",A,"geometry");P=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",v,"visual_scene");Aa=[];Ca=[];(p=ca.evaluate(".//dae:scene/dae:instance_visual_scene",ca,Q,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 t in na);t={scene:$,morphs:Aa,skins:Ca,dae:{images:ra,materials:qa,effects:wa,geometries:oa,controllers:P,animations:na,visualScenes:ta,scene:X}};o&&o(t)}};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,t,v,w,u,x,p,y,A,z,E,F,D,H=b.faces;u=b.vertices;var N=b.normals,O=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]=[];v=0;for(w=u.length;v<w;)x=new THREE.Vertex,x.position.x=u[v++]*e,x.position.y=
|
|
|
-u[v++]*e,x.position.z=u[v++]*e,f.vertices.push(x);v=0;for(w=H.length;v<w;){e=H[v++];u=e&1;t=e&2;c=e&4;h=e&8;p=e&16;x=e&32;A=e&64;e&=128;u?(z=new THREE.Face4,z.a=H[v++],z.b=H[v++],z.c=H[v++],z.d=H[v++],u=4):(z=new THREE.Face3,z.a=H[v++],z.b=H[v++],z.c=H[v++],u=3);if(t)t=H[v++],z.materials=f.materials[t];t=f.faces.length;if(c)for(c=0;c<K;c++)E=b.uvs[c],y=H[v++],D=E[y*2],y=E[y*2+1],f.faceUvs[c][t]=new THREE.UV(D,y);if(h)for(c=0;c<K;c++){E=b.uvs[c];F=[];for(h=0;h<u;h++)y=H[v++],D=E[y*2],y=E[y*2+1],F[h]=
|
|
|
-new THREE.UV(D,y);f.faceVertexUvs[c][t]=F}if(p)p=H[v++]*3,h=new THREE.Vector3,h.x=N[p++],h.y=N[p++],h.z=N[p],z.normal=h;if(x)for(c=0;c<u;c++)p=H[v++]*3,h=new THREE.Vector3,h.x=N[p++],h.y=N[p++],h.z=N[p],z.vertexNormals.push(h);if(A)x=H[v++],x=new THREE.Color(O[x]),z.color=x;if(e)for(c=0;c<u;c++)x=H[v++],x=new THREE.Color(O[x]),z.vertexColors.push(x);f.faces.push(z)}}})(h);(function(){var e,c,h,t;if(b.skinWeights){e=0;for(c=b.skinWeights.length;e<c;e+=2)h=b.skinWeights[e],t=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,t,v,w,u,x,p,y,A,z,F,E,D,G=b.faces;u=b.vertices;var N=b.normals,O=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]=[];v=0;for(w=u.length;v<w;)x=new THREE.Vertex,x.position.x=u[v++]*e,x.position.y=
|
|
|
+u[v++]*e,x.position.z=u[v++]*e,f.vertices.push(x);v=0;for(w=G.length;v<w;){e=G[v++];u=e&1;t=e&2;c=e&4;h=e&8;p=e&16;x=e&32;A=e&64;e&=128;u?(z=new THREE.Face4,z.a=G[v++],z.b=G[v++],z.c=G[v++],z.d=G[v++],u=4):(z=new THREE.Face3,z.a=G[v++],z.b=G[v++],z.c=G[v++],u=3);if(t)t=G[v++],z.materials=f.materials[t];t=f.faces.length;if(c)for(c=0;c<K;c++)F=b.uvs[c],y=G[v++],D=F[y*2],y=F[y*2+1],f.faceUvs[c][t]=new THREE.UV(D,y);if(h)for(c=0;c<K;c++){F=b.uvs[c];E=[];for(h=0;h<u;h++)y=G[v++],D=F[y*2],y=F[y*2+1],E[h]=
|
|
|
+new THREE.UV(D,y);f.faceVertexUvs[c][t]=E}if(p)p=G[v++]*3,h=new THREE.Vector3,h.x=N[p++],h.y=N[p++],h.z=N[p],z.normal=h;if(x)for(c=0;c<u;c++)p=G[v++]*3,h=new THREE.Vector3,h.x=N[p++],h.y=N[p++],h.z=N[p],z.vertexNormals.push(h);if(A)x=G[v++],x=new THREE.Color(O[x]),z.color=x;if(e)for(c=0;c<u;c++)x=G[v++],x=new THREE.Color(O[x]),z.vertexColors.push(x);f.faces.push(z)}}})(h);(function(){var e,c,h,t;if(b.skinWeights){e=0;for(c=b.skinWeights.length;e<c;e+=2)h=b.skinWeights[e],t=b.skinWeights[e+1],f.skinWeights.push(new THREE.Vector4(h,
|
|
|
t,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)h=b.skinIndices[e],t=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(h,t,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,h,t,v,w,u,x,p,y;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=[];p=f.morphTargets[c].vertices;y=b.morphTargets[c].vertices;t=0;for(v=y.length;t<v;t+=3)w=y[t]*e,u=y[t+1]*
|
|
|
e,x=y[t+2]*e,p.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=[];v=f.morphColors[c].colors;w=b.morphColors[c].colors;e=0;for(t=w.length;e<t;e+=3)u=new THREE.Color(16755200),u.setRGB(w[e],w[e+1],w[e+2]),v.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(p in R.objects)if(!Q.objects[p])if(F=R.objects[p],F.geometry!==void 0){if(O=Q.geometries[F.geometry]){var b=!1;da=[];for(Z=0;Z<F.materials.length;Z++)da[Z]=Q.materials[F.materials[Z]],b=da[Z]instanceof THREE.ShaderMaterial;b&&O.computeTangents();D=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(O,da);object.name=p;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;Q.scene.add(object);Q.objects[p]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(b));
|
|
|
-if(F.castsShadow)b=new THREE.ShadowVolume(O),Q.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},Q.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=p,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,Q.scene.add(object),Q.objects[p]=object,Q.empties[p]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},Q.triggers[object.name]=b)}function t(b){return function(c){Q.geometries[b]=c;n();Y-=1;e.onLoadComplete();w()}}function v(b){return function(e){Q.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-Y,loadedTextures:ea-W},Q);e.onLoadProgress();Y==0&&W==0&&c(Q)}var u,
|
|
|
-x,p,y,A,z,E,F,D,H,N,O,K,G,B,da,J,R,S,Y,W,o,ea,Q;R=b.data;B=new THREE.BinaryLoader;S=new THREE.JSONLoader;W=Y=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in R.objects)if(F=R.objects[p],F.meshCollider){b=!0;break}if(b)Q.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;H=R.transform.rotation;var ma=R.transform.scale;b&&Q.scene.position.set(b[0],b[1],b[2]);H&&Q.scene.rotation.set(H[0],
|
|
|
-H[1],H[2]);ma&&Q.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&Q.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(A in R.cameras){H=R.cameras[A];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);D=H.position;H=H.target;K.position.set(D[0],D[1],D[2]);K.target.position.set(H[0],H[1],H[2]);Q.cameras[A]=
|
|
|
-K}for(y in R.lights)A=R.lights[y],K=A.color!==void 0?A.color:16777215,H=A.intensity!==void 0?A.intensity:1,A.type=="directional"?(D=A.direction,J=new THREE.DirectionalLight(K,H),J.position.set(D[0],D[1],D[2]),J.position.normalize()):A.type=="point"?(D=A.position,d=A.distance,J=new THREE.PointLight(K,H,d),J.position.set(D[0],D[1],D[2])):A.type=="ambient"&&(J=new THREE.AmbientLight(K)),Q.scene.add(J),Q.lights[y]=J;for(z in R.fogs)y=R.fogs[z],y.type=="linear"?G=new THREE.Fog(0,y.near,y.far):y.type==
|
|
|
-"exp2"&&(G=new THREE.FogExp2(0,y.density)),H=y.color,G.color.setRGB(H[0],H[1],H[2]),Q.fogs[z]=G;if(Q.cameras&&R.defaults.camera)Q.currentCamera=Q.cameras[R.defaults.camera];if(Q.fogs&&R.defaults.fog)Q.scene.fog=Q.fogs[R.defaults.fog];H=R.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(H[0],H[1],H[2]);Q.bgColorAlpha=R.defaults.bgalpha;for(u in R.geometries)if(z=R.geometries[u],z.type=="bin_mesh"||z.type=="ascii_mesh")Y+=1,e.onLoadStart();o=Y;for(u in R.geometries)z=R.geometries[u],z.type==
|
|
|
+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(p in R.objects)if(!Q.objects[p])if(E=R.objects[p],E.geometry!==void 0){if(O=Q.geometries[E.geometry]){var b=!1;da=[];for(Z=0;Z<E.materials.length;Z++)da[Z]=Q.materials[E.materials[Z]],b=da[Z]instanceof THREE.ShaderMaterial;b&&O.computeTangents();D=E.position;r=E.rotation;
|
|
|
+q=E.quaternion;s=E.scale;q=0;da.length==0&&(da[0]=new THREE.MeshFaceMaterial);da.length>1&&(da=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(O,da);object.name=p;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=E.visible;Q.scene.add(object);Q.objects[p]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(b));
|
|
|
+if(E.castsShadow)b=new THREE.ShadowVolume(O),Q.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},Q.triggers[object.name]=b)}}else D=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=p,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=E.visible!==void 0?E.visible:!1,Q.scene.add(object),Q.objects[p]=object,Q.empties[p]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},Q.triggers[object.name]=b)}function t(b){return function(c){Q.geometries[b]=c;n();Y-=1;e.onLoadComplete();w()}}function v(b){return function(e){Q.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-Y,loadedTextures:ea-W},Q);e.onLoadProgress();Y==0&&W==0&&c(Q)}var u,
|
|
|
+x,p,y,A,z,F,E,D,G,N,O,K,H,B,da,J,R,S,Y,W,o,ea,Q;R=b.data;B=new THREE.BinaryLoader;S=new THREE.JSONLoader;W=Y=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in R.objects)if(E=R.objects[p],E.meshCollider){b=!0;break}if(b)Q.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;G=R.transform.rotation;var ma=R.transform.scale;b&&Q.scene.position.set(b[0],b[1],b[2]);G&&Q.scene.rotation.set(G[0],
|
|
|
+G[1],G[2]);ma&&Q.scene.scale.set(ma[0],ma[1],ma[2]);(b||G||ma)&&Q.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(A in R.cameras){G=R.cameras[A];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]);Q.cameras[A]=
|
|
|
+K}for(y in R.lights)A=R.lights[y],K=A.color!==void 0?A.color:16777215,G=A.intensity!==void 0?A.intensity:1,A.type=="directional"?(D=A.direction,J=new THREE.DirectionalLight(K,G),J.position.set(D[0],D[1],D[2]),J.position.normalize()):A.type=="point"?(D=A.position,d=A.distance,J=new THREE.PointLight(K,G,d),J.position.set(D[0],D[1],D[2])):A.type=="ambient"&&(J=new THREE.AmbientLight(K)),Q.scene.add(J),Q.lights[y]=J;for(z in R.fogs)y=R.fogs[z],y.type=="linear"?H=new THREE.Fog(0,y.near,y.far):y.type==
|
|
|
+"exp2"&&(H=new THREE.FogExp2(0,y.density)),G=y.color,H.color.setRGB(G[0],G[1],G[2]),Q.fogs[z]=H;if(Q.cameras&&R.defaults.camera)Q.currentCamera=Q.cameras[R.defaults.camera];if(Q.fogs&&R.defaults.fog)Q.scene.fog=Q.fogs[R.defaults.fog];G=R.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(G[0],G[1],G[2]);Q.bgColorAlpha=R.defaults.bgalpha;for(u in R.geometries)if(z=R.geometries[u],z.type=="bin_mesh"||z.type=="ascii_mesh")Y+=1,e.onLoadStart();o=Y;for(u in R.geometries)z=R.geometries[u],z.type==
|
|
|
"cube"?(O=new THREE.CubeGeometry(z.width,z.height,z.depth,z.segmentsWidth,z.segmentsHeight,z.segmentsDepth,null,z.flipped,z.sides),Q.geometries[u]=O):z.type=="plane"?(O=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),Q.geometries[u]=O):z.type=="sphere"?(O=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),Q.geometries[u]=O):z.type=="cylinder"?(O=new THREE.CylinderGeometry(z.topRad,z.botRad,z.height,z.radSegs,z.heightSegs),Q.geometries[u]=O):z.type=="torus"?
|
|
|
-(O=new THREE.TorusGeometry(z.radius,z.tube,z.segmentsR,z.segmentsT),Q.geometries[u]=O):z.type=="icosahedron"?(O=new THREE.IcosahedronGeometry(z.subdivisions),Q.geometries[u]=O):z.type=="bin_mesh"?B.load({model:f(z.url,R.urlBaseType),callback:t(u)}):z.type=="ascii_mesh"?S.load({model:f(z.url,R.urlBaseType),callback:t(u)}):z.type=="embedded_mesh"&&(z=R.embeds[z.id])&&S.createModel(z,v(u),"");for(E in R.textures)if(u=R.textures[E],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(E in R.textures){u=R.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 Z=0;Z<u.url.length;Z++)B[Z]=f(u.url[Z],R.urlBaseType);B=THREE.ImageUtils.loadTextureCube(B,u.mapping,b)}else{B=THREE.ImageUtils.loadTexture(f(u.url,R.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){S={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(S[u.wrap[0]]!==void 0)B.wrapS=S[u.wrap[0]];if(S[u.wrap[1]]!==void 0)B.wrapT=S[u.wrap[1]]}}Q.textures[E]=B}for(x in R.materials){E=R.materials[x];for(N in E.parameters)if(N=="envMap"||N=="map"||N=="lightMap")E.parameters[N]=Q.textures[E.parameters[N]];else if(N=="shading")E.parameters[N]=
|
|
|
-E.parameters[N]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(N=="blending")E.parameters[N]=THREE[E.parameters[N]]?THREE[E.parameters[N]]:THREE.NormalBlending;else if(N=="combine")E.parameters[N]=E.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(N=="vertexColors")if(E.parameters[N]=="face")E.parameters[N]=THREE.FaceColors;else if(E.parameters[N])E.parameters[N]=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;S=E.parameters.specular;z=E.parameters.ambient;G=E.parameters.shininess;b.tNormal.texture=Q.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=
|
|
|
-Q.textures[E.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(B);b.uSpecularColor.value.setHex(S);b.uAmbientColor.value.setHex(z);b.uShininess.value=G;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);Q.materials[x]=E}n();e.callbackSync(Q)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
+(O=new THREE.TorusGeometry(z.radius,z.tube,z.segmentsR,z.segmentsT),Q.geometries[u]=O):z.type=="icosahedron"?(O=new THREE.IcosahedronGeometry(z.subdivisions),Q.geometries[u]=O):z.type=="bin_mesh"?B.load({model:f(z.url,R.urlBaseType),callback:t(u)}):z.type=="ascii_mesh"?S.load({model:f(z.url,R.urlBaseType),callback:t(u)}):z.type=="embedded_mesh"&&(z=R.embeds[z.id])&&S.createModel(z,v(u),"");for(F in R.textures)if(u=R.textures[F],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(F in R.textures){u=R.textures[F];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],R.urlBaseType);B=THREE.ImageUtils.loadTextureCube(B,u.mapping,b)}else{B=THREE.ImageUtils.loadTexture(f(u.url,R.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){S={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(S[u.wrap[0]]!==void 0)B.wrapS=S[u.wrap[0]];if(S[u.wrap[1]]!==void 0)B.wrapT=S[u.wrap[1]]}}Q.textures[F]=B}for(x in R.materials){F=R.materials[x];for(N in F.parameters)if(N=="envMap"||N=="map"||N=="lightMap")F.parameters[N]=Q.textures[F.parameters[N]];else if(N=="shading")F.parameters[N]=
|
|
|
+F.parameters[N]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(N=="blending")F.parameters[N]=THREE[F.parameters[N]]?THREE[F.parameters[N]]:THREE.NormalBlending;else if(N=="combine")F.parameters[N]=F.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(N=="vertexColors")if(F.parameters[N]=="face")F.parameters[N]=THREE.FaceColors;else if(F.parameters[N])F.parameters[N]=THREE.VertexColors;if(F.parameters.opacity!==void 0&&F.parameters.opacity<1)F.parameters.transparent=
|
|
|
+!0;if(F.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);B=F.parameters.color;S=F.parameters.specular;z=F.parameters.ambient;H=F.parameters.shininess;b.tNormal.texture=Q.textures[F.parameters.normalMap];if(F.parameters.normalMapFactor)b.uNormalScale.value=F.parameters.normalMapFactor;if(F.parameters.map)b.tDiffuse.texture=F.parameters.map,b.enableDiffuse.value=!0;if(F.parameters.lightMap)b.tAO.texture=F.parameters.lightMap,b.enableAO.value=!0;if(F.parameters.specularMap)b.tSpecular.texture=
|
|
|
+Q.textures[F.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(B);b.uSpecularColor.value.setHex(S);b.uAmbientColor.value.setHex(z);b.uShininess.value=H;if(F.parameters.opacity)b.uOpacity.value=F.parameters.opacity;F=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else F=new THREE[F.type](F.parameters);Q.materials[x]=F}n();e.callbackSync(Q)}},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),v=[],w=[];(function(b,m,p){for(var t,v,w,E=b.length;p<E;p+=m)t=b[p],v=b[p+1],w=b[p+2],t=t/16383*e,v=v/16383*e,w=w/16383*e,t+=f,v+=h,w+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,v,w)))})(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,v.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,t,F,D,H,N=b.length;for(e=0;e<N;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;H=h;t=k;F=f;var O=h,K=k,G=m.materials[0],B=v[O*3],da=v[O*3+1],O=v[O*3+2],J=v[K*3],R=v[K*3+1],K=v[K*3+2];F=new THREE.Vector3(v[F*3],v[F*3+1],v[F*3+2]);O=new THREE.Vector3(B,da,O);K=new THREE.Vector3(J,R,K);m.faces.push(new THREE.Face3(D,H,t,[F,O,K],null,G));m=w[f*2];f=w[f*
|
|
|
-2+1];t=w[h*2];F=w[h*2+1];D=w[k*2];H=w[k*2+1];k=c.faceVertexUvs[0];h=t;t=F;F=[];F.push(new THREE.UV(m,f));F.push(new THREE.UV(h,t));F.push(new THREE.UV(D,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),v=[],w=[];(function(b,m,p){for(var t,v,w,F=b.length;p<F;p+=m)t=b[p],v=b[p+1],w=b[p+2],t=t/16383*e,v=v/16383*e,w=w/16383*e,t+=f,v+=h,w+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,v,w)))})(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,v.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,t,E,D,G,N=b.length;for(e=0;e<N;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;G=h;t=k;E=f;var O=h,K=k,H=m.materials[0],B=v[O*3],da=v[O*3+1],O=v[O*3+2],J=v[K*3],R=v[K*3+1],K=v[K*3+2];E=new THREE.Vector3(v[E*3],v[E*3+1],v[E*3+2]);O=new THREE.Vector3(B,da,O);K=new THREE.Vector3(J,R,K);m.faces.push(new THREE.Face3(D,G,t,[E,O,K],null,H));m=w[f*2];f=w[f*
|
|
|
+2+1];t=w[h*2];E=w[h*2+1];D=w[k*2];G=w[k*2+1];k=c.faceVertexUvs[0];h=t;t=E;E=[];E.push(new THREE.UV(m,f));E.push(new THREE.UV(h,t));E.push(new THREE.UV(D,G));k.push(E)}})(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,t,v,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=t;c[k+2]=v;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,t,v,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=t+m*this.delta;c[k+
|
|
|
2]=v;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,t,v,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=t;c[k+2]=v+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 t=k+1,v=k+this.yd,w=k+this.zd,u=t+this.yd,x=t+this.zd,p=k+this.yd+this.zd,y=t+this.yd+this.zd,A=0,z=this.field[k],E=this.field[t],F=this.field[v],D=this.field[u],H=this.field[w],N=this.field[x],O=this.field[p],K=this.field[y];z<m&&(A|=1);E<m&&(A|=2);F<m&&(A|=8);D<m&&(A|=4);H<m&&(A|=16);N<m&&(A|=32);O<m&&(A|=128);K<m&&(A|=64);var G=THREE.edgeTable[A];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(t),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,z,E));G&2&&(this.compNorm(t),this.compNorm(u),this.VIntY(t*3,this.vlist,this.nlist,3,m,da,c,h,E,D));G&4&&(this.compNorm(v),this.compNorm(u),this.VIntX(v*3,this.vlist,this.nlist,6,m,b,J,h,F,D));G&8&&(this.compNorm(k),this.compNorm(v),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,z,F));G&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,B,H,N));G&32&&(this.compNorm(x),
|
|
|
-this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,m,da,c,B,N,K));G&64&&(this.compNorm(p),this.compNorm(y),this.VIntX(p*3,this.vlist,this.nlist,18,m,b,J,B,O,K));G&128&&(this.compNorm(w),this.compNorm(p),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,B,H,O));G&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,z,H));G&512&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*3,this.vlist,this.nlist,27,m,da,c,h,E,N));G&1024&&(this.compNorm(u),this.compNorm(y),this.VIntZ(u*
|
|
|
-3,this.vlist,this.nlist,30,m,da,J,h,D,K));G&2048&&(this.compNorm(v),this.compNorm(p),this.VIntZ(v*3,this.vlist,this.nlist,33,m,b,J,h,F,O));A<<=4;for(m=k=0;THREE.triTable[A+m]!=-1;)b=A+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 t=this.count*3;this.positionArray[t]=b[h];this.positionArray[t+1]=b[h+1];this.positionArray[t+2]=b[h+2];this.positionArray[t+3]=b[k];this.positionArray[t+
|
|
|
+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 t=k+1,v=k+this.yd,w=k+this.zd,u=t+this.yd,x=t+this.zd,p=k+this.yd+this.zd,y=t+this.yd+this.zd,A=0,z=this.field[k],F=this.field[t],E=this.field[v],D=this.field[u],G=this.field[w],N=this.field[x],O=this.field[p],K=this.field[y];z<m&&(A|=1);F<m&&(A|=2);E<m&&(A|=8);D<m&&(A|=4);G<m&&(A|=16);N<m&&(A|=32);O<m&&(A|=128);K<m&&(A|=64);var H=THREE.edgeTable[A];if(H==0)return 0;var B=this.delta,
|
|
|
+da=b+B,J=c+B,B=h+B;H&1&&(this.compNorm(k),this.compNorm(t),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,z,F));H&2&&(this.compNorm(t),this.compNorm(u),this.VIntY(t*3,this.vlist,this.nlist,3,m,da,c,h,F,D));H&4&&(this.compNorm(v),this.compNorm(u),this.VIntX(v*3,this.vlist,this.nlist,6,m,b,J,h,E,D));H&8&&(this.compNorm(k),this.compNorm(v),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,z,E));H&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,B,G,N));H&32&&(this.compNorm(x),
|
|
|
+this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,m,da,c,B,N,K));H&64&&(this.compNorm(p),this.compNorm(y),this.VIntX(p*3,this.vlist,this.nlist,18,m,b,J,B,O,K));H&128&&(this.compNorm(w),this.compNorm(p),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,B,G,O));H&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,z,G));H&512&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*3,this.vlist,this.nlist,27,m,da,c,h,F,N));H&1024&&(this.compNorm(u),this.compNorm(y),this.VIntZ(u*
|
|
|
+3,this.vlist,this.nlist,30,m,da,J,h,D,K));H&2048&&(this.compNorm(v),this.compNorm(p),this.VIntZ(v*3,this.vlist,this.nlist,33,m,b,J,h,E,O));A<<=4;for(m=k=0;THREE.triTable[A+m]!=-1;)b=A+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 t=this.count*3;this.positionArray[t]=b[h];this.positionArray[t+1]=b[h+1];this.positionArray[t+2]=b[h+2];this.positionArray[t+3]=b[k];this.positionArray[t+
|
|
|
4]=b[k+1];this.positionArray[t+5]=b[k+2];this.positionArray[t+6]=b[m];this.positionArray[t+7]=b[m+1];this.positionArray[t+8]=b[m+2];this.normalArray[t]=c[h];this.normalArray[t+1]=c[h+1];this.normalArray[t+2]=c[h+2];this.normalArray[t+3]=c[k];this.normalArray[t+4]=c[k+1];this.normalArray[t+5]=c[k+2];this.normalArray[t+6]=c[m];this.normalArray[t+7]=c[m+1];this.normalArray[t+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),t=h*this.size,v=c*this.size,w=b*this.size,u=Math.floor(t-n);u<1&&(u=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var x=Math.floor(v-n);x<1&&(x=1);v=Math.floor(v+n);v>this.size-1&&(v=this.size-1);var p=Math.floor(w-n);p<1&&(p=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
|
|
|
-1);for(var y,A,z,E,F,D;u<t;u++){w=this.size2*u;A=u/this.size-h;F=A*A;for(A=x;A<v;A++){z=w+this.size*A;y=A/this.size-c;D=y*y;for(y=p;y<n;y++)E=y/this.size-b,E=k/(1.0E-6+E*E+D+F)-m,E>0&&(this.field[z+y]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,t,v=this.size,w=this.yd,u=this.zd,x=this.field,p=v*Math.sqrt(b/c);p>v&&(p=v);for(h=0;h<p;h++)if(k=h/v,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<v;k++){t=h+k*w;for(m=0;m<v;m++)x[u*m+t]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,t,v,w=this.size,u=this.yd,x=
|
|
|
+1);for(var y,A,z,F,E,D;u<t;u++){w=this.size2*u;A=u/this.size-h;E=A*A;for(A=x;A<v;A++){z=w+this.size*A;y=A/this.size-c;D=y*y;for(y=p;y<n;y++)F=y/this.size-b,F=k/(1.0E-6+F*F+D+E)-m,F>0&&(this.field[z+y]+=F)}}};this.addPlaneX=function(b,c){var h,k,m,n,t,v=this.size,w=this.yd,u=this.zd,x=this.field,p=v*Math.sqrt(b/c);p>v&&(p=v);for(h=0;h<p;h++)if(k=h/v,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<v;k++){t=h+k*w;for(m=0;m<v;m++)x[u*m+t]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,t,v,w=this.size,u=this.yd,x=
|
|
|
this.zd,p=this.field,y=w*Math.sqrt(b/c);y>w&&(y=w);for(k=0;k<y;k++)if(h=k/w,h*=h,n=b/(1.0E-4+h)-c,n>0){t=k*u;for(h=0;h<w;h++){v=t+h;for(m=0;m<w;m++)p[x*m+v]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,t,v;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){t=zd*m;for(k=0;k<size;k++){v=t+k*yd;for(h=0;h<size;h++)field[v+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,t,v,w,u,x=this.size-2;for(m=1;m<x;m++){u=this.size2*m;v=(m-this.halfsize)/this.halfsize;for(k=1;k<x;k++){w=u+this.size*k;t=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=w+h,this.polygonize(n,t,v,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,t,v,w,u,x,p;for(m=0;m<k.count;m++)x=m*3,w=x+1,p=x+2,n=k.positionArray[x],
|
|
|
t=k.positionArray[w],v=k.positionArray[p],u=new THREE.Vector3(n,t,v),n=k.normalArray[x],t=k.normalArray[w],v=k.normalArray[p],x=new THREE.Vector3(n,t,v),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,p=x+2,u=h[x],n=h[w],t=h[p],x=new THREE.Face3(x,w,p,[u,n,t]),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;
|
|
@@ -692,7 +693,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,t,v,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),p=new THREE.Camera(53,1,1,1E4);p.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 y=new THREE.Scene;y.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(t!==e.aspect||v!==e.near||w!==e.fov){t=e.aspect;v=e.near;w=e.fov;var E=e.projectionMatrix.clone(),F=125/30*0.5,D=F*v/125,H=v*Math.tan(w*Math.PI/360),N;m.n14=F;n.n14=-F;F=-H*t+D;N=H*t+D;E.n11=2*v/(N-F);E.n13=(N+F)/(N-F);h.projectionMatrix=E.clone();F=-H*t-D;N=H*t-D;E.n11=2*v/(N-F);E.n13=
|
|
|
-(N+F)/(N-F);k.projectionMatrix=E.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=v;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=v;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,y,p)}};
|
|
|
+var y=new THREE.Scene;y.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(t!==e.aspect||v!==e.near||w!==e.fov){t=e.aspect;v=e.near;w=e.fov;var F=e.projectionMatrix.clone(),E=125/30*0.5,D=E*v/125,G=v*Math.tan(w*Math.PI/360),N;m.n14=E;n.n14=-E;E=-G*t+D;N=G*t+D;F.n11=2*v/(N-E);F.n13=(N+E)/(N-E);h.projectionMatrix=F.clone();E=-G*t-D;N=G*t-D;F.n11=2*v/(N-E);F.n13=
|
|
|
+(N+E)/(N-E);k.projectionMatrix=F.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=v;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=v;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,y,p)}};
|
|
|
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)}};
|