|
@@ -12,33 +12,33 @@ 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,b,c,d){this.set(a||0,b||0,c||0,d||1)};
|
|
|
THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.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,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.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,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
|
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(D,v,E,w){w=w.clone().subSelf(v);E=E.clone().subSelf(v);var M=D.clone().subSelf(v);D=w.dot(w);v=w.dot(E);w=w.dot(M);var K=E.dot(E);E=E.dot(M);M=1/(D*K-v*v);K=(K*w-v*E)*M;D=(D*E-v*w)*M;return K>0&&D>0&&K+D<1}var c,d,f,g,h,j,k,n,q,x,
|
|
|
-u,t=a.geometry,y=t.vertices,B=[];c=0;for(d=t.faces.length;c<d;c++){f=t.faces[c];x=this.origin.clone();u=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(y[f.a].position.clone());h=k.multiplyVector3(y[f.b].position.clone());j=k.multiplyVector3(y[f.c].position.clone());k=f instanceof THREE.Face4?k.multiplyVector3(y[f.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(f.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));
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(D,v,E,w){w=w.clone().subSelf(v);E=E.clone().subSelf(v);var O=D.clone().subSelf(v);D=w.dot(w);v=w.dot(E);w=w.dot(O);var L=E.dot(E);E=E.dot(O);O=1/(D*L-v*v);L=(L*w-v*E)*O;D=(D*E-v*w)*O;return L>0&&D>0&&L+D<1}var c,d,f,g,h,j,k,o,q,x,
|
|
|
+u,t=a.geometry,z=t.vertices,B=[];c=0;for(d=t.faces.length;c<d;c++){f=t.faces[c];x=this.origin.clone();u=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(z[f.a].position.clone());h=k.multiplyVector3(z[f.b].position.clone());j=k.multiplyVector3(z[f.c].position.clone());k=f instanceof THREE.Face4?k.multiplyVector3(z[f.d].position.clone()):null;o=a.matrixRotationWorld.multiplyVector3(f.normal.clone());q=u.dot(o);if(q<0){o=o.dot((new THREE.Vector3).sub(g,x))/q;x=x.addSelf(u.multiplyScalar(o));
|
|
|
if(f instanceof THREE.Face3){if(b(x,g,h,j)){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};B.push(f)}}else if(f instanceof THREE.Face4&&(b(x,g,h,k)||b(x,h,j,k))){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};B.push(f)}}}return B}};
|
|
|
-THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(k,n,q,x){j=!1;b=k;c=n;d=q;f=x;a()};this.addPoint=function(k,n){if(j){j=!1;b=k;c=n;d=k;f=n}else{b=b<k?b:k;c=c<n?c:n;d=d>k?d:k;f=f>n?f:n}a()};
|
|
|
-this.add3Points=function(k,n,q,x,u,t){if(j){j=!1;b=k<q?k<u?k:u:q<u?q:u;c=n<x?n<t?n:t:x<t?x:t;d=k>q?k>u?k:u:q>u?q:u;f=n>x?n>t?n:t:x>t?x:t}else{b=k<q?k<u?k<b?k:b:u<b?u:b:q<u?q<b?q:b:u<b?u:b;c=n<x?n<t?n<c?n:c:t<c?t:c:x<t?x<c?x:c:t<c?t:c;d=k>q?k>u?k>d?k:d:u>d?u:d:q>u?q>d?q:d:u>d?u:d;f=n>x?n>t?n>f?n:f:t>f?t:f:x>t?x>f?x:f:t>f?t:f}a()};this.addRectangle=function(k){if(j){j=!1;b=k.getLeft();c=k.getTop();d=k.getRight();f=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();c=c<k.getTop()?c:k.getTop();d=d>k.getRight()?
|
|
|
+THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(k,o,q,x){j=!1;b=k;c=o;d=q;f=x;a()};this.addPoint=function(k,o){if(j){j=!1;b=k;c=o;d=k;f=o}else{b=b<k?b:k;c=c<o?c:o;d=d>k?d:k;f=f>o?f:o}a()};
|
|
|
+this.add3Points=function(k,o,q,x,u,t){if(j){j=!1;b=k<q?k<u?k:u:q<u?q:u;c=o<x?o<t?o:t:x<t?x:t;d=k>q?k>u?k:u:q>u?q:u;f=o>x?o>t?o:t:x>t?x:t}else{b=k<q?k<u?k<b?k:b:u<b?u:b:q<u?q<b?q:b:u<b?u:b;c=o<x?o<t?o<c?o:c:t<c?t:c:x<t?x<c?x:c:t<c?t:c;d=k>q?k>u?k>d?k:d:u>d?u:d:q>u?q>d?q:d:u>d?u:d;f=o>x?o>t?o>f?o:f:t>f?t:f:x>t?x>f?x:f:t>f?t:f}a()};this.addRectangle=function(k){if(j){j=!1;b=k.getLeft();c=k.getTop();d=k.getRight();f=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();c=c<k.getTop()?c:k.getTop();d=d>k.getRight()?
|
|
|
d:k.getRight();f=f>k.getBottom()?f:k.getBottom()}a()};this.inflate=function(k){b-=k;c-=k;d+=k;f+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();d=d<k.getRight()?d:k.getRight();f=f<k.getBottom()?f:k.getBottom();a()};this.instersects=function(k){return Math.min(d,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(f,k.getBottom())-Math.max(c,k.getTop())>=0};this.empty=function(){j=!0;f=d=c=b=0;a()};this.isEmpty=function(){return j}};
|
|
|
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
|
-THREE.Matrix4=function(a,b,c,d,f,g,h,j,k,n,q,x,u,t,y,B){this.set(a||1,b||0,c||0,d||0,f||0,g||1,h||0,j||0,k||0,n||0,q||1,x||0,u||0,t||0,y||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,h,j,k,n,q,x,u,t,y,B){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;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=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
|
|
|
+THREE.Matrix4=function(a,b,c,d,f,g,h,j,k,o,q,x,u,t,z,B){this.set(a||1,b||0,c||0,d||0,f||0,g||1,h||0,j||0,k||0,o||0,q||1,x||0,u||0,t||0,z||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,h,j,k,o,q,x,u,t,z,B){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=o;this.n33=q;this.n34=x;this.n41=u;this.n42=t;this.n43=z;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
|
|
|
f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(c,g).normalize()}f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*
|
|
|
d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
|
|
|
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=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,B=a.n42,D=a.n43,v=a.n44,E=b.n11,w=b.n12,M=b.n13,K=b.n14,Y=b.n21,L=b.n22,
|
|
|
-e=b.n23,X=b.n24,T=b.n31,ca=b.n32,ea=b.n33,I=b.n34;this.n11=c*E+d*Y+f*T;this.n12=c*w+d*L+f*ca;this.n13=c*M+d*e+f*ea;this.n14=c*K+d*X+f*I+g;this.n21=h*E+j*Y+k*T;this.n22=h*w+j*L+k*ca;this.n23=h*M+j*e+k*ea;this.n24=h*K+j*X+k*I+n;this.n31=q*E+x*Y+u*T;this.n32=q*w+x*L+u*ca;this.n33=q*M+x*e+u*ea;this.n34=q*K+x*X+u*I+t;this.n41=y*E+B*Y+D*T;this.n42=y*w+B*L+D*ca;this.n43=y*M+B*e+D*ea;this.n44=y*K+B*X+D*I+v;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;
|
|
|
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,o=a.n24,q=a.n31,x=a.n32,u=a.n33,t=a.n34,z=a.n41,B=a.n42,D=a.n43,v=a.n44,E=b.n11,w=b.n12,O=b.n13,L=b.n14,Y=b.n21,M=b.n22,
|
|
|
+e=b.n23,X=b.n24,S=b.n31,da=b.n32,ga=b.n33,I=b.n34;this.n11=c*E+d*Y+f*S;this.n12=c*w+d*M+f*da;this.n13=c*O+d*e+f*ga;this.n14=c*L+d*X+f*I+g;this.n21=h*E+j*Y+k*S;this.n22=h*w+j*M+k*da;this.n23=h*O+j*e+k*ga;this.n24=h*L+j*X+k*I+o;this.n31=q*E+x*Y+u*S;this.n32=q*w+x*M+u*da;this.n33=q*O+x*e+u*ga;this.n34=q*L+x*X+u*I+t;this.n41=z*E+B*Y+D*S;this.n42=z*w+B*M+D*da;this.n43=z*O+B*e+D*ga;this.n44=z*L+B*X+D*I+v;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;
|
|
|
c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
|
|
|
-this.n11,b=this.n12,c=this.n13,d=this.n14,f=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,B=this.n44;return d*h*n*u-c*j*n*u-d*g*q*u+b*j*q*u+c*g*x*u-b*h*x*u-d*h*k*t+c*j*k*t+d*f*q*t-a*j*q*t-c*f*x*t+a*h*x*t+d*g*k*y-b*j*k*y-d*f*n*y+a*j*n*y+b*f*x*y-a*g*x*y-c*g*k*B+b*h*k*B+c*f*n*B-a*h*n*B-b*f*q*B+a*g*q*B},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.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,o=this.n32,q=this.n33,x=this.n34,u=this.n41,t=this.n42,z=this.n43,B=this.n44;return d*h*o*u-c*j*o*u-d*g*q*u+b*j*q*u+c*g*x*u-b*h*x*u-d*h*k*t+c*j*k*t+d*f*q*t-a*j*q*t-c*f*x*t+a*h*x*t+d*g*k*z-b*j*k*z-d*f*o*z+a*j*o*z+b*f*x*z-a*g*x*z-c*g*k*B+b*h*k*B+c*f*o*B-a*h*o*B-b*f*q*B+a*g*q*B},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
|
|
|
this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
|
|
|
this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
|
|
|
this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
|
|
|
-b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,j=a.z,k=f*g,n=f*h;this.set(k*
|
|
|
-g+c,k*h-d*j,k*j+d*h,0,k*h+d*j,n*h+c,n*j-d*g,0,k*j-d*h,n*j+d*g,f*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=a*c,j=b*c;this.n11=f*g;this.n12=-f*d;this.n13=c;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-b*f;this.n31=-h*g+b*d;this.n32=h*d+b*g;this.n33=a*f;return this},setRotationFromQuaternion:function(a){var b=
|
|
|
-a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,j=d+d;a=b*g;var k=b*h;b*=j;var n=c*h;c*=j;d*=j;g*=f;h*=f;f*=j;this.n11=1-(n+d);this.n12=k-f;this.n13=b+h;this.n21=k+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+n);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
|
|
|
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,j=a.z,k=f*g,o=f*h;this.set(k*
|
|
|
+g+c,k*h-d*j,k*j+d*h,0,k*h+d*j,o*h+c,o*j-d*g,0,k*j-d*h,o*j+d*g,f*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=a*c,j=b*c;this.n11=f*g;this.n12=-f*d;this.n13=c;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-b*f;this.n31=-h*g+b*d;this.n32=h*d+b*g;this.n33=a*f;return this},setRotationFromQuaternion:function(a){var b=
|
|
|
+a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,j=d+d;a=b*g;var k=b*h;b*=j;var o=c*h;c*=j;d*=j;g*=f;h*=f;f*=j;this.n11=1-(o+d);this.n12=k-f;this.n13=b+h;this.n21=k+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+o);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
|
|
|
a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
|
|
|
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=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,B=a.n42,D=a.n43,v=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*t*B-n*u*B+n*x*D-j*t*D-k*x*v+j*u*v;b.n12=g*u*B-f*t*B-g*x*D+d*t*D+f*x*v-d*u*v;b.n13=f*n*B-g*k*B+g*j*D-d*n*D-f*j*v+d*k*v;b.n14=g*k*x-f*n*x-g*j*u+d*n*u+f*j*t-d*k*t;b.n21=n*u*y-k*t*y-n*q*D+h*t*D+k*q*v-h*u*v;b.n22=f*t*y-g*u*y+g*q*D-c*t*D-f*q*v+c*u*v;b.n23=g*k*y-f*n*y-g*h*D+c*n*D+f*h*v-c*k*v;
|
|
|
-b.n24=f*n*q-g*k*q+g*h*u-c*n*u-f*h*t+c*k*t;b.n31=j*t*y-n*x*y+n*q*B-h*t*B-j*q*v+h*x*v;b.n32=g*x*y-d*t*y-g*q*B+c*t*B+d*q*v-c*x*v;b.n33=f*n*y-g*j*y+g*h*B-c*n*B-d*h*v+c*j*v;b.n34=g*j*q-d*n*q-g*h*x+c*n*x+d*h*t-c*j*t;b.n41=k*x*y-j*u*y-k*q*B+h*u*B+j*q*D-h*x*D;b.n42=d*u*y-f*x*y+f*q*B-c*u*B-d*q*D+c*x*D;b.n43=f*j*y-d*k*y-f*h*B+c*k*B+d*h*D-c*j*D;b.n44=d*k*q-f*j*q+f*h*x-c*k*x-d*h*u+c*j*u;b.multiplyScalar(1/a.determinant());return b};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-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;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*j;c[5]=a*k;c[6]=a*n;c[7]=a*q;c[8]=a*x;return b};
|
|
|
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,o=a.n24,q=a.n31,x=a.n32,u=a.n33,t=a.n34,z=a.n41,B=a.n42,D=a.n43,v=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*t*B-o*u*B+o*x*D-j*t*D-k*x*v+j*u*v;b.n12=g*u*B-f*t*B-g*x*D+d*t*D+f*x*v-d*u*v;b.n13=f*o*B-g*k*B+g*j*D-d*o*D-f*j*v+d*k*v;b.n14=g*k*x-f*o*x-g*j*u+d*o*u+f*j*t-d*k*t;b.n21=o*u*z-k*t*z-o*q*D+h*t*D+k*q*v-h*u*v;b.n22=f*t*z-g*u*z+g*q*D-c*t*D-f*q*v+c*u*v;b.n23=g*k*z-f*o*z-g*h*D+c*o*D+f*h*v-c*k*v;
|
|
|
+b.n24=f*o*q-g*k*q+g*h*u-c*o*u-f*h*t+c*k*t;b.n31=j*t*z-o*x*z+o*q*B-h*t*B-j*q*v+h*x*v;b.n32=g*x*z-d*t*z-g*q*B+c*t*B+d*q*v-c*x*v;b.n33=f*o*z-g*j*z+g*h*B-c*o*B-d*h*v+c*j*v;b.n34=g*j*q-d*o*q-g*h*x+c*o*x+d*h*t-c*j*t;b.n41=k*x*z-j*u*z-k*q*B+h*u*B+j*q*D-h*x*D;b.n42=d*u*z-f*x*z+f*q*B-c*u*B-d*q*D+c*x*D;b.n43=f*j*z-d*k*z-f*h*B+c*k*B+d*h*D-c*j*D;b.n44=d*k*q-f*j*q+f*h*x-c*k*x-d*h*u+c*j*u;b.multiplyScalar(1/a.determinant());return b};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-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,o=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*o;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*j;c[5]=a*k;c[6]=a*o;c[7]=a*q;c[8]=a*x;return b};
|
|
|
THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
|
|
|
-THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,j,k,n;h=new THREE.Matrix4;j=b-a;k=c-d;n=g-f;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((b+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((c+d)/k);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((g+f)/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;
|
|
|
+THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,j,k,o;h=new THREE.Matrix4;j=b-a;k=c-d;o=g-f;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((b+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((c+d)/k);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((g+f)/o);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;
|
|
|
THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
|
|
|
!0;this._vector=new THREE.Vector3};
|
|
|
THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
|
|
@@ -47,22 +47,22 @@ undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b
|
|
|
b,c)}}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
|
|
|
THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,j=d*f;this.w=h*g-j*c;this.x=h*c+j*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
|
|
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=b*a+f*g+c*j-d*h;this.y=c*a+f*h+d*g-b*j;this.z=d*a+f*j+b*h-c*g;this.w=f*a-b*g-c*h-d*j;return this},
|
|
|
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,j=this.z,k=this.w,n=k*c+h*f-j*d,q=k*d+j*c-g*f,x=k*f+g*d-h*c;c=-g*c-h*d-j*f;b.x=n*k+c*-g+q*-j-x*-h;b.y=q*k+c*-h+x*-g-n*-j;b.z=x*k+c*-j+n*-h-q*-g;return b}};
|
|
|
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,j=this.z,k=this.w,o=k*c+h*f-j*d,q=k*d+j*c-g*f,x=k*f+g*d-h*c;c=-g*c-h*d-j*f;b.x=o*k+c*-g+q*-j-x*-h;b.y=q*k+c*-h+x*-g-o*-j;b.z=x*k+c*-j+o*-h-q*-g;return b}};
|
|
|
THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
|
|
|
THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
|
|
|
THREE.Face3=function(a,b,c,d,f){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};THREE.Face4=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g]};
|
|
|
-THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.vertexKeys=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
+THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
|
|
|
c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,j=new THREE.Vector3,k=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){j.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)j.addSelf(g.vertexNormals[b]);j.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,
|
|
|
c.position);k.sub(b.position,c.position);j.crossSelf(k)}j.isZero()||j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
|
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
|
|
|
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(I,aa,Ba,da,xa,ia,fa){g=I.vertices[aa].position;h=I.vertices[Ba].position;j=I.vertices[da].position;k=f[xa];n=f[ia];q=f[fa];x=h.x-g.x;u=j.x-g.x;t=h.y-g.y;
|
|
|
-y=j.y-g.y;B=h.z-g.z;D=j.z-g.z;v=n.u-k.u;E=q.u-k.u;w=n.v-k.v;M=q.v-k.v;K=1/(v*M-E*w);e.set((M*x-w*u)*K,(M*t-w*y)*K,(M*B-w*D)*K);X.set((v*u-E*x)*K,(v*y-E*t)*K,(v*D-E*B)*K);Y[aa].addSelf(e);Y[Ba].addSelf(e);Y[da].addSelf(e);L[aa].addSelf(X);L[Ba].addSelf(X);L[da].addSelf(X)}var b,c,d,f,g,h,j,k,n,q,x,u,t,y,B,D,v,E,w,M,K,Y=[],L=[],e=new THREE.Vector3,X=new THREE.Vector3,T=new THREE.Vector3,ca=new THREE.Vector3,ea=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){Y[b]=new THREE.Vector3;L[b]=new THREE.Vector3}b=
|
|
|
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(I,ca,za,ea,xa,ja,ha){g=I.vertices[ca].position;h=I.vertices[za].position;j=I.vertices[ea].position;k=f[xa];o=f[ja];q=f[ha];x=h.x-g.x;u=j.x-g.x;t=h.y-g.y;
|
|
|
+z=j.y-g.y;B=h.z-g.z;D=j.z-g.z;v=o.u-k.u;E=q.u-k.u;w=o.v-k.v;O=q.v-k.v;L=1/(v*O-E*w);e.set((O*x-w*u)*L,(O*t-w*z)*L,(O*B-w*D)*L);X.set((v*u-E*x)*L,(v*z-E*t)*L,(v*D-E*B)*L);Y[ca].addSelf(e);Y[za].addSelf(e);Y[ea].addSelf(e);M[ca].addSelf(X);M[za].addSelf(X);M[ea].addSelf(X)}var b,c,d,f,g,h,j,k,o,q,x,u,t,z,B,D,v,E,w,O,L,Y=[],M=[],e=new THREE.Vector3,X=new THREE.Vector3,S=new THREE.Vector3,da=new THREE.Vector3,ga=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){Y[b]=new THREE.Vector3;M[b]=new THREE.Vector3}b=
|
|
|
0;for(c=this.faces.length;b<c;b++){d=this.faces[b];f=this.uvs[b];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])}}b=0;for(c=this.vertices.length;b<c;b++){ea.copy(this.vertices[b].normal);d=Y[b];T.copy(d);T.subSelf(ea.multiplyScalar(ea.dot(d))).normalize();ca.cross(this.vertices[b].normal,d);d=ca.dot(L[b]);d=d<0?-1:1;this.vertices[b].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],
|
|
|
+this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){ga.copy(this.vertices[b].normal);d=Y[b];S.copy(d);S.subSelf(ga.multiplyScalar(ga.dot(d))).normalize();da.cross(this.vertices[b].normal,d);d=da.dot(M[b]);d=d<0?-1:1;this.vertices[b].tangent.set(S.x,S.y,S.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 b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
|
this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.Spline=function(){function a(u,t,y,B,D,v,E){u=(y-u)*0.5;B=(B-t)*0.5;return(2*(t-y)+u+B)*E+(-3*(t-y)-2*u-B)*v+u*D+t}var b=[],c={x:0,y:0,z:0},d,f,g,h,j,k,n,q,x;this.get2DPoint=function(u,t){d=(u.length-1)*t;f=Math.floor(d);g=d-f;b[0]=f==0?f:f-1;b[1]=f;b[2]=f>u.length-2?f:f+1;b[3]=f>u.length-3?f:f+2;k=u[b[0]];n=u[b[1]];q=u[b[2]];x=u[b[3]];h=g*g;j=g*h;c.x=a(k.x,n.x,q.x,x.x,g,h,j);c.y=a(k.y,n.y,q.y,x.y,g,h,j);c.z=a(k.z,n.z,q.z,x.z,g,h,j);return c}};
|
|
|
+THREE.Spline=function(){function a(u,t,z,B,D,v,E){u=(z-u)*0.5;B=(B-t)*0.5;return(2*(t-z)+u+B)*E+(-3*(t-z)-2*u-B)*v+u*D+t}var b=[],c={x:0,y:0,z:0},d,f,g,h,j,k,o,q,x;this.get2DPoint=function(u,t){d=(u.length-1)*t;f=Math.floor(d);g=d-f;b[0]=f==0?f:f-1;b[1]=f;b[2]=f>u.length-2?f:f+1;b[3]=f>u.length-3?f:f+2;k=u[b[0]];o=u[b[1]];q=u[b[2]];x=u[b[3]];h=g*g;j=g*h;c.x=a(k.x,o.x,q.x,x.x,g,h,j);c.y=a(k.y,o.y,q.y,x.y,g,h,j);c.z=a(k.z,o.z,q.z,x.z,g,h,j);return c}};
|
|
|
THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(f){for(var g=0;g<a.length;g++)a[g].update(f)};c.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};c.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};c.add=function(f){b[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");b[f.name]=f;if(f.initialized!==!0){for(var g=0;g<f.hierarchy.length;g++){for(var h=0;h<f.hierarchy[g].keys.length;h++){if(f.hierarchy[g].keys[h].time<
|
|
|
0)f.hierarchy[g].keys[h].time=0;if(f.hierarchy[g].keys[h].rot!==undefined&&!(f.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var j=f.hierarchy[g].keys[h].rot;f.hierarchy[g].keys[h].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}for(h=1;h<f.hierarchy[g].keys.length;h++)if(f.hierarchy[g].keys[h].time===f.hierarchy[g].keys[h-1].time){f.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<f.hierarchy[g].keys.length;h++)f.hierarchy[g].keys[h].index=h}h=parseInt(f.length*f.fps,10);f.JIT={};f.JIT.hierarchy=
|
|
|
[];for(g=0;g<f.hierarchy.length;g++)f.JIT.hierarchy.push(Array(h));f.initialized=!0}};c.get=function(f){if(typeof f==="string")if(b[f])return b[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};c.parse=function(f){var g=[];if(f instanceof THREE.SkinnedMesh)for(var h=0;h<f.bones.length;h++)g.push(f.bones[h]);else d(f,g);return g};var d=function(f,g){g.push(f);for(var h=0;h<f.children.length;h++)d(f.children[h],g)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
|
|
@@ -71,11 +71,11 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
|
|
|
this.hierarchy[c]instanceof THREE.Bone?this.hierarchy[c].skinMatrix:this.hierarchy[c].matrix}var d=this.hierarchy[c].animationCache.prevKey,f=this.hierarchy[c].animationCache.nextKey;d.pos=this.data.hierarchy[c].keys[0];d.rot=this.data.hierarchy[c].keys[0];d.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.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 b=["pos","rot","scl"],c,d,f,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 B=0;B<3;B++){c=b[B];h=k.prevKey[c];j=k.nextKey[c];if(j.time<=u){if(x<=u)if(this.loop){h=this.data.hierarchy[t].keys[0];for(j=this.getNextKeyWith(c,t,1);j.time<x;){h=j;j=this.getNextKeyWith(c,t,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(c,t,j.index+1)}while(j.time<
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,f,g,h,j,k,o,q=this.data.JIT.hierarchy,x,u;this.currentTime+=a;u=this.currentTime;x=this.currentTime%=this.data.length;o=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,z=this.hierarchy.length;t<z;t++){a=this.hierarchy[t];k=a.animationCache;if(this.JITCompile&&q[t][o]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=q[t][o];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
|
|
|
+!1}else{a.matrix=q[t][o];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 B=0;B<3;B++){c=b[B];h=k.prevKey[c];j=k.nextKey[c];if(j.time<=u){if(x<=u)if(this.loop){h=this.data.hierarchy[t].keys[0];for(j=this.getNextKeyWith(c,t,1);j.time<x;){h=j;j=this.getNextKeyWith(c,t,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(c,t,j.index+1)}while(j.time<
|
|
|
x)}k.prevKey[c]=h;k.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-h.time)/(j.time-h.time);f=h[c];g=j[c];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(c==="pos")if(this.interpolationType===THREE.AnimationHandler.LINEAR){c=a.position;c.x=f[0]+(g[0]-f[0])*d;c.y=f[1]+(g[1]-f[1])*d;c.z=f[2]+(g[2]-f[2])*d}else{var D=[];D[0]=this.getPrevKeyWith(c,t,h.index-1)[c];D[1]=f;D[2]=g;D[3]=this.getNextKeyWith(c,t,j.index+1)[c];
|
|
|
-d=d*0.33+0.33;d=this.interpolateCatmullRom(D,d);a.position.x=d[0];a.position.y=d[1];a.position.z=d[2]}else if(c==="rot")THREE.Quaternion.slerp(f,g,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=f[0]+(g[0]-f[0])*d;c.y=f[1]+(g[1]-f[1])*d;c.z=f[2]+(g[2]-f[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,b){var c=[],d=[],f,g,h,j,k,n;f=(a.length-1)*b;g=Math.floor(f);f-=g;c[0]=g==0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];j=a[c[1]];k=a[c[2]];n=a[c[3]];c=f*f;h=f*c;d[0]=this.interpolate(g[0],j[0],k[0],n[0],f,c,h);d[1]=this.interpolate(g[1],j[1],k[1],n[1],f,c,h);d[2]=this.interpolate(g[2],j[2],k[2],n[2],f,c,h);return d};
|
|
|
+d=d*0.33+0.33;d=this.interpolateCatmullRom(D,d);a.position.x=d[0];a.position.y=d[1];a.position.z=d[2]}else if(c==="rot")THREE.Quaternion.slerp(f,g,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=f[0]+(g[0]-f[0])*d;c.y=f[1]+(g[1]-f[1])*d;c.z=f[2]+(g[2]-f[2])*d}}}}if(this.JITCompile&&q[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(t=0;t<this.hierarchy.length;t++)q[t][o]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],f,g,h,j,k,o;f=(a.length-1)*b;g=Math.floor(f);f-=g;c[0]=g==0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];j=a[c[1]];k=a[c[2]];o=a[c[3]];c=f*f;h=f*c;d[0]=this.interpolate(g[0],j[0],k[0],o[0],f,c,h);d[1]=this.interpolate(g[1],j[1],k[1],o[1],f,c,h);d[2]=this.interpolate(g[2],j[2],k[2],o[2],f,c,h);return d};
|
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,d,f,g,h){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*g+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(c%=d.length;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[d.length-1]};THREE.Camera=function(a,b,c,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=f||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,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
@@ -93,25 +93,25 @@ THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLig
|
|
|
THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
|
|
THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
|
|
|
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
|
|
|
-THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.vertexAnimated=
|
|
|
-!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;
|
|
|
+THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
|
|
|
+if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;
|
|
|
if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;
|
|
|
-if(a.vertexAnimated!==undefined)this.vertexAnimated=a.vertexAnimated}};
|
|
|
-THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.vertexAnimated=
|
|
|
+if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
|
|
|
+THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=
|
|
|
!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;
|
|
|
if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;
|
|
|
-if(a.vertexAnimated!==undefined)this.vertexAnimated=a.vertexAnimated}};
|
|
|
+if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
|
|
|
THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=
|
|
|
-this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.vertexAnimated=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.map!==undefined)this.map=a.map;if(a.envMap!==undefined)this.envMap=
|
|
|
+this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.map!==undefined)this.map=a.map;if(a.envMap!==undefined)this.envMap=
|
|
|
a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;
|
|
|
-if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.vertexAnimated!==undefined)this.vertexAnimated=a.vertexAnimated}};
|
|
|
+if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
|
|
|
THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
|
|
|
undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
|
|
|
THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
|
|
|
undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
|
|
|
-THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.vertexAnimated=!1;if(a){if(a.fragmentShader!==undefined)this.fragmentShader=a.fragmentShader;if(a.vertexShader!==
|
|
|
-undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;
|
|
|
-if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.vertexAnimated!==undefined)this.vertexAnimated=a.vertexAnimated}};
|
|
|
+THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;if(a){if(a.fragmentShader!==undefined)this.fragmentShader=a.fragmentShader;if(a.vertexShader!==undefined)this.vertexShader=
|
|
|
+a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==
|
|
|
+undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
|
|
|
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==
|
|
|
undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
|
|
THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Texture=function(a,b,c,d,f,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};
|
|
@@ -120,8 +120,8 @@ THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedInt
|
|
|
THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
|
|
|
var Uniforms={clone:function(a){var b,c,d,f={};for(b in a){f[b]={};for(c in a[b]){d=a[b][c];f[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return f},merge:function(a){var b,c,d,f={};for(b=0;b<a.length;b++){d=this.clone(a[b]);for(c in d)f[c]=d[c]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
|
|
|
THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
|
-THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
|
|
-THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
|
+THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=0;this.morphTargetInfluences=[];for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0)}}};
|
|
|
+THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
|
|
|
b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,f,g,h,j;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){f=this.geometry.bones[c];g=f.pos;h=f.rotq;j=f.scl;d=this.addBone();d.name=f.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);d.useQuaternion=!0;j!==undefined?d.scale.set(j[0],j[1],j[2]):d.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){f=this.geometry.bones[c];
|
|
@@ -145,162 +145,163 @@ THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.O
|
|
|
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 b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
|
|
|
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 b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
|
|
|
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,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
|
-THREE.Projector=function(){function a(L,e){return e.z-L.z}function b(L,e){var X=0,T=1,ca=L.z+L.w,ea=e.z+e.w,I=-L.z+L.w,aa=-e.z+e.w;if(ca>=0&&ea>=0&&I>=0&&aa>=0)return!0;else if(ca<0&&ea<0||I<0&&aa<0)return!1;else{if(ca<0)X=Math.max(X,ca/(ca-ea));else ea<0&&(T=Math.min(T,ca/(ca-ea)));if(I<0)X=Math.max(X,I/(I-aa));else aa<0&&(T=Math.min(T,I/(I-aa)));if(T<X)return!1;else{L.lerpSelf(e,X);e.lerpSelf(L,1-T);return!0}}}var c,d,f=[],g,h,j,k=[],n,q,x=[],u,t,y=[],B=new THREE.Vector4,D=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],M=new THREE.Vector4,K=new THREE.Vector4,Y;this.projectObjects=function(L,e,X){e=[];var T,ca,ea;d=0;ca=L.objects;L=0;for(T=ca.length;L<T;L++){ea=ca[L];var I;if(!(I=!ea.visible))if(I=ea instanceof THREE.Mesh){a:{I=void 0;for(var aa=ea.matrixWorld,Ba=-ea.geometry.boundingSphere.radius*Math.max(ea.scale.x,Math.max(ea.scale.y,ea.scale.z)),da=0;da<6;da++){I=w[da].x*aa.n14+
|
|
|
-w[da].y*aa.n24+w[da].z*aa.n34+w[da].w;if(I<=Ba){I=!1;break a}}I=!0}I=!I}if(!I){c=f[d]=f[d]||new THREE.RenderableObject;B.copy(ea.position);v.multiplyVector3(B);c.object=ea;c.z=B.z;e.push(c);d++}}X&&e.sort(a);return e};this.projectScene=function(L,e,X){var T=[],ca=e.near,ea=e.far,I,aa,Ba,da,xa,ia,fa,va,Ca,ha,Z,pa,qa,R,la,ta;j=q=t=0;e.matrixAutoUpdate&&e.update();v.multiply(e.projectionMatrix,e.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))}L.update(undefined,!1,e);ia=this.projectObjects(L,e,!0);L=0;for(I=ia.length;L<I;L++){fa=ia[L].object;if(fa.visible){va=fa.matrixWorld;Z=fa.matrixRotationWorld;
|
|
|
-Ca=fa.materials;ha=fa.overdraw;if(fa instanceof THREE.Mesh){pa=fa.geometry;qa=pa.vertices;aa=0;for(Ba=qa.length;aa<Ba;aa++){R=qa[aa];R.positionWorld.copy(R.position);va.multiplyVector3(R.positionWorld);da=R.positionScreen;da.copy(R.positionWorld);v.multiplyVector4(da);da.x/=da.w;da.y/=da.w;R.__visible=da.z>ca&&da.z<ea}pa=pa.faces;aa=0;for(Ba=pa.length;aa<Ba;aa++){R=pa[aa];if(R instanceof THREE.Face3){da=qa[R.a];xa=qa[R.b];la=qa[R.c];if(da.__visible&&xa.__visible&&la.__visible&&(fa.doubleSided||fa.flipSided!=
|
|
|
-(la.positionScreen.x-da.positionScreen.x)*(xa.positionScreen.y-da.positionScreen.y)-(la.positionScreen.y-da.positionScreen.y)*(xa.positionScreen.x-da.positionScreen.x)<0)){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(da.positionWorld);g.v2.positionWorld.copy(xa.positionWorld);g.v3.positionWorld.copy(la.positionWorld);g.v1.positionScreen.copy(da.positionScreen);g.v2.positionScreen.copy(xa.positionScreen);g.v3.positionScreen.copy(la.positionScreen);g.normalWorld.copy(R.normal);Z.multiplyVector3(g.normalWorld);
|
|
|
-g.centroidWorld.copy(R.centroid);va.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);la=R.vertexNormals;Y=g.vertexNormalsWorld;da=0;for(xa=la.length;da<xa;da++){ta=Y[da]=Y[da]||new THREE.Vector3;ta.copy(la[da]);Z.multiplyVector3(ta)}g.z=g.centroidScreen.z;g.meshMaterials=Ca;g.faceMaterials=R.materials;g.overdraw=ha;if(fa.geometry.uvs[aa]){g.uvs[0]=fa.geometry.uvs[aa][0];g.uvs[1]=fa.geometry.uvs[aa][1];g.uvs[2]=fa.geometry.uvs[aa][2]}T.push(g);
|
|
|
-j++}}else if(R instanceof THREE.Face4){da=qa[R.a];xa=qa[R.b];la=qa[R.c];ta=qa[R.d];if(da.__visible&&xa.__visible&&la.__visible&&ta.__visible&&(fa.doubleSided||fa.flipSided!=((ta.positionScreen.x-da.positionScreen.x)*(xa.positionScreen.y-da.positionScreen.y)-(ta.positionScreen.y-da.positionScreen.y)*(xa.positionScreen.x-da.positionScreen.x)<0||(xa.positionScreen.x-la.positionScreen.x)*(ta.positionScreen.y-la.positionScreen.y)-(xa.positionScreen.y-la.positionScreen.y)*(ta.positionScreen.x-la.positionScreen.x)<
|
|
|
-0))){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(da.positionWorld);g.v2.positionWorld.copy(xa.positionWorld);g.v3.positionWorld.copy(ta.positionWorld);g.v1.positionScreen.copy(da.positionScreen);g.v2.positionScreen.copy(xa.positionScreen);g.v3.positionScreen.copy(ta.positionScreen);g.normalWorld.copy(R.normal);Z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(R.centroid);va.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);
|
|
|
-g.z=g.centroidScreen.z;g.meshMaterials=Ca;g.faceMaterials=R.materials;g.overdraw=ha;if(fa.geometry.uvs[aa]){g.uvs[0]=fa.geometry.uvs[aa][0];g.uvs[1]=fa.geometry.uvs[aa][1];g.uvs[2]=fa.geometry.uvs[aa][3]}T.push(g);j++;h=k[j]=k[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(xa.positionWorld);h.v2.positionWorld.copy(la.positionWorld);h.v3.positionWorld.copy(ta.positionWorld);h.v1.positionScreen.copy(xa.positionScreen);h.v2.positionScreen.copy(la.positionScreen);h.v3.positionScreen.copy(ta.positionScreen);
|
|
|
-h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=Ca;h.faceMaterials=R.materials;h.overdraw=ha;if(fa.geometry.uvs[aa]){h.uvs[0]=fa.geometry.uvs[aa][1];h.uvs[1]=fa.geometry.uvs[aa][2];h.uvs[2]=fa.geometry.uvs[aa][3]}T.push(h);j++}}}}else if(fa instanceof THREE.Line){E.multiply(v,va);qa=fa.geometry.vertices;R=qa[0];R.positionScreen.copy(R.position);E.multiplyVector4(R.positionScreen);aa=1;for(Ba=qa.length;aa<
|
|
|
-Ba;aa++){da=qa[aa];da.positionScreen.copy(da.position);E.multiplyVector4(da.positionScreen);xa=qa[aa-1];M.copy(da.positionScreen);K.copy(xa.positionScreen);if(b(M,K)){M.multiplyScalar(1/M.w);K.multiplyScalar(1/K.w);n=x[q]=x[q]||new THREE.RenderableLine;n.v1.positionScreen.copy(M);n.v2.positionScreen.copy(K);n.z=Math.max(M.z,K.z);n.materials=fa.materials;T.push(n);q++}}}else if(fa instanceof THREE.Particle){D.set(fa.position.x,fa.position.y,fa.position.z,1);v.multiplyVector4(D);D.z/=D.w;if(D.z>0&&
|
|
|
-D.z<1){u=y[t]=y[t]||new THREE.RenderableParticle;u.x=D.x/D.w;u.y=D.y/D.w;u.z=D.z;u.rotation=fa.rotation.z;u.scale.x=fa.scale.x*Math.abs(u.x-(D.x+e.projectionMatrix.n11)/(D.w+e.projectionMatrix.n14));u.scale.y=fa.scale.y*Math.abs(u.y-(D.y+e.projectionMatrix.n22)/(D.w+e.projectionMatrix.n24));u.materials=fa.materials;T.push(u);t++}}}}X&&T.sort(a);return T};this.unprojectVector=function(L,e){var X=e.matrixWorld.clone();X.multiplySelf(THREE.Matrix4.makeInvert(e.projectionMatrix));X.multiplyVector3(L);
|
|
|
-return L}};
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,j){c=h;d=j;f=c/2;g=d/2};this.render=function(h,j){var k,n,q,x,u,t,y,B;a=b.projectScene(h,j);k=0;for(n=a.length;k<n;k++){u=a[k];if(u instanceof THREE.RenderableParticle){y=u.x*f+f;B=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=B+"px"}}}}}};
|
|
|
-THREE.CanvasRenderer=function(){function a(ja){if(u!=ja)n.globalAlpha=u=ja}function b(ja){if(t!=ja){switch(ja){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}t=ja}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,j,k,n=f.getContext("2d"),q=new THREE.Color(0),x=0,u=1,t=0,y=null,B=null,D=1,v,E,w,M,K,Y,L,e,X,T=new THREE.Color,
|
|
|
-ca=new THREE.Color,ea=new THREE.Color,I=new THREE.Color,aa=new THREE.Color,Ba,da,xa,ia,fa,va,Ca,ha,Z,pa=new THREE.Rectangle,qa=new THREE.Rectangle,R=new THREE.Rectangle,la=!1,ta=new THREE.Color,l=new THREE.Color,z=new THREE.Color,p=new THREE.Color,m=Math.PI*2,o=new THREE.Vector3,C,A,G,Q,N,F,$=16;C=document.createElement("canvas");C.width=C.height=2;A=C.getContext("2d");A.fillStyle="rgba(0,0,0,1)";A.fillRect(0,0,2,2);G=A.getImageData(0,0,2,2);Q=G.data;N=document.createElement("canvas");N.width=N.height=
|
|
|
-$;F=N.getContext("2d");F.translate(-$/2,-$/2);F.scale($,$);$--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ja,ma){g=ja;h=ma;j=g/2;k=h/2;f.width=g;f.height=h;pa.set(-j,-k,j,k);u=1;t=0;B=y=null;D=1};this.setClearColor=function(ja,ma){q=ja;x=ma};this.setClearColorHex=function(ja,ma){q.setHex(ja);x=ma};this.clear=function(){n.setTransform(1,0,0,-1,j,k);if(!qa.isEmpty()){qa.inflate(1);qa.minSelf(pa);if(q.hex==0&&x==0)n.clearRect(qa.getX(),qa.getY(),
|
|
|
-qa.getWidth(),qa.getHeight());else{b(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(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight())}qa.empty()}};this.render=function(ja,ma){function ya(O){var na,ga,P,S=O.lights;l.setRGB(0,0,0);z.setRGB(0,0,0);p.setRGB(0,0,0);O=0;for(na=S.length;O<na;O++){ga=S[O];P=ga.color;if(ga instanceof THREE.AmbientLight){l.r+=P.r;l.g+=P.g;l.b+=P.b}else if(ga instanceof THREE.DirectionalLight){z.r+=
|
|
|
-P.r;z.g+=P.g;z.b+=P.b}else if(ga instanceof THREE.PointLight){p.r+=P.r;p.g+=P.g;p.b+=P.b}}}function wa(O,na,ga,P){var S,ka,oa,ra,ua=O.lights;O=0;for(S=ua.length;O<S;O++){ka=ua[O];oa=ka.color;ra=ka.intensity;if(ka instanceof THREE.DirectionalLight){ka=ga.dot(ka.position)*ra;if(ka>0){P.r+=oa.r*ka;P.g+=oa.g*ka;P.b+=oa.b*ka}}else if(ka instanceof THREE.PointLight){o.sub(ka.position,na);o.normalize();ka=ga.dot(o)*ra;if(ka>0){P.r+=oa.r*ka;P.g+=oa.g*ka;P.b+=oa.b*ka}}}}function sa(O,na,ga){if(ga.opacity!=
|
|
|
-0){a(ga.opacity);b(ga.blending);var P,S,ka,oa,ra,ua;if(ga instanceof THREE.ParticleBasicMaterial){if(ga.map){oa=ga.map.image;ra=oa.width>>1;ua=oa.height>>1;S=na.scale.x*j;ka=na.scale.y*k;ga=S*ra;P=ka*ua;R.set(O.x-ga,O.y-P,O.x+ga,O.y+P);if(pa.instersects(R)){n.save();n.translate(O.x,O.y);n.rotate(-na.rotation);n.scale(S,-ka);n.translate(-ra,-ua);n.drawImage(oa,0,0);n.restore()}}}else if(ga instanceof THREE.ParticleCircleMaterial){if(la){ta.r=l.r+z.r+p.r;ta.g=l.g+z.g+p.g;ta.b=l.b+z.b+p.b;T.r=ga.color.r*
|
|
|
-ta.r;T.g=ga.color.g*ta.g;T.b=ga.color.b*ta.b;T.updateStyleString()}else T.__styleString=ga.color.__styleString;ga=na.scale.x*j;P=na.scale.y*k;R.set(O.x-ga,O.y-P,O.x+ga,O.y+P);if(pa.instersects(R)){S=T.__styleString;if(B!=S)n.fillStyle=B=S;n.save();n.translate(O.x,O.y);n.rotate(-na.rotation);n.scale(ga,P);n.beginPath();n.arc(0,0,1,0,m,!0);n.closePath();n.fill();n.restore()}}}}function Ga(O,na,ga,P){if(P.opacity!=0){a(P.opacity);b(P.blending);n.beginPath();n.moveTo(O.positionScreen.x,O.positionScreen.y);
|
|
|
-n.lineTo(na.positionScreen.x,na.positionScreen.y);n.closePath();if(P instanceof THREE.LineBasicMaterial){T.__styleString=P.color.__styleString;O=P.linewidth;if(D!=O)n.lineWidth=D=O;O=T.__styleString;if(y!=O)n.strokeStyle=y=O;n.stroke();R.inflate(P.linewidth*2)}}}function Qa(O,na,ga,P,S,ka){if(S.opacity!=0){a(S.opacity);b(S.blending);M=O.positionScreen.x;K=O.positionScreen.y;Y=na.positionScreen.x;L=na.positionScreen.y;e=ga.positionScreen.x;X=ga.positionScreen.y;n.beginPath();n.moveTo(M,K);n.lineTo(Y,
|
|
|
-L);n.lineTo(e,X);n.lineTo(M,K);n.closePath();if(S instanceof THREE.MeshBasicMaterial)if(S.map)S.map.mapping instanceof THREE.UVMapping&&Ia(M,K,Y,L,e,X,S.map.image,P.uvs[0].u,P.uvs[0].v,P.uvs[1].u,P.uvs[1].v,P.uvs[2].u,P.uvs[2].v);else if(S.envMap){if(S.envMap.mapping instanceof THREE.SphericalReflectionMapping){O=ma.matrixWorldInverse;o.copy(P.vertexNormalsWorld[0]);ia=(o.x*O.n11+o.y*O.n12+o.z*O.n13)*0.5+0.5;fa=-(o.x*O.n21+o.y*O.n22+o.z*O.n23)*0.5+0.5;o.copy(P.vertexNormalsWorld[1]);va=(o.x*O.n11+
|
|
|
-o.y*O.n12+o.z*O.n13)*0.5+0.5;Ca=-(o.x*O.n21+o.y*O.n22+o.z*O.n23)*0.5+0.5;o.copy(P.vertexNormalsWorld[2]);ha=(o.x*O.n11+o.y*O.n12+o.z*O.n13)*0.5+0.5;Z=-(o.x*O.n21+o.y*O.n22+o.z*O.n23)*0.5+0.5;Ia(M,K,Y,L,e,X,S.envMap.image,ia,fa,va,Ca,ha,Z)}}else S.wireframe?J(S.color.__styleString,S.wireframeLinewidth):Oa(S.color.__styleString);else if(S instanceof THREE.MeshLambertMaterial){if(S.map&&!S.wireframe){S.map.mapping instanceof THREE.UVMapping&&Ia(M,K,Y,L,e,X,S.map.image,P.uvs[0].u,P.uvs[0].v,P.uvs[1].u,
|
|
|
-P.uvs[1].v,P.uvs[2].u,P.uvs[2].v);b(THREE.SubtractiveBlending)}if(la)if(!S.wireframe&&S.shading==THREE.SmoothShading&&P.vertexNormalsWorld.length==3){ca.r=ea.r=I.r=l.r;ca.g=ea.g=I.g=l.g;ca.b=ea.b=I.b=l.b;wa(ka,P.v1.positionWorld,P.vertexNormalsWorld[0],ca);wa(ka,P.v2.positionWorld,P.vertexNormalsWorld[1],ea);wa(ka,P.v3.positionWorld,P.vertexNormalsWorld[2],I);aa.r=(ea.r+I.r)*0.5;aa.g=(ea.g+I.g)*0.5;aa.b=(ea.b+I.b)*0.5;xa=Pa(ca,ea,I,aa);Ia(M,K,Y,L,e,X,xa,0,0,1,0,0,1)}else{ta.r=l.r;ta.g=l.g;ta.b=l.b;
|
|
|
-wa(ka,P.centroidWorld,P.normalWorld,ta);T.r=S.color.r*ta.r;T.g=S.color.g*ta.g;T.b=S.color.b*ta.b;T.updateStyleString();S.wireframe?J(T.__styleString,S.wireframeLinewidth):Oa(T.__styleString)}else S.wireframe?J(S.color.__styleString,S.wireframeLinewidth):Oa(S.color.__styleString)}else if(S instanceof THREE.MeshDepthMaterial){Ba=ma.near;da=ma.far;ca.r=ca.g=ca.b=1-U(O.positionScreen.z,Ba,da);ea.r=ea.g=ea.b=1-U(na.positionScreen.z,Ba,da);I.r=I.g=I.b=1-U(ga.positionScreen.z,Ba,da);aa.r=(ea.r+I.r)*0.5;
|
|
|
-aa.g=(ea.g+I.g)*0.5;aa.b=(ea.b+I.b)*0.5;xa=Pa(ca,ea,I,aa);Ia(M,K,Y,L,e,X,xa,0,0,1,0,0,1)}else if(S instanceof THREE.MeshNormalMaterial){T.r=V(P.normalWorld.x);T.g=V(P.normalWorld.y);T.b=V(P.normalWorld.z);T.updateStyleString();S.wireframe?J(T.__styleString,S.wireframeLinewidth):Oa(T.__styleString)}}}function J(O,na){if(y!=O)n.strokeStyle=y=O;if(D!=na)n.lineWidth=D=na;n.stroke();R.inflate(na*2)}function Oa(O){if(B!=O)n.fillStyle=B=O;n.fill()}function Ia(O,na,ga,P,S,ka,oa,ra,ua,Aa,La,Ka,Wa){var Ea,
|
|
|
-Sa;Ea=oa.width-1;Sa=oa.height-1;ra*=Ea;ua*=Sa;Aa*=Ea;La*=Sa;Ka*=Ea;Wa*=Sa;ga-=O;P-=na;S-=O;ka-=na;Aa-=ra;La-=ua;Ka-=ra;Wa-=ua;Ea=Aa*Wa-Ka*La;if(Ea!=0){Sa=1/Ea;Ea=(Wa*ga-La*S)*Sa;La=(Wa*P-La*ka)*Sa;ga=(Aa*S-Ka*ga)*Sa;P=(Aa*ka-Ka*P)*Sa;O=O-Ea*ra-ga*ua;na=na-La*ra-P*ua;n.save();n.transform(Ea,La,ga,P,O,na);n.clip();n.drawImage(oa,0,0);n.restore()}}function Pa(O,na,ga,P){var S=~~(O.r*255),ka=~~(O.g*255);O=~~(O.b*255);var oa=~~(na.r*255),ra=~~(na.g*255);na=~~(na.b*255);var ua=~~(ga.r*255),Aa=~~(ga.g*255);
|
|
|
-ga=~~(ga.b*255);var La=~~(P.r*255),Ka=~~(P.g*255);P=~~(P.b*255);Q[0]=S<0?0:S>255?255:S;Q[1]=ka<0?0:ka>255?255:ka;Q[2]=O<0?0:O>255?255:O;Q[4]=oa<0?0:oa>255?255:oa;Q[5]=ra<0?0:ra>255?255:ra;Q[6]=na<0?0:na>255?255:na;Q[8]=ua<0?0:ua>255?255:ua;Q[9]=Aa<0?0:Aa>255?255:Aa;Q[10]=ga<0?0:ga>255?255:ga;Q[12]=La<0?0:La>255?255:La;Q[13]=Ka<0?0:Ka>255?255:Ka;Q[14]=P<0?0:P>255?255:P;A.putImageData(G,0,0);F.drawImage(C,0,0);return N}function U(O,na,ga){O=(O-na)/(ga-na);return O*O*(3-2*O)}function V(O){O=(O+1)*0.5;
|
|
|
-return O<0?0:O>1?1:O}function W(O,na){var ga=na.x-O.x,P=na.y-O.y,S=1/Math.sqrt(ga*ga+P*P);ga*=S;P*=S;na.x+=ga;na.y+=P;O.x-=ga;O.y-=P}var za,Ma,Fa,Da,Na,Ja,H,Ha;this.autoClear?this.clear():n.setTransform(1,0,0,-1,j,k);c=d.projectScene(ja,ma,this.sortElements);(la=ja.lights.length>0)&&ya(ja);za=0;for(Ma=c.length;za<Ma;za++){Fa=c[za];R.empty();if(Fa instanceof THREE.RenderableParticle){v=Fa;v.x*=j;v.y*=k;Da=0;for(Na=Fa.materials.length;Da<Na;Da++)sa(v,Fa,Fa.materials[Da],ja)}else if(Fa instanceof THREE.RenderableLine){v=
|
|
|
-Fa.v1;E=Fa.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(pa.instersects(R)){Da=0;for(Na=Fa.materials.length;Da<Na;)Ga(v,E,Fa,Fa.materials[Da++],ja)}}else if(Fa instanceof THREE.RenderableFace3){v=Fa.v1;E=Fa.v2;w=Fa.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(Fa.overdraw){W(v.positionScreen,
|
|
|
-E.positionScreen);W(E.positionScreen,w.positionScreen);W(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(pa.instersects(R)){Da=0;for(Na=Fa.meshMaterials.length;Da<Na;){Ha=Fa.meshMaterials[Da++];if(Ha instanceof THREE.MeshFaceMaterial){Ja=0;for(H=Fa.faceMaterials.length;Ja<H;)(Ha=Fa.faceMaterials[Ja++])&&Qa(v,E,w,Fa,Ha,ja)}else Qa(v,E,w,Fa,Ha,ja)}}}qa.addRectangle(R)}n.setTransform(1,
|
|
|
-0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(ia,fa,va){var Ca,ha,Z,pa;Ca=0;for(ha=ia.lights.length;Ca<ha;Ca++){Z=ia.lights[Ca];if(Z instanceof THREE.DirectionalLight){pa=fa.normalWorld.dot(Z.position)*Z.intensity;if(pa>0){va.r+=Z.color.r*pa;va.g+=Z.color.g*pa;va.b+=Z.color.b*pa}}else if(Z instanceof THREE.PointLight){X.sub(Z.position,fa.centroidWorld);X.normalize();pa=fa.normalWorld.dot(X)*Z.intensity;if(pa>0){va.r+=Z.color.r*pa;va.g+=Z.color.g*pa;va.b+=Z.color.b*pa}}}}function b(ia,fa,va,Ca,ha,Z){I=d(aa++);
|
|
|
-I.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ha instanceof THREE.MeshBasicMaterial)w.__styleString=ha.color.__styleString;else if(ha instanceof THREE.MeshLambertMaterial)if(E){M.r=K.r;M.g=K.g;M.b=K.b;a(Z,Ca,M);w.r=ha.color.r*M.r;w.g=ha.color.g*M.g;w.b=ha.color.b*M.b;w.updateStyleString()}else w.__styleString=ha.color.__styleString;else if(ha instanceof THREE.MeshDepthMaterial){e=
|
|
|
-1-ha.__2near/(ha.__farPlusNear-Ca.z*ha.__farMinusNear);w.setRGB(e,e,e)}else ha instanceof THREE.MeshNormalMaterial&&w.setRGB(f(Ca.normalWorld.x),f(Ca.normalWorld.y),f(Ca.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 c(ia,fa,va,Ca,ha,Z,pa){I=d(aa++);I.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+Ca.positionScreen.x+","+Ca.positionScreen.y+"z");if(Z instanceof THREE.MeshBasicMaterial)w.__styleString=Z.color.__styleString;else if(Z instanceof THREE.MeshLambertMaterial)if(E){M.r=K.r;M.g=K.g;M.b=K.b;a(pa,ha,M);w.r=Z.color.r*M.r;w.g=Z.color.g*M.g;w.b=Z.color.b*M.b;w.updateStyleString()}else w.__styleString=
|
|
|
-Z.color.__styleString;else if(Z instanceof THREE.MeshDepthMaterial){e=1-Z.__2near/(Z.__farPlusNear-ha.z*Z.__farMinusNear);w.setRGB(e,e,e)}else Z instanceof THREE.MeshNormalMaterial&&w.setRGB(f(ha.normalWorld.x),f(ha.normalWorld.y),f(ha.normalWorld.z));Z.wireframe?I.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+Z.wireframeLinewidth+"; stroke-opacity: "+Z.opacity+"; stroke-linecap: "+Z.wireframeLinecap+"; stroke-linejoin: "+Z.wireframeLinejoin):I.setAttribute("style",
|
|
|
-"fill: "+w.__styleString+"; fill-opacity: "+Z.opacity);j.appendChild(I)}function d(ia){if(T[ia]==null){T[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");xa==0&&T[ia].setAttribute("shape-rendering","crispEdges")}return T[ia]}function f(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,B,D=new THREE.Rectangle,v=new THREE.Rectangle,E=!1,w=new THREE.Color(16777215),
|
|
|
-M=new THREE.Color(16777215),K=new THREE.Color(0),Y=new THREE.Color(0),L=new THREE.Color(0),e,X=new THREE.Vector3,T=[],ca=[],ea=[],I,aa,Ba,da,xa=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":xa=1;break;case "low":xa=0}};this.setSize=function(ia,fa){k=ia;n=fa;q=k/2;x=n/2;j.setAttribute("viewBox",-q+" "+-x+" "+k+" "+n);j.setAttribute("width",k);j.setAttribute("height",n);D.set(-q,-x,q,x)};this.clear=function(){for(;j.childNodes.length>
|
|
|
-0;)j.removeChild(j.childNodes[0])};this.render=function(ia,fa){var va,Ca,ha,Z,pa,qa,R,la;this.autoClear&&this.clear();g=h.projectScene(ia,fa,this.sortElements);da=Ba=aa=0;if(E=ia.lights.length>0){R=ia.lights;K.setRGB(0,0,0);Y.setRGB(0,0,0);L.setRGB(0,0,0);va=0;for(Ca=R.length;va<Ca;va++){ha=R[va];Z=ha.color;if(ha instanceof THREE.AmbientLight){K.r+=Z.r;K.g+=Z.g;K.b+=Z.b}else if(ha instanceof THREE.DirectionalLight){Y.r+=Z.r;Y.g+=Z.g;Y.b+=Z.b}else if(ha instanceof THREE.PointLight){L.r+=Z.r;L.g+=Z.g;
|
|
|
-L.b+=Z.b}}}va=0;for(Ca=g.length;va<Ca;va++){R=g[va];v.empty();if(R instanceof THREE.RenderableParticle){u=R;u.x*=q;u.y*=-x;ha=0;for(Z=R.materials.length;ha<Z;ha++)if(la=R.materials[ha]){pa=u;qa=R;var ta=Ba++;if(ca[ta]==null){ca[ta]=document.createElementNS("http://www.w3.org/2000/svg","circle");xa==0&&ca[ta].setAttribute("shape-rendering","crispEdges")}I=ca[ta];I.setAttribute("cx",pa.x);I.setAttribute("cy",pa.y);I.setAttribute("r",qa.scale.x*q);if(la instanceof THREE.ParticleCircleMaterial){if(E){M.r=
|
|
|
-K.r+Y.r+L.r;M.g=K.g+Y.g+L.g;M.b=K.b+Y.b+L.b;w.r=la.color.r*M.r;w.g=la.color.g*M.g;w.b=la.color.b*M.b;w.updateStyleString()}else w=la.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(D.instersects(v)){ha=0;for(Z=R.materials.length;ha<
|
|
|
-Z;)if(la=R.materials[ha++]){pa=u;qa=t;ta=da++;if(ea[ta]==null){ea[ta]=document.createElementNS("http://www.w3.org/2000/svg","line");xa==0&&ea[ta].setAttribute("shape-rendering","crispEdges")}I=ea[ta];I.setAttribute("x1",pa.positionScreen.x);I.setAttribute("y1",pa.positionScreen.y);I.setAttribute("x2",qa.positionScreen.x);I.setAttribute("y2",qa.positionScreen.y);if(la instanceof THREE.LineBasicMaterial){w.__styleString=la.color.__styleString;I.setAttribute("style","fill: none; stroke: "+w.__styleString+
|
|
|
-"; stroke-width: "+la.linewidth+"; stroke-opacity: "+la.opacity+"; stroke-linecap: "+la.linecap+"; stroke-linejoin: "+la.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(D.instersects(v)){ha=0;for(Z=R.meshMaterials.length;ha<Z;){la=R.meshMaterials[ha++];if(la instanceof THREE.MeshFaceMaterial){pa=0;for(qa=R.faceMaterials.length;pa<qa;)(la=R.faceMaterials[pa++])&&b(u,t,y,R,la,ia)}else la&&b(u,t,y,R,la,ia)}}}else if(R instanceof THREE.RenderableFace4){u=R.v1;t=R.v2;y=R.v3;B=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;B.positionScreen.x*=q;B.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(B.positionScreen.x,B.positionScreen.y);if(D.instersects(v)){ha=0;for(Z=R.meshMaterials.length;ha<Z;){la=R.meshMaterials[ha++];if(la instanceof THREE.MeshFaceMaterial){pa=0;for(qa=R.faceMaterials.length;pa<qa;)(la=R.faceMaterials[pa++])&&c(u,t,y,B,R,la,ia)}else la&&c(u,t,y,B,R,la,ia)}}}}}};
|
|
|
-THREE.WebGLRenderer=function(a){function b(l,z,p){var m,o,C,A=l.vertices,G=A.length,Q=l.colors,N=Q.length,F=l.__vertexArray,$=l.__colorArray,ja=l.__sortArray,ma=l.__dirtyVertices,ya=l.__dirtyColors;if(p.sortParticles){Ca.multiplySelf(p.matrixWorld);for(m=0;m<G;m++){o=A[m].position;pa.copy(o);Ca.multiplyVector3(pa);ja[m]=[pa.z,m]}ja.sort(function(wa,sa){return sa[0]-wa[0]});for(m=0;m<G;m++){o=A[ja[m][1]].position;C=m*3;F[C]=o.x;F[C+1]=o.y;F[C+2]=o.z}for(m=0;m<N;m++){C=m*3;color=Q[ja[m][1]];$[C]=color.r;
|
|
|
-$[C+1]=color.g;$[C+2]=color.b}}else{if(ma)for(m=0;m<G;m++){o=A[m].position;C=m*3;F[C]=o.x;F[C+1]=o.y;F[C+2]=o.z}if(ya)for(m=0;m<N;m++){color=Q[m];C=m*3;$[C]=color.r;$[C+1]=color.g;$[C+2]=color.b}}if(ma||p.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,F,z)}if(ya||p.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,$,z)}}function c(l,z){l.fragmentShader=z.fragmentShader;l.vertexShader=z.vertexShader;l.uniforms=
|
|
|
-Uniforms.clone(z.uniforms)}function d(l,z,p,m,o){m.program||ca.initMaterial(m,z,p,o);var C=m.program,A=C.uniforms,G=m.uniforms;if(C!=X){e.useProgram(C);X=C;e.uniformMatrix4fv(A.projectionMatrix,!1,ha)}if(p&&(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial||m instanceof THREE.LineBasicMaterial||m instanceof THREE.ParticleBasicMaterial)){G.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){G.fogNear.value=p.near;G.fogFar.value=
|
|
|
-p.far}else if(p instanceof THREE.FogExp2)G.fogDensity.value=p.density}if(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial){var Q,N,F=0,$=0,ja=0,ma,ya,wa,sa=qa,Ga=sa.directional.colors,Qa=sa.directional.positions,J=sa.point.colors,Oa=sa.point.positions,Ia=0,Pa=0;p=N=N=0;for(Q=z.length;p<Q;p++){N=z[p];ma=N.color;ya=N.position;wa=N.intensity;if(N instanceof THREE.AmbientLight){F+=ma.r;$+=ma.g;ja+=ma.b}else if(N instanceof THREE.DirectionalLight){N=Ia*3;Ga[N]=ma.r*wa;Ga[N+
|
|
|
-1]=ma.g*wa;Ga[N+2]=ma.b*wa;Qa[N]=ya.x;Qa[N+1]=ya.y;Qa[N+2]=ya.z;Ia+=1}else if(N instanceof THREE.PointLight){N=Pa*3;J[N]=ma.r*wa;J[N+1]=ma.g*wa;J[N+2]=ma.b*wa;Oa[N]=ya.x;Oa[N+1]=ya.y;Oa[N+2]=ya.z;Pa+=1}}for(p=Ia*3;p<Ga.length;p++)Ga[p]=0;for(p=Pa*3;p<J.length;p++)J[p]=0;sa.point.length=Pa;sa.directional.length=Ia;sa.ambient[0]=F;sa.ambient[1]=$;sa.ambient[2]=ja;z=qa;G.enableLighting.value=z.directional.length+z.point.length;G.ambientLightColor.value=z.ambient;G.directionalLightColor.value=z.directional.colors;
|
|
|
-G.directionalLightDirection.value=z.directional.positions;G.pointLightColor.value=z.point.colors;G.pointLightPosition.value=z.point.positions}if(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial){G.diffuse.value.setRGB(m.color.r*m.opacity,m.color.g*m.opacity,m.color.b*m.opacity);G.opacity.value=m.opacity;G.map.texture=m.map;G.lightMap.texture=m.lightMap;G.envMap.texture=m.envMap;G.reflectivity.value=m.reflectivity;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.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 U in G)if(F=C.uniforms[U]){p=G[U];Q=p.type;z=p.value;if(Q=="i")e.uniform1i(F,z);else if(Q=="f")e.uniform1f(F,z);else if(Q=="fv1")e.uniform1fv(F,z);else if(Q=="fv")e.uniform3fv(F,z);else if(Q==
|
|
|
-"v2")e.uniform2f(F,z.x,z.y);else if(Q=="v3")e.uniform3f(F,z.x,z.y,z.z);else if(Q=="c")e.uniform3f(F,z.r,z.g,z.b);else if(Q=="t"){e.uniform1i(F,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){e.bindTexture(e.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(Q=0;Q<6;++Q)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,e.RGBA,e.UNSIGNED_BYTE,p.image[Q])}else{p.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,
|
|
|
-p.image.__webGLTextureCube);for(Q=0;Q<6;++Q)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,p.image[Q]);p.__wasSetOnce=!0}E(e.TEXTURE_CUBE_MAP,p,p.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,p.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=
|
|
|
-e.createTexture();e.bindTexture(e.TEXTURE_2D,p.__webGLTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}E(e.TEXTURE_2D,p,p.image);e.bindTexture(e.TEXTURE_2D,null);p.needsUpdate=!1}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_2D,p.__webGLTexture)}}}e.uniformMatrix4fv(A.modelViewMatrix,!1,o._modelViewMatrixArray);e.uniformMatrix3fv(A.normalMatrix,!1,o._normalMatrixArray);(m instanceof THREE.MeshShaderMaterial||m instanceof THREE.MeshPhongMaterial||
|
|
|
-m.envMap)&&e.uniform3f(A.cameraPosition,l.position.x,l.position.y,l.position.z);(m instanceof THREE.MeshShaderMaterial||m.envMap||m.skinning)&&e.uniformMatrix4fv(A.objectMatrix,!1,o._objectMatrixArray);(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshShaderMaterial||m.skinning)&&e.uniformMatrix4fv(A.viewMatrix,!1,Z);if(m.skinning){e.uniformMatrix4fv(A.cameraInverseMatrix,!1,Z);e.uniformMatrix4fv(A.boneGlobalMatrices,!1,o.boneMatrices)}m.vertexAnimated&&
|
|
|
-e.uniform1f(A.positionInterpolation,o.keyInterpolation);return C}function f(l,z,p,m,o,C){l=d(l,z,p,m,C).attributes;if(m.vertexAnimated){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLVertexKeysBuffers[C.keyA]);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLVertexKeysBuffers[C.keyB]);e.vertexAttribPointer(l.positionNextKey,3,e.FLOAT,!1,0,0)}else{e.bindBuffer(e.ARRAY_BUFFER,o.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0)}if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-o.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(o.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=
|
|
|
-0)if(o.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);if(m.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-o.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,4,e.FLOAT,!1,0,0)}if(C instanceof THREE.Mesh)if(m.wireframe){e.lineWidth(m.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);e.drawElements(e.LINES,o.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,o.__webGLFaceCount,e.UNSIGNED_SHORT,
|
|
|
-0)}else if(C instanceof THREE.Line){C=C.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(m.linewidth);e.drawArrays(C,0,o.__webGLLineCount)}else if(C instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,o.__webGLParticleCount);else C instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,o.__webGLVertexCount)}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.position);e.vertexAttribPointer(z.attributes.position,3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.normal);e.vertexAttribPointer(z.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(ea!=l.doubleSided){l.doubleSided?
|
|
|
-e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);ea=l.doubleSided}if(I!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);I=l.flipSided}}function j(l){if(Ba!=l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);Ba=l}}function k(l){va[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);va[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);va[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);va[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);va[4].set(l.n41-l.n31,l.n42-
|
|
|
-l.n32,l.n43-l.n33,l.n44-l.n34);va[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<6;l++){z=va[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function n(l){for(var z=l.matrixWorld,p=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),m=0;m<6;m++){l=va[m].x*z.n14+va[m].y*z.n24+va[m].z*z.n34+va[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,C=l.transparent;C.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(C,p):q(o,p)}}function u(l){var z,p,m,o,C=l.object,A=l.buffer,G=l.opaque,Q=l.transparent;Q.count=0;l=G.count=0;for(m=C.materials.length;l<m;l++){z=C.materials[l];if(z instanceof THREE.MeshFaceMaterial){z=0;for(p=A.materials.length;z<p;z++)(o=A.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 B(l){function z(ja){var ma=[];p=0;for(m=ja.length;p<m;p++)ja[p]==undefined?ma.push("undefined"):ma.push(ja[p].id);return ma.join("_")}var p,m,o,C,A,G,Q,N,F={},$=l.vertexKeys!==undefined?l.vertexKeys.length:0;l.geometryGroups={};o=0;for(C=l.faces.length;o<
|
|
|
-C;o++){A=l.faces[o];G=A.materials;Q=z(G);F[Q]==undefined&&(F[Q]={hash:Q,counter:0});N=F[Q].hash+"_"+F[Q].counter;l.geometryGroups[N]==undefined&&(l.geometryGroups[N]={faces:[],materials:G,vertices:0,numberVertexKeys:$});A=A instanceof THREE.Face3?3:4;if(l.geometryGroups[N].vertices+A>65535){F[Q].counter+=1;N=F[Q].hash+"_"+F[Q].counter;l.geometryGroups[N]==undefined&&(l.geometryGroups[N]={faces:[],materials:G,vertices:0,numberVertexKeys:$})}l.geometryGroups[N].faces.push(o);l.geometryGroups[N].vertices+=
|
|
|
-A}}function D(l,z,p){l.push({buffer:z,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function v(l){if(l!=aa){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,
|
|
|
-e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}aa=l}}function E(l,z,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){e.texParameteri(l,e.TEXTURE_WRAP_S,Y(z.wrapS));e.texParameteri(l,e.TEXTURE_WRAP_T,Y(z.wrapT));e.texParameteri(l,e.TEXTURE_MAG_FILTER,Y(z.magFilter));e.texParameteri(l,e.TEXTURE_MIN_FILTER,Y(z.minFilter));e.generateMipmap(l)}else{e.texParameteri(l,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(l,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(l,
|
|
|
-e.TEXTURE_MAG_FILTER,K(z.magFilter));e.texParameteri(l,e.TEXTURE_MIN_FILTER,K(z.minFilter))}}function w(l){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,Y(l.wrapS));e.texParameteri(e.TEXTURE_2D,
|
|
|
-e.TEXTURE_WRAP_T,Y(l.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,Y(l.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,Y(l.minFilter));e.texImage2D(e.TEXTURE_2D,0,Y(l.format),l.width,l.height,0,Y(l.format),Y(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,
|
|
|
-null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var z,p;if(l){z=l.__webGLFramebuffer;p=l.width;l=l.height}else{z=null;p=ia;l=fa}if(z!=T){e.bindFramebuffer(e.FRAMEBUFFER,z);e.viewport(da,xa,p,l);T=z}}function M(l,z){var p;if(l=="fragment")p=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(p=e.createShader(e.VERTEX_SHADER));e.shaderSource(p,z);e.compileShader(p);if(!e.getShaderParameter(p,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(p));return null}return p}function K(l){switch(l){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
|
|
|
-case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return e.LINEAR}}function Y(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;
|
|
|
-case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;
|
|
|
-case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var L=document.createElement("canvas"),e,X=null,T=null,ca=this,ea=null,I=null,aa=null,Ba=null,da=0,xa=0,ia=0,fa=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,ha=new Float32Array(16),Z=new Float32Array(16),pa=new THREE.Vector4,qa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,
|
|
|
-colors:[],positions:[]}},R=!0,la=new THREE.Color(0),ta=0;if(a){if(a.antialias!==undefined)R=a.antialias;a.clearColor!==undefined&&la.setHex(a.clearColor);if(a.clearAlpha!==undefined)ta=a.clearAlpha}this.domElement=L;this.autoClear=!0;this.sortObjects=!0;(function(l,z,p){try{if(!(e=L.getContext("experimental-webgl",{antialias:l})))throw"Error creating WebGL context.";}catch(m){console.error(m)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);
|
|
|
-e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(z.r,z.g,z.b,p);_cullEnabled=!0})(R,la,ta);this.context=e;this.setSize=function(l,z){L.width=l;L.height=z;this.setViewport(0,0,L.width,L.height)};this.setViewport=function(l,z,p,m){da=l;xa=z;ia=p;fa=m;e.viewport(da,xa,ia,fa)};this.setScissor=function(l,z,p,m){e.scissor(l,z,p,m)};this.enableScissorTest=function(l){l?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(l){e.depthMask(l)};
|
|
|
-this.setClearColorHex=function(l,z){var p=new THREE.Color(l);e.clearColor(p.r,p.g,p.b,z)};this.setClearColor=function(l,z){e.clearColor(l.r,l.g,l.b,z)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,z,p,m){var o;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,
|
|
|
-THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var C,A,G,Q,N;C=Q=N=0;for(A=z.length;C<A;C++){G=z[C];G instanceof THREE.DirectionalLight&&Q++;G instanceof THREE.PointLight&&N++}if(N+Q<=4)z=Q;else{z=Math.ceil(4*Q/(N+Q));N=4-z}z={directional:z,point:N};C=50;if(m!==undefined&&m instanceof THREE.SkinnedMesh)C=
|
|
|
-m.bones.length;m=l.fragmentShader;N=l.vertexShader;C={fog:p,map:l.map,envMap:l.envMap,lightMap:l.lightMap,vertexColors:l.vertexColors,skinning:l.skinning,vertexAnimated:l.vertexAnimated,maxDirLights:z.directional,maxPointLights:z.point,maxBones:C};p=e.createProgram();z=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+C.maxDirLights,"#define MAX_POINT_LIGHTS "+C.maxPointLights,C.fog?"#define USE_FOG":"",C.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",C.map?"#define USE_MAP":
|
|
|
-"",C.envMap?"#define USE_ENVMAP":"",C.lightMap?"#define USE_LIGHTMAP":"",C.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");C=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+C.maxDirLights,"#define MAX_POINT_LIGHTS "+C.maxPointLights,"#define MAX_BONES "+C.maxBones,C.map?"#define USE_MAP":"",C.envMap?"#define USE_ENVMAP":"",C.lightMap?"#define USE_LIGHTMAP":"",C.vertexColors?"#define USE_COLOR":
|
|
|
-"",C.skinning?"#define USE_SKINNING":"",C.vertexAnimated?"#define USE_VERTEXANIMATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 positionNextKey;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
-e.attachShader(p,M("fragment",z+m));e.attachShader(p,M("vertex",C+N));e.linkProgram(p);e.getProgramParameter(p,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(p,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");p.uniforms={};p.attributes={};l.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","positionInterpolation"];for(o in l.uniforms)p.push(o);o=
|
|
|
-l.program;m=0;for(N=p.length;m<N;m++){z=p[m];o.uniforms[z]=e.getUniformLocation(o,z)}o=l.program;p=["position","positionNextKey","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];m=0;for(N=p.length;m<N;m++){z=p[m];o.attributes[z]=e.getAttribLocation(o,z)}o=l.program.attributes;e.enableVertexAttribArray(o.position);o.color>=0&&e.enableVertexAttribArray(o.color);o.normal>=0&&e.enableVertexAttribArray(o.normal);o.tangent>=0&&e.enableVertexAttribArray(o.tangent);
|
|
|
-if(l.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0){e.enableVertexAttribArray(o.skinVertexA);e.enableVertexAttribArray(o.skinVertexB);e.enableVertexAttribArray(o.skinIndex);e.enableVertexAttribArray(o.skinWeight)}l.vertexAnimated&&o.positionNextKey>=0&&e.enableVertexAttribArray(o.positionNextKey)};this.render=function(l,z,p,m){var o,C,A,G,Q,N,F,$,ja=l.lights,ma=l.fog;z.matrixAutoUpdate&&z.update();z.matrixWorldInverse.flattenToArray(Z);z.projectionMatrix.flattenToArray(ha);
|
|
|
-Ca.multiply(z.projectionMatrix,z.matrixWorldInverse);k(Ca);l.update(undefined,!1,z);this.initWebGLObjects(l);w(p);(this.autoClear||m)&&this.clear();Q=l.__webglObjects.length;for(m=0;m<Q;m++){o=l.__webglObjects[m];F=o.object;if(F.visible)if(!(F instanceof THREE.Mesh)||n(F)){F.matrixWorld.flattenToArray(F._objectMatrixArray);y(F,z);u(o);o.render=!0;if(this.sortObjects){pa.copy(F.position);Ca.multiplyVector3(pa);o.z=pa.z}}else o.render=!1;else o.render=!1}this.sortObjects&&l.__webglObjects.sort(t);N=
|
|
|
-l.__webglObjectsImmediate.length;for(m=0;m<N;m++){o=l.__webglObjectsImmediate[m];F=o.object;if(F.visible){F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray);y(F,z);x(o)}}v(THREE.NormalBlending);for(m=0;m<Q;m++){o=l.__webglObjects[m];if(o.render){F=o.object;$=o.buffer;A=o.opaque;h(F);for(o=0;o<A.count;o++){G=A.list[o];j(G.depthTest);f(z,ja,ma,G,$,F)}}}for(m=0;m<N;m++){o=l.__webglObjectsImmediate[m];F=o.object;if(F.visible){A=o.opaque;h(F);for(o=0;o<A.count;o++){G=A.list[o];j(G.depthTest);
|
|
|
-C=d(z,ja,ma,G,F);F.render(function(ya){g(ya,C)})}}}for(m=0;m<Q;m++){o=l.__webglObjects[m];if(o.render){F=o.object;$=o.buffer;A=o.transparent;h(F);for(o=0;o<A.count;o++){G=A.list[o];v(G.blending);j(G.depthTest);f(z,ja,ma,G,$,F)}}}for(m=0;m<N;m++){o=l.__webglObjectsImmediate[m];F=o.object;if(F.visible){A=o.transparent;h(F);for(o=0;o<A.count;o++){G=A.list[o];v(G.blending);j(G.depthTest);C=d(z,ja,ma,G,F);F.render(function(ya){g(ya,C)})}}}if(p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,
|
|
|
-p.__webGLTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l){if(!l.__webglObjects){l.__webglObjects=[];l.__webglObjectsImmediate=[]}for(;l.__objectsAdded.length;){var z=l.__objectsAdded[0],p=l,m=void 0,o=void 0,C=void 0;if(z._modelViewMatrix==undefined){z._modelViewMatrix=new THREE.Matrix4;z._normalMatrixArray=new Float32Array(9);z._modelViewMatrixArray=new Float32Array(16);z._objectMatrixArray=new Float32Array(16);z.matrixWorld.flattenToArray(z._objectMatrixArray)}if(z instanceof
|
|
|
-THREE.Mesh){o=z.geometry;o.geometryGroups==undefined&&B(o);for(m in o.geometryGroups){C=o.geometryGroups[m];if(!C.__webGLVertexBuffer){var A=C;A.__webGLVertexBuffer=e.createBuffer();A.__webGLNormalBuffer=e.createBuffer();A.__webGLTangentBuffer=e.createBuffer();A.__webGLColorBuffer=e.createBuffer();A.__webGLUVBuffer=e.createBuffer();A.__webGLUV2Buffer=e.createBuffer();A.__webGLSkinVertexABuffer=e.createBuffer();A.__webGLSkinVertexBBuffer=e.createBuffer();A.__webGLSkinIndicesBuffer=e.createBuffer();
|
|
|
-A.__webGLSkinWeightsBuffer=e.createBuffer();A.__webGLFaceBuffer=e.createBuffer();A.__webGLLineBuffer=e.createBuffer();if(A.numberVertexKeys){var G=void 0,Q=void 0;A.__webGLVertexKeysBuffers=[];G=0;for(Q=A.numberVertexKeys;G<Q;G++)A.__webGLVertexKeysBuffers.push(e.createBuffer())}A=C;var N=z,F=void 0,$=void 0,ja=Q=G=0,ma=N.geometry.faces,ya=A.faces;F=0;for($=ya.length;F<$;F++){fi=ya[F];face=ma[fi];if(face instanceof THREE.Face3){G+=3;Q+=1;ja+=3}else if(face instanceof THREE.Face4){G+=4;Q+=2;ja+=4}}A.__vertexArray=
|
|
|
-new Float32Array(G*3);A.__normalArray=new Float32Array(G*3);A.__tangentArray=new Float32Array(G*4);A.__colorArray=new Float32Array(G*3);A.__uvArray=new Float32Array(G*2);A.__uv2Array=new Float32Array(G*2);A.__skinVertexAArray=new Float32Array(G*4);A.__skinVertexBArray=new Float32Array(G*4);A.__skinIndexArray=new Float32Array(G*4);A.__skinWeightArray=new Float32Array(G*4);A.__faceArray=new Uint16Array(Q*3);A.__lineArray=new Uint16Array(ja*2);$=F=A;ma=void 0;ya=void 0;var wa=void 0,sa=void 0;wa=void 0;
|
|
|
-var Ga=!1;ma=0;for(ya=N.materials.length;ma<ya;ma++){wa=N.materials[ma];if(wa instanceof THREE.MeshFaceMaterial){wa=0;for(sa=$.materials.length;wa<sa;wa++)if($.materials[wa]&&$.materials[wa].shading!=undefined&&$.materials[wa].shading==THREE.SmoothShading){Ga=!0;break}}else if(wa&&wa.shading!=undefined&&wa.shading==THREE.SmoothShading){Ga=!0;break}if(Ga)break}F.__needsSmoothNormals=Ga;A.__webGLFaceCount=Q*3;A.__webGLLineCount=ja*2;if(A.numberVertexKeys){Q=void 0;ja=void 0;A.__vertexKeysArrays=[];
|
|
|
-Q=0;for(ja=A.numberVertexKeys;Q<ja;Q++)A.__vertexKeysArrays.push(new Float32Array(G*3))}o.__dirtyVertices=!0;o.__dirtyVertexKeys=!0;o.__dirtyElements=!0;o.__dirtyUvs=!0;o.__dirtyNormals=!0;o.__dirtyTangents=!0;o.__dirtyColors=!0}D(p.__webglObjects,C,z)}}else if(z instanceof THREE.Ribbon){o=z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=e.createBuffer();m.__webGLColorBuffer=e.createBuffer();m=o;C=m.vertices.length;m.__vertexArray=new Float32Array(C*3);m.__colorArray=new Float32Array(C*
|
|
|
-3);m.__webGLVertexCount=C;o.__dirtyVertices=!0;o.__dirtyColors=!0}D(p.__webglObjects,o,z)}else if(z instanceof THREE.Line){o=z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=e.createBuffer();m.__webGLColorBuffer=e.createBuffer();m=o;C=m.vertices.length;m.__vertexArray=new Float32Array(C*3);m.__colorArray=new Float32Array(C*3);m.__webGLLineCount=C;o.__dirtyVertices=!0;o.__dirtyColors=!0}D(p.__webglObjects,o,z)}else if(z instanceof THREE.ParticleSystem){o=z.geometry;if(!o.__webGLVertexBuffer){m=
|
|
|
-o;m.__webGLVertexBuffer=e.createBuffer();m.__webGLColorBuffer=e.createBuffer();m=o;C=m.vertices.length;m.__vertexArray=new Float32Array(C*3);m.__colorArray=new Float32Array(C*3);m.__sortArray=[];m.__webGLParticleCount=C;o.__dirtyVertices=!0;o.__dirtyColors=!0}D(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;C=void 0;o=void 0;A=void 0;if(m instanceof THREE.Mesh){o=m.geometry;for(C in o.geometryGroups){A=o.geometryGroups[C];if(o.__dirtyVertices||o.__dirtyVertexKeys||o.__dirtyElements||o.__dirtyUvs||o.__dirtyNormals||o.__dirtyColors||o.__dirtyTangents){G=
|
|
|
-e.DYNAMIC_DRAW;Q=void 0;ja=void 0;var Qa=void 0,J=void 0,Oa=void 0,Ia=void 0,Pa=void 0;Qa=void 0;var U=void 0,V=void 0,W=void 0,za=void 0;U=void 0;V=void 0;W=void 0;J=void 0;U=void 0;V=void 0;W=void 0;za=void 0;U=void 0;V=void 0;W=void 0;za=void 0;U=void 0;V=void 0;W=void 0;za=void 0;U=void 0;V=void 0;W=void 0;za=void 0;U=void 0;V=void 0;W=void 0;za=void 0;J=void 0;Ia=void 0;Oa=void 0;Pa=void 0;var Ma=void 0,Fa=void 0,Da=void 0,Na=sa=wa=Ga=ya=ma=N=$=F=0,Ja=0,H=0,Ha=A.__vertexArray,O=A.__vertexKeysArrays,
|
|
|
-na=A.__uvArray,ga=A.__uv2Array,P=A.__normalArray,S=A.__tangentArray,ka=A.__colorArray,oa=A.__skinVertexAArray,ra=A.__skinVertexBArray,ua=A.__skinIndexArray,Aa=A.__skinWeightArray,La=A.__faceArray,Ka=A.__lineArray,Wa=A.__needsSmoothNormals,Ea=m.geometry,Sa=Ea.__dirtyVertices,ab=Ea.__dirtyVertexKeys,bb=Ea.__dirtyElements,$a=Ea.__dirtyUvs,cb=Ea.__dirtyNormals,db=Ea.__dirtyTangents,eb=Ea.__dirtyColors,Ra=Ea.vertices,Ta=Ea.vertexKeys,fb=A.faces,gb=Ea.faces,hb=Ea.uvs,ib=Ea.uvs2,Ua=Ea.colors,Xa=Ea.skinVerticesA,
|
|
|
-Ya=Ea.skinVerticesB,Za=Ea.skinIndices,Va=Ea.skinWeights;Q=0;for(ja=fb.length;Q<ja;Q++){Qa=fb[Q];J=gb[Qa];Pa=hb[Qa];Qa=ib[Qa];Oa=J.vertexNormals;Ia=J.normal;if(J instanceof THREE.Face3){if(Sa){U=Ra[J.a].position;V=Ra[J.b].position;W=Ra[J.c].position;Ha[$]=U.x;Ha[$+1]=U.y;Ha[$+2]=U.z;Ha[$+3]=V.x;Ha[$+4]=V.y;Ha[$+5]=V.z;Ha[$+6]=W.x;Ha[$+7]=W.y;Ha[$+8]=W.z;$+=9}if(ab){Ma=0;for(Fa=Ta.length;Ma<Fa;Ma++){U=Ta[Ma].vertices[J.a].position;V=Ta[Ma].vertices[J.b].position;W=Ta[Ma].vertices[J.c].position;Da=O[Ma];
|
|
|
-Da[N+0]=U.x;Da[N+1]=U.y;Da[N+2]=U.z;Da[N+3]=V.x;Da[N+4]=V.y;Da[N+5]=V.z;Da[N+6]=W.x;Da[N+7]=W.y;Da[N+8]=W.z}N+=9}if(Va.length){U=Va[J.a];V=Va[J.b];W=Va[J.c];Aa[H]=U.x;Aa[H+1]=U.y;Aa[H+2]=U.z;Aa[H+3]=U.w;Aa[H+4]=V.x;Aa[H+5]=V.y;Aa[H+6]=V.z;Aa[H+7]=V.w;Aa[H+8]=W.x;Aa[H+9]=W.y;Aa[H+10]=W.z;Aa[H+11]=W.w;U=Za[J.a];V=Za[J.b];W=Za[J.c];ua[H]=U.x;ua[H+1]=U.y;ua[H+2]=U.z;ua[H+3]=U.w;ua[H+4]=V.x;ua[H+5]=V.y;ua[H+6]=V.z;ua[H+7]=V.w;ua[H+8]=W.x;ua[H+9]=W.y;ua[H+10]=W.z;ua[H+11]=W.w;U=Xa[J.a];V=Xa[J.b];W=Xa[J.c];
|
|
|
-oa[H]=U.x;oa[H+1]=U.y;oa[H+2]=U.z;oa[H+3]=1;oa[H+4]=V.x;oa[H+5]=V.y;oa[H+6]=V.z;oa[H+7]=1;oa[H+8]=W.x;oa[H+9]=W.y;oa[H+10]=W.z;oa[H+11]=1;U=Ya[J.a];V=Ya[J.b];W=Ya[J.c];ra[H]=U.x;ra[H+1]=U.y;ra[H+2]=U.z;ra[H+3]=1;ra[H+4]=V.x;ra[H+5]=V.y;ra[H+6]=V.z;ra[H+7]=1;ra[H+8]=W.x;ra[H+9]=W.y;ra[H+10]=W.z;ra[H+11]=1;H+=12}if(eb&&Ua.length){U=Ua[J.a];V=Ua[J.b];W=Ua[J.c];ka[Ja]=U.r;ka[Ja+1]=U.g;ka[Ja+2]=U.b;ka[Ja+3]=V.r;ka[Ja+4]=V.g;ka[Ja+5]=V.b;ka[Ja+6]=W.r;ka[Ja+7]=W.g;ka[Ja+8]=W.b;Ja+=9}if(db&&Ea.hasTangents){U=
|
|
|
-Ra[J.a].tangent;V=Ra[J.b].tangent;W=Ra[J.c].tangent;S[sa]=U.x;S[sa+1]=U.y;S[sa+2]=U.z;S[sa+3]=U.w;S[sa+4]=V.x;S[sa+5]=V.y;S[sa+6]=V.z;S[sa+7]=V.w;S[sa+8]=W.x;S[sa+9]=W.y;S[sa+10]=W.z;S[sa+11]=W.w;sa+=12}if(cb)if(Oa.length==3&&Wa)for(J=0;J<3;J++){Ia=Oa[J];P[wa]=Ia.x;P[wa+1]=Ia.y;P[wa+2]=Ia.z;wa+=3}else for(J=0;J<3;J++){P[wa]=Ia.x;P[wa+1]=Ia.y;P[wa+2]=Ia.z;wa+=3}if($a&&Pa)for(J=0;J<3;J++){Oa=Pa[J];na[ma]=Oa.u;na[ma+1]=Oa.v;ma+=2}if($a&&Qa)for(J=0;J<3;J++){Pa=Qa[J];ga[ya]=Pa.u;ga[ya+1]=Pa.v;ya+=2}if(bb){La[Ga]=
|
|
|
-F;La[Ga+1]=F+1;La[Ga+2]=F+2;Ga+=3;Ka[Na]=F;Ka[Na+1]=F+1;Ka[Na+2]=F;Ka[Na+3]=F+2;Ka[Na+4]=F+1;Ka[Na+5]=F+2;Na+=6;F+=3}}else if(J instanceof THREE.Face4){if(Sa){U=Ra[J.a].position;V=Ra[J.b].position;W=Ra[J.c].position;za=Ra[J.d].position;Ha[$]=U.x;Ha[$+1]=U.y;Ha[$+2]=U.z;Ha[$+3]=V.x;Ha[$+4]=V.y;Ha[$+5]=V.z;Ha[$+6]=W.x;Ha[$+7]=W.y;Ha[$+8]=W.z;Ha[$+9]=za.x;Ha[$+10]=za.y;Ha[$+11]=za.z;$+=12}if(ab){Ma=0;for(Fa=Ta.length;Ma<Fa;Ma++){U=Ta[Ma].vertices[J.a].position;V=Ta[Ma].vertices[J.b].position;W=Ta[Ma].vertices[J.c].position;
|
|
|
-za=Ta[Ma].vertices[J.d].position;Da=O[Ma];Da[N+0]=U.x;Da[N+1]=U.y;Da[N+2]=U.z;Da[N+3]=V.x;Da[N+4]=V.y;Da[N+5]=V.z;Da[N+6]=W.x;Da[N+7]=W.y;Da[N+8]=W.z;Da[N+9]=za.x;Da[N+10]=za.y;Da[N+11]=za.z}N+=12}if(Va.length){U=Va[J.a];V=Va[J.b];W=Va[J.c];za=Va[J.d];Aa[H]=U.x;Aa[H+1]=U.y;Aa[H+2]=U.z;Aa[H+3]=U.w;Aa[H+4]=V.x;Aa[H+5]=V.y;Aa[H+6]=V.z;Aa[H+7]=V.w;Aa[H+8]=W.x;Aa[H+9]=W.y;Aa[H+10]=W.z;Aa[H+11]=W.w;Aa[H+12]=za.x;Aa[H+13]=za.y;Aa[H+14]=za.z;Aa[H+15]=za.w;U=Za[J.a];V=Za[J.b];W=Za[J.c];za=Za[J.d];ua[H]=U.x;
|
|
|
-ua[H+1]=U.y;ua[H+2]=U.z;ua[H+3]=U.w;ua[H+4]=V.x;ua[H+5]=V.y;ua[H+6]=V.z;ua[H+7]=V.w;ua[H+8]=W.x;ua[H+9]=W.y;ua[H+10]=W.z;ua[H+11]=W.w;ua[H+12]=za.x;ua[H+13]=za.y;ua[H+14]=za.z;ua[H+15]=za.w;U=Xa[J.a];V=Xa[J.b];W=Xa[J.c];za=Xa[J.d];oa[H]=U.x;oa[H+1]=U.y;oa[H+2]=U.z;oa[H+3]=1;oa[H+4]=V.x;oa[H+5]=V.y;oa[H+6]=V.z;oa[H+7]=1;oa[H+8]=W.x;oa[H+9]=W.y;oa[H+10]=W.z;oa[H+11]=1;oa[H+12]=za.x;oa[H+13]=za.y;oa[H+14]=za.z;oa[H+15]=1;U=Ya[J.a];V=Ya[J.b];W=Ya[J.c];za=Ya[J.d];ra[H]=U.x;ra[H+1]=U.y;ra[H+2]=U.z;ra[H+
|
|
|
-3]=1;ra[H+4]=V.x;ra[H+5]=V.y;ra[H+6]=V.z;ra[H+7]=1;ra[H+8]=W.x;ra[H+9]=W.y;ra[H+10]=W.z;ra[H+11]=1;ra[H+12]=za.x;ra[H+13]=za.y;ra[H+14]=za.z;ra[H+15]=1;H+=16}if(eb&&Ua.length){U=Ua[J.a];V=Ua[J.b];W=Ua[J.c];za=Ua[J.d];ka[Ja]=U.r;ka[Ja+1]=U.g;ka[Ja+2]=U.b;ka[Ja+3]=V.r;ka[Ja+4]=V.g;ka[Ja+5]=V.b;ka[Ja+6]=W.r;ka[Ja+7]=W.g;ka[Ja+8]=W.b;ka[Ja+9]=za.r;ka[Ja+10]=za.g;ka[Ja+11]=za.b;Ja+=12}if(db&&Ea.hasTangents){U=Ra[J.a].tangent;V=Ra[J.b].tangent;W=Ra[J.c].tangent;J=Ra[J.d].tangent;S[sa]=U.x;S[sa+1]=U.y;S[sa+
|
|
|
-2]=U.z;S[sa+3]=U.w;S[sa+4]=V.x;S[sa+5]=V.y;S[sa+6]=V.z;S[sa+7]=V.w;S[sa+8]=W.x;S[sa+9]=W.y;S[sa+10]=W.z;S[sa+11]=W.w;S[sa+12]=J.x;S[sa+13]=J.y;S[sa+14]=J.z;S[sa+15]=J.w;sa+=16}if(cb)if(Oa.length==4&&Wa)for(J=0;J<4;J++){Ia=Oa[J];P[wa]=Ia.x;P[wa+1]=Ia.y;P[wa+2]=Ia.z;wa+=3}else for(J=0;J<4;J++){P[wa]=Ia.x;P[wa+1]=Ia.y;P[wa+2]=Ia.z;wa+=3}if($a&&Pa)for(J=0;J<4;J++){Oa=Pa[J];na[ma]=Oa.u;na[ma+1]=Oa.v;ma+=2}if($a&&Qa)for(J=0;J<4;J++){Pa=Qa[J];ga[ya]=Pa.u;ga[ya+1]=Pa.v;ya+=2}if(bb){La[Ga]=F;La[Ga+1]=F+1;
|
|
|
-La[Ga+2]=F+2;La[Ga+3]=F;La[Ga+4]=F+2;La[Ga+5]=F+3;Ga+=6;Ka[Na]=F;Ka[Na+1]=F+1;Ka[Na+2]=F;Ka[Na+3]=F+3;Ka[Na+4]=F+1;Ka[Na+5]=F+2;Ka[Na+6]=F+2;Ka[Na+7]=F+3;Na+=8;F+=4}}}if(Sa){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,G)}if(ab){Ma=0;for(Fa=Ta.length;Ma<Fa;Ma++){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLVertexKeysBuffers[Ma]);e.bufferData(e.ARRAY_BUFFER,O[Ma],G)}}if(eb&&Ua.length){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,ka,G)}if(cb){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-A.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,P,G)}if(db&&Ea.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,S,G)}if($a&&ma>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,na,G)}if($a&&ya>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,ga,G)}if(bb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,La,G);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);
|
|
|
-e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ka,G)}if(H>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,oa,G);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ra,G);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ua,G);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,Aa,G)}}}o.__dirtyVertices=!1;o.__dirtyVertexKeys=!1;o.__dirtyElements=!1;o.__dirtyUvs=!1;o.__dirtyNormals=
|
|
|
-!1;o.__dirtyTangents=!1;o.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){o=m.geometry;if(o.__dirtyVertices||o.__dirtyColors){m=o;C=e.DYNAMIC_DRAW;F=void 0;F=void 0;$=void 0;A=void 0;N=m.vertices;G=m.colors;ma=N.length;Q=G.length;ya=m.__vertexArray;ja=m.__colorArray;Ga=m.__dirtyColors;if(m.__dirtyVertices){for(F=0;F<ma;F++){$=N[F].position;A=F*3;ya[A]=$.x;ya[A+1]=$.y;ya[A+2]=$.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ya,C)}if(Ga){for(F=0;F<Q;F++){color=
|
|
|
-G[F];A=F*3;ja[A]=color.r;ja[A+1]=color.g;ja[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,ja,C)}}o.__dirtyVertices=!1;o.__dirtyColors=!1}else if(m instanceof THREE.Line){o=m.geometry;if(o.__dirtyVertices||o.__dirtyColors){m=o;C=e.DYNAMIC_DRAW;F=void 0;F=void 0;$=void 0;A=void 0;N=m.vertices;G=m.colors;ma=N.length;Q=G.length;ya=m.__vertexArray;ja=m.__colorArray;Ga=m.__dirtyColors;if(m.__dirtyVertices){for(F=0;F<ma;F++){$=N[F].position;A=F*3;ya[A]=$.x;ya[A+
|
|
|
-1]=$.y;ya[A+2]=$.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ya,C)}if(Ga){for(F=0;F<Q;F++){color=G[F];A=F*3;ja[A]=color.r;ja[A+1]=color.g;ja[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,ja,C)}}o.__dirtyVertices=!1;o.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){o=m.geometry;(o.__dirtyVertices||o.__dirtyColors||m.sortParticles)&&b(o,e.DYNAMIC_DRAW,m);o.__dirtyVertices=!1;o.__dirtyColors=!1}}};this.setFaceCulling=
|
|
|
-function(l,z){if(l){!z||z=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
-THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
-envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
|
|
|
-envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
|
-map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
|
|
|
-lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
|
+THREE.Projector=function(){function a(M,e){return e.z-M.z}function b(M,e){var X=0,S=1,da=M.z+M.w,ga=e.z+e.w,I=-M.z+M.w,ca=-e.z+e.w;if(da>=0&&ga>=0&&I>=0&&ca>=0)return!0;else if(da<0&&ga<0||I<0&&ca<0)return!1;else{if(da<0)X=Math.max(X,da/(da-ga));else ga<0&&(S=Math.min(S,da/(da-ga)));if(I<0)X=Math.max(X,I/(I-ca));else ca<0&&(S=Math.min(S,I/(I-ca)));if(S<X)return!1;else{M.lerpSelf(e,X);e.lerpSelf(M,1-S);return!0}}}var c,d,f=[],g,h,j,k=[],o,q,x=[],u,t,z=[],B=new THREE.Vector4,D=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],O=new THREE.Vector4,L=new THREE.Vector4,Y;this.projectObjects=function(M,e,X){e=[];var S,da,ga;d=0;da=M.objects;M=0;for(S=da.length;M<S;M++){ga=da[M];var I;if(!(I=!ga.visible))if(I=ga instanceof THREE.Mesh){a:{I=void 0;for(var ca=ga.matrixWorld,za=-ga.geometry.boundingSphere.radius*Math.max(ga.scale.x,Math.max(ga.scale.y,ga.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<=za){I=!1;break a}}I=!0}I=!I}if(!I){c=f[d]=f[d]||new THREE.RenderableObject;B.copy(ga.position);v.multiplyVector3(B);c.object=ga;c.z=B.z;e.push(c);d++}}X&&e.sort(a);return e};this.projectScene=function(M,e,X){var S=[],da=e.near,ga=e.far,I,ca,za,ea,xa,ja,ha,va,Aa,ia,$,qa,ra,Q,ma,ta;j=q=t=0;e.matrixAutoUpdate&&e.update();v.multiply(e.projectionMatrix,e.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++){ja=w[I];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}M.update(undefined,!1,e);ja=this.projectObjects(M,e,!0);M=0;for(I=ja.length;M<I;M++){ha=ja[M].object;if(ha.visible){va=ha.matrixWorld;$=ha.matrixRotationWorld;
|
|
|
+Aa=ha.materials;ia=ha.overdraw;if(ha instanceof THREE.Mesh){qa=ha.geometry;ra=qa.vertices;ca=0;for(za=ra.length;ca<za;ca++){Q=ra[ca];Q.positionWorld.copy(Q.position);va.multiplyVector3(Q.positionWorld);ea=Q.positionScreen;ea.copy(Q.positionWorld);v.multiplyVector4(ea);ea.x/=ea.w;ea.y/=ea.w;Q.__visible=ea.z>da&&ea.z<ga}qa=qa.faces;ca=0;for(za=qa.length;ca<za;ca++){Q=qa[ca];if(Q instanceof THREE.Face3){ea=ra[Q.a];xa=ra[Q.b];ma=ra[Q.c];if(ea.__visible&&xa.__visible&&ma.__visible&&(ha.doubleSided||ha.flipSided!=
|
|
|
+(ma.positionScreen.x-ea.positionScreen.x)*(xa.positionScreen.y-ea.positionScreen.y)-(ma.positionScreen.y-ea.positionScreen.y)*(xa.positionScreen.x-ea.positionScreen.x)<0)){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ea.positionWorld);g.v2.positionWorld.copy(xa.positionWorld);g.v3.positionWorld.copy(ma.positionWorld);g.v1.positionScreen.copy(ea.positionScreen);g.v2.positionScreen.copy(xa.positionScreen);g.v3.positionScreen.copy(ma.positionScreen);g.normalWorld.copy(Q.normal);$.multiplyVector3(g.normalWorld);
|
|
|
+g.centroidWorld.copy(Q.centroid);va.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);ma=Q.vertexNormals;Y=g.vertexNormalsWorld;ea=0;for(xa=ma.length;ea<xa;ea++){ta=Y[ea]=Y[ea]||new THREE.Vector3;ta.copy(ma[ea]);$.multiplyVector3(ta)}g.z=g.centroidScreen.z;g.meshMaterials=Aa;g.faceMaterials=Q.materials;g.overdraw=ia;if(ha.geometry.uvs[ca]){g.uvs[0]=ha.geometry.uvs[ca][0];g.uvs[1]=ha.geometry.uvs[ca][1];g.uvs[2]=ha.geometry.uvs[ca][2]}S.push(g);
|
|
|
+j++}}else if(Q instanceof THREE.Face4){ea=ra[Q.a];xa=ra[Q.b];ma=ra[Q.c];ta=ra[Q.d];if(ea.__visible&&xa.__visible&&ma.__visible&&ta.__visible&&(ha.doubleSided||ha.flipSided!=((ta.positionScreen.x-ea.positionScreen.x)*(xa.positionScreen.y-ea.positionScreen.y)-(ta.positionScreen.y-ea.positionScreen.y)*(xa.positionScreen.x-ea.positionScreen.x)<0||(xa.positionScreen.x-ma.positionScreen.x)*(ta.positionScreen.y-ma.positionScreen.y)-(xa.positionScreen.y-ma.positionScreen.y)*(ta.positionScreen.x-ma.positionScreen.x)<
|
|
|
+0))){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ea.positionWorld);g.v2.positionWorld.copy(xa.positionWorld);g.v3.positionWorld.copy(ta.positionWorld);g.v1.positionScreen.copy(ea.positionScreen);g.v2.positionScreen.copy(xa.positionScreen);g.v3.positionScreen.copy(ta.positionScreen);g.normalWorld.copy(Q.normal);$.multiplyVector3(g.normalWorld);g.centroidWorld.copy(Q.centroid);va.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);
|
|
|
+g.z=g.centroidScreen.z;g.meshMaterials=Aa;g.faceMaterials=Q.materials;g.overdraw=ia;if(ha.geometry.uvs[ca]){g.uvs[0]=ha.geometry.uvs[ca][0];g.uvs[1]=ha.geometry.uvs[ca][1];g.uvs[2]=ha.geometry.uvs[ca][3]}S.push(g);j++;h=k[j]=k[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(xa.positionWorld);h.v2.positionWorld.copy(ma.positionWorld);h.v3.positionWorld.copy(ta.positionWorld);h.v1.positionScreen.copy(xa.positionScreen);h.v2.positionScreen.copy(ma.positionScreen);h.v3.positionScreen.copy(ta.positionScreen);
|
|
|
+h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=Aa;h.faceMaterials=Q.materials;h.overdraw=ia;if(ha.geometry.uvs[ca]){h.uvs[0]=ha.geometry.uvs[ca][1];h.uvs[1]=ha.geometry.uvs[ca][2];h.uvs[2]=ha.geometry.uvs[ca][3]}S.push(h);j++}}}}else if(ha instanceof THREE.Line){E.multiply(v,va);ra=ha.geometry.vertices;Q=ra[0];Q.positionScreen.copy(Q.position);E.multiplyVector4(Q.positionScreen);ca=1;for(za=ra.length;ca<
|
|
|
+za;ca++){ea=ra[ca];ea.positionScreen.copy(ea.position);E.multiplyVector4(ea.positionScreen);xa=ra[ca-1];O.copy(ea.positionScreen);L.copy(xa.positionScreen);if(b(O,L)){O.multiplyScalar(1/O.w);L.multiplyScalar(1/L.w);o=x[q]=x[q]||new THREE.RenderableLine;o.v1.positionScreen.copy(O);o.v2.positionScreen.copy(L);o.z=Math.max(O.z,L.z);o.materials=ha.materials;S.push(o);q++}}}else if(ha instanceof THREE.Particle){D.set(ha.position.x,ha.position.y,ha.position.z,1);v.multiplyVector4(D);D.z/=D.w;if(D.z>0&&
|
|
|
+D.z<1){u=z[t]=z[t]||new THREE.RenderableParticle;u.x=D.x/D.w;u.y=D.y/D.w;u.z=D.z;u.rotation=ha.rotation.z;u.scale.x=ha.scale.x*Math.abs(u.x-(D.x+e.projectionMatrix.n11)/(D.w+e.projectionMatrix.n14));u.scale.y=ha.scale.y*Math.abs(u.y-(D.y+e.projectionMatrix.n22)/(D.w+e.projectionMatrix.n24));u.materials=ha.materials;S.push(u);t++}}}}X&&S.sort(a);return S};this.unprojectVector=function(M,e){var X=e.matrixWorld.clone();X.multiplySelf(THREE.Matrix4.makeInvert(e.projectionMatrix));X.multiplyVector3(M);
|
|
|
+return M}};
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,j){c=h;d=j;f=c/2;g=d/2};this.render=function(h,j){var k,o,q,x,u,t,z,B;a=b.projectScene(h,j);k=0;for(o=a.length;k<o;k++){u=a[k];if(u instanceof THREE.RenderableParticle){z=u.x*f+f;B=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=z+"px";t.style.top=B+"px"}}}}}};
|
|
|
+THREE.CanvasRenderer=function(){function a(ka){if(u!=ka)o.globalAlpha=u=ka}function b(ka){if(t!=ka){switch(ka){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}t=ka}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,j,k,o=f.getContext("2d"),q=new THREE.Color(0),x=0,u=1,t=0,z=null,B=null,D=1,v,E,w,O,L,Y,M,e,X,S=new THREE.Color,
|
|
|
+da=new THREE.Color,ga=new THREE.Color,I=new THREE.Color,ca=new THREE.Color,za,ea,xa,ja,ha,va,Aa,ia,$,qa=new THREE.Rectangle,ra=new THREE.Rectangle,Q=new THREE.Rectangle,ma=!1,ta=new THREE.Color,l=new THREE.Color,A=new THREE.Color,p=new THREE.Color,n=Math.PI*2,m=new THREE.Vector3,C,y,G,N,R,F,aa=16;C=document.createElement("canvas");C.width=C.height=2;y=C.getContext("2d");y.fillStyle="rgba(0,0,0,1)";y.fillRect(0,0,2,2);G=y.getImageData(0,0,2,2);N=G.data;R=document.createElement("canvas");R.width=R.height=
|
|
|
+aa;F=R.getContext("2d");F.translate(-aa/2,-aa/2);F.scale(aa,aa);aa--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ka,na){g=ka;h=na;j=g/2;k=h/2;f.width=g;f.height=h;qa.set(-j,-k,j,k);u=1;t=0;B=z=null;D=1};this.setClearColor=function(ka,na){q=ka;x=na};this.setClearColorHex=function(ka,na){q.setHex(ka);x=na};this.clear=function(){o.setTransform(1,0,0,-1,j,k);if(!ra.isEmpty()){ra.inflate(1);ra.minSelf(qa);if(q.hex==0&&x==0)o.clearRect(ra.getX(),ra.getY(),
|
|
|
+ra.getWidth(),ra.getHeight());else{b(THREE.NormalBlending);a(1);o.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+x+")";o.fillRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight())}ra.empty()}};this.render=function(ka,na){function wa(P){var oa,Z,J,U=P.lights;l.setRGB(0,0,0);A.setRGB(0,0,0);p.setRGB(0,0,0);P=0;for(oa=U.length;P<oa;P++){Z=U[P];J=Z.color;if(Z instanceof THREE.AmbientLight){l.r+=J.r;l.g+=J.g;l.b+=J.b}else if(Z instanceof THREE.DirectionalLight){A.r+=
|
|
|
+J.r;A.g+=J.g;A.b+=J.b}else if(Z instanceof THREE.PointLight){p.r+=J.r;p.g+=J.g;p.b+=J.b}}}function la(P,oa,Z,J){var U,fa,pa,sa,ua=P.lights;P=0;for(U=ua.length;P<U;P++){fa=ua[P];pa=fa.color;sa=fa.intensity;if(fa instanceof THREE.DirectionalLight){fa=Z.dot(fa.position)*sa;if(fa>0){J.r+=pa.r*fa;J.g+=pa.g*fa;J.b+=pa.b*fa}}else if(fa instanceof THREE.PointLight){m.sub(fa.position,oa);m.normalize();fa=Z.dot(m)*sa;if(fa>0){J.r+=pa.r*fa;J.g+=pa.g*fa;J.b+=pa.b*fa}}}}function Ca(P,oa,Z){if(Z.opacity!=0){a(Z.opacity);
|
|
|
+b(Z.blending);var J,U,fa,pa,sa,ua;if(Z instanceof THREE.ParticleBasicMaterial){if(Z.map){pa=Z.map.image;sa=pa.width>>1;ua=pa.height>>1;U=oa.scale.x*j;fa=oa.scale.y*k;Z=U*sa;J=fa*ua;Q.set(P.x-Z,P.y-J,P.x+Z,P.y+J);if(qa.instersects(Q)){o.save();o.translate(P.x,P.y);o.rotate(-oa.rotation);o.scale(U,-fa);o.translate(-sa,-ua);o.drawImage(pa,0,0);o.restore()}}}else if(Z instanceof THREE.ParticleCircleMaterial){if(ma){ta.r=l.r+A.r+p.r;ta.g=l.g+A.g+p.g;ta.b=l.b+A.b+p.b;S.r=Z.color.r*ta.r;S.g=Z.color.g*ta.g;
|
|
|
+S.b=Z.color.b*ta.b;S.updateStyleString()}else S.__styleString=Z.color.__styleString;Z=oa.scale.x*j;J=oa.scale.y*k;Q.set(P.x-Z,P.y-J,P.x+Z,P.y+J);if(qa.instersects(Q)){U=S.__styleString;if(B!=U)o.fillStyle=B=U;o.save();o.translate(P.x,P.y);o.rotate(-oa.rotation);o.scale(Z,J);o.beginPath();o.arc(0,0,1,0,n,!0);o.closePath();o.fill();o.restore()}}}}function Da(P,oa,Z,J){if(J.opacity!=0){a(J.opacity);b(J.blending);o.beginPath();o.moveTo(P.positionScreen.x,P.positionScreen.y);o.lineTo(oa.positionScreen.x,
|
|
|
+oa.positionScreen.y);o.closePath();if(J instanceof THREE.LineBasicMaterial){S.__styleString=J.color.__styleString;P=J.linewidth;if(D!=P)o.lineWidth=D=P;P=S.__styleString;if(z!=P)o.strokeStyle=z=P;o.stroke();Q.inflate(J.linewidth*2)}}}function Pa(P,oa,Z,J,U,fa){if(U.opacity!=0){a(U.opacity);b(U.blending);O=P.positionScreen.x;L=P.positionScreen.y;Y=oa.positionScreen.x;M=oa.positionScreen.y;e=Z.positionScreen.x;X=Z.positionScreen.y;o.beginPath();o.moveTo(O,L);o.lineTo(Y,M);o.lineTo(e,X);o.lineTo(O,L);
|
|
|
+o.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.mapping instanceof THREE.UVMapping&&Ia(O,L,Y,M,e,X,U.map.image,J.uvs[0].u,J.uvs[0].v,J.uvs[1].u,J.uvs[1].v,J.uvs[2].u,J.uvs[2].v);else if(U.envMap){if(U.envMap.mapping instanceof THREE.SphericalReflectionMapping){P=na.matrixWorldInverse;m.copy(J.vertexNormalsWorld[0]);ja=(m.x*P.n11+m.y*P.n12+m.z*P.n13)*0.5+0.5;ha=-(m.x*P.n21+m.y*P.n22+m.z*P.n23)*0.5+0.5;m.copy(J.vertexNormalsWorld[1]);va=(m.x*P.n11+m.y*P.n12+m.z*P.n13)*0.5+0.5;Aa=
|
|
|
+-(m.x*P.n21+m.y*P.n22+m.z*P.n23)*0.5+0.5;m.copy(J.vertexNormalsWorld[2]);ia=(m.x*P.n11+m.y*P.n12+m.z*P.n13)*0.5+0.5;$=-(m.x*P.n21+m.y*P.n22+m.z*P.n23)*0.5+0.5;Ia(O,L,Y,M,e,X,U.envMap.image,ja,ha,va,Aa,ia,$)}}else U.wireframe?K(U.color.__styleString,U.wireframeLinewidth):Na(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ia(O,L,Y,M,e,X,U.map.image,J.uvs[0].u,J.uvs[0].v,J.uvs[1].u,J.uvs[1].v,J.uvs[2].u,J.uvs[2].v);
|
|
|
+b(THREE.SubtractiveBlending)}if(ma)if(!U.wireframe&&U.shading==THREE.SmoothShading&&J.vertexNormalsWorld.length==3){da.r=ga.r=I.r=l.r;da.g=ga.g=I.g=l.g;da.b=ga.b=I.b=l.b;la(fa,J.v1.positionWorld,J.vertexNormalsWorld[0],da);la(fa,J.v2.positionWorld,J.vertexNormalsWorld[1],ga);la(fa,J.v3.positionWorld,J.vertexNormalsWorld[2],I);ca.r=(ga.r+I.r)*0.5;ca.g=(ga.g+I.g)*0.5;ca.b=(ga.b+I.b)*0.5;xa=Oa(da,ga,I,ca);Ia(O,L,Y,M,e,X,xa,0,0,1,0,0,1)}else{ta.r=l.r;ta.g=l.g;ta.b=l.b;la(fa,J.centroidWorld,J.normalWorld,
|
|
|
+ta);S.r=U.color.r*ta.r;S.g=U.color.g*ta.g;S.b=U.color.b*ta.b;S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframeLinewidth):Na(S.__styleString)}else U.wireframe?K(U.color.__styleString,U.wireframeLinewidth):Na(U.color.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){za=na.near;ea=na.far;da.r=da.g=da.b=1-T(P.positionScreen.z,za,ea);ga.r=ga.g=ga.b=1-T(oa.positionScreen.z,za,ea);I.r=I.g=I.b=1-T(Z.positionScreen.z,za,ea);ca.r=(ga.r+I.r)*0.5;ca.g=(ga.g+I.g)*0.5;ca.b=(ga.b+I.b)*0.5;
|
|
|
+xa=Oa(da,ga,I,ca);Ia(O,L,Y,M,e,X,xa,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){S.r=V(J.normalWorld.x);S.g=V(J.normalWorld.y);S.b=V(J.normalWorld.z);S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframeLinewidth):Na(S.__styleString)}}}function K(P,oa){if(z!=P)o.strokeStyle=z=P;if(D!=oa)o.lineWidth=D=oa;o.stroke();Q.inflate(oa*2)}function Na(P){if(B!=P)o.fillStyle=B=P;o.fill()}function Ia(P,oa,Z,J,U,fa,pa,sa,ua,Ra,La,Ka,Wa){var Ea,Sa;Ea=pa.width-1;Sa=pa.height-1;sa*=Ea;ua*=
|
|
|
+Sa;Ra*=Ea;La*=Sa;Ka*=Ea;Wa*=Sa;Z-=P;J-=oa;U-=P;fa-=oa;Ra-=sa;La-=ua;Ka-=sa;Wa-=ua;Ea=Ra*Wa-Ka*La;if(Ea!=0){Sa=1/Ea;Ea=(Wa*Z-La*U)*Sa;La=(Wa*J-La*fa)*Sa;Z=(Ra*U-Ka*Z)*Sa;J=(Ra*fa-Ka*J)*Sa;P=P-Ea*sa-Z*ua;oa=oa-La*sa-J*ua;o.save();o.transform(Ea,La,Z,J,P,oa);o.clip();o.drawImage(pa,0,0);o.restore()}}function Oa(P,oa,Z,J){var U=~~(P.r*255),fa=~~(P.g*255);P=~~(P.b*255);var pa=~~(oa.r*255),sa=~~(oa.g*255);oa=~~(oa.b*255);var ua=~~(Z.r*255),Ra=~~(Z.g*255);Z=~~(Z.b*255);var La=~~(J.r*255),Ka=~~(J.g*255);
|
|
|
+J=~~(J.b*255);N[0]=U<0?0:U>255?255:U;N[1]=fa<0?0:fa>255?255:fa;N[2]=P<0?0:P>255?255:P;N[4]=pa<0?0:pa>255?255:pa;N[5]=sa<0?0:sa>255?255:sa;N[6]=oa<0?0:oa>255?255:oa;N[8]=ua<0?0:ua>255?255:ua;N[9]=Ra<0?0:Ra>255?255:Ra;N[10]=Z<0?0:Z>255?255:Z;N[12]=La<0?0:La>255?255:La;N[13]=Ka<0?0:Ka>255?255:Ka;N[14]=J<0?0:J>255?255:J;y.putImageData(G,0,0);F.drawImage(C,0,0);return R}function T(P,oa,Z){P=(P-oa)/(Z-oa);return P*P*(3-2*P)}function V(P){P=(P+1)*0.5;return P<0?0:P>1?1:P}function W(P,oa){var Z=oa.x-P.x,
|
|
|
+J=oa.y-P.y,U=1/Math.sqrt(Z*Z+J*J);Z*=U;J*=U;oa.x+=Z;oa.y+=J;P.x-=Z;P.y-=J}var ya,Ma,Fa,Ba,Ga,H,Ja,Ha;this.autoClear?this.clear():o.setTransform(1,0,0,-1,j,k);c=d.projectScene(ka,na,this.sortElements);(ma=ka.lights.length>0)&&wa(ka);ya=0;for(Ma=c.length;ya<Ma;ya++){Fa=c[ya];Q.empty();if(Fa instanceof THREE.RenderableParticle){v=Fa;v.x*=j;v.y*=k;Ba=0;for(Ga=Fa.materials.length;Ba<Ga;Ba++)Ca(v,Fa,Fa.materials[Ba],ka)}else if(Fa instanceof THREE.RenderableLine){v=Fa.v1;E=Fa.v2;v.positionScreen.x*=j;v.positionScreen.y*=
|
|
|
+k;E.positionScreen.x*=j;E.positionScreen.y*=k;Q.addPoint(v.positionScreen.x,v.positionScreen.y);Q.addPoint(E.positionScreen.x,E.positionScreen.y);if(qa.instersects(Q)){Ba=0;for(Ga=Fa.materials.length;Ba<Ga;)Da(v,E,Fa,Fa.materials[Ba++],ka)}}else if(Fa instanceof THREE.RenderableFace3){v=Fa.v1;E=Fa.v2;w=Fa.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(Fa.overdraw){W(v.positionScreen,E.positionScreen);W(E.positionScreen,
|
|
|
+w.positionScreen);W(w.positionScreen,v.positionScreen)}Q.add3Points(v.positionScreen.x,v.positionScreen.y,E.positionScreen.x,E.positionScreen.y,w.positionScreen.x,w.positionScreen.y);if(qa.instersects(Q)){Ba=0;for(Ga=Fa.meshMaterials.length;Ba<Ga;){Ha=Fa.meshMaterials[Ba++];if(Ha instanceof THREE.MeshFaceMaterial){H=0;for(Ja=Fa.faceMaterials.length;H<Ja;)(Ha=Fa.faceMaterials[H++])&&Pa(v,E,w,Fa,Ha,ka)}else Pa(v,E,w,Fa,Ha,ka)}}}ra.addRectangle(Q)}o.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(ja,ha,va){var Aa,ia,$,qa;Aa=0;for(ia=ja.lights.length;Aa<ia;Aa++){$=ja.lights[Aa];if($ instanceof THREE.DirectionalLight){qa=ha.normalWorld.dot($.position)*$.intensity;if(qa>0){va.r+=$.color.r*qa;va.g+=$.color.g*qa;va.b+=$.color.b*qa}}else if($ instanceof THREE.PointLight){X.sub($.position,ha.centroidWorld);X.normalize();qa=ha.normalWorld.dot(X)*$.intensity;if(qa>0){va.r+=$.color.r*qa;va.g+=$.color.g*qa;va.b+=$.color.b*qa}}}}function b(ja,ha,va,Aa,ia,$){I=d(ca++);
|
|
|
+I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ia instanceof THREE.MeshBasicMaterial)w.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshLambertMaterial)if(E){O.r=L.r;O.g=L.g;O.b=L.b;a($,Aa,O);w.r=ia.color.r*O.r;w.g=ia.color.g*O.g;w.b=ia.color.b*O.b;w.updateStyleString()}else w.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshDepthMaterial){e=
|
|
|
+1-ia.__2near/(ia.__farPlusNear-Aa.z*ia.__farMinusNear);w.setRGB(e,e,e)}else ia instanceof THREE.MeshNormalMaterial&&w.setRGB(f(Aa.normalWorld.x),f(Aa.normalWorld.y),f(Aa.normalWorld.z));ia.wireframe?I.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+ia.wireframeLinewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.wireframeLinecap+"; stroke-linejoin: "+ia.wireframeLinejoin):I.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+ia.opacity);j.appendChild(I)}
|
|
|
+function c(ja,ha,va,Aa,ia,$,qa){I=d(ca++);I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+Aa.positionScreen.x+","+Aa.positionScreen.y+"z");if($ instanceof THREE.MeshBasicMaterial)w.__styleString=$.color.__styleString;else if($ instanceof THREE.MeshLambertMaterial)if(E){O.r=L.r;O.g=L.g;O.b=L.b;a(qa,ia,O);w.r=$.color.r*O.r;w.g=$.color.g*O.g;w.b=$.color.b*O.b;w.updateStyleString()}else w.__styleString=
|
|
|
+$.color.__styleString;else if($ instanceof THREE.MeshDepthMaterial){e=1-$.__2near/($.__farPlusNear-ia.z*$.__farMinusNear);w.setRGB(e,e,e)}else $ instanceof THREE.MeshNormalMaterial&&w.setRGB(f(ia.normalWorld.x),f(ia.normalWorld.y),f(ia.normalWorld.z));$.wireframe?I.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+$.wireframeLinewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.wireframeLinecap+"; stroke-linejoin: "+$.wireframeLinejoin):I.setAttribute("style",
|
|
|
+"fill: "+w.__styleString+"; fill-opacity: "+$.opacity);j.appendChild(I)}function d(ja){if(S[ja]==null){S[ja]=document.createElementNS("http://www.w3.org/2000/svg","path");xa==0&&S[ja].setAttribute("shape-rendering","crispEdges")}return S[ja]}function f(ja){return ja<0?Math.min((1+ja)*0.5,0.5):0.5+Math.min(ja*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,o,q,x,u,t,z,B,D=new THREE.Rectangle,v=new THREE.Rectangle,E=!1,w=new THREE.Color(16777215),
|
|
|
+O=new THREE.Color(16777215),L=new THREE.Color(0),Y=new THREE.Color(0),M=new THREE.Color(0),e,X=new THREE.Vector3,S=[],da=[],ga=[],I,ca,za,ea,xa=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ja){switch(ja){case "high":xa=1;break;case "low":xa=0}};this.setSize=function(ja,ha){k=ja;o=ha;q=k/2;x=o/2;j.setAttribute("viewBox",-q+" "+-x+" "+k+" "+o);j.setAttribute("width",k);j.setAttribute("height",o);D.set(-q,-x,q,x)};this.clear=function(){for(;j.childNodes.length>
|
|
|
+0;)j.removeChild(j.childNodes[0])};this.render=function(ja,ha){var va,Aa,ia,$,qa,ra,Q,ma;this.autoClear&&this.clear();g=h.projectScene(ja,ha,this.sortElements);ea=za=ca=0;if(E=ja.lights.length>0){Q=ja.lights;L.setRGB(0,0,0);Y.setRGB(0,0,0);M.setRGB(0,0,0);va=0;for(Aa=Q.length;va<Aa;va++){ia=Q[va];$=ia.color;if(ia instanceof THREE.AmbientLight){L.r+=$.r;L.g+=$.g;L.b+=$.b}else if(ia instanceof THREE.DirectionalLight){Y.r+=$.r;Y.g+=$.g;Y.b+=$.b}else if(ia instanceof THREE.PointLight){M.r+=$.r;M.g+=$.g;
|
|
|
+M.b+=$.b}}}va=0;for(Aa=g.length;va<Aa;va++){Q=g[va];v.empty();if(Q instanceof THREE.RenderableParticle){u=Q;u.x*=q;u.y*=-x;ia=0;for($=Q.materials.length;ia<$;ia++)if(ma=Q.materials[ia]){qa=u;ra=Q;var ta=za++;if(da[ta]==null){da[ta]=document.createElementNS("http://www.w3.org/2000/svg","circle");xa==0&&da[ta].setAttribute("shape-rendering","crispEdges")}I=da[ta];I.setAttribute("cx",qa.x);I.setAttribute("cy",qa.y);I.setAttribute("r",ra.scale.x*q);if(ma instanceof THREE.ParticleCircleMaterial){if(E){O.r=
|
|
|
+L.r+Y.r+M.r;O.g=L.g+Y.g+M.g;O.b=L.b+Y.b+M.b;w.r=ma.color.r*O.r;w.g=ma.color.g*O.g;w.b=ma.color.b*O.b;w.updateStyleString()}else w=ma.color;I.setAttribute("style","fill: "+w.__styleString)}j.appendChild(I)}}else if(Q instanceof THREE.RenderableLine){u=Q.v1;t=Q.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(D.instersects(v)){ia=0;for($=Q.materials.length;ia<
|
|
|
+$;)if(ma=Q.materials[ia++]){qa=u;ra=t;ta=ea++;if(ga[ta]==null){ga[ta]=document.createElementNS("http://www.w3.org/2000/svg","line");xa==0&&ga[ta].setAttribute("shape-rendering","crispEdges")}I=ga[ta];I.setAttribute("x1",qa.positionScreen.x);I.setAttribute("y1",qa.positionScreen.y);I.setAttribute("x2",ra.positionScreen.x);I.setAttribute("y2",ra.positionScreen.y);if(ma instanceof THREE.LineBasicMaterial){w.__styleString=ma.color.__styleString;I.setAttribute("style","fill: none; stroke: "+w.__styleString+
|
|
|
+"; stroke-width: "+ma.linewidth+"; stroke-opacity: "+ma.opacity+"; stroke-linecap: "+ma.linecap+"; stroke-linejoin: "+ma.linejoin);j.appendChild(I)}}}}else if(Q instanceof THREE.RenderableFace3){u=Q.v1;t=Q.v2;z=Q.v3;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;z.positionScreen.x*=q;z.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(z.positionScreen.x,z.positionScreen.y);
|
|
|
+if(D.instersects(v)){ia=0;for($=Q.meshMaterials.length;ia<$;){ma=Q.meshMaterials[ia++];if(ma instanceof THREE.MeshFaceMaterial){qa=0;for(ra=Q.faceMaterials.length;qa<ra;)(ma=Q.faceMaterials[qa++])&&b(u,t,z,Q,ma,ja)}else ma&&b(u,t,z,Q,ma,ja)}}}else if(Q instanceof THREE.RenderableFace4){u=Q.v1;t=Q.v2;z=Q.v3;B=Q.v4;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;z.positionScreen.x*=q;z.positionScreen.y*=-x;B.positionScreen.x*=q;B.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,
|
|
|
+u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(z.positionScreen.x,z.positionScreen.y);v.addPoint(B.positionScreen.x,B.positionScreen.y);if(D.instersects(v)){ia=0;for($=Q.meshMaterials.length;ia<$;){ma=Q.meshMaterials[ia++];if(ma instanceof THREE.MeshFaceMaterial){qa=0;for(ra=Q.faceMaterials.length;qa<ra;)(ma=Q.faceMaterials[qa++])&&c(u,t,z,B,Q,ma,ja)}else ma&&c(u,t,z,B,Q,ma,ja)}}}}}};
|
|
|
+THREE.WebGLRenderer=function(a){function b(l,A,p){var n,m,C,y=l.vertices,G=y.length,N=l.colors,R=N.length,F=l.__vertexArray,aa=l.__colorArray,ka=l.__sortArray,na=l.__dirtyVertices,wa=l.__dirtyColors;if(p.sortParticles){Aa.multiplySelf(p.matrixWorld);for(n=0;n<G;n++){m=y[n].position;qa.copy(m);Aa.multiplyVector3(qa);ka[n]=[qa.z,n]}ka.sort(function(la,Ca){return Ca[0]-la[0]});for(n=0;n<G;n++){m=y[ka[n][1]].position;C=n*3;F[C]=m.x;F[C+1]=m.y;F[C+2]=m.z}for(n=0;n<R;n++){C=n*3;color=N[ka[n][1]];aa[C]=
|
|
|
+color.r;aa[C+1]=color.g;aa[C+2]=color.b}}else{if(na)for(n=0;n<G;n++){m=y[n].position;C=n*3;F[C]=m.x;F[C+1]=m.y;F[C+2]=m.z}if(wa)for(n=0;n<R;n++){color=N[n];C=n*3;aa[C]=color.r;aa[C+1]=color.g;aa[C+2]=color.b}}if(na||p.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,F,A)}if(wa||p.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,aa,A)}}function c(l,A){l.fragmentShader=A.fragmentShader;l.vertexShader=A.vertexShader;
|
|
|
+l.uniforms=Uniforms.clone(A.uniforms)}function d(l,A,p,n,m){n.program||da.initMaterial(n,A,p,m);var C=n.program,y=C.uniforms,G=n.uniforms;if(C!=X){e.useProgram(C);X=C;e.uniformMatrix4fv(y.projectionMatrix,!1,ia)}if(p&&(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial||n instanceof THREE.LineBasicMaterial||n instanceof THREE.ParticleBasicMaterial)){G.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){G.fogNear.value=p.near;
|
|
|
+G.fogFar.value=p.far}else if(p instanceof THREE.FogExp2)G.fogDensity.value=p.density}if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial){var N,R,F=0,aa=0,ka=0,na,wa,la,Ca=ra,Da=Ca.directional.colors,Pa=Ca.directional.positions,K=Ca.point.colors,Na=Ca.point.positions,Ia=0,Oa=0;p=R=R=0;for(N=A.length;p<N;p++){R=A[p];na=R.color;wa=R.position;la=R.intensity;if(R instanceof THREE.AmbientLight){F+=na.r;aa+=na.g;ka+=na.b}else if(R instanceof THREE.DirectionalLight){R=Ia*3;Da[R]=
|
|
|
+na.r*la;Da[R+1]=na.g*la;Da[R+2]=na.b*la;Pa[R]=wa.x;Pa[R+1]=wa.y;Pa[R+2]=wa.z;Ia+=1}else if(R instanceof THREE.PointLight){R=Oa*3;K[R]=na.r*la;K[R+1]=na.g*la;K[R+2]=na.b*la;Na[R]=wa.x;Na[R+1]=wa.y;Na[R+2]=wa.z;Oa+=1}}for(p=Ia*3;p<Da.length;p++)Da[p]=0;for(p=Oa*3;p<K.length;p++)K[p]=0;Ca.point.length=Oa;Ca.directional.length=Ia;Ca.ambient[0]=F;Ca.ambient[1]=aa;Ca.ambient[2]=ka;A=ra;G.enableLighting.value=A.directional.length+A.point.length;G.ambientLightColor.value=A.ambient;G.directionalLightColor.value=
|
|
|
+A.directional.colors;G.directionalLightDirection.value=A.directional.positions;G.pointLightColor.value=A.point.colors;G.pointLightPosition.value=A.point.positions}if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial){G.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);G.opacity.value=n.opacity;G.map.texture=n.map;G.lightMap.texture=n.lightMap;G.envMap.texture=n.envMap;G.reflectivity.value=n.reflectivity;
|
|
|
+G.refractionRatio.value=n.refractionRatio;G.combine.value=n.combine;G.useRefract.value=n.envMap&&n.envMap.mapping instanceof THREE.CubeRefractionMapping}if(n instanceof THREE.LineBasicMaterial){G.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);G.opacity.value=n.opacity}else if(n instanceof THREE.ParticleBasicMaterial){G.psColor.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);G.opacity.value=n.opacity;G.size.value=n.size;G.map.texture=n.map}else if(n instanceof
|
|
|
+THREE.MeshPhongMaterial){G.ambient.value.setRGB(n.ambient.r,n.ambient.g,n.ambient.b);G.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b);G.shininess.value=n.shininess}else if(n instanceof THREE.MeshDepthMaterial){G.mNear.value=l.near;G.mFar.value=l.far;G.opacity.value=n.opacity}else if(n instanceof THREE.MeshNormalMaterial)G.opacity.value=n.opacity;for(var T in G)if(F=C.uniforms[T]){p=G[T];N=p.type;A=p.value;if(N=="i")e.uniform1i(F,A);else if(N=="f")e.uniform1f(F,A);else if(N=="fv1")e.uniform1fv(F,
|
|
|
+A);else if(N=="fv")e.uniform3fv(F,A);else if(N=="v2")e.uniform2f(F,A.x,A.y);else if(N=="v3")e.uniform3f(F,A.x,A.y,A.z);else if(N=="c")e.uniform3f(F,A.r,A.g,A.b);else if(N=="t"){e.uniform1i(F,A);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(p.needsUpdate){if(p.__wasSetOnce){e.bindTexture(e.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(N=0;N<6;++N)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+N,0,0,0,e.RGBA,e.UNSIGNED_BYTE,p.image[N])}else{p.image.__webGLTextureCube=
|
|
|
+e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(N=0;N<6;++N)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+N,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,p.image[N]);p.__wasSetOnce=!0}E(e.TEXTURE_CUBE_MAP,p,p.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}e.activeTexture(e.TEXTURE0+A);e.bindTexture(e.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,p.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,
|
|
|
+0,0,0,e.RGBA,e.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,p.__webGLTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}E(e.TEXTURE_2D,p,p.image);e.bindTexture(e.TEXTURE_2D,null);p.needsUpdate=!1}e.activeTexture(e.TEXTURE0+A);e.bindTexture(e.TEXTURE_2D,p.__webGLTexture)}}}e.uniformMatrix4fv(y.modelViewMatrix,!1,m._modelViewMatrixArray);e.uniformMatrix3fv(y.normalMatrix,!1,m._normalMatrixArray);(n instanceof THREE.MeshShaderMaterial||
|
|
|
+n instanceof THREE.MeshPhongMaterial||n.envMap)&&e.uniform3f(y.cameraPosition,l.position.x,l.position.y,l.position.z);(n instanceof THREE.MeshShaderMaterial||n.envMap||n.skinning)&&e.uniformMatrix4fv(y.objectMatrix,!1,m._objectMatrixArray);(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshShaderMaterial||n.skinning)&&e.uniformMatrix4fv(y.viewMatrix,!1,$);if(n.skinning){e.uniformMatrix4fv(y.cameraInverseMatrix,!1,$);e.uniformMatrix4fv(y.boneGlobalMatrices,
|
|
|
+!1,m.boneMatrices)}return C}function f(l,A,p,n,m,C){l=d(l,A,p,n,C).attributes;if(n.morphTargets){e.bindBuffer(e.ARRAY_BUFFER,m.__webGLMorphTargetsBuffers[C.morphTargetBase]);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);A=[];p=-1;var y=0,G=C.morphTargetInfluences,N,R=G.length,F=0;for(A[C.morphTargetBase]=1;F<n.numSupportedMorphTargets;){for(N=0;N<R;N++)if(!A[N]&&p<G[N]){y=N;p=G[y]}e.bindBuffer(e.ARRAY_BUFFER,m.__webGLMorphTargetsBuffers[y]);e.vertexAttribPointer(l["morphTarget"+F],3,e.FLOAT,
|
|
|
+!1,0,0);C.__webGLMorphTargetInfluences[F]=p;A[y]=1;p=-1;F++}e.uniform1fv(n.program.uniforms.morphTargetInfluences,C.__webGLMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,m.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0)}if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,m.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,m.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
+m.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(m.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,m.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(m.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,m.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);if(n.skinning&&l.skinVertexA>=0&&
|
|
|
+l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,m.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,m.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,m.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,m.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,4,e.FLOAT,!1,0,0)}if(C instanceof
|
|
|
+THREE.Mesh)if(n.wireframe){e.lineWidth(n.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webGLLineBuffer);e.drawElements(e.LINES,m.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,m.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(C instanceof THREE.Line){C=C.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(n.linewidth);e.drawArrays(C,0,m.__webGLLineCount)}else if(C instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,
|
|
|
+0,m.__webGLParticleCount);else C instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,m.__webGLVertexCount)}function g(l,A){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(A.attributes.position);e.vertexAttribPointer(A.attributes.position,3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
+l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(A.attributes.normal);e.vertexAttribPointer(A.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(ga!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);ga=l.doubleSided}if(I!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);I=l.flipSided}}function j(l){if(za!=l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);
|
|
|
+za=l}}function k(l){va[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);va[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);va[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);va[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);va[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);va[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var A;for(l=0;l<6;l++){A=va[l];A.divideScalar(Math.sqrt(A.x*A.x+A.y*A.y+A.z*A.z))}}function o(l){for(var A=l.matrixWorld,p=-l.geometry.boundingSphere.radius*
|
|
|
+Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=va[n].x*A.n14+va[n].y*A.n24+va[n].z*A.n34+va[n].w;if(l<=p)return!1}return!0}function q(l,A){l.list[l.count]=A;l.count+=1}function x(l){var A,p,n=l.object,m=l.opaque,C=l.transparent;C.count=0;l=m.count=0;for(A=n.materials.length;l<A;l++){p=n.materials[l];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?q(C,p):q(m,p)}}function u(l){var A,p,n,m,C=l.object,y=l.buffer,G=l.opaque,N=l.transparent;N.count=0;l=G.count=0;for(n=C.materials.length;l<
|
|
|
+n;l++){A=C.materials[l];if(A instanceof THREE.MeshFaceMaterial){A=0;for(p=y.materials.length;A<p;A++)(m=y.materials[A])&&(m.opacity&&m.opacity<1||m.blending!=THREE.NormalBlending?q(N,m):q(G,m))}else{m=A;m.opacity&&m.opacity<1||m.blending!=THREE.NormalBlending?q(N,m):q(G,m)}}}function t(l,A){return A.z-l.z}function z(l,A){l._modelViewMatrix.multiplyToArray(A.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}
|
|
|
+function B(l){function A(ka){var na=[];p=0;for(n=ka.length;p<n;p++)ka[p]==undefined?na.push("undefined"):na.push(ka[p].id);return na.join("_")}var p,n,m,C,y,G,N,R,F={},aa=l.morphTargets!==undefined?l.morphTargets.length:0;l.geometryGroups={};m=0;for(C=l.faces.length;m<C;m++){y=l.faces[m];G=y.materials;N=A(G);F[N]==undefined&&(F[N]={hash:N,counter:0});R=F[N].hash+"_"+F[N].counter;l.geometryGroups[R]==undefined&&(l.geometryGroups[R]={faces:[],materials:G,vertices:0,numMorphTargets:aa});y=y instanceof
|
|
|
+THREE.Face3?3:4;if(l.geometryGroups[R].vertices+y>65535){F[N].counter+=1;R=F[N].hash+"_"+F[N].counter;l.geometryGroups[R]==undefined&&(l.geometryGroups[R]={faces:[],materials:G,vertices:0,numMorphTargets:aa})}l.geometryGroups[R].faces.push(m);l.geometryGroups[R].vertices+=y}}function D(l,A,p){l.push({buffer:A,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function v(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,
|
|
|
+e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}ca=l}}function E(l,A,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){e.texParameteri(l,e.TEXTURE_WRAP_S,Y(A.wrapS));e.texParameteri(l,e.TEXTURE_WRAP_T,Y(A.wrapT));e.texParameteri(l,e.TEXTURE_MAG_FILTER,
|
|
|
+Y(A.magFilter));e.texParameteri(l,e.TEXTURE_MIN_FILTER,Y(A.minFilter));e.generateMipmap(l)}else{e.texParameteri(l,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(l,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(l,e.TEXTURE_MAG_FILTER,L(A.magFilter));e.texParameteri(l,e.TEXTURE_MIN_FILTER,L(A.minFilter))}}function w(l){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,
|
|
|
+l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,Y(l.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,Y(l.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,Y(l.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,Y(l.minFilter));e.texImage2D(e.TEXTURE_2D,0,Y(l.format),l.width,l.height,0,Y(l.format),Y(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,
|
|
|
+l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var A,p;if(l){A=l.__webGLFramebuffer;p=l.width;l=l.height}else{A=null;p=ja;l=ha}if(A!=S){e.bindFramebuffer(e.FRAMEBUFFER,A);e.viewport(ea,xa,p,l);S=A}}function O(l,A){var p;if(l=="fragment")p=
|
|
|
+e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(p=e.createShader(e.VERTEX_SHADER));e.shaderSource(p,A);e.compileShader(p);if(!e.getShaderParameter(p,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(p));return null}return p}function L(l){switch(l){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return e.LINEAR}}function Y(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;
|
|
|
+case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;
|
|
|
+case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=document.createElement("canvas"),
|
|
|
+e,X=null,S=null,da=this,ga=null,I=null,ca=null,za=null,ea=0,xa=0,ja=0,ha=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,ia=new Float32Array(16),$=new Float32Array(16),qa=new THREE.Vector4,ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Q=!0,ma=new THREE.Color(0),ta=0;if(a){if(a.antialias!==undefined)Q=a.antialias;a.clearColor!==undefined&&ma.setHex(a.clearColor);
|
|
|
+if(a.clearAlpha!==undefined)ta=a.clearAlpha}this.maxMorphTargets=8;this.domElement=M;this.autoClear=!0;this.sortObjects=!0;(function(l,A,p){try{if(!(e=M.getContext("experimental-webgl",{antialias:l})))throw"Error creating WebGL context.";}catch(n){console.error(n)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(A.r,A.g,A.b,p);_cullEnabled=
|
|
|
+!0})(Q,ma,ta);this.context=e;this.setSize=function(l,A){M.width=l;M.height=A;this.setViewport(0,0,M.width,M.height)};this.setViewport=function(l,A,p,n){ea=l;xa=A;ja=p;ha=n;e.viewport(ea,xa,ja,ha)};this.setScissor=function(l,A,p,n){e.scissor(l,A,p,n)};this.enableScissorTest=function(l){l?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(l){e.depthMask(l)};this.setClearColorHex=function(l,A){var p=new THREE.Color(l);e.clearColor(p.r,p.g,p.b,A)};this.setClearColor=
|
|
|
+function(l,A){e.clearColor(l.r,l.g,l.b,A)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,A,p,n){var m,C;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);
|
|
|
+else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var y,G,N,R;C=N=R=0;for(y=A.length;C<y;C++){G=A[C];G instanceof THREE.DirectionalLight&&N++;G instanceof THREE.PointLight&&R++}if(R+N<=4)A=N;else{A=Math.ceil(4*N/(R+N));R=4-A}C={directional:A,point:R};y=50;if(n!==undefined&&n instanceof THREE.SkinnedMesh)y=n.bones.length;R=l.fragmentShader;A=l.vertexShader;y={fog:p,map:l.map,envMap:l.envMap,lightMap:l.lightMap,
|
|
|
+vertexColors:l.vertexColors,skinning:l.skinning,morphTargets:l.morphTargets,maxMorphTargets:1,maxDirLights:C.directional,maxPointLights:C.point,maxBones:y};p=e.createProgram();C=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+y.maxDirLights,"#define MAX_POINT_LIGHTS "+y.maxPointLights,y.fog?"#define USE_FOG":"",y.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",y.map?"#define USE_MAP":"",y.envMap?"#define USE_ENVMAP":"",y.lightMap?"#define USE_LIGHTMAP":"",y.vertexColors?
|
|
|
+"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");y=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+y.maxDirLights,"#define MAX_POINT_LIGHTS "+y.maxPointLights,"#define MAX_BONES "+y.maxBones,y.map?"#define USE_MAP":"",y.envMap?"#define USE_ENVMAP":"",y.lightMap?"#define USE_LIGHTMAP":"",y.vertexColors?"#define USE_COLOR":"",y.skinning?"#define USE_SKINNING":"",y.morphTargets?"#define USE_MORPHTARGETS":
|
|
|
+"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
+e.attachShader(p,O("fragment",C+R));e.attachShader(p,O("vertex",y+A));e.linkProgram(p);e.getProgramParameter(p,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(p,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");p.uniforms={};p.attributes={};l.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(m in l.uniforms)p.push(m);m=
|
|
|
+l.program;R=0;for(A=p.length;R<A;R++){C=p[R];m.uniforms[C]=e.getUniformLocation(m,C)}p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(m=0;m<this.maxMorphTargets;m++)p.push("morphTarget"+m);m=l.program;R=0;for(A=p.length;R<A;R++){C=p[R];m.attributes[C]=e.getAttribLocation(m,C)}m=l.program.attributes;e.enableVertexAttribArray(m.position);m.color>=0&&e.enableVertexAttribArray(m.color);m.normal>=0&&e.enableVertexAttribArray(m.normal);m.tangent>=
|
|
|
+0&&e.enableVertexAttribArray(m.tangent);if(l.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){e.enableVertexAttribArray(m.skinVertexA);e.enableVertexAttribArray(m.skinVertexB);e.enableVertexAttribArray(m.skinIndex);e.enableVertexAttribArray(m.skinWeight)}if(l.morphTargets){l.numSupportedMorphTargets=0;if(m.morphTarget0>=0){e.enableVertexAttribArray(m.morphTarget0);l.numSupportedMorphTargets++}if(m.morphTarget1>=0){e.enableVertexAttribArray(m.morphTarget1);l.numSupportedMorphTargets++}if(m.morphTarget2>=
|
|
|
+0){e.enableVertexAttribArray(m.morphTarget2);l.numSupportedMorphTargets++}if(m.morphTarget3>=0){e.enableVertexAttribArray(m.morphTarget3);l.numSupportedMorphTargets++}if(m.morphTarget4>=0){e.enableVertexAttribArray(m.morphTarget4);l.numSupportedMorphTargets++}if(m.morphTarget5>=0){e.enableVertexAttribArray(m.morphTarget5);l.numSupportedMorphTargets++}if(m.morphTarget6>=0){e.enableVertexAttribArray(m.morphTarget6);l.numSupportedMorphTargets++}if(m.morphTarget7>=0){e.enableVertexAttribArray(m.morphTarget7);
|
|
|
+l.numSupportedMorphTargets++}n.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(m=0;m<this.maxMorphTargets;m++)n.__webGLMorphTargetInfluences[m]=0}};this.render=function(l,A,p,n){var m,C,y,G,N,R,F,aa,ka=l.lights,na=l.fog;A.matrixAutoUpdate&&A.update();A.matrixWorldInverse.flattenToArray($);A.projectionMatrix.flattenToArray(ia);Aa.multiply(A.projectionMatrix,A.matrixWorldInverse);k(Aa);l.update(undefined,!1,A);this.initWebGLObjects(l);w(p);(this.autoClear||n)&&this.clear();N=
|
|
|
+l.__webglObjects.length;for(n=0;n<N;n++){m=l.__webglObjects[n];F=m.object;if(F.visible)if(!(F instanceof THREE.Mesh)||o(F)){F.matrixWorld.flattenToArray(F._objectMatrixArray);z(F,A);u(m);m.render=!0;if(this.sortObjects){qa.copy(F.position);Aa.multiplyVector3(qa);m.z=qa.z}}else m.render=!1;else m.render=!1}this.sortObjects&&l.__webglObjects.sort(t);R=l.__webglObjectsImmediate.length;for(n=0;n<R;n++){m=l.__webglObjectsImmediate[n];F=m.object;if(F.visible){F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray);
|
|
|
+z(F,A);x(m)}}v(THREE.NormalBlending);for(n=0;n<N;n++){m=l.__webglObjects[n];if(m.render){F=m.object;aa=m.buffer;y=m.opaque;h(F);for(m=0;m<y.count;m++){G=y.list[m];j(G.depthTest);f(A,ka,na,G,aa,F)}}}for(n=0;n<R;n++){m=l.__webglObjectsImmediate[n];F=m.object;if(F.visible){y=m.opaque;h(F);for(m=0;m<y.count;m++){G=y.list[m];j(G.depthTest);C=d(A,ka,na,G,F);F.render(function(wa){g(wa,C)})}}}for(n=0;n<N;n++){m=l.__webglObjects[n];if(m.render){F=m.object;aa=m.buffer;y=m.transparent;h(F);for(m=0;m<y.count;m++){G=
|
|
|
+y.list[m];v(G.blending);j(G.depthTest);f(A,ka,na,G,aa,F)}}}for(n=0;n<R;n++){m=l.__webglObjectsImmediate[n];F=m.object;if(F.visible){y=m.transparent;h(F);for(m=0;m<y.count;m++){G=y.list[m];v(G.blending);j(G.depthTest);C=d(A,ka,na,G,F);F.render(function(wa){g(wa,C)})}}}if(p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,p.__webGLTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l){if(!l.__webglObjects){l.__webglObjects=
|
|
|
+[];l.__webglObjectsImmediate=[]}for(;l.__objectsAdded.length;){var A=l.__objectsAdded[0],p=l,n=void 0,m=void 0,C=void 0;if(A._modelViewMatrix==undefined){A._modelViewMatrix=new THREE.Matrix4;A._normalMatrixArray=new Float32Array(9);A._modelViewMatrixArray=new Float32Array(16);A._objectMatrixArray=new Float32Array(16);A.matrixWorld.flattenToArray(A._objectMatrixArray)}if(A instanceof THREE.Mesh){m=A.geometry;m.geometryGroups==undefined&&B(m);for(n in m.geometryGroups){C=m.geometryGroups[n];if(!C.__webGLVertexBuffer){var y=
|
|
|
+C;y.__webGLVertexBuffer=e.createBuffer();y.__webGLNormalBuffer=e.createBuffer();y.__webGLTangentBuffer=e.createBuffer();y.__webGLColorBuffer=e.createBuffer();y.__webGLUVBuffer=e.createBuffer();y.__webGLUV2Buffer=e.createBuffer();y.__webGLSkinVertexABuffer=e.createBuffer();y.__webGLSkinVertexBBuffer=e.createBuffer();y.__webGLSkinIndicesBuffer=e.createBuffer();y.__webGLSkinWeightsBuffer=e.createBuffer();y.__webGLFaceBuffer=e.createBuffer();y.__webGLLineBuffer=e.createBuffer();if(y.numMorphTargets){var G=
|
|
|
+void 0,N=void 0;y.__webGLMorphTargetsBuffers=[];G=0;for(N=y.numMorphTargets;G<N;G++)y.__webGLMorphTargetsBuffers.push(e.createBuffer())}y=C;var R=A,F=void 0,aa=void 0,ka=N=G=0,na=R.geometry.faces,wa=y.faces;F=0;for(aa=wa.length;F<aa;F++){fi=wa[F];face=na[fi];if(face instanceof THREE.Face3){G+=3;N+=1;ka+=3}else if(face instanceof THREE.Face4){G+=4;N+=2;ka+=4}}y.__vertexArray=new Float32Array(G*3);y.__normalArray=new Float32Array(G*3);y.__tangentArray=new Float32Array(G*4);y.__colorArray=new Float32Array(G*
|
|
|
+3);y.__uvArray=new Float32Array(G*2);y.__uv2Array=new Float32Array(G*2);y.__skinVertexAArray=new Float32Array(G*4);y.__skinVertexBArray=new Float32Array(G*4);y.__skinIndexArray=new Float32Array(G*4);y.__skinWeightArray=new Float32Array(G*4);y.__faceArray=new Uint16Array(N*3);y.__lineArray=new Uint16Array(ka*2);aa=F=y;na=void 0;wa=void 0;var la=void 0,Ca=void 0;la=void 0;var Da=!1;na=0;for(wa=R.materials.length;na<wa;na++){la=R.materials[na];if(la instanceof THREE.MeshFaceMaterial){la=0;for(Ca=aa.materials.length;la<
|
|
|
+Ca;la++)if(aa.materials[la]&&aa.materials[la].shading!=undefined&&aa.materials[la].shading==THREE.SmoothShading){Da=!0;break}}else if(la&&la.shading!=undefined&&la.shading==THREE.SmoothShading){Da=!0;break}if(Da)break}F.__needsSmoothNormals=Da;y.__webGLFaceCount=N*3;y.__webGLLineCount=ka*2;if(y.numMorphTargets){N=void 0;ka=void 0;y.__morphTargetsArrays=[];N=0;for(ka=y.numMorphTargets;N<ka;N++)y.__morphTargetsArrays.push(new Float32Array(G*3))}m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=
|
|
|
+!0;m.__dirtyUvs=!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}D(p.__webglObjects,C,A)}}else if(A instanceof THREE.Ribbon){m=A.geometry;if(!m.__webGLVertexBuffer){n=m;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=m;C=n.vertices.length;n.__vertexArray=new Float32Array(C*3);n.__colorArray=new Float32Array(C*3);n.__webGLVertexCount=C;m.__dirtyVertices=!0;m.__dirtyColors=!0}D(p.__webglObjects,m,A)}else if(A instanceof THREE.Line){m=A.geometry;if(!m.__webGLVertexBuffer){n=
|
|
|
+m;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=m;C=n.vertices.length;n.__vertexArray=new Float32Array(C*3);n.__colorArray=new Float32Array(C*3);n.__webGLLineCount=C;m.__dirtyVertices=!0;m.__dirtyColors=!0}D(p.__webglObjects,m,A)}else if(A instanceof THREE.ParticleSystem){m=A.geometry;if(!m.__webGLVertexBuffer){n=m;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=m;C=n.vertices.length;n.__vertexArray=new Float32Array(C*3);n.__colorArray=
|
|
|
+new Float32Array(C*3);n.__sortArray=[];n.__webGLParticleCount=C;m.__dirtyVertices=!0;m.__dirtyColors=!0}D(p.__webglObjects,m,A)}else THREE.MarchingCubes!==undefined&&A instanceof THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:A,opaque:{list:[],count:0},transparent:{list:[],count:0}});l.__objectsAdded.splice(0,1)}for(;l.__objectsRemoved.length;){A=l.__objectsRemoved[0];p=l;m=void 0;n=void 0;for(m=p.__webglObjects.length-1;m>=0;m--){n=p.__webglObjects[m].object;A==n&&p.__webglObjects.splice(m,
|
|
|
+1)}l.__objectsRemoved.splice(0,1)}A=0;for(p=l.__webglObjects.length;A<p;A++){n=l.__webglObjects[A].object;C=void 0;m=void 0;y=void 0;if(n instanceof THREE.Mesh){m=n.geometry;for(C in m.geometryGroups){y=m.geometryGroups[C];if(m.__dirtyVertices||m.__dirtyMorphTargets||m.__dirtyElements||m.__dirtyUvs||m.__dirtyNormals||m.__dirtyColors||m.__dirtyTangents){G=e.DYNAMIC_DRAW;N=void 0;ka=void 0;var Pa=void 0,K=void 0,Na=void 0,Ia=void 0,Oa=void 0;Pa=void 0;var T=void 0,V=void 0,W=void 0,ya=void 0;T=void 0;
|
|
|
+V=void 0;W=void 0;K=void 0;T=void 0;V=void 0;W=void 0;ya=void 0;T=void 0;V=void 0;W=void 0;ya=void 0;T=void 0;V=void 0;W=void 0;ya=void 0;T=void 0;V=void 0;W=void 0;ya=void 0;T=void 0;V=void 0;W=void 0;ya=void 0;K=void 0;Ia=void 0;Na=void 0;Oa=void 0;var Ma=void 0,Fa=void 0,Ba=void 0,Ga=Ca=la=Da=wa=na=R=aa=F=0,H=0,Ja=0,Ha=y.__vertexArray,P=y.__uvArray,oa=y.__uv2Array,Z=y.__normalArray,J=y.__tangentArray,U=y.__colorArray,fa=y.__skinVertexAArray,pa=y.__skinVertexBArray,sa=y.__skinIndexArray,ua=y.__skinWeightArray,
|
|
|
+Ra=y.__morphTargetsArrays,La=y.__faceArray,Ka=y.__lineArray,Wa=y.__needsSmoothNormals,Ea=n.geometry,Sa=Ea.__dirtyVertices,ab=Ea.__dirtyElements,$a=Ea.__dirtyUvs,bb=Ea.__dirtyNormals,cb=Ea.__dirtyTangents,db=Ea.__dirtyColors,eb=Ea.__dirtyMorphTargets,Qa=Ea.vertices,fb=y.faces,gb=Ea.faces,hb=Ea.uvs,ib=Ea.uvs2,Ta=Ea.colors,Xa=Ea.skinVerticesA,Ya=Ea.skinVerticesB,Za=Ea.skinIndices,Va=Ea.skinWeights,Ua=Ea.morphTargets;N=0;for(ka=fb.length;N<ka;N++){Pa=fb[N];K=gb[Pa];Oa=hb[Pa];Pa=ib[Pa];Na=K.vertexNormals;
|
|
|
+Ia=K.normal;if(K instanceof THREE.Face3){if(Sa){T=Qa[K.a].position;V=Qa[K.b].position;W=Qa[K.c].position;Ha[aa]=T.x;Ha[aa+1]=T.y;Ha[aa+2]=T.z;Ha[aa+3]=V.x;Ha[aa+4]=V.y;Ha[aa+5]=V.z;Ha[aa+6]=W.x;Ha[aa+7]=W.y;Ha[aa+8]=W.z;aa+=9}if(eb){Ma=0;for(Fa=Ua.length;Ma<Fa;Ma++){T=Ua[Ma].vertices[K.a].position;V=Ua[Ma].vertices[K.b].position;W=Ua[Ma].vertices[K.c].position;Ba=Ra[Ma];Ba[Ja+0]=T.x;Ba[Ja+1]=T.y;Ba[Ja+2]=T.z;Ba[Ja+3]=V.x;Ba[Ja+4]=V.y;Ba[Ja+5]=V.z;Ba[Ja+6]=W.x;Ba[Ja+7]=W.y;Ba[Ja+8]=W.z}Ja+=9}if(Va.length){T=
|
|
|
+Va[K.a];V=Va[K.b];W=Va[K.c];ua[H]=T.x;ua[H+1]=T.y;ua[H+2]=T.z;ua[H+3]=T.w;ua[H+4]=V.x;ua[H+5]=V.y;ua[H+6]=V.z;ua[H+7]=V.w;ua[H+8]=W.x;ua[H+9]=W.y;ua[H+10]=W.z;ua[H+11]=W.w;T=Za[K.a];V=Za[K.b];W=Za[K.c];sa[H]=T.x;sa[H+1]=T.y;sa[H+2]=T.z;sa[H+3]=T.w;sa[H+4]=V.x;sa[H+5]=V.y;sa[H+6]=V.z;sa[H+7]=V.w;sa[H+8]=W.x;sa[H+9]=W.y;sa[H+10]=W.z;sa[H+11]=W.w;T=Xa[K.a];V=Xa[K.b];W=Xa[K.c];fa[H]=T.x;fa[H+1]=T.y;fa[H+2]=T.z;fa[H+3]=1;fa[H+4]=V.x;fa[H+5]=V.y;fa[H+6]=V.z;fa[H+7]=1;fa[H+8]=W.x;fa[H+9]=W.y;fa[H+10]=W.z;
|
|
|
+fa[H+11]=1;T=Ya[K.a];V=Ya[K.b];W=Ya[K.c];pa[H]=T.x;pa[H+1]=T.y;pa[H+2]=T.z;pa[H+3]=1;pa[H+4]=V.x;pa[H+5]=V.y;pa[H+6]=V.z;pa[H+7]=1;pa[H+8]=W.x;pa[H+9]=W.y;pa[H+10]=W.z;pa[H+11]=1;H+=12}if(db&&Ta.length){T=Ta[K.a];V=Ta[K.b];W=Ta[K.c];U[Ga]=T.r;U[Ga+1]=T.g;U[Ga+2]=T.b;U[Ga+3]=V.r;U[Ga+4]=V.g;U[Ga+5]=V.b;U[Ga+6]=W.r;U[Ga+7]=W.g;U[Ga+8]=W.b;Ga+=9}if(cb&&Ea.hasTangents){T=Qa[K.a].tangent;V=Qa[K.b].tangent;W=Qa[K.c].tangent;J[la]=T.x;J[la+1]=T.y;J[la+2]=T.z;J[la+3]=T.w;J[la+4]=V.x;J[la+5]=V.y;J[la+6]=V.z;
|
|
|
+J[la+7]=V.w;J[la+8]=W.x;J[la+9]=W.y;J[la+10]=W.z;J[la+11]=W.w;la+=12}if(bb)if(Na.length==3&&Wa)for(K=0;K<3;K++){Ia=Na[K];Z[Da]=Ia.x;Z[Da+1]=Ia.y;Z[Da+2]=Ia.z;Da+=3}else for(K=0;K<3;K++){Z[Da]=Ia.x;Z[Da+1]=Ia.y;Z[Da+2]=Ia.z;Da+=3}if($a&&Oa)for(K=0;K<3;K++){Na=Oa[K];P[R]=Na.u;P[R+1]=Na.v;R+=2}if($a&&Pa)for(K=0;K<3;K++){Oa=Pa[K];oa[na]=Oa.u;oa[na+1]=Oa.v;na+=2}if(ab){La[wa]=F;La[wa+1]=F+1;La[wa+2]=F+2;wa+=3;Ka[Ca]=F;Ka[Ca+1]=F+1;Ka[Ca+2]=F;Ka[Ca+3]=F+2;Ka[Ca+4]=F+1;Ka[Ca+5]=F+2;Ca+=6;F+=3}}else if(K instanceof
|
|
|
+THREE.Face4){if(Sa){T=Qa[K.a].position;V=Qa[K.b].position;W=Qa[K.c].position;ya=Qa[K.d].position;Ha[aa]=T.x;Ha[aa+1]=T.y;Ha[aa+2]=T.z;Ha[aa+3]=V.x;Ha[aa+4]=V.y;Ha[aa+5]=V.z;Ha[aa+6]=W.x;Ha[aa+7]=W.y;Ha[aa+8]=W.z;Ha[aa+9]=ya.x;Ha[aa+10]=ya.y;Ha[aa+11]=ya.z;aa+=12}if(eb){Ma=0;for(Fa=Ua.length;Ma<Fa;Ma++){T=Ua[Ma].vertices[K.a].position;V=Ua[Ma].vertices[K.b].position;W=Ua[Ma].vertices[K.c].position;ya=Ua[Ma].vertices[K.d].position;Ba=Ra[Ma];Ba[Ja+0]=T.x;Ba[Ja+1]=T.y;Ba[Ja+2]=T.z;Ba[Ja+3]=V.x;Ba[Ja+
|
|
|
+4]=V.y;Ba[Ja+5]=V.z;Ba[Ja+6]=W.x;Ba[Ja+7]=W.y;Ba[Ja+8]=W.z;Ba[Ja+9]=ya.x;Ba[Ja+10]=ya.y;Ba[Ja+11]=ya.z}Ja+=12}if(Va.length){T=Va[K.a];V=Va[K.b];W=Va[K.c];ya=Va[K.d];ua[H]=T.x;ua[H+1]=T.y;ua[H+2]=T.z;ua[H+3]=T.w;ua[H+4]=V.x;ua[H+5]=V.y;ua[H+6]=V.z;ua[H+7]=V.w;ua[H+8]=W.x;ua[H+9]=W.y;ua[H+10]=W.z;ua[H+11]=W.w;ua[H+12]=ya.x;ua[H+13]=ya.y;ua[H+14]=ya.z;ua[H+15]=ya.w;T=Za[K.a];V=Za[K.b];W=Za[K.c];ya=Za[K.d];sa[H]=T.x;sa[H+1]=T.y;sa[H+2]=T.z;sa[H+3]=T.w;sa[H+4]=V.x;sa[H+5]=V.y;sa[H+6]=V.z;sa[H+7]=V.w;sa[H+
|
|
|
+8]=W.x;sa[H+9]=W.y;sa[H+10]=W.z;sa[H+11]=W.w;sa[H+12]=ya.x;sa[H+13]=ya.y;sa[H+14]=ya.z;sa[H+15]=ya.w;T=Xa[K.a];V=Xa[K.b];W=Xa[K.c];ya=Xa[K.d];fa[H]=T.x;fa[H+1]=T.y;fa[H+2]=T.z;fa[H+3]=1;fa[H+4]=V.x;fa[H+5]=V.y;fa[H+6]=V.z;fa[H+7]=1;fa[H+8]=W.x;fa[H+9]=W.y;fa[H+10]=W.z;fa[H+11]=1;fa[H+12]=ya.x;fa[H+13]=ya.y;fa[H+14]=ya.z;fa[H+15]=1;T=Ya[K.a];V=Ya[K.b];W=Ya[K.c];ya=Ya[K.d];pa[H]=T.x;pa[H+1]=T.y;pa[H+2]=T.z;pa[H+3]=1;pa[H+4]=V.x;pa[H+5]=V.y;pa[H+6]=V.z;pa[H+7]=1;pa[H+8]=W.x;pa[H+9]=W.y;pa[H+10]=W.z;
|
|
|
+pa[H+11]=1;pa[H+12]=ya.x;pa[H+13]=ya.y;pa[H+14]=ya.z;pa[H+15]=1;H+=16}if(db&&Ta.length){T=Ta[K.a];V=Ta[K.b];W=Ta[K.c];ya=Ta[K.d];U[Ga]=T.r;U[Ga+1]=T.g;U[Ga+2]=T.b;U[Ga+3]=V.r;U[Ga+4]=V.g;U[Ga+5]=V.b;U[Ga+6]=W.r;U[Ga+7]=W.g;U[Ga+8]=W.b;U[Ga+9]=ya.r;U[Ga+10]=ya.g;U[Ga+11]=ya.b;Ga+=12}if(cb&&Ea.hasTangents){T=Qa[K.a].tangent;V=Qa[K.b].tangent;W=Qa[K.c].tangent;K=Qa[K.d].tangent;J[la]=T.x;J[la+1]=T.y;J[la+2]=T.z;J[la+3]=T.w;J[la+4]=V.x;J[la+5]=V.y;J[la+6]=V.z;J[la+7]=V.w;J[la+8]=W.x;J[la+9]=W.y;J[la+
|
|
|
+10]=W.z;J[la+11]=W.w;J[la+12]=K.x;J[la+13]=K.y;J[la+14]=K.z;J[la+15]=K.w;la+=16}if(bb)if(Na.length==4&&Wa)for(K=0;K<4;K++){Ia=Na[K];Z[Da]=Ia.x;Z[Da+1]=Ia.y;Z[Da+2]=Ia.z;Da+=3}else for(K=0;K<4;K++){Z[Da]=Ia.x;Z[Da+1]=Ia.y;Z[Da+2]=Ia.z;Da+=3}if($a&&Oa)for(K=0;K<4;K++){Na=Oa[K];P[R]=Na.u;P[R+1]=Na.v;R+=2}if($a&&Pa)for(K=0;K<4;K++){Oa=Pa[K];oa[na]=Oa.u;oa[na+1]=Oa.v;na+=2}if(ab){La[wa]=F;La[wa+1]=F+1;La[wa+2]=F+2;La[wa+3]=F;La[wa+4]=F+2;La[wa+5]=F+3;wa+=6;Ka[Ca]=F;Ka[Ca+1]=F+1;Ka[Ca+2]=F;Ka[Ca+3]=F+3;
|
|
|
+Ka[Ca+4]=F+1;Ka[Ca+5]=F+2;Ka[Ca+6]=F+2;Ka[Ca+7]=F+3;Ca+=8;F+=4}}}if(Sa){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,G)}if(eb){Ma=0;for(Fa=Ua.length;Ma<Fa;Ma++){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLMorphTargetsBuffers[Ma]);e.bufferData(e.ARRAY_BUFFER,Ra[Ma],G)}}if(db&&Ta.length){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,U,G)}if(bb){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Z,G)}if(cb&&Ea.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
+y.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,J,G)}if($a&&R>0){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,P,G)}if($a&&na>0){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,oa,G)}if(ab){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,La,G);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ka,G)}if(H>0){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLSkinVertexABuffer);
|
|
|
+e.bufferData(e.ARRAY_BUFFER,fa,G);e.bindBuffer(e.ARRAY_BUFFER,y.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,pa,G);e.bindBuffer(e.ARRAY_BUFFER,y.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,sa,G);e.bindBuffer(e.ARRAY_BUFFER,y.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ua,G)}}}m.__dirtyVertices=!1;m.__dirtyMorphTargets=!1;m.__dirtyElements=!1;m.__dirtyUvs=!1;m.__dirtyNormals=!1;m.__dirtyTangents=!1;m.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){m=n.geometry;if(m.__dirtyVertices||
|
|
|
+m.__dirtyColors){n=m;C=e.DYNAMIC_DRAW;F=void 0;F=void 0;aa=void 0;y=void 0;R=n.vertices;G=n.colors;na=R.length;N=G.length;wa=n.__vertexArray;ka=n.__colorArray;Da=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<na;F++){aa=R[F].position;y=F*3;wa[y]=aa.x;wa[y+1]=aa.y;wa[y+2]=aa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,wa,C)}if(Da){for(F=0;F<N;F++){color=G[F];y=F*3;ka[y]=color.r;ka[y+1]=color.g;ka[y+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
+ka,C)}}m.__dirtyVertices=!1;m.__dirtyColors=!1}else if(n instanceof THREE.Line){m=n.geometry;if(m.__dirtyVertices||m.__dirtyColors){n=m;C=e.DYNAMIC_DRAW;F=void 0;F=void 0;aa=void 0;y=void 0;R=n.vertices;G=n.colors;na=R.length;N=G.length;wa=n.__vertexArray;ka=n.__colorArray;Da=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<na;F++){aa=R[F].position;y=F*3;wa[y]=aa.x;wa[y+1]=aa.y;wa[y+2]=aa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,wa,C)}if(Da){for(F=0;F<N;F++){color=
|
|
|
+G[F];y=F*3;ka[y]=color.r;ka[y+1]=color.g;ka[y+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,ka,C)}}m.__dirtyVertices=!1;m.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){m=n.geometry;(m.__dirtyVertices||m.__dirtyColors||n.sortParticles)&&b(m,e.DYNAMIC_DRAW,n);m.__dirtyVertices=!1;m.__dirtyColors=!1}}};this.setFaceCulling=function(l,A){if(l){!A||A=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):
|
|
|
+e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
+THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
|
|
|
+envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
|
+map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
|
|
|
+lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
|
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
|
|
lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
|
|
|
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
|
|
|
-vertexanimated_pars_vertex:"#ifdef USE_VERTEXANIMATION\nuniform float positionInterpolation;\n#endif",vertexanimated_vertex:"#ifdef USE_VERTEXANIMATION\ngl_Position = projectionMatrix * modelViewMatrix * vec4( mix( position, positionNextKey, positionInterpolation ), 1.0 );\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
|
|
|
-THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},positionInterpolation:{type:"f",
|
|
|
+morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[8];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0, 0, 0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed *= 0.25;\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
|
|
|
+THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",
|
|
|
value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",
|
|
|
value:new THREE.Color(16777215)}}};
|
|
|
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
|
|
|
value:1}},fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
|
|
|
THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
|
|
|
-THREE.Snippets.skinning_pars_vertex,THREE.Snippets.vertexanimated_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,THREE.Snippets.skinning_vertex,THREE.Snippets.vertexanimated_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
|
|
|
+THREE.Snippets.skinning_pars_vertex,THREE.Snippets.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,THREE.Snippets.skinning_vertex,THREE.Snippets.morphtarget_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
|
|
|
THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",
|
|
|
-THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,THREE.Snippets.vertexanimated_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,
|
|
|
-THREE.Snippets.skinning_vertex,THREE.Snippets.vertexanimated_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,
|
|
|
+THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,THREE.Snippets.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,
|
|
|
+THREE.Snippets.skinning_vertex,THREE.Snippets.morphtarget_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,
|
|
|
THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",
|
|
|
-THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,THREE.Snippets.vertexanimated_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
|
|
|
-THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,THREE.Snippets.vertexanimated_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),
|
|
|
+THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,THREE.Snippets.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
|
|
|
+THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,THREE.Snippets.morphtarget_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),
|
|
|
vertexShader:["uniform float size;",THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};
|
|
|
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,f=c.length;for(d=0;d<f;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
|
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|
|
|
-var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,j=a.faces,k=f.faces,n=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var q=0,x=h.length;q<x;q++){var u=new THREE.Vertex(h[q].position.clone());c&&b.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);c=0;for(g=y.length;c<g;c++){u=y[c];t.vertexNormals.push(u.clone())}t.materials=h.materials.slice();j.push(t)}q=0;for(x=f.length;q<x;q++){d=f[q];j=[];c=0;for(g=d.length;c<g;c++)j.push(new THREE.UV(d[c].u,d[c].v));n.push(j)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,
|
|
|
-b);b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;c&&c(this)};f[b].src=a[b]}return g}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(q in L.objects)if(!I.objects[q]){B=L.objects[q];if(w=I.geometries[B.geometry]){Y=[];for(i=0;i<B.materials.length;i++)Y[i]=I.materials[B.materials[i]];D=B.position;r=B.rotation;s=B.scale;object=new THREE.Mesh(w,Y);object.position.set(D[0],
|
|
|
-D[1],D[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=B.visible;I.scene.addObject(object);I.objects[q]=object}}}function h(aa){return function(Ba){I.geometries[aa]=Ba;g();X-=1;j()}}function j(){d({total_models:ca,total_textures:ea,loaded_models:ca-X,loaded_textures:ea-T},I);X==0&&T==0&&c(I)}var k,n,q,x,u,t,y,B,D,v,E,w,M,K,Y,L,e,X,T,ca,ea,I;L=f.data;e=new THREE.Loader;T=X=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
-lights:{},fogs:{}};f=function(){T-=1;j()};for(u in L.cameras){v=L.cameras[u];if(v.type=="perspective")M=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){M=new THREE.Camera;M.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}D=v.position;v=v.target;M.position.set(D[0],D[1],D[2]);M.target.position.set(v[0],v[1],v[2]);I.cameras[u]=M}for(x in L.lights){u=L.lights[x];if(u.type=="directional"){D=u.direction;light=new THREE.DirectionalLight;light.position.set(D[0],
|
|
|
-D[1],D[2]);light.position.normalize()}else if(u.type=="point"){D=u.position;light=new THREE.PointLight;light.position.set(D[0],D[1],D[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 L.fogs){x=L.fogs[t];if(x.type=="linear")K=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(K=new THREE.FogExp2(0,x.density));v=x.color;K.color.setRGB(v[0],v[1],v[2]);I.fogs[t]=K}if(I.cameras&&L.defaults.camera)I.currentCamera=I.cameras[L.defaults.camera];
|
|
|
-if(I.fogs&&L.defaults.fog)I.scene.fog=I.fogs[L.defaults.fog];v=L.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(v[0],v[1],v[2]);I.bgColorAlpha=L.defaults.bgalpha;for(k in L.geometries){t=L.geometries[k];if(t.type=="bin_mesh"||t.type=="ascii_mesh")X+=1}ca=X;for(k in L.geometries){t=L.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,
|
|
|
+var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,j=a.faces,k=f.faces,o=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var q=0,x=h.length;q<x;q++){var u=new THREE.Vertex(h[q].position.clone());c&&b.matrix.multiplyVector3(u.position);g.push(u)}q=0;for(x=k.length;q<x;q++){h=k[q];var t,z=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);c=0;for(g=z.length;c<g;c++){u=z[c];t.vertexNormals.push(u.clone())}t.materials=h.materials.slice();j.push(t)}q=0;for(x=f.length;q<x;q++){d=f[q];j=[];c=0;for(g=d.length;c<g;c++)j.push(new THREE.UV(d[c].u,d[c].v));o.push(j)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,
|
|
|
+b);b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;c&&c(this)};f[b].src=a[b]}return g}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(q in M.objects)if(!I.objects[q]){B=M.objects[q];if(w=I.geometries[B.geometry]){Y=[];for(i=0;i<B.materials.length;i++)Y[i]=I.materials[B.materials[i]];D=B.position;r=B.rotation;s=B.scale;object=new THREE.Mesh(w,Y);object.position.set(D[0],
|
|
|
+D[1],D[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=B.visible;I.scene.addObject(object);I.objects[q]=object}}}function h(ca){return function(za){I.geometries[ca]=za;g();X-=1;j()}}function j(){d({total_models:da,total_textures:ga,loaded_models:da-X,loaded_textures:ga-S},I);X==0&&S==0&&c(I)}var k,o,q,x,u,t,z,B,D,v,E,w,O,L,Y,M,e,X,S,da,ga,I;M=f.data;e=new THREE.Loader;S=X=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
+lights:{},fogs:{}};f=function(){S-=1;j()};for(u in M.cameras){v=M.cameras[u];if(v.type=="perspective")O=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){O=new THREE.Camera;O.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}D=v.position;v=v.target;O.position.set(D[0],D[1],D[2]);O.target.position.set(v[0],v[1],v[2]);I.cameras[u]=O}for(x in M.lights){u=M.lights[x];if(u.type=="directional"){D=u.direction;light=new THREE.DirectionalLight;light.position.set(D[0],
|
|
|
+D[1],D[2]);light.position.normalize()}else if(u.type=="point"){D=u.position;light=new THREE.PointLight;light.position.set(D[0],D[1],D[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")X+=1}da=X;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")e.loadBinary({model:t.url,
|
|
|
-callback:h(k)});else t.type=="ascii_mesh"&&e.loadAscii({model:t.url,callback:h(k)})}for(y in L.textures){k=L.textures[y];T+=k.url instanceof Array?k.url.length:1}ea=T;for(y in L.textures){k=L.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,f);else{t=ImageUtils.loadTexture(k.url,k.mapping,f);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 L.materials){y=L.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();b(I)}},addMesh:function(a,b,c,d,f,g,h,j,k,n){b=new THREE.Mesh(b,n);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=j;b.rotation.z=k;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,1,null,!0),c);a.addObject(b);
|
|
|
+callback:h(k)});else t.type=="ascii_mesh"&&e.loadAscii({model:t.url,callback:h(k)})}for(z in M.textures){k=M.textures[z];S+=k.url instanceof Array?k.url.length:1}ga=S;for(z in M.textures){k=M.textures[z];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,f);else{t=ImageUtils.loadTexture(k.url,k.mapping,f);if(THREE[k.minFilter]!=undefined)t.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=undefined)t.magFilter=
|
|
|
+THREE[k.magFilter]}I.textures[z]=t}for(o in M.materials){z=M.materials[o];for(E in z.parameters)if(E=="envMap"||E=="map"||E=="lightMap")z.parameters[E]=I.textures[z.parameters[E]];else if(E=="shading")z.parameters[E]=z.parameters[E]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(E=="blending")z.parameters[E]=THREE[z.parameters[E]]?THREE[z.parameters[E]]:THREE.NormalBlending;else E=="combine"&&(z.parameters[E]=z.parameters[E]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);z=new THREE[z.type](z.parameters);
|
|
|
+I.materials[o]=z}g();b(I)}},addMesh:function(a,b,c,d,f,g,h,j,k,o){b=new THREE.Mesh(b,o);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=j;b.rotation.z=k;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,1,null,!0),c);a.addObject(b);
|
|
|
return b},addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,b,b,1,1,d,!0),new THREE.MeshFaceMaterial);
|
|
|
a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
|
|
|
SceneUtils.addMesh(a,b,1,0,-d,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
@@ -312,39 +313,39 @@ 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 b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,j,k){function n(D,v,E,w,M,K,Y,L){var e,X,T=d||1,ca=f||1,ea=M/2,I=K/2,aa=q.vertices.length;if(D=="x"&&v=="y"||D=="y"&&v=="x")e="z";else if(D=="x"&&v=="z"||D=="z"&&v=="x"){e="y";ca=g||1}else if(D=="z"&&
|
|
|
-v=="y"||D=="y"&&v=="z"){e="x";T=g||1}var Ba=T+1,da=ca+1;M/=T;var xa=K/ca;for(X=0;X<da;X++)for(K=0;K<Ba;K++){var ia=new THREE.Vector3;ia[D]=(K*M-ea)*E;ia[v]=(X*xa-I)*w;ia[e]=Y;q.vertices.push(new THREE.Vertex(ia))}for(X=0;X<ca;X++)for(K=0;K<T;K++){q.faces.push(new THREE.Face4(K+Ba*X+aa,K+Ba*(X+1)+aa,K+1+Ba*(X+1)+aa,K+1+Ba*X+aa,null,L));q.uvs.push([new THREE.UV(K/T,X/ca),new THREE.UV(K/T,(X+1)/ca),new THREE.UV((K+1)/T,(X+1)/ca),new THREE.UV((K+1)/T,X/ca)])}}THREE.Geometry.call(this);var q=this,x=a/
|
|
|
-2,u=b/2,t=c/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 B in k)this.sides[B]!=undefined&&(this.sides[B]=k[B]);this.sides.px&&n("z","y",1*j,-1,c,b,-x,this.materials[0]);this.sides.nx&&n("z","y",-1*j,-1,c,b,x,this.materials[1]);this.sides.py&&n("x","z",1*j,1,a,c,u,this.materials[2]);this.sides.ny&&n("x","z",1*j,-1,
|
|
|
-a,c,-u,this.materials[3]);this.sides.pz&&n("x","y",1*j,-1,a,b,t,this.materials[4]);this.sides.nz&&n("x","y",-1*j,-1,a,b,-t,this.materials[5]);(function(){for(var D=[],v=[],E=0,w=q.vertices.length;E<w;E++){for(var M=q.vertices[E],K=!1,Y=0,L=D.length;Y<L;Y++){var e=D[Y];if(M.position.x==e.position.x&&M.position.y==e.position.y&&M.position.z==e.position.z){v[E]=Y;K=!0;break}}if(!K){v[E]=D.length;D.push(new THREE.Vertex(M.position.clone()))}}E=0;for(w=q.faces.length;E<w;E++){M=q.faces[E];M.a=v[M.a];M.b=
|
|
|
-v[M.b];M.c=v[M.c];M.d=v[M.d]}q.vertices=D})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
|
-var Cylinder=function(a,b,c,d,f){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)*b,Math.cos(2*j*k/a)*b,0);for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*c,Math.cos(2*j*k/a)*c,d);for(k=0;k<a;k++)h.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(c!=0){g(0,0,-f);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(b!=0){g(0,0,d+f);for(k=a+a/2;k<
|
|
|
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,j,k){function o(D,v,E,w,O,L,Y,M){var e,X,S=d||1,da=f||1,ga=O/2,I=L/2,ca=q.vertices.length;if(D=="x"&&v=="y"||D=="y"&&v=="x")e="z";else if(D=="x"&&v=="z"||D=="z"&&v=="x"){e="y";da=g||1}else if(D=="z"&&
|
|
|
+v=="y"||D=="y"&&v=="z"){e="x";S=g||1}var za=S+1,ea=da+1;O/=S;var xa=L/da;for(X=0;X<ea;X++)for(L=0;L<za;L++){var ja=new THREE.Vector3;ja[D]=(L*O-ga)*E;ja[v]=(X*xa-I)*w;ja[e]=Y;q.vertices.push(new THREE.Vertex(ja))}for(X=0;X<da;X++)for(L=0;L<S;L++){q.faces.push(new THREE.Face4(L+za*X+ca,L+za*(X+1)+ca,L+1+za*(X+1)+ca,L+1+za*X+ca,null,M));q.uvs.push([new THREE.UV(L/S,X/da),new THREE.UV(L/S,(X+1)/da),new THREE.UV((L+1)/S,(X+1)/da),new THREE.UV((L+1)/S,X/da)])}}THREE.Geometry.call(this);var q=this,x=a/
|
|
|
+2,u=b/2,t=c/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var z=0;z<6;z++)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 B in k)this.sides[B]!=undefined&&(this.sides[B]=k[B]);this.sides.px&&o("z","y",1*j,-1,c,b,-x,this.materials[0]);this.sides.nx&&o("z","y",-1*j,-1,c,b,x,this.materials[1]);this.sides.py&&o("x","z",1*j,1,a,c,u,this.materials[2]);this.sides.ny&&o("x","z",1*j,-1,
|
|
|
+a,c,-u,this.materials[3]);this.sides.pz&&o("x","y",1*j,-1,a,b,t,this.materials[4]);this.sides.nz&&o("x","y",-1*j,-1,a,b,-t,this.materials[5]);(function(){for(var D=[],v=[],E=0,w=q.vertices.length;E<w;E++){for(var O=q.vertices[E],L=!1,Y=0,M=D.length;Y<M;Y++){var e=D[Y];if(O.position.x==e.position.x&&O.position.y==e.position.y&&O.position.z==e.position.z){v[E]=Y;L=!0;break}}if(!L){v[E]=D.length;D.push(new THREE.Vertex(O.position.clone()))}}E=0;for(w=q.faces.length;E<w;E++){O=q.faces[E];O.a=v[O.a];O.b=
|
|
|
+v[O.b];O.c=v[O.c];O.d=v[O.d]}q.vertices=D})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
|
+var Cylinder=function(a,b,c,d,f){function g(o,q,x){h.vertices.push(new THREE.Vertex(new THREE.Vector3(o,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)*b,Math.cos(2*j*k/a)*b,0);for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*c,Math.cos(2*j*k/a)*c,d);for(k=0;k<a;k++)h.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(c!=0){g(0,0,-f);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(b!=0){g(0,0,d+f);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,b,c,d){THREE.Geometry.call(this);var f,g=a/2,h=b/2;c=c||1;d=d||1;var j=c+1,k=d+1;a/=c;var n=b/d;for(f=0;f<k;f++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*n-h),0)));for(f=0;f<d;f++)for(b=0;b<c;b++){this.faces.push(new THREE.Face4(b+j*f,b+j*(f+1),b+1+j*(f+1),b+1+j*f));this.uvs.push([new THREE.UV(b/c,f/d),new THREE.UV(b/c,(f+1)/d),new THREE.UV((b+1)/c,(f+1)/d),new THREE.UV((b+1)/c,f/d)])}this.computeCentroids();this.computeFaceNormals()};
|
|
|
+var Plane=function(a,b,c,d){THREE.Geometry.call(this);var f,g=a/2,h=b/2;c=c||1;d=d||1;var j=c+1,k=d+1;a/=c;var o=b/d;for(f=0;f<k;f++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*o-h),0)));for(f=0;f<d;f++)for(b=0;b<c;b++){this.faces.push(new THREE.Face4(b+j*f,b+j*(f+1),b+1+j*(f+1),b+1+j*f));this.uvs.push([new THREE.UV(b/c,f/d),new THREE.UV(b/c,(f+1)/d),new THREE.UV((b+1)/c,(f+1)/d),new THREE.UV((b+1)/c,f/d)])}this.computeCentroids();this.computeFaceNormals()};
|
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
|
-var Sphere=function(a,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c<h+1;c++){d=c/h;var j=a*Math.cos(d*f),k=a*Math.sin(d*f),n=[],q=0;for(d=0;d<g;d++){var x=2*d/g,u=k*Math.sin(x*f);x=k*Math.cos(x*f);(c==0||c==h)&&d>0||(q=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,j,u)))-1);n.push(q)}b.push(n)}var t,y,B;f=b.length;for(c=0;c<f;c++){g=b[c].length;if(c>0)for(d=0;d<g;d++){n=d==g-1;h=b[c][n?0:d+1];j=b[c][n?g-1:d];k=b[c-1][n?g-1:d];n=b[c-1][n?
|
|
|
-0:d+1];u=c/(f-1);t=(c-1)/(f-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 D=new THREE.UV(1-y,t);if(c<b.length-1){t=this.vertices[h].position.clone();y=this.vertices[j].position.clone();B=this.vertices[k].position.clone();t.normalize();y.normalize();B.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(B.x,B.y,B.z)]));this.uvs.push([q,u,x])}if(c>1){t=this.vertices[h].position.clone();
|
|
|
-y=this.vertices[k].position.clone();B=this.vertices[n].position.clone();t.normalize();y.normalize();B.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(B.x,B.y,B.z)]));this.uvs.push([q,x,D])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
|
+var Sphere=function(a,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c<h+1;c++){d=c/h;var j=a*Math.cos(d*f),k=a*Math.sin(d*f),o=[],q=0;for(d=0;d<g;d++){var x=2*d/g,u=k*Math.sin(x*f);x=k*Math.cos(x*f);(c==0||c==h)&&d>0||(q=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,j,u)))-1);o.push(q)}b.push(o)}var t,z,B;f=b.length;for(c=0;c<f;c++){g=b[c].length;if(c>0)for(d=0;d<g;d++){o=d==g-1;h=b[c][o?0:d+1];j=b[c][o?g-1:d];k=b[c-1][o?g-1:d];o=b[c-1][o?
|
|
|
+0:d+1];u=c/(f-1);t=(c-1)/(f-1);z=(d+1)/g;x=d/g;q=new THREE.UV(1-z,u);u=new THREE.UV(1-x,u);x=new THREE.UV(1-x,t);var D=new THREE.UV(1-z,t);if(c<b.length-1){t=this.vertices[h].position.clone();z=this.vertices[j].position.clone();B=this.vertices[k].position.clone();t.normalize();z.normalize();B.normalize();this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([q,u,x])}if(c>1){t=this.vertices[h].position.clone();
|
|
|
+z=this.vertices[k].position.clone();B=this.vertices[o].position.clone();t.normalize();z.normalize();B.normalize();this.faces.push(new THREE.Face3(h,k,o,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([q,x,D])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
|
var Torus=function(a,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
|
|
|
1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;f=(this.segmentsT+1)*b+c-1;var g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][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 b(x,u,t){var y=Math.sqrt(x*x+u*u+t*t);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(x/y,u/y,t/y)))-1}function c(x,u,t,y){y.faces.push(new THREE.Face3(x,u,t))}function d(x,u){var t=f.vertices[x].position,y=f.vertices[u].position;return b((t.x+y.x)/2,(t.y+y.y)/2,(t.z+y.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
|
|
|
-1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),n=d(g.faces[j].b,g.faces[j].c),q=d(g.faces[j].c,g.faces[j].a);c(g.faces[j].a,k,q,h);c(g.faces[j].b,n,k,h);c(g.faces[j].c,
|
|
|
-q,n,h);c(k,n,q,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
-function LathedObject(a,b,c){THREE.Geometry.call(this);this.nsteps=b||12;this.latheAngle=c||2*Math.PI;b=this.latheAngle/this.nsteps;for(var d=[],f=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));f[j]=this.vertices.length-1;d[j]=new THREE.Vector3(a[j].x,a[j].y,a[j].z)}for(var k=THREE.Matrix4.rotationZMatrix(this.stepSize),n=0;n<=this.latheAngle+0.0010;n+=this.stepSize){for(j=0;j<d.length;j++)if(n<c){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));
|
|
|
-g[j]=this.vertices.length-1}else g=h;n==0&&(h=f);for(j=0;j<f.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],f[j+1],f[j]));this.uvs.push([new THREE.UV(n/c,j/a.length),new THREE.UV(n/c,(j+1)/a.length),new THREE.UV((n-b)/c,(j+1)/a.length),new THREE.UV((n-b)/c,j/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
|
|
|
+var Icosahedron=function(a){function b(x,u,t){var z=Math.sqrt(x*x+u*u+t*t);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(x/z,u/z,t/z)))-1}function c(x,u,t,z){z.faces.push(new THREE.Face3(x,u,t))}function d(x,u){var t=f.vertices[x].position,z=f.vertices[u].position;return b((t.x+z.x)/2,(t.y+z.y)/2,(t.z+z.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
|
|
|
+1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),o=d(g.faces[j].b,g.faces[j].c),q=d(g.faces[j].c,g.faces[j].a);c(g.faces[j].a,k,q,h);c(g.faces[j].b,o,k,h);c(g.faces[j].c,
|
|
|
+q,o,h);c(k,o,q,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
+function LathedObject(a,b,c){THREE.Geometry.call(this);this.nsteps=b||12;this.latheAngle=c||2*Math.PI;b=this.latheAngle/this.nsteps;for(var d=[],f=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));f[j]=this.vertices.length-1;d[j]=new THREE.Vector3(a[j].x,a[j].y,a[j].z)}for(var k=THREE.Matrix4.rotationZMatrix(this.stepSize),o=0;o<=this.latheAngle+0.0010;o+=this.stepSize){for(j=0;j<d.length;j++)if(o<c){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));
|
|
|
+g[j]=this.vertices.length-1}else g=h;o==0&&(h=f);for(j=0;j<f.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],f[j+1],f[j]));this.uvs.push([new THREE.UV(o/c,j/a.length),new THREE.UV(o/c,(j+1)/a.length),new THREE.UV((o-b)/c,(j+1)/a.length),new THREE.UV((o-b)/c,j/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
|
|
|
if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
|
|
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;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(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,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;f[g]=this.lerp(q[c],q[c+3],h);f[g+1]=this.lerp(q[c+1],q[c+4],h);f[g+2]=this.lerp(q[c+2],q[c+5],h)};this.VIntY=function(c,d,f,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=c+this.yd*3;f[g]=this.lerp(q[c],q[d],h);f[g+1]=this.lerp(q[c+1],q[d+1],h);f[g+2]=this.lerp(q[c+2],q[d+2],h)};this.VIntZ=function(c,d,f,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=c+this.zd*3;f[g]=this.lerp(q[c],q[d],h);f[g+1]=this.lerp(q[c+1],q[d+1],h);f[g+2]=this.lerp(q[c+2],q[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
|
|
|
-this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,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,B=0,D=this.field[g],v=this.field[k],E=this.field[n],w=this.field[x],M=this.field[q],K=this.field[u],Y=this.field[t],L=this.field[y];D<h&&(B|=1);v<h&&(B|=2);E<h&&(B|=8);w<h&&(B|=4);M<h&&(B|=16);K<h&&(B|=32);Y<h&&(B|=128);L<h&&(B|=64);var e=THREE.edgeTable[B];if(e==0)return 0;
|
|
|
-var X=this.delta,T=c+X,ca=d+X;X=f+X;if(e&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,D,v)}if(e&2){this.compNorm(k);this.compNorm(x);this.VIntY(k*3,this.vlist,this.nlist,3,h,T,d,f,v,w)}if(e&4){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,6,h,c,ca,f,E,w)}if(e&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,D,E)}if(e&16){this.compNorm(q);this.compNorm(u);this.VIntX(q*3,this.vlist,this.nlist,12,h,c,d,
|
|
|
-X,M,K)}if(e&32){this.compNorm(u);this.compNorm(y);this.VIntY(u*3,this.vlist,this.nlist,15,h,T,d,X,K,L)}if(e&64){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,18,h,c,ca,X,Y,L)}if(e&128){this.compNorm(q);this.compNorm(t);this.VIntY(q*3,this.vlist,this.nlist,21,h,c,d,X,M,Y)}if(e&256){this.compNorm(g);this.compNorm(q);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,D,M)}if(e&512){this.compNorm(k);this.compNorm(u);this.VIntZ(k*3,this.vlist,this.nlist,27,h,T,d,f,v,K)}if(e&1024){this.compNorm(x);
|
|
|
-this.compNorm(y);this.VIntZ(x*3,this.vlist,this.nlist,30,h,T,ca,f,w,L)}if(e&2048){this.compNorm(n);this.compNorm(t);this.VIntZ(n*3,this.vlist,this.nlist,33,h,c,ca,f,E,Y)}B<<=4;for(h=g=0;THREE.triTable[B+h]!=-1;){c=B+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],j);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,j){var k=this.count*3;this.positionArray[k]=c[f];this.positionArray[k+1]=c[f+1];this.positionArray[k+2]=c[f+2];this.positionArray[k+
|
|
|
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,g,h,j,k,o,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=o;f[g]=this.lerp(q[c],q[c+3],h);f[g+1]=this.lerp(q[c+1],q[c+4],h);f[g+2]=this.lerp(q[c+2],q[c+5],h)};this.VIntY=function(c,d,f,g,h,j,k,o,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
|
|
|
+2]=o;d=c+this.yd*3;f[g]=this.lerp(q[c],q[d],h);f[g+1]=this.lerp(q[c+1],q[d+1],h);f[g+2]=this.lerp(q[c+2],q[d+2],h)};this.VIntZ=function(c,d,f,g,h,j,k,o,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=o+h*this.delta;d=c+this.zd*3;f[g]=this.lerp(q[c],q[d],h);f[g+1]=this.lerp(q[c+1],q[d+1],h);f[g+2]=this.lerp(q[c+2],q[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
|
|
|
+this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,g,h,j){var k=g+1,o=g+this.yd,q=g+this.zd,x=k+this.yd,u=k+this.zd,t=g+this.yd+this.zd,z=k+this.yd+this.zd,B=0,D=this.field[g],v=this.field[k],E=this.field[o],w=this.field[x],O=this.field[q],L=this.field[u],Y=this.field[t],M=this.field[z];D<h&&(B|=1);v<h&&(B|=2);E<h&&(B|=8);w<h&&(B|=4);O<h&&(B|=16);L<h&&(B|=32);Y<h&&(B|=128);M<h&&(B|=64);var e=THREE.edgeTable[B];if(e==0)return 0;
|
|
|
+var X=this.delta,S=c+X,da=d+X;X=f+X;if(e&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,D,v)}if(e&2){this.compNorm(k);this.compNorm(x);this.VIntY(k*3,this.vlist,this.nlist,3,h,S,d,f,v,w)}if(e&4){this.compNorm(o);this.compNorm(x);this.VIntX(o*3,this.vlist,this.nlist,6,h,c,da,f,E,w)}if(e&8){this.compNorm(g);this.compNorm(o);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,D,E)}if(e&16){this.compNorm(q);this.compNorm(u);this.VIntX(q*3,this.vlist,this.nlist,12,h,c,d,
|
|
|
+X,O,L)}if(e&32){this.compNorm(u);this.compNorm(z);this.VIntY(u*3,this.vlist,this.nlist,15,h,S,d,X,L,M)}if(e&64){this.compNorm(t);this.compNorm(z);this.VIntX(t*3,this.vlist,this.nlist,18,h,c,da,X,Y,M)}if(e&128){this.compNorm(q);this.compNorm(t);this.VIntY(q*3,this.vlist,this.nlist,21,h,c,d,X,O,Y)}if(e&256){this.compNorm(g);this.compNorm(q);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,D,O)}if(e&512){this.compNorm(k);this.compNorm(u);this.VIntZ(k*3,this.vlist,this.nlist,27,h,S,d,f,v,L)}if(e&1024){this.compNorm(x);
|
|
|
+this.compNorm(z);this.VIntZ(x*3,this.vlist,this.nlist,30,h,S,da,f,w,M)}if(e&2048){this.compNorm(o);this.compNorm(t);this.VIntZ(o*3,this.vlist,this.nlist,33,h,c,da,f,E,Y)}B<<=4;for(h=g=0;THREE.triTable[B+h]!=-1;){c=B+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],j);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,j){var k=this.count*3;this.positionArray[k]=c[f];this.positionArray[k+1]=c[f+1];this.positionArray[k+2]=c[f+2];this.positionArray[k+
|
|
|
3]=c[g];this.positionArray[k+4]=c[g+1];this.positionArray[k+5]=c[g+2];this.positionArray[k+6]=c[h];this.positionArray[k+7]=c[h+1];this.positionArray[k+8]=c[h+2];this.normalArray[k]=d[f];this.normalArray[k+1]=d[f+1];this.normalArray[k+2]=d[f+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(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var j=this.size*Math.sqrt(g/h),k=f*this.size,n=d*this.size,q=c*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,B,D,v,E,w;x<k;x++){q=this.size2*x;B=x/this.size-f;E=B*B;for(B=u;B<n;B++){D=q+this.size*B;y=B/this.size-d;w=y*y;for(y=t;y<j;y++){v=y/this.size-c;v=g/(1.0E-6+v*v+w+E)-h;v>0&&(this.field[D+y]+=v)}}}};this.addPlaneX=function(c,d){var f,g,h,j,k,n=this.size,q=this.yd,x=this.zd,u=this.field,t=n*Math.sqrt(c/d);t>n&&(t=n);for(f=0;f<t;f++){g=f/n;g*=g;j=c/(1.0E-4+g)-d;if(j>0)for(g=0;g<n;g++){k=f+g*q;for(h=0;h<n;h++)u[x*h+k]+=j}}};this.addPlaneY=function(c,d){var f,g,
|
|
|
-h,j,k,n,q=this.size,x=this.yd,u=this.zd,t=this.field,y=q*Math.sqrt(c/d);y>q&&(y=q);for(g=0;g<y;g++){f=g/q;f*=f;j=c/(1.0E-4+f)-d;if(j>0){k=g*x;for(f=0;f<q;f++){n=k+f;for(h=0;h<q;h++)t[u*h+n]+=j}}}};this.addPlaneZ=function(c,d){var f,g,h,j,k,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;j=c/(1.0E-4+f)-d;if(j>0){k=zd*h;for(g=0;g<size;g++){n=k+g*yd;for(f=0;f<size;f++)field[n+f]+=j}}}};this.reset=function(){var c;
|
|
|
-for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,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(f=1;f<u;f++){j=(f-this.halfsize)/this.halfsize;d=q+f;this.polygonize(j,k,n,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,j,k,n,q,x,u;for(g=
|
|
|
-0;g<f.count;g++){n=g*3;x=n+1;u=n+2;h=f.positionArray[n];j=f.positionArray[x];k=f.positionArray[u];q=new THREE.Vector3(h,j,k);h=f.normalArray[n];j=f.normalArray[x];k=f.normalArray[u];n=new THREE.Vector3(h,j,k);n.normalize();n=new THREE.Vertex(q,n);d.vertices.push(n)}nfaces=f.count/3;for(g=0;g<nfaces;g++){n=(c+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)}c+=nfaces;f.count=0});return d};this.init(a)};
|
|
|
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var j=this.size*Math.sqrt(g/h),k=f*this.size,o=d*this.size,q=c*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(o-j);u<1&&(u=1);o=Math.floor(o+j);o>this.size-1&&(o=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 z,B,D,v,E,w;x<k;x++){q=this.size2*x;B=x/this.size-f;E=B*B;for(B=u;B<o;B++){D=q+this.size*B;z=B/this.size-d;w=z*z;for(z=t;z<j;z++){v=z/this.size-c;v=g/(1.0E-6+v*v+w+E)-h;v>0&&(this.field[D+z]+=v)}}}};this.addPlaneX=function(c,d){var f,g,h,j,k,o=this.size,q=this.yd,x=this.zd,u=this.field,t=o*Math.sqrt(c/d);t>o&&(t=o);for(f=0;f<t;f++){g=f/o;g*=g;j=c/(1.0E-4+g)-d;if(j>0)for(g=0;g<o;g++){k=f+g*q;for(h=0;h<o;h++)u[x*h+k]+=j}}};this.addPlaneY=function(c,d){var f,g,
|
|
|
+h,j,k,o,q=this.size,x=this.yd,u=this.zd,t=this.field,z=q*Math.sqrt(c/d);z>q&&(z=q);for(g=0;g<z;g++){f=g/q;f*=f;j=c/(1.0E-4+f)-d;if(j>0){k=g*x;for(f=0;f<q;f++){o=k+f;for(h=0;h<q;h++)t[u*h+o]+=j}}}};this.addPlaneZ=function(c,d){var f,g,h,j,k,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;j=c/(1.0E-4+f)-d;if(j>0){k=zd*h;for(g=0;g<size;g++){o=k+g*yd;for(f=0;f<size;f++)field[o+f]+=j}}}};this.reset=function(){var c;
|
|
|
+for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,g,h,j,k,o,q,x,u=this.size-2;for(h=1;h<u;h++){x=this.size2*h;o=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){q=x+this.size*g;k=(g-this.halfsize)/this.halfsize;for(f=1;f<u;f++){j=(f-this.halfsize)/this.halfsize;d=q+f;this.polygonize(j,k,o,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,j,k,o,q,x,u;for(g=
|
|
|
+0;g<f.count;g++){o=g*3;x=o+1;u=o+2;h=f.positionArray[o];j=f.positionArray[x];k=f.positionArray[u];q=new THREE.Vector3(h,j,k);h=f.normalArray[o];j=f.normalArray[x];k=f.normalArray[u];o=new THREE.Vector3(h,j,k);o.normalize();o=new THREE.Vertex(q,o);d.vertices.push(o)}nfaces=f.count/3;for(g=0;g<nfaces;g++){o=(c+g)*3;x=o+1;u=o+2;q=d.vertices[o].normal;h=d.vertices[x].normal;j=d.vertices[u].normal;o=new THREE.Face3(o,x,u,[q,h,j]);d.faces.push(o)}c+=nfaces;f.count=0});return d};this.init(a)};
|
|
|
THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
@@ -374,25 +375,25 @@ THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement
|
|
|
b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,c,d)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:
|
|
|
THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,f,d,g)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,d,f,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0;
|
|
|
h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,f,b):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,b,c,d){var f=function(g){function h(p,m){var o=q(p,m),C=q(p,m+1),A=q(p,m+2),G=q(p,m+3),Q=(G<<1&255|A>>7)-127;o|=(A&127)<<16|C<<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),C=q(p,m+1),A=q(p,m+2);return(q(p,m+3)<<24)+(A<<16)+(C<<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,C;m=j(a,p);
|
|
|
-o=j(a,p+Y);C=j(a,p+L);p=k(a,p+e);THREE.Loader.prototype.f3(v,m,o,C,p)}function u(p){var m,o,C,A,G,Q;m=j(a,p);o=j(a,p+Y);C=j(a,p+L);A=k(a,p+e);G=j(a,p+X);Q=j(a,p+T);p=j(a,p+ca);THREE.Loader.prototype.f3n(v,M,m,o,C,A,G,Q,p)}function t(p){var m,o,C,A;m=j(a,p);o=j(a,p+ea);C=j(a,p+I);A=j(a,p+aa);p=k(a,p+Ba);THREE.Loader.prototype.f4(v,m,o,C,A,p)}function y(p){var m,o,C,A,G,Q,N,F;m=j(a,p);o=j(a,p+ea);C=j(a,p+I);A=j(a,p+aa);G=k(a,p+Ba);Q=j(a,p+da);N=j(a,p+xa);F=j(a,p+ia);p=j(a,p+fa);THREE.Loader.prototype.f4n(v,
|
|
|
-M,m,o,C,A,G,Q,N,F,p)}function B(p){var m,o;m=j(a,p);o=j(a,p+va);p=j(a,p+Ca);THREE.Loader.prototype.uv3(v.uvs,K[m*2],K[m*2+1],K[o*2],K[o*2+1],K[p*2],K[p*2+1])}function D(p){var m,o,C;m=j(a,p);o=j(a,p+ha);C=j(a,p+Z);p=j(a,p+pa);THREE.Loader.prototype.uv4(v.uvs,K[m*2],K[m*2+1],K[o*2],K[o*2+1],K[C*2],K[C*2+1],K[p*2],K[p*2+1])}var v=this,E=0,w,M=[],K=[],Y,L,e,X,T,ca,ea,I,aa,Ba,da,xa,ia,fa,va,Ca,ha,Z,pa,qa,R,la,ta,l,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);w={signature:a.substr(E,
|
|
|
+createBinModel:function(a,b,c,d){var f=function(g){function h(p,n){var m=q(p,n),C=q(p,n+1),y=q(p,n+2),G=q(p,n+3),N=(G<<1&255|y>>7)-127;m|=(y&127)<<16|C<<8;if(m==0&&N==-127)return 0;return(1-2*(G>>7))*(1+m*Math.pow(2,-23))*Math.pow(2,N)}function j(p,n){var m=q(p,n),C=q(p,n+1),y=q(p,n+2);return(q(p,n+3)<<24)+(y<<16)+(C<<8)+m}function k(p,n){var m=q(p,n);return(q(p,n+1)<<8)+m}function o(p,n){var m=q(p,n);return m>127?m-256:m}function q(p,n){return p.charCodeAt(n)&255}function x(p){var n,m,C;n=j(a,p);
|
|
|
+m=j(a,p+Y);C=j(a,p+M);p=k(a,p+e);THREE.Loader.prototype.f3(v,n,m,C,p)}function u(p){var n,m,C,y,G,N;n=j(a,p);m=j(a,p+Y);C=j(a,p+M);y=k(a,p+e);G=j(a,p+X);N=j(a,p+S);p=j(a,p+da);THREE.Loader.prototype.f3n(v,O,n,m,C,y,G,N,p)}function t(p){var n,m,C,y;n=j(a,p);m=j(a,p+ga);C=j(a,p+I);y=j(a,p+ca);p=k(a,p+za);THREE.Loader.prototype.f4(v,n,m,C,y,p)}function z(p){var n,m,C,y,G,N,R,F;n=j(a,p);m=j(a,p+ga);C=j(a,p+I);y=j(a,p+ca);G=k(a,p+za);N=j(a,p+ea);R=j(a,p+xa);F=j(a,p+ja);p=j(a,p+ha);THREE.Loader.prototype.f4n(v,
|
|
|
+O,n,m,C,y,G,N,R,F,p)}function B(p){var n,m;n=j(a,p);m=j(a,p+va);p=j(a,p+Aa);THREE.Loader.prototype.uv3(v.uvs,L[n*2],L[n*2+1],L[m*2],L[m*2+1],L[p*2],L[p*2+1])}function D(p){var n,m,C;n=j(a,p);m=j(a,p+ia);C=j(a,p+$);p=j(a,p+qa);THREE.Loader.prototype.uv4(v.uvs,L[n*2],L[n*2+1],L[m*2],L[m*2+1],L[C*2],L[C*2+1],L[p*2],L[p*2+1])}var v=this,E=0,w,O=[],L=[],Y,M,e,X,S,da,ga,I,ca,za,ea,xa,ja,ha,va,Aa,ia,$,qa,ra,Q,ma,ta,l,A;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;Y=w.vertex_index_bytes;L=w.vertex_index_bytes*2;e=w.vertex_index_bytes*3;X=w.vertex_index_bytes*3+w.material_index_bytes;T=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;ca=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;ea=w.vertex_index_bytes;I=w.vertex_index_bytes*2;aa=w.vertex_index_bytes*3;Ba=w.vertex_index_bytes*4;da=w.vertex_index_bytes*4+w.material_index_bytes;xa=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;fa=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;va=w.uv_index_bytes;Ca=w.uv_index_bytes*2;ha=w.uv_index_bytes;Z=w.uv_index_bytes*2;pa=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;qa=w.ntri_flat*g;R=w.ntri_smooth*(g+w.normal_index_bytes*3);la=w.ntri_flat_uv*(g+w.uv_index_bytes*3);ta=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);E+=function(p){for(var m,o,C,A=w.vertex_coordinate_bytes*3,G=p+w.nvertices*A;p<G;p+=A){m=h(a,p);o=h(a,p+w.vertex_coordinate_bytes);C=h(a,p+w.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,m,o,C)}return w.nvertices*A}(E);E+=function(p){for(var m,o,C,A=w.normal_coordinate_bytes*3,G=p+w.nnormals*A;p<G;p+=A){m=n(a,p);o=n(a,p+w.normal_coordinate_bytes);C=n(a,p+w.normal_coordinate_bytes*2);M.push(m/
|
|
|
-127,o/127,C/127)}return w.nnormals*A}(E);E+=function(p){for(var m,o,C=w.uv_coordinate_bytes*2,A=p+w.nuvs*C;p<A;p+=C){m=h(a,p);o=h(a,p+w.uv_coordinate_bytes);K.push(m,o)}return w.nuvs*C}(E);qa=E+qa;R=qa+R;la=R+la;ta=la+ta;l=ta+l;g=l+g;z=g+z;(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes,C=o+w.uv_index_bytes*3,A=p+w.ntri_flat_uv*C;for(m=p;m<A;m+=C){x(m);B(m+o)}return A-p})(R);(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,C=o+w.uv_index_bytes*
|
|
|
-3,A=p+w.ntri_smooth_uv*C;for(m=p;m<A;m+=C){u(m);B(m+o)}return A-p})(la);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes,C=o+w.uv_index_bytes*4,A=p+w.nquad_flat_uv*C;for(m=p;m<A;m+=C){t(m);D(m+o)}return A-p})(g);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,C=o+w.uv_index_bytes*4,A=p+w.nquad_smooth_uv*C;for(m=p;m<A;m+=C){y(m);D(m+o)}return A-p})(z);(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes,C=p+w.ntri_flat*o;for(m=
|
|
|
-p;m<C;m+=o)x(m);return C-p})(E);(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,C=p+w.ntri_smooth*o;for(m=p;m<C;m+=o)u(m);return C-p})(qa);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes,C=p+w.nquad_flat*o;for(m=p;m<C;m+=o)t(m);return C-p})(ta);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,C=p+w.nquad_smooth*o;for(m=p;m<C;m+=o)y(m);return C-p})(l);this.computeCentroids();this.computeFaceNormals()};
|
|
|
-f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},createModel:function(a,b,c){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var h,j,k,n,q,x;if(a.vertices!==undefined){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)}}else{h=0;for(j=a.vertexKeys.length;h<j;h++){g.vertexKeys[h]={};g.vertexKeys[h].time=a.vertexKeys[h].t;g.vertexKeys[h].vertices=
|
|
|
-[];x=g.vertexKeys[h].vertices;q=a.vertexKeys[h].v;if(h===0){k=0;for(n=q.length;k<n;k+=3)g.vertices.push(new THREE.Vertex(new THREE.Vector3(q[k],q[k+1],q[k+2])))}k=0;for(n=q.length;k<n;k+=3)x.push(new THREE.Vertex(new THREE.Vector3(q[k],q[k+1],q[k+2])))}}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,B){THREE.Loader.prototype.f3(g,y[B],y[B+1],y[B+2],y[B+3])}function j(y,B){THREE.Loader.prototype.f3n(g,
|
|
|
-a.normals,y[B],y[B+1],y[B+2],y[B+3],y[B+4],y[B+5],y[B+6])}function k(y,B){THREE.Loader.prototype.f4(g,y[B],y[B+1],y[B+2],y[B+3],y[B+4])}function n(y,B){THREE.Loader.prototype.f4n(g,a.normals,y[B],y[B+1],y[B+2],y[B+3],y[B+4],y[B+5],y[B+6],y[B+7],y[B+8])}function q(y,B){var D,v,E,w,M,K,Y,L,e;D=y[B];v=y[B+1];E=y[B+2];w=a.uvs[D*2];Y=a.uvs[D*2+1];M=a.uvs[v*2];L=a.uvs[v*2+1];K=a.uvs[E*2];e=a.uvs[E*2+1];THREE.Loader.prototype.uv3(g.uvs,w,Y,M,L,K,e);if(a.uvs2&&a.uvs2.length){w=a.uvs2[D*2];Y=a.uvs2[D*2+1];
|
|
|
-M=a.uvs2[v*2];L=a.uvs2[v*2+1];K=a.uvs2[E*2];e=a.uvs2[E*2+1];THREE.Loader.prototype.uv3(g.uvs2,w,1-Y,M,1-L,K,1-e)}}function x(y,B){var D,v,E,w,M,K,Y,L,e,X,T,ca;D=y[B];v=y[B+1];E=y[B+2];w=y[B+3];M=a.uvs[D*2];e=a.uvs[D*2+1];K=a.uvs[v*2];X=a.uvs[v*2+1];Y=a.uvs[E*2];T=a.uvs[E*2+1];L=a.uvs[w*2];ca=a.uvs[w*2+1];THREE.Loader.prototype.uv4(g.uvs,M,e,K,X,Y,T,L,ca);if(a.uvs2){M=a.uvs2[D*2];e=a.uvs2[D*2+1];K=a.uvs2[v*2];X=a.uvs2[v*2+1];Y=a.uvs2[E*2];T=a.uvs2[E*2+1];L=a.uvs2[w*2];ca=a.uvs2[w*2+1];THREE.Loader.prototype.uv4(g.uvs2,
|
|
|
-M,1-e,K,1-X,Y,1-T,L,1-ca)}}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;b(new d(c))},bones:function(a,b){a.bones=b},animation:function(a,b){a.animation=b},si:function(a,b,c,d,f){a.skinIndices.push(new THREE.Vector4(b,c,d,f))},sw:function(a,b,c,d,f){a.skinWeights.push(new THREE.Vector4(b,c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))},vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},
|
|
|
-f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,j,k){g=a.materials[g];var n=b[j*3],q=b[j*3+1];j=b[j*3+2];var x=b[k*3],u=b[k*3+1];k=b[k*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(n,q,j),new THREE.Vector3(x,u,k)],g))},f4n:function(a,b,c,d,f,g,h,j,k,n,q){h=a.materials[h];var x=b[k*3],u=b[k*3+1];k=b[k*
|
|
|
-3+2];var t=b[n*3],y=b[n*3+1];n=b[n*3+2];var B=b[q*3],D=b[q*3+1];q=b[q*3+2];a.faces.push(new THREE.Face4(c,d,f,g,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(x,u,k),new THREE.Vector3(t,y,n),new THREE.Vector3(B,D,q)],h))},uv3:function(a,b,c,d,f,g,h){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(d,f));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,b,c,d,f,g,h,j,k){var n=[];n.push(new THREE.UV(b,c));n.push(new THREE.UV(d,f));n.push(new THREE.UV(g,h));n.push(new THREE.UV(j,
|
|
|
-k));a.push(n)},init_materials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],c)]},createMaterial:function(a,b){function c(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var n=new Image;n.onload=function(){if(!c(this.width)||!c(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 f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.mapDiffuse&&b){h=document.createElement("canvas");g.map=new THREE.Texture(h);d(g.map,b+"/"+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&&b){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);d(g.lightMap,b+"/"+a.mapLightmap)}return new THREE[f](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|
|
|
+E+=w.header_bytes;Y=w.vertex_index_bytes;M=w.vertex_index_bytes*2;e=w.vertex_index_bytes*3;X=w.vertex_index_bytes*3+w.material_index_bytes;S=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;ga=w.vertex_index_bytes;I=w.vertex_index_bytes*2;ca=w.vertex_index_bytes*3;za=w.vertex_index_bytes*4;ea=w.vertex_index_bytes*4+w.material_index_bytes;xa=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;ja=
|
|
|
+w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;ha=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;va=w.uv_index_bytes;Aa=w.uv_index_bytes*2;ia=w.uv_index_bytes;$=w.uv_index_bytes*2;qa=w.uv_index_bytes*3;g=w.vertex_index_bytes*3+w.material_index_bytes;A=w.vertex_index_bytes*4+w.material_index_bytes;ra=w.ntri_flat*g;Q=w.ntri_smooth*(g+w.normal_index_bytes*3);ma=w.ntri_flat_uv*(g+w.uv_index_bytes*3);ta=w.ntri_smooth_uv*(g+w.normal_index_bytes*3+w.uv_index_bytes*
|
|
|
+3);l=w.nquad_flat*A;g=w.nquad_smooth*(A+w.normal_index_bytes*4);A=w.nquad_flat_uv*(A+w.uv_index_bytes*4);E+=function(p){for(var n,m,C,y=w.vertex_coordinate_bytes*3,G=p+w.nvertices*y;p<G;p+=y){n=h(a,p);m=h(a,p+w.vertex_coordinate_bytes);C=h(a,p+w.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,n,m,C)}return w.nvertices*y}(E);E+=function(p){for(var n,m,C,y=w.normal_coordinate_bytes*3,G=p+w.nnormals*y;p<G;p+=y){n=o(a,p);m=o(a,p+w.normal_coordinate_bytes);C=o(a,p+w.normal_coordinate_bytes*2);O.push(n/
|
|
|
+127,m/127,C/127)}return w.nnormals*y}(E);E+=function(p){for(var n,m,C=w.uv_coordinate_bytes*2,y=p+w.nuvs*C;p<y;p+=C){n=h(a,p);m=h(a,p+w.uv_coordinate_bytes);L.push(n,m)}return w.nuvs*C}(E);ra=E+ra;Q=ra+Q;ma=Q+ma;ta=ma+ta;l=ta+l;g=l+g;A=g+A;(function(p){var n,m=w.vertex_index_bytes*3+w.material_index_bytes,C=m+w.uv_index_bytes*3,y=p+w.ntri_flat_uv*C;for(n=p;n<y;n+=C){x(n);B(n+m)}return y-p})(Q);(function(p){var n,m=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,C=m+w.uv_index_bytes*
|
|
|
+3,y=p+w.ntri_smooth_uv*C;for(n=p;n<y;n+=C){u(n);B(n+m)}return y-p})(ma);(function(p){var n,m=w.vertex_index_bytes*4+w.material_index_bytes,C=m+w.uv_index_bytes*4,y=p+w.nquad_flat_uv*C;for(n=p;n<y;n+=C){t(n);D(n+m)}return y-p})(g);(function(p){var n,m=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,C=m+w.uv_index_bytes*4,y=p+w.nquad_smooth_uv*C;for(n=p;n<y;n+=C){z(n);D(n+m)}return y-p})(A);(function(p){var n,m=w.vertex_index_bytes*3+w.material_index_bytes,C=p+w.ntri_flat*m;for(n=
|
|
|
+p;n<C;n+=m)x(n);return C-p})(E);(function(p){var n,m=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,C=p+w.ntri_smooth*m;for(n=p;n<C;n+=m)u(n);return C-p})(ra);(function(p){var n,m=w.vertex_index_bytes*4+w.material_index_bytes,C=p+w.nquad_flat*m;for(n=p;n<C;n+=m)t(n);return C-p})(ta);(function(p){var n,m=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,C=p+w.nquad_smooth*m;for(n=p;n<C;n+=m)z(n);return C-p})(l);this.computeCentroids();this.computeFaceNormals()};
|
|
|
+f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},createModel:function(a,b,c){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var h,j,k,o,q,x;h=0;for(j=a.vertices.length;h<j;h+=3){k=a.vertices[h];o=a.vertices[h+1];q=a.vertices[h+2];THREE.Loader.prototype.v(g,k,o,q)}if(a.morphTargets!==undefined){h=0;for(j=a.morphTargets.length;h<j;h++){g.morphTargets[h]={};g.morphTargets[h].name=a.morphTargets[h].name;g.morphTargets[h].vertices=
|
|
|
+[];x=g.morphTargets[h].vertices;q=a.morphTargets[h].vertices;k=0;for(o=q.length;k<o;k+=3)x.push(new THREE.Vertex(new THREE.Vector3(q[k],q[k+1],q[k+2])))}}if(a.colors){h=0;for(j=a.colors.length;h<j;h+=3){k=a.colors[h];o=a.colors[h+1];q=a.colors[h+2];THREE.Loader.prototype.vc(g,k,o,q)}}})();(function(){function h(z,B){THREE.Loader.prototype.f3(g,z[B],z[B+1],z[B+2],z[B+3])}function j(z,B){THREE.Loader.prototype.f3n(g,a.normals,z[B],z[B+1],z[B+2],z[B+3],z[B+4],z[B+5],z[B+6])}function k(z,B){THREE.Loader.prototype.f4(g,
|
|
|
+z[B],z[B+1],z[B+2],z[B+3],z[B+4])}function o(z,B){THREE.Loader.prototype.f4n(g,a.normals,z[B],z[B+1],z[B+2],z[B+3],z[B+4],z[B+5],z[B+6],z[B+7],z[B+8])}function q(z,B){var D,v,E,w,O,L,Y,M,e;D=z[B];v=z[B+1];E=z[B+2];w=a.uvs[D*2];Y=a.uvs[D*2+1];O=a.uvs[v*2];M=a.uvs[v*2+1];L=a.uvs[E*2];e=a.uvs[E*2+1];THREE.Loader.prototype.uv3(g.uvs,w,Y,O,M,L,e);if(a.uvs2&&a.uvs2.length){w=a.uvs2[D*2];Y=a.uvs2[D*2+1];O=a.uvs2[v*2];M=a.uvs2[v*2+1];L=a.uvs2[E*2];e=a.uvs2[E*2+1];THREE.Loader.prototype.uv3(g.uvs2,w,1-Y,O,
|
|
|
+1-M,L,1-e)}}function x(z,B){var D,v,E,w,O,L,Y,M,e,X,S,da;D=z[B];v=z[B+1];E=z[B+2];w=z[B+3];O=a.uvs[D*2];e=a.uvs[D*2+1];L=a.uvs[v*2];X=a.uvs[v*2+1];Y=a.uvs[E*2];S=a.uvs[E*2+1];M=a.uvs[w*2];da=a.uvs[w*2+1];THREE.Loader.prototype.uv4(g.uvs,O,e,L,X,Y,S,M,da);if(a.uvs2){O=a.uvs2[D*2];e=a.uvs2[D*2+1];L=a.uvs2[v*2];X=a.uvs2[v*2+1];Y=a.uvs2[E*2];S=a.uvs2[E*2+1];M=a.uvs2[w*2];da=a.uvs2[w*2+1];THREE.Loader.prototype.uv4(g.uvs2,O,1-e,L,1-X,Y,1-S,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){o(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)o(a.quadsNormals,u)})();(function(){var h,j,k,o;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<j;h+=2){k=a.skinWeights[h];o=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,k,o,0,0)}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];o=a.skinIndices[h+1];THREE.Loader.prototype.si(g,k,o,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;b(new d(c))},bones:function(a,b){a.bones=b},animation:function(a,b){a.animation=b},si:function(a,b,c,d,f){a.skinIndices.push(new THREE.Vector4(b,c,d,f))},sw:function(a,b,c,d,f){a.skinWeights.push(new THREE.Vector4(b,c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))},vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,
|
|
|
+b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,j,k){g=a.materials[g];var o=b[j*3],q=b[j*3+1];j=b[j*3+2];var x=b[k*3],u=b[k*3+1];k=b[k*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(o,q,j),new THREE.Vector3(x,u,k)],g))},f4n:function(a,b,c,d,f,g,h,j,k,o,q){h=a.materials[h];var x=b[k*3],u=b[k*3+1];k=b[k*3+2];var t=b[o*3],z=b[o*3+1];o=b[o*3+2];var B=b[q*3],D=b[q*3+1];q=b[q*3+2];a.faces.push(new THREE.Face4(c,
|
|
|
+d,f,g,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(x,u,k),new THREE.Vector3(t,z,o),new THREE.Vector3(B,D,q)],h))},uv3:function(a,b,c,d,f,g,h){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(d,f));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,b,c,d,f,g,h,j,k){var o=[];o.push(new THREE.UV(b,c));o.push(new THREE.UV(d,f));o.push(new THREE.UV(g,h));o.push(new THREE.UV(j,k));a.push(o)},init_materials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=
|
|
|
+[THREE.Loader.prototype.createMaterial(b[d],c)]},createMaterial:function(a,b){function c(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var o=new Image;o.onload=function(){if(!c(this.width)||!c(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};o.src=k}var f,g,h;f="MeshLambertMaterial";
|
|
|
+g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.mapDiffuse&&b){h=document.createElement("canvas");g.map=new THREE.Texture(h);d(g.map,b+"/"+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&&b){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);
|
|
|
+d(g.lightMap,b+"/"+a.mapLightmap)}return new THREE[f](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|