|
@@ -12,7 +12,7 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
|
|
|
1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,d){this.set(a||0,c||0,b||0,d||1)};
|
|
|
THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
|
|
|
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
|
-THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(E,v,F,w){w=w.clone().subSelf(v);F=F.clone().subSelf(v);var N=E.clone().subSelf(v);E=w.dot(w);v=w.dot(F);w=w.dot(N);var L=F.dot(F);F=F.dot(N);N=1/(E*L-v*v);L=(L*w-v*F)*N;E=(E*F-v*w)*N;return L>0&&E>0&&L+E<1}var b,d,e,g,h,j,k,n,q,x,
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(F,v,E,w){w=w.clone().subSelf(v);E=E.clone().subSelf(v);var N=F.clone().subSelf(v);F=w.dot(w);v=w.dot(E);w=w.dot(N);var L=E.dot(E);E=E.dot(N);N=1/(F*L-v*v);L=(L*w-v*E)*N;F=(F*E-v*w)*N;return L>0&&F>0&&L+F<1}var b,d,e,g,h,j,k,n,q,x,
|
|
|
u,t=a.geometry,y=t.vertices,A=[];b=0;for(d=t.faces.length;b<d;b++){e=t.faces[b];x=this.origin.clone();u=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(y[e.a].position.clone());h=k.multiplyVector3(y[e.b].position.clone());j=k.multiplyVector3(y[e.c].position.clone());k=e instanceof THREE.Face4?k.multiplyVector3(y[e.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(e.normal.clone());q=u.dot(n);if(q<0){n=n.dot((new THREE.Vector3).sub(g,x))/q;x=x.addSelf(u.multiplyScalar(n));
|
|
|
if(e instanceof THREE.Face3){if(c(x,g,h,j)){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};A.push(e)}}else if(e instanceof THREE.Face4&&(c(x,g,h,k)||c(x,h,j,k))){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};A.push(e)}}}return A}};
|
|
|
THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,n,q,x){j=!1;c=k;b=n;d=q;e=x;a()};this.addPoint=function(k,n){if(j){j=!1;c=k;b=n;d=k;e=n}else{c=c<k?c:k;b=b<n?b:n;d=d>k?d:k;e=e>n?e:n}a()};
|
|
@@ -23,8 +23,8 @@ THREE.Matrix4=function(a,c,b,d,e,g,h,j,k,n,q,x,u,t,y,A){this.set(a||1,c||0,b||0,
|
|
|
THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,n,q,x,u,t,y,A){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=n;this.n33=q;this.n34=x;this.n41=u;this.n42=t;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
|
|
|
e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,g).normalize()}e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23*
|
|
|
d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();
|
|
|
-return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,n=a.n24,q=a.n31,x=a.n32,u=a.n33,t=a.n34,y=a.n41,A=a.n42,E=a.n43,v=a.n44,F=c.n11,w=c.n12,N=c.n13,L=c.n14,Z=c.n21,M=c.n22,
|
|
|
-f=c.n23,V=c.n24,T=c.n31,da=c.n32,fa=c.n33,I=c.n34;this.n11=b*F+d*Z+e*T;this.n12=b*w+d*M+e*da;this.n13=b*N+d*f+e*fa;this.n14=b*L+d*V+e*I+g;this.n21=h*F+j*Z+k*T;this.n22=h*w+j*M+k*da;this.n23=h*N+j*f+k*fa;this.n24=h*L+j*V+k*I+n;this.n31=q*F+x*Z+u*T;this.n32=q*w+x*M+u*da;this.n33=q*N+x*f+u*fa;this.n34=q*L+x*V+u*I+t;this.n41=y*F+A*Z+E*T;this.n42=y*w+A*M+E*da;this.n43=y*N+A*f+E*fa;this.n44=y*L+A*V+E*I+v;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;
|
|
|
+return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,n=a.n24,q=a.n31,x=a.n32,u=a.n33,t=a.n34,y=a.n41,A=a.n42,F=a.n43,v=a.n44,E=c.n11,w=c.n12,N=c.n13,L=c.n14,Z=c.n21,M=c.n22,
|
|
|
+f=c.n23,V=c.n24,T=c.n31,da=c.n32,fa=c.n33,I=c.n34;this.n11=b*E+d*Z+e*T;this.n12=b*w+d*M+e*da;this.n13=b*N+d*f+e*fa;this.n14=b*L+d*V+e*I+g;this.n21=h*E+j*Z+k*T;this.n22=h*w+j*M+k*da;this.n23=h*N+j*f+k*fa;this.n24=h*L+j*V+k*I+n;this.n31=q*E+x*Z+u*T;this.n32=q*w+x*M+u*da;this.n33=q*N+x*f+u*fa;this.n34=q*L+x*V+u*I+t;this.n41=y*E+A*Z+F*T;this.n42=y*w+A*M+F*da;this.n43=y*N+A*f+F*fa;this.n44=y*L+A*V+F*I+v;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;
|
|
|
b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
|
|
|
this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,n=this.n32,q=this.n33,x=this.n34,u=this.n41,t=this.n42,y=this.n43,A=this.n44;return d*h*n*u-b*j*n*u-d*g*q*u+c*j*q*u+b*g*x*u-c*h*x*u-d*h*k*t+b*j*k*t+d*e*q*t-a*j*q*t-b*e*x*t+a*h*x*t+d*g*k*y-c*j*k*y-d*e*n*y+a*j*n*y+c*e*x*y-a*g*x*y-b*g*k*A+c*h*k*A+b*e*n*A-a*h*n*A-c*e*q*A+a*g*q*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
|
|
|
this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
|
|
@@ -34,8 +34,8 @@ c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:functio
|
|
|
g+b,k*h-d*j,k*j+d*h,0,k*h+d*j,n*h+b,n*j-d*g,0,k*j-d*h,n*j+d*g,e*j*j+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,j=c*b;this.n11=e*g;this.n12=-e*d;this.n13=b;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-c*e;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var c=
|
|
|
a.x,b=a.y,d=a.z,e=a.w,g=c+c,h=b+b,j=d+d;a=c*g;var k=c*h;c*=j;var n=b*h;b*=j;d*=j;g*=e;h*=e;e*=j;this.n11=1-(n+d);this.n12=k-e;this.n13=c+h;this.n21=k+e;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+n);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
|
|
|
a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,e=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
|
|
|
-THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,n=a.n24,q=a.n31,x=a.n32,u=a.n33,t=a.n34,y=a.n41,A=a.n42,E=a.n43,v=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*t*A-n*u*A+n*x*E-j*t*E-k*x*v+j*u*v;c.n12=g*u*A-e*t*A-g*x*E+d*t*E+e*x*v-d*u*v;c.n13=e*n*A-g*k*A+g*j*E-d*n*E-e*j*v+d*k*v;c.n14=g*k*x-e*n*x-g*j*u+d*n*u+e*j*t-d*k*t;c.n21=n*u*y-k*t*y-n*q*E+h*t*E+k*q*v-h*u*v;c.n22=e*t*y-g*u*y+g*q*E-b*t*E-e*q*v+b*u*v;c.n23=g*k*y-e*n*y-g*h*E+b*n*E+e*h*v-b*k*v;
|
|
|
-c.n24=e*n*q-g*k*q+g*h*u-b*n*u-e*h*t+b*k*t;c.n31=j*t*y-n*x*y+n*q*A-h*t*A-j*q*v+h*x*v;c.n32=g*x*y-d*t*y-g*q*A+b*t*A+d*q*v-b*x*v;c.n33=e*n*y-g*j*y+g*h*A-b*n*A-d*h*v+b*j*v;c.n34=g*j*q-d*n*q-g*h*x+b*n*x+d*h*t-b*j*t;c.n41=k*x*y-j*u*y-k*q*A+h*u*A+j*q*E-h*x*E;c.n42=d*u*y-e*x*y+e*q*A-b*u*A-d*q*E+b*x*E;c.n43=e*j*y-d*k*y-e*h*A+b*k*A+d*h*E-b*j*E;c.n44=d*k*q-e*j*q+e*h*x-b*k*x-d*h*u+b*j*u;c.multiplyScalar(1/a.determinant());return c};
|
|
|
+THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,n=a.n24,q=a.n31,x=a.n32,u=a.n33,t=a.n34,y=a.n41,A=a.n42,F=a.n43,v=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*t*A-n*u*A+n*x*F-j*t*F-k*x*v+j*u*v;c.n12=g*u*A-e*t*A-g*x*F+d*t*F+e*x*v-d*u*v;c.n13=e*n*A-g*k*A+g*j*F-d*n*F-e*j*v+d*k*v;c.n14=g*k*x-e*n*x-g*j*u+d*n*u+e*j*t-d*k*t;c.n21=n*u*y-k*t*y-n*q*F+h*t*F+k*q*v-h*u*v;c.n22=e*t*y-g*u*y+g*q*F-b*t*F-e*q*v+b*u*v;c.n23=g*k*y-e*n*y-g*h*F+b*n*F+e*h*v-b*k*v;
|
|
|
+c.n24=e*n*q-g*k*q+g*h*u-b*n*u-e*h*t+b*k*t;c.n31=j*t*y-n*x*y+n*q*A-h*t*A-j*q*v+h*x*v;c.n32=g*x*y-d*t*y-g*q*A+b*t*A+d*q*v-b*x*v;c.n33=e*n*y-g*j*y+g*h*A-b*n*A-d*h*v+b*j*v;c.n34=g*j*q-d*n*q-g*h*x+b*n*x+d*h*t-b*j*t;c.n41=k*x*y-j*u*y-k*q*A+h*u*A+j*q*F-h*x*F;c.n42=d*u*y-e*x*y+e*q*A-b*u*A-d*q*F+b*x*F;c.n43=e*j*y-d*k*y-e*h*A+b*k*A+d*h*F-b*j*F;c.n44=d*k*q-e*j*q+e*h*x-b*k*x-d*h*u+b*j*u;c.multiplyScalar(1/a.determinant());return c};
|
|
|
THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,q=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*n;b[7]=a*q;b[8]=a*x;return c};
|
|
|
THREE.Matrix4.makeFrustum=function(a,c,b,d,e,g){var h;h=new THREE.Matrix4;h.n11=2*e/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*e/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+e)/(g-e);h.n34=-2*g*e/(g-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var e;a=b*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*c,a*c,e,a,b,d)};
|
|
|
THREE.Matrix4.makeOrtho=function(a,c,b,d,e,g){var h,j,k,n;h=new THREE.Matrix4;j=c-a;k=b-d;n=g-e;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((b+d)/k);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((g+e)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
@@ -57,28 +57,28 @@ b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},co
|
|
|
b.position);k.sub(c.position,b.position);j.crossSelf(k)}j.isZero()||j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,
|
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<
|
|
|
c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(I,ca,xa,ea,va,ia,ga){g=I.vertices[ca].position;h=I.vertices[xa].position;j=I.vertices[ea].position;k=e[va];n=e[ia];q=e[ga];x=h.x-g.x;u=j.x-g.x;t=h.y-g.y;
|
|
|
-y=j.y-g.y;A=h.z-g.z;E=j.z-g.z;v=n.u-k.u;F=q.u-k.u;w=n.v-k.v;N=q.v-k.v;L=1/(v*N-F*w);f.set((N*x-w*u)*L,(N*t-w*y)*L,(N*A-w*E)*L);V.set((v*u-F*x)*L,(v*y-F*t)*L,(v*E-F*A)*L);Z[ca].addSelf(f);Z[xa].addSelf(f);Z[ea].addSelf(f);M[ca].addSelf(V);M[xa].addSelf(V);M[ea].addSelf(V)}var c,b,d,e,g,h,j,k,n,q,x,u,t,y,A,E,v,F,w,N,L,Z=[],M=[],f=new THREE.Vector3,V=new THREE.Vector3,T=new THREE.Vector3,da=new THREE.Vector3,fa=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){Z[c]=new THREE.Vector3;M[c]=new THREE.Vector3}c=
|
|
|
+y=j.y-g.y;A=h.z-g.z;F=j.z-g.z;v=n.u-k.u;E=q.u-k.u;w=n.v-k.v;N=q.v-k.v;L=1/(v*N-E*w);f.set((N*x-w*u)*L,(N*t-w*y)*L,(N*A-w*F)*L);V.set((v*u-E*x)*L,(v*y-E*t)*L,(v*F-E*A)*L);Z[ca].addSelf(f);Z[xa].addSelf(f);Z[ea].addSelf(f);M[ca].addSelf(V);M[xa].addSelf(V);M[ea].addSelf(V)}var c,b,d,e,g,h,j,k,n,q,x,u,t,y,A,F,v,E,w,N,L,Z=[],M=[],f=new THREE.Vector3,V=new THREE.Vector3,T=new THREE.Vector3,da=new THREE.Vector3,fa=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){Z[c]=new THREE.Vector3;M[c]=new THREE.Vector3}c=
|
|
|
0;for(b=this.faces.length;c<b;c++){d=this.faces[c];e=this.uvs[c];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
|
|
|
this.vertices[d.d].normal.copy(d.vertexNormals[3])}}c=0;for(b=this.vertices.length;c<b;c++){fa.copy(this.vertices[c].normal);d=Z[c];T.copy(d);T.subSelf(fa.multiplyScalar(fa.dot(d))).normalize();da.cross(this.vertices[c].normal,d);d=da.dot(M[c]);d=d<0?-1:1;this.vertices[c].tangent.set(T.x,T.y,T.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
|
z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
|
this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.Spline=function(){function a(u,t,y,A,E,v,F){u=(y-u)*0.5;A=(A-t)*0.5;return(2*(t-y)+u+A)*F+(-3*(t-y)-2*u-A)*v+u*E+t}var c=[],b={x:0,y:0,z:0},d,e,g,h,j,k,n,q,x;this.get2DPoint=function(u,t){d=(u.length-1)*t;e=Math.floor(d);g=d-e;c[0]=e==0?e:e-1;c[1]=e;c[2]=e>u.length-2?e:e+1;c[3]=e>u.length-3?e:e+2;k=u[c[0]];n=u[c[1]];q=u[c[2]];x=u[c[3]];h=g*g;j=g*h;b.x=a(k.x,n.x,q.x,x.x,g,h,j);b.y=a(k.y,n.y,q.y,x.y,g,h,j);b.z=a(k.z,n.z,q.z,x.z,g,h,j);return b}};
|
|
|
+THREE.Spline=function(){function a(u,t,y,A,F,v,E){u=(y-u)*0.5;A=(A-t)*0.5;return(2*(t-y)+u+A)*E+(-3*(t-y)-2*u-A)*v+u*F+t}var c=[],b={x:0,y:0,z:0},d,e,g,h,j,k,n,q,x;this.getPoint=function(u,t){d=(u.length-1)*t;e=Math.floor(d);g=d-e;c[0]=e==0?e:e-1;c[1]=e;c[2]=e>u.length-2?e:e+1;c[3]=e>u.length-3?e:e+2;k=u[c[0]];n=u[c[1]];q=u[c[2]];x=u[c[3]];h=g*g;j=g*h;b.x=a(k.x,n.x,q.x,x.x,g,h,j);b.y=a(k.y,n.y,q.y,x.y,g,h,j);b.z=a(k.z,n.z,q.z,x.z,g,h,j);return b}};
|
|
|
THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(e){for(var g=0;g<a.length;g++)a[g].update(e)};b.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};b.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};b.add=function(e){c[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");c[e.name]=e;if(e.initialized!==!0){for(var g=0;g<e.hierarchy.length;g++){for(var h=0;h<e.hierarchy[g].keys.length;h++){if(e.hierarchy[g].keys[h].time<
|
|
|
0)e.hierarchy[g].keys[h].time=0;if(e.hierarchy[g].keys[h].rot!==undefined&&!(e.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var j=e.hierarchy[g].keys[h].rot;e.hierarchy[g].keys[h].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}for(h=1;h<e.hierarchy[g].keys.length;h++)if(e.hierarchy[g].keys[h].time===e.hierarchy[g].keys[h-1].time){e.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<e.hierarchy[g].keys.length;h++)e.hierarchy[g].keys[h].index=h}h=parseInt(e.length*e.fps,10);e.JIT={};e.JIT.hierarchy=
|
|
|
[];for(g=0;g<e.hierarchy.length;g++)e.JIT.hierarchy.push(Array(h));e.initialized=!0}};b.get=function(e){if(typeof e==="string")if(c[e])return c[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};b.parse=function(e){var g=[];if(e instanceof THREE.SkinnedMesh)for(var h=0;h<e.bones.length;h++)g.push(e.bones[h]);else d(e,g);return g};var d=function(e,g){g.push(e);for(var h=0;h<e.children.length;h++)d(e.children[h],g)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
|
|
|
-2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0};
|
|
|
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;for(var b=0;b<this.hierarchy.length;b++){this.hierarchy[b].useQuaternion=!0;this.hierarchy[b].matrixAutoUpdate=!0;if(this.hierarchy[b].animationCache===undefined){this.hierarchy[b].animationCache={};this.hierarchy[b].animationCache.prevKey={pos:0,rot:0,scl:0};this.hierarchy[b].animationCache.nextKey={pos:0,rot:0,scl:0};this.hierarchy[b].animationCache.originalMatrix=
|
|
|
-this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix:this.hierarchy[b].matrix}var d=this.hierarchy[b].animationCache.prevKey,e=this.hierarchy[b].animationCache.nextKey;d.pos=this.data.hierarchy[b].keys[0];d.rot=this.data.hierarchy[b].keys[0];d.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
-THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
+2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[]};
|
|
|
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,d=this.hierarchy.length,e;for(b=0;b<d;b++){e=this.hierarchy[b];e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:e.matrix}var g=e.animationCache.prevKey;
|
|
|
+e=e.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
|
|
|
THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,e,g,h,j,k,n,q=this.data.JIT.hierarchy,x,u;this.currentTime+=a;u=this.currentTime;x=this.currentTime%=this.data.length;n=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,y=this.hierarchy.length;t<y;t++){a=this.hierarchy[t];k=a.animationCache;if(this.JITCompile&&q[t][n]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=q[t][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
|
|
|
-!1}else{a.matrix=q[t][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var A=0;A<3;A++){b=c[A];h=k.prevKey[b];j=k.nextKey[b];if(j.time<=u){if(x<=u)if(this.loop){h=this.data.hierarchy[t].keys[0];for(j=this.getNextKeyWith(b,t,1);j.time<x;){h=j;j=this.getNextKeyWith(b,t,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,t,j.index+1)}while(j.time<
|
|
|
-x)}k.prevKey[b]=h;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-h.time)/(j.time-h.time);e=h[b];g=j[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+t);d=d<0?0:1}if(b==="pos")if(this.interpolationType===THREE.AnimationHandler.LINEAR){b=a.position;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else{var E=[];E[0]=this.getPrevKeyWith(b,t,h.index-1)[b];E[1]=e;E[2]=g;E[3]=this.getNextKeyWith(b,t,j.index+1)[b];
|
|
|
-d=d*0.33+0.33;d=this.interpolateCatmullRom(E,d);a.position.x=d[0];a.position.y=d[1];a.position.z=d[2]}else if(b==="rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}}}}if(this.JITCompile&&q[0][n]===undefined){this.hierarchy[0].update(undefined,!0);for(t=0;t<this.hierarchy.length;t++)q[t][n]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
|
|
|
+!1}else{a.matrix=q[t][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var A=0;A<3;A++){b=c[A];h=k.prevKey[b];j=k.nextKey[b];if(j.time<=u){if(x<u)if(this.loop){h=this.data.hierarchy[t].keys[0];for(j=this.getNextKeyWith(b,t,1);j.time<x;){h=j;j=this.getNextKeyWith(b,t,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,t,j.index+1)}while(j.time<
|
|
|
+x)}k.prevKey[b]=h;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-h.time)/(j.time-h.time);e=h[b];g=j[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+t);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else{this.points[0]=this.getPrevKeyWith("pos",t,h.index-1).pos;this.points[1]=e;this.points[2]=g;this.points[3]=
|
|
|
+this.getNextKeyWith("pos",t,j.index+1).pos;d=d*0.33+0.33;d=this.interpolateCatmullRom(this.points,d);b.x=d[0];b.y=d[1];b.z=d[2]}}else if(b==="rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}}}}if(this.JITCompile&&q[0][n]===undefined){this.hierarchy[0].update(undefined,!0);for(t=0;t<this.hierarchy.length;t++)q[t][n]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
|
|
|
THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,g,h,j,k,n;e=(a.length-1)*c;g=Math.floor(e);e-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];k=a[b[2]];n=a[b[3]];b=e*e;h=e*b;d[0]=this.interpolate(g[0],j[0],k[0],n[0],e,b,h);d[1]=this.interpolate(g[1],j[1],k[1],n[1],e,b,h);d[2]=this.interpolate(g[2],j[2],k[2],n[2],e,b,h);return d};
|
|
|
-THREE.Animation.prototype.interpolate=function(a,c,b,d,e,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b%=d.length;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
|
|
|
-THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b=b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};THREE.Camera=function(a,c,b,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};
|
|
|
-THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
+THREE.Animation.prototype.interpolate=function(a,c,b,d,e,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
|
|
|
+THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
|
|
|
+THREE.Camera=function(a,c,b,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
+THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
|
|
|
!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};
|
|
|
THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
|
|
@@ -140,8 +140,8 @@ THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updat
|
|
|
THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
|
|
|
THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
|
|
|
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
|
|
|
-THREE.Projector=function(){function a(M,f){return f.z-M.z}function c(M,f){var V=0,T=1,da=M.z+M.w,fa=f.z+f.w,I=-M.z+M.w,ca=-f.z+f.w;if(da>=0&&fa>=0&&I>=0&&ca>=0)return!0;else if(da<0&&fa<0||I<0&&ca<0)return!1;else{if(da<0)V=Math.max(V,da/(da-fa));else fa<0&&(T=Math.min(T,da/(da-fa)));if(I<0)V=Math.max(V,I/(I-ca));else ca<0&&(T=Math.min(T,I/(I-ca)));if(T<V)return!1;else{M.lerpSelf(f,V);f.lerpSelf(M,1-T);return!0}}}var b,d,e=[],g,h,j,k=[],n,q,x=[],u,t,y=[],A=new THREE.Vector4,E=new THREE.Vector4,v=new THREE.Matrix4,
|
|
|
-F=new THREE.Matrix4,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,L=new THREE.Vector4,Z;this.projectObjects=function(M,f,V){f=[];var T,da,fa;d=0;da=M.objects;M=0;for(T=da.length;M<T;M++){fa=da[M];var I;if(!(I=!fa.visible))if(I=fa instanceof THREE.Mesh){a:{I=void 0;for(var ca=fa.matrixWorld,xa=-fa.geometry.boundingSphere.radius*Math.max(fa.scale.x,Math.max(fa.scale.y,fa.scale.z)),ea=0;ea<6;ea++){I=w[ea].x*ca.n14+
|
|
|
+THREE.Projector=function(){function a(M,f){return f.z-M.z}function c(M,f){var V=0,T=1,da=M.z+M.w,fa=f.z+f.w,I=-M.z+M.w,ca=-f.z+f.w;if(da>=0&&fa>=0&&I>=0&&ca>=0)return!0;else if(da<0&&fa<0||I<0&&ca<0)return!1;else{if(da<0)V=Math.max(V,da/(da-fa));else fa<0&&(T=Math.min(T,da/(da-fa)));if(I<0)V=Math.max(V,I/(I-ca));else ca<0&&(T=Math.min(T,I/(I-ca)));if(T<V)return!1;else{M.lerpSelf(f,V);f.lerpSelf(M,1-T);return!0}}}var b,d,e=[],g,h,j,k=[],n,q,x=[],u,t,y=[],A=new THREE.Vector4,F=new THREE.Vector4,v=new THREE.Matrix4,
|
|
|
+E=new THREE.Matrix4,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,L=new THREE.Vector4,Z;this.projectObjects=function(M,f,V){f=[];var T,da,fa;d=0;da=M.objects;M=0;for(T=da.length;M<T;M++){fa=da[M];var I;if(!(I=!fa.visible))if(I=fa instanceof THREE.Mesh){a:{I=void 0;for(var ca=fa.matrixWorld,xa=-fa.geometry.boundingSphere.radius*Math.max(fa.scale.x,Math.max(fa.scale.y,fa.scale.z)),ea=0;ea<6;ea++){I=w[ea].x*ca.n14+
|
|
|
w[ea].y*ca.n24+w[ea].z*ca.n34+w[ea].w;if(I<=xa){I=!1;break a}}I=!0}I=!I}if(!I){b=e[d]=e[d]||new THREE.RenderableObject;A.copy(fa.position);v.multiplyVector3(A);b.object=fa;b.z=A.z;f.push(b);d++}}V&&f.sort(a);return f};this.projectScene=function(M,f,V){var T=[],da=f.near,fa=f.far,I,ca,xa,ea,va,ia,ga,ta,ya,ha,aa,ma,na,R,ja,qa;j=q=t=0;f.matrixAutoUpdate&&f.update();v.multiply(f.projectionMatrix,f.matrixWorldInverse);w[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);w[1].set(v.n41+v.n11,v.n42+
|
|
|
v.n12,v.n43+v.n13,v.n44+v.n14);w[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);w[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);w[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);w[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(I=0;I<6;I++){ia=w[I];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}M.update(undefined,!1,f);ia=this.projectObjects(M,f,!0);M=0;for(I=ia.length;M<I;M++){ga=ia[M].object;if(ga.visible){ta=ga.matrixWorld;aa=ga.matrixRotationWorld;
|
|
|
ya=ga.materials;ha=ga.overdraw;if(ga instanceof THREE.Mesh){ma=ga.geometry;na=ma.vertices;ca=0;for(xa=na.length;ca<xa;ca++){R=na[ca];R.positionWorld.copy(R.position);ta.multiplyVector3(R.positionWorld);ea=R.positionScreen;ea.copy(R.positionWorld);v.multiplyVector4(ea);ea.x/=ea.w;ea.y/=ea.w;R.__visible=ea.z>da&&ea.z<fa}ma=ma.faces;ca=0;for(xa=ma.length;ca<xa;ca++){R=ma[ca];if(R instanceof THREE.Face3){ea=na[R.a];va=na[R.b];ja=na[R.c];if(ea.__visible&&va.__visible&&ja.__visible&&(ga.doubleSided||ga.flipSided!=
|
|
@@ -150,43 +150,43 @@ g.centroidWorld.copy(R.centroid);ta.multiplyVector3(g.centroidWorld);g.centroidS
|
|
|
j++}}else if(R instanceof THREE.Face4){ea=na[R.a];va=na[R.b];ja=na[R.c];qa=na[R.d];if(ea.__visible&&va.__visible&&ja.__visible&&qa.__visible&&(ga.doubleSided||ga.flipSided!=((qa.positionScreen.x-ea.positionScreen.x)*(va.positionScreen.y-ea.positionScreen.y)-(qa.positionScreen.y-ea.positionScreen.y)*(va.positionScreen.x-ea.positionScreen.x)<0||(va.positionScreen.x-ja.positionScreen.x)*(qa.positionScreen.y-ja.positionScreen.y)-(va.positionScreen.y-ja.positionScreen.y)*(qa.positionScreen.x-ja.positionScreen.x)<
|
|
|
0))){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ea.positionWorld);g.v2.positionWorld.copy(va.positionWorld);g.v3.positionWorld.copy(qa.positionWorld);g.v1.positionScreen.copy(ea.positionScreen);g.v2.positionScreen.copy(va.positionScreen);g.v3.positionScreen.copy(qa.positionScreen);g.normalWorld.copy(R.normal);aa.multiplyVector3(g.normalWorld);g.centroidWorld.copy(R.centroid);ta.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);
|
|
|
g.z=g.centroidScreen.z;g.meshMaterials=ya;g.faceMaterials=R.materials;g.overdraw=ha;if(ga.geometry.uvs[ca]){g.uvs[0]=ga.geometry.uvs[ca][0];g.uvs[1]=ga.geometry.uvs[ca][1];g.uvs[2]=ga.geometry.uvs[ca][3]}T.push(g);j++;h=k[j]=k[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(va.positionWorld);h.v2.positionWorld.copy(ja.positionWorld);h.v3.positionWorld.copy(qa.positionWorld);h.v1.positionScreen.copy(va.positionScreen);h.v2.positionScreen.copy(ja.positionScreen);h.v3.positionScreen.copy(qa.positionScreen);
|
|
|
-h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=ya;h.faceMaterials=R.materials;h.overdraw=ha;if(ga.geometry.uvs[ca]){h.uvs[0]=ga.geometry.uvs[ca][1];h.uvs[1]=ga.geometry.uvs[ca][2];h.uvs[2]=ga.geometry.uvs[ca][3]}T.push(h);j++}}}}else if(ga instanceof THREE.Line){F.multiply(v,ta);na=ga.geometry.vertices;R=na[0];R.positionScreen.copy(R.position);F.multiplyVector4(R.positionScreen);ca=1;for(xa=na.length;ca<
|
|
|
-xa;ca++){ea=na[ca];ea.positionScreen.copy(ea.position);F.multiplyVector4(ea.positionScreen);va=na[ca-1];N.copy(ea.positionScreen);L.copy(va.positionScreen);if(c(N,L)){N.multiplyScalar(1/N.w);L.multiplyScalar(1/L.w);n=x[q]=x[q]||new THREE.RenderableLine;n.v1.positionScreen.copy(N);n.v2.positionScreen.copy(L);n.z=Math.max(N.z,L.z);n.materials=ga.materials;T.push(n);q++}}}else if(ga instanceof THREE.Particle){E.set(ga.position.x,ga.position.y,ga.position.z,1);v.multiplyVector4(E);E.z/=E.w;if(E.z>0&&
|
|
|
-E.z<1){u=y[t]=y[t]||new THREE.RenderableParticle;u.x=E.x/E.w;u.y=E.y/E.w;u.z=E.z;u.rotation=ga.rotation.z;u.scale.x=ga.scale.x*Math.abs(u.x-(E.x+f.projectionMatrix.n11)/(E.w+f.projectionMatrix.n14));u.scale.y=ga.scale.y*Math.abs(u.y-(E.y+f.projectionMatrix.n22)/(E.w+f.projectionMatrix.n24));u.materials=ga.materials;T.push(u);t++}}}}V&&T.sort(a);return T};this.unprojectVector=function(M,f){var V=f.matrixWorld.clone();V.multiplySelf(THREE.Matrix4.makeInvert(f.projectionMatrix));V.multiplyVector3(M);
|
|
|
+h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=ya;h.faceMaterials=R.materials;h.overdraw=ha;if(ga.geometry.uvs[ca]){h.uvs[0]=ga.geometry.uvs[ca][1];h.uvs[1]=ga.geometry.uvs[ca][2];h.uvs[2]=ga.geometry.uvs[ca][3]}T.push(h);j++}}}}else if(ga instanceof THREE.Line){E.multiply(v,ta);na=ga.geometry.vertices;R=na[0];R.positionScreen.copy(R.position);E.multiplyVector4(R.positionScreen);ca=1;for(xa=na.length;ca<
|
|
|
+xa;ca++){ea=na[ca];ea.positionScreen.copy(ea.position);E.multiplyVector4(ea.positionScreen);va=na[ca-1];N.copy(ea.positionScreen);L.copy(va.positionScreen);if(c(N,L)){N.multiplyScalar(1/N.w);L.multiplyScalar(1/L.w);n=x[q]=x[q]||new THREE.RenderableLine;n.v1.positionScreen.copy(N);n.v2.positionScreen.copy(L);n.z=Math.max(N.z,L.z);n.materials=ga.materials;T.push(n);q++}}}else if(ga instanceof THREE.Particle){F.set(ga.position.x,ga.position.y,ga.position.z,1);v.multiplyVector4(F);F.z/=F.w;if(F.z>0&&
|
|
|
+F.z<1){u=y[t]=y[t]||new THREE.RenderableParticle;u.x=F.x/F.w;u.y=F.y/F.w;u.z=F.z;u.rotation=ga.rotation.z;u.scale.x=ga.scale.x*Math.abs(u.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14));u.scale.y=ga.scale.y*Math.abs(u.y-(F.y+f.projectionMatrix.n22)/(F.w+f.projectionMatrix.n24));u.materials=ga.materials;T.push(u);t++}}}}V&&T.sort(a);return T};this.unprojectVector=function(M,f){var V=f.matrixWorld.clone();V.multiplySelf(THREE.Matrix4.makeInvert(f.projectionMatrix));V.multiplyVector3(M);
|
|
|
return M}};
|
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,n,q,x,u,t,y,A;a=c.projectScene(h,j);k=0;for(n=a.length;k<n;k++){u=a[k];if(u instanceof THREE.RenderableParticle){y=u.x*e+e;A=u.y*g+g;q=0;for(x=u.material.length;q<x;q++){t=u.material[q];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=y+"px";t.style.top=A+"px"}}}}}};
|
|
|
-THREE.CanvasRenderer=function(){function a(ka){if(u!=ka)n.globalAlpha=u=ka}function c(ka){if(t!=ka){switch(ka){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}t=ka}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,j,k,n=e.getContext("2d"),q=new THREE.Color(0),x=0,u=1,t=0,y=null,A=null,E=1,v,F,w,N,L,Z,M,f,V,T=new THREE.Color,
|
|
|
+THREE.CanvasRenderer=function(){function a(ka){if(u!=ka)n.globalAlpha=u=ka}function c(ka){if(t!=ka){switch(ka){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}t=ka}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,j,k,n=e.getContext("2d"),q=new THREE.Color(0),x=0,u=1,t=0,y=null,A=null,F=1,v,E,w,N,L,Z,M,f,V,T=new THREE.Color,
|
|
|
da=new THREE.Color,fa=new THREE.Color,I=new THREE.Color,ca=new THREE.Color,xa,ea,va,ia,ga,ta,ya,ha,aa,ma=new THREE.Rectangle,na=new THREE.Rectangle,R=new THREE.Rectangle,ja=!1,qa=new THREE.Color,l=new THREE.Color,z=new THREE.Color,p=new THREE.Color,m=Math.PI*2,o=new THREE.Vector3,B,C,G,Q,H,O,la=16;B=document.createElement("canvas");B.width=B.height=2;C=B.getContext("2d");C.fillStyle="rgba(0,0,0,1)";C.fillRect(0,0,2,2);G=C.getImageData(0,0,2,2);Q=G.data;H=document.createElement("canvas");H.width=H.height=
|
|
|
-la;O=H.getContext("2d");O.translate(-la/2,-la/2);O.scale(la,la);la--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ka,ra){g=ka;h=ra;j=g/2;k=h/2;e.width=g;e.height=h;ma.set(-j,-k,j,k);u=1;t=0;A=y=null;E=1};this.setClearColor=function(ka,ra){q=ka;x=ra};this.setClearColorHex=function(ka,ra){q.setHex(ka);x=ra};this.clear=function(){n.setTransform(1,0,0,-1,j,k);if(!na.isEmpty()){na.inflate(1);na.minSelf(ma);if(q.hex==0&&x==0)n.clearRect(na.getX(),na.getY(),
|
|
|
+la;O=H.getContext("2d");O.translate(-la/2,-la/2);O.scale(la,la);la--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ka,ra){g=ka;h=ra;j=g/2;k=h/2;e.width=g;e.height=h;ma.set(-j,-k,j,k);u=1;t=0;A=y=null;F=1};this.setClearColor=function(ka,ra){q=ka;x=ra};this.setClearColorHex=function(ka,ra){q.setHex(ka);x=ra};this.clear=function(){n.setTransform(1,0,0,-1,j,k);if(!na.isEmpty()){na.inflate(1);na.minSelf(ma);if(q.hex==0&&x==0)n.clearRect(na.getX(),na.getY(),
|
|
|
na.getWidth(),na.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+x+")";n.fillRect(na.getX(),na.getY(),na.getWidth(),na.getHeight())}na.empty()}};this.render=function(ka,ra){function sa(J){var Y,U,K,S=J.lights;l.setRGB(0,0,0);z.setRGB(0,0,0);p.setRGB(0,0,0);J=0;for(Y=S.length;J<Y;J++){U=S[J];K=U.color;if(U instanceof THREE.AmbientLight){l.r+=K.r;l.g+=K.g;l.b+=K.b}else if(U instanceof THREE.DirectionalLight){z.r+=
|
|
|
K.r;z.g+=K.g;z.b+=K.b}else if(U instanceof THREE.PointLight){p.r+=K.r;p.g+=K.g;p.b+=K.b}}}function oa(J,Y,U,K){var S,ua,wa,Ia,za=J.lights;J=0;for(S=za.length;J<S;J++){ua=za[J];wa=ua.color;Ia=ua.intensity;if(ua instanceof THREE.DirectionalLight){ua=U.dot(ua.position)*Ia;if(ua>0){K.r+=wa.r*ua;K.g+=wa.g*ua;K.b+=wa.b*ua}}else if(ua instanceof THREE.PointLight){o.sub(ua.position,Y);o.normalize();ua=U.dot(o)*Ia;if(ua>0){K.r+=wa.r*ua;K.g+=wa.g*ua;K.b+=wa.b*ua}}}}function pa(J,Y,U){if(U.opacity!=0){a(U.opacity);
|
|
|
c(U.blending);var K,S,ua,wa,Ia,za;if(U instanceof THREE.ParticleBasicMaterial){if(U.map){wa=U.map.image;Ia=wa.width>>1;za=wa.height>>1;S=Y.scale.x*j;ua=Y.scale.y*k;U=S*Ia;K=ua*za;R.set(J.x-U,J.y-K,J.x+U,J.y+K);if(ma.instersects(R)){n.save();n.translate(J.x,J.y);n.rotate(-Y.rotation);n.scale(S,-ua);n.translate(-Ia,-za);n.drawImage(wa,0,0);n.restore()}}}else if(U instanceof THREE.ParticleCircleMaterial){if(ja){qa.r=l.r+z.r+p.r;qa.g=l.g+z.g+p.g;qa.b=l.b+z.b+p.b;T.r=U.color.r*qa.r;T.g=U.color.g*qa.g;
|
|
|
T.b=U.color.b*qa.b;T.updateStyleString()}else T.__styleString=U.color.__styleString;U=Y.scale.x*j;K=Y.scale.y*k;R.set(J.x-U,J.y-K,J.x+U,J.y+K);if(ma.instersects(R)){S=T.__styleString;if(A!=S)n.fillStyle=A=S;n.save();n.translate(J.x,J.y);n.rotate(-Y.rotation);n.scale(U,K);n.beginPath();n.arc(0,0,1,0,m,!0);n.closePath();n.fill();n.restore()}}}}function Ja(J,Y,U,K){if(K.opacity!=0){a(K.opacity);c(K.blending);n.beginPath();n.moveTo(J.positionScreen.x,J.positionScreen.y);n.lineTo(Y.positionScreen.x,Y.positionScreen.y);
|
|
|
-n.closePath();if(K instanceof THREE.LineBasicMaterial){T.__styleString=K.color.__styleString;J=K.linewidth;if(E!=J)n.lineWidth=E=J;J=T.__styleString;if(y!=J)n.strokeStyle=y=J;n.stroke();R.inflate(K.linewidth*2)}}}function P(J,Y,U,K,S,ua){if(S.opacity!=0){a(S.opacity);c(S.blending);N=J.positionScreen.x;L=J.positionScreen.y;Z=Y.positionScreen.x;M=Y.positionScreen.y;f=U.positionScreen.x;V=U.positionScreen.y;n.beginPath();n.moveTo(N,L);n.lineTo(Z,M);n.lineTo(f,V);n.lineTo(N,L);n.closePath();if(S instanceof
|
|
|
+n.closePath();if(K instanceof THREE.LineBasicMaterial){T.__styleString=K.color.__styleString;J=K.linewidth;if(F!=J)n.lineWidth=F=J;J=T.__styleString;if(y!=J)n.strokeStyle=y=J;n.stroke();R.inflate(K.linewidth*2)}}}function P(J,Y,U,K,S,ua){if(S.opacity!=0){a(S.opacity);c(S.blending);N=J.positionScreen.x;L=J.positionScreen.y;Z=Y.positionScreen.x;M=Y.positionScreen.y;f=U.positionScreen.x;V=U.positionScreen.y;n.beginPath();n.moveTo(N,L);n.lineTo(Z,M);n.lineTo(f,V);n.lineTo(N,L);n.closePath();if(S instanceof
|
|
|
THREE.MeshBasicMaterial)if(S.map)S.map.mapping instanceof THREE.UVMapping&&Fa(N,L,Z,M,f,V,S.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);else if(S.envMap){if(S.envMap.mapping instanceof THREE.SphericalReflectionMapping){J=ra.matrixWorldInverse;o.copy(K.vertexNormalsWorld[0]);ia=(o.x*J.n11+o.y*J.n12+o.z*J.n13)*0.5+0.5;ga=-(o.x*J.n21+o.y*J.n22+o.z*J.n23)*0.5+0.5;o.copy(K.vertexNormalsWorld[1]);ta=(o.x*J.n11+o.y*J.n12+o.z*J.n13)*0.5+0.5;ya=-(o.x*J.n21+o.y*J.n22+o.z*J.n23)*
|
|
|
0.5+0.5;o.copy(K.vertexNormalsWorld[2]);ha=(o.x*J.n11+o.y*J.n12+o.z*J.n13)*0.5+0.5;aa=-(o.x*J.n21+o.y*J.n22+o.z*J.n23)*0.5+0.5;Fa(N,L,Z,M,f,V,S.envMap.image,ia,ga,ta,ya,ha,aa)}}else S.wireframe?Ga(S.color.__styleString,S.wireframeLinewidth):Ea(S.color.__styleString);else if(S instanceof THREE.MeshLambertMaterial){if(S.map&&!S.wireframe){S.map.mapping instanceof THREE.UVMapping&&Fa(N,L,Z,M,f,V,S.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);c(THREE.SubtractiveBlending)}if(ja)if(!S.wireframe&&
|
|
|
S.shading==THREE.SmoothShading&&K.vertexNormalsWorld.length==3){da.r=fa.r=I.r=l.r;da.g=fa.g=I.g=l.g;da.b=fa.b=I.b=l.b;oa(ua,K.v1.positionWorld,K.vertexNormalsWorld[0],da);oa(ua,K.v2.positionWorld,K.vertexNormalsWorld[1],fa);oa(ua,K.v3.positionWorld,K.vertexNormalsWorld[2],I);ca.r=(fa.r+I.r)*0.5;ca.g=(fa.g+I.g)*0.5;ca.b=(fa.b+I.b)*0.5;va=W(da,fa,I,ca);Fa(N,L,Z,M,f,V,va,0,0,1,0,0,1)}else{qa.r=l.r;qa.g=l.g;qa.b=l.b;oa(ua,K.centroidWorld,K.normalWorld,qa);T.r=S.color.r*qa.r;T.g=S.color.g*qa.g;T.b=S.color.b*
|
|
|
qa.b;T.updateStyleString();S.wireframe?Ga(T.__styleString,S.wireframeLinewidth):Ea(T.__styleString)}else S.wireframe?Ga(S.color.__styleString,S.wireframeLinewidth):Ea(S.color.__styleString)}else if(S instanceof THREE.MeshDepthMaterial){xa=ra.near;ea=ra.far;da.r=da.g=da.b=1-X(J.positionScreen.z,xa,ea);fa.r=fa.g=fa.b=1-X(Y.positionScreen.z,xa,ea);I.r=I.g=I.b=1-X(U.positionScreen.z,xa,ea);ca.r=(fa.r+I.r)*0.5;ca.g=(fa.g+I.g)*0.5;ca.b=(fa.b+I.b)*0.5;va=W(da,fa,I,ca);Fa(N,L,Z,M,f,V,va,0,0,1,0,0,1)}else if(S instanceof
|
|
|
-THREE.MeshNormalMaterial){T.r=$(K.normalWorld.x);T.g=$(K.normalWorld.y);T.b=$(K.normalWorld.z);T.updateStyleString();S.wireframe?Ga(T.__styleString,S.wireframeLinewidth):Ea(T.__styleString)}}}function Ga(J,Y){if(y!=J)n.strokeStyle=y=J;if(E!=Y)n.lineWidth=E=Y;n.stroke();R.inflate(Y*2)}function Ea(J){if(A!=J)n.fillStyle=A=J;n.fill()}function Fa(J,Y,U,K,S,ua,wa,Ia,za,Pa,Ka,La,Ta){var Na,Qa;Na=wa.width-1;Qa=wa.height-1;Ia*=Na;za*=Qa;Pa*=Na;Ka*=Qa;La*=Na;Ta*=Qa;U-=J;K-=Y;S-=J;ua-=Y;Pa-=Ia;Ka-=za;La-=Ia;
|
|
|
+THREE.MeshNormalMaterial){T.r=$(K.normalWorld.x);T.g=$(K.normalWorld.y);T.b=$(K.normalWorld.z);T.updateStyleString();S.wireframe?Ga(T.__styleString,S.wireframeLinewidth):Ea(T.__styleString)}}}function Ga(J,Y){if(y!=J)n.strokeStyle=y=J;if(F!=Y)n.lineWidth=F=Y;n.stroke();R.inflate(Y*2)}function Ea(J){if(A!=J)n.fillStyle=A=J;n.fill()}function Fa(J,Y,U,K,S,ua,wa,Ia,za,Pa,Ka,La,Ta){var Na,Qa;Na=wa.width-1;Qa=wa.height-1;Ia*=Na;za*=Qa;Pa*=Na;Ka*=Qa;La*=Na;Ta*=Qa;U-=J;K-=Y;S-=J;ua-=Y;Pa-=Ia;Ka-=za;La-=Ia;
|
|
|
Ta-=za;Na=Pa*Ta-La*Ka;if(Na!=0){Qa=1/Na;Na=(Ta*U-Ka*S)*Qa;Ka=(Ta*K-Ka*ua)*Qa;U=(Pa*S-La*U)*Qa;K=(Pa*ua-La*K)*Qa;J=J-Na*Ia-U*za;Y=Y-Ka*Ia-K*za;n.save();n.transform(Na,Ka,U,K,J,Y);n.clip();n.drawImage(wa,0,0);n.restore()}}function W(J,Y,U,K){var S=~~(J.r*255),ua=~~(J.g*255);J=~~(J.b*255);var wa=~~(Y.r*255),Ia=~~(Y.g*255);Y=~~(Y.b*255);var za=~~(U.r*255),Pa=~~(U.g*255);U=~~(U.b*255);var Ka=~~(K.r*255),La=~~(K.g*255);K=~~(K.b*255);Q[0]=S<0?0:S>255?255:S;Q[1]=ua<0?0:ua>255?255:ua;Q[2]=J<0?0:J>255?255:
|
|
|
J;Q[4]=wa<0?0:wa>255?255:wa;Q[5]=Ia<0?0:Ia>255?255:Ia;Q[6]=Y<0?0:Y>255?255:Y;Q[8]=za<0?0:za>255?255:za;Q[9]=Pa<0?0:Pa>255?255:Pa;Q[10]=U<0?0:U>255?255:U;Q[12]=Ka<0?0:Ka>255?255:Ka;Q[13]=La<0?0:La>255?255:La;Q[14]=K<0?0:K>255?255:K;C.putImageData(G,0,0);O.drawImage(B,0,0);return H}function X(J,Y,U){J=(J-Y)/(U-Y);return J*J*(3-2*J)}function $(J){J=(J+1)*0.5;return J<0?0:J>1?1:J}function Aa(J,Y){var U=Y.x-J.x,K=Y.y-J.y,S=1/Math.sqrt(U*U+K*K);U*=S;K*=S;Y.x+=U;Y.y+=K;J.x-=U;J.y-=K}var Ha,Da,D,Ca,Ra,Ua,
|
|
|
-Ma,Ba;this.autoClear?this.clear():n.setTransform(1,0,0,-1,j,k);b=d.projectScene(ka,ra,this.sortElements);(ja=ka.lights.length>0)&&sa(ka);Ha=0;for(Da=b.length;Ha<Da;Ha++){D=b[Ha];R.empty();if(D instanceof THREE.RenderableParticle){v=D;v.x*=j;v.y*=k;Ca=0;for(Ra=D.materials.length;Ca<Ra;Ca++)pa(v,D,D.materials[Ca],ka)}else if(D instanceof THREE.RenderableLine){v=D.v1;F=D.v2;v.positionScreen.x*=j;v.positionScreen.y*=k;F.positionScreen.x*=j;F.positionScreen.y*=k;R.addPoint(v.positionScreen.x,v.positionScreen.y);
|
|
|
-R.addPoint(F.positionScreen.x,F.positionScreen.y);if(ma.instersects(R)){Ca=0;for(Ra=D.materials.length;Ca<Ra;)Ja(v,F,D,D.materials[Ca++],ka)}}else if(D instanceof THREE.RenderableFace3){v=D.v1;F=D.v2;w=D.v3;v.positionScreen.x*=j;v.positionScreen.y*=k;F.positionScreen.x*=j;F.positionScreen.y*=k;w.positionScreen.x*=j;w.positionScreen.y*=k;if(D.overdraw){Aa(v.positionScreen,F.positionScreen);Aa(F.positionScreen,w.positionScreen);Aa(w.positionScreen,v.positionScreen)}R.add3Points(v.positionScreen.x,v.positionScreen.y,
|
|
|
-F.positionScreen.x,F.positionScreen.y,w.positionScreen.x,w.positionScreen.y);if(ma.instersects(R)){Ca=0;for(Ra=D.meshMaterials.length;Ca<Ra;){Ba=D.meshMaterials[Ca++];if(Ba instanceof THREE.MeshFaceMaterial){Ua=0;for(Ma=D.faceMaterials.length;Ua<Ma;)(Ba=D.faceMaterials[Ua++])&&P(v,F,w,D,Ba,ka)}else P(v,F,w,D,Ba,ka)}}}na.addRectangle(R)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
+Ma,Ba;this.autoClear?this.clear():n.setTransform(1,0,0,-1,j,k);b=d.projectScene(ka,ra,this.sortElements);(ja=ka.lights.length>0)&&sa(ka);Ha=0;for(Da=b.length;Ha<Da;Ha++){D=b[Ha];R.empty();if(D instanceof THREE.RenderableParticle){v=D;v.x*=j;v.y*=k;Ca=0;for(Ra=D.materials.length;Ca<Ra;Ca++)pa(v,D,D.materials[Ca],ka)}else if(D instanceof THREE.RenderableLine){v=D.v1;E=D.v2;v.positionScreen.x*=j;v.positionScreen.y*=k;E.positionScreen.x*=j;E.positionScreen.y*=k;R.addPoint(v.positionScreen.x,v.positionScreen.y);
|
|
|
+R.addPoint(E.positionScreen.x,E.positionScreen.y);if(ma.instersects(R)){Ca=0;for(Ra=D.materials.length;Ca<Ra;)Ja(v,E,D,D.materials[Ca++],ka)}}else if(D instanceof THREE.RenderableFace3){v=D.v1;E=D.v2;w=D.v3;v.positionScreen.x*=j;v.positionScreen.y*=k;E.positionScreen.x*=j;E.positionScreen.y*=k;w.positionScreen.x*=j;w.positionScreen.y*=k;if(D.overdraw){Aa(v.positionScreen,E.positionScreen);Aa(E.positionScreen,w.positionScreen);Aa(w.positionScreen,v.positionScreen)}R.add3Points(v.positionScreen.x,v.positionScreen.y,
|
|
|
+E.positionScreen.x,E.positionScreen.y,w.positionScreen.x,w.positionScreen.y);if(ma.instersects(R)){Ca=0;for(Ra=D.meshMaterials.length;Ca<Ra;){Ba=D.meshMaterials[Ca++];if(Ba instanceof THREE.MeshFaceMaterial){Ua=0;for(Ma=D.faceMaterials.length;Ua<Ma;)(Ba=D.faceMaterials[Ua++])&&P(v,E,w,D,Ba,ka)}else P(v,E,w,D,Ba,ka)}}}na.addRectangle(R)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
THREE.SVGRenderer=function(){function a(ia,ga,ta){var ya,ha,aa,ma;ya=0;for(ha=ia.lights.length;ya<ha;ya++){aa=ia.lights[ya];if(aa instanceof THREE.DirectionalLight){ma=ga.normalWorld.dot(aa.position)*aa.intensity;if(ma>0){ta.r+=aa.color.r*ma;ta.g+=aa.color.g*ma;ta.b+=aa.color.b*ma}}else if(aa instanceof THREE.PointLight){V.sub(aa.position,ga.centroidWorld);V.normalize();ma=ga.normalWorld.dot(V)*aa.intensity;if(ma>0){ta.r+=aa.color.r*ma;ta.g+=aa.color.g*ma;ta.b+=aa.color.b*ma}}}}function c(ia,ga,ta,
|
|
|
-ya,ha,aa){I=d(ca++);I.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(ha instanceof THREE.MeshBasicMaterial)w.__styleString=ha.color.__styleString;else if(ha instanceof THREE.MeshLambertMaterial)if(F){N.r=L.r;N.g=L.g;N.b=L.b;a(aa,ya,N);w.r=ha.color.r*N.r;w.g=ha.color.g*N.g;w.b=ha.color.b*N.b;w.updateStyleString()}else w.__styleString=ha.color.__styleString;else if(ha instanceof
|
|
|
+ya,ha,aa){I=d(ca++);I.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(ha instanceof THREE.MeshBasicMaterial)w.__styleString=ha.color.__styleString;else if(ha instanceof THREE.MeshLambertMaterial)if(E){N.r=L.r;N.g=L.g;N.b=L.b;a(aa,ya,N);w.r=ha.color.r*N.r;w.g=ha.color.g*N.g;w.b=ha.color.b*N.b;w.updateStyleString()}else w.__styleString=ha.color.__styleString;else if(ha instanceof
|
|
|
THREE.MeshDepthMaterial){f=1-ha.__2near/(ha.__farPlusNear-ya.z*ha.__farMinusNear);w.setRGB(f,f,f)}else ha instanceof THREE.MeshNormalMaterial&&w.setRGB(e(ya.normalWorld.x),e(ya.normalWorld.y),e(ya.normalWorld.z));ha.wireframe?I.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+ha.wireframeLinewidth+"; stroke-opacity: "+ha.opacity+"; stroke-linecap: "+ha.wireframeLinecap+"; stroke-linejoin: "+ha.wireframeLinejoin):I.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+
|
|
|
-ha.opacity);j.appendChild(I)}function b(ia,ga,ta,ya,ha,aa,ma){I=d(ca++);I.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+" L "+ya.positionScreen.x+","+ya.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)w.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(F){N.r=L.r;N.g=L.g;N.b=L.b;a(ma,ha,N);w.r=aa.color.r*N.r;w.g=aa.color.g*N.g;
|
|
|
+ha.opacity);j.appendChild(I)}function b(ia,ga,ta,ya,ha,aa,ma){I=d(ca++);I.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+" L "+ya.positionScreen.x+","+ya.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)w.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(E){N.r=L.r;N.g=L.g;N.b=L.b;a(ma,ha,N);w.r=aa.color.r*N.r;w.g=aa.color.g*N.g;
|
|
|
w.b=aa.color.b*N.b;w.updateStyleString()}else w.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){f=1-aa.__2near/(aa.__farPlusNear-ha.z*aa.__farMinusNear);w.setRGB(f,f,f)}else aa instanceof THREE.MeshNormalMaterial&&w.setRGB(e(ha.normalWorld.x),e(ha.normalWorld.y),e(ha.normalWorld.z));aa.wireframe?I.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+
|
|
|
-"; stroke-linejoin: "+aa.wireframeLinejoin):I.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+aa.opacity);j.appendChild(I)}function d(ia){if(T[ia]==null){T[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");va==0&&T[ia].setAttribute("shape-rendering","crispEdges")}return T[ia]}function e(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,n,q,x,u,t,y,A,E=
|
|
|
-new THREE.Rectangle,v=new THREE.Rectangle,F=!1,w=new THREE.Color(16777215),N=new THREE.Color(16777215),L=new THREE.Color(0),Z=new THREE.Color(0),M=new THREE.Color(0),f,V=new THREE.Vector3,T=[],da=[],fa=[],I,ca,xa,ea,va=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":va=1;break;case "low":va=0}};this.setSize=function(ia,ga){k=ia;n=ga;q=k/2;x=n/2;j.setAttribute("viewBox",-q+" "+-x+" "+k+" "+n);j.setAttribute("width",
|
|
|
-k);j.setAttribute("height",n);E.set(-q,-x,q,x)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(ia,ga){var ta,ya,ha,aa,ma,na,R,ja;this.autoClear&&this.clear();g=h.projectScene(ia,ga,this.sortElements);ea=xa=ca=0;if(F=ia.lights.length>0){R=ia.lights;L.setRGB(0,0,0);Z.setRGB(0,0,0);M.setRGB(0,0,0);ta=0;for(ya=R.length;ta<ya;ta++){ha=R[ta];aa=ha.color;if(ha instanceof THREE.AmbientLight){L.r+=aa.r;L.g+=aa.g;L.b+=aa.b}else if(ha instanceof THREE.DirectionalLight){Z.r+=
|
|
|
+"; stroke-linejoin: "+aa.wireframeLinejoin):I.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+aa.opacity);j.appendChild(I)}function d(ia){if(T[ia]==null){T[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");va==0&&T[ia].setAttribute("shape-rendering","crispEdges")}return T[ia]}function e(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,n,q,x,u,t,y,A,F=
|
|
|
+new THREE.Rectangle,v=new THREE.Rectangle,E=!1,w=new THREE.Color(16777215),N=new THREE.Color(16777215),L=new THREE.Color(0),Z=new THREE.Color(0),M=new THREE.Color(0),f,V=new THREE.Vector3,T=[],da=[],fa=[],I,ca,xa,ea,va=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":va=1;break;case "low":va=0}};this.setSize=function(ia,ga){k=ia;n=ga;q=k/2;x=n/2;j.setAttribute("viewBox",-q+" "+-x+" "+k+" "+n);j.setAttribute("width",
|
|
|
+k);j.setAttribute("height",n);F.set(-q,-x,q,x)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(ia,ga){var ta,ya,ha,aa,ma,na,R,ja;this.autoClear&&this.clear();g=h.projectScene(ia,ga,this.sortElements);ea=xa=ca=0;if(E=ia.lights.length>0){R=ia.lights;L.setRGB(0,0,0);Z.setRGB(0,0,0);M.setRGB(0,0,0);ta=0;for(ya=R.length;ta<ya;ta++){ha=R[ta];aa=ha.color;if(ha instanceof THREE.AmbientLight){L.r+=aa.r;L.g+=aa.g;L.b+=aa.b}else if(ha instanceof THREE.DirectionalLight){Z.r+=
|
|
|
aa.r;Z.g+=aa.g;Z.b+=aa.b}else if(ha instanceof THREE.PointLight){M.r+=aa.r;M.g+=aa.g;M.b+=aa.b}}}ta=0;for(ya=g.length;ta<ya;ta++){R=g[ta];v.empty();if(R instanceof THREE.RenderableParticle){u=R;u.x*=q;u.y*=-x;ha=0;for(aa=R.materials.length;ha<aa;ha++)if(ja=R.materials[ha]){ma=u;na=R;var qa=xa++;if(da[qa]==null){da[qa]=document.createElementNS("http://www.w3.org/2000/svg","circle");va==0&&da[qa].setAttribute("shape-rendering","crispEdges")}I=da[qa];I.setAttribute("cx",ma.x);I.setAttribute("cy",ma.y);
|
|
|
-I.setAttribute("r",na.scale.x*q);if(ja instanceof THREE.ParticleCircleMaterial){if(F){N.r=L.r+Z.r+M.r;N.g=L.g+Z.g+M.g;N.b=L.b+Z.b+M.b;w.r=ja.color.r*N.r;w.g=ja.color.g*N.g;w.b=ja.color.b*N.b;w.updateStyleString()}else w=ja.color;I.setAttribute("style","fill: "+w.__styleString)}j.appendChild(I)}}else if(R instanceof THREE.RenderableLine){u=R.v1;t=R.v2;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,
|
|
|
-t.positionScreen.y);if(E.instersects(v)){ha=0;for(aa=R.materials.length;ha<aa;)if(ja=R.materials[ha++]){ma=u;na=t;qa=ea++;if(fa[qa]==null){fa[qa]=document.createElementNS("http://www.w3.org/2000/svg","line");va==0&&fa[qa].setAttribute("shape-rendering","crispEdges")}I=fa[qa];I.setAttribute("x1",ma.positionScreen.x);I.setAttribute("y1",ma.positionScreen.y);I.setAttribute("x2",na.positionScreen.x);I.setAttribute("y2",na.positionScreen.y);if(ja instanceof THREE.LineBasicMaterial){w.__styleString=ja.color.__styleString;
|
|
|
+I.setAttribute("r",na.scale.x*q);if(ja instanceof THREE.ParticleCircleMaterial){if(E){N.r=L.r+Z.r+M.r;N.g=L.g+Z.g+M.g;N.b=L.b+Z.b+M.b;w.r=ja.color.r*N.r;w.g=ja.color.g*N.g;w.b=ja.color.b*N.b;w.updateStyleString()}else w=ja.color;I.setAttribute("style","fill: "+w.__styleString)}j.appendChild(I)}}else if(R instanceof THREE.RenderableLine){u=R.v1;t=R.v2;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,
|
|
|
+t.positionScreen.y);if(F.instersects(v)){ha=0;for(aa=R.materials.length;ha<aa;)if(ja=R.materials[ha++]){ma=u;na=t;qa=ea++;if(fa[qa]==null){fa[qa]=document.createElementNS("http://www.w3.org/2000/svg","line");va==0&&fa[qa].setAttribute("shape-rendering","crispEdges")}I=fa[qa];I.setAttribute("x1",ma.positionScreen.x);I.setAttribute("y1",ma.positionScreen.y);I.setAttribute("x2",na.positionScreen.x);I.setAttribute("y2",na.positionScreen.y);if(ja instanceof THREE.LineBasicMaterial){w.__styleString=ja.color.__styleString;
|
|
|
I.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+ja.linewidth+"; stroke-opacity: "+ja.opacity+"; stroke-linecap: "+ja.linecap+"; stroke-linejoin: "+ja.linejoin);j.appendChild(I)}}}}else if(R instanceof THREE.RenderableFace3){u=R.v1;t=R.v2;y=R.v3;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;y.positionScreen.x*=q;y.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);
|
|
|
-v.addPoint(y.positionScreen.x,y.positionScreen.y);if(E.instersects(v)){ha=0;for(aa=R.meshMaterials.length;ha<aa;){ja=R.meshMaterials[ha++];if(ja instanceof THREE.MeshFaceMaterial){ma=0;for(na=R.faceMaterials.length;ma<na;)(ja=R.faceMaterials[ma++])&&c(u,t,y,R,ja,ia)}else ja&&c(u,t,y,R,ja,ia)}}}else if(R instanceof THREE.RenderableFace4){u=R.v1;t=R.v2;y=R.v3;A=R.v4;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;y.positionScreen.x*=q;y.positionScreen.y*=-x;
|
|
|
-A.positionScreen.x*=q;A.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(y.positionScreen.x,y.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(E.instersects(v)){ha=0;for(aa=R.meshMaterials.length;ha<aa;){ja=R.meshMaterials[ha++];if(ja instanceof THREE.MeshFaceMaterial){ma=0;for(na=R.faceMaterials.length;ma<na;)(ja=R.faceMaterials[ma++])&&b(u,t,y,A,R,ja,ia)}else ja&&b(u,t,y,A,R,ja,ia)}}}}}};
|
|
|
+v.addPoint(y.positionScreen.x,y.positionScreen.y);if(F.instersects(v)){ha=0;for(aa=R.meshMaterials.length;ha<aa;){ja=R.meshMaterials[ha++];if(ja instanceof THREE.MeshFaceMaterial){ma=0;for(na=R.faceMaterials.length;ma<na;)(ja=R.faceMaterials[ma++])&&c(u,t,y,R,ja,ia)}else ja&&c(u,t,y,R,ja,ia)}}}else if(R instanceof THREE.RenderableFace4){u=R.v1;t=R.v2;y=R.v3;A=R.v4;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;y.positionScreen.x*=q;y.positionScreen.y*=-x;
|
|
|
+A.positionScreen.x*=q;A.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(y.positionScreen.x,y.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(F.instersects(v)){ha=0;for(aa=R.meshMaterials.length;ha<aa;){ja=R.meshMaterials[ha++];if(ja instanceof THREE.MeshFaceMaterial){ma=0;for(na=R.faceMaterials.length;ma<na;)(ja=R.faceMaterials[ma++])&&b(u,t,y,A,R,ja,ia)}else ja&&b(u,t,y,A,R,ja,ia)}}}}}};
|
|
|
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",
|
|
@@ -217,8 +217,8 @@ z.directional.colors;G.directionalLightDirection.value=z.directional.positions;G
|
|
|
G.refractionRatio.value=m.refractionRatio;G.combine.value=m.combine;G.useRefract.value=m.envMap&&m.envMap.mapping instanceof THREE.CubeRefractionMapping}if(m instanceof THREE.LineBasicMaterial){G.diffuse.value.setRGB(m.color.r*m.opacity,m.color.g*m.opacity,m.color.b*m.opacity);G.opacity.value=m.opacity}else if(m instanceof THREE.ParticleBasicMaterial){G.psColor.value.setRGB(m.color.r*m.opacity,m.color.g*m.opacity,m.color.b*m.opacity);G.opacity.value=m.opacity;G.size.value=m.size;G.scale.value=M.height/
|
|
|
2;G.map.texture=m.map}else if(m instanceof THREE.MeshPhongMaterial){G.ambient.value.setRGB(m.ambient.r,m.ambient.g,m.ambient.b);G.specular.value.setRGB(m.specular.r,m.specular.g,m.specular.b);G.shininess.value=m.shininess}else if(m instanceof THREE.MeshDepthMaterial){G.mNear.value=l.near;G.mFar.value=l.far;G.opacity.value=m.opacity}else if(m instanceof THREE.MeshNormalMaterial)G.opacity.value=m.opacity;for(var X in G)if(O=B.uniforms[X]){p=G[X];Q=p.type;z=p.value;if(Q=="i")f.uniform1i(O,z);else if(Q==
|
|
|
"f")f.uniform1f(O,z);else if(Q=="fv1")f.uniform1fv(O,z);else if(Q=="fv")f.uniform3fv(O,z);else if(Q=="v2")f.uniform2f(O,z.x,z.y);else if(Q=="v3")f.uniform3f(O,z.x,z.y,z.z);else if(Q=="c")f.uniform3f(O,z.r,z.g,z.b);else if(Q=="t"){f.uniform1i(O,z);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(Q=0;Q<6;++Q)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,f.RGBA,
|
|
|
-f.UNSIGNED_BYTE,p.image[Q])}else{p.image.__webGLTextureCube=f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(Q=0;Q<6;++Q)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[Q]);p.__wasSetOnce=!0}F(f.TEXTURE_CUBE_MAP,p,p.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,
|
|
|
-p.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}F(f.TEXTURE_2D,p,p.image);f.bindTexture(f.TEXTURE_2D,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_2D,p.__webGLTexture)}}}f.uniformMatrix4fv(C.modelViewMatrix,!1,o._modelViewMatrixArray);f.uniformMatrix3fv(C.normalMatrix,
|
|
|
+f.UNSIGNED_BYTE,p.image[Q])}else{p.image.__webGLTextureCube=f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(Q=0;Q<6;++Q)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[Q]);p.__wasSetOnce=!0}E(f.TEXTURE_CUBE_MAP,p,p.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,
|
|
|
+p.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}E(f.TEXTURE_2D,p,p.image);f.bindTexture(f.TEXTURE_2D,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_2D,p.__webGLTexture)}}}f.uniformMatrix4fv(C.modelViewMatrix,!1,o._modelViewMatrixArray);f.uniformMatrix3fv(C.normalMatrix,
|
|
|
!1,o._normalMatrixArray);(m instanceof THREE.MeshShaderMaterial||m instanceof THREE.MeshPhongMaterial||m.envMap)&&f.uniform3f(C.cameraPosition,l.position.x,l.position.y,l.position.z);(m instanceof THREE.MeshShaderMaterial||m.envMap||m.skinning)&&f.uniformMatrix4fv(C.objectMatrix,!1,o._objectMatrixArray);(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshShaderMaterial||m.skinning)&&f.uniformMatrix4fv(C.viewMatrix,!1,aa);if(m.skinning){f.uniformMatrix4fv(C.cameraInverseMatrix,
|
|
|
!1,aa);f.uniformMatrix4fv(C.boneGlobalMatrices,!1,o.boneMatrices)}return B}function e(l,z,p,m,o,B){if(m.opacity!=0){l=d(l,z,p,m,B).attributes;f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.vertexAttribPointer(l.position,3,f.FLOAT,!1,0,0);if(l.color>=0){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.vertexAttribPointer(l.color,3,f.FLOAT,!1,0,0)}if(l.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLNormalBuffer);f.vertexAttribPointer(l.normal,3,f.FLOAT,!1,0,0)}if(l.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,
|
|
|
o.__webGLTangentBuffer);f.vertexAttribPointer(l.tangent,4,f.FLOAT,!1,0,0)}if(l.uv>=0)if(o.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLUVBuffer);f.vertexAttribPointer(l.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(l.uv)}else f.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(o.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLUV2Buffer);f.vertexAttribPointer(l.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(l.uv2)}else f.disableVertexAttribArray(l.uv2);if(m.skinning&&l.skinVertexA>=0&&
|
|
@@ -230,8 +230,8 @@ xa=l}}function k(l){ta[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);t
|
|
|
Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),m=0;m<6;m++){l=ta[m].x*z.n14+ta[m].y*z.n24+ta[m].z*z.n34+ta[m].w;if(l<=p)return!1}return!0}function q(l,z){l.list[l.count]=z;l.count+=1}function x(l){var z,p,m=l.object,o=l.opaque,B=l.transparent;B.count=0;l=o.count=0;for(z=m.materials.length;l<z;l++){p=m.materials[l];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?q(B,p):q(o,p)}}function u(l){var z,p,m,o,B=l.object,C=l.buffer,G=l.opaque,Q=l.transparent;Q.count=0;l=G.count=0;for(m=B.materials.length;l<
|
|
|
m;l++){z=B.materials[l];if(z instanceof THREE.MeshFaceMaterial){z=0;for(p=C.materials.length;z<p;z++)(o=C.materials[z])&&(o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?q(Q,o):q(G,o))}else{o=z;o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?q(Q,o):q(G,o)}}}function t(l,z){return z.z-l.z}function y(l,z){l._modelViewMatrix.multiplyToArray(z.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}
|
|
|
function A(l){function z(la){var ka=[];p=0;for(m=la.length;p<m;p++)la[p]==undefined?ka.push("undefined"):ka.push(la[p].id);return ka.join("_")}var p,m,o,B,C,G,Q,H,O={};l.geometryGroups={};o=0;for(B=l.faces.length;o<B;o++){C=l.faces[o];G=C.materials;Q=z(G);O[Q]==undefined&&(O[Q]={hash:Q,counter:0});H=O[Q].hash+"_"+O[Q].counter;l.geometryGroups[H]==undefined&&(l.geometryGroups[H]={faces:[],materials:G,vertices:0});C=C instanceof THREE.Face3?3:4;if(l.geometryGroups[H].vertices+C>65535){O[Q].counter+=
|
|
|
-1;H=O[Q].hash+"_"+O[Q].counter;l.geometryGroups[H]==undefined&&(l.geometryGroups[H]={faces:[],materials:G,vertices:0})}l.geometryGroups[H].faces.push(o);l.geometryGroups[H].vertices+=C}}function E(l,z,p){l.push({buffer:z,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function v(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);
|
|
|
-f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}ca=l}}function F(l,z,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(l,f.TEXTURE_WRAP_S,Z(z.wrapS));f.texParameteri(l,f.TEXTURE_WRAP_T,Z(z.wrapT));f.texParameteri(l,f.TEXTURE_MAG_FILTER,Z(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,
|
|
|
+1;H=O[Q].hash+"_"+O[Q].counter;l.geometryGroups[H]==undefined&&(l.geometryGroups[H]={faces:[],materials:G,vertices:0})}l.geometryGroups[H].faces.push(o);l.geometryGroups[H].vertices+=C}}function F(l,z,p){l.push({buffer:z,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function v(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);
|
|
|
+f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}ca=l}}function E(l,z,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(l,f.TEXTURE_WRAP_S,Z(z.wrapS));f.texParameteri(l,f.TEXTURE_WRAP_T,Z(z.wrapT));f.texParameteri(l,f.TEXTURE_MAG_FILTER,Z(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,
|
|
|
Z(z.minFilter));f.generateMipmap(l)}else{f.texParameteri(l,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_MAG_FILTER,L(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,L(z.minFilter))}}function w(l){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=f.createFramebuffer();l.__webGLRenderbuffer=f.createRenderbuffer();l.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,l.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,
|
|
|
f.DEPTH_COMPONENT16,l.width,l.height);f.bindTexture(f.TEXTURE_2D,l.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,Z(l.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,Z(l.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,Z(l.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,Z(l.minFilter));f.texImage2D(f.TEXTURE_2D,0,Z(l.format),l.width,l.height,0,Z(l.format),Z(l.type),null);f.bindFramebuffer(f.FRAMEBUFFER,l.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,
|
|
|
f.COLOR_ATTACHMENT0,f.TEXTURE_2D,l.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,l.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var z,p;if(l){z=l.__webGLFramebuffer;p=l.width;l=l.height}else{z=null;p=ia;l=ga}if(z!=T){f.bindFramebuffer(f.FRAMEBUFFER,z);f.viewport(ea,va,p,l);T=z}}function N(l,z){var p;if(l=="fragment")p=f.createShader(f.FRAGMENT_SHADER);else l=="vertex"&&
|
|
@@ -255,9 +255,9 @@ C.list[o];v(G.blending);j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(m=0;m<H;m++){o=l.
|
|
|
B;C.__webGLVertexBuffer=f.createBuffer();C.__webGLNormalBuffer=f.createBuffer();C.__webGLTangentBuffer=f.createBuffer();C.__webGLColorBuffer=f.createBuffer();C.__webGLUVBuffer=f.createBuffer();C.__webGLUV2Buffer=f.createBuffer();C.__webGLSkinVertexABuffer=f.createBuffer();C.__webGLSkinVertexBBuffer=f.createBuffer();C.__webGLSkinIndicesBuffer=f.createBuffer();C.__webGLSkinWeightsBuffer=f.createBuffer();C.__webGLFaceBuffer=f.createBuffer();C.__webGLLineBuffer=f.createBuffer();C=B;var G=z,Q=void 0,H=
|
|
|
void 0,O=0,la=0,ka=0,ra=G.geometry.faces,sa=C.faces;Q=0;for(H=sa.length;Q<H;Q++){fi=sa[Q];face=ra[fi];if(face instanceof THREE.Face3){O+=3;la+=1;ka+=3}else if(face instanceof THREE.Face4){O+=4;la+=2;ka+=4}}C.__vertexArray=new Float32Array(O*3);C.__normalArray=new Float32Array(O*3);C.__tangentArray=new Float32Array(O*4);C.__colorArray=new Float32Array(O*3);C.__uvArray=new Float32Array(O*2);C.__uv2Array=new Float32Array(O*2);C.__skinVertexAArray=new Float32Array(O*4);C.__skinVertexBArray=new Float32Array(O*
|
|
|
4);C.__skinIndexArray=new Float32Array(O*4);C.__skinWeightArray=new Float32Array(O*4);C.__faceArray=new Uint16Array(la*3);C.__lineArray=new Uint16Array(ka*2);H=Q=C;O=void 0;ra=void 0;var oa=void 0,pa=void 0;oa=void 0;sa=!1;O=0;for(ra=G.materials.length;O<ra;O++){oa=G.materials[O];if(oa instanceof THREE.MeshFaceMaterial){oa=0;for(pa=H.materials.length;oa<pa;oa++)if(H.materials[oa]&&H.materials[oa].shading!=undefined&&H.materials[oa].shading==THREE.SmoothShading){sa=!0;break}}else if(oa&&oa.shading!=
|
|
|
-undefined&&oa.shading==THREE.SmoothShading){sa=!0;break}if(sa)break}Q.__needsSmoothNormals=sa;C.__webGLFaceCount=la*3;C.__webGLLineCount=ka*2;o.__dirtyVertices=!0;o.__dirtyElements=!0;o.__dirtyUvs=!0;o.__dirtyNormals=!0;o.__dirtyTangents=!0;o.__dirtyColors=!0}E(p.__webglObjects,B,z)}}else if(z instanceof THREE.Ribbon){o=z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=f.createBuffer();m.__webGLColorBuffer=f.createBuffer();m=o;B=m.vertices.length;m.__vertexArray=new Float32Array(B*3);
|
|
|
-m.__colorArray=new Float32Array(B*3);m.__webGLVertexCount=B;o.__dirtyVertices=!0;o.__dirtyColors=!0}E(p.__webglObjects,o,z)}else if(z instanceof THREE.Line){o=z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=f.createBuffer();m.__webGLColorBuffer=f.createBuffer();m=o;B=m.vertices.length;m.__vertexArray=new Float32Array(B*3);m.__colorArray=new Float32Array(B*3);m.__webGLLineCount=B;o.__dirtyVertices=!0;o.__dirtyColors=!0}E(p.__webglObjects,o,z)}else if(z instanceof THREE.ParticleSystem){o=
|
|
|
-z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=f.createBuffer();m.__webGLColorBuffer=f.createBuffer();m=o;B=m.vertices.length;m.__vertexArray=new Float32Array(B*3);m.__colorArray=new Float32Array(B*3);m.__sortArray=[];m.__webGLParticleCount=B;o.__dirtyVertices=!0;o.__dirtyColors=!0}E(p.__webglObjects,o,z)}else THREE.MarchingCubes!==undefined&&z instanceof THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}});l.__objectsAdded.splice(0,
|
|
|
+undefined&&oa.shading==THREE.SmoothShading){sa=!0;break}if(sa)break}Q.__needsSmoothNormals=sa;C.__webGLFaceCount=la*3;C.__webGLLineCount=ka*2;o.__dirtyVertices=!0;o.__dirtyElements=!0;o.__dirtyUvs=!0;o.__dirtyNormals=!0;o.__dirtyTangents=!0;o.__dirtyColors=!0}F(p.__webglObjects,B,z)}}else if(z instanceof THREE.Ribbon){o=z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=f.createBuffer();m.__webGLColorBuffer=f.createBuffer();m=o;B=m.vertices.length;m.__vertexArray=new Float32Array(B*3);
|
|
|
+m.__colorArray=new Float32Array(B*3);m.__webGLVertexCount=B;o.__dirtyVertices=!0;o.__dirtyColors=!0}F(p.__webglObjects,o,z)}else if(z instanceof THREE.Line){o=z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=f.createBuffer();m.__webGLColorBuffer=f.createBuffer();m=o;B=m.vertices.length;m.__vertexArray=new Float32Array(B*3);m.__colorArray=new Float32Array(B*3);m.__webGLLineCount=B;o.__dirtyVertices=!0;o.__dirtyColors=!0}F(p.__webglObjects,o,z)}else if(z instanceof THREE.ParticleSystem){o=
|
|
|
+z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=f.createBuffer();m.__webGLColorBuffer=f.createBuffer();m=o;B=m.vertices.length;m.__vertexArray=new Float32Array(B*3);m.__colorArray=new Float32Array(B*3);m.__sortArray=[];m.__webGLParticleCount=B;o.__dirtyVertices=!0;o.__dirtyColors=!0}F(p.__webglObjects,o,z)}else THREE.MarchingCubes!==undefined&&z instanceof THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}});l.__objectsAdded.splice(0,
|
|
|
1)}for(;l.__objectsRemoved.length;){z=l.__objectsRemoved[0];p=l;o=void 0;m=void 0;for(o=p.__webglObjects.length-1;o>=0;o--){m=p.__webglObjects[o].object;z==m&&p.__webglObjects.splice(o,1)}l.__objectsRemoved.splice(0,1)}z=0;for(p=l.__webglObjects.length;z<p;z++){m=l.__webglObjects[z].object;B=void 0;o=void 0;C=void 0;if(m instanceof THREE.Mesh){o=m.geometry;for(B in o.geometryGroups){C=o.geometryGroups[B];if(o.__dirtyVertices||o.__dirtyElements||o.__dirtyUvs||o.__dirtyNormals||o.__dirtyColors||o.__dirtyTangents){la=
|
|
|
f.DYNAMIC_DRAW;ka=void 0;Q=void 0;var Ja=void 0,P=void 0,Ga=void 0,Ea=void 0,Fa=void 0;Ja=void 0;var W=void 0,X=void 0,$=void 0,Aa=void 0;W=void 0;X=void 0;$=void 0;P=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;P=void 0;Ea=void 0;Ga=void 0;Fa=void 0;var Ha=pa=oa=sa=ra=O=G=H=0,Da=0,D=0,Ca=C.__vertexArray,Ra=C.__uvArray,Ua=C.__uv2Array,Ma=C.__normalArray,
|
|
|
Ba=C.__tangentArray,J=C.__colorArray,Y=C.__skinVertexAArray,U=C.__skinVertexBArray,K=C.__skinIndexArray,S=C.__skinWeightArray,ua=C.__faceArray,wa=C.__lineArray,Ia=C.__needsSmoothNormals,za=m.geometry,Pa=za.__dirtyVertices,Ka=za.__dirtyElements,La=za.__dirtyUvs,Ta=za.__dirtyNormals,Na=za.__dirtyTangents,Qa=za.__dirtyColors,Oa=za.vertices,Za=C.faces,$a=za.faces,ab=za.uvs,bb=za.uvs2,Sa=za.colors,Wa=za.skinVerticesA,Xa=za.skinVerticesB,Ya=za.skinIndices,Va=za.skinWeights;ka=0;for(Q=Za.length;ka<Q;ka++){Ja=
|
|
@@ -280,14 +280,14 @@ THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3
|
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|
|
|
var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,n=a.uvs;e=e.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var q=0,x=h.length;q<x;q++){var u=new THREE.Vertex(h[q].position.clone());b&&c.matrix.multiplyVector3(u.position);g.push(u)}q=0;for(x=k.length;q<x;q++){h=k[q];var t,y=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
|
|
|
d,h.b+d,h.c+d,h.d+d));t.centroid.copy(h.centroid);t.normal.copy(h.normal);b=0;for(g=y.length;b<g;b++){u=y[b];t.vertexNormals.push(u.clone())}t.materials=h.materials.slice();j.push(t)}q=0;for(x=e.length;q<x;q++){d=e[q];j=[];b=0;for(g=d.length;b<g;b++)j.push(new THREE.UV(d[b].u,d[b].v));n.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,c,b){var d,e=[],g=new THREE.Texture(e,
|
|
|
-c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(q in M.objects)if(!I.objects[q]){A=M.objects[q];if(w=I.geometries[A.geometry]){Z=[];for(i=0;i<A.materials.length;i++)Z[i]=I.materials[A.materials[i]];E=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(w,Z);object.position.set(E[0],
|
|
|
-E[1],E[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;I.scene.addObject(object);I.objects[q]=object}}}function h(ca){return function(xa){I.geometries[ca]=xa;g();V-=1;j()}}function j(){d({total_models:da,total_textures:fa,loaded_models:da-V,loaded_textures:fa-T},I);V==0&&T==0&&b(I)}var k,n,q,x,u,t,y,A,E,v,F,w,N,L,Z,M,f,V,T,da,fa,I;M=e.data;f=new THREE.Loader;T=V=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
-lights:{},fogs:{}};e=function(){T-=1;j()};for(u in M.cameras){v=M.cameras[u];if(v.type=="perspective")N=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){N=new THREE.Camera;N.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}E=v.position;v=v.target;N.position.set(E[0],E[1],E[2]);N.target.position.set(v[0],v[1],v[2]);I.cameras[u]=N}for(x in M.lights){u=M.lights[x];if(u.type=="directional"){E=u.direction;light=new THREE.DirectionalLight;light.position.set(E[0],
|
|
|
-E[1],E[2]);light.position.normalize()}else if(u.type=="point"){E=u.position;light=new THREE.PointLight;light.position.set(E[0],E[1],E[2])}v=u.color;i=u.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);I.scene.addLight(light);I.lights[x]=light}for(t in M.fogs){x=M.fogs[t];if(x.type=="linear")L=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(L=new THREE.FogExp2(0,x.density));v=x.color;L.color.setRGB(v[0],v[1],v[2]);I.fogs[t]=L}if(I.cameras&&M.defaults.camera)I.currentCamera=I.cameras[M.defaults.camera];
|
|
|
+c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(q in M.objects)if(!I.objects[q]){A=M.objects[q];if(w=I.geometries[A.geometry]){Z=[];for(i=0;i<A.materials.length;i++)Z[i]=I.materials[A.materials[i]];F=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(w,Z);object.position.set(F[0],
|
|
|
+F[1],F[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;I.scene.addObject(object);I.objects[q]=object}}}function h(ca){return function(xa){I.geometries[ca]=xa;g();V-=1;j()}}function j(){d({total_models:da,total_textures:fa,loaded_models:da-V,loaded_textures:fa-T},I);V==0&&T==0&&b(I)}var k,n,q,x,u,t,y,A,F,v,E,w,N,L,Z,M,f,V,T,da,fa,I;M=e.data;f=new THREE.Loader;T=V=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
+lights:{},fogs:{}};e=function(){T-=1;j()};for(u in M.cameras){v=M.cameras[u];if(v.type=="perspective")N=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){N=new THREE.Camera;N.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}F=v.position;v=v.target;N.position.set(F[0],F[1],F[2]);N.target.position.set(v[0],v[1],v[2]);I.cameras[u]=N}for(x in M.lights){u=M.lights[x];if(u.type=="directional"){F=u.direction;light=new THREE.DirectionalLight;light.position.set(F[0],
|
|
|
+F[1],F[2]);light.position.normalize()}else if(u.type=="point"){F=u.position;light=new THREE.PointLight;light.position.set(F[0],F[1],F[2])}v=u.color;i=u.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);I.scene.addLight(light);I.lights[x]=light}for(t in M.fogs){x=M.fogs[t];if(x.type=="linear")L=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(L=new THREE.FogExp2(0,x.density));v=x.color;L.color.setRGB(v[0],v[1],v[2]);I.fogs[t]=L}if(I.cameras&&M.defaults.camera)I.currentCamera=I.cameras[M.defaults.camera];
|
|
|
if(I.fogs&&M.defaults.fog)I.scene.fog=I.fogs[M.defaults.fog];v=M.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(v[0],v[1],v[2]);I.bgColorAlpha=M.defaults.bgalpha;for(k in M.geometries){t=M.geometries[k];if(t.type=="bin_mesh"||t.type=="ascii_mesh")V+=1}da=V;for(k in M.geometries){t=M.geometries[k];if(t.type=="cube"){w=new Cube(t.width,t.height,t.depth,t.segmentsWidth,t.segmentsHeight,t.segmentsDepth,null,t.flipped,t.sides);I.geometries[k]=w}else if(t.type=="plane"){w=new Plane(t.width,
|
|
|
t.height,t.segmentsWidth,t.segmentsHeight);I.geometries[k]=w}else if(t.type=="sphere"){w=new Sphere(t.radius,t.segmentsWidth,t.segmentsHeight);I.geometries[k]=w}else if(t.type=="cylinder"){w=new Cylinder(t.numSegs,t.topRad,t.botRad,t.height,t.topOffset,t.botOffset);I.geometries[k]=w}else if(t.type=="torus"){w=new Torus(t.radius,t.tube,t.segmentsR,t.segmentsT);I.geometries[k]=w}else if(t.type=="icosahedron"){w=new Icosahedron(t.subdivisions);I.geometries[k]=w}else if(t.type=="bin_mesh")f.loadBinary({model:t.url,
|
|
|
callback:h(k)});else t.type=="ascii_mesh"&&f.loadAscii({model:t.url,callback:h(k)})}for(y in M.textures){k=M.textures[y];T+=k.url instanceof Array?k.url.length:1}fa=T;for(y in M.textures){k=M.textures[y];if(k.mapping!=undefined&&THREE[k.mapping]!=undefined)k.mapping=new THREE[k.mapping];if(k.url instanceof Array)t=ImageUtils.loadTextureCube(k.url,k.mapping,e);else{t=ImageUtils.loadTexture(k.url,k.mapping,e);if(THREE[k.minFilter]!=undefined)t.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=undefined)t.magFilter=
|
|
|
-THREE[k.magFilter]}I.textures[y]=t}for(n in M.materials){y=M.materials[n];for(F in y.parameters)if(F=="envMap"||F=="map"||F=="lightMap")y.parameters[F]=I.textures[y.parameters[F]];else if(F=="shading")y.parameters[F]=y.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")y.parameters[F]=THREE[y.parameters[F]]?THREE[y.parameters[F]]:THREE.NormalBlending;else F=="combine"&&(y.parameters[F]=y.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);y=new THREE[y.type](y.parameters);
|
|
|
+THREE[k.magFilter]}I.textures[y]=t}for(n in M.materials){y=M.materials[n];for(E in y.parameters)if(E=="envMap"||E=="map"||E=="lightMap")y.parameters[E]=I.textures[y.parameters[E]];else if(E=="shading")y.parameters[E]=y.parameters[E]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(E=="blending")y.parameters[E]=THREE[y.parameters[E]]?THREE[y.parameters[E]]:THREE.NormalBlending;else E=="combine"&&(y.parameters[E]=y.parameters[E]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);y=new THREE[y.type](y.parameters);
|
|
|
I.materials[n]=y}g();c(I)}},addMesh:function(a,c,b,d,e,g,h,j,k,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=g;c.rotation.x=h;c.rotation.y=j;c.rotation.z=k;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
|
|
|
return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);
|
|
|
a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var e=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,c,1,0,d,0,g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
|
|
@@ -300,18 +300,18 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
|
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
|
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}},Cube=function(a,c,b,d,e,g,h,j,k){function n(E,v,F,w,N,L,Z,M){var f,V,T=d||1,da=e||1,fa=N/2,I=L/2,ca=q.vertices.length;if(E=="x"&&v=="y"||E=="y"&&v=="x")f="z";else if(E=="x"&&v=="z"||E=="z"&&v=="x"){f="y";da=g||1}else if(E=="z"&&
|
|
|
-v=="y"||E=="y"&&v=="z"){f="x";T=g||1}var xa=T+1,ea=da+1;N/=T;var va=L/da;for(V=0;V<ea;V++)for(L=0;L<xa;L++){var ia=new THREE.Vector3;ia[E]=(L*N-fa)*F;ia[v]=(V*va-I)*w;ia[f]=Z;q.vertices.push(new THREE.Vertex(ia))}for(V=0;V<da;V++)for(L=0;L<T;L++){q.faces.push(new THREE.Face4(L+xa*V+ca,L+xa*(V+1)+ca,L+1+xa*(V+1)+ca,L+1+xa*V+ca,null,M));q.uvs.push([new THREE.UV(L/T,V/da),new THREE.UV(L/T,(V+1)/da),new THREE.UV((L+1)/T,(V+1)/da),new THREE.UV((L+1)/T,V/da)])}}THREE.Geometry.call(this);var q=this,x=a/
|
|
|
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}},Cube=function(a,c,b,d,e,g,h,j,k){function n(F,v,E,w,N,L,Z,M){var f,V,T=d||1,da=e||1,fa=N/2,I=L/2,ca=q.vertices.length;if(F=="x"&&v=="y"||F=="y"&&v=="x")f="z";else if(F=="x"&&v=="z"||F=="z"&&v=="x"){f="y";da=g||1}else if(F=="z"&&
|
|
|
+v=="y"||F=="y"&&v=="z"){f="x";T=g||1}var xa=T+1,ea=da+1;N/=T;var va=L/da;for(V=0;V<ea;V++)for(L=0;L<xa;L++){var ia=new THREE.Vector3;ia[F]=(L*N-fa)*E;ia[v]=(V*va-I)*w;ia[f]=Z;q.vertices.push(new THREE.Vertex(ia))}for(V=0;V<da;V++)for(L=0;L<T;L++){q.faces.push(new THREE.Face4(L+xa*V+ca,L+xa*(V+1)+ca,L+1+xa*(V+1)+ca,L+1+xa*V+ca,null,M));q.uvs.push([new THREE.UV(L/T,V/da),new THREE.UV(L/T,(V+1)/da),new THREE.UV((L+1)/T,(V+1)/da),new THREE.UV((L+1)/T,V/da)])}}THREE.Geometry.call(this);var q=this,x=a/
|
|
|
2,u=c/2,t=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var A in k)this.sides[A]!=undefined&&(this.sides[A]=k[A]);this.sides.px&&n("z","y",1*j,-1,b,c,-x,this.materials[0]);this.sides.nx&&n("z","y",-1*j,-1,b,c,x,this.materials[1]);this.sides.py&&n("x","z",1*j,1,a,b,u,this.materials[2]);this.sides.ny&&n("x","z",1*j,-1,
|
|
|
-a,b,-u,this.materials[3]);this.sides.pz&&n("x","y",1*j,-1,a,c,t,this.materials[4]);this.sides.nz&&n("x","y",-1*j,-1,a,c,-t,this.materials[5]);(function(){for(var E=[],v=[],F=0,w=q.vertices.length;F<w;F++){for(var N=q.vertices[F],L=!1,Z=0,M=E.length;Z<M;Z++){var f=E[Z];if(N.position.x==f.position.x&&N.position.y==f.position.y&&N.position.z==f.position.z){v[F]=Z;L=!0;break}}if(!L){v[F]=E.length;E.push(new THREE.Vertex(N.position.clone()))}}F=0;for(w=q.faces.length;F<w;F++){N=q.faces[F];N.a=v[N.a];N.b=
|
|
|
-v[N.b];N.c=v[N.c];N.d=v[N.d]}q.vertices=E})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
|
+a,b,-u,this.materials[3]);this.sides.pz&&n("x","y",1*j,-1,a,c,t,this.materials[4]);this.sides.nz&&n("x","y",-1*j,-1,a,c,-t,this.materials[5]);(function(){for(var F=[],v=[],E=0,w=q.vertices.length;E<w;E++){for(var N=q.vertices[E],L=!1,Z=0,M=F.length;Z<M;Z++){var f=F[Z];if(N.position.x==f.position.x&&N.position.y==f.position.y&&N.position.z==f.position.z){v[E]=Z;L=!0;break}}if(!L){v[E]=F.length;F.push(new THREE.Vertex(N.position.clone()))}}E=0;for(w=q.faces.length;E<w;E++){N=q.faces[E];N.a=v[N.a];N.b=
|
|
|
+v[N.b];N.c=v[N.c];N.d=v[N.d]}q.vertices=F})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
|
var Cylinder=function(a,c,b,d,e){function g(n,q,x){h.vertices.push(new THREE.Vertex(new THREE.Vector3(n,q,x)))}THREE.Geometry.call(this);var h=this,j=Math.PI,k;for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*c,Math.cos(2*j*k/a)*c,0);for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*b,Math.cos(2*j*k/a)*b,d);for(k=0;k<a;k++)h.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(b!=0){g(0,0,-e);for(k=a;k<a+a/2;k++)h.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(c!=0){g(0,0,d+e);for(k=a+a/2;k<
|
|
|
2*a;k++)h.faces.push(new THREE.Face4((2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
|
|
|
var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var j=b+1,k=d+1;a/=b;var n=c/d;for(e=0;e<k;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*n-h),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e));this.uvs.push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
|
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
|
var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,e=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var j=a*Math.cos(d*e),k=a*Math.sin(d*e),n=[],q=0;for(d=0;d<g;d++){var x=2*d/g,u=k*Math.sin(x*e);x=k*Math.cos(x*e);(b==0||b==h)&&d>0||(q=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,j,u)))-1);n.push(q)}c.push(n)}var t,y,A;e=c.length;for(b=0;b<e;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){n=d==g-1;h=c[b][n?0:d+1];j=c[b][n?g-1:d];k=c[b-1][n?g-1:d];n=c[b-1][n?
|
|
|
-0:d+1];u=b/(e-1);t=(b-1)/(e-1);y=(d+1)/g;x=d/g;q=new THREE.UV(1-y,u);u=new THREE.UV(1-x,u);x=new THREE.UV(1-x,t);var E=new THREE.UV(1-y,t);if(b<c.length-1){t=this.vertices[h].position.clone();y=this.vertices[j].position.clone();A=this.vertices[k].position.clone();t.normalize();y.normalize();A.normalize();this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([q,u,x])}if(b>1){t=this.vertices[h].position.clone();
|
|
|
-y=this.vertices[k].position.clone();A=this.vertices[n].position.clone();t.normalize();y.normalize();A.normalize();this.faces.push(new THREE.Face3(h,k,n,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([q,x,E])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
|
+0:d+1];u=b/(e-1);t=(b-1)/(e-1);y=(d+1)/g;x=d/g;q=new THREE.UV(1-y,u);u=new THREE.UV(1-x,u);x=new THREE.UV(1-x,t);var F=new THREE.UV(1-y,t);if(b<c.length-1){t=this.vertices[h].position.clone();y=this.vertices[j].position.clone();A=this.vertices[k].position.clone();t.normalize();y.normalize();A.normalize();this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([q,u,x])}if(b>1){t=this.vertices[h].position.clone();
|
|
|
+y=this.vertices[k].position.clone();A=this.vertices[n].position.clone();t.normalize();y.normalize();A.normalize();this.faces.push(new THREE.Face3(h,k,n,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([q,x,F])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
|
var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
|
|
|
1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;e=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,e,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
|
|
|
var Icosahedron=function(a){function c(x,u,t){var y=Math.sqrt(x*x+u*u+t*t);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(x/y,u/y,t/y)))-1}function b(x,u,t,y){y.faces.push(new THREE.Face3(x,u,t))}function d(x,u){var t=e.vertices[x].position,y=e.vertices[u].position;return c((t.x+y.x)/2,(t.y+y.y)/2,(t.z+y.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
|
|
@@ -323,13 +323,13 @@ if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
|
|
THREE.MarchingCubes=function(a,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.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=n;e[g]=this.lerp(q[b],q[b+3],h);e[g+1]=this.lerp(q[b+1],q[b+4],h);e[g+2]=this.lerp(q[b+2],q[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
|
|
|
2]=n;d=b+this.yd*3;e[g]=this.lerp(q[b],q[d],h);e[g+1]=this.lerp(q[b+1],q[d+1],h);e[g+2]=this.lerp(q[b+2],q[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=n+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(q[b],q[d],h);e[g+1]=this.lerp(q[b+1],q[d+1],h);e[g+2]=this.lerp(q[b+2],q[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
|
|
|
-this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,j){var k=g+1,n=g+this.yd,q=g+this.zd,x=k+this.yd,u=k+this.zd,t=g+this.yd+this.zd,y=k+this.yd+this.zd,A=0,E=this.field[g],v=this.field[k],F=this.field[n],w=this.field[x],N=this.field[q],L=this.field[u],Z=this.field[t],M=this.field[y];E<h&&(A|=1);v<h&&(A|=2);F<h&&(A|=8);w<h&&(A|=4);N<h&&(A|=16);L<h&&(A|=32);Z<h&&(A|=128);M<h&&(A|=64);var f=THREE.edgeTable[A];if(f==0)return 0;
|
|
|
-var V=this.delta,T=b+V,da=d+V;V=e+V;if(f&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,E,v)}if(f&2){this.compNorm(k);this.compNorm(x);this.VIntY(k*3,this.vlist,this.nlist,3,h,T,d,e,v,w)}if(f&4){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,da,e,F,w)}if(f&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,E,F)}if(f&16){this.compNorm(q);this.compNorm(u);this.VIntX(q*3,this.vlist,this.nlist,12,h,b,d,
|
|
|
-V,N,L)}if(f&32){this.compNorm(u);this.compNorm(y);this.VIntY(u*3,this.vlist,this.nlist,15,h,T,d,V,L,M)}if(f&64){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,18,h,b,da,V,Z,M)}if(f&128){this.compNorm(q);this.compNorm(t);this.VIntY(q*3,this.vlist,this.nlist,21,h,b,d,V,N,Z)}if(f&256){this.compNorm(g);this.compNorm(q);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,E,N)}if(f&512){this.compNorm(k);this.compNorm(u);this.VIntZ(k*3,this.vlist,this.nlist,27,h,T,d,e,v,L)}if(f&1024){this.compNorm(x);
|
|
|
-this.compNorm(y);this.VIntZ(x*3,this.vlist,this.nlist,30,h,T,da,e,w,M)}if(f&2048){this.compNorm(n);this.compNorm(t);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,da,e,F,Z)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){b=A+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],j);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,j){var k=this.count*3;this.positionArray[k]=b[e];this.positionArray[k+1]=b[e+1];this.positionArray[k+2]=b[e+2];this.positionArray[k+
|
|
|
+this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,j){var k=g+1,n=g+this.yd,q=g+this.zd,x=k+this.yd,u=k+this.zd,t=g+this.yd+this.zd,y=k+this.yd+this.zd,A=0,F=this.field[g],v=this.field[k],E=this.field[n],w=this.field[x],N=this.field[q],L=this.field[u],Z=this.field[t],M=this.field[y];F<h&&(A|=1);v<h&&(A|=2);E<h&&(A|=8);w<h&&(A|=4);N<h&&(A|=16);L<h&&(A|=32);Z<h&&(A|=128);M<h&&(A|=64);var f=THREE.edgeTable[A];if(f==0)return 0;
|
|
|
+var V=this.delta,T=b+V,da=d+V;V=e+V;if(f&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,F,v)}if(f&2){this.compNorm(k);this.compNorm(x);this.VIntY(k*3,this.vlist,this.nlist,3,h,T,d,e,v,w)}if(f&4){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,da,e,E,w)}if(f&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,F,E)}if(f&16){this.compNorm(q);this.compNorm(u);this.VIntX(q*3,this.vlist,this.nlist,12,h,b,d,
|
|
|
+V,N,L)}if(f&32){this.compNorm(u);this.compNorm(y);this.VIntY(u*3,this.vlist,this.nlist,15,h,T,d,V,L,M)}if(f&64){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,18,h,b,da,V,Z,M)}if(f&128){this.compNorm(q);this.compNorm(t);this.VIntY(q*3,this.vlist,this.nlist,21,h,b,d,V,N,Z)}if(f&256){this.compNorm(g);this.compNorm(q);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,F,N)}if(f&512){this.compNorm(k);this.compNorm(u);this.VIntZ(k*3,this.vlist,this.nlist,27,h,T,d,e,v,L)}if(f&1024){this.compNorm(x);
|
|
|
+this.compNorm(y);this.VIntZ(x*3,this.vlist,this.nlist,30,h,T,da,e,w,M)}if(f&2048){this.compNorm(n);this.compNorm(t);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,da,e,E,Z)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){b=A+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],j);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,j){var k=this.count*3;this.positionArray[k]=b[e];this.positionArray[k+1]=b[e+1];this.positionArray[k+2]=b[e+2];this.positionArray[k+
|
|
|
3]=b[g];this.positionArray[k+4]=b[g+1];this.positionArray[k+5]=b[g+2];this.positionArray[k+6]=b[h];this.positionArray[k+7]=b[h+1];this.positionArray[k+8]=b[h+2];this.normalArray[k]=d[e];this.normalArray[k+1]=d[e+1];this.normalArray[k+2]=d[e+2];this.normalArray[k+3]=d[g];this.normalArray[k+4]=d[g+1];this.normalArray[k+5]=d[g+2];this.normalArray[k+6]=d[h];this.normalArray[k+7]=d[h+1];this.normalArray[k+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=
|
|
|
function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,g,h){var j=this.size*Math.sqrt(g/h),k=e*this.size,n=d*this.size,q=b*this.size,x=Math.floor(k-j);x<1&&(x=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var u=Math.floor(n-j);u<1&&(u=1);n=Math.floor(n+j);n>this.size-1&&(n=this.size-1);var t=Math.floor(q-j);t<1&&(t=1);j=Math.floor(q+j);
|
|
|
-j>this.size-1&&(j=this.size-1);for(var y,A,E,v,F,w;x<k;x++){q=this.size2*x;A=x/this.size-e;F=A*A;for(A=u;A<n;A++){E=q+this.size*A;y=A/this.size-d;w=y*y;for(y=t;y<j;y++){v=y/this.size-b;v=g/(1.0E-6+v*v+w+F)-h;v>0&&(this.field[E+y]+=v)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,n=this.size,q=this.yd,x=this.zd,u=this.field,t=n*Math.sqrt(b/d);t>n&&(t=n);for(e=0;e<t;e++){g=e/n;g*=g;j=b/(1.0E-4+g)-d;if(j>0)for(g=0;g<n;g++){k=e+g*q;for(h=0;h<n;h++)u[x*h+k]+=j}}};this.addPlaneY=function(b,d){var e,g,
|
|
|
+j>this.size-1&&(j=this.size-1);for(var y,A,F,v,E,w;x<k;x++){q=this.size2*x;A=x/this.size-e;E=A*A;for(A=u;A<n;A++){F=q+this.size*A;y=A/this.size-d;w=y*y;for(y=t;y<j;y++){v=y/this.size-b;v=g/(1.0E-6+v*v+w+E)-h;v>0&&(this.field[F+y]+=v)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,n=this.size,q=this.yd,x=this.zd,u=this.field,t=n*Math.sqrt(b/d);t>n&&(t=n);for(e=0;e<t;e++){g=e/n;g*=g;j=b/(1.0E-4+g)-d;if(j>0)for(g=0;g<n;g++){k=e+g*q;for(h=0;h<n;h++)u[x*h+k]+=j}}};this.addPlaneY=function(b,d){var e,g,
|
|
|
h,j,k,n,q=this.size,x=this.yd,u=this.zd,t=this.field,y=q*Math.sqrt(b/d);y>q&&(y=q);for(g=0;g<y;g++){e=g/q;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=g*x;for(e=0;e<q;e++){n=k+e;for(h=0;h<q;h++)t[u*h+n]+=j}}}};this.addPlaneZ=function(b,d){var e,g,h,j,k,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){e=h/size;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=zd*h;for(g=0;g<size;g++){n=k+g*yd;for(e=0;e<size;e++)field[n+e]+=j}}}};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 d,e,g,h,j,k,n,q,x,u=this.size-2;for(h=1;h<u;h++){x=this.size2*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){q=x+this.size*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<u;e++){j=(e-this.halfsize)/this.halfsize;d=q+e;this.polygonize(j,k,n,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(e){var g,h,j,k,n,q,x,u;for(g=
|
|
|
0;g<e.count;g++){n=g*3;x=n+1;u=n+2;h=e.positionArray[n];j=e.positionArray[x];k=e.positionArray[u];q=new THREE.Vector3(h,j,k);h=e.normalArray[n];j=e.normalArray[x];k=e.normalArray[u];n=new THREE.Vector3(h,j,k);n.normalize();n=new THREE.Vertex(q,n);d.vertices.push(n)}nfaces=e.count/3;for(g=0;g<nfaces;g++){n=(b+g)*3;x=n+1;u=n+2;q=d.vertices[n].normal;h=d.vertices[x].normal;j=d.vertices[u].normal;n=new THREE.Face3(n,x,u,[q,h,j]);d.faces.push(n)}b+=nfaces;e.count=0});return d};this.init(a)};
|
|
@@ -364,22 +364,22 @@ THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.pr
|
|
|
h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
|
|
|
createBinModel:function(a,c,b,d){var e=function(g){function h(p,m){var o=q(p,m),B=q(p,m+1),C=q(p,m+2),G=q(p,m+3),Q=(G<<1&255|C>>7)-127;o|=(C&127)<<16|B<<8;if(o==0&&Q==-127)return 0;return(1-2*(G>>7))*(1+o*Math.pow(2,-23))*Math.pow(2,Q)}function j(p,m){var o=q(p,m),B=q(p,m+1),C=q(p,m+2);return(q(p,m+3)<<24)+(C<<16)+(B<<8)+o}function k(p,m){var o=q(p,m);return(q(p,m+1)<<8)+o}function n(p,m){var o=q(p,m);return o>127?o-256:o}function q(p,m){return p.charCodeAt(m)&255}function x(p){var m,o,B;m=j(a,p);
|
|
|
o=j(a,p+Z);B=j(a,p+M);p=k(a,p+f);THREE.Loader.prototype.f3(v,m,o,B,p)}function u(p){var m,o,B,C,G,Q;m=j(a,p);o=j(a,p+Z);B=j(a,p+M);C=k(a,p+f);G=j(a,p+V);Q=j(a,p+T);p=j(a,p+da);THREE.Loader.prototype.f3n(v,N,m,o,B,C,G,Q,p)}function t(p){var m,o,B,C;m=j(a,p);o=j(a,p+fa);B=j(a,p+I);C=j(a,p+ca);p=k(a,p+xa);THREE.Loader.prototype.f4(v,m,o,B,C,p)}function y(p){var m,o,B,C,G,Q,H,O;m=j(a,p);o=j(a,p+fa);B=j(a,p+I);C=j(a,p+ca);G=k(a,p+xa);Q=j(a,p+ea);H=j(a,p+va);O=j(a,p+ia);p=j(a,p+ga);THREE.Loader.prototype.f4n(v,
|
|
|
-N,m,o,B,C,G,Q,H,O,p)}function A(p){var m,o;m=j(a,p);o=j(a,p+ta);p=j(a,p+ya);THREE.Loader.prototype.uv3(v.uvs,L[m*2],L[m*2+1],L[o*2],L[o*2+1],L[p*2],L[p*2+1])}function E(p){var m,o,B;m=j(a,p);o=j(a,p+ha);B=j(a,p+aa);p=j(a,p+ma);THREE.Loader.prototype.uv4(v.uvs,L[m*2],L[m*2+1],L[o*2],L[o*2+1],L[B*2],L[B*2+1],L[p*2],L[p*2+1])}var v=this,F=0,w,N=[],L=[],Z,M,f,V,T,da,fa,I,ca,xa,ea,va,ia,ga,ta,ya,ha,aa,ma,na,R,ja,qa,l,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);w={signature:a.substr(F,
|
|
|
-8),header_bytes:q(a,F+8),vertex_coordinate_bytes:q(a,F+9),normal_coordinate_bytes:q(a,F+10),uv_coordinate_bytes:q(a,F+11),vertex_index_bytes:q(a,F+12),normal_index_bytes:q(a,F+13),uv_index_bytes:q(a,F+14),material_index_bytes:q(a,F+15),nvertices:j(a,F+16),nnormals:j(a,F+16+4),nuvs:j(a,F+16+8),ntri_flat:j(a,F+16+12),ntri_smooth:j(a,F+16+16),ntri_flat_uv:j(a,F+16+20),ntri_smooth_uv:j(a,F+16+24),nquad_flat:j(a,F+16+28),nquad_smooth:j(a,F+16+32),nquad_flat_uv:j(a,F+16+36),nquad_smooth_uv:j(a,F+16+40)};
|
|
|
-F+=w.header_bytes;Z=w.vertex_index_bytes;M=w.vertex_index_bytes*2;f=w.vertex_index_bytes*3;V=w.vertex_index_bytes*3+w.material_index_bytes;T=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;da=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;fa=w.vertex_index_bytes;I=w.vertex_index_bytes*2;ca=w.vertex_index_bytes*3;xa=w.vertex_index_bytes*4;ea=w.vertex_index_bytes*4+w.material_index_bytes;va=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;ia=
|
|
|
+N,m,o,B,C,G,Q,H,O,p)}function A(p){var m,o;m=j(a,p);o=j(a,p+ta);p=j(a,p+ya);THREE.Loader.prototype.uv3(v.uvs,L[m*2],L[m*2+1],L[o*2],L[o*2+1],L[p*2],L[p*2+1])}function F(p){var m,o,B;m=j(a,p);o=j(a,p+ha);B=j(a,p+aa);p=j(a,p+ma);THREE.Loader.prototype.uv4(v.uvs,L[m*2],L[m*2+1],L[o*2],L[o*2+1],L[B*2],L[B*2+1],L[p*2],L[p*2+1])}var v=this,E=0,w,N=[],L=[],Z,M,f,V,T,da,fa,I,ca,xa,ea,va,ia,ga,ta,ya,ha,aa,ma,na,R,ja,qa,l,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);w={signature:a.substr(E,
|
|
|
+8),header_bytes:q(a,E+8),vertex_coordinate_bytes:q(a,E+9),normal_coordinate_bytes:q(a,E+10),uv_coordinate_bytes:q(a,E+11),vertex_index_bytes:q(a,E+12),normal_index_bytes:q(a,E+13),uv_index_bytes:q(a,E+14),material_index_bytes:q(a,E+15),nvertices:j(a,E+16),nnormals:j(a,E+16+4),nuvs:j(a,E+16+8),ntri_flat:j(a,E+16+12),ntri_smooth:j(a,E+16+16),ntri_flat_uv:j(a,E+16+20),ntri_smooth_uv:j(a,E+16+24),nquad_flat:j(a,E+16+28),nquad_smooth:j(a,E+16+32),nquad_flat_uv:j(a,E+16+36),nquad_smooth_uv:j(a,E+16+40)};
|
|
|
+E+=w.header_bytes;Z=w.vertex_index_bytes;M=w.vertex_index_bytes*2;f=w.vertex_index_bytes*3;V=w.vertex_index_bytes*3+w.material_index_bytes;T=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;da=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;fa=w.vertex_index_bytes;I=w.vertex_index_bytes*2;ca=w.vertex_index_bytes*3;xa=w.vertex_index_bytes*4;ea=w.vertex_index_bytes*4+w.material_index_bytes;va=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;ia=
|
|
|
w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;ga=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;ta=w.uv_index_bytes;ya=w.uv_index_bytes*2;ha=w.uv_index_bytes;aa=w.uv_index_bytes*2;ma=w.uv_index_bytes*3;g=w.vertex_index_bytes*3+w.material_index_bytes;z=w.vertex_index_bytes*4+w.material_index_bytes;na=w.ntri_flat*g;R=w.ntri_smooth*(g+w.normal_index_bytes*3);ja=w.ntri_flat_uv*(g+w.uv_index_bytes*3);qa=w.ntri_smooth_uv*(g+w.normal_index_bytes*3+w.uv_index_bytes*
|
|
|
-3);l=w.nquad_flat*z;g=w.nquad_smooth*(z+w.normal_index_bytes*4);z=w.nquad_flat_uv*(z+w.uv_index_bytes*4);F+=function(p){for(var m,o,B,C=w.vertex_coordinate_bytes*3,G=p+w.nvertices*C;p<G;p+=C){m=h(a,p);o=h(a,p+w.vertex_coordinate_bytes);B=h(a,p+w.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,m,o,B)}return w.nvertices*C}(F);F+=function(p){for(var m,o,B,C=w.normal_coordinate_bytes*3,G=p+w.nnormals*C;p<G;p+=C){m=n(a,p);o=n(a,p+w.normal_coordinate_bytes);B=n(a,p+w.normal_coordinate_bytes*2);N.push(m/
|
|
|
-127,o/127,B/127)}return w.nnormals*C}(F);F+=function(p){for(var m,o,B=w.uv_coordinate_bytes*2,C=p+w.nuvs*B;p<C;p+=B){m=h(a,p);o=h(a,p+w.uv_coordinate_bytes);L.push(m,o)}return w.nuvs*B}(F);na=F+na;R=na+R;ja=R+ja;qa=ja+qa;l=qa+l;g=l+g;z=g+z;(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes,B=o+w.uv_index_bytes*3,C=p+w.ntri_flat_uv*B;for(m=p;m<C;m+=B){x(m);A(m+o)}return C-p})(R);(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,B=o+w.uv_index_bytes*
|
|
|
-3,C=p+w.ntri_smooth_uv*B;for(m=p;m<C;m+=B){u(m);A(m+o)}return C-p})(ja);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes,B=o+w.uv_index_bytes*4,C=p+w.nquad_flat_uv*B;for(m=p;m<C;m+=B){t(m);E(m+o)}return C-p})(g);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,B=o+w.uv_index_bytes*4,C=p+w.nquad_smooth_uv*B;for(m=p;m<C;m+=B){y(m);E(m+o)}return C-p})(z);(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes,B=p+w.ntri_flat*o;for(m=
|
|
|
-p;m<B;m+=o)x(m);return B-p})(F);(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,B=p+w.ntri_smooth*o;for(m=p;m<B;m+=o)u(m);return B-p})(na);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes,B=p+w.nquad_flat*o;for(m=p;m<B;m+=o)t(m);return B-p})(qa);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,B=p+w.nquad_smooth*o;for(m=p;m<B;m+=o)y(m);return B-p})(l);this.computeCentroids();this.computeFaceNormals()};
|
|
|
+3);l=w.nquad_flat*z;g=w.nquad_smooth*(z+w.normal_index_bytes*4);z=w.nquad_flat_uv*(z+w.uv_index_bytes*4);E+=function(p){for(var m,o,B,C=w.vertex_coordinate_bytes*3,G=p+w.nvertices*C;p<G;p+=C){m=h(a,p);o=h(a,p+w.vertex_coordinate_bytes);B=h(a,p+w.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,m,o,B)}return w.nvertices*C}(E);E+=function(p){for(var m,o,B,C=w.normal_coordinate_bytes*3,G=p+w.nnormals*C;p<G;p+=C){m=n(a,p);o=n(a,p+w.normal_coordinate_bytes);B=n(a,p+w.normal_coordinate_bytes*2);N.push(m/
|
|
|
+127,o/127,B/127)}return w.nnormals*C}(E);E+=function(p){for(var m,o,B=w.uv_coordinate_bytes*2,C=p+w.nuvs*B;p<C;p+=B){m=h(a,p);o=h(a,p+w.uv_coordinate_bytes);L.push(m,o)}return w.nuvs*B}(E);na=E+na;R=na+R;ja=R+ja;qa=ja+qa;l=qa+l;g=l+g;z=g+z;(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes,B=o+w.uv_index_bytes*3,C=p+w.ntri_flat_uv*B;for(m=p;m<C;m+=B){x(m);A(m+o)}return C-p})(R);(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,B=o+w.uv_index_bytes*
|
|
|
+3,C=p+w.ntri_smooth_uv*B;for(m=p;m<C;m+=B){u(m);A(m+o)}return C-p})(ja);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes,B=o+w.uv_index_bytes*4,C=p+w.nquad_flat_uv*B;for(m=p;m<C;m+=B){t(m);F(m+o)}return C-p})(g);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,B=o+w.uv_index_bytes*4,C=p+w.nquad_smooth_uv*B;for(m=p;m<C;m+=B){y(m);F(m+o)}return C-p})(z);(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes,B=p+w.ntri_flat*o;for(m=
|
|
|
+p;m<B;m+=o)x(m);return B-p})(E);(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,B=p+w.ntri_smooth*o;for(m=p;m<B;m+=o)u(m);return B-p})(na);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes,B=p+w.nquad_flat*o;for(m=p;m<B;m+=o)t(m);return B-p})(qa);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,B=p+w.nquad_smooth*o;for(m=p;m<B;m+=o)y(m);return B-p})(l);this.computeCentroids();this.computeFaceNormals()};
|
|
|
e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){var h,j,k,n,q;h=0;for(j=a.vertices.length;h<j;h+=3){k=a.vertices[h];n=a.vertices[h+1];q=a.vertices[h+2];THREE.Loader.prototype.v(g,k,n,q)}if(a.colors){h=0;for(j=a.colors.length;h<j;h+=3){k=a.colors[h];n=a.colors[h+1];q=a.colors[h+2];THREE.Loader.prototype.vc(g,k,n,q)}}})();(function(){function h(y,
|
|
|
-A){THREE.Loader.prototype.f3(g,y[A],y[A+1],y[A+2],y[A+3])}function j(y,A){THREE.Loader.prototype.f3n(g,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6])}function k(y,A){THREE.Loader.prototype.f4(g,y[A],y[A+1],y[A+2],y[A+3],y[A+4])}function n(y,A){THREE.Loader.prototype.f4n(g,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6],y[A+7],y[A+8])}function q(y,A){var E,v,F,w,N,L,Z,M,f;E=y[A];v=y[A+1];F=y[A+2];w=a.uvs[E*2];Z=a.uvs[E*2+1];N=a.uvs[v*2];M=a.uvs[v*2+1];L=a.uvs[F*2];f=a.uvs[F*2+1];
|
|
|
-THREE.Loader.prototype.uv3(g.uvs,w,Z,N,M,L,f);if(a.uvs2&&a.uvs2.length){w=a.uvs2[E*2];Z=a.uvs2[E*2+1];N=a.uvs2[v*2];M=a.uvs2[v*2+1];L=a.uvs2[F*2];f=a.uvs2[F*2+1];THREE.Loader.prototype.uv3(g.uvs2,w,1-Z,N,1-M,L,1-f)}}function x(y,A){var E,v,F,w,N,L,Z,M,f,V,T,da;E=y[A];v=y[A+1];F=y[A+2];w=y[A+3];N=a.uvs[E*2];f=a.uvs[E*2+1];L=a.uvs[v*2];V=a.uvs[v*2+1];Z=a.uvs[F*2];T=a.uvs[F*2+1];M=a.uvs[w*2];da=a.uvs[w*2+1];THREE.Loader.prototype.uv4(g.uvs,N,f,L,V,Z,T,M,da);if(a.uvs2){N=a.uvs2[E*2];f=a.uvs2[E*2+1];L=
|
|
|
-a.uvs2[v*2];V=a.uvs2[v*2+1];Z=a.uvs2[F*2];T=a.uvs2[F*2+1];M=a.uvs2[w*2];da=a.uvs2[w*2+1];THREE.Loader.prototype.uv4(g.uvs2,N,1-f,L,1-V,Z,1-T,M,1-da)}}var u,t;u=0;for(t=a.trianglesUvs.length;u<t;u+=7){h(a.trianglesUvs,u);q(a.trianglesUvs,u+4)}u=0;for(t=a.trianglesNormalsUvs.length;u<t;u+=10){j(a.trianglesNormalsUvs,u);q(a.trianglesNormalsUvs,u+7)}u=0;for(t=a.quadsUvs.length;u<t;u+=9){k(a.quadsUvs,u);x(a.quadsUvs,u+5)}u=0;for(t=a.quadsNormalsUvs.length;u<t;u+=13){n(a.quadsNormalsUvs,u);x(a.quadsNormalsUvs,
|
|
|
+A){THREE.Loader.prototype.f3(g,y[A],y[A+1],y[A+2],y[A+3])}function j(y,A){THREE.Loader.prototype.f3n(g,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6])}function k(y,A){THREE.Loader.prototype.f4(g,y[A],y[A+1],y[A+2],y[A+3],y[A+4])}function n(y,A){THREE.Loader.prototype.f4n(g,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6],y[A+7],y[A+8])}function q(y,A){var F,v,E,w,N,L,Z,M,f;F=y[A];v=y[A+1];E=y[A+2];w=a.uvs[F*2];Z=a.uvs[F*2+1];N=a.uvs[v*2];M=a.uvs[v*2+1];L=a.uvs[E*2];f=a.uvs[E*2+1];
|
|
|
+THREE.Loader.prototype.uv3(g.uvs,w,Z,N,M,L,f);if(a.uvs2&&a.uvs2.length){w=a.uvs2[F*2];Z=a.uvs2[F*2+1];N=a.uvs2[v*2];M=a.uvs2[v*2+1];L=a.uvs2[E*2];f=a.uvs2[E*2+1];THREE.Loader.prototype.uv3(g.uvs2,w,1-Z,N,1-M,L,1-f)}}function x(y,A){var F,v,E,w,N,L,Z,M,f,V,T,da;F=y[A];v=y[A+1];E=y[A+2];w=y[A+3];N=a.uvs[F*2];f=a.uvs[F*2+1];L=a.uvs[v*2];V=a.uvs[v*2+1];Z=a.uvs[E*2];T=a.uvs[E*2+1];M=a.uvs[w*2];da=a.uvs[w*2+1];THREE.Loader.prototype.uv4(g.uvs,N,f,L,V,Z,T,M,da);if(a.uvs2){N=a.uvs2[F*2];f=a.uvs2[F*2+1];L=
|
|
|
+a.uvs2[v*2];V=a.uvs2[v*2+1];Z=a.uvs2[E*2];T=a.uvs2[E*2+1];M=a.uvs2[w*2];da=a.uvs2[w*2+1];THREE.Loader.prototype.uv4(g.uvs2,N,1-f,L,1-V,Z,1-T,M,1-da)}}var u,t;u=0;for(t=a.trianglesUvs.length;u<t;u+=7){h(a.trianglesUvs,u);q(a.trianglesUvs,u+4)}u=0;for(t=a.trianglesNormalsUvs.length;u<t;u+=10){j(a.trianglesNormalsUvs,u);q(a.trianglesNormalsUvs,u+7)}u=0;for(t=a.quadsUvs.length;u<t;u+=9){k(a.quadsUvs,u);x(a.quadsUvs,u+5)}u=0;for(t=a.quadsNormalsUvs.length;u<t;u+=13){n(a.quadsNormalsUvs,u);x(a.quadsNormalsUvs,
|
|
|
u+9)}u=0;for(t=a.triangles.length;u<t;u+=4)h(a.triangles,u);u=0;for(t=a.trianglesNormals.length;u<t;u+=7)j(a.trianglesNormals,u);u=0;for(t=a.quads.length;u<t;u+=5)k(a.quads,u);u=0;for(t=a.quadsNormals.length;u<t;u+=9)n(a.quadsNormals,u)})();(function(){var h,j,k,n;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<j;h+=2){k=a.skinWeights[h];n=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,k,n,0,0)}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];n=a.skinIndices[h+1];
|
|
|
THREE.Loader.prototype.si(g,k,n,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))},bones:function(a,c){a.bones=c},animation:function(a,c){a.animation=c},si:function(a,c,b,d,e){a.skinIndices.push(new THREE.Vector4(c,b,d,e))},sw:function(a,c,b,d,e){a.skinWeights.push(new THREE.Vector4(c,b,d,e))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,
|
|
|
b,d)))},vc:function(a,c,b,d){var e=new THREE.Color(16777215);e.setRGB(c,b,d);a.colors.push(e)},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,a.materials[e]))},f4:function(a,c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,a.materials[g]))},f3n:function(a,c,b,d,e,g,h,j,k){g=a.materials[g];var n=c[j*3],q=c[j*3+1];j=c[j*3+2];var x=c[k*3],u=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(n,q,j),new THREE.Vector3(x,
|
|
|
-u,k)],g))},f4n:function(a,c,b,d,e,g,h,j,k,n,q){h=a.materials[h];var x=c[k*3],u=c[k*3+1];k=c[k*3+2];var t=c[n*3],y=c[n*3+1];n=c[n*3+2];var A=c[q*3],E=c[q*3+1];q=c[q*3+2];a.faces.push(new THREE.Face4(b,d,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(x,u,k),new THREE.Vector3(t,y,n),new THREE.Vector3(A,E,q)],h))},uv3:function(a,c,b,d,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,d,e,g,h,j,k){var n=[];n.push(new THREE.UV(c,
|
|
|
+u,k)],g))},f4n:function(a,c,b,d,e,g,h,j,k,n,q){h=a.materials[h];var x=c[k*3],u=c[k*3+1];k=c[k*3+2];var t=c[n*3],y=c[n*3+1];n=c[n*3+2];var A=c[q*3],F=c[q*3+1];q=c[q*3+2];a.faces.push(new THREE.Face4(b,d,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(x,u,k),new THREE.Vector3(t,y,n),new THREE.Vector3(A,F,q)],h))},uv3:function(a,c,b,d,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,d,e,g,h,j,k){var n=[];n.push(new THREE.UV(c,
|
|
|
b));n.push(new THREE.UV(d,e));n.push(new THREE.UV(g,h));n.push(new THREE.UV(j,k));a.push(n)},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var n=new Image;n.onload=function(){if(!b(this.width)||!b(this.height)){var q=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/
|
|
|
Math.LN2));j.image.width=q;j.image.height=x;j.image.getContext("2d").drawImage(this,0,0,q,x)}else j.image=this;j.needsUpdate=!0};n.src=k}var e,g,h;e="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
|
|
|
255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|