|
@@ -12,21 +12,21 @@ this.length();b>0?this.multiplyScalar(1/b):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(b,d,c,f){this.set(b||0,d||0,c||0,f||1)};
|
|
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(b,d,c,f){this.set(b||0,d||0,c||0,f||1)};
|
|
THREE.Vector4.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
|
|
THREE.Vector4.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
|
|
b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
|
|
b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
|
|
-THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b<d;b++){c=f[b];c instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(c)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function d(H,B,U,D){D=D.clone().subSelf(B);U=U.clone().subSelf(B);var R=H.clone().subSelf(B);H=D.dot(D);B=D.dot(U);D=D.dot(R);var L=U.dot(U);U=U.dot(R);R=1/(H*L-B*B);L=(L*D-B*U)*R;H=(H*U-B*D)*R;return L>0&&H>0&&L+H<1}var c,f,g,h,j,k,m,o,t,p,
|
|
|
|
-y,u=b.geometry,A=u.vertices,I=[];c=0;for(f=u.faces.length;c<f;c++){g=u.faces[c];p=this.origin.clone();y=this.direction.clone();m=b.matrixWorld;h=m.multiplyVector3(A[g.a].position.clone());j=m.multiplyVector3(A[g.b].position.clone());k=m.multiplyVector3(A[g.c].position.clone());m=g instanceof THREE.Face4?m.multiplyVector3(A[g.d].position.clone()):null;o=b.matrixRotationWorld.multiplyVector3(g.normal.clone());t=y.dot(o);if(b.doubleSided||(b.flipSided?t>0:t<0)){o=o.dot((new THREE.Vector3).sub(h,p))/
|
|
|
|
-t;p=p.addSelf(y.multiplyScalar(o));if(g instanceof THREE.Face3){if(d(p,h,j,k)){g={distance:this.origin.distanceTo(p),point:p,face:g,object:b};I.push(g)}}else if(g instanceof THREE.Face4&&(d(p,h,j,m)||d(p,j,k,m))){g={distance:this.origin.distanceTo(p),point:p,face:g,object:b};I.push(g)}}}return I}};
|
|
|
|
|
|
+THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b<d;b++){c=f[b];c instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(c)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function d(G,B,R,E){E=E.clone().subSelf(B);R=R.clone().subSelf(B);var P=G.clone().subSelf(B);G=E.dot(E);B=E.dot(R);E=E.dot(P);var L=R.dot(R);R=R.dot(P);P=1/(G*L-B*B);L=(L*E-B*R)*P;G=(G*R-B*E)*P;return L>0&&G>0&&L+G<1}var c,f,g,h,j,k,m,o,t,p,
|
|
|
|
+y,u=b.geometry,z=u.vertices,H=[];c=0;for(f=u.faces.length;c<f;c++){g=u.faces[c];p=this.origin.clone();y=this.direction.clone();m=b.matrixWorld;h=m.multiplyVector3(z[g.a].position.clone());j=m.multiplyVector3(z[g.b].position.clone());k=m.multiplyVector3(z[g.c].position.clone());m=g instanceof THREE.Face4?m.multiplyVector3(z[g.d].position.clone()):null;o=b.matrixRotationWorld.multiplyVector3(g.normal.clone());t=y.dot(o);if(b.doubleSided||(b.flipSided?t>0:t<0)){o=o.dot((new THREE.Vector3).sub(h,p))/
|
|
|
|
+t;p=p.addSelf(y.multiplyScalar(o));if(g instanceof THREE.Face3){if(d(p,h,j,k)){g={distance:this.origin.distanceTo(p),point:p,face:g,object:b};H.push(g)}}else if(g instanceof THREE.Face4&&(d(p,h,j,m)||d(p,j,k,m))){g={distance:this.origin.distanceTo(p),point:p,face:g,object:b};H.push(g)}}}return H}};
|
|
THREE.Rectangle=function(){function b(){h=f-d;j=g-c}var d,c,f,g,h,j,k=!0;this.getX=function(){return d};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(m,o,t,p){k=!1;d=m;c=o;f=t;g=p;b()};this.addPoint=function(m,o){if(k){k=!1;d=m;c=o;f=m;g=o}else{d=d<m?d:m;c=c<o?c:o;f=f>m?f:m;g=g>o?g:o}b()};
|
|
THREE.Rectangle=function(){function b(){h=f-d;j=g-c}var d,c,f,g,h,j,k=!0;this.getX=function(){return d};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(m,o,t,p){k=!1;d=m;c=o;f=t;g=p;b()};this.addPoint=function(m,o){if(k){k=!1;d=m;c=o;f=m;g=o}else{d=d<m?d:m;c=c<o?c:o;f=f>m?f:m;g=g>o?g:o}b()};
|
|
this.add3Points=function(m,o,t,p,y,u){if(k){k=!1;d=m<t?m<y?m:y:t<y?t:y;c=o<p?o<u?o:u:p<u?p:u;f=m>t?m>y?m:y:t>y?t:y;g=o>p?o>u?o:u:p>u?p:u}else{d=m<t?m<y?m<d?m:d:y<d?y:d:t<y?t<d?t:d:y<d?y:d;c=o<p?o<u?o<c?o:c:u<c?u:c:p<u?p<c?p:c:u<c?u:c;f=m>t?m>y?m>f?m:f:y>f?y:f:t>y?t>f?t:f:y>f?y:f;g=o>p?o>u?o>g?o:g:u>g?u:g:p>u?p>g?p:g:u>g?u:g}b()};this.addRectangle=function(m){if(k){k=!1;d=m.getLeft();c=m.getTop();f=m.getRight();g=m.getBottom()}else{d=d<m.getLeft()?d:m.getLeft();c=c<m.getTop()?c:m.getTop();f=f>m.getRight()?
|
|
this.add3Points=function(m,o,t,p,y,u){if(k){k=!1;d=m<t?m<y?m:y:t<y?t:y;c=o<p?o<u?o:u:p<u?p:u;f=m>t?m>y?m:y:t>y?t:y;g=o>p?o>u?o:u:p>u?p:u}else{d=m<t?m<y?m<d?m:d:y<d?y:d:t<y?t<d?t:d:y<d?y:d;c=o<p?o<u?o<c?o:c:u<c?u:c:p<u?p<c?p:c:u<c?u:c;f=m>t?m>y?m>f?m:f:y>f?y:f:t>y?t>f?t:f:y>f?y:f;g=o>p?o>u?o>g?o:g:u>g?u:g:p>u?p>g?p:g:u>g?u:g}b()};this.addRectangle=function(m){if(k){k=!1;d=m.getLeft();c=m.getTop();f=m.getRight();g=m.getBottom()}else{d=d<m.getLeft()?d:m.getLeft();c=c<m.getTop()?c:m.getTop();f=f>m.getRight()?
|
|
f:m.getRight();g=g>m.getBottom()?g:m.getBottom()}b()};this.inflate=function(m){d-=m;c-=m;f+=m;g+=m;b()};this.minSelf=function(m){d=d>m.getLeft()?d:m.getLeft();c=c>m.getTop()?c:m.getTop();f=f<m.getRight()?f:m.getRight();g=g<m.getBottom()?g:m.getBottom();b()};this.instersects=function(m){return Math.min(f,m.getRight())-Math.max(d,m.getLeft())>=0&&Math.min(g,m.getBottom())-Math.max(c,m.getTop())>=0};this.empty=function(){k=!0;g=f=c=d=0;b()};this.isEmpty=function(){return k}};
|
|
f:m.getRight();g=g>m.getBottom()?g:m.getBottom()}b()};this.inflate=function(m){d-=m;c-=m;f+=m;g+=m;b()};this.minSelf=function(m){d=d>m.getLeft()?d:m.getLeft();c=c>m.getTop()?c:m.getTop();f=f<m.getRight()?f:m.getRight();g=g<m.getBottom()?g:m.getBottom();b()};this.instersects=function(m){return Math.min(f,m.getRight())-Math.max(d,m.getLeft())>=0&&Math.min(g,m.getBottom())-Math.max(c,m.getTop())>=0};this.empty=function(){k=!0;g=f=c=d=0;b()};this.isEmpty=function(){return k}};
|
|
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};
|
|
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};
|
|
-THREE.Matrix4=function(b,d,c,f,g,h,j,k,m,o,t,p,y,u,A,I){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,m||0,o||0,t||1,p||0,y||0,u||0,A||0,I||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,m,o,t,p,y,u,A,I){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=o;this.n33=t;this.n34=p;this.n41=y;this.n42=u;this.n43=A;this.n44=I;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,c){var f=THREE.Matrix4.__v1,
|
|
|
|
|
|
+THREE.Matrix4=function(b,d,c,f,g,h,j,k,m,o,t,p,y,u,z,H){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,m||0,o||0,t||1,p||0,y||0,u||0,z||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,m,o,t,p,y,u,z,H){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=o;this.n33=t;this.n34=p;this.n41=y;this.n42=u;this.n43=z;this.n44=H;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,c){var f=THREE.Matrix4.__v1,
|
|
g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23*
|
|
g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23*
|
|
f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize();
|
|
f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize();
|
|
-return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,t=b.n31,p=b.n32,y=b.n33,u=b.n34,A=b.n41,I=b.n42,H=b.n43,B=b.n44,U=d.n11,D=d.n12,R=d.n13,L=d.n14,Q=d.n21,qa=d.n22,
|
|
|
|
-la=d.n23,ra=d.n24,ga=d.n31,ea=d.n32,e=d.n33,oa=d.n34;this.n11=c*U+f*Q+g*ga;this.n12=c*D+f*qa+g*ea;this.n13=c*R+f*la+g*e;this.n14=c*L+f*ra+g*oa+h;this.n21=j*U+k*Q+m*ga;this.n22=j*D+k*qa+m*ea;this.n23=j*R+k*la+m*e;this.n24=j*L+k*ra+m*oa+o;this.n31=t*U+p*Q+y*ga;this.n32=t*D+p*qa+y*ea;this.n33=t*R+p*la+y*e;this.n34=t*L+p*ra+y*oa+u;this.n41=A*U+I*Q+H*ga;this.n42=A*D+I*qa+H*ea;this.n43=A*R+I*la+H*e;this.n44=A*L+I*ra+H*oa+B;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]=
|
|
|
|
|
|
+return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,t=b.n31,p=b.n32,y=b.n33,u=b.n34,z=b.n41,H=b.n42,G=b.n43,B=b.n44,R=d.n11,E=d.n12,P=d.n13,L=d.n14,O=d.n21,sa=d.n22,
|
|
|
|
+oa=d.n23,ta=d.n24,ha=d.n31,fa=d.n32,e=d.n33,qa=d.n34;this.n11=c*R+f*O+g*ha;this.n12=c*E+f*sa+g*fa;this.n13=c*P+f*oa+g*e;this.n14=c*L+f*ta+g*qa+h;this.n21=j*R+k*O+m*ha;this.n22=j*E+k*sa+m*fa;this.n23=j*P+k*oa+m*e;this.n24=j*L+k*ta+m*qa+o;this.n31=t*R+p*O+y*ha;this.n32=t*E+p*sa+y*fa;this.n33=t*P+p*oa+y*e;this.n34=t*L+p*ta+y*qa+u;this.n41=z*R+H*O+G*ha;this.n42=z*E+H*sa+G*fa;this.n43=z*P+H*oa+G*e;this.n44=z*L+H*ta+G*qa+B;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);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(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
|
|
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(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
|
|
-b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,t=this.n33,p=this.n34,y=this.n41,u=this.n42,A=this.n43,I=this.n44;return f*j*o*y-c*k*o*y-f*h*t*y+d*k*t*y+c*h*p*y-d*j*p*y-f*j*m*u+c*k*m*u+f*g*t*u-b*k*t*u-c*g*p*u+b*j*p*u+f*h*m*A-d*k*m*A-f*g*o*A+b*k*o*A+d*g*p*A-b*h*p*A-c*h*m*I+d*j*m*I+c*g*o*I-b*j*o*I-d*g*t*I+b*h*t*I},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
|
|
|
|
|
|
+b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,t=this.n33,p=this.n34,y=this.n41,u=this.n42,z=this.n43,H=this.n44;return f*j*o*y-c*k*o*y-f*h*t*y+d*k*t*y+c*h*p*y-d*j*p*y-f*j*m*u+c*k*m*u+f*g*t*u-b*k*t*u-c*g*p*u+b*j*p*u+f*h*m*z-d*k*m*z-f*g*o*z+b*k*o*z+d*g*p*z-b*h*p*z-c*h*m*H+d*j*m*H+c*g*o*H-b*j*o*H-d*g*t*H+b*h*t*H},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
|
|
this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
|
|
this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
|
|
this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;
|
|
this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;
|
|
b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,c){this.set(1,0,0,b,0,1,0,d,0,0,1,c,0,0,
|
|
b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,c){this.set(1,0,0,b,0,1,0,d,0,0,1,c,0,0,
|
|
@@ -35,8 +35,8 @@ b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=t
|
|
new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,c=b.y,f=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=b*c,k=d*c;this.n11=g*h;this.n12=-g*f;this.n13=c;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-d*g;this.n31=-j*h+d*f;this.n32=j*f+
|
|
new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,c=b.y,f=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=b*c,k=d*c;this.n11=g*h;this.n12=-g*f;this.n13=c;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-d*g;this.n31=-j*h+d*f;this.n32=j*f+
|
|
d*h;this.n33=b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,c=b.y,f=b.z,g=b.w,h=d+d,j=c+c,k=f+f;b=d*h;var m=d*j;d*=k;var o=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(o+f);this.n12=m-g;this.n13=d+j;this.n21=m+g;this.n22=1-(b+f);this.n23=c-h;this.n31=d-j;this.n32=c+h;this.n33=1-(b+o);return this},scale:function(b){var d=b.x,c=b.y;b=b.z;this.n11*=d;this.n12*=c;this.n13*=b;this.n21*=d;this.n22*=c;this.n23*=b;this.n31*=d;this.n32*=c;this.n33*=b;this.n41*=d;this.n42*=c;this.n43*=b;return this},
|
|
d*h;this.n33=b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,c=b.y,f=b.z,g=b.w,h=d+d,j=c+c,k=f+f;b=d*h;var m=d*j;d*=k;var o=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(o+f);this.n12=m-g;this.n13=d+j;this.n21=m+g;this.n22=1-(b+f);this.n23=c-h;this.n31=d-j;this.n32=c+h;this.n33=1-(b+o);return this},scale:function(b){var d=b.x,c=b.y;b=b.z;this.n11*=d;this.n12*=c;this.n13*=b;this.n21*=d;this.n22*=c;this.n23*=b;this.n31*=d;this.n32*=c;this.n33*=b;this.n41*=d;this.n42*=c;this.n43*=b;return this},
|
|
extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var c=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var c=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
-THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,t=b.n31,p=b.n32,y=b.n33,u=b.n34,A=b.n41,I=b.n42,H=b.n43,B=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=m*u*I-o*y*I+o*p*H-k*u*H-m*p*B+k*y*B;d.n12=h*y*I-g*u*I-h*p*H+f*u*H+g*p*B-f*y*B;d.n13=g*o*I-h*m*I+h*k*H-f*o*H-g*k*B+f*m*B;d.n14=h*m*p-g*o*p-h*k*y+f*o*y+g*k*u-f*m*u;d.n21=o*y*A-m*u*A-o*t*H+j*u*H+m*t*B-j*y*B;d.n22=g*u*A-h*y*A+h*t*H-c*u*H-g*t*B+c*y*B;d.n23=h*m*A-g*o*A-h*j*H+c*o*H+g*j*B-c*m*B;
|
|
|
|
-d.n24=g*o*t-h*m*t+h*j*y-c*o*y-g*j*u+c*m*u;d.n31=k*u*A-o*p*A+o*t*I-j*u*I-k*t*B+j*p*B;d.n32=h*p*A-f*u*A-h*t*I+c*u*I+f*t*B-c*p*B;d.n33=g*o*A-h*k*A+h*j*I-c*o*I-f*j*B+c*k*B;d.n34=h*k*t-f*o*t-h*j*p+c*o*p+f*j*u-c*k*u;d.n41=m*p*A-k*y*A-m*t*I+j*y*I+k*t*H-j*p*H;d.n42=f*y*A-g*p*A+g*t*I-c*y*I-f*t*H+c*p*H;d.n43=g*k*A-f*m*A-g*j*I+c*m*I+f*j*H-c*k*H;d.n44=f*m*t-g*k*t+g*j*p-c*m*p-f*j*y+c*k*y;d.multiplyScalar(1/b.determinant());return d};
|
|
|
|
|
|
+THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,t=b.n31,p=b.n32,y=b.n33,u=b.n34,z=b.n41,H=b.n42,G=b.n43,B=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=m*u*H-o*y*H+o*p*G-k*u*G-m*p*B+k*y*B;d.n12=h*y*H-g*u*H-h*p*G+f*u*G+g*p*B-f*y*B;d.n13=g*o*H-h*m*H+h*k*G-f*o*G-g*k*B+f*m*B;d.n14=h*m*p-g*o*p-h*k*y+f*o*y+g*k*u-f*m*u;d.n21=o*y*z-m*u*z-o*t*G+j*u*G+m*t*B-j*y*B;d.n22=g*u*z-h*y*z+h*t*G-c*u*G-g*t*B+c*y*B;d.n23=h*m*z-g*o*z-h*j*G+c*o*G+g*j*B-c*m*B;
|
|
|
|
+d.n24=g*o*t-h*m*t+h*j*y-c*o*y-g*j*u+c*m*u;d.n31=k*u*z-o*p*z+o*t*H-j*u*H-k*t*B+j*p*B;d.n32=h*p*z-f*u*z-h*t*H+c*u*H+f*t*B-c*p*B;d.n33=g*o*z-h*k*z+h*j*H-c*o*H-f*j*B+c*k*B;d.n34=h*k*t-f*o*t-h*j*p+c*o*p+f*j*u-c*k*u;d.n41=m*p*z-k*y*z-m*t*H+j*y*H+k*t*G-j*p*G;d.n42=f*y*z-g*p*z+g*t*H-c*y*H-f*t*G+c*p*G;d.n43=g*k*z-f*m*z-g*j*H+c*m*H+f*j*G-c*k*G;d.n44=f*m*t-g*k*t+g*j*p-c*m*p-f*j*y+c*k*y;d.multiplyScalar(1/b.determinant());return d};
|
|
THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,t=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*o;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*m;c[6]=b*o;c[7]=b*t;c[8]=b*p;return d};
|
|
THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,t=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*o;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*m;c[6]=b*o;c[7]=b*t;c[8]=b*p;return d};
|
|
THREE.Matrix4.makeFrustum=function(b,d,c,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,c,f){var g;b=c*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,c,f)};
|
|
THREE.Matrix4.makeFrustum=function(b,d,c,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,c,f){var g;b=c*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,c,f)};
|
|
THREE.Matrix4.makeOrtho=function(b,d,c,f,g,h){var j,k,m,o;j=new THREE.Matrix4;k=d-b;m=c-f;o=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((d+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((c+f)/m);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((h+g)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
THREE.Matrix4.makeOrtho=function(b,d,c,f,g,h){var j,k,m,o;j=new THREE.Matrix4;k=d-b;m=c-f;o=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((d+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((c+f)/m);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((h+g)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
@@ -58,17 +58,17 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,c;b=0;for(d=this.f
|
|
c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,c,f,g,h,j,k=new THREE.Vector3,m=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);d=0;for(c=h.vertexNormals.length;d<c;d++)k.addSelf(h.vertexNormals[d]);k.divideScalar(3)}else{d=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,c.position);m.sub(d.position,c.position);k.crossSelf(m)}k.isZero()||
|
|
c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,c,f,g,h,j,k=new THREE.Vector3,m=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);d=0;for(c=h.vertexNormals.length;d<c;d++)k.addSelf(h.vertexNormals[d]);k.divideScalar(3)}else{d=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,c.position);m.sub(d.position,c.position);k.crossSelf(m)}k.isZero()||
|
|
k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,d,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];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{f=
|
|
k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,d,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];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{f=
|
|
this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(f[c.a]);
|
|
this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(f[c.a]);
|
|
-c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(fa,wa,ua,pa,ca,ka,ma){k=fa.vertices[wa].position;m=fa.vertices[ua].position;o=fa.vertices[pa].position;t=j[ca];p=j[ka];y=j[ma];u=m.x-k.x;A=o.x-k.x;I=m.y-k.y;H=o.y-k.y;B=m.z-k.z;U=o.z-k.z;D=p.u-t.u;R=y.u-t.u;L=p.v-t.v;Q=y.v-t.v;qa=1/(D*
|
|
|
|
-Q-R*L);ea.set((Q*u-L*A)*qa,(Q*I-L*H)*qa,(Q*B-L*U)*qa);e.set((D*A-R*u)*qa,(D*H-R*I)*qa,(D*U-R*B)*qa);ra[wa].addSelf(ea);ra[ua].addSelf(ea);ra[pa].addSelf(ea);ga[wa].addSelf(e);ga[ua].addSelf(e);ga[pa].addSelf(e)}var d,c,f,g,h,j,k,m,o,t,p,y,u,A,I,H,B,U,D,R,L,Q,qa,la,ra=[],ga=[],ea=new THREE.Vector3,e=new THREE.Vector3,oa=new THREE.Vector3,Da=new THREE.Vector3,Aa=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){ra[d]=new THREE.Vector3;ga[d]=new THREE.Vector3}d=0;for(c=this.faces.length;d<c;d++){h=
|
|
|
|
-this.faces[d];j=this.faceVertexUvs[0][d];if(h instanceof THREE.Face3)b(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){b(this,h.a,h.b,h.c,0,1,2);b(this,h.a,h.b,h.d,0,1,3)}}var da=["a","b","c","d"];d=0;for(c=this.faces.length;d<c;d++){h=this.faces[d];for(f=0;f<h.vertexNormals.length;f++){Aa.copy(h.vertexNormals[f]);g=h[da[f]];la=ra[g];oa.copy(la);oa.subSelf(Aa.multiplyScalar(Aa.dot(la))).normalize();Da.cross(h.vertexNormals[f],la);g=Da.dot(ga[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(oa.x,
|
|
|
|
-oa.y,oa.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,c=this.vertices.length;d<c;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
|
|
|
|
|
|
+c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(ga,xa,va,ra,ca,ka,pa){k=ga.vertices[xa].position;m=ga.vertices[va].position;o=ga.vertices[ra].position;t=j[ca];p=j[ka];y=j[pa];u=m.x-k.x;z=o.x-k.x;H=m.y-k.y;G=o.y-k.y;B=m.z-k.z;R=o.z-k.z;E=p.u-t.u;P=y.u-t.u;L=p.v-t.v;O=y.v-t.v;sa=1/(E*
|
|
|
|
+O-P*L);fa.set((O*u-L*z)*sa,(O*H-L*G)*sa,(O*B-L*R)*sa);e.set((E*z-P*u)*sa,(E*G-P*H)*sa,(E*R-P*B)*sa);ta[xa].addSelf(fa);ta[va].addSelf(fa);ta[ra].addSelf(fa);ha[xa].addSelf(e);ha[va].addSelf(e);ha[ra].addSelf(e)}var d,c,f,g,h,j,k,m,o,t,p,y,u,z,H,G,B,R,E,P,L,O,sa,oa,ta=[],ha=[],fa=new THREE.Vector3,e=new THREE.Vector3,qa=new THREE.Vector3,Ea=new THREE.Vector3,Da=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){ta[d]=new THREE.Vector3;ha[d]=new THREE.Vector3}d=0;for(c=this.faces.length;d<c;d++){h=
|
|
|
|
+this.faces[d];j=this.faceVertexUvs[0][d];if(h instanceof THREE.Face3)b(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){b(this,h.a,h.b,h.c,0,1,2);b(this,h.a,h.b,h.d,0,1,3)}}var ea=["a","b","c","d"];d=0;for(c=this.faces.length;d<c;d++){h=this.faces[d];for(f=0;f<h.vertexNormals.length;f++){Da.copy(h.vertexNormals[f]);g=h[ea[f]];oa=ta[g];qa.copy(oa);qa.subSelf(Da.multiplyScalar(Da.dot(oa))).normalize();Ea.cross(h.vertexNormals[f],oa);g=Ea.dot(ha[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(qa.x,
|
|
|
|
+qa.y,qa.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,c=this.vertices.length;d<c;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
|
|
if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,c=this.vertices.length;d<c;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere=
|
|
if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,c=this.vertices.length;d<c;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere=
|
|
{radius:b}},computeEdgeFaces:function(){function b(m,o){return Math.min(m,o)+"_"+Math.max(m,o)}function d(m,o,t){if(m[o]===undefined){m[o]={set:{},array:[]};m[o].set[t]=1;m[o].array.push(t)}else if(m[o].set[t]===undefined){m[o].set[t]=1;m[o].array.push(t)}}var c,f,g,h,j,k={};c=0;for(f=this.faces.length;c<f;c++){j=this.faces[c];if(j instanceof THREE.Face3){g=b(j.a,j.b);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.a,j.c);d(k,g,c)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);d(k,g,c);g=b(j.a,j.b);d(k,g,c);
|
|
{radius:b}},computeEdgeFaces:function(){function b(m,o){return Math.min(m,o)+"_"+Math.max(m,o)}function d(m,o,t){if(m[o]===undefined){m[o]={set:{},array:[]};m[o].set[t]=1;m[o].array.push(t)}else if(m[o].set[t]===undefined){m[o].set[t]=1;m[o].array.push(t)}}var c,f,g,h,j,k={};c=0;for(f=this.faces.length;c<f;c++){j=this.faces[c];if(j instanceof THREE.Face3){g=b(j.a,j.b);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.a,j.c);d(k,g,c)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);d(k,g,c);g=b(j.a,j.b);d(k,g,c);
|
|
g=b(j.a,j.d);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.c,j.d);d(k,g,c)}}c=0;for(f=this.edges.length;c<f;c++){j=this.edges[c];g=j.vertexIndices[0];h=j.vertexIndices[1];j.faceIndices=k[b(g,h)].array;for(g=0;g<j.faceIndices.length;g++){h=j.faceIndices[g];j.faces.push(this.faces[h])}}}};THREE.GeometryIdCounter=0;
|
|
g=b(j.a,j.d);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.c,j.d);d(k,g,c)}}c=0;for(f=this.edges.length;c<f;c++){j=this.edges[c];g=j.vertexIndices[0];h=j.vertexIndices[1];j.faceIndices=k[b(g,h)].array;for(g=0;g<j.faceIndices.length;g++){h=j.faceIndices[g];j.faces.push(this.faces[h])}}}};THREE.GeometryIdCounter=0;
|
|
-THREE.Spline=function(b){function d(u,A,I,H,B,U,D){u=(I-u)*0.5;H=(H-A)*0.5;return(2*(A-I)+u+H)*D+(-3*(A-I)-2*u-H)*U+u*B+A}this.points=b;var c=[],f={x:0,y:0,z:0},g,h,j,k,m,o,t,p,y;this.initFromArray=function(u){this.points=[];for(var A=0;A<u.length;A++)this.points[A]={x:u[A][0],y:u[A][1],z:u[A][2]}};this.getPoint=function(u){g=(this.points.length-1)*u;h=Math.floor(g);j=g-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;o=this.points[c[0]];t=this.points[c[1]];
|
|
|
|
-p=this.points[c[2]];y=this.points[c[3]];k=j*j;m=j*k;f.x=d(o.x,t.x,p.x,y.x,j,k,m);f.y=d(o.y,t.y,p.y,y.y,j,k,m);f.z=d(o.z,t.z,p.z,y.z,j,k,m);return f};this.getControlPointsArray=function(){var u,A,I=this.points.length,H=[];for(u=0;u<I;u++){A=this.points[u];H[u]=[A.x,A.y,A.z]}return H};this.getLength=function(u){var A,I,H=A=A=0,B=new THREE.Vector3,U=new THREE.Vector3,D=[],R=0;D[0]=0;u||(u=100);I=this.points.length*u;B.copy(this.points[0]);for(u=1;u<I;u++){A=u/I;position=this.getPoint(A);U.copy(position);
|
|
|
|
-R+=U.distanceTo(B);B.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=H){D[A]=R;H=A}}D[D.length]=R;return{chunks:D,total:R}};this.reparametrizeByArcLength=function(u){var A,I,H,B,U,D,R=[],L=new THREE.Vector3,Q=this.getLength();R.push(L.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){I=Q.chunks[A]-Q.chunks[A-1];D=Math.ceil(u*I/Q.total);B=(A-1)/(this.points.length-1);U=A/(this.points.length-1);for(I=1;I<D-1;I++){H=B+I*(1/D)*(U-B);position=this.getPoint(H);R.push(L.copy(position).clone())}R.push(L.copy(this.points[A]).clone())}this.points=
|
|
|
|
-R}};THREE.Edge=function(b,d,c,f){this.vertices=[b,d];this.vertexIndices=[c,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,c,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=c||0.1;this.far=f||2E3;this.target=g||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.Spline=function(b){function d(u,z,H,G,B,R,E){u=(H-u)*0.5;G=(G-z)*0.5;return(2*(z-H)+u+G)*E+(-3*(z-H)-2*u-G)*R+u*B+z}this.points=b;var c=[],f={x:0,y:0,z:0},g,h,j,k,m,o,t,p,y;this.initFromArray=function(u){this.points=[];for(var z=0;z<u.length;z++)this.points[z]={x:u[z][0],y:u[z][1],z:u[z][2]}};this.getPoint=function(u){g=(this.points.length-1)*u;h=Math.floor(g);j=g-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;o=this.points[c[0]];t=this.points[c[1]];
|
|
|
|
+p=this.points[c[2]];y=this.points[c[3]];k=j*j;m=j*k;f.x=d(o.x,t.x,p.x,y.x,j,k,m);f.y=d(o.y,t.y,p.y,y.y,j,k,m);f.z=d(o.z,t.z,p.z,y.z,j,k,m);return f};this.getControlPointsArray=function(){var u,z,H=this.points.length,G=[];for(u=0;u<H;u++){z=this.points[u];G[u]=[z.x,z.y,z.z]}return G};this.getLength=function(u){var z,H,G=z=z=0,B=new THREE.Vector3,R=new THREE.Vector3,E=[],P=0;E[0]=0;u||(u=100);H=this.points.length*u;B.copy(this.points[0]);for(u=1;u<H;u++){z=u/H;position=this.getPoint(z);R.copy(position);
|
|
|
|
+P+=R.distanceTo(B);B.copy(position);z*=this.points.length-1;z=Math.floor(z);if(z!=G){E[z]=P;G=z}}E[E.length]=P;return{chunks:E,total:P}};this.reparametrizeByArcLength=function(u){var z,H,G,B,R,E,P=[],L=new THREE.Vector3,O=this.getLength();P.push(L.copy(this.points[0]).clone());for(z=1;z<this.points.length;z++){H=O.chunks[z]-O.chunks[z-1];E=Math.ceil(u*H/O.total);B=(z-1)/(this.points.length-1);R=z/(this.points.length-1);for(H=1;H<E-1;H++){G=B+H*(1/E)*(R-B);position=this.getPoint(G);P.push(L.copy(position).clone())}P.push(L.copy(this.points[z]).clone())}this.points=
|
|
|
|
+P}};THREE.Edge=function(b,d,c,f){this.vertices=[b,d];this.vertexIndices=[c,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,c,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=c||0.1;this.far=f||2E3;this.target=g||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(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
THREE.Camera.prototype.update=function(b,d,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);d=!0}else{this.matrixAutoUpdate&&this.updateMatrix();if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
|
|
THREE.Camera.prototype.update=function(b,d,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);d=!0}else{this.matrixAutoUpdate&&this.updateMatrix();if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
|
|
!1;d=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
!1;d=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
@@ -122,12 +122,12 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
|
|
THREE.LOD.prototype.update=function(b,d,c){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}if(this.LODs.length>1){b=c.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible=
|
|
THREE.LOD.prototype.update=function(b,d,c){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}if(this.LODs.length>1){b=c.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible=
|
|
!1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.ShadowVolume=function(b,d){if(b instanceof THREE.Mesh){THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this)}else THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
|
|
!1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.ShadowVolume=function(b,d){if(b instanceof THREE.Mesh){THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this)}else THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
|
|
THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,c,f,g,h,j,k,m,o,t,p,y,u,A=new THREE.Geometry;A.vertices=this.geometry.vertices;f=A.faces=this.geometry.faces;var I=A.egdes=this.geometry.edges,H=A.edgeFaces=[];g=0;var B=[];b=0;for(d=f.length;b<d;b++){c=f[b];B.push(g);g+=c instanceof THREE.Face3?3:4;c.vertexNormals[0]=c.normal;c.vertexNormals[1]=c.normal;c.vertexNormals[2]=c.normal;if(c instanceof THREE.Face4)c.vertexNormals[3]=
|
|
|
|
-c.normal}b=0;for(d=I.length;b<d;b++){k=I[b];c=k.faces[0];f=k.faces[1];g=k.faceIndices[0];h=k.faceIndices[1];j=k.vertexIndices[0];k=k.vertexIndices[1];if(c.a===j){m="a";t=B[g]+0}else if(c.b===j){m="b";t=B[g]+1}else if(c.c===j){m="c";t=B[g]+2}else if(c.d===j){m="d";t=B[g]+3}if(c.a===k){m+="a";p=B[g]+0}else if(c.b===k){m+="b";p=B[g]+1}else if(c.c===k){m+="c";p=B[g]+2}else if(c.d===k){m+="d";p=B[g]+3}if(f.a===j){o="a";y=B[h]+0}else if(f.b===j){o="b";y=B[h]+1}else if(f.c===j){o="c";y=B[h]+2}else if(f.d===
|
|
|
|
-j){o="d";y=B[h]+3}if(f.a===k){o+="a";u=B[h]+0}else if(f.b===k){o+="b";u=B[h]+1}else if(f.c===k){o+="c";u=B[h]+2}else if(f.d===k){o+="d";u=B[h]+3}if(m==="ac"||m==="ad"||m==="ca"||m==="da"){if(t>p){c=t;t=p;p=c}}else if(t<p){c=t;t=p;p=c}if(o==="ac"||o==="ad"||o==="ca"||o==="da"){if(y>u){c=y;y=u;u=c}}else if(y<u){c=y;y=u;u=c}c=new THREE.Face4(t,p,y,u);c.normal.set(1,0,0);H.push(c)}this.geometry=A}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
|
|
|
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,c,f,g,h,j,k,m,o,t,p,y,u,z=new THREE.Geometry;z.vertices=this.geometry.vertices;f=z.faces=this.geometry.faces;var H=z.egdes=this.geometry.edges,G=z.edgeFaces=[];g=0;var B=[];b=0;for(d=f.length;b<d;b++){c=f[b];B.push(g);g+=c instanceof THREE.Face3?3:4;c.vertexNormals[0]=c.normal;c.vertexNormals[1]=c.normal;c.vertexNormals[2]=c.normal;if(c instanceof THREE.Face4)c.vertexNormals[3]=
|
|
|
|
+c.normal}b=0;for(d=H.length;b<d;b++){k=H[b];c=k.faces[0];f=k.faces[1];g=k.faceIndices[0];h=k.faceIndices[1];j=k.vertexIndices[0];k=k.vertexIndices[1];if(c.a===j){m="a";t=B[g]+0}else if(c.b===j){m="b";t=B[g]+1}else if(c.c===j){m="c";t=B[g]+2}else if(c.d===j){m="d";t=B[g]+3}if(c.a===k){m+="a";p=B[g]+0}else if(c.b===k){m+="b";p=B[g]+1}else if(c.c===k){m+="c";p=B[g]+2}else if(c.d===k){m+="d";p=B[g]+3}if(f.a===j){o="a";y=B[h]+0}else if(f.b===j){o="b";y=B[h]+1}else if(f.c===j){o="c";y=B[h]+2}else if(f.d===
|
|
|
|
+j){o="d";y=B[h]+3}if(f.a===k){o+="a";u=B[h]+0}else if(f.b===k){o+="b";u=B[h]+1}else if(f.c===k){o+="c";u=B[h]+2}else if(f.d===k){o+="d";u=B[h]+3}if(m==="ac"||m==="ad"||m==="ca"||m==="da"){if(t>p){c=t;t=p;p=c}}else if(t<p){c=t;t=p;p=c}if(o==="ac"||o==="ad"||o==="ca"||o==="da"){if(y>u){c=y;y=u;u=c}}else if(y<u){c=y;y=u;u=c}c=new THREE.Face4(t,p,y,u);c.normal.set(1,0,0);G.push(c)}this.geometry=z}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
|
|
THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,c=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,m,o,t,p=["a","b","c","d"];for(m=0;m<h;m++){k=d.length;j=g[m];if(j instanceof THREE.Face4){o=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{o=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);c.push(k);
|
|
THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,c=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,m,o,t,p=["a","b","c","d"];for(m=0;m<h;m++){k=d.length;j=g[m];if(j instanceof THREE.Face4){o=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{o=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);c.push(k);
|
|
for(k=0;k<o;k++){t=b[j[p[k]]];d.push(new THREE.Vertex(t.position.clone()))}}for(h=0;h<g.length-1;h++){b=c[h];for(j=h+1;j<g.length;j++){k=c[j];k=this.facesShareEdge(d,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
|
|
for(k=0;k<o;k++){t=b[j[p[k]]];d.push(new THREE.Vertex(t.position.clone()))}}for(h=0;h<g.length-1;h++){b=c[h];for(j=h+1;j<g.length;j++){k=c[j];k=this.facesShareEdge(d,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
|
|
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,c){var f,g,h,j,k,m,o,t,p,y,u,A,I,H=0,B=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=c instanceof THREE.Face4?4:3;for(A=0;A<f;A++){h=d[B[A]];k=b[h];for(I=0;I<g;I++){j=c[B[I]];m=b[j];if(Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4){H++;if(H===1){o=k;t=m;p=h;y=j;u=B[A]}if(H===2){u+=B[A];return u==="ad"||u==="ac"?{faces:[d,c],vertices:[o,t,m,k],indices:[p,
|
|
|
|
|
|
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,c){var f,g,h,j,k,m,o,t,p,y,u,z,H,G=0,B=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=c instanceof THREE.Face4?4:3;for(z=0;z<f;z++){h=d[B[z]];k=b[h];for(H=0;H<g;H++){j=c[B[H]];m=b[j];if(Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4){G++;if(G===1){o=k;t=m;p=h;y=j;u=B[z]}if(G===2){u+=B[z];return u==="ad"||u==="ac"?{faces:[d,c],vertices:[o,t,m,k],indices:[p,
|
|
y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,c],vertices:[o,k,m,t],indices:[p,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};
|
|
y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,c],vertices:[o,k,m,t],indices:[p,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};
|
|
THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==undefined){this.material=b.material;this.map=undefined;this.blending=material.blending}else if(b.map!==undefined){this.map=b.map instanceof THREE.Texture?b.map:ImageUtils.loadTexture(b.map);this.material=undefined;this.blending=b.blending!==undefined?b.blending:THREE.NormalBlending}this.useScreenCoordinates=b.useScreenCoordinates!==undefined?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==undefined?b.mergeWith3D:!this.useScreenCoordinates;
|
|
THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==undefined){this.material=b.material;this.map=undefined;this.blending=material.blending}else if(b.map!==undefined){this.map=b.map instanceof THREE.Texture?b.map:ImageUtils.loadTexture(b.map);this.material=undefined;this.blending=b.blending!==undefined?b.blending:THREE.NormalBlending}this.useScreenCoordinates=b.useScreenCoordinates!==undefined?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==undefined?b.mergeWith3D:!this.useScreenCoordinates;
|
|
this.affectedByDistance=b.affectedByDistance!==undefined?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
|
|
this.affectedByDistance=b.affectedByDistance!==undefined?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
|
|
@@ -137,58 +137,58 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
|
|
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
|
|
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
|
|
THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
|
|
THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
|
|
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(b,d,c){this.color=new THREE.Color(b);this.near=d||1;this.far=c||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
|
|
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(b,d,c){this.color=new THREE.Color(b);this.near=d||1;this.far=c||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
|
|
-THREE.Projector=function(){function b(){var ea=m[k]=m[k]||new THREE.RenderableVertex;k++;return ea}function d(ea,e){return e.z-ea.z}function c(ea,e){var oa=0,Da=1,Aa=ea.z+ea.w,da=e.z+e.w,fa=-ea.z+ea.w,wa=-e.z+e.w;if(Aa>=0&&da>=0&&fa>=0&&wa>=0)return!0;else if(Aa<0&&da<0||fa<0&&wa<0)return!1;else{if(Aa<0)oa=Math.max(oa,Aa/(Aa-da));else da<0&&(Da=Math.min(Da,Aa/(Aa-da)));if(fa<0)oa=Math.max(oa,fa/(fa-wa));else wa<0&&(Da=Math.min(Da,fa/(fa-wa)));if(Da<oa)return!1;else{ea.lerpSelf(e,oa);e.lerpSelf(ea,
|
|
|
|
-1-Da);return!0}}}var f,g,h=[],j,k,m=[],o,t,p=[],y,u=[],A,I,H=[],B,U,D=[],R=new THREE.Vector4,L=new THREE.Vector4,Q=new THREE.Matrix4,qa=new THREE.Matrix4,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ra=new THREE.Vector4,ga=new THREE.Vector4;this.projectVector=function(ea,e){Q.multiply(e.projectionMatrix,e.matrixWorldInverse);Q.multiplyVector3(ea);return ea};this.unprojectVector=function(ea,e){Q.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));
|
|
|
|
-Q.multiplyVector3(ea);return ea};this.projectObjects=function(ea,e,oa){e=[];var Da,Aa,da;g=0;Aa=ea.objects;ea=0;for(Da=Aa.length;ea<Da;ea++){da=Aa[ea];var fa;if(!(fa=!da.visible))if(fa=da instanceof THREE.Mesh){a:{fa=void 0;for(var wa=da.matrixWorld,ua=-da.geometry.boundingSphere.radius*Math.max(da.scale.x,Math.max(da.scale.y,da.scale.z)),pa=0;pa<6;pa++){fa=la[pa].x*wa.n14+la[pa].y*wa.n24+la[pa].z*wa.n34+la[pa].w;if(fa<=ua){fa=!1;break a}}fa=!0}fa=!fa}if(!fa){fa=h[g]=h[g]||new THREE.RenderableObject;
|
|
|
|
-g++;f=fa;R.copy(da.position);Q.multiplyVector3(R);f.object=da;f.z=R.z;e.push(f)}}oa&&e.sort(d);return e};this.projectScene=function(ea,e,oa){var Da=[],Aa=e.near,da=e.far,fa,wa,ua,pa,ca,ka,ma,Fa,ja,ha,Ja,Xa,Za,Ta,S,T,O;U=I=y=t=0;e.matrixAutoUpdate&&e.update(undefined,!0);ea.update(undefined,!1,e);Q.multiply(e.projectionMatrix,e.matrixWorldInverse);la[0].set(Q.n41-Q.n11,Q.n42-Q.n12,Q.n43-Q.n13,Q.n44-Q.n14);la[1].set(Q.n41+Q.n11,Q.n42+Q.n12,Q.n43+Q.n13,Q.n44+Q.n14);la[2].set(Q.n41+Q.n21,Q.n42+Q.n22,
|
|
|
|
-Q.n43+Q.n23,Q.n44+Q.n24);la[3].set(Q.n41-Q.n21,Q.n42-Q.n22,Q.n43-Q.n23,Q.n44-Q.n24);la[4].set(Q.n41-Q.n31,Q.n42-Q.n32,Q.n43-Q.n33,Q.n44-Q.n34);la[5].set(Q.n41+Q.n31,Q.n42+Q.n32,Q.n43+Q.n33,Q.n44+Q.n34);for(fa=0;fa<6;fa++){ja=la[fa];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(ea,e,!0);ea=0;for(fa=ja.length;ea<fa;ea++){ha=ja[ea].object;if(ha.visible){Ja=ha.matrixWorld;Xa=ha.matrixRotationWorld;Za=ha.materials;Ta=ha.overdraw;k=0;if(ha instanceof THREE.Mesh){S=ha.geometry;
|
|
|
|
-pa=S.vertices;T=S.faces;S=S.faceVertexUvs;wa=0;for(ua=pa.length;wa<ua;wa++){j=b();j.positionWorld.copy(pa[wa].position);Ja.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);Q.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Aa&&j.positionScreen.z<da}pa=0;for(wa=T.length;pa<wa;pa++){ua=T[pa];if(ua instanceof THREE.Face3){ca=m[ua.a];ka=m[ua.b];ma=m[ua.c];if(ca.visible&&ka.visible&&ma.visible&&
|
|
|
|
-(ha.doubleSided||ha.flipSided!=(ma.positionScreen.x-ca.positionScreen.x)*(ka.positionScreen.y-ca.positionScreen.y)-(ma.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0)){Fa=p[t]=p[t]||new THREE.RenderableFace3;t++;o=Fa;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma)}else continue}else if(ua instanceof THREE.Face4){ca=m[ua.a];ka=m[ua.b];ma=m[ua.c];Fa=m[ua.d];if(ca.visible&&ka.visible&&ma.visible&&Fa.visible&&(ha.doubleSided||ha.flipSided!=((Fa.positionScreen.x-ca.positionScreen.x)*
|
|
|
|
-(ka.positionScreen.y-ca.positionScreen.y)-(Fa.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0||(ka.positionScreen.x-ma.positionScreen.x)*(Fa.positionScreen.y-ma.positionScreen.y)-(ka.positionScreen.y-ma.positionScreen.y)*(Fa.positionScreen.x-ma.positionScreen.x)<0))){O=u[y]=u[y]||new THREE.RenderableFace4;y++;o=O;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma);o.v4.copy(Fa)}else continue}o.normalWorld.copy(ua.normal);Xa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(ua.centroid);
|
|
|
|
-Ja.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);Q.multiplyVector3(o.centroidScreen);ma=ua.vertexNormals;ca=0;for(ka=ma.length;ca<ka;ca++){Fa=o.vertexNormalsWorld[ca];Fa.copy(ma[ca]);Xa.multiplyVector3(Fa)}ca=0;for(ka=S.length;ca<ka;ca++)if(O=S[ca][pa]){ma=0;for(Fa=O.length;ma<Fa;ma++)o.uvs[ca][ma]=O[ma]}o.meshMaterials=Za;o.faceMaterials=ua.materials;o.overdraw=Ta;o.z=o.centroidScreen.z;Da.push(o)}}else if(ha instanceof THREE.Line){qa.multiply(Q,Ja);pa=ha.geometry.vertices;
|
|
|
|
-ca=b();ca.positionScreen.copy(pa[0].position);qa.multiplyVector4(ca.positionScreen);wa=1;for(ua=pa.length;wa<ua;wa++){ca=b();ca.positionScreen.copy(pa[wa].position);qa.multiplyVector4(ca.positionScreen);ka=m[k-2];ra.copy(ca.positionScreen);ga.copy(ka.positionScreen);if(c(ra,ga)){ra.multiplyScalar(1/ra.w);ga.multiplyScalar(1/ga.w);Ja=H[I]=H[I]||new THREE.RenderableLine;I++;A=Ja;A.v1.positionScreen.copy(ra);A.v2.positionScreen.copy(ga);A.z=Math.max(ra.z,ga.z);A.materials=ha.materials;Da.push(A)}}}else if(ha instanceof
|
|
|
|
-THREE.Particle){L.set(ha.matrixWorld.n14,ha.matrixWorld.n24,ha.matrixWorld.n34,1);Q.multiplyVector4(L);L.z/=L.w;if(L.z>0&&L.z<1){Ja=D[U]=D[U]||new THREE.RenderableParticle;U++;B=Ja;B.x=L.x/L.w;B.y=L.y/L.w;B.z=L.z;B.rotation=ha.rotation.z;B.scale.x=ha.scale.x*Math.abs(B.x-(L.x+e.projectionMatrix.n11)/(L.w+e.projectionMatrix.n14));B.scale.y=ha.scale.y*Math.abs(B.y-(L.y+e.projectionMatrix.n22)/(L.w+e.projectionMatrix.n24));B.materials=ha.materials;Da.push(B)}}}}oa&&Da.sort(d);return Da}};
|
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var m,o,t,p,y,u,A,I;b=d.projectScene(j,k);m=0;for(o=b.length;m<o;m++){y=b[m];if(y instanceof THREE.RenderableParticle){A=y.x*g+g;I=y.y*h+h;t=0;for(p=y.material.length;t<p;t++){u=y.material[t];if(u instanceof THREE.ParticleDOMMaterial){u=u.domElement;u.style.left=A+"px";u.style.top=I+"px"}}}}}};
|
|
|
|
-THREE.CanvasRenderer=function(){function b(Ga){if(A!=Ga)p.globalAlpha=A=Ga}function d(Ga){if(I!=Ga){switch(Ga){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}I=Ga}}function c(Ga){if(H!=Ga)p.strokeStyle=H=Ga}var f=this,g=null,h=new THREE.Projector,j=document.createElement("canvas"),k,m,o,t,p=j.getContext("2d"),y=new THREE.Color(0),u=0,A=
|
|
|
|
-1,I=0,H=null,B=null,U=null,D=null,R=null,L,Q,qa,la,ra=new THREE.RenderableVertex,ga=new THREE.RenderableVertex,ea,e,oa,Da,Aa,da,fa,wa,ua,pa,ca,ka,ma=new THREE.Color,Fa=new THREE.Color,ja=new THREE.Color,ha=new THREE.Color,Ja=new THREE.Color,Xa,Za,Ta,S,T,O,Ba,La,n,C,x=new THREE.Rectangle,v=new THREE.Rectangle,z=new THREE.Rectangle,P=!1,K=new THREE.Color,F=new THREE.Color,V=new THREE.Color,G=new THREE.Color,J=new THREE.Vector3,M,Z,Y,sa,Ka,Ca,Ha=16;M=document.createElement("canvas");M.width=M.height=
|
|
|
|
-2;Z=M.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Y=Z.getImageData(0,0,2,2);sa=Y.data;Ka=document.createElement("canvas");Ka.width=Ka.height=Ha;Ca=Ka.getContext("2d");Ca.translate(-Ha/2,-Ha/2);Ca.scale(Ha,Ha);Ha--;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setSize=function(Ga,xa){k=Ga;m=xa;o=k/2;t=m/2;j.width=k;j.height=m;x.set(-o,-t,o,t);A=1;I=0;R=D=U=B=H=null};this.setClearColor=function(Ga,xa){y=Ga;u=xa};
|
|
|
|
-this.setClearColorHex=function(Ga,xa){y.setHex(Ga);u=xa};this.clear=function(){p.setTransform(1,0,0,-1,o,t);if(!v.isEmpty()){v.inflate(1);v.minSelf(x);if(y.hex==0&&u==0)p.clearRect(v.getX(),v.getY(),v.getWidth(),v.getHeight());else{d(THREE.NormalBlending);b(1);p.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+u+")";p.fillRect(v.getX(),v.getY(),v.getWidth(),v.getHeight())}v.empty()}};this.render=function(Ga,xa){function Ea(W){var na,ia,$,va=W.lights;F.setRGB(0,
|
|
|
|
-0,0);V.setRGB(0,0,0);G.setRGB(0,0,0);W=0;for(na=va.length;W<na;W++){ia=va[W];$=ia.color;if(ia instanceof THREE.AmbientLight){F.r+=$.r;F.g+=$.g;F.b+=$.b}else if(ia instanceof THREE.DirectionalLight){V.r+=$.r;V.g+=$.g;V.b+=$.b}else if(ia instanceof THREE.PointLight){G.r+=$.r;G.g+=$.g;G.b+=$.b}}}function za(W,na,ia,$){var va,ta,ya,X,Ia=W.lights;W=0;for(va=Ia.length;W<va;W++){ta=Ia[W];ya=ta.color;if(ta instanceof THREE.DirectionalLight){X=ia.dot(ta.position);if(!(X<=0)){X*=ta.intensity;$.r+=ya.r*X;$.g+=
|
|
|
|
-ya.g*X;$.b+=ya.b*X}}else if(ta instanceof THREE.PointLight){X=ia.dot(J.sub(ta.position,na).normalize());if(!(X<=0)){X*=ta.distance==0?1:1-Math.min(na.distanceTo(ta.position)/ta.distance,1);if(X!=0){X*=ta.intensity;$.r+=ya.r*X;$.g+=ya.g*X;$.b+=ya.b*X}}}}}function Ua(W,na,ia){b(ia.opacity);d(ia.blending);var $,va,ta,ya,X,Ia;if(ia instanceof THREE.ParticleBasicMaterial){if(ia.map){ya=ia.map.image;X=ya.width>>1;Ia=ya.height>>1;ia=na.scale.x*o;ta=na.scale.y*t;$=ia*X;va=ta*Ia;z.set(W.x-$,W.y-va,W.x+$,W.y+
|
|
|
|
-va);if(x.instersects(z)){p.save();p.translate(W.x,W.y);p.rotate(-na.rotation);p.scale(ia,-ta);p.translate(-X,-Ia);p.drawImage(ya,0,0);p.restore()}}}else if(ia instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;va=na.scale.y*t;z.set(W.x-$,W.y-va,W.x+$,W.y+va);if(x.instersects(z)){c(ia.color.__styleString);ta=ia.color.__styleString;if(B!=ta)p.fillStyle=B=ta;p.save();p.translate(W.x,W.y);p.rotate(-na.rotation);p.scale($,va);ia.program(p);p.restore()}}}function E(W,na,ia,$){b($.opacity);d($.blending);
|
|
|
|
-p.beginPath();p.moveTo(W.positionScreen.x,W.positionScreen.y);p.lineTo(na.positionScreen.x,na.positionScreen.y);p.closePath();if($ instanceof THREE.LineBasicMaterial){ma.__styleString=$.color.__styleString;W=$.linewidth;if(U!=W)p.lineWidth=U=W;W=$.linecap;if(D!=W)p.lineCap=D=W;W=$.linejoin;if(R!=W)p.lineJoin=R=W;c(ma.__styleString);p.stroke();z.inflate($.linewidth*2)}}function aa(W,na,ia,$,va,ta,ya,X,Ia){f.data.vertices+=3;f.data.faces++;b(X.opacity);d(X.blending);ea=W.positionScreen.x;e=W.positionScreen.y;
|
|
|
|
-oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ia.positionScreen.x;da=ia.positionScreen.y;ab(ea,e,oa,Da,Aa,da);if(X instanceof THREE.MeshBasicMaterial)if(X.map){if(X.map.mapping instanceof THREE.UVMapping){S=ya.uvs[0];cb(ea,e,oa,Da,Aa,da,X.map.image,S[$].u,S[$].v,S[va].u,S[va].v,S[ta].u,S[ta].v)}}else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping){W=xa.matrixWorldInverse;J.copy(ya.vertexNormalsWorld[0]);T=(J.x*W.n11+J.y*W.n12+J.z*W.n13)*0.5+0.5;O=-(J.x*W.n21+J.y*W.n22+
|
|
|
|
-J.z*W.n23)*0.5+0.5;J.copy(ya.vertexNormalsWorld[1]);Ba=(J.x*W.n11+J.y*W.n12+J.z*W.n13)*0.5+0.5;La=-(J.x*W.n21+J.y*W.n22+J.z*W.n23)*0.5+0.5;J.copy(ya.vertexNormalsWorld[2]);n=(J.x*W.n11+J.y*W.n12+J.z*W.n13)*0.5+0.5;C=-(J.x*W.n21+J.y*W.n22+J.z*W.n23)*0.5+0.5;cb(ea,e,oa,Da,Aa,da,X.envMap.image,T,O,Ba,La,n,C)}}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){if(X.map.mapping instanceof
|
|
|
|
-THREE.UVMapping){S=ya.uvs[0];cb(ea,e,oa,Da,Aa,da,X.map.image,S[$].u,S[$].v,S[va].u,S[va].v,S[ta].u,S[ta].v)}d(THREE.SubtractiveBlending)}if(P)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==3){Fa.r=ja.r=ha.r=F.r;Fa.g=ja.g=ha.g=F.g;Fa.b=ja.b=ha.b=F.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ja);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],ha);Ja.r=(ja.r+ha.r)*0.5;Ja.g=(ja.g+ha.g)*0.5;Ja.b=(ja.b+ha.b)*
|
|
|
|
-0.5;Ta=hb(Fa,ja,ha,Ja);cb(ea,e,oa,Da,Aa,da,Ta,0,0,1,0,0,1)}else{K.r=F.r;K.g=F.g;K.b=F.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=
|
|
|
|
-xa.near;Za=xa.far;Fa.r=Fa.g=Fa.b=1-Wa(W.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ha.r=ha.g=ha.b=1-Wa(ia.positionScreen.z,Xa,Za);Ja.r=(ja.r+ha.r)*0.5;Ja.g=(ja.g+ha.g)*0.5;Ja.b=(ja.b+ha.b)*0.5;Ta=hb(Fa,ja,ha,Ja);cb(ea,e,oa,Da,Aa,da,Ta,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):
|
|
|
|
-Qa(ma.__styleString)}}function w(W,na,ia,$,va,ta,ya,X,Ia){f.data.vertices+=4;f.data.faces++;b(X.opacity);d(X.blending);if(X.map||X.envMap){aa(W,na,$,0,1,3,ya,X,Ia);aa(va,ia,ta,1,2,3,ya,X,Ia)}else{ea=W.positionScreen.x;e=W.positionScreen.y;oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ia.positionScreen.x;da=ia.positionScreen.y;fa=$.positionScreen.x;wa=$.positionScreen.y;ua=va.positionScreen.x;pa=va.positionScreen.y;ca=ta.positionScreen.x;ka=ta.positionScreen.y;if(X instanceof THREE.MeshBasicMaterial){fb(ea,
|
|
|
|
-e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshLambertMaterial)if(P)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==4){Fa.r=ja.r=ha.r=Ja.r=F.r;Fa.g=ja.g=ha.g=Ja.g=F.g;Fa.b=ja.b=ha.b=Ja.b=F.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ja);za(Ia,ya.v4.positionWorld,ya.vertexNormalsWorld[3],
|
|
|
|
-ha);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],Ja);Ta=hb(Fa,ja,ha,Ja);ab(ea,e,oa,Da,fa,wa);cb(ea,e,oa,Da,fa,wa,Ta,0,0,1,0,0,1);ab(ua,pa,Aa,da,ca,ka);cb(ua,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}else{K.r=F.r;K.g=F.g;K.b=F.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();fb(ea,e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else{fb(ea,e,oa,
|
|
|
|
-Da,Aa,da,fa,wa);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();fb(ea,e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=xa.near;Za=xa.far;Fa.r=
|
|
|
|
-Fa.g=Fa.b=1-Wa(W.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ha.r=ha.g=ha.b=1-Wa($.positionScreen.z,Xa,Za);Ja.r=Ja.g=Ja.b=1-Wa(ia.positionScreen.z,Xa,Za);Ta=hb(Fa,ja,ha,Ja);ab(ea,e,oa,Da,fa,wa);cb(ea,e,oa,Da,fa,wa,Ta,0,0,1,0,0,1);ab(ua,pa,Aa,da,ca,ka);cb(ua,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}}}function ab(W,na,ia,$,va,ta){p.beginPath();p.moveTo(W,na);p.lineTo(ia,$);p.lineTo(va,ta);p.lineTo(W,na);p.closePath()}function fb(W,na,ia,$,va,ta,ya,X){p.beginPath();p.moveTo(W,na);p.lineTo(ia,
|
|
|
|
-$);p.lineTo(va,ta);p.lineTo(ya,X);p.lineTo(W,na);p.closePath()}function Oa(W,na,ia,$){if(U!=na)p.lineWidth=U=na;if(D!=ia)p.lineCap=D=ia;if(R!=$)p.lineJoin=R=$;c(W);p.stroke();z.inflate(na*2)}function Qa(W){if(B!=W)p.fillStyle=B=W;p.fill()}function cb(W,na,ia,$,va,ta,ya,X,Ia,Ya,eb,Sa,kb){var gb,db;gb=ya.width-1;db=ya.height-1;X*=gb;Ia*=db;Ya*=gb;eb*=db;Sa*=gb;kb*=db;ia-=W;$-=na;va-=W;ta-=na;Ya-=X;eb-=Ia;Sa-=X;kb-=Ia;gb=Ya*kb-Sa*eb;if(gb!=0){db=1/gb;gb=(kb*ia-eb*va)*db;eb=(kb*$-eb*ta)*db;ia=(Ya*va-
|
|
|
|
-Sa*ia)*db;$=(Ya*ta-Sa*$)*db;W=W-gb*X-ia*Ia;na=na-eb*X-$*Ia;p.save();p.transform(gb,eb,ia,$,W,na);p.clip();p.drawImage(ya,0,0);p.restore()}}function hb(W,na,ia,$){var va=~~(W.r*255),ta=~~(W.g*255);W=~~(W.b*255);var ya=~~(na.r*255),X=~~(na.g*255);na=~~(na.b*255);var Ia=~~(ia.r*255),Ya=~~(ia.g*255);ia=~~(ia.b*255);var eb=~~($.r*255),Sa=~~($.g*255);$=~~($.b*255);sa[0]=va<0?0:va>255?255:va;sa[1]=ta<0?0:ta>255?255:ta;sa[2]=W<0?0:W>255?255:W;sa[4]=ya<0?0:ya>255?255:ya;sa[5]=X<0?0:X>255?255:X;sa[6]=na<0?
|
|
|
|
-0:na>255?255:na;sa[8]=Ia<0?0:Ia>255?255:Ia;sa[9]=Ya<0?0:Ya>255?255:Ya;sa[10]=ia<0?0:ia>255?255:ia;sa[12]=eb<0?0:eb>255?255:eb;sa[13]=Sa<0?0:Sa>255?255:Sa;sa[14]=$<0?0:$>255?255:$;Z.putImageData(Y,0,0);Ca.drawImage(M,0,0);return Ka}function Wa(W,na,ia){W=(W-na)/(ia-na);return W*W*(3-2*W)}function $a(W){W=(W+1)*0.5;return W<0?0:W>1?1:W}function Ma(W,na){var ia=na.x-W.x,$=na.y-W.y,va=1/Math.sqrt(ia*ia+$*$);ia*=va;$*=va;na.x+=ia;na.y+=$;W.x-=ia;W.y-=$}var bb,Va,N,Na,Ra,ib,jb,Pa;this.autoClear?this.clear():
|
|
|
|
-p.setTransform(1,0,0,-1,o,t);f.data.vertices=0;f.data.faces=0;g=h.projectScene(Ga,xa,this.sortElements);(P=Ga.lights.length>0)&&Ea(Ga);bb=0;for(Va=g.length;bb<Va;bb++){N=g[bb];z.empty();if(N instanceof THREE.RenderableParticle){L=N;L.x*=o;L.y*=t;Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&Ua(L,N,Pa,Ga)}}else if(N instanceof THREE.RenderableLine){L=N.v1;Q=N.v2;L.positionScreen.x*=o;L.positionScreen.y*=t;Q.positionScreen.x*=o;Q.positionScreen.y*=t;z.addPoint(L.positionScreen.x,
|
|
|
|
-L.positionScreen.y);z.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&E(L,Q,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace3){L=N.v1;Q=N.v2;qa=N.v3;L.positionScreen.x*=o;L.positionScreen.y*=t;Q.positionScreen.x*=o;Q.positionScreen.y*=t;qa.positionScreen.x*=o;qa.positionScreen.y*=t;if(N.overdraw){Ma(L.positionScreen,Q.positionScreen);Ma(Q.positionScreen,qa.positionScreen);Ma(qa.positionScreen,L.positionScreen)}z.add3Points(L.positionScreen.x,
|
|
|
|
-L.positionScreen.y,Q.positionScreen.x,Q.positionScreen.y,qa.positionScreen.x,qa.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&aa(L,Q,qa,0,1,2,N,Pa,Ga)}else Pa.opacity!=0&&aa(L,Q,qa,0,1,2,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace4){L=N.v1;Q=N.v2;qa=N.v3;la=N.v4;L.positionScreen.x*=o;L.positionScreen.y*=
|
|
|
|
-t;Q.positionScreen.x*=o;Q.positionScreen.y*=t;qa.positionScreen.x*=o;qa.positionScreen.y*=t;la.positionScreen.x*=o;la.positionScreen.y*=t;ra.positionScreen.copy(Q.positionScreen);ga.positionScreen.copy(la.positionScreen);if(N.overdraw){Ma(L.positionScreen,Q.positionScreen);Ma(Q.positionScreen,la.positionScreen);Ma(la.positionScreen,L.positionScreen);Ma(qa.positionScreen,ra.positionScreen);Ma(qa.positionScreen,ga.positionScreen)}z.addPoint(L.positionScreen.x,L.positionScreen.y);z.addPoint(Q.positionScreen.x,
|
|
|
|
-Q.positionScreen.y);z.addPoint(qa.positionScreen.x,qa.positionScreen.y);z.addPoint(la.positionScreen.x,la.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&w(L,Q,qa,la,ra,ga,N,Pa,Ga)}else Pa.opacity!=0&&w(L,Q,qa,la,ra,ga,N,Pa,Ga)}}}v.addRectangle(z)}p.setTransform(1,0,0,1,0,0)}};
|
|
|
|
-THREE.SVGRenderer=function(){function b(fa,wa,ua){var pa,ca,ka,ma;pa=0;for(ca=fa.lights.length;pa<ca;pa++){ka=fa.lights[pa];if(ka instanceof THREE.DirectionalLight){ma=wa.normalWorld.dot(ka.position)*ka.intensity;if(ma>0){ua.r+=ka.color.r*ma;ua.g+=ka.color.g*ma;ua.b+=ka.color.b*ma}}else if(ka instanceof THREE.PointLight){ga.sub(ka.position,wa.centroidWorld);ga.normalize();ma=wa.normalWorld.dot(ga)*ka.intensity;if(ma>0){ua.r+=ka.color.r*ma;ua.g+=ka.color.g*ma;ua.b+=ka.color.b*ma}}}}function d(fa,wa,
|
|
|
|
-ua,pa,ca,ka){h.data.vertices+=3;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+"z");if(ca instanceof THREE.MeshBasicMaterial)R.__styleString=ca.color.__styleString;else if(ca instanceof THREE.MeshLambertMaterial)if(D){L.r=Q.r;L.g=Q.g;L.b=Q.b;b(ka,pa,L);R.r=ca.color.r*L.r;R.g=ca.color.g*L.g;R.b=ca.color.b*L.b;R.updateStyleString()}else R.__styleString=
|
|
|
|
-ca.color.__styleString;else if(ca instanceof THREE.MeshDepthMaterial){ra=1-ca.__2near/(ca.__farPlusNear-pa.z*ca.__farMinusNear);R.setRGB(ra,ra,ra)}else ca instanceof THREE.MeshNormalMaterial&&R.setRGB(g(pa.normalWorld.x),g(pa.normalWorld.y),g(pa.normalWorld.z));ca.wireframe?oa.setAttribute("style","fill: none; stroke: "+R.__styleString+"; stroke-width: "+ca.wireframeLinewidth+"; stroke-opacity: "+ca.opacity+"; stroke-linecap: "+ca.wireframeLinecap+"; stroke-linejoin: "+ca.wireframeLinejoin):oa.setAttribute("style",
|
|
|
|
-"fill: "+R.__styleString+"; fill-opacity: "+ca.opacity);m.appendChild(oa)}function c(fa,wa,ua,pa,ca,ka,ma){h.data.vertices+=4;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)R.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(D){L.r=
|
|
|
|
-Q.r;L.g=Q.g;L.b=Q.b;b(ma,ca,L);R.r=ka.color.r*L.r;R.g=ka.color.g*L.g;R.b=ka.color.b*L.b;R.updateStyleString()}else R.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshDepthMaterial){ra=1-ka.__2near/(ka.__farPlusNear-ca.z*ka.__farMinusNear);R.setRGB(ra,ra,ra)}else ka instanceof THREE.MeshNormalMaterial&&R.setRGB(g(ca.normalWorld.x),g(ca.normalWorld.y),g(ca.normalWorld.z));ka.wireframe?oa.setAttribute("style","fill: none; stroke: "+R.__styleString+"; stroke-width: "+ka.wireframeLinewidth+
|
|
|
|
-"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):oa.setAttribute("style","fill: "+R.__styleString+"; fill-opacity: "+ka.opacity);m.appendChild(oa)}function f(fa){if(ea[fa]==null){ea[fa]=document.createElementNS("http://www.w3.org/2000/svg","path");da==0&&ea[fa].setAttribute("shape-rendering","crispEdges")}return ea[fa]}function g(fa){return fa<0?Math.min((1+fa)*0.5,0.5):0.5+Math.min(fa*0.5,0.5)}var h=this,j=null,k=new THREE.Projector,
|
|
|
|
-m=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,p,y,u,A,I,H,B=new THREE.Rectangle,U=new THREE.Rectangle,D=!1,R=new THREE.Color(16777215),L=new THREE.Color(16777215),Q=new THREE.Color(0),qa=new THREE.Color(0),la=new THREE.Color(0),ra,ga=new THREE.Vector3,ea=[],e=[],oa,Da,Aa,da=1;this.domElement=m;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setQuality=function(fa){switch(fa){case "high":da=1;break;case "low":da=0}};this.setSize=function(fa,
|
|
|
|
-wa){o=fa;t=wa;p=o/2;y=t/2;m.setAttribute("viewBox",-p+" "+-y+" "+o+" "+t);m.setAttribute("width",o);m.setAttribute("height",t);B.set(-p,-y,p,y)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(fa,wa){var ua,pa,ca,ka,ma,Fa,ja,ha;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;j=k.projectScene(fa,wa,this.sortElements);Aa=Da=0;if(D=fa.lights.length>0){ja=fa.lights;Q.setRGB(0,0,0);qa.setRGB(0,0,0);la.setRGB(0,0,0);ua=0;for(pa=ja.length;ua<
|
|
|
|
-pa;ua++){ca=ja[ua];ka=ca.color;if(ca instanceof THREE.AmbientLight){Q.r+=ka.r;Q.g+=ka.g;Q.b+=ka.b}else if(ca instanceof THREE.DirectionalLight){qa.r+=ka.r;qa.g+=ka.g;qa.b+=ka.b}else if(ca instanceof THREE.PointLight){la.r+=ka.r;la.g+=ka.g;la.b+=ka.b}}}ua=0;for(pa=j.length;ua<pa;ua++){ja=j[ua];U.empty();if(ja instanceof THREE.RenderableParticle){u=ja;u.x*=p;u.y*=-y;ca=0;for(ka=ja.materials.length;ca<ka;)ca++}else if(ja instanceof THREE.RenderableLine){u=ja.v1;A=ja.v2;u.positionScreen.x*=p;u.positionScreen.y*=
|
|
|
|
--y;A.positionScreen.x*=p;A.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.materials.length;ca<ka;)if((ha=ja.materials[ca++])&&ha.opacity!=0){ma=u;Fa=A;var Ja=Aa++;if(e[Ja]==null){e[Ja]=document.createElementNS("http://www.w3.org/2000/svg","line");da==0&&e[Ja].setAttribute("shape-rendering","crispEdges")}oa=e[Ja];oa.setAttribute("x1",ma.positionScreen.x);oa.setAttribute("y1",ma.positionScreen.y);
|
|
|
|
-oa.setAttribute("x2",Fa.positionScreen.x);oa.setAttribute("y2",Fa.positionScreen.y);if(ha instanceof THREE.LineBasicMaterial){R.__styleString=ha.color.__styleString;oa.setAttribute("style","fill: none; stroke: "+R.__styleString+"; stroke-width: "+ha.linewidth+"; stroke-opacity: "+ha.opacity+"; stroke-linecap: "+ha.linecap+"; stroke-linejoin: "+ha.linejoin);m.appendChild(oa)}}}}else if(ja instanceof THREE.RenderableFace3){u=ja.v1;A=ja.v2;I=ja.v3;u.positionScreen.x*=p;u.positionScreen.y*=-y;A.positionScreen.x*=
|
|
|
|
-p;A.positionScreen.y*=-y;I.positionScreen.x*=p;I.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);U.addPoint(I.positionScreen.x,I.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ha=ja.meshMaterials[ca++];if(ha instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(ha=ja.faceMaterials[ma++])&&ha.opacity!=0&&d(u,A,I,ja,ha,fa)}else ha&&ha.opacity!=0&&d(u,A,I,ja,ha,fa)}}}else if(ja instanceof
|
|
|
|
-THREE.RenderableFace4){u=ja.v1;A=ja.v2;I=ja.v3;H=ja.v4;u.positionScreen.x*=p;u.positionScreen.y*=-y;A.positionScreen.x*=p;A.positionScreen.y*=-y;I.positionScreen.x*=p;I.positionScreen.y*=-y;H.positionScreen.x*=p;H.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);U.addPoint(I.positionScreen.x,I.positionScreen.y);U.addPoint(H.positionScreen.x,H.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ha=
|
|
|
|
-ja.meshMaterials[ca++];if(ha instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(ha=ja.faceMaterials[ma++])&&ha.opacity!=0&&c(u,A,I,H,ja,ha,fa)}else ha&&ha.opacity!=0&&c(u,A,I,H,ja,ha,fa)}}}}}};
|
|
|
|
|
|
+THREE.Projector=function(){function b(){var fa=m[k]=m[k]||new THREE.RenderableVertex;k++;return fa}function d(fa,e){return e.z-fa.z}function c(fa,e){var qa=0,Ea=1,Da=fa.z+fa.w,ea=e.z+e.w,ga=-fa.z+fa.w,xa=-e.z+e.w;if(Da>=0&&ea>=0&&ga>=0&&xa>=0)return!0;else if(Da<0&&ea<0||ga<0&&xa<0)return!1;else{if(Da<0)qa=Math.max(qa,Da/(Da-ea));else ea<0&&(Ea=Math.min(Ea,Da/(Da-ea)));if(ga<0)qa=Math.max(qa,ga/(ga-xa));else xa<0&&(Ea=Math.min(Ea,ga/(ga-xa)));if(Ea<qa)return!1;else{fa.lerpSelf(e,qa);e.lerpSelf(fa,
|
|
|
|
+1-Ea);return!0}}}var f,g,h=[],j,k,m=[],o,t,p=[],y,u=[],z,H,G=[],B,R,E=[],P=new THREE.Vector4,L=new THREE.Vector4,O=new THREE.Matrix4,sa=new THREE.Matrix4,oa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Vector4,ha=new THREE.Vector4;this.projectVector=function(fa,e){O.multiply(e.projectionMatrix,e.matrixWorldInverse);O.multiplyVector3(fa);return fa};this.unprojectVector=function(fa,e){O.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));
|
|
|
|
+O.multiplyVector3(fa);return fa};this.projectObjects=function(fa,e,qa){e=[];var Ea,Da,ea;g=0;Da=fa.objects;fa=0;for(Ea=Da.length;fa<Ea;fa++){ea=Da[fa];var ga;if(!(ga=!ea.visible))if(ga=ea instanceof THREE.Mesh){a:{ga=void 0;for(var xa=ea.matrixWorld,va=-ea.geometry.boundingSphere.radius*Math.max(ea.scale.x,Math.max(ea.scale.y,ea.scale.z)),ra=0;ra<6;ra++){ga=oa[ra].x*xa.n14+oa[ra].y*xa.n24+oa[ra].z*xa.n34+oa[ra].w;if(ga<=va){ga=!1;break a}}ga=!0}ga=!ga}if(!ga){ga=h[g]=h[g]||new THREE.RenderableObject;
|
|
|
|
+g++;f=ga;P.copy(ea.position);O.multiplyVector3(P);f.object=ea;f.z=P.z;e.push(f)}}qa&&e.sort(d);return e};this.projectScene=function(fa,e,qa){var Ea=[],Da=e.near,ea=e.far,ga,xa,va,ra,ca,ka,pa,Fa,ja,ia,Ia,Ya,ab,Ra,Q,aa,W;R=H=y=t=0;e.matrixAutoUpdate&&e.update(undefined,!0);fa.update(undefined,!1,e);O.multiply(e.projectionMatrix,e.matrixWorldInverse);oa[0].set(O.n41-O.n11,O.n42-O.n12,O.n43-O.n13,O.n44-O.n14);oa[1].set(O.n41+O.n11,O.n42+O.n12,O.n43+O.n13,O.n44+O.n14);oa[2].set(O.n41+O.n21,O.n42+O.n22,
|
|
|
|
+O.n43+O.n23,O.n44+O.n24);oa[3].set(O.n41-O.n21,O.n42-O.n22,O.n43-O.n23,O.n44-O.n24);oa[4].set(O.n41-O.n31,O.n42-O.n32,O.n43-O.n33,O.n44-O.n34);oa[5].set(O.n41+O.n31,O.n42+O.n32,O.n43+O.n33,O.n44+O.n34);for(ga=0;ga<6;ga++){ja=oa[ga];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(fa,e,!0);fa=0;for(ga=ja.length;fa<ga;fa++){ia=ja[fa].object;if(ia.visible){Ia=ia.matrixWorld;Ya=ia.matrixRotationWorld;ab=ia.materials;Ra=ia.overdraw;k=0;if(ia instanceof THREE.Mesh){Q=ia.geometry;
|
|
|
|
+ra=Q.vertices;aa=Q.faces;Q=Q.faceVertexUvs;xa=0;for(va=ra.length;xa<va;xa++){j=b();j.positionWorld.copy(ra[xa].position);Ia.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);O.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Da&&j.positionScreen.z<ea}ra=0;for(xa=aa.length;ra<xa;ra++){va=aa[ra];if(va instanceof THREE.Face3){ca=m[va.a];ka=m[va.b];pa=m[va.c];if(ca.visible&&ka.visible&&pa.visible&&
|
|
|
|
+(ia.doubleSided||ia.flipSided!=(pa.positionScreen.x-ca.positionScreen.x)*(ka.positionScreen.y-ca.positionScreen.y)-(pa.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0)){Fa=p[t]=p[t]||new THREE.RenderableFace3;t++;o=Fa;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(pa)}else continue}else if(va instanceof THREE.Face4){ca=m[va.a];ka=m[va.b];pa=m[va.c];Fa=m[va.d];if(ca.visible&&ka.visible&&pa.visible&&Fa.visible&&(ia.doubleSided||ia.flipSided!=((Fa.positionScreen.x-ca.positionScreen.x)*
|
|
|
|
+(ka.positionScreen.y-ca.positionScreen.y)-(Fa.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0||(ka.positionScreen.x-pa.positionScreen.x)*(Fa.positionScreen.y-pa.positionScreen.y)-(ka.positionScreen.y-pa.positionScreen.y)*(Fa.positionScreen.x-pa.positionScreen.x)<0))){W=u[y]=u[y]||new THREE.RenderableFace4;y++;o=W;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(pa);o.v4.copy(Fa)}else continue}o.normalWorld.copy(va.normal);Ya.multiplyVector3(o.normalWorld);o.centroidWorld.copy(va.centroid);
|
|
|
|
+Ia.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);O.multiplyVector3(o.centroidScreen);pa=va.vertexNormals;ca=0;for(ka=pa.length;ca<ka;ca++){Fa=o.vertexNormalsWorld[ca];Fa.copy(pa[ca]);Ya.multiplyVector3(Fa)}ca=0;for(ka=Q.length;ca<ka;ca++)if(W=Q[ca][ra]){pa=0;for(Fa=W.length;pa<Fa;pa++)o.uvs[ca][pa]=W[pa]}o.meshMaterials=ab;o.faceMaterials=va.materials;o.overdraw=Ra;o.z=o.centroidScreen.z;Ea.push(o)}}else if(ia instanceof THREE.Line){sa.multiply(O,Ia);ra=ia.geometry.vertices;
|
|
|
|
+ca=b();ca.positionScreen.copy(ra[0].position);sa.multiplyVector4(ca.positionScreen);xa=1;for(va=ra.length;xa<va;xa++){ca=b();ca.positionScreen.copy(ra[xa].position);sa.multiplyVector4(ca.positionScreen);ka=m[k-2];ta.copy(ca.positionScreen);ha.copy(ka.positionScreen);if(c(ta,ha)){ta.multiplyScalar(1/ta.w);ha.multiplyScalar(1/ha.w);Ia=G[H]=G[H]||new THREE.RenderableLine;H++;z=Ia;z.v1.positionScreen.copy(ta);z.v2.positionScreen.copy(ha);z.z=Math.max(ta.z,ha.z);z.materials=ia.materials;Ea.push(z)}}}else if(ia instanceof
|
|
|
|
+THREE.Particle){L.set(ia.matrixWorld.n14,ia.matrixWorld.n24,ia.matrixWorld.n34,1);O.multiplyVector4(L);L.z/=L.w;if(L.z>0&&L.z<1){Ia=E[R]=E[R]||new THREE.RenderableParticle;R++;B=Ia;B.x=L.x/L.w;B.y=L.y/L.w;B.z=L.z;B.rotation=ia.rotation.z;B.scale.x=ia.scale.x*Math.abs(B.x-(L.x+e.projectionMatrix.n11)/(L.w+e.projectionMatrix.n14));B.scale.y=ia.scale.y*Math.abs(B.y-(L.y+e.projectionMatrix.n22)/(L.w+e.projectionMatrix.n24));B.materials=ia.materials;Ea.push(B)}}}}qa&&Ea.sort(d);return Ea}};
|
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var m,o,t,p,y,u,z,H;b=d.projectScene(j,k);m=0;for(o=b.length;m<o;m++){y=b[m];if(y instanceof THREE.RenderableParticle){z=y.x*g+g;H=y.y*h+h;t=0;for(p=y.material.length;t<p;t++){u=y.material[t];if(u instanceof THREE.ParticleDOMMaterial){u=u.domElement;u.style.left=z+"px";u.style.top=H+"px"}}}}}};
|
|
|
|
+THREE.CanvasRenderer=function(){function b(ya){if(z!=ya)p.globalAlpha=z=ya}function d(ya){if(H!=ya){switch(ya){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}H=ya}}function c(ya){if(G!=ya)p.strokeStyle=G=ya}var f=this,g=null,h=new THREE.Projector,j=document.createElement("canvas"),k,m,o,t,p=j.getContext("2d"),y=new THREE.Color(0),u=0,z=
|
|
|
|
+1,H=0,G=null,B=null,R=null,E=null,P=null,L,O,sa,oa,ta=new THREE.RenderableVertex,ha=new THREE.RenderableVertex,fa,e,qa,Ea,Da,ea,ga,xa,va,ra,ca,ka,pa=new THREE.Color,Fa=new THREE.Color,ja=new THREE.Color,ia=new THREE.Color,Ia=new THREE.Color,Ya,ab,Ra,Q,aa,W,T,La,db,n,C=new THREE.Rectangle,w=new THREE.Rectangle,v=new THREE.Rectangle,A=!1,K=new THREE.Color,J=new THREE.Color,I=new THREE.Color,S=new THREE.Color,D=new THREE.Vector3,M,N,Z,V,Aa,Ka,Ba=16;M=document.createElement("canvas");M.width=M.height=
|
|
|
|
+2;N=M.getContext("2d");N.fillStyle="rgba(0,0,0,1)";N.fillRect(0,0,2,2);Z=N.getImageData(0,0,2,2);V=Z.data;Aa=document.createElement("canvas");Aa.width=Aa.height=Ba;Ka=Aa.getContext("2d");Ka.translate(-Ba/2,-Ba/2);Ka.scale(Ba,Ba);Ba--;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setSize=function(ya,Oa){k=ya;m=Oa;o=k/2;t=m/2;j.width=k;j.height=m;C.set(-o,-t,o,t);z=1;H=0;P=E=R=B=G=null};this.setClearColor=function(ya,Oa){y=ya;u=Oa};
|
|
|
|
+this.setClearColorHex=function(ya,Oa){y.setHex(ya);u=Oa};this.clear=function(){p.setTransform(1,0,0,-1,o,t);if(!w.isEmpty()){w.inflate(1);w.minSelf(C);if(y.hex==0&&u==0)p.clearRect(w.getX(),w.getY(),w.getWidth(),w.getHeight());else{d(THREE.NormalBlending);b(1);p.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+u+")";p.fillRect(w.getX(),w.getY(),w.getWidth(),w.getHeight())}w.empty()}};this.render=function(ya,Oa){function Ga(X){var ma,na,$,wa=X.lights;J.setRGB(0,
|
|
|
|
+0,0);I.setRGB(0,0,0);S.setRGB(0,0,0);X=0;for(ma=wa.length;X<ma;X++){na=wa[X];$=na.color;if(na instanceof THREE.AmbientLight){J.r+=$.r;J.g+=$.g;J.b+=$.b}else if(na instanceof THREE.DirectionalLight){I.r+=$.r;I.g+=$.g;I.b+=$.b}else if(na instanceof THREE.PointLight){S.r+=$.r;S.g+=$.g;S.b+=$.b}}}function za(X,ma,na,$){var wa,ua,la,Y,Ja=X.lights;X=0;for(wa=Ja.length;X<wa;X++){ua=Ja[X];la=ua.color;if(ua instanceof THREE.DirectionalLight){Y=na.dot(ua.position);if(!(Y<=0)){Y*=ua.intensity;$.r+=la.r*Y;$.g+=
|
|
|
|
+la.g*Y;$.b+=la.b*Y}}else if(ua instanceof THREE.PointLight){Y=na.dot(D.sub(ua.position,ma).normalize());if(!(Y<=0)){Y*=ua.distance==0?1:1-Math.min(ma.distanceTo(ua.position)/ua.distance,1);if(Y!=0){Y*=ua.intensity;$.r+=la.r*Y;$.g+=la.g*Y;$.b+=la.b*Y}}}}}function Ha(X,ma,na){b(na.opacity);d(na.blending);var $,wa,ua,la,Y,Ja;if(na instanceof THREE.ParticleBasicMaterial){if(na.map){la=na.map.image;Y=la.width>>1;Ja=la.height>>1;na=ma.scale.x*o;ua=ma.scale.y*t;$=na*Y;wa=ua*Ja;v.set(X.x-$,X.y-wa,X.x+$,X.y+
|
|
|
|
+wa);if(C.instersects(v)){p.save();p.translate(X.x,X.y);p.rotate(-ma.rotation);p.scale(na,-ua);p.translate(-Y,-Ja);p.drawImage(la,0,0);p.restore()}}}else if(na instanceof THREE.ParticleCanvasMaterial){$=ma.scale.x*o;wa=ma.scale.y*t;v.set(X.x-$,X.y-wa,X.x+$,X.y+wa);if(C.instersects(v)){c(na.color.__styleString);ua=na.color.__styleString;if(B!=ua)p.fillStyle=B=ua;p.save();p.translate(X.x,X.y);p.rotate(-ma.rotation);p.scale($,wa);na.program(p);p.restore()}}}function Ua(X,ma,na,$){b($.opacity);d($.blending);
|
|
|
|
+p.beginPath();p.moveTo(X.positionScreen.x,X.positionScreen.y);p.lineTo(ma.positionScreen.x,ma.positionScreen.y);p.closePath();if($ instanceof THREE.LineBasicMaterial){pa.__styleString=$.color.__styleString;X=$.linewidth;if(R!=X)p.lineWidth=R=X;X=$.linecap;if(E!=X)p.lineCap=E=X;X=$.linejoin;if(P!=X)p.lineJoin=P=X;c(pa.__styleString);p.stroke();v.inflate($.linewidth*2)}}function F(X,ma,na,$,wa,ua,la,Y,Ja){f.data.vertices+=3;f.data.faces++;b(Y.opacity);d(Y.blending);fa=X.positionScreen.x;e=X.positionScreen.y;
|
|
|
|
+qa=ma.positionScreen.x;Ea=ma.positionScreen.y;Da=na.positionScreen.x;ea=na.positionScreen.y;x(fa,e,qa,Ea,Da,ea);if(Y instanceof THREE.MeshBasicMaterial)if(Y.map){if(Y.map.mapping instanceof THREE.UVMapping){Q=la.uvs[0];Pa(fa,e,qa,Ea,Da,ea,Y.map.image,Q[$].u,Q[$].v,Q[wa].u,Q[wa].v,Q[ua].u,Q[ua].v)}}else if(Y.envMap){if(Y.envMap.mapping instanceof THREE.SphericalReflectionMapping){X=Oa.matrixWorldInverse;D.copy(la.vertexNormalsWorld[0]);aa=(D.x*X.n11+D.y*X.n12+D.z*X.n13)*0.5+0.5;W=-(D.x*X.n21+D.y*X.n22+
|
|
|
|
+D.z*X.n23)*0.5+0.5;D.copy(la.vertexNormalsWorld[1]);T=(D.x*X.n11+D.y*X.n12+D.z*X.n13)*0.5+0.5;La=-(D.x*X.n21+D.y*X.n22+D.z*X.n23)*0.5+0.5;D.copy(la.vertexNormalsWorld[2]);db=(D.x*X.n11+D.y*X.n12+D.z*X.n13)*0.5+0.5;n=-(D.x*X.n21+D.y*X.n22+D.z*X.n23)*0.5+0.5;Pa(fa,e,qa,Ea,Da,ea,Y.envMap.image,aa,W,T,La,db,n)}}else Y.wireframe?eb(Y.color.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Na(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&&!Y.wireframe){if(Y.map.mapping instanceof
|
|
|
|
+THREE.UVMapping){Q=la.uvs[0];Pa(fa,e,qa,Ea,Da,ea,Y.map.image,Q[$].u,Q[$].v,Q[wa].u,Q[wa].v,Q[ua].u,Q[ua].v)}d(THREE.SubtractiveBlending)}if(A)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&la.vertexNormalsWorld.length==3){Fa.r=ja.r=ia.r=J.r;Fa.g=ja.g=ia.g=J.g;Fa.b=ja.b=ia.b=J.b;za(Ja,la.v1.positionWorld,la.vertexNormalsWorld[0],Fa);za(Ja,la.v2.positionWorld,la.vertexNormalsWorld[1],ja);za(Ja,la.v3.positionWorld,la.vertexNormalsWorld[2],ia);Ia.r=(ja.r+ia.r)*0.5;Ia.g=(ja.g+ia.g)*0.5;Ia.b=(ja.b+ia.b)*
|
|
|
|
+0.5;Ra=ib(Fa,ja,ia,Ia);Pa(fa,e,qa,Ea,Da,ea,Ra,0,0,1,0,0,1)}else{K.r=J.r;K.g=J.g;K.b=J.b;za(Ja,la.centroidWorld,la.normalWorld,K);pa.r=Y.color.r*K.r;pa.g=Y.color.g*K.g;pa.b=Y.color.b*K.b;pa.updateStyleString();Y.wireframe?eb(pa.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Na(pa.__styleString)}else Y.wireframe?eb(Y.color.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Na(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){Ya=
|
|
|
|
+Oa.near;ab=Oa.far;Fa.r=Fa.g=Fa.b=1-fb(X.positionScreen.z,Ya,ab);ja.r=ja.g=ja.b=1-fb(ma.positionScreen.z,Ya,ab);ia.r=ia.g=ia.b=1-fb(na.positionScreen.z,Ya,ab);Ia.r=(ja.r+ia.r)*0.5;Ia.g=(ja.g+ia.g)*0.5;Ia.b=(ja.b+ia.b)*0.5;Ra=ib(Fa,ja,ia,Ia);Pa(fa,e,qa,Ea,Da,ea,Ra,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){pa.r=Za(la.normalWorld.x);pa.g=Za(la.normalWorld.y);pa.b=Za(la.normalWorld.z);pa.updateStyleString();Y.wireframe?eb(pa.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):
|
|
|
|
+Na(pa.__styleString)}}function da(X,ma,na,$,wa,ua,la,Y,Ja){f.data.vertices+=4;f.data.faces++;b(Y.opacity);d(Y.blending);if(Y.map||Y.envMap){F(X,ma,$,0,1,3,la,Y,Ja);F(wa,na,ua,1,2,3,la,Y,Ja)}else{fa=X.positionScreen.x;e=X.positionScreen.y;qa=ma.positionScreen.x;Ea=ma.positionScreen.y;Da=na.positionScreen.x;ea=na.positionScreen.y;ga=$.positionScreen.x;xa=$.positionScreen.y;va=wa.positionScreen.x;ra=wa.positionScreen.y;ca=ua.positionScreen.x;ka=ua.positionScreen.y;if(Y instanceof THREE.MeshBasicMaterial){bb(fa,
|
|
|
|
+e,qa,Ea,Da,ea,ga,xa);Y.wireframe?eb(Y.color.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Na(Y.color.__styleString)}else if(Y instanceof THREE.MeshLambertMaterial)if(A)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&la.vertexNormalsWorld.length==4){Fa.r=ja.r=ia.r=Ia.r=J.r;Fa.g=ja.g=ia.g=Ia.g=J.g;Fa.b=ja.b=ia.b=Ia.b=J.b;za(Ja,la.v1.positionWorld,la.vertexNormalsWorld[0],Fa);za(Ja,la.v2.positionWorld,la.vertexNormalsWorld[1],ja);za(Ja,la.v4.positionWorld,la.vertexNormalsWorld[3],
|
|
|
|
+ia);za(Ja,la.v3.positionWorld,la.vertexNormalsWorld[2],Ia);Ra=ib(Fa,ja,ia,Ia);x(fa,e,qa,Ea,ga,xa);Pa(fa,e,qa,Ea,ga,xa,Ra,0,0,1,0,0,1);x(va,ra,Da,ea,ca,ka);Pa(va,ra,Da,ea,ca,ka,Ra,1,0,1,1,0,1)}else{K.r=J.r;K.g=J.g;K.b=J.b;za(Ja,la.centroidWorld,la.normalWorld,K);pa.r=Y.color.r*K.r;pa.g=Y.color.g*K.g;pa.b=Y.color.b*K.b;pa.updateStyleString();bb(fa,e,qa,Ea,Da,ea,ga,xa);Y.wireframe?eb(pa.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Na(pa.__styleString)}else{bb(fa,e,qa,Ea,
|
|
|
|
+Da,ea,ga,xa);Y.wireframe?eb(Y.color.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Na(Y.color.__styleString)}else if(Y instanceof THREE.MeshNormalMaterial){pa.r=Za(la.normalWorld.x);pa.g=Za(la.normalWorld.y);pa.b=Za(la.normalWorld.z);pa.updateStyleString();bb(fa,e,qa,Ea,Da,ea,ga,xa);Y.wireframe?eb(pa.__styleString,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Na(pa.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){Ya=Oa.near;ab=Oa.far;Fa.r=Fa.g=
|
|
|
|
+Fa.b=1-fb(X.positionScreen.z,Ya,ab);ja.r=ja.g=ja.b=1-fb(ma.positionScreen.z,Ya,ab);ia.r=ia.g=ia.b=1-fb($.positionScreen.z,Ya,ab);Ia.r=Ia.g=Ia.b=1-fb(na.positionScreen.z,Ya,ab);Ra=ib(Fa,ja,ia,Ia);x(fa,e,qa,Ea,ga,xa);Pa(fa,e,qa,Ea,ga,xa,Ra,0,0,1,0,0,1);x(va,ra,Da,ea,ca,ka);Pa(va,ra,Da,ea,ca,ka,Ra,1,0,1,1,0,1)}}}function x(X,ma,na,$,wa,ua){p.beginPath();p.moveTo(X,ma);p.lineTo(na,$);p.lineTo(wa,ua);p.lineTo(X,ma);p.closePath()}function bb(X,ma,na,$,wa,ua,la,Y){p.beginPath();p.moveTo(X,ma);p.lineTo(na,
|
|
|
|
+$);p.lineTo(wa,ua);p.lineTo(la,Y);p.lineTo(X,ma);p.closePath()}function eb(X,ma,na,$){if(R!=ma)p.lineWidth=R=ma;if(E!=na)p.lineCap=E=na;if(P!=$)p.lineJoin=P=$;c(X);p.stroke();v.inflate(ma*2)}function Na(X){if(B!=X)p.fillStyle=B=X;p.fill()}function Pa(X,ma,na,$,wa,ua,la,Y,Ja,Va,Ta,jb,Wa){var gb,hb;gb=la.width-1;hb=la.height-1;Y*=gb;Ja*=hb;Va*=gb;Ta*=hb;jb*=gb;Wa*=hb;na-=X;$-=ma;wa-=X;ua-=ma;Va-=Y;Ta-=Ja;jb-=Y;Wa-=Ja;gb=Va*Wa-jb*Ta;if(gb!=0){hb=1/gb;gb=(Wa*na-Ta*wa)*hb;Ta=(Wa*$-Ta*ua)*hb;na=(Va*wa-
|
|
|
|
+jb*na)*hb;$=(Va*ua-jb*$)*hb;X=X-gb*Y-na*Ja;ma=ma-Ta*Y-$*Ja;p.save();p.transform(gb,Ta,na,$,X,ma);p.clip();p.drawImage(la,0,0);p.restore()}}function ib(X,ma,na,$){var wa=~~(X.r*255),ua=~~(X.g*255);X=~~(X.b*255);var la=~~(ma.r*255),Y=~~(ma.g*255);ma=~~(ma.b*255);var Ja=~~(na.r*255),Va=~~(na.g*255);na=~~(na.b*255);var Ta=~~($.r*255),jb=~~($.g*255);$=~~($.b*255);V[0]=wa<0?0:wa>255?255:wa;V[1]=ua<0?0:ua>255?255:ua;V[2]=X<0?0:X>255?255:X;V[4]=la<0?0:la>255?255:la;V[5]=Y<0?0:Y>255?255:Y;V[6]=ma<0?0:ma>255?
|
|
|
|
+255:ma;V[8]=Ja<0?0:Ja>255?255:Ja;V[9]=Va<0?0:Va>255?255:Va;V[10]=na<0?0:na>255?255:na;V[12]=Ta<0?0:Ta>255?255:Ta;V[13]=jb<0?0:jb>255?255:jb;V[14]=$<0?0:$>255?255:$;N.putImageData(Z,0,0);Ka.drawImage(M,0,0);return Aa}function fb(X,ma,na){X=(X-ma)/(na-ma);return X*X*(3-2*X)}function Za(X){X=(X+1)*0.5;return X<0?0:X>1?1:X}function $a(X,ma){var na=ma.x-X.x,$=ma.y-X.y,wa=1/Math.sqrt(na*na+$*$);na*=wa;$*=wa;ma.x+=na;ma.y+=$;X.x-=na;X.y-=$}var Ma,cb,Ca,U,Qa,Sa,kb,Xa;this.autoClear?this.clear():p.setTransform(1,
|
|
|
|
+0,0,-1,o,t);f.data.vertices=0;f.data.faces=0;g=h.projectScene(ya,Oa,this.sortElements);(A=ya.lights.length>0)&&Ga(ya);Ma=0;for(cb=g.length;Ma<cb;Ma++){Ca=g[Ma];v.empty();if(Ca instanceof THREE.RenderableParticle){L=Ca;L.x*=o;L.y*=t;U=0;for(Qa=Ca.materials.length;U<Qa;){Xa=Ca.materials[U++];Xa.opacity!=0&&Ha(L,Ca,Xa,ya)}}else if(Ca instanceof THREE.RenderableLine){L=Ca.v1;O=Ca.v2;L.positionScreen.x*=o;L.positionScreen.y*=t;O.positionScreen.x*=o;O.positionScreen.y*=t;v.addPoint(L.positionScreen.x,L.positionScreen.y);
|
|
|
|
+v.addPoint(O.positionScreen.x,O.positionScreen.y);if(C.instersects(v)){U=0;for(Qa=Ca.materials.length;U<Qa;){Xa=Ca.materials[U++];Xa.opacity!=0&&Ua(L,O,Ca,Xa,ya)}}}else if(Ca instanceof THREE.RenderableFace3){L=Ca.v1;O=Ca.v2;sa=Ca.v3;L.positionScreen.x*=o;L.positionScreen.y*=t;O.positionScreen.x*=o;O.positionScreen.y*=t;sa.positionScreen.x*=o;sa.positionScreen.y*=t;if(Ca.overdraw){$a(L.positionScreen,O.positionScreen);$a(O.positionScreen,sa.positionScreen);$a(sa.positionScreen,L.positionScreen)}v.add3Points(L.positionScreen.x,
|
|
|
|
+L.positionScreen.y,O.positionScreen.x,O.positionScreen.y,sa.positionScreen.x,sa.positionScreen.y);if(C.instersects(v)){U=0;for(Qa=Ca.meshMaterials.length;U<Qa;){Xa=Ca.meshMaterials[U++];if(Xa instanceof THREE.MeshFaceMaterial){Sa=0;for(kb=Ca.faceMaterials.length;Sa<kb;)(Xa=Ca.faceMaterials[Sa++])&&Xa.opacity!=0&&F(L,O,sa,0,1,2,Ca,Xa,ya)}else Xa.opacity!=0&&F(L,O,sa,0,1,2,Ca,Xa,ya)}}}else if(Ca instanceof THREE.RenderableFace4){L=Ca.v1;O=Ca.v2;sa=Ca.v3;oa=Ca.v4;L.positionScreen.x*=o;L.positionScreen.y*=
|
|
|
|
+t;O.positionScreen.x*=o;O.positionScreen.y*=t;sa.positionScreen.x*=o;sa.positionScreen.y*=t;oa.positionScreen.x*=o;oa.positionScreen.y*=t;ta.positionScreen.copy(O.positionScreen);ha.positionScreen.copy(oa.positionScreen);if(Ca.overdraw){$a(L.positionScreen,O.positionScreen);$a(O.positionScreen,oa.positionScreen);$a(oa.positionScreen,L.positionScreen);$a(sa.positionScreen,ta.positionScreen);$a(sa.positionScreen,ha.positionScreen)}v.addPoint(L.positionScreen.x,L.positionScreen.y);v.addPoint(O.positionScreen.x,
|
|
|
|
+O.positionScreen.y);v.addPoint(sa.positionScreen.x,sa.positionScreen.y);v.addPoint(oa.positionScreen.x,oa.positionScreen.y);if(C.instersects(v)){U=0;for(Qa=Ca.meshMaterials.length;U<Qa;){Xa=Ca.meshMaterials[U++];if(Xa instanceof THREE.MeshFaceMaterial){Sa=0;for(kb=Ca.faceMaterials.length;Sa<kb;)(Xa=Ca.faceMaterials[Sa++])&&Xa.opacity!=0&&da(L,O,sa,oa,ta,ha,Ca,Xa,ya)}else Xa.opacity!=0&&da(L,O,sa,oa,ta,ha,Ca,Xa,ya)}}}w.addRectangle(v)}p.setTransform(1,0,0,1,0,0)}};
|
|
|
|
+THREE.SVGRenderer=function(){function b(ga,xa,va){var ra,ca,ka,pa;ra=0;for(ca=ga.lights.length;ra<ca;ra++){ka=ga.lights[ra];if(ka instanceof THREE.DirectionalLight){pa=xa.normalWorld.dot(ka.position)*ka.intensity;if(pa>0){va.r+=ka.color.r*pa;va.g+=ka.color.g*pa;va.b+=ka.color.b*pa}}else if(ka instanceof THREE.PointLight){ha.sub(ka.position,xa.centroidWorld);ha.normalize();pa=xa.normalWorld.dot(ha)*ka.intensity;if(pa>0){va.r+=ka.color.r*pa;va.g+=ka.color.g*pa;va.b+=ka.color.b*pa}}}}function d(ga,xa,
|
|
|
|
+va,ra,ca,ka){h.data.vertices+=3;h.data.faces++;qa=f(Ea++);qa.setAttribute("d","M "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+xa.positionScreen.x+" "+xa.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ca instanceof THREE.MeshBasicMaterial)P.__styleString=ca.color.__styleString;else if(ca instanceof THREE.MeshLambertMaterial)if(E){L.r=O.r;L.g=O.g;L.b=O.b;b(ka,ra,L);P.r=ca.color.r*L.r;P.g=ca.color.g*L.g;P.b=ca.color.b*L.b;P.updateStyleString()}else P.__styleString=
|
|
|
|
+ca.color.__styleString;else if(ca instanceof THREE.MeshDepthMaterial){ta=1-ca.__2near/(ca.__farPlusNear-ra.z*ca.__farMinusNear);P.setRGB(ta,ta,ta)}else ca instanceof THREE.MeshNormalMaterial&&P.setRGB(g(ra.normalWorld.x),g(ra.normalWorld.y),g(ra.normalWorld.z));ca.wireframe?qa.setAttribute("style","fill: none; stroke: "+P.__styleString+"; stroke-width: "+ca.wireframeLinewidth+"; stroke-opacity: "+ca.opacity+"; stroke-linecap: "+ca.wireframeLinecap+"; stroke-linejoin: "+ca.wireframeLinejoin):qa.setAttribute("style",
|
|
|
|
+"fill: "+P.__styleString+"; fill-opacity: "+ca.opacity);m.appendChild(qa)}function c(ga,xa,va,ra,ca,ka,pa){h.data.vertices+=4;h.data.faces++;qa=f(Ea++);qa.setAttribute("d","M "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+xa.positionScreen.x+" "+xa.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)P.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(E){L.r=
|
|
|
|
+O.r;L.g=O.g;L.b=O.b;b(pa,ca,L);P.r=ka.color.r*L.r;P.g=ka.color.g*L.g;P.b=ka.color.b*L.b;P.updateStyleString()}else P.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshDepthMaterial){ta=1-ka.__2near/(ka.__farPlusNear-ca.z*ka.__farMinusNear);P.setRGB(ta,ta,ta)}else ka instanceof THREE.MeshNormalMaterial&&P.setRGB(g(ca.normalWorld.x),g(ca.normalWorld.y),g(ca.normalWorld.z));ka.wireframe?qa.setAttribute("style","fill: none; stroke: "+P.__styleString+"; stroke-width: "+ka.wireframeLinewidth+
|
|
|
|
+"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):qa.setAttribute("style","fill: "+P.__styleString+"; fill-opacity: "+ka.opacity);m.appendChild(qa)}function f(ga){if(fa[ga]==null){fa[ga]=document.createElementNS("http://www.w3.org/2000/svg","path");ea==0&&fa[ga].setAttribute("shape-rendering","crispEdges")}return fa[ga]}function g(ga){return ga<0?Math.min((1+ga)*0.5,0.5):0.5+Math.min(ga*0.5,0.5)}var h=this,j=null,k=new THREE.Projector,
|
|
|
|
+m=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,p,y,u,z,H,G,B=new THREE.Rectangle,R=new THREE.Rectangle,E=!1,P=new THREE.Color(16777215),L=new THREE.Color(16777215),O=new THREE.Color(0),sa=new THREE.Color(0),oa=new THREE.Color(0),ta,ha=new THREE.Vector3,fa=[],e=[],qa,Ea,Da,ea=1;this.domElement=m;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setQuality=function(ga){switch(ga){case "high":ea=1;break;case "low":ea=0}};this.setSize=function(ga,
|
|
|
|
+xa){o=ga;t=xa;p=o/2;y=t/2;m.setAttribute("viewBox",-p+" "+-y+" "+o+" "+t);m.setAttribute("width",o);m.setAttribute("height",t);B.set(-p,-y,p,y)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(ga,xa){var va,ra,ca,ka,pa,Fa,ja,ia;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;j=k.projectScene(ga,xa,this.sortElements);Da=Ea=0;if(E=ga.lights.length>0){ja=ga.lights;O.setRGB(0,0,0);sa.setRGB(0,0,0);oa.setRGB(0,0,0);va=0;for(ra=ja.length;va<
|
|
|
|
+ra;va++){ca=ja[va];ka=ca.color;if(ca instanceof THREE.AmbientLight){O.r+=ka.r;O.g+=ka.g;O.b+=ka.b}else if(ca instanceof THREE.DirectionalLight){sa.r+=ka.r;sa.g+=ka.g;sa.b+=ka.b}else if(ca instanceof THREE.PointLight){oa.r+=ka.r;oa.g+=ka.g;oa.b+=ka.b}}}va=0;for(ra=j.length;va<ra;va++){ja=j[va];R.empty();if(ja instanceof THREE.RenderableParticle){u=ja;u.x*=p;u.y*=-y;ca=0;for(ka=ja.materials.length;ca<ka;)ca++}else if(ja instanceof THREE.RenderableLine){u=ja.v1;z=ja.v2;u.positionScreen.x*=p;u.positionScreen.y*=
|
|
|
|
+-y;z.positionScreen.x*=p;z.positionScreen.y*=-y;R.addPoint(u.positionScreen.x,u.positionScreen.y);R.addPoint(z.positionScreen.x,z.positionScreen.y);if(B.instersects(R)){ca=0;for(ka=ja.materials.length;ca<ka;)if((ia=ja.materials[ca++])&&ia.opacity!=0){pa=u;Fa=z;var Ia=Da++;if(e[Ia]==null){e[Ia]=document.createElementNS("http://www.w3.org/2000/svg","line");ea==0&&e[Ia].setAttribute("shape-rendering","crispEdges")}qa=e[Ia];qa.setAttribute("x1",pa.positionScreen.x);qa.setAttribute("y1",pa.positionScreen.y);
|
|
|
|
+qa.setAttribute("x2",Fa.positionScreen.x);qa.setAttribute("y2",Fa.positionScreen.y);if(ia instanceof THREE.LineBasicMaterial){P.__styleString=ia.color.__styleString;qa.setAttribute("style","fill: none; stroke: "+P.__styleString+"; stroke-width: "+ia.linewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.linecap+"; stroke-linejoin: "+ia.linejoin);m.appendChild(qa)}}}}else if(ja instanceof THREE.RenderableFace3){u=ja.v1;z=ja.v2;H=ja.v3;u.positionScreen.x*=p;u.positionScreen.y*=-y;z.positionScreen.x*=
|
|
|
|
+p;z.positionScreen.y*=-y;H.positionScreen.x*=p;H.positionScreen.y*=-y;R.addPoint(u.positionScreen.x,u.positionScreen.y);R.addPoint(z.positionScreen.x,z.positionScreen.y);R.addPoint(H.positionScreen.x,H.positionScreen.y);if(B.instersects(R)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ia=ja.meshMaterials[ca++];if(ia instanceof THREE.MeshFaceMaterial){pa=0;for(Fa=ja.faceMaterials.length;pa<Fa;)(ia=ja.faceMaterials[pa++])&&ia.opacity!=0&&d(u,z,H,ja,ia,ga)}else ia&&ia.opacity!=0&&d(u,z,H,ja,ia,ga)}}}else if(ja instanceof
|
|
|
|
+THREE.RenderableFace4){u=ja.v1;z=ja.v2;H=ja.v3;G=ja.v4;u.positionScreen.x*=p;u.positionScreen.y*=-y;z.positionScreen.x*=p;z.positionScreen.y*=-y;H.positionScreen.x*=p;H.positionScreen.y*=-y;G.positionScreen.x*=p;G.positionScreen.y*=-y;R.addPoint(u.positionScreen.x,u.positionScreen.y);R.addPoint(z.positionScreen.x,z.positionScreen.y);R.addPoint(H.positionScreen.x,H.positionScreen.y);R.addPoint(G.positionScreen.x,G.positionScreen.y);if(B.instersects(R)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ia=
|
|
|
|
+ja.meshMaterials[ca++];if(ia instanceof THREE.MeshFaceMaterial){pa=0;for(Fa=ja.faceMaterials.length;pa<Fa;)(ia=ja.faceMaterials[pa++])&&ia.opacity!=0&&c(u,z,H,G,ja,ia,ga)}else ia&&ia.opacity!=0&&c(u,z,H,G,ja,ia,ga)}}}}}};
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
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",
|
|
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",
|
|
@@ -219,121 +219,121 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
|
|
"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.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.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
|
|
"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.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.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
|
|
THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
-THREE.WebGLRenderer=function(b){function d(n,C,x){var v,z,P,K=n.vertices,F=K.length,V=n.colors,G=V.length,J=n.__vertexArray,M=n.__colorArray,Z=n.__sortArray,Y=n.__dirtyVertices,sa=n.__dirtyColors;if(x.sortParticles){Ja.multiplySelf(x.matrixWorld);for(v=0;v<F;v++){z=K[v].position;Ta.copy(z);Ja.multiplyVector3(Ta);Z[v]=[Ta.z,v]}Z.sort(function(Ka,Ca){return Ca[0]-Ka[0]});for(v=0;v<F;v++){z=K[Z[v][1]].position;P=v*3;J[P]=z.x;J[P+1]=z.y;J[P+2]=z.z}for(v=0;v<G;v++){P=v*3;color=V[Z[v][1]];M[P]=color.r;
|
|
|
|
-M[P+1]=color.g;M[P+2]=color.b}}else{if(Y)for(v=0;v<F;v++){z=K[v].position;P=v*3;J[P]=z.x;J[P+1]=z.y;J[P+2]=z.z}if(sa)for(v=0;v<G;v++){color=V[v];P=v*3;M[P]=color.r;M[P+1]=color.g;M[P+2]=color.b}}if(Y||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,J,C)}if(sa||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,M,C)}}function c(n,C,x,v,z){v.program||ea.initMaterial(v,C,x,z);var P=v.program,K=P.uniforms,F=v.uniforms;
|
|
|
|
-if(P!=Aa){e.useProgram(P);Aa=P}e.uniformMatrix4fv(K.projectionMatrix,!1,Xa);if(x&&(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial||v instanceof THREE.LineBasicMaterial||v instanceof THREE.ParticleBasicMaterial||v.fog)){F.fogColor.value=x.color;if(x instanceof THREE.Fog){F.fogNear.value=x.near;F.fogFar.value=x.far}else if(x instanceof THREE.FogExp2)F.fogDensity.value=x.density}if(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||
|
|
|
|
-v.lights){var V,G,J=0,M=0,Z=0,Y,sa,Ka,Ca,Ha=S,Ga=Ha.directional.colors,xa=Ha.directional.positions,Ea=Ha.point.colors,za=Ha.point.positions,Ua=Ha.point.distances,E=0,aa=0;x=G=Ca=0;for(V=C.length;x<V;x++){G=C[x];Y=G.color;sa=G.position;Ka=G.intensity;Ca=G.distance;if(G instanceof THREE.AmbientLight){J+=Y.r;M+=Y.g;Z+=Y.b}else if(G instanceof THREE.DirectionalLight){Ca=E*3;Ga[Ca]=Y.r*Ka;Ga[Ca+1]=Y.g*Ka;Ga[Ca+2]=Y.b*Ka;xa[Ca]=sa.x;xa[Ca+1]=sa.y;xa[Ca+2]=sa.z;E+=1}else if(G instanceof THREE.PointLight){G=
|
|
|
|
-aa*3;Ea[G]=Y.r*Ka;Ea[G+1]=Y.g*Ka;Ea[G+2]=Y.b*Ka;za[G]=sa.x;za[G+1]=sa.y;za[G+2]=sa.z;Ua[aa]=Ca;aa+=1}}for(x=E*3;x<Ga.length;x++)Ga[x]=0;for(x=aa*3;x<Ea.length;x++)Ea[x]=0;Ha.point.length=aa;Ha.directional.length=E;Ha.ambient[0]=J;Ha.ambient[1]=M;Ha.ambient[2]=Z;x=S;F.enableLighting.value=x.directional.length+x.point.length;F.ambientLightColor.value=x.ambient;F.directionalLightColor.value=x.directional.colors;F.directionalLightDirection.value=x.directional.positions;F.pointLightColor.value=x.point.colors;
|
|
|
|
-F.pointLightPosition.value=x.point.positions;F.pointLightDistance.value=x.point.distances}if(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial){F.diffuse.value=v.color;F.opacity.value=v.opacity;F.map.texture=v.map;F.lightMap.texture=v.lightMap;F.envMap.texture=v.envMap;F.reflectivity.value=v.reflectivity;F.refractionRatio.value=v.refractionRatio;F.combine.value=v.combine;F.useRefract.value=v.envMap&&v.envMap.mapping instanceof THREE.CubeRefractionMapping}if(v instanceof
|
|
|
|
-THREE.LineBasicMaterial){F.diffuse.value=v.color;F.opacity.value=v.opacity}else if(v instanceof THREE.ParticleBasicMaterial){F.psColor.value=v.color;F.opacity.value=v.opacity;F.size.value=v.size;F.scale.value=oa.height/2;F.map.texture=v.map}else if(v instanceof THREE.MeshPhongMaterial){F.ambient.value=v.ambient;F.specular.value=v.specular;F.shininess.value=v.shininess}else if(v instanceof THREE.MeshDepthMaterial){F.mNear.value=n.near;F.mFar.value=n.far;F.opacity.value=v.opacity}else if(v instanceof
|
|
|
|
-THREE.MeshNormalMaterial)F.opacity.value=v.opacity;for(var w in F)if(M=P.uniforms[w]){V=F[w];J=V.type;x=V.value;if(J=="i")e.uniform1i(M,x);else if(J=="f")e.uniform1f(M,x);else if(J=="fv1")e.uniform1fv(M,x);else if(J=="fv")e.uniform3fv(M,x);else if(J=="v2")e.uniform2f(M,x.x,x.y);else if(J=="v3")e.uniform3f(M,x.x,x.y,x.z);else if(J=="v4")e.uniform4f(M,x.x,x.y,x.z,x.w);else if(J=="c")e.uniform3f(M,x.r,x.g,x.b);else if(J=="t"){e.uniform1i(M,x);if(V=V.texture)if(V.image instanceof Array&&V.image.length==
|
|
|
|
-6){if(V.image.length==6){if(V.needsUpdate){if(V.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,V.image.__webglTextureCube);for(J=0;J<6;++J)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,e.RGBA,e.UNSIGNED_BYTE,V.image[J])}else{V.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,V.image.__webglTextureCube);for(J=0;J<6;++J)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,V.image[J]);V.__webglInit=!0}L(e.TEXTURE_CUBE_MAP,V,V.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,
|
|
|
|
-null);V.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,V.image.__webglTextureCube)}}else Q(V,x)}}e.uniformMatrix4fv(K.modelViewMatrix,!1,z._modelViewMatrixArray);e.uniformMatrix3fv(K.normalMatrix,!1,z._normalMatrixArray);(v instanceof THREE.MeshShaderMaterial||v instanceof THREE.MeshPhongMaterial||v.envMap)&&K.cameraPosition!==null&&e.uniform3f(K.cameraPosition,n.position.x,n.position.y,n.position.z);(v instanceof THREE.MeshShaderMaterial||v.envMap||v.skinning)&&K.objectMatrix!==
|
|
|
|
-null&&e.uniformMatrix4fv(K.objectMatrix,!1,z._objectMatrixArray);(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshShaderMaterial||v.skinning)&&K.viewMatrix!==null&&e.uniformMatrix4fv(K.viewMatrix,!1,Za);if(v instanceof THREE.ShadowVolumeDynamicMaterial){n=F.directionalLightDirection.value;n[0]=-C[1].position.x;n[1]=-C[1].position.y;n[2]=-C[1].position.z;e.uniform3fv(K.directionalLightDirection,n);e.uniformMatrix4fv(K.objectMatrix,!1,z._objectMatrixArray);
|
|
|
|
-e.uniformMatrix4fv(K.viewMatrix,!1,Za)}if(v.skinning){e.uniformMatrix4fv(K.cameraInverseMatrix,!1,Za);e.uniformMatrix4fv(K.boneGlobalMatrices,!1,z.boneMatrices)}return P}function f(n,C,x,v,z,P){if(v.opacity!=0){var K;n=c(n,C,x,v,P).attributes;if(!v.morphTargets&&n.position>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}else{C=v.program.attributes;if(P.morphTargetBase!==-1){e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[P.morphTargetBase]);
|
|
|
|
-e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0)}else if(C.position>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0)}if(P.morphTargetForcedOrder.length){x=0;for(var F=P.morphTargetForcedOrder,V=P.morphTargetInfluences;x<v.numSupportedMorphTargets&&x<F.length;){e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[F[x]]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);P.__webglMorphTargetInfluences[x]=V[F[x]];x++}}else{F=[];var G=
|
|
|
|
--1,J=0;V=P.morphTargetInfluences;var M,Z=V.length;x=0;for(P.morphTargetBase!==-1&&(F[P.morphTargetBase]=!0);x<v.numSupportedMorphTargets;){for(M=0;M<Z;M++)if(!F[M]&&V[M]>G){J=M;G=V[J]}e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[J]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);P.__webglMorphTargetInfluences[x]=G;F[J]=1;G=-1;x++}}v.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(v.program.uniforms.morphTargetInfluences,P.__webglMorphTargetInfluences)}if(v.attributes)for(K in v.attributes)if(n[K]>=
|
|
|
|
-0){C=v.attributes[K];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(n[K],C.size,e.FLOAT,!1,0,0)}if(n.color>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglColorBuffer);e.vertexAttribPointer(n.color,3,e.FLOAT,!1,0,0)}if(n.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglNormalBuffer);e.vertexAttribPointer(n.normal,3,e.FLOAT,!1,0,0)}if(n.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglTangentBuffer);e.vertexAttribPointer(n.tangent,4,e.FLOAT,!1,0,0)}if(n.uv>=0)if(z.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
-z.__webglUVBuffer);e.vertexAttribPointer(n.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv)}else e.disableVertexAttribArray(n.uv);if(n.uv2>=0)if(z.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,z.__webglUV2Buffer);e.vertexAttribPointer(n.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv2)}else e.disableVertexAttribArray(n.uv2);if(v.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexABuffer);e.vertexAttribPointer(n.skinVertexA,
|
|
|
|
-4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexBBuffer);e.vertexAttribPointer(n.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinIndicesBuffer);e.vertexAttribPointer(n.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinWeightsBuffer);e.vertexAttribPointer(n.skinWeight,4,e.FLOAT,!1,0,0)}if(P instanceof THREE.Mesh){if(v.wireframe){e.lineWidth(v.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglLineBuffer);e.drawElements(e.LINES,
|
|
|
|
-z.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglFaceBuffer);e.drawElements(e.TRIANGLES,z.__webglFaceCount,e.UNSIGNED_SHORT,0)}ea.data.vertices+=z.__webglFaceCount;ea.data.faces+=z.__webglFaceCount/3;ea.data.drawCalls++}else if(P instanceof THREE.Line){P=P.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(P,0,z.__webglLineCount);ea.data.drawCalls++}else if(P instanceof THREE.ParticleSystem){e.drawArrays(e.POINTS,0,z.__webglParticleCount);
|
|
|
|
-ea.data.drawCalls++}else if(P instanceof THREE.Ribbon){e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount);ea.data.drawCalls++}}}function g(n,C,x){if(!n.__webglVertexBuffer)n.__webglVertexBuffer=e.createBuffer();if(!n.__webglNormalBuffer)n.__webglNormalBuffer=e.createBuffer();if(n.hasPos){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,
|
|
|
|
-!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(x==THREE.FlatShading){var v,z,P,K,F,V,G,J,M,Z,Y=n.count*3;for(Z=0;Z<Y;Z+=9){x=n.normalArray;v=x[Z];z=x[Z+1];P=x[Z+2];K=x[Z+3];V=x[Z+4];J=x[Z+5];F=x[Z+6];G=x[Z+7];M=x[Z+8];v=(v+K+F)/3;z=(z+V+G)/3;P=(P+J+M)/3;x[Z]=v;x[Z+1]=z;x[Z+2]=P;x[Z+3]=v;x[Z+4]=z;x[Z+5]=P;x[Z+6]=v;x[Z+7]=z;x[Z+8]=P}}e.bufferData(e.ARRAY_BUFFER,n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.normal);e.vertexAttribPointer(C.attributes.normal,
|
|
|
|
-3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,n.count);n.count=0}function h(n){if(wa!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);wa=n.doubleSided}if(ua!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ua=n.flipSided}}function j(n){if(ca!=n){n?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ca=n}}function k(n){ha[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);ha[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);ha[2].set(n.n41+n.n21,n.n42+n.n22,
|
|
|
|
-n.n43+n.n23,n.n44+n.n24);ha[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);ha[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);ha[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var C;for(n=0;n<6;n++){C=ha[n];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function m(n){for(var C=n.matrixWorld,x=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),v=0;v<6;v++){n=ha[v].x*C.n14+ha[v].y*C.n24+ha[v].z*C.n34+ha[v].w;if(n<=x)return!1}return!0}function o(n,
|
|
|
|
-C){n.list[n.count]=C;n.count+=1}function t(n){var C,x,v=n.object,z=n.opaque,P=n.transparent;P.count=0;n=z.count=0;for(C=v.materials.length;n<C;n++){x=v.materials[n];x.transparent?o(P,x):o(z,x)}}function p(n){var C,x,v,z,P=n.object,K=n.buffer,F=n.opaque,V=n.transparent;V.count=0;n=F.count=0;for(v=P.materials.length;n<v;n++){C=P.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(x=K.materials.length;C<x;C++)(z=K.materials[C])&&(z.transparent?o(V,z):o(F,z))}else(z=C)&&(z.transparent?o(V,z):
|
|
|
|
-o(F,z))}}function y(n,C){return C.z-n.z}function u(n){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);var C,x=n.lights.length,v,z=n.lights,P=[],K,F,V,G,J,M=n.__webglShadowVolumes.length;for(C=0;C<x;C++){v=n.lights[C];if(v instanceof THREE.DirectionalLight&&v.castShadow){P[0]=
|
|
|
|
--v.position.x;P[1]=-v.position.y;P[2]=-v.position.z;for(J=0;J<M;J++){v=n.__webglShadowVolumes[J].object;K=n.__webglShadowVolumes[J].buffer;F=v.materials[0];F.program||ea.initMaterial(F,z,undefined,v);F=F.program;V=F.uniforms;G=F.attributes;if(Aa!==F){e.useProgram(F);Aa=F;e.uniformMatrix4fv(V.projectionMatrix,!1,Xa);e.uniformMatrix4fv(V.viewMatrix,!1,Za);e.uniform3fv(V.directionalLightDirection,P)}v.matrixWorld.flattenToArray(v._objectMatrixArray);e.uniformMatrix4fv(V.objectMatrix,!1,v._objectMatrixArray);
|
|
|
|
-e.bindBuffer(e.ARRAY_BUFFER,K.__webglVertexBuffer);e.vertexAttribPointer(G.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,K.__webglNormalBuffer);e.vertexAttribPointer(G.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,K.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,
|
|
|
|
-0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);pa="";Aa=T.program;e.useProgram(T.program);e.uniformMatrix4fv(T.projectionLocation,!1,Xa);e.uniform1f(T.darknessLocation,T.darkness);e.bindBuffer(e.ARRAY_BUFFER,T.vertexBuffer);e.vertexAttribPointer(T.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(T.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,T.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,
|
|
|
|
-0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function A(n,C){var x,v,z;x=_sprite.attributes;var P=_sprite.uniforms,K=ja/Fa,F,V=[],G=Fa*0.5,J=ja*0.5,M=!0;e.useProgram(_sprite.program);Aa=_sprite.program;pa="";if(!La){e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);La=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.vertexAttribPointer(x.position,2,e.FLOAT,!1,
|
|
|
|
-16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(P.projectionMatrix,!1,Xa);e.activeTexture(e.TEXTURE0);e.uniform1i(P.map,0);x=0;for(v=n.__webglSprites.length;x<v;x++){z=n.__webglSprites[x];if(z.useScreenCoordinates)z.z=-z.position.z;else{z._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,z.matrixWorld,z._modelViewMatrixArray);z.z=-z._modelViewMatrix.n34}}n.__webglSprites.sort(y);x=0;for(v=n.__webglSprites.length;x<
|
|
|
|
-v;x++){z=n.__webglSprites[x];if(z.material===undefined&&z.map&&z.map.image&&z.map.image.width){if(z.useScreenCoordinates){e.uniform1i(P.useScreenCoordinates,1);e.uniform3f(P.screenPosition,(z.position.x-G)/G,(J-z.position.y)/J,Math.max(0,Math.min(1,z.position.z)))}else{e.uniform1i(P.useScreenCoordinates,0);e.uniform1i(P.affectedByDistance,z.affectedByDistance?1:0);e.uniformMatrix4fv(P.modelViewMatrix,!1,z._modelViewMatrixArray)}F=z.map.image.width/(z.affectedByDistance?1:ja);V[0]=F*K*z.scale.x;V[1]=
|
|
|
|
-F*z.scale.y;e.uniform2f(P.uvScale,z.uvScale.x,z.uvScale.y);e.uniform2f(P.uvOffset,z.uvOffset.x,z.uvOffset.y);e.uniform2f(P.alignment,z.alignment.x,z.alignment.y);e.uniform1f(P.opacity,z.opacity);e.uniform1f(P.rotation,z.rotation);e.uniform2fv(P.scale,V);if(z.mergeWith3D&&!M){e.enable(e.DEPTH_TEST);M=!0}else if(!z.mergeWith3D&&M){e.disable(e.DEPTH_TEST);M=!1}R(z.blending);Q(z.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function I(n,
|
|
|
|
-C){var x,v,z=n.__webglLensFlares.length,P,K,F,V=new THREE.Vector3,G=ja/Fa,J=Fa*0.5,M=ja*0.5,Z=16/ja,Y=[Z*G,Z],sa=[1,1,0],Ka=[1,1],Ca=O.uniforms;x=O.attributes;e.useProgram(O.program);Aa=O.program;pa="";if(!Ba){e.enableVertexAttribArray(O.attributes.vertex);e.enableVertexAttribArray(O.attributes.uv);Ba=!0}e.uniform1i(Ca.occlusionMap,0);e.uniform1i(Ca.map,1);e.bindBuffer(e.ARRAY_BUFFER,O.vertexBuffer);e.vertexAttribPointer(x.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-O.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,O.occlusionTexture);e.activeTexture(e.TEXTURE1);for(v=0;v<z;v++){x=n.__webglLensFlares[v].object;V.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(V);C.projectionMatrix.multiplyVector3(V);sa[0]=V.x;sa[1]=V.y;sa[2]=V.z;Ka[0]=sa[0]*J+J;Ka[1]=sa[1]*M+M;if(O.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ja){e.bindTexture(e.TEXTURE_2D,O.tempTexture);
|
|
|
|
-e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,0);e.uniform2fv(Ca.scale,Y);e.uniform3fv(Ca.screenPosition,sa);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,O.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,O.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=
|
|
|
|
-sa[0];x.positionScreen.y=sa[1];x.positionScreen.z=sa[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(Ca.renderType,2);e.enable(e.BLEND);P=0;for(K=x.lensFlares.length;P<K;P++){F=x.lensFlares[P];if(F.opacity>0.0010&&F.scale>0.0010){sa[0]=F.x;sa[1]=F.y;sa[2]=F.z;Z=F.size*F.scale/ja;Y[0]=Z*G;Y[1]=Z;e.uniform3fv(Ca.screenPosition,sa);e.uniform2fv(Ca.scale,Y);e.uniform1f(Ca.rotation,F.rotation);e.uniform1f(Ca.opacity,F.opacity);R(F.blending);Q(F.texture,1);e.drawElements(e.TRIANGLES,
|
|
|
|
-6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function H(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function B(n){var C,x,v,z,P;if(n instanceof THREE.Mesh){x=n.geometry;for(C in x.geometryGroups){v=x.geometryGroups[C];P=!1;for(z in v.__webglCustomAttributes)if(v.__webglCustomAttributes[z].needsUpdate){P=!0;break}if(x.__dirtyVertices||
|
|
|
|
-x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||P){P=e.DYNAMIC_DRAW;var K=void 0,F=void 0,V=void 0,G=void 0;V=void 0;var J=void 0,M=void 0,Z=void 0,Y=void 0,sa=void 0,Ka=void 0,Ca=void 0,Ha=void 0,Ga=void 0,xa=void 0,Ea=void 0,za=void 0,Ua=void 0;M=void 0;Z=void 0;G=void 0;Y=void 0;G=void 0;var E=void 0,aa=void 0;M=void 0;E=void 0;aa=void 0;var w=void 0,ab=void 0;E=void 0;aa=void 0;w=void 0;ab=void 0;E=void 0;aa=void 0;w=void 0;ab=void 0;
|
|
|
|
-E=void 0;aa=void 0;w=void 0;G=void 0;Y=void 0;J=void 0;V=void 0;V=void 0;E=void 0;aa=void 0;w=void 0;var fb=void 0,Oa=0,Qa=0,cb=0,hb=0,Wa=0,$a=0,Ma=0,bb=0,Va=0,N=0,Na=0;aa=E=0;var Ra=v.__vertexArray,ib=v.__uvArray,jb=v.__uv2Array,Pa=v.__normalArray,W=v.__tangentArray,na=v.__colorArray,ia=v.__skinVertexAArray,$=v.__skinVertexBArray,va=v.__skinIndexArray,ta=v.__skinWeightArray,ya=v.__morphTargetsArrays,X=v.__webglCustomAttributes;w=void 0;var Ia=v.__faceArray,Ya=v.__lineArray,eb=v.__needsSmoothNormals;
|
|
|
|
-Ka=v.__vertexColorType;sa=v.__uvType;Ca=v.__normalType;var Sa=n.geometry,kb=Sa.__dirtyVertices,gb=Sa.__dirtyElements,db=Sa.__dirtyUvs,rb=Sa.__dirtyNormals,sb=Sa.__dirtyTangents,tb=Sa.__dirtyColors,ub=Sa.__dirtyMorphTargets,nb=Sa.vertices,vb=v.faces,yb=Sa.faces,wb=Sa.faceVertexUvs[0],xb=Sa.faceVertexUvs[1],ob=Sa.skinVerticesA,pb=Sa.skinVerticesB,qb=Sa.skinIndices,lb=Sa.skinWeights,mb=n instanceof THREE.ShadowVolume?Sa.edgeFaces:undefined;morphTargets=Sa.morphTargets;if(X)for(fb in X){X[fb].offset=
|
|
|
|
-0;X[fb].offsetSrc=0}K=0;for(F=vb.length;K<F;K++){V=vb[K];G=yb[V];wb&&(Ha=wb[V]);xb&&(Ga=xb[V]);V=G.vertexNormals;J=G.normal;M=G.vertexColors;Z=G.color;Y=G.vertexTangents;if(G instanceof THREE.Face3){if(kb){xa=nb[G.a].position;Ea=nb[G.b].position;za=nb[G.c].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Qa+=9}if(X)for(fb in X){w=X[fb];if(w.needsUpdate){E=w.offset;aa=w.offsetSrc;if(w.size===1){if(w.boundTo===undefined||
|
|
|
|
-w.boundTo==="vertices"){w.array[E+0]=w.value[G.a];w.array[E+1]=w.value[G.b];w.array[E+2]=w.value[G.c]}else if(w.boundTo==="faces"){w.array[E+0]=w.value[aa];w.array[E+1]=w.value[aa];w.array[E+2]=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){w.array[E+0]=w.value[aa+0];w.array[E+1]=w.value[aa+1];w.array[E+2]=w.value[aa+2];w.offsetSrc+=3}w.offset+=3}else{if(w.boundTo===undefined||w.boundTo==="vertices"){xa=w.value[G.a];Ea=w.value[G.b];za=w.value[G.c]}else if(w.boundTo==="faces"){xa=w.value[aa];
|
|
|
|
-Ea=w.value[aa];za=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){xa=w.value[aa+0];Ea=w.value[aa+1];za=w.value[aa+2];w.offsetSrc+=3}if(w.size===2){w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=Ea.x;w.array[E+3]=Ea.y;w.array[E+4]=za.x;w.array[E+5]=za.y;w.offset+=6}else if(w.size===3){if(w.type==="c"){w.array[E+0]=xa.r;w.array[E+1]=xa.g;w.array[E+2]=xa.b;w.array[E+3]=Ea.r;w.array[E+4]=Ea.g;w.array[E+5]=Ea.b;w.array[E+6]=za.r;w.array[E+7]=za.g;w.array[E+8]=za.b}else{w.array[E+0]=xa.x;
|
|
|
|
-w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=Ea.x;w.array[E+4]=Ea.y;w.array[E+5]=Ea.z;w.array[E+6]=za.x;w.array[E+7]=za.y;w.array[E+8]=za.z}w.offset+=9}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=xa.w;w.array[E+4]=Ea.x;w.array[E+5]=Ea.y;w.array[E+6]=Ea.z;w.array[E+7]=Ea.w;w.array[E+8]=za.x;w.array[E+9]=za.y;w.array[E+10]=za.z;w.array[E+11]=za.w;w.offset+=12}}}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){xa=morphTargets[E].vertices[G.a].position;Ea=morphTargets[E].vertices[G.b].position;
|
|
|
|
-za=morphTargets[E].vertices[G.c].position;w=ya[E];w[Na+0]=xa.x;w[Na+1]=xa.y;w[Na+2]=xa.z;w[Na+3]=Ea.x;w[Na+4]=Ea.y;w[Na+5]=Ea.z;w[Na+6]=za.x;w[Na+7]=za.y;w[Na+8]=za.z}Na+=9}if(lb.length){E=lb[G.a];aa=lb[G.b];w=lb[G.c];ta[N]=E.x;ta[N+1]=E.y;ta[N+2]=E.z;ta[N+3]=E.w;ta[N+4]=aa.x;ta[N+5]=aa.y;ta[N+6]=aa.z;ta[N+7]=aa.w;ta[N+8]=w.x;ta[N+9]=w.y;ta[N+10]=w.z;ta[N+11]=w.w;E=qb[G.a];aa=qb[G.b];w=qb[G.c];va[N]=E.x;va[N+1]=E.y;va[N+2]=E.z;va[N+3]=E.w;va[N+4]=aa.x;va[N+5]=aa.y;va[N+6]=aa.z;va[N+7]=aa.w;va[N+8]=
|
|
|
|
-w.x;va[N+9]=w.y;va[N+10]=w.z;va[N+11]=w.w;E=ob[G.a];aa=ob[G.b];w=ob[G.c];ia[N]=E.x;ia[N+1]=E.y;ia[N+2]=E.z;ia[N+3]=1;ia[N+4]=aa.x;ia[N+5]=aa.y;ia[N+6]=aa.z;ia[N+7]=1;ia[N+8]=w.x;ia[N+9]=w.y;ia[N+10]=w.z;ia[N+11]=1;E=pb[G.a];aa=pb[G.b];w=pb[G.c];$[N]=E.x;$[N+1]=E.y;$[N+2]=E.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=w.x;$[N+9]=w.y;$[N+10]=w.z;$[N+11]=1;N+=12}if(tb&&Ka){if(M.length==3&&Ka==THREE.VertexColors){G=M[0];E=M[1];aa=M[2]}else aa=E=G=Z;na[Va]=G.r;na[Va+1]=G.g;na[Va+2]=G.b;
|
|
|
|
-na[Va+3]=E.r;na[Va+4]=E.g;na[Va+5]=E.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;Va+=9}if(sb&&Sa.hasTangents){M=Y[0];Z=Y[1];G=Y[2];W[Ma]=M.x;W[Ma+1]=M.y;W[Ma+2]=M.z;W[Ma+3]=M.w;W[Ma+4]=Z.x;W[Ma+5]=Z.y;W[Ma+6]=Z.z;W[Ma+7]=Z.w;W[Ma+8]=G.x;W[Ma+9]=G.y;W[Ma+10]=G.z;W[Ma+11]=G.w;Ma+=12}if(rb&&Ca)if(V.length==3&&eb)for(Y=0;Y<3;Y++){J=V[Y];Pa[$a]=J.x;Pa[$a+1]=J.y;Pa[$a+2]=J.z;$a+=3}else for(Y=0;Y<3;Y++){Pa[$a]=J.x;Pa[$a+1]=J.y;Pa[$a+2]=J.z;$a+=3}if(db&&Ha!==undefined&&sa)for(Y=0;Y<3;Y++){V=Ha[Y];ib[cb]=
|
|
|
|
-V.u;ib[cb+1]=V.v;cb+=2}if(db&&Ga!==undefined&&sa)for(Y=0;Y<3;Y++){V=Ga[Y];jb[hb]=V.u;jb[hb+1]=V.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+2;Wa+=3;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+2;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;bb+=6;Oa+=3}}else if(G instanceof THREE.Face4){if(kb){xa=nb[G.a].position;Ea=nb[G.b].position;za=nb[G.c].position;Ua=nb[G.d].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Ra[Qa+9]=Ua.x;
|
|
|
|
-Ra[Qa+10]=Ua.y;Ra[Qa+11]=Ua.z;Qa+=12}if(X)for(fb in X){w=X[fb];if(w.needsUpdate){E=w.offset;aa=w.offsetSrc;if(w.size===1){if(w.boundTo===undefined||w.boundTo==="vertices"){w.array[E+0]=w.value[G.a];w.array[E+1]=w.value[G.b];w.array[E+2]=w.value[G.c];w.array[E+3]=w.value[G.d]}else if(w.boundTo==="faces"){w.array[E+0]=w.value[aa];w.array[E+1]=w.value[aa];w.array[E+2]=w.value[aa];w.array[E+3]=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){w.array[E+0]=w.value[aa+0];w.array[E+1]=w.value[aa+
|
|
|
|
-1];w.array[E+2]=w.value[aa+2];w.array[E+3]=w.value[aa+3];w.offsetSrc+=4}w.offset+=4}else{if(w.boundTo===undefined||w.boundTo==="vertices"){xa=w.value[G.a];Ea=w.value[G.b];za=w.value[G.c];Ua=w.value[G.d]}else if(w.boundTo==="faces"){xa=w.value[aa];Ea=w.value[aa];za=w.value[aa];Ua=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){xa=w.value[aa+0];Ea=w.value[aa+1];za=w.value[aa+2];Ua=w.value[aa+3];w.offsetSrc+=4}if(w.size===2){w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=Ea.x;w.array[E+
|
|
|
|
-3]=Ea.y;w.array[E+4]=za.x;w.array[E+5]=za.y;w.array[E+6]=Ua.x;w.array[E+7]=Ua.y;w.offset+=8}else if(w.size===3){if(w.type==="c"){w.array[E+0]=xa.r;w.array[E+1]=xa.g;w.array[E+2]=xa.b;w.array[E+3]=Ea.r;w.array[E+4]=Ea.g;w.array[E+5]=Ea.b;w.array[E+6]=za.r;w.array[E+7]=za.g;w.array[E+8]=za.b;w.array[E+9]=Ua.r;w.array[E+10]=Ua.g;w.array[E+11]=Ua.b}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=Ea.x;w.array[E+4]=Ea.y;w.array[E+5]=Ea.z;w.array[E+6]=za.x;w.array[E+7]=za.y;w.array[E+
|
|
|
|
-8]=za.z;w.array[E+9]=Ua.x;w.array[E+10]=Ua.y;w.array[E+11]=Ua.z}w.offset+=12}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=xa.w;w.array[E+4]=Ea.x;w.array[E+5]=Ea.y;w.array[E+6]=Ea.z;w.array[E+7]=Ea.w;w.array[E+8]=za.x;w.array[E+9]=za.y;w.array[E+10]=za.z;w.array[E+11]=za.w;w.array[E+12]=Ua.x;w.array[E+13]=Ua.y;w.array[E+14]=Ua.z;w.array[E+15]=Ua.w;w.offset+=16}}}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){xa=morphTargets[E].vertices[G.a].position;Ea=morphTargets[E].vertices[G.b].position;
|
|
|
|
-za=morphTargets[E].vertices[G.c].position;Ua=morphTargets[E].vertices[G.d].position;w=ya[E];w[Na+0]=xa.x;w[Na+1]=xa.y;w[Na+2]=xa.z;w[Na+3]=Ea.x;w[Na+4]=Ea.y;w[Na+5]=Ea.z;w[Na+6]=za.x;w[Na+7]=za.y;w[Na+8]=za.z;w[Na+9]=Ua.x;w[Na+10]=Ua.y;w[Na+11]=Ua.z}Na+=12}if(lb.length){E=lb[G.a];aa=lb[G.b];w=lb[G.c];ab=lb[G.d];ta[N]=E.x;ta[N+1]=E.y;ta[N+2]=E.z;ta[N+3]=E.w;ta[N+4]=aa.x;ta[N+5]=aa.y;ta[N+6]=aa.z;ta[N+7]=aa.w;ta[N+8]=w.x;ta[N+9]=w.y;ta[N+10]=w.z;ta[N+11]=w.w;ta[N+12]=ab.x;ta[N+13]=ab.y;ta[N+14]=ab.z;
|
|
|
|
-ta[N+15]=ab.w;E=qb[G.a];aa=qb[G.b];w=qb[G.c];ab=qb[G.d];va[N]=E.x;va[N+1]=E.y;va[N+2]=E.z;va[N+3]=E.w;va[N+4]=aa.x;va[N+5]=aa.y;va[N+6]=aa.z;va[N+7]=aa.w;va[N+8]=w.x;va[N+9]=w.y;va[N+10]=w.z;va[N+11]=w.w;va[N+12]=ab.x;va[N+13]=ab.y;va[N+14]=ab.z;va[N+15]=ab.w;E=ob[G.a];aa=ob[G.b];w=ob[G.c];ab=ob[G.d];ia[N]=E.x;ia[N+1]=E.y;ia[N+2]=E.z;ia[N+3]=1;ia[N+4]=aa.x;ia[N+5]=aa.y;ia[N+6]=aa.z;ia[N+7]=1;ia[N+8]=w.x;ia[N+9]=w.y;ia[N+10]=w.z;ia[N+11]=1;ia[N+12]=ab.x;ia[N+13]=ab.y;ia[N+14]=ab.z;ia[N+15]=1;E=pb[G.a];
|
|
|
|
-aa=pb[G.b];w=pb[G.c];G=pb[G.d];$[N]=E.x;$[N+1]=E.y;$[N+2]=E.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=w.x;$[N+9]=w.y;$[N+10]=w.z;$[N+11]=1;$[N+12]=G.x;$[N+13]=G.y;$[N+14]=G.z;$[N+15]=1;N+=16}if(tb&&Ka){if(M.length==4&&Ka==THREE.VertexColors){G=M[0];E=M[1];aa=M[2];M=M[3]}else M=aa=E=G=Z;na[Va]=G.r;na[Va+1]=G.g;na[Va+2]=G.b;na[Va+3]=E.r;na[Va+4]=E.g;na[Va+5]=E.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;na[Va+9]=M.r;na[Va+10]=M.g;na[Va+11]=M.b;Va+=12}if(sb&&Sa.hasTangents){M=Y[0];
|
|
|
|
-Z=Y[1];G=Y[2];Y=Y[3];W[Ma]=M.x;W[Ma+1]=M.y;W[Ma+2]=M.z;W[Ma+3]=M.w;W[Ma+4]=Z.x;W[Ma+5]=Z.y;W[Ma+6]=Z.z;W[Ma+7]=Z.w;W[Ma+8]=G.x;W[Ma+9]=G.y;W[Ma+10]=G.z;W[Ma+11]=G.w;W[Ma+12]=Y.x;W[Ma+13]=Y.y;W[Ma+14]=Y.z;W[Ma+15]=Y.w;Ma+=16}if(rb&&Ca)if(V.length==4&&eb)for(Y=0;Y<4;Y++){J=V[Y];Pa[$a]=J.x;Pa[$a+1]=J.y;Pa[$a+2]=J.z;$a+=3}else for(Y=0;Y<4;Y++){Pa[$a]=J.x;Pa[$a+1]=J.y;Pa[$a+2]=J.z;$a+=3}if(db&&Ha!==undefined&&sa)for(Y=0;Y<4;Y++){V=Ha[Y];ib[cb]=V.u;ib[cb+1]=V.v;cb+=2}if(db&&Ga!==undefined&&sa)for(Y=0;Y<
|
|
|
|
-4;Y++){V=Ga[Y];jb[hb]=V.u;jb[hb+1]=V.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+3;Ia[Wa+3]=Oa+1;Ia[Wa+4]=Oa+2;Ia[Wa+5]=Oa+3;Wa+=6;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+3;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;Ya[bb+6]=Oa+2;Ya[bb+7]=Oa+3;bb+=8;Oa+=4}}}if(mb){K=0;for(F=mb.length;K<F;K++){Ia[Wa]=mb[K].a;Ia[Wa+1]=mb[K].b;Ia[Wa+2]=mb[K].c;Ia[Wa+3]=mb[K].a;Ia[Wa+4]=mb[K].c;Ia[Wa+5]=mb[K].d;Wa+=6}}if(kb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,P)}if(X)for(fb in X){w=
|
|
|
|
-X[fb];if(w.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,w.buffer);e.bufferData(e.ARRAY_BUFFER,w.array,P);w.needsUpdate=!1}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){e.bindBuffer(e.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[E]);e.bufferData(e.ARRAY_BUFFER,ya[E],P)}}if(tb&&Va>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,P)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,P)}if(sb&&Sa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
-v.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,W,P)}if(db&&cb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,P)}if(db&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,jb,P)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,P);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,P)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexABuffer);
|
|
|
|
-e.bufferData(e.ARRAY_BUFFER,ia,P);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,$,P);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,va,P);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ta,P)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){x=n.geometry;if(x.__dirtyVertices||
|
|
|
|
-x.__dirtyColors){n=x;C=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;P=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<Ca;F++){sa=Ka[F].position;z=F*3;Ha[z]=sa.x;Ha[z+1]=sa.y;Ha[z+2]=sa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(Ga){for(F=0;F<P;F++){color=v[F];z=F*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}x.__dirtyVertices=
|
|
|
|
-!1;x.__dirtyColors=!1}else if(n instanceof THREE.Line){x=n.geometry;if(x.__dirtyVertices||x.__dirtyColors){n=x;C=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;P=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<Ca;F++){sa=Ka[F].position;z=F*3;Ha[z]=sa.x;Ha[z+1]=sa.y;Ha[z+2]=sa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(Ga){for(F=0;F<P;F++){color=v[F];z=F*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
-n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){x=n.geometry;(x.__dirtyVertices||x.__dirtyColors||n.sortParticles)&&d(x,e.DYNAMIC_DRAW,n);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function U(n){function C(Z){var Y=[];x=0;for(v=Z.length;x<v;x++)Z[x]==undefined?Y.push("undefined"):Y.push(Z[x].id);return Y.join("_")}var x,v,z,P,K,F,V,G,J={},M=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};
|
|
|
|
-z=0;for(P=n.faces.length;z<P;z++){K=n.faces[z];F=K.materials;V=C(F);J[V]==undefined&&(J[V]={hash:V,counter:0});G=J[V].hash+"_"+J[V].counter;n.geometryGroups[G]==undefined&&(n.geometryGroups[G]={faces:[],materials:F,vertices:0,numMorphTargets:M});K=K instanceof THREE.Face3?3:4;if(n.geometryGroups[G].vertices+K>65535){J[V].counter+=1;G=J[V].hash+"_"+J[V].counter;n.geometryGroups[G]==undefined&&(n.geometryGroups[G]={faces:[],materials:F,vertices:0,numMorphTargets:M})}n.geometryGroups[G].faces.push(z);
|
|
|
|
-n.geometryGroups[G].vertices+=K}}function D(n,C,x){n.push({buffer:C,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function R(n){if(n!=pa){switch(n){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,
|
|
|
|
-e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}pa=n}}function L(n,C,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,ga(C.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,ga(C.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,ga(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ga(C.minFilter));e.generateMipmap(n)}else{e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);
|
|
|
|
-e.texParameteri(n,e.TEXTURE_MAG_FILTER,ra(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ra(C.minFilter))}}function Q(n,C){if(n.needsUpdate){if(n.__webglInit){e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n.image)}else{n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n.image);n.__webglInit=!0}L(e.TEXTURE_2D,n,n.image);e.bindTexture(e.TEXTURE_2D,null);
|
|
|
|
-n.needsUpdate=!1}e.activeTexture(e.TEXTURE0+C);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function qa(n){if(n&&!n.__webglFramebuffer){if(n.depthBuffer===undefined)n.depthBuffer=!0;if(n.stencilBuffer===undefined)n.stencilBuffer=!0;n.__webglFramebuffer=e.createFramebuffer();n.__webglRenderbuffer=e.createRenderbuffer();n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,ga(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,
|
|
|
|
-ga(n.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,ga(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,ga(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,ga(n.format),n.width,n.height,0,ga(n.format),ga(n.type),null);e.bindRenderbuffer(e.RENDERBUFFER,n.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.__webglTexture,0);if(n.depthBuffer&&!n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,
|
|
|
|
|
|
+THREE.WebGLRenderer=function(b){function d(n,C,w){var v,A,K,J=n.vertices,I=J.length,S=n.colors,D=S.length,M=n.__vertexArray,N=n.__colorArray,Z=n.__sortArray,V=n.__dirtyVertices,Aa=n.__dirtyColors;if(w.sortParticles){Ia.multiplySelf(w.matrixWorld);for(v=0;v<I;v++){A=J[v].position;Ra.copy(A);Ia.multiplyVector3(Ra);Z[v]=[Ra.z,v]}Z.sort(function(Ka,Ba){return Ba[0]-Ka[0]});for(v=0;v<I;v++){A=J[Z[v][1]].position;K=v*3;M[K]=A.x;M[K+1]=A.y;M[K+2]=A.z}for(v=0;v<D;v++){K=v*3;color=S[Z[v][1]];N[K]=color.r;
|
|
|
|
+N[K+1]=color.g;N[K+2]=color.b}}else{if(V)for(v=0;v<I;v++){A=J[v].position;K=v*3;M[K]=A.x;M[K+1]=A.y;M[K+2]=A.z}if(Aa)for(v=0;v<D;v++){color=S[v];K=v*3;N[K]=color.r;N[K+1]=color.g;N[K+2]=color.b}}if(V||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,M,C)}if(Aa||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,N,C)}}function c(n,C,w,v,A){v.program||fa.initMaterial(v,C,w,A);var K=v.program,J=K.uniforms,I=v.uniforms;
|
|
|
|
+if(K!=Da){e.useProgram(K);Da=K}e.uniformMatrix4fv(J.projectionMatrix,!1,Ya);if(w&&(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial||v instanceof THREE.LineBasicMaterial||v instanceof THREE.ParticleBasicMaterial||v.fog)){I.fogColor.value=w.color;if(w instanceof THREE.Fog){I.fogNear.value=w.near;I.fogFar.value=w.far}else if(w instanceof THREE.FogExp2)I.fogDensity.value=w.density}if(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||
|
|
|
|
+v.lights){var S,D,M=0,N=0,Z=0,V,Aa,Ka,Ba,ya=Q,Oa=ya.directional.colors,Ga=ya.directional.positions,za=ya.point.colors,Ha=ya.point.positions,Ua=ya.point.distances,F=0,da=0;w=D=Ba=0;for(S=C.length;w<S;w++){D=C[w];V=D.color;Aa=D.position;Ka=D.intensity;Ba=D.distance;if(D instanceof THREE.AmbientLight){M+=V.r;N+=V.g;Z+=V.b}else if(D instanceof THREE.DirectionalLight){Ba=F*3;Oa[Ba]=V.r*Ka;Oa[Ba+1]=V.g*Ka;Oa[Ba+2]=V.b*Ka;Ga[Ba]=Aa.x;Ga[Ba+1]=Aa.y;Ga[Ba+2]=Aa.z;F+=1}else if(D instanceof THREE.PointLight){D=
|
|
|
|
+da*3;za[D]=V.r*Ka;za[D+1]=V.g*Ka;za[D+2]=V.b*Ka;Ha[D]=Aa.x;Ha[D+1]=Aa.y;Ha[D+2]=Aa.z;Ua[da]=Ba;da+=1}}for(w=F*3;w<Oa.length;w++)Oa[w]=0;for(w=da*3;w<za.length;w++)za[w]=0;ya.point.length=da;ya.directional.length=F;ya.ambient[0]=M;ya.ambient[1]=N;ya.ambient[2]=Z;w=Q;I.enableLighting.value=w.directional.length+w.point.length;I.ambientLightColor.value=w.ambient;I.directionalLightColor.value=w.directional.colors;I.directionalLightDirection.value=w.directional.positions;I.pointLightColor.value=w.point.colors;
|
|
|
|
+I.pointLightPosition.value=w.point.positions;I.pointLightDistance.value=w.point.distances}if(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial){I.diffuse.value=v.color;I.opacity.value=v.opacity;I.map.texture=v.map;I.lightMap.texture=v.lightMap;I.envMap.texture=v.envMap;I.reflectivity.value=v.reflectivity;I.refractionRatio.value=v.refractionRatio;I.combine.value=v.combine;I.useRefract.value=v.envMap&&v.envMap.mapping instanceof THREE.CubeRefractionMapping}if(v instanceof
|
|
|
|
+THREE.LineBasicMaterial){I.diffuse.value=v.color;I.opacity.value=v.opacity}else if(v instanceof THREE.ParticleBasicMaterial){I.psColor.value=v.color;I.opacity.value=v.opacity;I.size.value=v.size;I.scale.value=qa.height/2;I.map.texture=v.map}else if(v instanceof THREE.MeshPhongMaterial){I.ambient.value=v.ambient;I.specular.value=v.specular;I.shininess.value=v.shininess}else if(v instanceof THREE.MeshDepthMaterial){I.mNear.value=n.near;I.mFar.value=n.far;I.opacity.value=v.opacity}else if(v instanceof
|
|
|
|
+THREE.MeshNormalMaterial)I.opacity.value=v.opacity;for(var x in I)if(N=K.uniforms[x]){S=I[x];M=S.type;w=S.value;if(M=="i")e.uniform1i(N,w);else if(M=="f")e.uniform1f(N,w);else if(M=="fv1")e.uniform1fv(N,w);else if(M=="fv")e.uniform3fv(N,w);else if(M=="v2")e.uniform2f(N,w.x,w.y);else if(M=="v3")e.uniform3f(N,w.x,w.y,w.z);else if(M=="v4")e.uniform4f(N,w.x,w.y,w.z,w.w);else if(M=="c")e.uniform3f(N,w.r,w.g,w.b);else if(M=="t"){e.uniform1i(N,w);if(S=S.texture)if(S.image instanceof Array&&S.image.length==
|
|
|
|
+6){if(S.image.length==6){if(S.needsUpdate){if(S.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,S.image.__webglTextureCube);for(M=0;M<6;++M)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+M,0,0,0,e.RGBA,e.UNSIGNED_BYTE,S.image[M])}else{S.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,S.image.__webglTextureCube);for(M=0;M<6;++M)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+M,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,S.image[M]);S.__webglInit=!0}L(e.TEXTURE_CUBE_MAP,S,S.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,
|
|
|
|
+null);S.needsUpdate=!1}e.activeTexture(e.TEXTURE0+w);e.bindTexture(e.TEXTURE_CUBE_MAP,S.image.__webglTextureCube)}}else O(S,w)}}e.uniformMatrix4fv(J.modelViewMatrix,!1,A._modelViewMatrixArray);e.uniformMatrix3fv(J.normalMatrix,!1,A._normalMatrixArray);(v instanceof THREE.MeshShaderMaterial||v instanceof THREE.MeshPhongMaterial||v.envMap)&&J.cameraPosition!==null&&e.uniform3f(J.cameraPosition,n.position.x,n.position.y,n.position.z);(v instanceof THREE.MeshShaderMaterial||v.envMap||v.skinning)&&J.objectMatrix!==
|
|
|
|
+null&&e.uniformMatrix4fv(J.objectMatrix,!1,A._objectMatrixArray);(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshShaderMaterial||v.skinning)&&J.viewMatrix!==null&&e.uniformMatrix4fv(J.viewMatrix,!1,ab);if(v instanceof THREE.ShadowVolumeDynamicMaterial){n=I.directionalLightDirection.value;n[0]=-C[1].position.x;n[1]=-C[1].position.y;n[2]=-C[1].position.z;e.uniform3fv(J.directionalLightDirection,n);e.uniformMatrix4fv(J.objectMatrix,!1,A._objectMatrixArray);
|
|
|
|
+e.uniformMatrix4fv(J.viewMatrix,!1,ab)}if(v.skinning){e.uniformMatrix4fv(J.cameraInverseMatrix,!1,ab);e.uniformMatrix4fv(J.boneGlobalMatrices,!1,A.boneMatrices)}return K}function f(n,C,w,v,A,K){if(v.opacity!=0){var J;n=c(n,C,w,v,K).attributes;if(!v.morphTargets&&n.position>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}else{C=v.program.attributes;if(K.morphTargetBase!==-1){e.bindBuffer(e.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[K.morphTargetBase]);
|
|
|
|
+e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0)}else if(C.position>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0)}if(K.morphTargetForcedOrder.length){w=0;for(var I=K.morphTargetForcedOrder,S=K.morphTargetInfluences;w<v.numSupportedMorphTargets&&w<I.length;){e.bindBuffer(e.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[I[w]]);e.vertexAttribPointer(C["morphTarget"+w],3,e.FLOAT,!1,0,0);K.__webglMorphTargetInfluences[w]=S[I[w]];w++}}else{I=[];var D=
|
|
|
|
+-1,M=0;S=K.morphTargetInfluences;var N,Z=S.length;w=0;for(K.morphTargetBase!==-1&&(I[K.morphTargetBase]=!0);w<v.numSupportedMorphTargets;){for(N=0;N<Z;N++)if(!I[N]&&S[N]>D){M=N;D=S[M]}e.bindBuffer(e.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[M]);e.vertexAttribPointer(C["morphTarget"+w],3,e.FLOAT,!1,0,0);K.__webglMorphTargetInfluences[w]=D;I[M]=1;D=-1;w++}}v.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(v.program.uniforms.morphTargetInfluences,K.__webglMorphTargetInfluences)}if(v.attributes)for(J in v.attributes)if(n[J]>=
|
|
|
|
+0){C=v.attributes[J];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(n[J],C.size,e.FLOAT,!1,0,0)}if(n.color>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglColorBuffer);e.vertexAttribPointer(n.color,3,e.FLOAT,!1,0,0)}if(n.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglNormalBuffer);e.vertexAttribPointer(n.normal,3,e.FLOAT,!1,0,0)}if(n.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglTangentBuffer);e.vertexAttribPointer(n.tangent,4,e.FLOAT,!1,0,0)}if(n.uv>=0)if(A.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
+A.__webglUVBuffer);e.vertexAttribPointer(n.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv)}else e.disableVertexAttribArray(n.uv);if(n.uv2>=0)if(A.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,A.__webglUV2Buffer);e.vertexAttribPointer(n.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv2)}else e.disableVertexAttribArray(n.uv2);if(v.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinVertexABuffer);e.vertexAttribPointer(n.skinVertexA,
|
|
|
|
+4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinVertexBBuffer);e.vertexAttribPointer(n.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinIndicesBuffer);e.vertexAttribPointer(n.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinWeightsBuffer);e.vertexAttribPointer(n.skinWeight,4,e.FLOAT,!1,0,0)}if(K instanceof THREE.Mesh){if(v.wireframe){e.lineWidth(v.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webglLineBuffer);e.drawElements(e.LINES,
|
|
|
|
+A.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webglFaceBuffer);e.drawElements(e.TRIANGLES,A.__webglFaceCount,e.UNSIGNED_SHORT,0)}fa.data.vertices+=A.__webglFaceCount;fa.data.faces+=A.__webglFaceCount/3;fa.data.drawCalls++}else if(K instanceof THREE.Line){K=K.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(K,0,A.__webglLineCount);fa.data.drawCalls++}else if(K instanceof THREE.ParticleSystem){e.drawArrays(e.POINTS,0,A.__webglParticleCount);
|
|
|
|
+fa.data.drawCalls++}else if(K instanceof THREE.Ribbon){e.drawArrays(e.TRIANGLE_STRIP,0,A.__webglVertexCount);fa.data.drawCalls++}}}function g(n,C,w){if(!n.__webglVertexBuffer)n.__webglVertexBuffer=e.createBuffer();if(!n.__webglNormalBuffer)n.__webglNormalBuffer=e.createBuffer();if(n.hasPos){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,
|
|
|
|
+!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(w==THREE.FlatShading){var v,A,K,J,I,S,D,M,N,Z,V=n.count*3;for(Z=0;Z<V;Z+=9){w=n.normalArray;v=w[Z];A=w[Z+1];K=w[Z+2];J=w[Z+3];S=w[Z+4];M=w[Z+5];I=w[Z+6];D=w[Z+7];N=w[Z+8];v=(v+J+I)/3;A=(A+S+D)/3;K=(K+M+N)/3;w[Z]=v;w[Z+1]=A;w[Z+2]=K;w[Z+3]=v;w[Z+4]=A;w[Z+5]=K;w[Z+6]=v;w[Z+7]=A;w[Z+8]=K}}e.bufferData(e.ARRAY_BUFFER,n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.normal);e.vertexAttribPointer(C.attributes.normal,
|
|
|
|
+3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,n.count);n.count=0}function h(n){if(xa!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);xa=n.doubleSided}if(va!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);va=n.flipSided}}function j(n){if(ca!=n){n?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ca=n}}function k(n){ia[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);ia[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);ia[2].set(n.n41+n.n21,n.n42+n.n22,
|
|
|
|
+n.n43+n.n23,n.n44+n.n24);ia[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);ia[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);ia[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var C;for(n=0;n<6;n++){C=ia[n];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function m(n){for(var C=n.matrixWorld,w=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),v=0;v<6;v++){n=ia[v].x*C.n14+ia[v].y*C.n24+ia[v].z*C.n34+ia[v].w;if(n<=w)return!1}return!0}function o(n,
|
|
|
|
+C){n.list[n.count]=C;n.count+=1}function t(n){var C,w,v=n.object,A=n.opaque,K=n.transparent;K.count=0;n=A.count=0;for(C=v.materials.length;n<C;n++){w=v.materials[n];w.transparent?o(K,w):o(A,w)}}function p(n){var C,w,v,A,K=n.object,J=n.buffer,I=n.opaque,S=n.transparent;S.count=0;n=I.count=0;for(v=K.materials.length;n<v;n++){C=K.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(w=J.materials.length;C<w;C++)(A=J.materials[C])&&(A.transparent?o(S,A):o(I,A))}else(A=C)&&(A.transparent?o(S,A):
|
|
|
|
+o(I,A))}}function y(n,C){return C.z-n.z}function u(n){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);var C,w=n.lights.length,v,A=n.lights,K=[],J,I,S,D,M,N=n.__webglShadowVolumes.length;for(C=0;C<w;C++){v=n.lights[C];if(v instanceof THREE.DirectionalLight&&v.castShadow){K[0]=
|
|
|
|
+-v.position.x;K[1]=-v.position.y;K[2]=-v.position.z;for(M=0;M<N;M++){v=n.__webglShadowVolumes[M].object;J=n.__webglShadowVolumes[M].buffer;I=v.materials[0];I.program||fa.initMaterial(I,A,undefined,v);I=I.program;S=I.uniforms;D=I.attributes;if(Da!==I){e.useProgram(I);Da=I;e.uniformMatrix4fv(S.projectionMatrix,!1,Ya);e.uniformMatrix4fv(S.viewMatrix,!1,ab);e.uniform3fv(S.directionalLightDirection,K)}v.matrixWorld.flattenToArray(v._objectMatrixArray);e.uniformMatrix4fv(S.objectMatrix,!1,v._objectMatrixArray);
|
|
|
|
+e.bindBuffer(e.ARRAY_BUFFER,J.__webglVertexBuffer);e.vertexAttribPointer(D.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,J.__webglNormalBuffer);e.vertexAttribPointer(D.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,J.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,J.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,J.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,
|
|
|
|
+0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);ra="";Da=W.program;e.useProgram(W.program);e.uniformMatrix4fv(W.projectionLocation,!1,Ya);e.uniform1f(W.darknessLocation,W.darkness);e.bindBuffer(e.ARRAY_BUFFER,W.vertexBuffer);e.vertexAttribPointer(W.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(W.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,W.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,
|
|
|
|
+0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(ga)}function z(n,C){var w,v,A;w=_sprite.attributes;var K=_sprite.uniforms,J=ja/Fa,I,S=[],D=Fa*0.5,M=ja*0.5,N=!0;e.useProgram(_sprite.program);Da=_sprite.program;ra="";if(!db){e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);db=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.vertexAttribPointer(w.position,2,e.FLOAT,!1,
|
|
|
|
+16,0);e.vertexAttribPointer(w.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(K.projectionMatrix,!1,Ya);e.activeTexture(e.TEXTURE0);e.uniform1i(K.map,0);w=0;for(v=n.__webglSprites.length;w<v;w++){A=n.__webglSprites[w];if(A.useScreenCoordinates)A.z=-A.position.z;else{A._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,A.matrixWorld,A._modelViewMatrixArray);A.z=-A._modelViewMatrix.n34}}n.__webglSprites.sort(y);w=0;for(v=n.__webglSprites.length;w<
|
|
|
|
+v;w++){A=n.__webglSprites[w];if(A.material===undefined&&A.map&&A.map.image&&A.map.image.width){if(A.useScreenCoordinates){e.uniform1i(K.useScreenCoordinates,1);e.uniform3f(K.screenPosition,(A.position.x-D)/D,(M-A.position.y)/M,Math.max(0,Math.min(1,A.position.z)))}else{e.uniform1i(K.useScreenCoordinates,0);e.uniform1i(K.affectedByDistance,A.affectedByDistance?1:0);e.uniformMatrix4fv(K.modelViewMatrix,!1,A._modelViewMatrixArray)}I=A.map.image.width/(A.affectedByDistance?1:ja);S[0]=I*J*A.scale.x;S[1]=
|
|
|
|
+I*A.scale.y;e.uniform2f(K.uvScale,A.uvScale.x,A.uvScale.y);e.uniform2f(K.uvOffset,A.uvOffset.x,A.uvOffset.y);e.uniform2f(K.alignment,A.alignment.x,A.alignment.y);e.uniform1f(K.opacity,A.opacity);e.uniform1f(K.rotation,A.rotation);e.uniform2fv(K.scale,S);if(A.mergeWith3D&&!N){e.enable(e.DEPTH_TEST);N=!0}else if(!A.mergeWith3D&&N){e.disable(e.DEPTH_TEST);N=!1}P(A.blending);O(A.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(ga)}function H(n,
|
|
|
|
+C){var w,v,A=n.__webglLensFlares.length,K,J,I,S=new THREE.Vector3,D=ja/Fa,M=Fa*0.5,N=ja*0.5,Z=16/ja,V=[Z*D,Z],Aa=[1,1,0],Ka=[1,1],Ba=T.uniforms;w=T.attributes;e.useProgram(T.program);Da=T.program;ra="";if(!La){e.enableVertexAttribArray(T.attributes.vertex);e.enableVertexAttribArray(T.attributes.uv);La=!0}e.uniform1i(Ba.occlusionMap,0);e.uniform1i(Ba.map,1);e.bindBuffer(e.ARRAY_BUFFER,T.vertexBuffer);e.vertexAttribPointer(w.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(w.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+T.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,T.occlusionTexture);e.activeTexture(e.TEXTURE1);for(v=0;v<A;v++){w=n.__webglLensFlares[v].object;S.set(w.matrixWorld.n14,w.matrixWorld.n24,w.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(S);C.projectionMatrix.multiplyVector3(S);Aa[0]=S.x;Aa[1]=S.y;Aa[2]=S.z;Ka[0]=Aa[0]*M+M;Ka[1]=Aa[1]*N+N;if(T.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ja){e.bindTexture(e.TEXTURE_2D,T.tempTexture);
|
|
|
|
+e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ba.renderType,0);e.uniform2fv(Ba.scale,V);e.uniform3fv(Ba.screenPosition,Aa);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,T.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ba.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,T.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);w.positionScreen.x=
|
|
|
|
+Aa[0];w.positionScreen.y=Aa[1];w.positionScreen.z=Aa[2];w.customUpdateCallback?w.customUpdateCallback(w):w.updateLensFlares();e.uniform1i(Ba.renderType,2);e.enable(e.BLEND);K=0;for(J=w.lensFlares.length;K<J;K++){I=w.lensFlares[K];if(I.opacity>0.0010&&I.scale>0.0010){Aa[0]=I.x;Aa[1]=I.y;Aa[2]=I.z;Z=I.size*I.scale/ja;V[0]=Z*D;V[1]=Z;e.uniform3fv(Ba.screenPosition,Aa);e.uniform2fv(Ba.scale,V);e.uniform1f(Ba.rotation,I.rotation);e.uniform1f(Ba.opacity,I.opacity);P(I.blending);O(I.texture,1);e.drawElements(e.TRIANGLES,
|
|
|
|
+6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(ga)}function G(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function B(n){var C,w,v,A,K;if(n instanceof THREE.Mesh){w=n.geometry;for(C in w.geometryGroups){v=w.geometryGroups[C];K=!1;for(A in v.__webglCustomAttributes)if(v.__webglCustomAttributes[A].needsUpdate){K=!0;break}if(w.__dirtyVertices||
|
|
|
|
+w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents||K){K=e.DYNAMIC_DRAW;var J=void 0,I=void 0,S=void 0,D=void 0;S=void 0;var M=void 0,N=void 0,Z=void 0,V=void 0,Aa=void 0,Ka=void 0,Ba=void 0,ya=void 0,Oa=void 0,Ga=void 0,za=void 0,Ha=void 0,Ua=void 0;N=void 0;Z=void 0;D=void 0;V=void 0;D=void 0;var F=void 0,da=void 0;N=void 0;F=void 0;da=void 0;var x=void 0,bb=void 0;F=void 0;da=void 0;x=void 0;bb=void 0;F=void 0;da=void 0;x=void 0;bb=void 0;
|
|
|
|
+F=void 0;da=void 0;x=void 0;D=void 0;V=void 0;M=void 0;S=void 0;S=void 0;F=void 0;da=void 0;x=void 0;var eb=void 0,Na=0,Pa=0,ib=0,fb=0,Za=0,$a=0,Ma=0,cb=0,Ca=0,U=0,Qa=0;da=F=0;var Sa=v.__vertexArray,kb=v.__uvArray,Xa=v.__uv2Array,X=v.__normalArray,ma=v.__tangentArray,na=v.__colorArray,$=v.__skinVertexAArray,wa=v.__skinVertexBArray,ua=v.__skinIndexArray,la=v.__skinWeightArray,Y=v.__morphTargetsArrays,Ja=v.__webglCustomAttributes;x=void 0;var Va=v.__faceArray,Ta=v.__lineArray,jb=v.__needsSmoothNormals;
|
|
|
|
+Ka=v.__vertexColorType;Aa=v.__uvType;Ba=v.__normalType;var Wa=n.geometry,gb=Wa.__dirtyVertices,hb=Wa.__dirtyElements,rb=Wa.__dirtyUvs,sb=Wa.__dirtyNormals,tb=Wa.__dirtyTangents,ub=Wa.__dirtyColors,vb=Wa.__dirtyMorphTargets,nb=Wa.vertices,wb=v.faces,zb=Wa.faces,xb=Wa.faceVertexUvs[0],yb=Wa.faceVertexUvs[1],ob=Wa.skinVerticesA,pb=Wa.skinVerticesB,qb=Wa.skinIndices,lb=Wa.skinWeights,mb=n instanceof THREE.ShadowVolume?Wa.edgeFaces:undefined;morphTargets=Wa.morphTargets;if(Ja)for(eb in Ja){Ja[eb].offset=
|
|
|
|
+0;Ja[eb].offsetSrc=0}J=0;for(I=wb.length;J<I;J++){S=wb[J];D=zb[S];xb&&(ya=xb[S]);yb&&(Oa=yb[S]);S=D.vertexNormals;M=D.normal;N=D.vertexColors;Z=D.color;V=D.vertexTangents;if(D instanceof THREE.Face3){if(gb){Ga=nb[D.a].position;za=nb[D.b].position;Ha=nb[D.c].position;Sa[Pa]=Ga.x;Sa[Pa+1]=Ga.y;Sa[Pa+2]=Ga.z;Sa[Pa+3]=za.x;Sa[Pa+4]=za.y;Sa[Pa+5]=za.z;Sa[Pa+6]=Ha.x;Sa[Pa+7]=Ha.y;Sa[Pa+8]=Ha.z;Pa+=9}if(Ja)for(eb in Ja){x=Ja[eb];if(x.needsUpdate){F=x.offset;da=x.offsetSrc;if(x.size===1){if(x.boundTo===undefined||
|
|
|
|
+x.boundTo==="vertices"){x.array[F+0]=x.value[D.a];x.array[F+1]=x.value[D.b];x.array[F+2]=x.value[D.c]}else if(x.boundTo==="faces"){x.array[F+0]=x.value[da];x.array[F+1]=x.value[da];x.array[F+2]=x.value[da];x.offsetSrc++}else if(x.boundTo==="faceVertices"){x.array[F+0]=x.value[da+0];x.array[F+1]=x.value[da+1];x.array[F+2]=x.value[da+2];x.offsetSrc+=3}x.offset+=3}else{if(x.boundTo===undefined||x.boundTo==="vertices"){Ga=x.value[D.a];za=x.value[D.b];Ha=x.value[D.c]}else if(x.boundTo==="faces"){Ga=x.value[da];
|
|
|
|
+za=x.value[da];Ha=x.value[da];x.offsetSrc++}else if(x.boundTo==="faceVertices"){Ga=x.value[da+0];za=x.value[da+1];Ha=x.value[da+2];x.offsetSrc+=3}if(x.size===2){x.array[F+0]=Ga.x;x.array[F+1]=Ga.y;x.array[F+2]=za.x;x.array[F+3]=za.y;x.array[F+4]=Ha.x;x.array[F+5]=Ha.y;x.offset+=6}else if(x.size===3){if(x.type==="c"){x.array[F+0]=Ga.r;x.array[F+1]=Ga.g;x.array[F+2]=Ga.b;x.array[F+3]=za.r;x.array[F+4]=za.g;x.array[F+5]=za.b;x.array[F+6]=Ha.r;x.array[F+7]=Ha.g;x.array[F+8]=Ha.b}else{x.array[F+0]=Ga.x;
|
|
|
|
+x.array[F+1]=Ga.y;x.array[F+2]=Ga.z;x.array[F+3]=za.x;x.array[F+4]=za.y;x.array[F+5]=za.z;x.array[F+6]=Ha.x;x.array[F+7]=Ha.y;x.array[F+8]=Ha.z}x.offset+=9}else{x.array[F+0]=Ga.x;x.array[F+1]=Ga.y;x.array[F+2]=Ga.z;x.array[F+3]=Ga.w;x.array[F+4]=za.x;x.array[F+5]=za.y;x.array[F+6]=za.z;x.array[F+7]=za.w;x.array[F+8]=Ha.x;x.array[F+9]=Ha.y;x.array[F+10]=Ha.z;x.array[F+11]=Ha.w;x.offset+=12}}}}if(vb){F=0;for(da=morphTargets.length;F<da;F++){Ga=morphTargets[F].vertices[D.a].position;za=morphTargets[F].vertices[D.b].position;
|
|
|
|
+Ha=morphTargets[F].vertices[D.c].position;x=Y[F];x[Qa+0]=Ga.x;x[Qa+1]=Ga.y;x[Qa+2]=Ga.z;x[Qa+3]=za.x;x[Qa+4]=za.y;x[Qa+5]=za.z;x[Qa+6]=Ha.x;x[Qa+7]=Ha.y;x[Qa+8]=Ha.z}Qa+=9}if(lb.length){F=lb[D.a];da=lb[D.b];x=lb[D.c];la[U]=F.x;la[U+1]=F.y;la[U+2]=F.z;la[U+3]=F.w;la[U+4]=da.x;la[U+5]=da.y;la[U+6]=da.z;la[U+7]=da.w;la[U+8]=x.x;la[U+9]=x.y;la[U+10]=x.z;la[U+11]=x.w;F=qb[D.a];da=qb[D.b];x=qb[D.c];ua[U]=F.x;ua[U+1]=F.y;ua[U+2]=F.z;ua[U+3]=F.w;ua[U+4]=da.x;ua[U+5]=da.y;ua[U+6]=da.z;ua[U+7]=da.w;ua[U+8]=
|
|
|
|
+x.x;ua[U+9]=x.y;ua[U+10]=x.z;ua[U+11]=x.w;F=ob[D.a];da=ob[D.b];x=ob[D.c];$[U]=F.x;$[U+1]=F.y;$[U+2]=F.z;$[U+3]=1;$[U+4]=da.x;$[U+5]=da.y;$[U+6]=da.z;$[U+7]=1;$[U+8]=x.x;$[U+9]=x.y;$[U+10]=x.z;$[U+11]=1;F=pb[D.a];da=pb[D.b];x=pb[D.c];wa[U]=F.x;wa[U+1]=F.y;wa[U+2]=F.z;wa[U+3]=1;wa[U+4]=da.x;wa[U+5]=da.y;wa[U+6]=da.z;wa[U+7]=1;wa[U+8]=x.x;wa[U+9]=x.y;wa[U+10]=x.z;wa[U+11]=1;U+=12}if(ub&&Ka){if(N.length==3&&Ka==THREE.VertexColors){D=N[0];F=N[1];da=N[2]}else da=F=D=Z;na[Ca]=D.r;na[Ca+1]=D.g;na[Ca+2]=D.b;
|
|
|
|
+na[Ca+3]=F.r;na[Ca+4]=F.g;na[Ca+5]=F.b;na[Ca+6]=da.r;na[Ca+7]=da.g;na[Ca+8]=da.b;Ca+=9}if(tb&&Wa.hasTangents){N=V[0];Z=V[1];D=V[2];ma[Ma]=N.x;ma[Ma+1]=N.y;ma[Ma+2]=N.z;ma[Ma+3]=N.w;ma[Ma+4]=Z.x;ma[Ma+5]=Z.y;ma[Ma+6]=Z.z;ma[Ma+7]=Z.w;ma[Ma+8]=D.x;ma[Ma+9]=D.y;ma[Ma+10]=D.z;ma[Ma+11]=D.w;Ma+=12}if(sb&&Ba)if(S.length==3&&jb)for(V=0;V<3;V++){M=S[V];X[$a]=M.x;X[$a+1]=M.y;X[$a+2]=M.z;$a+=3}else for(V=0;V<3;V++){X[$a]=M.x;X[$a+1]=M.y;X[$a+2]=M.z;$a+=3}if(rb&&ya!==undefined&&Aa)for(V=0;V<3;V++){S=ya[V];kb[ib]=
|
|
|
|
+S.u;kb[ib+1]=S.v;ib+=2}if(rb&&Oa!==undefined&&Aa)for(V=0;V<3;V++){S=Oa[V];Xa[fb]=S.u;Xa[fb+1]=S.v;fb+=2}if(hb){Va[Za]=Na;Va[Za+1]=Na+1;Va[Za+2]=Na+2;Za+=3;Ta[cb]=Na;Ta[cb+1]=Na+1;Ta[cb+2]=Na;Ta[cb+3]=Na+2;Ta[cb+4]=Na+1;Ta[cb+5]=Na+2;cb+=6;Na+=3}}else if(D instanceof THREE.Face4){if(gb){Ga=nb[D.a].position;za=nb[D.b].position;Ha=nb[D.c].position;Ua=nb[D.d].position;Sa[Pa]=Ga.x;Sa[Pa+1]=Ga.y;Sa[Pa+2]=Ga.z;Sa[Pa+3]=za.x;Sa[Pa+4]=za.y;Sa[Pa+5]=za.z;Sa[Pa+6]=Ha.x;Sa[Pa+7]=Ha.y;Sa[Pa+8]=Ha.z;Sa[Pa+9]=Ua.x;
|
|
|
|
+Sa[Pa+10]=Ua.y;Sa[Pa+11]=Ua.z;Pa+=12}if(Ja)for(eb in Ja){x=Ja[eb];if(x.needsUpdate){F=x.offset;da=x.offsetSrc;if(x.size===1){if(x.boundTo===undefined||x.boundTo==="vertices"){x.array[F+0]=x.value[D.a];x.array[F+1]=x.value[D.b];x.array[F+2]=x.value[D.c];x.array[F+3]=x.value[D.d]}else if(x.boundTo==="faces"){x.array[F+0]=x.value[da];x.array[F+1]=x.value[da];x.array[F+2]=x.value[da];x.array[F+3]=x.value[da];x.offsetSrc++}else if(x.boundTo==="faceVertices"){x.array[F+0]=x.value[da+0];x.array[F+1]=x.value[da+
|
|
|
|
+1];x.array[F+2]=x.value[da+2];x.array[F+3]=x.value[da+3];x.offsetSrc+=4}x.offset+=4}else{if(x.boundTo===undefined||x.boundTo==="vertices"){Ga=x.value[D.a];za=x.value[D.b];Ha=x.value[D.c];Ua=x.value[D.d]}else if(x.boundTo==="faces"){Ga=x.value[da];za=x.value[da];Ha=x.value[da];Ua=x.value[da];x.offsetSrc++}else if(x.boundTo==="faceVertices"){Ga=x.value[da+0];za=x.value[da+1];Ha=x.value[da+2];Ua=x.value[da+3];x.offsetSrc+=4}if(x.size===2){x.array[F+0]=Ga.x;x.array[F+1]=Ga.y;x.array[F+2]=za.x;x.array[F+
|
|
|
|
+3]=za.y;x.array[F+4]=Ha.x;x.array[F+5]=Ha.y;x.array[F+6]=Ua.x;x.array[F+7]=Ua.y;x.offset+=8}else if(x.size===3){if(x.type==="c"){x.array[F+0]=Ga.r;x.array[F+1]=Ga.g;x.array[F+2]=Ga.b;x.array[F+3]=za.r;x.array[F+4]=za.g;x.array[F+5]=za.b;x.array[F+6]=Ha.r;x.array[F+7]=Ha.g;x.array[F+8]=Ha.b;x.array[F+9]=Ua.r;x.array[F+10]=Ua.g;x.array[F+11]=Ua.b}else{x.array[F+0]=Ga.x;x.array[F+1]=Ga.y;x.array[F+2]=Ga.z;x.array[F+3]=za.x;x.array[F+4]=za.y;x.array[F+5]=za.z;x.array[F+6]=Ha.x;x.array[F+7]=Ha.y;x.array[F+
|
|
|
|
+8]=Ha.z;x.array[F+9]=Ua.x;x.array[F+10]=Ua.y;x.array[F+11]=Ua.z}x.offset+=12}else{x.array[F+0]=Ga.x;x.array[F+1]=Ga.y;x.array[F+2]=Ga.z;x.array[F+3]=Ga.w;x.array[F+4]=za.x;x.array[F+5]=za.y;x.array[F+6]=za.z;x.array[F+7]=za.w;x.array[F+8]=Ha.x;x.array[F+9]=Ha.y;x.array[F+10]=Ha.z;x.array[F+11]=Ha.w;x.array[F+12]=Ua.x;x.array[F+13]=Ua.y;x.array[F+14]=Ua.z;x.array[F+15]=Ua.w;x.offset+=16}}}}if(vb){F=0;for(da=morphTargets.length;F<da;F++){Ga=morphTargets[F].vertices[D.a].position;za=morphTargets[F].vertices[D.b].position;
|
|
|
|
+Ha=morphTargets[F].vertices[D.c].position;Ua=morphTargets[F].vertices[D.d].position;x=Y[F];x[Qa+0]=Ga.x;x[Qa+1]=Ga.y;x[Qa+2]=Ga.z;x[Qa+3]=za.x;x[Qa+4]=za.y;x[Qa+5]=za.z;x[Qa+6]=Ha.x;x[Qa+7]=Ha.y;x[Qa+8]=Ha.z;x[Qa+9]=Ua.x;x[Qa+10]=Ua.y;x[Qa+11]=Ua.z}Qa+=12}if(lb.length){F=lb[D.a];da=lb[D.b];x=lb[D.c];bb=lb[D.d];la[U]=F.x;la[U+1]=F.y;la[U+2]=F.z;la[U+3]=F.w;la[U+4]=da.x;la[U+5]=da.y;la[U+6]=da.z;la[U+7]=da.w;la[U+8]=x.x;la[U+9]=x.y;la[U+10]=x.z;la[U+11]=x.w;la[U+12]=bb.x;la[U+13]=bb.y;la[U+14]=bb.z;
|
|
|
|
+la[U+15]=bb.w;F=qb[D.a];da=qb[D.b];x=qb[D.c];bb=qb[D.d];ua[U]=F.x;ua[U+1]=F.y;ua[U+2]=F.z;ua[U+3]=F.w;ua[U+4]=da.x;ua[U+5]=da.y;ua[U+6]=da.z;ua[U+7]=da.w;ua[U+8]=x.x;ua[U+9]=x.y;ua[U+10]=x.z;ua[U+11]=x.w;ua[U+12]=bb.x;ua[U+13]=bb.y;ua[U+14]=bb.z;ua[U+15]=bb.w;F=ob[D.a];da=ob[D.b];x=ob[D.c];bb=ob[D.d];$[U]=F.x;$[U+1]=F.y;$[U+2]=F.z;$[U+3]=1;$[U+4]=da.x;$[U+5]=da.y;$[U+6]=da.z;$[U+7]=1;$[U+8]=x.x;$[U+9]=x.y;$[U+10]=x.z;$[U+11]=1;$[U+12]=bb.x;$[U+13]=bb.y;$[U+14]=bb.z;$[U+15]=1;F=pb[D.a];da=pb[D.b];
|
|
|
|
+x=pb[D.c];D=pb[D.d];wa[U]=F.x;wa[U+1]=F.y;wa[U+2]=F.z;wa[U+3]=1;wa[U+4]=da.x;wa[U+5]=da.y;wa[U+6]=da.z;wa[U+7]=1;wa[U+8]=x.x;wa[U+9]=x.y;wa[U+10]=x.z;wa[U+11]=1;wa[U+12]=D.x;wa[U+13]=D.y;wa[U+14]=D.z;wa[U+15]=1;U+=16}if(ub&&Ka){if(N.length==4&&Ka==THREE.VertexColors){D=N[0];F=N[1];da=N[2];N=N[3]}else N=da=F=D=Z;na[Ca]=D.r;na[Ca+1]=D.g;na[Ca+2]=D.b;na[Ca+3]=F.r;na[Ca+4]=F.g;na[Ca+5]=F.b;na[Ca+6]=da.r;na[Ca+7]=da.g;na[Ca+8]=da.b;na[Ca+9]=N.r;na[Ca+10]=N.g;na[Ca+11]=N.b;Ca+=12}if(tb&&Wa.hasTangents){N=
|
|
|
|
+V[0];Z=V[1];D=V[2];V=V[3];ma[Ma]=N.x;ma[Ma+1]=N.y;ma[Ma+2]=N.z;ma[Ma+3]=N.w;ma[Ma+4]=Z.x;ma[Ma+5]=Z.y;ma[Ma+6]=Z.z;ma[Ma+7]=Z.w;ma[Ma+8]=D.x;ma[Ma+9]=D.y;ma[Ma+10]=D.z;ma[Ma+11]=D.w;ma[Ma+12]=V.x;ma[Ma+13]=V.y;ma[Ma+14]=V.z;ma[Ma+15]=V.w;Ma+=16}if(sb&&Ba)if(S.length==4&&jb)for(V=0;V<4;V++){M=S[V];X[$a]=M.x;X[$a+1]=M.y;X[$a+2]=M.z;$a+=3}else for(V=0;V<4;V++){X[$a]=M.x;X[$a+1]=M.y;X[$a+2]=M.z;$a+=3}if(rb&&ya!==undefined&&Aa)for(V=0;V<4;V++){S=ya[V];kb[ib]=S.u;kb[ib+1]=S.v;ib+=2}if(rb&&Oa!==undefined&&
|
|
|
|
+Aa)for(V=0;V<4;V++){S=Oa[V];Xa[fb]=S.u;Xa[fb+1]=S.v;fb+=2}if(hb){Va[Za]=Na;Va[Za+1]=Na+1;Va[Za+2]=Na+3;Va[Za+3]=Na+1;Va[Za+4]=Na+2;Va[Za+5]=Na+3;Za+=6;Ta[cb]=Na;Ta[cb+1]=Na+1;Ta[cb+2]=Na;Ta[cb+3]=Na+3;Ta[cb+4]=Na+1;Ta[cb+5]=Na+2;Ta[cb+6]=Na+2;Ta[cb+7]=Na+3;cb+=8;Na+=4}}}if(mb){J=0;for(I=mb.length;J<I;J++){Va[Za]=mb[J].a;Va[Za+1]=mb[J].b;Va[Za+2]=mb[J].c;Va[Za+3]=mb[J].a;Va[Za+4]=mb[J].c;Va[Za+5]=mb[J].d;Za+=6}}if(gb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Sa,
|
|
|
|
+K)}if(Ja)for(eb in Ja){x=Ja[eb];if(x.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,x.buffer);e.bufferData(e.ARRAY_BUFFER,x.array,K);x.needsUpdate=!1}}if(vb){F=0;for(da=morphTargets.length;F<da;F++){e.bindBuffer(e.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[F]);e.bufferData(e.ARRAY_BUFFER,Y[F],K)}}if(ub&&Ca>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,K)}if(sb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,X,K)}if(tb&&Wa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
+v.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ma,K)}if(rb&&ib>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,kb,K)}if(rb&&fb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Xa,K)}if(hb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Va,K);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ta,K)}if(U>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexABuffer);
|
|
|
|
+e.bufferData(e.ARRAY_BUFFER,$,K);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,wa,K);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ua,K);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,la,K)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){w=n.geometry;if(w.__dirtyVertices||
|
|
|
|
+w.__dirtyColors){n=w;C=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ba=Ka.length;K=v.length;ya=n.__vertexArray;J=n.__colorArray;Oa=n.__dirtyColors;if(n.__dirtyVertices){for(I=0;I<Ba;I++){Aa=Ka[I].position;A=I*3;ya[A]=Aa.x;ya[A+1]=Aa.y;ya[A+2]=Aa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ya,C)}if(Oa){for(I=0;I<K;I++){color=v[I];A=I*3;J[A]=color.r;J[A+1]=color.g;J[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,J,C)}}w.__dirtyVertices=
|
|
|
|
+!1;w.__dirtyColors=!1}else if(n instanceof THREE.Line){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;C=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ba=Ka.length;K=v.length;ya=n.__vertexArray;J=n.__colorArray;Oa=n.__dirtyColors;if(n.__dirtyVertices){for(I=0;I<Ba;I++){Aa=Ka[I].position;A=I*3;ya[A]=Aa.x;ya[A+1]=Aa.y;ya[A+2]=Aa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ya,C)}if(Oa){for(I=0;I<K;I++){color=v[I];A=I*3;J[A]=color.r;J[A+1]=color.g;J[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
+n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,J,C)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){w=n.geometry;(w.__dirtyVertices||w.__dirtyColors||n.sortParticles)&&d(w,e.DYNAMIC_DRAW,n);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function R(n){function C(Z){var V=[];w=0;for(v=Z.length;w<v;w++)Z[w]==undefined?V.push("undefined"):V.push(Z[w].id);return V.join("_")}var w,v,A,K,J,I,S,D,M={},N=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};
|
|
|
|
+A=0;for(K=n.faces.length;A<K;A++){J=n.faces[A];I=J.materials;S=C(I);M[S]==undefined&&(M[S]={hash:S,counter:0});D=M[S].hash+"_"+M[S].counter;n.geometryGroups[D]==undefined&&(n.geometryGroups[D]={faces:[],materials:I,vertices:0,numMorphTargets:N});J=J instanceof THREE.Face3?3:4;if(n.geometryGroups[D].vertices+J>65535){M[S].counter+=1;D=M[S].hash+"_"+M[S].counter;n.geometryGroups[D]==undefined&&(n.geometryGroups[D]={faces:[],materials:I,vertices:0,numMorphTargets:N})}n.geometryGroups[D].faces.push(A);
|
|
|
|
+n.geometryGroups[D].vertices+=J}}function E(n,C,w){n.push({buffer:C,object:w,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function P(n){if(n!=ra){switch(n){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,
|
|
|
|
+e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ra=n}}function L(n,C,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,ha(C.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,ha(C.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,ha(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ha(C.minFilter));e.generateMipmap(n)}else{e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);
|
|
|
|
+e.texParameteri(n,e.TEXTURE_MAG_FILTER,ta(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ta(C.minFilter))}}function O(n,C){if(n.needsUpdate){if(n.__webglInit){e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n.image)}else{n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n.image);n.__webglInit=!0}L(e.TEXTURE_2D,n,n.image);e.bindTexture(e.TEXTURE_2D,null);
|
|
|
|
+n.needsUpdate=!1}e.activeTexture(e.TEXTURE0+C);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function sa(n){if(n&&!n.__webglFramebuffer){if(n.depthBuffer===undefined)n.depthBuffer=!0;if(n.stencilBuffer===undefined)n.stencilBuffer=!0;n.__webglFramebuffer=e.createFramebuffer();n.__webglRenderbuffer=e.createRenderbuffer();n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,ha(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,
|
|
|
|
+ha(n.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,ha(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,ha(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,ha(n.format),n.width,n.height,0,ha(n.format),ha(n.type),null);e.bindRenderbuffer(e.RENDERBUFFER,n.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.__webglTexture,0);if(n.depthBuffer&&!n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,
|
|
e.DEPTH_COMPONENT16,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,
|
|
e.DEPTH_COMPONENT16,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,
|
|
-null)}var C,x;if(n){C=n.__webglFramebuffer;x=n.width;n=n.height}else{C=null;x=Fa;n=ja}if(C!=da){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ka,ma,x,n);da=C}}function la(n,C){var x;if(n=="fragment")x=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,C);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(C);return null}return x}function ra(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
|
|
|
|
-default:return e.LINEAR}}function ga(n){switch(n){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;
|
|
|
|
|
|
+null)}var C,w;if(n){C=n.__webglFramebuffer;w=n.width;n=n.height}else{C=null;w=Fa;n=ja}if(C!=ea){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ka,pa,w,n);ea=C}}function oa(n,C){var w;if(n=="fragment")w=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(w=e.createShader(e.VERTEX_SHADER));e.shaderSource(w,C);e.compileShader(w);if(!e.getShaderParameter(w,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(w));console.error(C);return null}return w}function ta(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
|
|
|
|
+default:return e.LINEAR}}function ha(n){switch(n){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}
|
|
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 ea=this,e,oa=document.createElement("canvas"),Da=[],Aa=null,da=null,fa=!0,wa=null,ua=null,pa=null,ca=null,ka=0,ma=0,Fa=0,ja=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ja=new THREE.Matrix4,Xa=new Float32Array(16),Za=new Float32Array(16),Ta=new THREE.Vector4,S={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;
|
|
|
|
-antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=!0;(function(n,C,x,v){try{if(!(e=oa.getContext("experimental-webgl",{antialias:n,stencil:v})))throw"Error creating WebGL context.";}catch(z){console.error(z)}console.log(navigator.userAgent+" | "+
|
|
|
|
-e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));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.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,C.g,C.b,x)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var T={};T.vertices=new Float32Array(12);
|
|
|
|
-T.faces=new Uint16Array(6);T.darkness=0.5;T.vertices[0]=-20;T.vertices[1]=-20;T.vertices[2]=-1;T.vertices[3]=20;T.vertices[4]=-20;T.vertices[5]=-1;T.vertices[6]=20;T.vertices[7]=20;T.vertices[8]=-1;T.vertices[9]=-20;T.vertices[10]=20;T.vertices[11]=-1;T.faces[0]=0;T.faces[1]=1;T.faces[2]=2;T.faces[3]=0;T.faces[4]=2;T.faces[5]=3;T.vertexBuffer=e.createBuffer();T.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,T.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,T.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-T.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,T.faces,e.STATIC_DRAW);T.program=e.createProgram();e.attachShader(T.program,la("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(T.program,la("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(T.program);T.vertexLocation=e.getAttribLocation(T.program,"position");T.projectionLocation=e.getUniformLocation(T.program,"projectionMatrix");T.darknessLocation=e.getUniformLocation(T.program,"darkness")}var O={};O.vertices=
|
|
|
|
-new Float32Array(16);O.faces=new Uint16Array(6);b=0;O.vertices[b++]=-1;O.vertices[b++]=-1;O.vertices[b++]=0;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;b=0;O.faces[b++]=0;O.faces[b++]=1;O.faces[b++]=2;O.faces[b++]=0;O.faces[b++]=2;O.faces[b++]=3;O.vertexBuffer=e.createBuffer();O.elementBuffer=e.createBuffer();
|
|
|
|
-O.tempTexture=e.createTexture();O.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,O.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,O.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,O.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,O.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,O.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);
|
|
|
|
-e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.bindTexture(e.TEXTURE_2D,O.occlusionTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,16,16,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);if(e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=
|
|
|
|
-0){O.hasVertexTexture=!1;O.program=e.createProgram();e.attachShader(O.program,la("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(O.program,la("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{O.hasVertexTexture=!0;O.program=e.createProgram();e.attachShader(O.program,la("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(O.program,la("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(O.program);O.attributes={};O.uniforms=
|
|
|
|
-{};O.attributes.vertex=e.getAttribLocation(O.program,"position");O.attributes.uv=e.getAttribLocation(O.program,"UV");O.uniforms.renderType=e.getUniformLocation(O.program,"renderType");O.uniforms.map=e.getUniformLocation(O.program,"map");O.uniforms.occlusionMap=e.getUniformLocation(O.program,"occlusionMap");O.uniforms.opacity=e.getUniformLocation(O.program,"opacity");O.uniforms.scale=e.getUniformLocation(O.program,"scale");O.uniforms.rotation=e.getUniformLocation(O.program,"rotation");O.uniforms.screenPosition=
|
|
|
|
-e.getUniformLocation(O.program,"screenPosition");var Ba=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=
|
|
|
|
-0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=e.createBuffer();_sprite.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,_sprite.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,_sprite.faces,e.STATIC_DRAW);_sprite.program=e.createProgram();
|
|
|
|
-e.attachShader(_sprite.program,la("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,la("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=e.getUniformLocation(_sprite.program,
|
|
|
|
-"uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=e.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=e.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
|
|
|
|
-e.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=e.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");var La=!1;this.setSize=function(n,C){oa.width=n;oa.height=C;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(n,C,x,v){ka=n;ma=C;Fa=x;ja=v;e.viewport(ka,ma,Fa,
|
|
|
|
-ja)};this.setScissor=function(n,C,x,v){e.scissor(n,C,x,v)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){fa=n;e.depthMask(n)};this.setClearColorHex=function(n,C){var x=new THREE.Color(n);e.clearColor(x.r,x.g,x.b,C)};this.setClearColor=function(n,C){e.clearColor(n.r,n.g,n.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){T.darkness=
|
|
|
|
-n};this.getContext=function(){return e};this.initMaterial=function(n,C,x,v){var z,P,K;if(n instanceof THREE.MeshDepthMaterial)K="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)K="shadowVolumeDynamic";else if(n instanceof THREE.MeshNormalMaterial)K="normal";else if(n instanceof THREE.MeshBasicMaterial)K="basic";else if(n instanceof THREE.MeshLambertMaterial)K="lambert";else if(n instanceof THREE.MeshPhongMaterial)K="phong";else if(n instanceof THREE.LineBasicMaterial)K="basic";else n instanceof
|
|
|
|
-THREE.ParticleBasicMaterial&&(K="particle_basic");if(K){var F=THREE.ShaderLib[K];n.uniforms=THREE.UniformsUtils.clone(F.uniforms);n.vertexShader=F.vertexShader;n.fragmentShader=F.fragmentShader}var V,G,J;V=J=F=0;for(G=C.length;V<G;V++){P=C[V];P instanceof THREE.DirectionalLight&&J++;P instanceof THREE.PointLight&&F++}if(F+J<=4)C=J;else{C=Math.ceil(4*J/(F+J));F=4-C}P={directional:C,point:F};J=50;if(v!==undefined&&v instanceof THREE.SkinnedMesh)J=v.bones.length;var M;a:{V=n.fragmentShader;G=n.vertexShader;
|
|
|
|
-F=n.uniforms;C=n.attributes;x={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:x,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:P.directional,maxPointLights:P.point,maxBones:J};var Z;P=[];if(K)P.push(K);else{P.push(V);P.push(G)}for(Z in x){P.push(Z);P.push(x[Z])}K=P.join();Z=0;for(P=Da.length;Z<P;Z++)if(Da[Z].code==K){M=Da[Z].program;break a}Z=e.createProgram();prefix_fragment=
|
|
|
|
-["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":"",x.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":
|
|
|
|
-"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,"#define MAX_BONES "+x.maxBones,x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"",x.skinning?"#define USE_SKINNING":"",x.morphTargets?"#define USE_MORPHTARGETS":"",x.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
-e.attachShader(Z,la("fragment",prefix_fragment+V));e.attachShader(Z,la("vertex",prefix_vertex+G));e.linkProgram(Z);e.getProgramParameter(Z,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(Z,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");Z.uniforms={};Z.attributes={};var Y;V=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(Y in F)V.push(Y);
|
|
|
|
-Y=V;F=0;for(V=Y.length;F<V;F++){G=Y[F];Z.uniforms[G]=e.getUniformLocation(Z,G)}V=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(Y=0;Y<x.maxMorphTargets;Y++)V.push("morphTarget"+Y);for(M in C)V.push(M);M=V;Y=0;for(C=M.length;Y<C;Y++){x=M[Y];Z.attributes[x]=e.getAttribLocation(Z,x)}Da.push({program:Z,code:K});M=Z}n.program=M;M=n.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(n.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)}for(z in n.attributes)M[z]>=0&&e.enableVertexAttribArray(M[z]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(M.morphTarget0>=0){e.enableVertexAttribArray(M.morphTarget0);
|
|
|
|
-n.numSupportedMorphTargets++}if(M.morphTarget1>=0){e.enableVertexAttribArray(M.morphTarget1);n.numSupportedMorphTargets++}if(M.morphTarget2>=0){e.enableVertexAttribArray(M.morphTarget2);n.numSupportedMorphTargets++}if(M.morphTarget3>=0){e.enableVertexAttribArray(M.morphTarget3);n.numSupportedMorphTargets++}if(M.morphTarget4>=0){e.enableVertexAttribArray(M.morphTarget4);n.numSupportedMorphTargets++}if(M.morphTarget5>=0){e.enableVertexAttribArray(M.morphTarget5);n.numSupportedMorphTargets++}if(M.morphTarget6>=
|
|
|
|
-0){e.enableVertexAttribArray(M.morphTarget6);n.numSupportedMorphTargets++}if(M.morphTarget7>=0){e.enableVertexAttribArray(M.morphTarget7);n.numSupportedMorphTargets++}v.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(z=this.maxMorphTargets;n<z;n++)v.__webglMorphTargetInfluences[n]=0}};this.render=function(n,C,x,v){var z,P,K,F,V,G,J,M,Z=n.lights,Y=n.fog;ea.data.vertices=0;ea.data.faces=0;ea.data.drawCalls=0;C.matrixAutoUpdate&&C.update(undefined,!0);n.update(undefined,!1,
|
|
|
|
-C);C.matrixWorldInverse.flattenToArray(Za);C.projectionMatrix.flattenToArray(Xa);Ja.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ja);this.initWebGLObjects(n);qa(x);(this.autoClear||v)&&this.clear();V=n.__webglObjects.length;for(v=0;v<V;v++){z=n.__webglObjects[v];J=z.object;if(J.visible)if(!(J instanceof THREE.Mesh)||m(J)){J.matrixWorld.flattenToArray(J._objectMatrixArray);H(J,C);p(z);z.render=!0;if(this.sortObjects){Ta.copy(J.position);Ja.multiplyVector3(Ta);z.z=Ta.z}}else z.render=!1;else z.render=
|
|
|
|
-!1}this.sortObjects&&n.__webglObjects.sort(y);G=n.__webglObjectsImmediate.length;for(v=0;v<G;v++){z=n.__webglObjectsImmediate[v];J=z.object;if(J.visible){J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray);H(J,C);t(z)}}R(THREE.NormalBlending);for(v=0;v<V;v++){z=n.__webglObjects[v];if(z.render){J=z.object;M=z.buffer;K=z.opaque;h(J);for(z=0;z<K.count;z++){F=K.list[z];j(F.depthTest);f(C,Z,Y,F,M,J)}}}for(v=0;v<G;v++){z=n.__webglObjectsImmediate[v];J=z.object;if(J.visible){K=z.opaque;
|
|
|
|
-h(J);for(z=0;z<K.count;z++){F=K.list[z];j(F.depthTest);P=c(C,Z,Y,F,J);J.render(function(sa){g(sa,P,F.shading)})}}}for(v=0;v<V;v++){z=n.__webglObjects[v];if(z.render){J=z.object;M=z.buffer;K=z.transparent;h(J);for(z=0;z<K.count;z++){F=K.list[z];R(F.blending);j(F.depthTest);f(C,Z,Y,F,M,J)}}}for(v=0;v<G;v++){z=n.__webglObjectsImmediate[v];J=z.object;if(J.visible){K=z.transparent;h(J);for(z=0;z<K.count;z++){F=K.list[z];R(F.blending);j(F.depthTest);P=c(C,Z,Y,F,J);J.render(function(sa){g(sa,P,F.shading)})}}}n.__webglSprites.length&&
|
|
|
|
-A(n,C);stencil&&n.__webglShadowVolumes.length&&n.lights.length&&u(n);n.__webglLensFlares.length&&I(n,C);if(x&&x.minFilter!==THREE.NearestFilter&&x.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,x.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=[]}for(;n.__objectsAdded.length;){var C=
|
|
|
|
-n.__objectsAdded[0],x=n,v=void 0,z=void 0,P=void 0;if(C._modelViewMatrix==undefined){C._modelViewMatrix=new THREE.Matrix4;C._normalMatrixArray=new Float32Array(9);C._modelViewMatrixArray=new Float32Array(16);C._objectMatrixArray=new Float32Array(16);C.matrixWorld.flattenToArray(C._objectMatrixArray)}if(C instanceof THREE.Mesh){z=C.geometry;z.geometryGroups==undefined&&U(z);for(v in z.geometryGroups){P=z.geometryGroups[v];if(!P.__webglVertexBuffer){var K=P;K.__webglVertexBuffer=e.createBuffer();K.__webglNormalBuffer=
|
|
|
|
-e.createBuffer();K.__webglTangentBuffer=e.createBuffer();K.__webglColorBuffer=e.createBuffer();K.__webglUVBuffer=e.createBuffer();K.__webglUV2Buffer=e.createBuffer();K.__webglSkinVertexABuffer=e.createBuffer();K.__webglSkinVertexBBuffer=e.createBuffer();K.__webglSkinIndicesBuffer=e.createBuffer();K.__webglSkinWeightsBuffer=e.createBuffer();K.__webglFaceBuffer=e.createBuffer();K.__webglLineBuffer=e.createBuffer();if(K.numMorphTargets){var F=void 0,V=void 0;K.__webglMorphTargetsBuffers=[];F=0;for(V=
|
|
|
|
-K.numMorphTargets;F<V;F++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}K=P;F=C;var G=void 0,J=void 0,M=void 0;M=void 0;var Z=void 0,Y=void 0,sa=void 0,Ka=sa=V=0;J=void 0;M=void 0;var Ca=void 0;G=void 0;J=void 0;Z=F.geometry;Ca=Z.faces;Y=K.faces;G=0;for(J=Y.length;G<J;G++){M=Y[G];M=Ca[M];if(M instanceof THREE.Face3){V+=3;sa+=1;Ka+=3}else if(M instanceof THREE.Face4){V+=4;sa+=2;Ka+=4}}G=K;J=F;Ca=void 0;Y=void 0;var Ha=void 0,Ga=void 0;Ha=void 0;M=[];Ca=0;for(Y=J.materials.length;Ca<Y;Ca++){Ha=
|
|
|
|
-J.materials[Ca];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=G.materials.length;Ha<l;Ha++)(Ga=G.materials[Ha])&&M.push(Ga)}else(Ga=Ha)&&M.push(Ga)}G=M;a:{J=void 0;Ca=void 0;Y=G.length;for(J=0;J<Y;J++){Ca=G[J];if(Ca.map||Ca.lightMap||Ca instanceof THREE.MeshShaderMaterial){J=!0;break a}}J=!1}a:{Ca=G;Y=void 0;M=void 0;Ha=Ca.length;for(Y=0;Y<Ha;Y++){M=Ca[Y];if(!(M instanceof THREE.MeshBasicMaterial&&!M.envMap||M instanceof THREE.MeshDepthMaterial)){Ca=M&&M.shading!=undefined&&M.shading==THREE.SmoothShading?
|
|
|
|
-THREE.SmoothShading:THREE.FlatShading;break a}}Ca=!1}a:{Y=void 0;M=void 0;Ha=G.length;for(Y=0;Y<Ha;Y++){M=G[Y];if(M.vertexColors){M=M.vertexColors;break a}}M=!1}K.__vertexArray=new Float32Array(V*3);if(Ca)K.__normalArray=new Float32Array(V*3);if(Z.hasTangents)K.__tangentArray=new Float32Array(V*4);if(M)K.__colorArray=new Float32Array(V*3);if(J){if(Z.faceUvs.length>0||Z.faceVertexUvs.length>0)K.__uvArray=new Float32Array(V*2);if(Z.faceUvs.length>1||Z.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(V*
|
|
|
|
-2)}if(F.geometry.skinWeights.length&&F.geometry.skinIndices.length){K.__skinVertexAArray=new Float32Array(V*4);K.__skinVertexBArray=new Float32Array(V*4);K.__skinIndexArray=new Float32Array(V*4);K.__skinWeightArray=new Float32Array(V*4)}K.__faceArray=new Uint16Array(sa*3+(F.geometry.edgeFaces?F.geometry.edgeFaces.length*6:0));K.__lineArray=new Uint16Array(Ka*2);if(K.numMorphTargets){K.__morphTargetsArrays=[];Z=0;for(Y=K.numMorphTargets;Z<Y;Z++)K.__morphTargetsArrays.push(new Float32Array(V*3))}K.__needsSmoothNormals=
|
|
|
|
-Ca==THREE.SmoothShading;K.__uvType=J;K.__vertexColorType=M;K.__normalType=Ca;K.__webglFaceCount=sa*3+(F.geometry.edgeFaces?F.geometry.edgeFaces.length*6:0);K.__webglLineCount=Ka*2;Z=0;for(Y=G.length;Z<Y;Z++)if(G[Z].attributes){K.__webglCustomAttributes={};for(a in G[Z].attributes){J=G[Z].attributes[a];if(!J.__webglInitialized||J.createUniqueBuffers){J.__webglInitialized=!0;sa=1;if(J.type==="v2")sa=2;else if(J.type==="v3")sa=3;else if(J.type==="v4")sa=4;else J.type==="c"&&(sa=3);J.size=sa;J.needsUpdate=
|
|
|
|
-!0;J.array=new Float32Array(V*sa);J.buffer=e.createBuffer();J.buffer.belongsToAttribute=a}K.__webglCustomAttributes[a]=J}}z.__dirtyVertices=!0;z.__dirtyMorphTargets=!0;z.__dirtyElements=!0;z.__dirtyUvs=!0;z.__dirtyNormals=!0;z.__dirtyTangents=!0;z.__dirtyColors=!0}C instanceof THREE.ShadowVolume?D(x.__webglShadowVolumes,P,C):D(x.__webglObjects,P,C)}}else if(C instanceof THREE.LensFlare)D(x.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){z=C.geometry;if(!z.__webglVertexBuffer){v=
|
|
|
|
-z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;P=v.vertices.length;v.__vertexArray=new Float32Array(P*3);v.__colorArray=new Float32Array(P*3);v.__webglVertexCount=P;z.__dirtyVertices=!0;z.__dirtyColors=!0}D(x.__webglObjects,z,C)}else if(C instanceof THREE.Line){z=C.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;P=v.vertices.length;v.__vertexArray=new Float32Array(P*3);v.__colorArray=new Float32Array(P*
|
|
|
|
-3);v.__webglLineCount=P;z.__dirtyVertices=!0;z.__dirtyColors=!0}D(x.__webglObjects,z,C)}else if(C instanceof THREE.ParticleSystem){z=C.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;P=v.vertices.length;v.__vertexArray=new Float32Array(P*3);v.__colorArray=new Float32Array(P*3);v.__sortArray=[];v.__webglParticleCount=P;z.__dirtyVertices=!0;z.__dirtyColors=!0}D(x.__webglObjects,z,C)}else if(THREE.MarchingCubes!==undefined&&C instanceof
|
|
|
|
-THREE.MarchingCubes)x.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});else C instanceof THREE.Sprite&&x.__webglSprites.push(C);n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){C=n.__objectsRemoved[0];x=n;z=void 0;v=void 0;if(C instanceof THREE.Mesh)for(z=x.__webglObjects.length-1;z>=0;z--){v=x.__webglObjects[z].object;if(C==v){x.__webglObjects.splice(z,1);break}}else if(C instanceof THREE.Sprite)for(z=x.__webglSprites.length-1;z>=0;z--){v=
|
|
|
|
-x.__webglSprites[z];if(C==v){x.__webglSprites.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}C=0;for(x=n.__webglObjects.length;C<x;C++)B(n.__webglObjects[C].object,n);C=0;for(x=n.__webglShadowVolumes.length;C<x;C++)B(n.__webglShadowVolumes[C].object,n);C=0;for(x=n.__webglLensFlares.length;C<x;C++)B(n.__webglLensFlares[C].object,n)};this.setFaceCulling=function(n,C){if(n){!C||C=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(n=="back")e.cullFace(e.BACK);else n=="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}};
|
|
|
|
|
|
+var fa=this,e,qa=document.createElement("canvas"),Ea=[],Da=null,ea=null,ga=!0,xa=null,va=null,ra=null,ca=null,ka=0,pa=0,Fa=0,ja=0,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ia=new THREE.Matrix4,Ya=new Float32Array(16),ab=new Float32Array(16),Ra=new THREE.Vector4,Q={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;
|
|
|
|
+antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=qa;this.autoClear=!0;this.sortObjects=!0;(function(n,C,w,v){try{if(!(e=qa.getContext("experimental-webgl",{antialias:n,stencil:v})))throw"Error creating WebGL context.";}catch(A){console.error(A)}console.log(navigator.userAgent+" | "+
|
|
|
|
+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));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.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,C.g,C.b,w)})(antialias,clearColor,clearAlpha,stencil);this.context=e;var aa=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
|
+0;if(stencil){var W={};W.vertices=new Float32Array(12);W.faces=new Uint16Array(6);W.darkness=0.5;W.vertices[0]=-20;W.vertices[1]=-20;W.vertices[2]=-1;W.vertices[3]=20;W.vertices[4]=-20;W.vertices[5]=-1;W.vertices[6]=20;W.vertices[7]=20;W.vertices[8]=-1;W.vertices[9]=-20;W.vertices[10]=20;W.vertices[11]=-1;W.faces[0]=0;W.faces[1]=1;W.faces[2]=2;W.faces[3]=0;W.faces[4]=2;W.faces[5]=3;W.vertexBuffer=e.createBuffer();W.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,W.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
|
+W.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,W.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,W.faces,e.STATIC_DRAW);W.program=e.createProgram();e.attachShader(W.program,oa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(W.program,oa("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(W.program);W.vertexLocation=e.getAttribLocation(W.program,"position");W.projectionLocation=e.getUniformLocation(W.program,"projectionMatrix");W.darknessLocation=
|
|
|
|
+e.getUniformLocation(W.program,"darkness")}var T={};T.vertices=new Float32Array(16);T.faces=new Uint16Array(6);b=0;T.vertices[b++]=-1;T.vertices[b++]=-1;T.vertices[b++]=0;T.vertices[b++]=0;T.vertices[b++]=1;T.vertices[b++]=-1;T.vertices[b++]=1;T.vertices[b++]=0;T.vertices[b++]=1;T.vertices[b++]=1;T.vertices[b++]=1;T.vertices[b++]=1;T.vertices[b++]=-1;T.vertices[b++]=1;T.vertices[b++]=0;T.vertices[b++]=1;b=0;T.faces[b++]=0;T.faces[b++]=1;T.faces[b++]=2;T.faces[b++]=0;T.faces[b++]=2;T.faces[b++]=3;
|
|
|
|
+T.vertexBuffer=e.createBuffer();T.elementBuffer=e.createBuffer();T.tempTexture=e.createTexture();T.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,T.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,T.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,T.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,T.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,T.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,
|
|
|
|
+e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.bindTexture(e.TEXTURE_2D,T.occlusionTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,16,16,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);
|
|
|
|
+e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);if(e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){T.hasVertexTexture=!1;T.program=e.createProgram();e.attachShader(T.program,oa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(T.program,oa("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{T.hasVertexTexture=!0;T.program=e.createProgram();e.attachShader(T.program,oa("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(T.program,
|
|
|
|
+oa("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(T.program);T.attributes={};T.uniforms={};T.attributes.vertex=e.getAttribLocation(T.program,"position");T.attributes.uv=e.getAttribLocation(T.program,"UV");T.uniforms.renderType=e.getUniformLocation(T.program,"renderType");T.uniforms.map=e.getUniformLocation(T.program,"map");T.uniforms.occlusionMap=e.getUniformLocation(T.program,"occlusionMap");T.uniforms.opacity=e.getUniformLocation(T.program,"opacity");T.uniforms.scale=
|
|
|
|
+e.getUniformLocation(T.program,"scale");T.uniforms.rotation=e.getUniformLocation(T.program,"rotation");T.uniforms.screenPosition=e.getUniformLocation(T.program,"screenPosition");var La=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=
|
|
|
|
+1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=e.createBuffer();_sprite.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,_sprite.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);
|
|
|
|
+e.bufferData(e.ELEMENT_ARRAY_BUFFER,_sprite.faces,e.STATIC_DRAW);_sprite.program=e.createProgram();e.attachShader(_sprite.program,oa("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,oa("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=
|
|
|
|
+e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=e.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=e.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=
|
|
|
|
+e.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=e.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=e.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");var db=!1;this.setSize=function(n,C){qa.width=n;qa.height=C;this.setViewport(0,
|
|
|
|
+0,qa.width,qa.height)};this.setViewport=function(n,C,w,v){ka=n;pa=C;Fa=w;ja=v;e.viewport(ka,pa,Fa,ja)};this.setScissor=function(n,C,w,v){e.scissor(n,C,w,v)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){ga=n;e.depthMask(n)};this.setClearColorHex=function(n,C){var w=new THREE.Color(n);e.clearColor(w.r,w.g,w.b,C)};this.setClearColor=function(n,C){e.clearColor(n.r,n.g,n.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|
|
|
|
|
+e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){W.darkness=n};this.getContext=function(){return e};this.initMaterial=function(n,C,w,v){var A,K,J;if(n instanceof THREE.MeshDepthMaterial)J="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)J="shadowVolumeDynamic";else if(n instanceof THREE.MeshNormalMaterial)J="normal";else if(n instanceof THREE.MeshBasicMaterial)J="basic";else if(n instanceof THREE.MeshLambertMaterial)J="lambert";else if(n instanceof
|
|
|
|
+THREE.MeshPhongMaterial)J="phong";else if(n instanceof THREE.LineBasicMaterial)J="basic";else n instanceof THREE.ParticleBasicMaterial&&(J="particle_basic");if(J){var I=THREE.ShaderLib[J];n.uniforms=THREE.UniformsUtils.clone(I.uniforms);n.vertexShader=I.vertexShader;n.fragmentShader=I.fragmentShader}var S,D,M;S=M=I=0;for(D=C.length;S<D;S++){K=C[S];K instanceof THREE.DirectionalLight&&M++;K instanceof THREE.PointLight&&I++}if(I+M<=4)C=M;else{C=Math.ceil(4*M/(I+M));I=4-C}K={directional:C,point:I};M=
|
|
|
|
+50;if(v!==undefined&&v instanceof THREE.SkinnedMesh)M=v.bones.length;var N;a:{S=n.fragmentShader;D=n.vertexShader;I=n.uniforms;C=n.attributes;w={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:w,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:K.directional,maxPointLights:K.point,maxBones:M};var Z;K=[];if(J)K.push(J);else{K.push(S);K.push(D)}for(Z in w){K.push(Z);K.push(w[Z])}J=K.join();
|
|
|
|
+Z=0;for(K=Ea.length;Z<K;Z++)if(Ea[Z].code==J){N=Ea[Z].program;break a}Z=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,w.fog?"#define USE_FOG":"",w.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",w.map?"#define USE_MAP":"",w.envMap?"#define USE_ENVMAP":"",w.lightMap?"#define USE_LIGHTMAP":"",w.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
|
|
|
|
+prefix_vertex=[aa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,"#define MAX_BONES "+w.maxBones,w.map?"#define USE_MAP":"",w.envMap?"#define USE_ENVMAP":"",w.lightMap?"#define USE_LIGHTMAP":"",w.vertexColors?"#define USE_COLOR":"",w.skinning?"#define USE_SKINNING":"",w.morphTargets?"#define USE_MORPHTARGETS":"",w.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
+e.attachShader(Z,oa("fragment",prefix_fragment+S));e.attachShader(Z,oa("vertex",prefix_vertex+D));e.linkProgram(Z);e.getProgramParameter(Z,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(Z,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");Z.uniforms={};Z.attributes={};var V;S=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(V in I)S.push(V);
|
|
|
|
+V=S;I=0;for(S=V.length;I<S;I++){D=V[I];Z.uniforms[D]=e.getUniformLocation(Z,D)}S=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(V=0;V<w.maxMorphTargets;V++)S.push("morphTarget"+V);for(N in C)S.push(N);N=S;V=0;for(C=N.length;V<C;V++){w=N[V];Z.attributes[w]=e.getAttribLocation(Z,w)}Ea.push({program:Z,code:J});N=Z}n.program=N;N=n.program.attributes;e.enableVertexAttribArray(N.position);N.color>=0&&e.enableVertexAttribArray(N.color);N.normal>=
|
|
|
|
+0&&e.enableVertexAttribArray(N.normal);N.tangent>=0&&e.enableVertexAttribArray(N.tangent);if(n.skinning&&N.skinVertexA>=0&&N.skinVertexB>=0&&N.skinIndex>=0&&N.skinWeight>=0){e.enableVertexAttribArray(N.skinVertexA);e.enableVertexAttribArray(N.skinVertexB);e.enableVertexAttribArray(N.skinIndex);e.enableVertexAttribArray(N.skinWeight)}for(A in n.attributes)N[A]>=0&&e.enableVertexAttribArray(N[A]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(N.morphTarget0>=0){e.enableVertexAttribArray(N.morphTarget0);
|
|
|
|
+n.numSupportedMorphTargets++}if(N.morphTarget1>=0){e.enableVertexAttribArray(N.morphTarget1);n.numSupportedMorphTargets++}if(N.morphTarget2>=0){e.enableVertexAttribArray(N.morphTarget2);n.numSupportedMorphTargets++}if(N.morphTarget3>=0){e.enableVertexAttribArray(N.morphTarget3);n.numSupportedMorphTargets++}if(N.morphTarget4>=0){e.enableVertexAttribArray(N.morphTarget4);n.numSupportedMorphTargets++}if(N.morphTarget5>=0){e.enableVertexAttribArray(N.morphTarget5);n.numSupportedMorphTargets++}if(N.morphTarget6>=
|
|
|
|
+0){e.enableVertexAttribArray(N.morphTarget6);n.numSupportedMorphTargets++}if(N.morphTarget7>=0){e.enableVertexAttribArray(N.morphTarget7);n.numSupportedMorphTargets++}v.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(A=this.maxMorphTargets;n<A;n++)v.__webglMorphTargetInfluences[n]=0}};this.render=function(n,C,w,v){var A,K,J,I,S,D,M,N,Z=n.lights,V=n.fog;fa.data.vertices=0;fa.data.faces=0;fa.data.drawCalls=0;C.matrixAutoUpdate&&C.update(undefined,!0);n.update(undefined,!1,
|
|
|
|
+C);C.matrixWorldInverse.flattenToArray(ab);C.projectionMatrix.flattenToArray(Ya);Ia.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ia);this.initWebGLObjects(n);sa(w);(this.autoClear||v)&&this.clear();S=n.__webglObjects.length;for(v=0;v<S;v++){A=n.__webglObjects[v];M=A.object;if(M.visible)if(!(M instanceof THREE.Mesh)||m(M)){M.matrixWorld.flattenToArray(M._objectMatrixArray);G(M,C);p(A);A.render=!0;if(this.sortObjects){Ra.copy(M.position);Ia.multiplyVector3(Ra);A.z=Ra.z}}else A.render=!1;else A.render=
|
|
|
|
+!1}this.sortObjects&&n.__webglObjects.sort(y);D=n.__webglObjectsImmediate.length;for(v=0;v<D;v++){A=n.__webglObjectsImmediate[v];M=A.object;if(M.visible){M.matrixAutoUpdate&&M.matrixWorld.flattenToArray(M._objectMatrixArray);G(M,C);t(A)}}P(THREE.NormalBlending);for(v=0;v<S;v++){A=n.__webglObjects[v];if(A.render){M=A.object;N=A.buffer;J=A.opaque;h(M);for(A=0;A<J.count;A++){I=J.list[A];j(I.depthTest);f(C,Z,V,I,N,M)}}}for(v=0;v<D;v++){A=n.__webglObjectsImmediate[v];M=A.object;if(M.visible){J=A.opaque;
|
|
|
|
+h(M);for(A=0;A<J.count;A++){I=J.list[A];j(I.depthTest);K=c(C,Z,V,I,M);M.render(function(Aa){g(Aa,K,I.shading)})}}}for(v=0;v<S;v++){A=n.__webglObjects[v];if(A.render){M=A.object;N=A.buffer;J=A.transparent;h(M);for(A=0;A<J.count;A++){I=J.list[A];P(I.blending);j(I.depthTest);f(C,Z,V,I,N,M)}}}for(v=0;v<D;v++){A=n.__webglObjectsImmediate[v];M=A.object;if(M.visible){J=A.transparent;h(M);for(A=0;A<J.count;A++){I=J.list[A];P(I.blending);j(I.depthTest);K=c(C,Z,V,I,M);M.render(function(Aa){g(Aa,K,I.shading)})}}}n.__webglSprites.length&&
|
|
|
|
+z(n,C);stencil&&n.__webglShadowVolumes.length&&n.lights.length&&u(n);n.__webglLensFlares.length&&H(n,C);if(w&&w.minFilter!==THREE.NearestFilter&&w.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,w.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=[]}for(;n.__objectsAdded.length;){var C=
|
|
|
|
+n.__objectsAdded[0],w=n,v=void 0,A=void 0,K=void 0;if(C._modelViewMatrix==undefined){C._modelViewMatrix=new THREE.Matrix4;C._normalMatrixArray=new Float32Array(9);C._modelViewMatrixArray=new Float32Array(16);C._objectMatrixArray=new Float32Array(16);C.matrixWorld.flattenToArray(C._objectMatrixArray)}if(C instanceof THREE.Mesh){A=C.geometry;A.geometryGroups==undefined&&R(A);for(v in A.geometryGroups){K=A.geometryGroups[v];if(!K.__webglVertexBuffer){var J=K;J.__webglVertexBuffer=e.createBuffer();J.__webglNormalBuffer=
|
|
|
|
+e.createBuffer();J.__webglTangentBuffer=e.createBuffer();J.__webglColorBuffer=e.createBuffer();J.__webglUVBuffer=e.createBuffer();J.__webglUV2Buffer=e.createBuffer();J.__webglSkinVertexABuffer=e.createBuffer();J.__webglSkinVertexBBuffer=e.createBuffer();J.__webglSkinIndicesBuffer=e.createBuffer();J.__webglSkinWeightsBuffer=e.createBuffer();J.__webglFaceBuffer=e.createBuffer();J.__webglLineBuffer=e.createBuffer();if(J.numMorphTargets){var I=void 0,S=void 0;J.__webglMorphTargetsBuffers=[];I=0;for(S=
|
|
|
|
+J.numMorphTargets;I<S;I++)J.__webglMorphTargetsBuffers.push(e.createBuffer())}J=K;I=C;var D=void 0,M=void 0,N=void 0;N=void 0;var Z=void 0,V=void 0,Aa=void 0,Ka=Aa=S=0;M=void 0;N=void 0;var Ba=void 0;D=void 0;M=void 0;Z=I.geometry;Ba=Z.faces;V=J.faces;D=0;for(M=V.length;D<M;D++){N=V[D];N=Ba[N];if(N instanceof THREE.Face3){S+=3;Aa+=1;Ka+=3}else if(N instanceof THREE.Face4){S+=4;Aa+=2;Ka+=4}}D=J;M=I;Ba=void 0;V=void 0;var ya=void 0,Oa=void 0;ya=void 0;N=[];Ba=0;for(V=M.materials.length;Ba<V;Ba++){ya=
|
|
|
|
+M.materials[Ba];if(ya instanceof THREE.MeshFaceMaterial){ya=0;for(l=D.materials.length;ya<l;ya++)(Oa=D.materials[ya])&&N.push(Oa)}else(Oa=ya)&&N.push(Oa)}D=N;a:{M=void 0;Ba=void 0;V=D.length;for(M=0;M<V;M++){Ba=D[M];if(Ba.map||Ba.lightMap||Ba instanceof THREE.MeshShaderMaterial){M=!0;break a}}M=!1}a:{Ba=D;V=void 0;N=void 0;ya=Ba.length;for(V=0;V<ya;V++){N=Ba[V];if(!(N instanceof THREE.MeshBasicMaterial&&!N.envMap||N instanceof THREE.MeshDepthMaterial)){Ba=N&&N.shading!=undefined&&N.shading==THREE.SmoothShading?
|
|
|
|
+THREE.SmoothShading:THREE.FlatShading;break a}}Ba=!1}a:{V=void 0;N=void 0;ya=D.length;for(V=0;V<ya;V++){N=D[V];if(N.vertexColors){N=N.vertexColors;break a}}N=!1}J.__vertexArray=new Float32Array(S*3);if(Ba)J.__normalArray=new Float32Array(S*3);if(Z.hasTangents)J.__tangentArray=new Float32Array(S*4);if(N)J.__colorArray=new Float32Array(S*3);if(M){if(Z.faceUvs.length>0||Z.faceVertexUvs.length>0)J.__uvArray=new Float32Array(S*2);if(Z.faceUvs.length>1||Z.faceVertexUvs.length>1)J.__uv2Array=new Float32Array(S*
|
|
|
|
+2)}if(I.geometry.skinWeights.length&&I.geometry.skinIndices.length){J.__skinVertexAArray=new Float32Array(S*4);J.__skinVertexBArray=new Float32Array(S*4);J.__skinIndexArray=new Float32Array(S*4);J.__skinWeightArray=new Float32Array(S*4)}J.__faceArray=new Uint16Array(Aa*3+(I.geometry.edgeFaces?I.geometry.edgeFaces.length*6:0));J.__lineArray=new Uint16Array(Ka*2);if(J.numMorphTargets){J.__morphTargetsArrays=[];Z=0;for(V=J.numMorphTargets;Z<V;Z++)J.__morphTargetsArrays.push(new Float32Array(S*3))}J.__needsSmoothNormals=
|
|
|
|
+Ba==THREE.SmoothShading;J.__uvType=M;J.__vertexColorType=N;J.__normalType=Ba;J.__webglFaceCount=Aa*3+(I.geometry.edgeFaces?I.geometry.edgeFaces.length*6:0);J.__webglLineCount=Ka*2;Z=0;for(V=D.length;Z<V;Z++)if(D[Z].attributes){J.__webglCustomAttributes={};for(a in D[Z].attributes){M=D[Z].attributes[a];if(!M.__webglInitialized||M.createUniqueBuffers){M.__webglInitialized=!0;Aa=1;if(M.type==="v2")Aa=2;else if(M.type==="v3")Aa=3;else if(M.type==="v4")Aa=4;else M.type==="c"&&(Aa=3);M.size=Aa;M.needsUpdate=
|
|
|
|
+!0;M.array=new Float32Array(S*Aa);M.buffer=e.createBuffer();M.buffer.belongsToAttribute=a}J.__webglCustomAttributes[a]=M}}A.__dirtyVertices=!0;A.__dirtyMorphTargets=!0;A.__dirtyElements=!0;A.__dirtyUvs=!0;A.__dirtyNormals=!0;A.__dirtyTangents=!0;A.__dirtyColors=!0}C instanceof THREE.ShadowVolume?E(w.__webglShadowVolumes,K,C):E(w.__webglObjects,K,C)}}else if(C instanceof THREE.LensFlare)E(w.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){A=C.geometry;if(!A.__webglVertexBuffer){v=
|
|
|
|
+A;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=A;K=v.vertices.length;v.__vertexArray=new Float32Array(K*3);v.__colorArray=new Float32Array(K*3);v.__webglVertexCount=K;A.__dirtyVertices=!0;A.__dirtyColors=!0}E(w.__webglObjects,A,C)}else if(C instanceof THREE.Line){A=C.geometry;if(!A.__webglVertexBuffer){v=A;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=A;K=v.vertices.length;v.__vertexArray=new Float32Array(K*3);v.__colorArray=new Float32Array(K*
|
|
|
|
+3);v.__webglLineCount=K;A.__dirtyVertices=!0;A.__dirtyColors=!0}E(w.__webglObjects,A,C)}else if(C instanceof THREE.ParticleSystem){A=C.geometry;if(!A.__webglVertexBuffer){v=A;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=A;K=v.vertices.length;v.__vertexArray=new Float32Array(K*3);v.__colorArray=new Float32Array(K*3);v.__sortArray=[];v.__webglParticleCount=K;A.__dirtyVertices=!0;A.__dirtyColors=!0}E(w.__webglObjects,A,C)}else if(THREE.MarchingCubes!==undefined&&C instanceof
|
|
|
|
+THREE.MarchingCubes)w.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});else C instanceof THREE.Sprite&&w.__webglSprites.push(C);n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){C=n.__objectsRemoved[0];w=n;A=void 0;v=void 0;if(C instanceof THREE.Mesh)for(A=w.__webglObjects.length-1;A>=0;A--){v=w.__webglObjects[A].object;if(C==v){w.__webglObjects.splice(A,1);break}}else if(C instanceof THREE.Sprite)for(A=w.__webglSprites.length-1;A>=0;A--){v=
|
|
|
|
+w.__webglSprites[A];if(C==v){w.__webglSprites.splice(A,1);break}}n.__objectsRemoved.splice(0,1)}C=0;for(w=n.__webglObjects.length;C<w;C++)B(n.__webglObjects[C].object,n);C=0;for(w=n.__webglShadowVolumes.length;C<w;C++)B(n.__webglShadowVolumes[C].object,n);C=0;for(w=n.__webglLensFlares.length;C<w;C++)B(n.__webglLensFlares[C].object,n)};this.setFaceCulling=function(n,C){if(n){!C||C=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(n=="back")e.cullFace(e.BACK);else n=="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 aa}};
|
|
THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;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.RGBAFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==
|
|
THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;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.RGBAFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==
|
|
undefined?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==undefined?c.stencilBuffer:!0};
|
|
undefined?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==undefined?c.stencilBuffer:!0};
|
|
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(b,d,c){c&&b.update(undefined,!1,d);c=b.sounds;var f,g=c.length;for(f=0;f<g;f++){b=c[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
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(b,d,c){c&&b.update(undefined,!1,d);c=b.sounds;var f,g=c.length;for(f=0;f<g;f++){b=c[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
@@ -350,8 +350,8 @@ THREE.Animation.prototype.play=function(b,d){if(!this.isPlaying){this.isPlaying=
|
|
g instanceof THREE.Bone?g.skinMatrix:g.matrix}var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];g.pos=this.getNextKeyWith("pos",c,1);g.rot=this.getNextKeyWith("rot",c,1);g.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
g instanceof THREE.Bone?g.skinMatrix:g.matrix}var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];g.pos=this.getNextKeyWith("pos",c,1);g.rot=this.getNextKeyWith("rot",c,1);g.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.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==undefined){if(this.hierarchy[b]instanceof THREE.Bone)this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix;else this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
|
|
THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==undefined){if(this.hierarchy[b]instanceof THREE.Bone)this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix;else this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
|
|
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],c,f,g,h,j,k,m,o,t=this.data.JIT.hierarchy,p,y;this.currentTime+=b*this.timeScale;y=this.currentTime;p=this.currentTime%=this.data.length;o=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,A=this.hierarchy.length;u<A;u++){b=this.hierarchy[u];m=b.animationCache;if(this.JITCompile&&t[u][o]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=t[u][o];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
|
|
|
|
-!1}else{b.matrix=t[u][o];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var I=0;I<3;I++){c=d[I];j=m.prevKey[c];k=m.nextKey[c];if(k.time<=y){if(p<y)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(c,u,1);k.time<p;){j=k;k=this.getNextKeyWith(c,u,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(c,u,k.index+1)}while(k.time<
|
|
|
|
|
|
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],c,f,g,h,j,k,m,o,t=this.data.JIT.hierarchy,p,y;this.currentTime+=b*this.timeScale;y=this.currentTime;p=this.currentTime%=this.data.length;o=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,z=this.hierarchy.length;u<z;u++){b=this.hierarchy[u];m=b.animationCache;if(this.JITCompile&&t[u][o]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=t[u][o];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
|
|
|
|
+!1}else{b.matrix=t[u][o];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var H=0;H<3;H++){c=d[H];j=m.prevKey[c];k=m.nextKey[c];if(k.time<=y){if(p<y)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(c,u,1);k.time<p;){j=k;k=this.getNextKeyWith(c,u,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(c,u,k.index+1)}while(k.time<
|
|
p)}m.prevKey[c]=j;m.nextKey[c]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(p-j.time)/(k.time-j.time);g=j[c];h=k[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
|
|
p)}m.prevKey[c]=j;m.nextKey[c]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(p-j.time)/(k.time-j.time);g=j[c];h=k[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
|
|
this.getPrevKeyWith("pos",u,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);c.x=g[0];c.y=g[1];c.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(c===
|
|
this.getPrevKeyWith("pos",u,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);c.x=g[0];c.y=g[1];c.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(c===
|
|
"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(c==="scl"){c=b.scale;c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&t[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(u=0;u<this.hierarchy.length;u++)t[u][o]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
|
|
"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(c==="scl"){c=b.scale;c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&t[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(u=0;u<this.hierarchy.length;u++)t[u][o]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
|
|
@@ -360,8 +360,8 @@ THREE.Animation.prototype.interpolate=function(b,d,c,f,g,h,j){b=(c-b)*0.5;f=(f-d
|
|
THREE.Animation.prototype.getPrevKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[f.length-1]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[f.length-1]};
|
|
THREE.ColorUtils={adjustHSV:function(b,d,c,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+d,0,1);g.s=THREE.ColorUtils.clamp(g.s+c,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,d){var c=b.r,f=b.g,g=b.b,h=Math.max(Math.max(c,f),g),j=Math.min(Math.min(c,f),g);if(j==h)j=c=0;else{var k=h-j;j=k/h;c=c==h?(f-g)/k:f==h?2+(g-c)/k:4+(c-f)/k;c/=6;c<0&&(c+=1);c>1&&(c-=1)}d===undefined&&(d={h:0,s:0,v:0});d.h=c;d.s=j;d.v=h;return d},
|
|
THREE.ColorUtils={adjustHSV:function(b,d,c,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+d,0,1);g.s=THREE.ColorUtils.clamp(g.s+c,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,d){var c=b.r,f=b.g,g=b.b,h=Math.max(Math.max(c,f),g),j=Math.min(Math.min(c,f),g);if(j==h)j=c=0;else{var k=h-j;j=k/h;c=c==h?(f-g)/k:f==h?2+(g-c)/k:4+(c-f)/k;c/=6;c<0&&(c+=1);c>1&&(c-=1)}d===undefined&&(d={h:0,s:0,v:0});d.h=c;d.s=j;d.v=h;return d},
|
|
clamp:function(b,d,c){return b<d?d:b>c?c:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
clamp:function(b,d,c){return b<d?d:b>c?c:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
-var GeometryUtils={merge:function(b,d){var c=d instanceof THREE.Mesh,f=b.vertices.length,g=c?d.geometry:d,h=b.vertices,j=g.vertices,k=b.faces,m=g.faces,o=b.faceVertexUvs[0];g=g.faceVertexUvs[0];c&&d.matrixAutoUpdate&&d.updateMatrix();for(var t=0,p=j.length;t<p;t++){var y=new THREE.Vertex(j[t].position.clone());c&&d.matrix.multiplyVector3(y.position);h.push(y)}t=0;for(p=m.length;t<p;t++){j=m[t];var u,A,I=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)u=new THREE.Face3(j.a+f,j.b+f,j.c+
|
|
|
|
-f);else j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));u.normal.copy(j.normal);c=0;for(h=I.length;c<h;c++){A=I[c];u.vertexNormals.push(A.clone())}u.color.copy(j.color);c=0;for(h=y.length;c<h;c++){A=y[c];u.vertexColors.push(A.clone())}u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}t=0;for(p=g.length;t<p;t++){f=g[t];k=[];c=0;for(h=f.length;c<h;c++)k.push(new THREE.UV(f[c].u,f[c].v));o.push(k)}}};
|
|
|
|
|
|
+var GeometryUtils={merge:function(b,d){var c=d instanceof THREE.Mesh,f=b.vertices.length,g=c?d.geometry:d,h=b.vertices,j=g.vertices,k=b.faces,m=g.faces,o=b.faceVertexUvs[0];g=g.faceVertexUvs[0];c&&d.matrixAutoUpdate&&d.updateMatrix();for(var t=0,p=j.length;t<p;t++){var y=new THREE.Vertex(j[t].position.clone());c&&d.matrix.multiplyVector3(y.position);h.push(y)}t=0;for(p=m.length;t<p;t++){j=m[t];var u,z,H=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)u=new THREE.Face3(j.a+f,j.b+f,j.c+
|
|
|
|
+f);else j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));u.normal.copy(j.normal);c=0;for(h=H.length;c<h;c++){z=H[c];u.vertexNormals.push(z.clone())}u.color.copy(j.color);c=0;for(h=y.length;c<h;c++){z=y[c];u.vertexColors.push(z.clone())}u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}t=0;for(p=g.length;t<p;t++){f=g[t];k=[];c=0;for(h=f.length;c<h;c++)k.push(new THREE.UV(f[c].u,f[c].v));o.push(k)}}};
|
|
THREE.ImageUtils={loadTexture:function(b,d,c){var f=new Image,g=new THREE.Texture(f,d);f.onload=function(){g.needsUpdate=!0;c&&c(this)};f.src=b;return g},loadTextureCube:function(b,d,c){var f,g=[],h=new THREE.Texture(g,d);d=g.loadCount=0;for(f=b.length;d<f;++d){g[d]=new Image;g[d].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;c&&c(this)};g[d].src=b[d]}return h}};
|
|
THREE.ImageUtils={loadTexture:function(b,d,c){var f=new Image,g=new THREE.Texture(f,d);f.onload=function(){g.needsUpdate=!0;c&&c(this)};f.src=b;return g},loadTextureCube:function(b,d,c){var f,g=[],h=new THREE.Texture(g,d);d=g.loadCount=0;for(f=b.length;d<f;++d){g[d]=new Image;g[d].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;c&&c(this)};g[d].src=b[d]}return h}};
|
|
THREE.SceneUtils={addMesh:function(b,d,c,f,g,h,j,k,m,o){d=new THREE.Mesh(d,o);d.scale.x=d.scale.y=d.scale.z=c;d.position.x=f;d.position.y=g;d.position.z=h;d.rotation.x=j;d.rotation.y=k;d.rotation.z=m;b.addObject(d);return d},addPanoramaCubeWebGL:function(b,d,c){var f=THREE.ShaderUtils.lib.cube;f.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,1,null,!0),c);b.addObject(d);
|
|
THREE.SceneUtils={addMesh:function(b,d,c,f,g,h,j,k,m,o){d=new THREE.Mesh(d,o);d.scale.x=d.scale.y=d.scale.z=c;d.position.x=f;d.position.y=g;d.position.z=h;d.rotation.x=j;d.rotation.y=k;d.rotation.z=m;b.addObject(d);return d},addPanoramaCubeWebGL:function(b,d,c){var f=THREE.ShaderUtils.lib.cube;f.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,1,null,!0),c);b.addObject(d);
|
|
return d},addPanoramaCube:function(b,d,c){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,f,!0),
|
|
return d},addPanoramaCube:function(b,d,c){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,f,!0),
|
|
@@ -387,7 +387,7 @@ this.activeLook||(f=0);this.lon+=this.mouseX*f;this.lookVertical&&(this.lat-=thi
|
|
(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;c=this.target.position;g=this.position;c.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=g.y+100*Math.cos(this.phi);c.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(c){c.preventDefault()},!1);this.domElement.addEventListener("mousemove",d(this,
|
|
(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;c=this.target.position;g=this.position;c.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=g.y+100*Math.cos(this.phi);c.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(c){c.preventDefault()},!1);this.domElement.addEventListener("mousemove",d(this,
|
|
this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
|
|
this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
|
|
THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
|
|
THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
|
|
-THREE.PathCamera=function(b){function d(o,t,p,y){var u={name:p,fps:0.6,length:y,hierarchy:[]},A,I=t.getControlPointsArray(),H=t.getLength(),B=I.length,U=0;A=B-1;t={parent:-1,keys:[]};t.keys[0]={time:0,pos:I[0],rot:[0,0,0,1],scl:[1,1,1]};t.keys[A]={time:y,pos:I[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<B-1;A++){U=y*H.chunks[A]/H.total;t.keys[A]={time:U,pos:I[A]}}u.hierarchy[0]=t;THREE.AnimationHandler.add(u);return new THREE.Animation(o,p,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(o,t){var p,
|
|
|
|
|
|
+THREE.PathCamera=function(b){function d(o,t,p,y){var u={name:p,fps:0.6,length:y,hierarchy:[]},z,H=t.getControlPointsArray(),G=t.getLength(),B=H.length,R=0;z=B-1;t={parent:-1,keys:[]};t.keys[0]={time:0,pos:H[0],rot:[0,0,0,1],scl:[1,1,1]};t.keys[z]={time:y,pos:H[z],rot:[0,0,0,1],scl:[1,1,1]};for(z=1;z<B-1;z++){R=y*G.chunks[z]/G.total;t.keys[z]={time:R,pos:H[z]}}u.hierarchy[0]=t;THREE.AnimationHandler.add(u);return new THREE.Animation(o,p,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(o,t){var p,
|
|
y,u=new THREE.Geometry;for(p=0;p<o.points.length*t;p++){y=p/(o.points.length*t);y=o.getPoint(y);u.vertices[p]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return u}function f(o,t){var p=c(t,10),y=c(t,10),u=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(p,u);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);y=new THREE.Sphere(1,
|
|
y,u=new THREE.Geometry;for(p=0;p<o.points.length*t;p++){y=p/(o.points.length*t);y=o.getPoint(y);u.vertices[p]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return u}function f(o,t){var p=c(t,10),y=c(t,10),u=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(p,u);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);y=new THREE.Sphere(1,
|
|
16,8);u=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){p=new THREE.Mesh(y,u);p.position.copy(t.points[i]);p.updateMatrix();o.addChild(p)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
|
|
16,8);u=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){p=new THREE.Mesh(y,u);p.position.copy(t.points[i]);p.updateMatrix();o.addChild(p)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
|
|
!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
|
|
!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
|
|
@@ -406,34 +406,34 @@ this.rollSpeed;this.translateX(this.moveVector.x*c);this.translateY(this.moveVec
|
|
this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-c+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
|
|
this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-c+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
|
|
document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",d(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",d(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",d(this,this.mouseup),!1);window.addEventListener("keydown",d(this,this.keydown),!1);window.addEventListener("keyup",d(this,
|
|
document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",d(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",d(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",d(this,this.mouseup),!1);window.addEventListener("keydown",d(this,this.keydown),!1);window.addEventListener("keyup",d(this,
|
|
this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
|
|
this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
|
|
-THREE.RollCamera=function(b,d,c,f){THREE.Camera.call(this,b,d,c,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.useTarget=!1;this.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,o=1,t=0,p=0,y=0,u=0,A=0,I=window.innerWidth/2,H=window.innerHeight/2;this.update=
|
|
|
|
-function(){var B=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=B;this.delta=(B-this.lastUpdate)/1E3;this.lastUpdate=B;if(this.mouseLook){B=this.delta*this.lookSpeed;this.rotateHorizontally(B*u);this.rotateVertically(B*A)}B=this.delta*this.movementSpeed;this.translateZ(B*(t>0||this.autoForward&&!(t<0)?1:t));this.translateX(B*p);this.translateY(B*y);m&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<
|
|
|
|
|
|
+THREE.RollCamera=function(b,d,c,f){THREE.Camera.call(this,b,d,c,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.useTarget=!1;this.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,o=1,t=0,p=0,y=0,u=0,z=0,H=window.innerWidth/2,G=window.innerHeight/2;this.update=
|
|
|
|
+function(){var B=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=B;this.delta=(B-this.lastUpdate)/1E3;this.lastUpdate=B;if(this.mouseLook){B=this.delta*this.lookSpeed;this.rotateHorizontally(B*u);this.rotateVertically(B*z)}B=this.delta*this.movementSpeed;this.translateZ(B*(t>0||this.autoForward&&!(t<0)?1:t));this.translateX(B*p);this.translateY(B*y);m&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<
|
|
this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}j.copy(this.forward);h.set(0,1,0);g.cross(h,j).normalize();h.cross(j,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=j.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=j.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=j.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.matrix.multiplySelf(k);
|
|
this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}j.copy(this.forward);h.set(0,1,0);g.cross(h,j).normalize();h.cross(j,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=j.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=j.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=j.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.matrix.multiplySelf(k);
|
|
this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(B){this.position.x+=this.matrix.n11*B;this.position.y+=this.matrix.n21*B;this.position.z+=this.matrix.n31*B};this.translateY=function(B){this.position.x+=this.matrix.n12*B;this.position.y+=this.matrix.n22*B;this.position.z+=this.matrix.n32*B};this.translateZ=function(B){this.position.x-=this.matrix.n13*B;this.position.y-=
|
|
this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(B){this.position.x+=this.matrix.n11*B;this.position.y+=this.matrix.n21*B;this.position.z+=this.matrix.n31*B};this.translateY=function(B){this.position.x+=this.matrix.n12*B;this.position.y+=this.matrix.n22*B;this.position.z+=this.matrix.n32*B};this.translateZ=function(B){this.position.x-=this.matrix.n13*B;this.position.y-=
|
|
this.matrix.n23*B;this.position.z-=this.matrix.n33*B};this.rotateHorizontally=function(B){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(B);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(B){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(B);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(B){B.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
this.matrix.n23*B;this.position.z-=this.matrix.n33*B};this.rotateHorizontally=function(B){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(B);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(B){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(B);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(B){B.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
-function(B){u=(B.clientX-I)/window.innerWidth;A=(B.clientY-H)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:t=1;break;case 2:t=-1}},!1);this.domElement.addEventListener("mouseup",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:t=0;break;case 2:t=0}},!1);this.domElement.addEventListener("keydown",function(B){switch(B.keyCode){case 38:case 87:t=1;break;case 37:case 65:p=-1;break;
|
|
|
|
|
|
+function(B){u=(B.clientX-H)/window.innerWidth;z=(B.clientY-G)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:t=1;break;case 2:t=-1}},!1);this.domElement.addEventListener("mouseup",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:t=0;break;case 2:t=0}},!1);this.domElement.addEventListener("keydown",function(B){switch(B.keyCode){case 38:case 87:t=1;break;case 37:case 65:p=-1;break;
|
|
case 40:case 83:t=-1;break;case 39:case 68:p=1;break;case 81:m=!0;o=1;break;case 69:m=!0;o=-1;break;case 82:y=1;break;case 70:y=-1}},!1);this.domElement.addEventListener("keyup",function(B){switch(B.keyCode){case 38:case 87:t=0;break;case 37:case 65:p=0;break;case 40:case 83:t=0;break;case 39:case 68:p=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:y=0;break;case 70:y=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
case 40:case 83:t=-1;break;case 39:case 68:p=1;break;case 81:m=!0;o=1;break;case 69:m=!0;o=-1;break;case 82:y=1;break;case 70:y=-1}},!1);this.domElement.addEventListener("keyup",function(B){switch(B.keyCode){case 38:case 87:t=0;break;case 37:case 65:p=0;break;case 40:case 83:t=0;break;case 39:case 68:p=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:y=0;break;case 70:y=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
|
|
THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
|
|
-THREE.Cube=function(b,d,c,f,g,h,j,k,m){function o(H,B,U,D,R,L,Q,qa){var la,ra,ga=f||1,ea=g||1,e=R/2,oa=L/2,Da=t.vertices.length;if(H=="x"&&B=="y"||H=="y"&&B=="x")la="z";else if(H=="x"&&B=="z"||H=="z"&&B=="x"){la="y";ea=h||1}else if(H=="z"&&B=="y"||H=="y"&&B=="z"){la="x";ga=h||1}var Aa=ga+1,da=ea+1;R/=ga;var fa=L/ea;for(ra=0;ra<da;ra++)for(L=0;L<Aa;L++){var wa=new THREE.Vector3;wa[H]=(L*R-e)*U;wa[B]=(ra*fa-oa)*D;wa[la]=Q;t.vertices.push(new THREE.Vertex(wa))}for(ra=0;ra<ea;ra++)for(L=0;L<ga;L++){t.faces.push(new THREE.Face4(L+
|
|
|
|
-Aa*ra+Da,L+Aa*(ra+1)+Da,L+1+Aa*(ra+1)+Da,L+1+Aa*ra+Da,null,null,qa));t.faceVertexUvs[0].push([new THREE.UV(L/ga,ra/ea),new THREE.UV(L/ga,(ra+1)/ea),new THREE.UV((L+1)/ga,(ra+1)/ea),new THREE.UV((L+1)/ga,ra/ea)])}}THREE.Geometry.call(this);var t=this,p=b/2,y=d/2,u=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var I in m)this.sides[I]!=
|
|
|
|
-undefined&&(this.sides[I]=m[I]);this.sides.px&&o("z","y",1*k,-1,c,d,-p,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,c,d,p,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,c,y,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,c,-y,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,d,u,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,d,-u,this.materials[5]);(function(){for(var H=[],B=[],U=0,D=t.vertices.length;U<D;U++){for(var R=t.vertices[U],L=!1,Q=0,qa=H.length;Q<qa;Q++){var la=
|
|
|
|
-H[Q];if(R.position.x==la.position.x&&R.position.y==la.position.y&&R.position.z==la.position.z){B[U]=Q;L=!0;break}}if(!L){B[U]=H.length;H.push(new THREE.Vertex(R.position.clone()))}}U=0;for(D=t.faces.length;U<D;U++){R=t.faces[U];R.a=B[R.a];R.b=B[R.b];R.c=B[R.c];R.d=B[R.d]}t.vertices=H})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
|
|
|
|
-THREE.Cylinder=function(b,d,c,f,g,h){function j(y,u,A){k.vertices.push(new THREE.Vertex(new THREE.Vector3(y,u,A)))}THREE.Geometry.call(this);var k=this,m,o=Math.PI*2,t=f/2;for(m=0;m<b;m++)j(Math.sin(o*m/b)*d,Math.cos(o*m/b)*d,-t);for(m=0;m<b;m++)j(Math.sin(o*m/b)*c,Math.cos(o*m/b)*c,t);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(c>0){j(0,0,-t-(h||0));for(m=b;m<b+b/2;m++)k.faces.push(new THREE.Face4(2*b,(2*m-2*b)%b,(2*m-2*b+1)%b,(2*m-2*b+2)%b))}if(d>0){j(0,0,t+(g||0));
|
|
|
|
|
|
+THREE.Cube=function(b,d,c,f,g,h,j,k,m){function o(G,B,R,E,P,L,O,sa){var oa,ta,ha=f||1,fa=g||1,e=P/2,qa=L/2,Ea=t.vertices.length;if(G=="x"&&B=="y"||G=="y"&&B=="x")oa="z";else if(G=="x"&&B=="z"||G=="z"&&B=="x"){oa="y";fa=h||1}else if(G=="z"&&B=="y"||G=="y"&&B=="z"){oa="x";ha=h||1}var Da=ha+1,ea=fa+1;P/=ha;var ga=L/fa;for(ta=0;ta<ea;ta++)for(L=0;L<Da;L++){var xa=new THREE.Vector3;xa[G]=(L*P-e)*R;xa[B]=(ta*ga-qa)*E;xa[oa]=O;t.vertices.push(new THREE.Vertex(xa))}for(ta=0;ta<fa;ta++)for(L=0;L<ha;L++){t.faces.push(new THREE.Face4(L+
|
|
|
|
+Da*ta+Ea,L+Da*(ta+1)+Ea,L+1+Da*(ta+1)+Ea,L+1+Da*ta+Ea,null,null,sa));t.faceVertexUvs[0].push([new THREE.UV(L/ha,ta/fa),new THREE.UV(L/ha,(ta+1)/fa),new THREE.UV((L+1)/ha,(ta+1)/fa),new THREE.UV((L+1)/ha,ta/fa)])}}THREE.Geometry.call(this);var t=this,p=b/2,y=d/2,u=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var z=0;z<6;z++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var H in m)this.sides[H]!=
|
|
|
|
+undefined&&(this.sides[H]=m[H]);this.sides.px&&o("z","y",1*k,-1,c,d,-p,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,c,d,p,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,c,y,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,c,-y,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,d,u,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,d,-u,this.materials[5]);(function(){for(var G=[],B=[],R=0,E=t.vertices.length;R<E;R++){for(var P=t.vertices[R],L=!1,O=0,sa=G.length;O<sa;O++){var oa=
|
|
|
|
+G[O];if(P.position.x==oa.position.x&&P.position.y==oa.position.y&&P.position.z==oa.position.z){B[R]=O;L=!0;break}}if(!L){B[R]=G.length;G.push(new THREE.Vertex(P.position.clone()))}}R=0;for(E=t.faces.length;R<E;R++){P=t.faces[R];P.a=B[P.a];P.b=B[P.b];P.c=B[P.c];P.d=B[P.d]}t.vertices=G})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
|
|
|
|
+THREE.Cylinder=function(b,d,c,f,g,h){function j(y,u,z){k.vertices.push(new THREE.Vertex(new THREE.Vector3(y,u,z)))}THREE.Geometry.call(this);var k=this,m,o=Math.PI*2,t=f/2;for(m=0;m<b;m++)j(Math.sin(o*m/b)*d,Math.cos(o*m/b)*d,-t);for(m=0;m<b;m++)j(Math.sin(o*m/b)*c,Math.cos(o*m/b)*c,t);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(c>0){j(0,0,-t-(h||0));for(m=b;m<b+b/2;m++)k.faces.push(new THREE.Face4(2*b,(2*m-2*b)%b,(2*m-2*b+1)%b,(2*m-2*b+2)%b))}if(d>0){j(0,0,t+(g||0));
|
|
for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m<b;m++){d=[];c=this.faces[m];g=this.vertices[c.a];h=this.vertices[c.b];t=this.vertices[c.c];var p=this.vertices[c.d];d.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/o,0.5+h.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/o,0.5+t.position.z/
|
|
for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m<b;m++){d=[];c=this.faces[m];g=this.vertices[c.a];h=this.vertices[c.b];t=this.vertices[c.c];var p=this.vertices[c.d];d.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/o,0.5+h.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/o,0.5+t.position.z/
|
|
f));c instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/f));this.faceVertexUvs[0].push(d)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
|
|
f));c instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/f));this.faceVertexUvs[0].push(d)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
|
|
-THREE.Icosahedron=function(b){function d(p,y,u){var A=Math.sqrt(p*p+y*y+u*u);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(p/A,y/A,u/A)))-1}function c(p,y,u,A){A.faces.push(new THREE.Face3(p,y,u))}function f(p,y){var u=g.vertices[p].position,A=g.vertices[y].position;return d((u.x+A.x)/2,(u.y+A.y)/2,(u.z+A.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
|
|
|
|
|
|
+THREE.Icosahedron=function(b){function d(p,y,u){var z=Math.sqrt(p*p+y*y+u*u);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(p/z,y/z,u/z)))-1}function c(p,y,u,z){z.faces.push(new THREE.Face3(p,y,u))}function f(p,y){var u=g.vertices[p].position,z=g.vertices[y].position;return d((u.x+z.x)/2,(u.y+z.y)/2,(u.z+z.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
|
|
1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var m=f(h.faces[k].a,h.faces[k].b),o=f(h.faces[k].b,h.faces[k].c),t=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,m,t,j);c(h.faces[k].b,o,m,j);c(h.faces[k].c,
|
|
1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var m=f(h.faces[k].a,h.faces[k].b),o=f(h.faces[k].b,h.faces[k].c),t=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,m,t,j);c(h.faces[k].b,o,m,j);c(h.faces[k].c,
|
|
t,o,j);c(m,o,t,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
|
|
t,o,j);c(m,o,t,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
|
|
THREE.Lathe=function(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;c=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(d),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));c[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.0010;m+=d){for(k=0;k<c.length;k++)if(m<this.angle){c[k]=j.multiplyVector3(c[k].clone());this.vertices.push(new THREE.Vertex(c[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);
|
|
THREE.Lathe=function(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;c=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(d),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));c[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.0010;m+=d){for(k=0;k<c.length;k++)if(m<this.angle){c[k]=j.multiplyVector3(c[k].clone());this.vertices.push(new THREE.Vertex(c[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);
|
|
for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
|
|
for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
|
|
THREE.Plane=function(b,d,c,f){THREE.Geometry.call(this);var g,h=b/2,j=d/2;c=c||1;f=f||1;var k=c+1,m=f+1;b/=c;var o=d/f;for(g=0;g<m;g++)for(d=0;d<k;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*b-h,-(g*o-j),0)));for(g=0;g<f;g++)for(d=0;d<c;d++){this.faces.push(new THREE.Face4(d+k*g,d+k*(g+1),d+1+k*(g+1),d+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(d/c,g/f),new THREE.UV(d/c,(g+1)/f),new THREE.UV((d+1)/c,(g+1)/f),new THREE.UV((d+1)/c,g/f)])}this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.Plane=function(b,d,c,f){THREE.Geometry.call(this);var g,h=b/2,j=d/2;c=c||1;f=f||1;var k=c+1,m=f+1;b/=c;var o=d/f;for(g=0;g<m;g++)for(d=0;d<k;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*b-h,-(g*o-j),0)));for(g=0;g<f;g++)for(d=0;d<c;d++){this.faces.push(new THREE.Face4(d+k*g,d+k*(g+1),d+1+k*(g+1),d+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(d/c,g/f),new THREE.UV(d/c,(g+1)/f),new THREE.UV((d+1)/c,(g+1)/f),new THREE.UV((d+1)/c,g/f)])}this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
|
|
THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
|
|
-THREE.Sphere=function(b,d,c){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,d||8),j=Math.max(2,c||6);d=[];for(c=0;c<j+1;c++){f=c/j;var k=b*Math.cos(f*g),m=b*Math.sin(f*g),o=[],t=0;for(f=0;f<h;f++){var p=2*f/h,y=m*Math.sin(p*g);p=m*Math.cos(p*g);(c==0||c==j)&&f>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,y)))-1);o.push(t)}d.push(o)}var u,A,I;g=d.length;for(c=0;c<g;c++){h=d[c].length;if(c>0)for(f=0;f<h;f++){o=f==h-1;j=d[c][o?0:f+1];k=d[c][o?h-1:f];m=d[c-1][o?h-1:f];o=d[c-
|
|
|
|
-1][o?0:f+1];y=c/(g-1);u=(c-1)/(g-1);A=(f+1)/h;p=f/h;t=new THREE.UV(1-A,y);y=new THREE.UV(1-p,y);p=new THREE.UV(1-p,u);var H=new THREE.UV(1-A,u);if(c<d.length-1){u=this.vertices[j].position.clone();A=this.vertices[k].position.clone();I=this.vertices[m].position.clone();u.normalize();A.normalize();I.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(I.x,I.y,I.z)]));this.faceVertexUvs[0].push([t,y,p])}if(c>1){u=this.vertices[j].position.clone();
|
|
|
|
-A=this.vertices[m].position.clone();I=this.vertices[o].position.clone();u.normalize();A.normalize();I.normalize();this.faces.push(new THREE.Face3(j,m,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(I.x,I.y,I.z)]));this.faceVertexUvs[0].push([t,p,H])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
|
|
|
|
|
|
+THREE.Sphere=function(b,d,c){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,d||8),j=Math.max(2,c||6);d=[];for(c=0;c<j+1;c++){f=c/j;var k=b*Math.cos(f*g),m=b*Math.sin(f*g),o=[],t=0;for(f=0;f<h;f++){var p=2*f/h,y=m*Math.sin(p*g);p=m*Math.cos(p*g);(c==0||c==j)&&f>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,y)))-1);o.push(t)}d.push(o)}var u,z,H;g=d.length;for(c=0;c<g;c++){h=d[c].length;if(c>0)for(f=0;f<h;f++){o=f==h-1;j=d[c][o?0:f+1];k=d[c][o?h-1:f];m=d[c-1][o?h-1:f];o=d[c-
|
|
|
|
+1][o?0:f+1];y=c/(g-1);u=(c-1)/(g-1);z=(f+1)/h;p=f/h;t=new THREE.UV(1-z,y);y=new THREE.UV(1-p,y);p=new THREE.UV(1-p,u);var G=new THREE.UV(1-z,u);if(c<d.length-1){u=this.vertices[j].position.clone();z=this.vertices[k].position.clone();H=this.vertices[m].position.clone();u.normalize();z.normalize();H.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([t,y,p])}if(c>1){u=this.vertices[j].position.clone();
|
|
|
|
+z=this.vertices[m].position.clone();H=this.vertices[o].position.clone();u.normalize();z.normalize();H.normalize();this.faces.push(new THREE.Face3(j,m,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([t,p,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
|
|
THREE.Torus=function(b,d,c,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=d||40;this.segmentsR=c||8;this.segmentsT=f||6;b=[];for(d=0;d<=this.segmentsR;++d)for(c=0;c<=this.segmentsT;++c){f=c/this.segmentsT*2*Math.PI;var g=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([c/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(c=
|
|
THREE.Torus=function(b,d,c,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=d||40;this.segmentsR=c||8;this.segmentsT=f||6;b=[];for(d=0;d<=this.segmentsR;++d)for(c=0;c<=this.segmentsT;++c){f=c/this.segmentsT*2*Math.PI;var g=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([c/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(c=
|
|
1;c<=this.segmentsT;++c){f=(this.segmentsT+1)*d+c;g=(this.segmentsT+1)*d+c-1;var h=(this.segmentsT+1)*(d-1)+c-1,j=(this.segmentsT+1)*(d-1)+c;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
|
|
1;c<=this.segmentsT;++c){f=(this.segmentsT+1)*d+c;g=(this.segmentsT+1)*d+c-1;var h=(this.segmentsT+1)*(d-1)+c-1,j=(this.segmentsT+1)*(d-1)+c;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
|
|
-THREE.TorusKnot=function(b,d,c,f,g,h,j){function k(p,y,u,A,I,H){y=u/A*p;u=Math.cos(y);return new THREE.Vector3(I*(2+u)*0.5*Math.cos(p),I*(2+u)*Math.sin(p)*0.5,H*I*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(d=0;d<this.segmentsT;++d){var m=
|
|
|
|
|
|
+THREE.TorusKnot=function(b,d,c,f,g,h,j){function k(p,y,u,z,H,G){y=u/z*p;u=Math.cos(y);return new THREE.Vector3(H*(2+u)*0.5*Math.cos(p),H*(2+u)*Math.sin(p)*0.5,G*H*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(d=0;d<this.segmentsT;++d){var m=
|
|
b/this.segmentsR*2*this.p*Math.PI;j=d/this.segmentsT*2*Math.PI;g=k(m,j,this.q,this.p,this.radius,this.heightScale);m=k(m+0.01,j,this.q,this.p,this.radius,this.heightScale);c.x=m.x-g.x;c.y=m.y-g.y;c.z=m.z-g.z;f.x=m.x+g.x;f.y=m.y+g.y;f.z=m.z+g.z;h.cross(c,f);f.cross(h,c);h.normalize();f.normalize();m=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=m*f.x+j*h.x;g.y+=m*f.y+j*h.y;g.z+=m*f.z+j*h.z;this.grid[b][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(d=
|
|
b/this.segmentsR*2*this.p*Math.PI;j=d/this.segmentsT*2*Math.PI;g=k(m,j,this.q,this.p,this.radius,this.heightScale);m=k(m+0.01,j,this.q,this.p,this.radius,this.heightScale);c.x=m.x-g.x;c.y=m.y-g.y;c.z=m.z-g.z;f.x=m.x+g.x;f.y=m.y+g.y;f.z=m.z+g.z;h.cross(c,f);f.cross(h,c);h.normalize();f.normalize();m=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=m*f.x+j*h.x;g.y+=m*f.y+j*h.y;g.z+=m*f.z+j*h.z;this.grid[b][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(d=
|
|
0;d<this.segmentsT;++d){f=(b+1)%this.segmentsR;h=(d+1)%this.segmentsT;g=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][h];h=this.grid[b][h];j=new THREE.UV(b/this.segmentsR,d/this.segmentsT);m=new THREE.UV((b+1)/this.segmentsR,d/this.segmentsT);var o=new THREE.UV((b+1)/this.segmentsR,(d+1)/this.segmentsT),t=new THREE.UV(b/this.segmentsR,(d+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,c,f,h));this.faceVertexUvs[0].push([j,m,o,t])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
|
|
0;d<this.segmentsT;++d){f=(b+1)%this.segmentsR;h=(d+1)%this.segmentsT;g=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][h];h=this.grid[b][h];j=new THREE.UV(b/this.segmentsR,d/this.segmentsT);m=new THREE.UV((b+1)/this.segmentsR,d/this.segmentsT);var o=new THREE.UV((b+1)/this.segmentsR,(d+1)/this.segmentsT),t=new THREE.UV(b/this.segmentsR,(d+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,c,f,h));this.faceVertexUvs[0].push([j,m,o,t])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
|
|
THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
@@ -443,52 +443,52 @@ Math.LN2));k.image.width=t;k.image.height=p;k.image.getContext("2d").drawImage(t
|
|
"Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==undefined||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==undefined)h.depthTest=b.depthTest;if(b.vertexColors!==undefined)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&d){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,d+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<
|
|
"Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==undefined||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==undefined)h.depthTest=b.depthTest;if(b.vertexColors!==undefined)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&d){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,d+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<
|
|
16)+(b.colorDiffuse[1]*255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&d){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,d+"/"+b.mapLightmap)}return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
16)+(b.colorDiffuse[1]*255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&d){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,d+"/"+b.mapLightmap)}return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
THREE.JSONLoader.prototype.load=function(b){var d=this,c=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(c);b=new Worker(c);b.onmessage=function(h){d.createModel(h.data,f,g);d.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
THREE.JSONLoader.prototype.load=function(b){var d=this,c=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(c);b=new Worker(c);b.onmessage=function(h){d.createModel(h.data,f,g);d.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
-THREE.JSONLoader.prototype.createModel=function(b,d,c){var f=new THREE.Geometry,g=b.scale!==undefined?b.scale:1;this.init_materials(f,b.materials,c);(function(h){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var j,k,m,o,t,p,y,u,A,I,H,B,U,D,R=b.faces;p=b.vertices;var L=b.normals,Q=b.colors,qa=0;for(j=0;j<b.uvs.length;j++)b.uvs[j].length&&qa++;for(j=0;j<qa;j++){f.faceUvs[j]=[];f.faceVertexUvs[j]=[]}o=0;for(t=p.length;o<t;){y=new THREE.Vertex;y.position.x=p[o++]/
|
|
|
|
-h;y.position.y=p[o++]/h;y.position.z=p[o++]/h;f.vertices.push(y)}o=0;for(t=R.length;o<t;){h=R[o++];p=h&1;m=h&2;j=h&4;k=h&8;u=h&16;y=h&32;I=h&64;h&=128;if(p){H=new THREE.Face4;H.a=R[o++];H.b=R[o++];H.c=R[o++];H.d=R[o++];p=4}else{H=new THREE.Face3;H.a=R[o++];H.b=R[o++];H.c=R[o++];p=3}if(m){m=R[o++];H.materials=f.materials[m]}m=f.faces.length;if(j)for(j=0;j<qa;j++){B=b.uvs[j];A=R[o++];D=B[A*2];A=B[A*2+1];f.faceUvs[j][m]=new THREE.UV(D,A)}if(k)for(j=0;j<qa;j++){B=b.uvs[j];U=[];for(k=0;k<p;k++){A=R[o++];
|
|
|
|
-D=B[A*2];A=B[A*2+1];U[k]=new THREE.UV(D,A)}f.faceVertexUvs[j][m]=U}if(u){u=R[o++]*3;k=new THREE.Vector3;k.x=L[u++];k.y=L[u++];k.z=L[u];H.normal=k}if(y)for(j=0;j<p;j++){u=R[o++]*3;k=new THREE.Vector3;k.x=L[u++];k.y=L[u++];k.z=L[u];H.vertexNormals.push(k)}if(I){y=R[o++];y=new THREE.Color(Q[y]);H.color=y}if(h)for(j=0;j<p;j++){y=R[o++];y=new THREE.Color(Q[y]);H.vertexColors.push(y)}f.faces.push(H)}}})(g);(function(){var h,j,k,m;if(b.skinWeights){h=0;for(j=b.skinWeights.length;h<j;h+=2){k=b.skinWeights[h];
|
|
|
|
-m=b.skinWeights[h+1];f.skinWeights.push(new THREE.Vector4(k,m,0,0))}}if(b.skinIndices){h=0;for(j=b.skinIndices.length;h<j;h+=2){k=b.skinIndices[h];m=b.skinIndices[h+1];f.skinIndices.push(new THREE.Vector4(k,m,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(h){if(b.morphTargets!==undefined){var j,k,m,o,t,p,y,u,A;j=0;for(k=b.morphTargets.length;j<k;j++){f.morphTargets[j]={};f.morphTargets[j].name=b.morphTargets[j].name;f.morphTargets[j].vertices=[];u=f.morphTargets[j].vertices;A=b.morphTargets[j].vertices;
|
|
|
|
-m=0;for(o=A.length;m<o;m+=3){t=A[m]/h;p=A[m+1]/h;y=A[m+2]/h;u.push(new THREE.Vertex(new THREE.Vector3(t,p,y)))}}}if(b.morphColors!==undefined){j=0;for(k=b.morphColors.length;j<k;j++){f.morphColors[j]={};f.morphColors[j].name=b.morphColors[j].name;f.morphColors[j].colors=[];o=f.morphColors[j].colors;t=b.morphColors[j].colors;h=0;for(m=t.length;h<m;h+=3){p=new THREE.Color(16755200);p.setRGB(t[h],t[h+1],t[h+2]);o.push(p)}}}})(g);(function(){if(b.edges!==undefined){var h,j,k;for(h=0;h<b.edges.length;h+=
|
|
|
|
|
|
+THREE.JSONLoader.prototype.createModel=function(b,d,c){var f=new THREE.Geometry,g=b.scale!==undefined?b.scale:1;this.init_materials(f,b.materials,c);(function(h){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var j,k,m,o,t,p,y,u,z,H,G,B,R,E,P=b.faces;p=b.vertices;var L=b.normals,O=b.colors,sa=0;for(j=0;j<b.uvs.length;j++)b.uvs[j].length&&sa++;for(j=0;j<sa;j++){f.faceUvs[j]=[];f.faceVertexUvs[j]=[]}o=0;for(t=p.length;o<t;){y=new THREE.Vertex;y.position.x=p[o++]/
|
|
|
|
+h;y.position.y=p[o++]/h;y.position.z=p[o++]/h;f.vertices.push(y)}o=0;for(t=P.length;o<t;){h=P[o++];p=h&1;m=h&2;j=h&4;k=h&8;u=h&16;y=h&32;H=h&64;h&=128;if(p){G=new THREE.Face4;G.a=P[o++];G.b=P[o++];G.c=P[o++];G.d=P[o++];p=4}else{G=new THREE.Face3;G.a=P[o++];G.b=P[o++];G.c=P[o++];p=3}if(m){m=P[o++];G.materials=f.materials[m]}m=f.faces.length;if(j)for(j=0;j<sa;j++){B=b.uvs[j];z=P[o++];E=B[z*2];z=B[z*2+1];f.faceUvs[j][m]=new THREE.UV(E,z)}if(k)for(j=0;j<sa;j++){B=b.uvs[j];R=[];for(k=0;k<p;k++){z=P[o++];
|
|
|
|
+E=B[z*2];z=B[z*2+1];R[k]=new THREE.UV(E,z)}f.faceVertexUvs[j][m]=R}if(u){u=P[o++]*3;k=new THREE.Vector3;k.x=L[u++];k.y=L[u++];k.z=L[u];G.normal=k}if(y)for(j=0;j<p;j++){u=P[o++]*3;k=new THREE.Vector3;k.x=L[u++];k.y=L[u++];k.z=L[u];G.vertexNormals.push(k)}if(H){y=P[o++];y=new THREE.Color(O[y]);G.color=y}if(h)for(j=0;j<p;j++){y=P[o++];y=new THREE.Color(O[y]);G.vertexColors.push(y)}f.faces.push(G)}}})(g);(function(){var h,j,k,m;if(b.skinWeights){h=0;for(j=b.skinWeights.length;h<j;h+=2){k=b.skinWeights[h];
|
|
|
|
+m=b.skinWeights[h+1];f.skinWeights.push(new THREE.Vector4(k,m,0,0))}}if(b.skinIndices){h=0;for(j=b.skinIndices.length;h<j;h+=2){k=b.skinIndices[h];m=b.skinIndices[h+1];f.skinIndices.push(new THREE.Vector4(k,m,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(h){if(b.morphTargets!==undefined){var j,k,m,o,t,p,y,u,z;j=0;for(k=b.morphTargets.length;j<k;j++){f.morphTargets[j]={};f.morphTargets[j].name=b.morphTargets[j].name;f.morphTargets[j].vertices=[];u=f.morphTargets[j].vertices;z=b.morphTargets[j].vertices;
|
|
|
|
+m=0;for(o=z.length;m<o;m+=3){t=z[m]/h;p=z[m+1]/h;y=z[m+2]/h;u.push(new THREE.Vertex(new THREE.Vector3(t,p,y)))}}}if(b.morphColors!==undefined){j=0;for(k=b.morphColors.length;j<k;j++){f.morphColors[j]={};f.morphColors[j].name=b.morphColors[j].name;f.morphColors[j].colors=[];o=f.morphColors[j].colors;t=b.morphColors[j].colors;h=0;for(m=t.length;h<m;h+=3){p=new THREE.Color(16755200);p.setRGB(t[h],t[h+1],t[h+2]);o.push(p)}}}})(g);(function(){if(b.edges!==undefined){var h,j,k;for(h=0;h<b.edges.length;h+=
|
|
2){j=b.edges[h];k=b.edges[h+1];f.edges.push(new THREE.Edge(f.vertices[j],f.vertices[k],j,k))}}})();f.computeFaceNormals();d(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
2){j=b.edges[h];k=b.edges[h+1];f.edges.push(new THREE.Edge(f.vertices[j],f.vertices[k],j,k))}}})();f.computeFaceNormals();d(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
THREE.BinaryLoader.prototype={load:function(b){var d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,c,g,f,h)};d.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
|
|
THREE.BinaryLoader.prototype={load:function(b){var d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,c,g,f,h)};d.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
|
|
d.postMessage(b)},loadAjaxBuffers:function(b,d,c,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,c,g,d):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){m==0&&(m=j.getResponseHeader("Content-Length"));h({total:m,loaded:j.responseText.length})}}else j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
|
|
d.postMessage(b)},loadAjaxBuffers:function(b,d,c,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,c,g,d):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){m==0&&(m=j.getResponseHeader("Content-Length"));h({total:m,loaded:j.responseText.length})}}else j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
|
|
-j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(S,T){var O=t(S,T),Ba=t(S,T+1),La=t(S,T+2),n=t(S,T+3),C=(n<<1&255|La>>7)-127;O|=(La&127)<<16|Ba<<8;if(O==0&&C==-127)return 0;return(1-2*(n>>7))*(1+O*Math.pow(2,-23))*Math.pow(2,C)}function k(S,T){var O=t(S,T),Ba=t(S,T+1),La=t(S,T+2);return(t(S,T+3)<<24)+(La<<16)+(Ba<<8)+O}function m(S,T){var O=t(S,T);return(t(S,T+1)<<8)+O}function o(S,T){var O=t(S,T);return O>127?O-256:O}function t(S,
|
|
|
|
-T){return S.charCodeAt(T)&255}function p(S){var T,O,Ba;T=k(b,S);O=k(b,S+Q);Ba=k(b,S+qa);S=m(b,S+la);THREE.BinaryLoader.prototype.f3(B,T,O,Ba,S)}function y(S){var T,O,Ba,La,n,C;T=k(b,S);O=k(b,S+Q);Ba=k(b,S+qa);La=m(b,S+la);n=k(b,S+ra);C=k(b,S+ga);S=k(b,S+ea);THREE.BinaryLoader.prototype.f3n(B,R,T,O,Ba,La,n,C,S)}function u(S){var T,O,Ba,La;T=k(b,S);O=k(b,S+e);Ba=k(b,S+oa);La=k(b,S+Da);S=m(b,S+Aa);THREE.BinaryLoader.prototype.f4(B,T,O,Ba,La,S)}function A(S){var T,O,Ba,La,n,C,x,v;T=k(b,S);O=k(b,S+e);
|
|
|
|
-Ba=k(b,S+oa);La=k(b,S+Da);n=m(b,S+Aa);C=k(b,S+da);x=k(b,S+fa);v=k(b,S+wa);S=k(b,S+ua);THREE.BinaryLoader.prototype.f4n(B,R,T,O,Ba,La,n,C,x,v,S)}function I(S){var T,O;T=k(b,S);O=k(b,S+pa);S=k(b,S+ca);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],L[T*2],L[T*2+1],L[O*2],L[O*2+1],L[S*2],L[S*2+1])}function H(S){var T,O,Ba;T=k(b,S);O=k(b,S+ka);Ba=k(b,S+ma);S=k(b,S+Fa);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],L[T*2],L[T*2+1],L[O*2],L[O*2+1],L[Ba*2],L[Ba*2+1],L[S*2],L[S*2+1])}var B=this,
|
|
|
|
-U=0,D,R=[],L=[],Q,qa,la,ra,ga,ea,e,oa,Da,Aa,da,fa,wa,ua,pa,ca,ka,ma,Fa,ja,ha,Ja,Xa,Za,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,f,h);D={signature:b.substr(U,8),header_bytes:t(b,U+8),vertex_coordinate_bytes:t(b,U+9),normal_coordinate_bytes:t(b,U+10),uv_coordinate_bytes:t(b,U+11),vertex_index_bytes:t(b,U+12),normal_index_bytes:t(b,U+13),uv_index_bytes:t(b,U+14),material_index_bytes:t(b,U+15),nvertices:k(b,U+16),nnormals:k(b,U+16+4),nuvs:k(b,U+16+8),ntri_flat:k(b,U+16+12),
|
|
|
|
-ntri_smooth:k(b,U+16+16),ntri_flat_uv:k(b,U+16+20),ntri_smooth_uv:k(b,U+16+24),nquad_flat:k(b,U+16+28),nquad_smooth:k(b,U+16+32),nquad_flat_uv:k(b,U+16+36),nquad_smooth_uv:k(b,U+16+40)};U+=D.header_bytes;Q=D.vertex_index_bytes;qa=D.vertex_index_bytes*2;la=D.vertex_index_bytes*3;ra=D.vertex_index_bytes*3+D.material_index_bytes;ga=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;ea=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;e=D.vertex_index_bytes;oa=D.vertex_index_bytes*
|
|
|
|
-2;Da=D.vertex_index_bytes*3;Aa=D.vertex_index_bytes*4;da=D.vertex_index_bytes*4+D.material_index_bytes;fa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;wa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;ua=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;pa=D.uv_index_bytes;ca=D.uv_index_bytes*2;ka=D.uv_index_bytes;ma=D.uv_index_bytes*2;Fa=D.uv_index_bytes*3;h=D.vertex_index_bytes*3+D.material_index_bytes;Ta=D.vertex_index_bytes*4+D.material_index_bytes;
|
|
|
|
-ja=D.ntri_flat*h;ha=D.ntri_smooth*(h+D.normal_index_bytes*3);Ja=D.ntri_flat_uv*(h+D.uv_index_bytes*3);Xa=D.ntri_smooth_uv*(h+D.normal_index_bytes*3+D.uv_index_bytes*3);Za=D.nquad_flat*Ta;h=D.nquad_smooth*(Ta+D.normal_index_bytes*4);Ta=D.nquad_flat_uv*(Ta+D.uv_index_bytes*4);U+=function(S){for(var T,O,Ba,La=D.vertex_coordinate_bytes*3,n=S+D.nvertices*La;S<n;S+=La){T=j(b,S);O=j(b,S+D.vertex_coordinate_bytes);Ba=j(b,S+D.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(B,T,O,Ba)}return D.nvertices*
|
|
|
|
-La}(U);U+=function(S){for(var T,O,Ba,La=D.normal_coordinate_bytes*3,n=S+D.nnormals*La;S<n;S+=La){T=o(b,S);O=o(b,S+D.normal_coordinate_bytes);Ba=o(b,S+D.normal_coordinate_bytes*2);R.push(T/127,O/127,Ba/127)}return D.nnormals*La}(U);U+=function(S){for(var T,O,Ba=D.uv_coordinate_bytes*2,La=S+D.nuvs*Ba;S<La;S+=Ba){T=j(b,S);O=j(b,S+D.uv_coordinate_bytes);L.push(T,O)}return D.nuvs*Ba}(U);ja=U+ja;ha=ja+ha;Ja=ha+Ja;Xa=Ja+Xa;Za=Xa+Za;h=Za+h;Ta=h+Ta;(function(S){var T,O=D.vertex_index_bytes*3+D.material_index_bytes,
|
|
|
|
-Ba=O+D.uv_index_bytes*3,La=S+D.ntri_flat_uv*Ba;for(T=S;T<La;T+=Ba){p(T);I(T+O)}return La-S})(ha);(function(S){var T,O=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,Ba=O+D.uv_index_bytes*3,La=S+D.ntri_smooth_uv*Ba;for(T=S;T<La;T+=Ba){y(T);I(T+O)}return La-S})(Ja);(function(S){var T,O=D.vertex_index_bytes*4+D.material_index_bytes,Ba=O+D.uv_index_bytes*4,La=S+D.nquad_flat_uv*Ba;for(T=S;T<La;T+=Ba){u(T);H(T+O)}return La-S})(h);(function(S){var T,O=D.vertex_index_bytes*4+D.material_index_bytes+
|
|
|
|
-D.normal_index_bytes*4,Ba=O+D.uv_index_bytes*4,La=S+D.nquad_smooth_uv*Ba;for(T=S;T<La;T+=Ba){A(T);H(T+O)}return La-S})(Ta);(function(S){var T,O=D.vertex_index_bytes*3+D.material_index_bytes,Ba=S+D.ntri_flat*O;for(T=S;T<Ba;T+=O)p(T);return Ba-S})(U);(function(S){var T,O=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,Ba=S+D.ntri_smooth*O;for(T=S;T<Ba;T+=O)y(T);return Ba-S})(ja);(function(S){var T,O=D.vertex_index_bytes*4+D.material_index_bytes,Ba=S+D.nquad_flat*O;for(T=S;T<Ba;T+=
|
|
|
|
-O)u(T);return Ba-S})(Xa);(function(S){var T,O=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,Ba=S+D.nquad_smooth*O;for(T=S;T<Ba;T+=O)A(T);return Ba-S})(Za);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;d(new g(c))},v:function(b,d,c,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(d,c,f)))},f3:function(b,d,c,f,g){b.faces.push(new THREE.Face3(d,c,f,null,null,b.materials[g]))},f4:function(b,d,c,f,g,h){b.faces.push(new THREE.Face4(d,
|
|
|
|
-c,f,g,null,null,b.materials[h]))},f3n:function(b,d,c,f,g,h,j,k,m){h=b.materials[h];var o=d[k*3],t=d[k*3+1];k=d[k*3+2];var p=d[m*3],y=d[m*3+1];m=d[m*3+2];b.faces.push(new THREE.Face3(c,f,g,[new THREE.Vector3(d[j*3],d[j*3+1],d[j*3+2]),new THREE.Vector3(o,t,k),new THREE.Vector3(p,y,m)],null,h))},f4n:function(b,d,c,f,g,h,j,k,m,o,t){j=b.materials[j];var p=d[m*3],y=d[m*3+1];m=d[m*3+2];var u=d[o*3],A=d[o*3+1];o=d[o*3+2];var I=d[t*3],H=d[t*3+1];t=d[t*3+2];b.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(d[k*
|
|
|
|
-3],d[k*3+1],d[k*3+2]),new THREE.Vector3(p,y,m),new THREE.Vector3(u,A,o),new THREE.Vector3(I,H,t)],null,j))},uv3:function(b,d,c,f,g,h,j){var k=[];k.push(new THREE.UV(d,c));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,d,c,f,g,h,j,k,m){var o=[];o.push(new THREE.UV(d,c));o.push(new THREE.UV(f,g));o.push(new THREE.UV(h,j));o.push(new THREE.UV(k,m));b.push(o)}};
|
|
|
|
|
|
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(Q,aa){var W=t(Q,aa),T=t(Q,aa+1),La=t(Q,aa+2),db=t(Q,aa+3),n=(db<<1&255|La>>7)-127;W|=(La&127)<<16|T<<8;if(W==0&&n==-127)return 0;return(1-2*(db>>7))*(1+W*Math.pow(2,-23))*Math.pow(2,n)}function k(Q,aa){var W=t(Q,aa),T=t(Q,aa+1),La=t(Q,aa+2);return(t(Q,aa+3)<<24)+(La<<16)+(T<<8)+W}function m(Q,aa){var W=t(Q,aa);return(t(Q,aa+1)<<8)+W}function o(Q,aa){var W=t(Q,aa);return W>127?
|
|
|
|
+W-256:W}function t(Q,aa){return Q.charCodeAt(aa)&255}function p(Q){var aa,W,T;aa=k(b,Q);W=k(b,Q+O);T=k(b,Q+sa);Q=m(b,Q+oa);THREE.BinaryLoader.prototype.f3(B,aa,W,T,Q)}function y(Q){var aa,W,T,La,db,n;aa=k(b,Q);W=k(b,Q+O);T=k(b,Q+sa);La=m(b,Q+oa);db=k(b,Q+ta);n=k(b,Q+ha);Q=k(b,Q+fa);THREE.BinaryLoader.prototype.f3n(B,P,aa,W,T,La,db,n,Q)}function u(Q){var aa,W,T,La;aa=k(b,Q);W=k(b,Q+e);T=k(b,Q+qa);La=k(b,Q+Ea);Q=m(b,Q+Da);THREE.BinaryLoader.prototype.f4(B,aa,W,T,La,Q)}function z(Q){var aa,W,T,La,db,
|
|
|
|
+n,C,w;aa=k(b,Q);W=k(b,Q+e);T=k(b,Q+qa);La=k(b,Q+Ea);db=m(b,Q+Da);n=k(b,Q+ea);C=k(b,Q+ga);w=k(b,Q+xa);Q=k(b,Q+va);THREE.BinaryLoader.prototype.f4n(B,P,aa,W,T,La,db,n,C,w,Q)}function H(Q){var aa,W;aa=k(b,Q);W=k(b,Q+ra);Q=k(b,Q+ca);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],L[aa*2],L[aa*2+1],L[W*2],L[W*2+1],L[Q*2],L[Q*2+1])}function G(Q){var aa,W,T;aa=k(b,Q);W=k(b,Q+ka);T=k(b,Q+pa);Q=k(b,Q+Fa);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],L[aa*2],L[aa*2+1],L[W*2],L[W*2+1],L[T*2],L[T*2+
|
|
|
|
+1],L[Q*2],L[Q*2+1])}var B=this,R=0,E,P=[],L=[],O,sa,oa,ta,ha,fa,e,qa,Ea,Da,ea,ga,xa,va,ra,ca,ka,pa,Fa,ja,ia,Ia,Ya,ab,Ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,f,h);E={signature:b.substr(R,8),header_bytes:t(b,R+8),vertex_coordinate_bytes:t(b,R+9),normal_coordinate_bytes:t(b,R+10),uv_coordinate_bytes:t(b,R+11),vertex_index_bytes:t(b,R+12),normal_index_bytes:t(b,R+13),uv_index_bytes:t(b,R+14),material_index_bytes:t(b,R+15),nvertices:k(b,R+16),nnormals:k(b,R+16+4),nuvs:k(b,
|
|
|
|
+R+16+8),ntri_flat:k(b,R+16+12),ntri_smooth:k(b,R+16+16),ntri_flat_uv:k(b,R+16+20),ntri_smooth_uv:k(b,R+16+24),nquad_flat:k(b,R+16+28),nquad_smooth:k(b,R+16+32),nquad_flat_uv:k(b,R+16+36),nquad_smooth_uv:k(b,R+16+40)};R+=E.header_bytes;O=E.vertex_index_bytes;sa=E.vertex_index_bytes*2;oa=E.vertex_index_bytes*3;ta=E.vertex_index_bytes*3+E.material_index_bytes;ha=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes;fa=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*2;
|
|
|
|
+e=E.vertex_index_bytes;qa=E.vertex_index_bytes*2;Ea=E.vertex_index_bytes*3;Da=E.vertex_index_bytes*4;ea=E.vertex_index_bytes*4+E.material_index_bytes;ga=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes;xa=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*2;va=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*3;ra=E.uv_index_bytes;ca=E.uv_index_bytes*2;ka=E.uv_index_bytes;pa=E.uv_index_bytes*2;Fa=E.uv_index_bytes*3;h=E.vertex_index_bytes*3+E.material_index_bytes;
|
|
|
|
+Ra=E.vertex_index_bytes*4+E.material_index_bytes;ja=E.ntri_flat*h;ia=E.ntri_smooth*(h+E.normal_index_bytes*3);Ia=E.ntri_flat_uv*(h+E.uv_index_bytes*3);Ya=E.ntri_smooth_uv*(h+E.normal_index_bytes*3+E.uv_index_bytes*3);ab=E.nquad_flat*Ra;h=E.nquad_smooth*(Ra+E.normal_index_bytes*4);Ra=E.nquad_flat_uv*(Ra+E.uv_index_bytes*4);R+=function(Q){for(var aa,W,T,La=E.vertex_coordinate_bytes*3,db=Q+E.nvertices*La;Q<db;Q+=La){aa=j(b,Q);W=j(b,Q+E.vertex_coordinate_bytes);T=j(b,Q+E.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(B,
|
|
|
|
+aa,W,T)}return E.nvertices*La}(R);R+=function(Q){for(var aa,W,T,La=E.normal_coordinate_bytes*3,db=Q+E.nnormals*La;Q<db;Q+=La){aa=o(b,Q);W=o(b,Q+E.normal_coordinate_bytes);T=o(b,Q+E.normal_coordinate_bytes*2);P.push(aa/127,W/127,T/127)}return E.nnormals*La}(R);R+=function(Q){for(var aa,W,T=E.uv_coordinate_bytes*2,La=Q+E.nuvs*T;Q<La;Q+=T){aa=j(b,Q);W=j(b,Q+E.uv_coordinate_bytes);L.push(aa,W)}return E.nuvs*T}(R);ja=R+ja;ia=ja+ia;Ia=ia+Ia;Ya=Ia+Ya;ab=Ya+ab;h=ab+h;Ra=h+Ra;(function(Q){var aa,W=E.vertex_index_bytes*
|
|
|
|
+3+E.material_index_bytes,T=W+E.uv_index_bytes*3,La=Q+E.ntri_flat_uv*T;for(aa=Q;aa<La;aa+=T){p(aa);H(aa+W)}return La-Q})(ia);(function(Q){var aa,W=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,T=W+E.uv_index_bytes*3,La=Q+E.ntri_smooth_uv*T;for(aa=Q;aa<La;aa+=T){y(aa);H(aa+W)}return La-Q})(Ia);(function(Q){var aa,W=E.vertex_index_bytes*4+E.material_index_bytes,T=W+E.uv_index_bytes*4,La=Q+E.nquad_flat_uv*T;for(aa=Q;aa<La;aa+=T){u(aa);G(aa+W)}return La-Q})(h);(function(Q){var aa,
|
|
|
|
+W=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*4,T=W+E.uv_index_bytes*4,La=Q+E.nquad_smooth_uv*T;for(aa=Q;aa<La;aa+=T){z(aa);G(aa+W)}return La-Q})(Ra);(function(Q){var aa,W=E.vertex_index_bytes*3+E.material_index_bytes,T=Q+E.ntri_flat*W;for(aa=Q;aa<T;aa+=W)p(aa);return T-Q})(R);(function(Q){var aa,W=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,T=Q+E.ntri_smooth*W;for(aa=Q;aa<T;aa+=W)y(aa);return T-Q})(ja);(function(Q){var aa,W=E.vertex_index_bytes*4+E.material_index_bytes,
|
|
|
|
+T=Q+E.nquad_flat*W;for(aa=Q;aa<T;aa+=W)u(aa);return T-Q})(Ya);(function(Q){var aa,W=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*4,T=Q+E.nquad_smooth*W;for(aa=Q;aa<T;aa+=W)z(aa);return T-Q})(ab);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;d(new g(c))},v:function(b,d,c,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(d,c,f)))},f3:function(b,d,c,f,g){b.faces.push(new THREE.Face3(d,c,f,null,null,b.materials[g]))},
|
|
|
|
+f4:function(b,d,c,f,g,h){b.faces.push(new THREE.Face4(d,c,f,g,null,null,b.materials[h]))},f3n:function(b,d,c,f,g,h,j,k,m){h=b.materials[h];var o=d[k*3],t=d[k*3+1];k=d[k*3+2];var p=d[m*3],y=d[m*3+1];m=d[m*3+2];b.faces.push(new THREE.Face3(c,f,g,[new THREE.Vector3(d[j*3],d[j*3+1],d[j*3+2]),new THREE.Vector3(o,t,k),new THREE.Vector3(p,y,m)],null,h))},f4n:function(b,d,c,f,g,h,j,k,m,o,t){j=b.materials[j];var p=d[m*3],y=d[m*3+1];m=d[m*3+2];var u=d[o*3],z=d[o*3+1];o=d[o*3+2];var H=d[t*3],G=d[t*3+1];t=d[t*
|
|
|
|
+3+2];b.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(d[k*3],d[k*3+1],d[k*3+2]),new THREE.Vector3(p,y,m),new THREE.Vector3(u,z,o),new THREE.Vector3(H,G,t)],null,j))},uv3:function(b,d,c,f,g,h,j){var k=[];k.push(new THREE.UV(d,c));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,d,c,f,g,h,j,k,m){var o=[];o.push(new THREE.UV(d,c));o.push(new THREE.UV(f,g));o.push(new THREE.UV(h,j));o.push(new THREE.UV(k,m));b.push(o)}};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
-THREE.SceneLoader.prototype={load:function(b,d){var c=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(h){function j(pa,ca){return ca=="relativeToHTML"?pa:g+"/"+pa}function k(){for(u in ga.objects)if(!da.objects[u]){U=ga.objects[u];if(U.geometry!==undefined){if(Q=da.geometries[U.geometry]){ra=[];for(ua=0;ua<U.materials.length;ua++)ra[ua]=da.materials[U.materials[ua]];D=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;ra.length==0&&(ra[0]=
|
|
|
|
-new THREE.MeshFaceMaterial);ra.length>1&&(ra=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(Q,ra);object.name=u;object.position.set(D[0],D[1],D[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=U.visible;da.scene.addObject(object);da.objects[u]=object;if(U.meshCollider){var pa=THREE.CollisionUtils.MeshColliderWBox(object);da.scene.collisions.colliders.push(pa)}if(U.castsShadow){pa=
|
|
|
|
-new THREE.ShadowVolume(Q);da.scene.addChild(pa);pa.position=object.position;pa.rotation=object.rotation;pa.scale=object.scale}if(U.trigger&&U.trigger.toLowerCase()!="none"){pa={type:U.trigger,object:U};da.triggers[object.name]=pa}}}else{D=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;object=new THREE.Object3D;object.name=u;object.position.set(D[0],D[1],D[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],
|
|
|
|
-s[1],s[2]);object.visible=U.visible!==undefined?U.visible:!1;da.scene.addObject(object);da.objects[u]=object;da.empties[u]=object;if(U.trigger&&U.trigger.toLowerCase()!="none"){pa={type:U.trigger,object:U};da.triggers[object.name]=pa}}}}function m(pa){return function(ca){da.geometries[pa]=ca;k();e-=1;c.onLoadComplete();t()}}function o(pa){return function(ca){da.geometries[pa]=ca}}function t(){c.callbackProgress({totalModels:Da,totalTextures:Aa,loadedModels:Da-e,loadedTextures:Aa-oa},da);c.onLoadProgress();
|
|
|
|
-e==0&&oa==0&&d(da)}var p,y,u,A,I,H,B,U,D,R,L,Q,qa,la,ra,ga,ea,e,oa,Da,Aa,da;ga=h.data;h=new THREE.BinaryLoader;ea=new THREE.JSONLoader;oa=e=0;da={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var fa=!1;for(u in ga.objects){U=ga.objects[u];if(U.meshCollider){fa=!0;break}}if(fa)da.scene.collisions=new THREE.CollisionSystem;if(ga.transform){fa=ga.transform.position;R=ga.transform.rotation;var wa=ga.transform.scale;fa&&da.scene.position.set(fa[0],
|
|
|
|
-fa[1],fa[2]);R&&da.scene.rotation.set(R[0],R[1],R[2]);wa&&da.scene.scale.set(wa[0],wa[1],wa[2]);(fa||R||wa)&&da.scene.updateMatrix()}fa=function(){oa-=1;t();c.onLoadComplete()};for(I in ga.cameras){R=ga.cameras[I];if(R.type=="perspective")qa=new THREE.Camera(R.fov,R.aspect,R.near,R.far);else if(R.type=="ortho"){qa=new THREE.Camera;qa.projectionMatrix=THREE.Matrix4.makeOrtho(R.left,R.right,R.top,R.bottom,R.near,R.far)}D=R.position;R=R.target;qa.position.set(D[0],D[1],D[2]);qa.target.position.set(R[0],
|
|
|
|
-R[1],R[2]);da.cameras[I]=qa}for(A in ga.lights){I=ga.lights[A];qa=I.color!==undefined?I.color:16777215;R=I.intensity!==undefined?I.intensity:1;if(I.type=="directional"){D=I.direction;light=new THREE.DirectionalLight(qa,R);light.position.set(D[0],D[1],D[2]);light.position.normalize()}else if(I.type=="point"){D=I.position;light=new THREE.PointLight(qa,R);light.position.set(D[0],D[1],D[2])}da.scene.addLight(light);da.lights[A]=light}for(H in ga.fogs){A=ga.fogs[H];if(A.type=="linear")la=new THREE.Fog(0,
|
|
|
|
-A.near,A.far);else A.type=="exp2"&&(la=new THREE.FogExp2(0,A.density));R=A.color;la.color.setRGB(R[0],R[1],R[2]);da.fogs[H]=la}if(da.cameras&&ga.defaults.camera)da.currentCamera=da.cameras[ga.defaults.camera];if(da.fogs&&ga.defaults.fog)da.scene.fog=da.fogs[ga.defaults.fog];R=ga.defaults.bgcolor;da.bgColor=new THREE.Color;da.bgColor.setRGB(R[0],R[1],R[2]);da.bgColorAlpha=ga.defaults.bgalpha;for(p in ga.geometries){H=ga.geometries[p];if(H.type=="bin_mesh"||H.type=="ascii_mesh"){e+=1;c.onLoadStart()}}Da=
|
|
|
|
-e;for(p in ga.geometries){H=ga.geometries[p];if(H.type=="cube"){Q=new THREE.Cube(H.width,H.height,H.depth,H.segmentsWidth,H.segmentsHeight,H.segmentsDepth,null,H.flipped,H.sides);da.geometries[p]=Q}else if(H.type=="plane"){Q=new THREE.Plane(H.width,H.height,H.segmentsWidth,H.segmentsHeight);da.geometries[p]=Q}else if(H.type=="sphere"){Q=new THREE.Sphere(H.radius,H.segmentsWidth,H.segmentsHeight);da.geometries[p]=Q}else if(H.type=="cylinder"){Q=new THREE.Cylinder(H.numSegs,H.topRad,H.botRad,H.height,
|
|
|
|
-H.topOffset,H.botOffset);da.geometries[p]=Q}else if(H.type=="torus"){Q=new THREE.Torus(H.radius,H.tube,H.segmentsR,H.segmentsT);da.geometries[p]=Q}else if(H.type=="icosahedron"){Q=new THREE.Icosahedron(H.subdivisions);da.geometries[p]=Q}else if(H.type=="bin_mesh")h.load({model:j(H.url,ga.urlBaseType),callback:m(p)});else if(H.type=="ascii_mesh")ea.load({model:j(H.url,ga.urlBaseType),callback:m(p)});else if(H.type=="embedded_mesh")(H=ga.embeds[H.id])&&ea.createModel(H,o(p),"")}for(B in ga.textures){p=
|
|
|
|
-ga.textures[B];if(p.url instanceof Array){oa+=p.url.length;for(h=0;h<p.url.length;h++)c.onLoadStart()}else{oa+=1;c.onLoadStart()}}Aa=oa;for(B in ga.textures){p=ga.textures[B];if(p.mapping!=undefined&&THREE[p.mapping]!=undefined)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){h=[];for(var ua=0;ua<p.url.length;ua++)h[ua]=j(p.url[ua],ga.urlBaseType);h=THREE.ImageUtils.loadTextureCube(h,p.mapping,fa)}else{h=THREE.ImageUtils.loadTexture(j(p.url,ga.urlBaseType),p.mapping,fa);if(THREE[p.minFilter]!=
|
|
|
|
-undefined)h.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=undefined)h.magFilter=THREE[p.magFilter]}da.textures[B]=h}for(y in ga.materials){B=ga.materials[y];for(L in B.parameters)if(L=="envMap"||L=="map"||L=="lightMap")B.parameters[L]=da.textures[B.parameters[L]];else if(L=="shading")B.parameters[L]=B.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")B.parameters[L]=THREE[B.parameters[L]]?THREE[B.parameters[L]]:THREE.NormalBlending;else if(L=="combine")B.parameters[L]=
|
|
|
|
-B.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(B.parameters[L]=="face")B.parameters[L]=THREE.FaceColors;else if(B.parameters[L])B.parameters[L]=THREE.VertexColors;if(B.parameters.opacity!==undefined&&B.parameters.opacity<1)B.parameters.transparent=!0;B=new THREE[B.type](B.parameters);da.materials[y]=B}k();c.callbackSync(da)}}};
|
|
|
|
|
|
+THREE.SceneLoader.prototype={load:function(b,d){var c=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(h){function j(ra,ca){return ca=="relativeToHTML"?ra:g+"/"+ra}function k(){for(u in ha.objects)if(!ea.objects[u]){R=ha.objects[u];if(R.geometry!==undefined){if(O=ea.geometries[R.geometry]){ta=[];for(va=0;va<R.materials.length;va++)ta[va]=ea.materials[R.materials[va]];E=R.position;r=R.rotation;q=R.quaternion;s=R.scale;q=0;ta.length==0&&(ta[0]=
|
|
|
|
+new THREE.MeshFaceMaterial);ta.length>1&&(ta=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(O,ta);object.name=u;object.position.set(E[0],E[1],E[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=R.visible;ea.scene.addObject(object);ea.objects[u]=object;if(R.meshCollider){var ra=THREE.CollisionUtils.MeshColliderWBox(object);ea.scene.collisions.colliders.push(ra)}if(R.castsShadow){ra=
|
|
|
|
+new THREE.ShadowVolume(O);ea.scene.addChild(ra);ra.position=object.position;ra.rotation=object.rotation;ra.scale=object.scale}if(R.trigger&&R.trigger.toLowerCase()!="none"){ra={type:R.trigger,object:R};ea.triggers[object.name]=ra}}}else{E=R.position;r=R.rotation;q=R.quaternion;s=R.scale;q=0;object=new THREE.Object3D;object.name=u;object.position.set(E[0],E[1],E[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],
|
|
|
|
+s[1],s[2]);object.visible=R.visible!==undefined?R.visible:!1;ea.scene.addObject(object);ea.objects[u]=object;ea.empties[u]=object;if(R.trigger&&R.trigger.toLowerCase()!="none"){ra={type:R.trigger,object:R};ea.triggers[object.name]=ra}}}}function m(ra){return function(ca){ea.geometries[ra]=ca;k();e-=1;c.onLoadComplete();t()}}function o(ra){return function(ca){ea.geometries[ra]=ca}}function t(){c.callbackProgress({totalModels:Ea,totalTextures:Da,loadedModels:Ea-e,loadedTextures:Da-qa},ea);c.onLoadProgress();
|
|
|
|
+e==0&&qa==0&&d(ea)}var p,y,u,z,H,G,B,R,E,P,L,O,sa,oa,ta,ha,fa,e,qa,Ea,Da,ea;ha=h.data;h=new THREE.BinaryLoader;fa=new THREE.JSONLoader;qa=e=0;ea={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var ga=!1;for(u in ha.objects){R=ha.objects[u];if(R.meshCollider){ga=!0;break}}if(ga)ea.scene.collisions=new THREE.CollisionSystem;if(ha.transform){ga=ha.transform.position;P=ha.transform.rotation;var xa=ha.transform.scale;ga&&ea.scene.position.set(ga[0],
|
|
|
|
+ga[1],ga[2]);P&&ea.scene.rotation.set(P[0],P[1],P[2]);xa&&ea.scene.scale.set(xa[0],xa[1],xa[2]);(ga||P||xa)&&ea.scene.updateMatrix()}ga=function(){qa-=1;t();c.onLoadComplete()};for(H in ha.cameras){P=ha.cameras[H];if(P.type=="perspective")sa=new THREE.Camera(P.fov,P.aspect,P.near,P.far);else if(P.type=="ortho"){sa=new THREE.Camera;sa.projectionMatrix=THREE.Matrix4.makeOrtho(P.left,P.right,P.top,P.bottom,P.near,P.far)}E=P.position;P=P.target;sa.position.set(E[0],E[1],E[2]);sa.target.position.set(P[0],
|
|
|
|
+P[1],P[2]);ea.cameras[H]=sa}for(z in ha.lights){H=ha.lights[z];sa=H.color!==undefined?H.color:16777215;P=H.intensity!==undefined?H.intensity:1;if(H.type=="directional"){E=H.direction;light=new THREE.DirectionalLight(sa,P);light.position.set(E[0],E[1],E[2]);light.position.normalize()}else if(H.type=="point"){E=H.position;light=new THREE.PointLight(sa,P);light.position.set(E[0],E[1],E[2])}ea.scene.addLight(light);ea.lights[z]=light}for(G in ha.fogs){z=ha.fogs[G];if(z.type=="linear")oa=new THREE.Fog(0,
|
|
|
|
+z.near,z.far);else z.type=="exp2"&&(oa=new THREE.FogExp2(0,z.density));P=z.color;oa.color.setRGB(P[0],P[1],P[2]);ea.fogs[G]=oa}if(ea.cameras&&ha.defaults.camera)ea.currentCamera=ea.cameras[ha.defaults.camera];if(ea.fogs&&ha.defaults.fog)ea.scene.fog=ea.fogs[ha.defaults.fog];P=ha.defaults.bgcolor;ea.bgColor=new THREE.Color;ea.bgColor.setRGB(P[0],P[1],P[2]);ea.bgColorAlpha=ha.defaults.bgalpha;for(p in ha.geometries){G=ha.geometries[p];if(G.type=="bin_mesh"||G.type=="ascii_mesh"){e+=1;c.onLoadStart()}}Ea=
|
|
|
|
+e;for(p in ha.geometries){G=ha.geometries[p];if(G.type=="cube"){O=new THREE.Cube(G.width,G.height,G.depth,G.segmentsWidth,G.segmentsHeight,G.segmentsDepth,null,G.flipped,G.sides);ea.geometries[p]=O}else if(G.type=="plane"){O=new THREE.Plane(G.width,G.height,G.segmentsWidth,G.segmentsHeight);ea.geometries[p]=O}else if(G.type=="sphere"){O=new THREE.Sphere(G.radius,G.segmentsWidth,G.segmentsHeight);ea.geometries[p]=O}else if(G.type=="cylinder"){O=new THREE.Cylinder(G.numSegs,G.topRad,G.botRad,G.height,
|
|
|
|
+G.topOffset,G.botOffset);ea.geometries[p]=O}else if(G.type=="torus"){O=new THREE.Torus(G.radius,G.tube,G.segmentsR,G.segmentsT);ea.geometries[p]=O}else if(G.type=="icosahedron"){O=new THREE.Icosahedron(G.subdivisions);ea.geometries[p]=O}else if(G.type=="bin_mesh")h.load({model:j(G.url,ha.urlBaseType),callback:m(p)});else if(G.type=="ascii_mesh")fa.load({model:j(G.url,ha.urlBaseType),callback:m(p)});else if(G.type=="embedded_mesh")(G=ha.embeds[G.id])&&fa.createModel(G,o(p),"")}for(B in ha.textures){p=
|
|
|
|
+ha.textures[B];if(p.url instanceof Array){qa+=p.url.length;for(h=0;h<p.url.length;h++)c.onLoadStart()}else{qa+=1;c.onLoadStart()}}Da=qa;for(B in ha.textures){p=ha.textures[B];if(p.mapping!=undefined&&THREE[p.mapping]!=undefined)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){h=[];for(var va=0;va<p.url.length;va++)h[va]=j(p.url[va],ha.urlBaseType);h=THREE.ImageUtils.loadTextureCube(h,p.mapping,ga)}else{h=THREE.ImageUtils.loadTexture(j(p.url,ha.urlBaseType),p.mapping,ga);if(THREE[p.minFilter]!=
|
|
|
|
+undefined)h.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=undefined)h.magFilter=THREE[p.magFilter]}ea.textures[B]=h}for(y in ha.materials){B=ha.materials[y];for(L in B.parameters)if(L=="envMap"||L=="map"||L=="lightMap")B.parameters[L]=ea.textures[B.parameters[L]];else if(L=="shading")B.parameters[L]=B.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")B.parameters[L]=THREE[B.parameters[L]]?THREE[B.parameters[L]]:THREE.NormalBlending;else if(L=="combine")B.parameters[L]=
|
|
|
|
+B.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(B.parameters[L]=="face")B.parameters[L]=THREE.FaceColors;else if(B.parameters[L])B.parameters[L]=THREE.VertexColors;if(B.parameters.opacity!==undefined&&B.parameters.opacity<1)B.parameters.transparent=!0;B=new THREE[B.type](B.parameters);ea.materials[y]=B}k();c.callbackSync(ea)}}};
|
|
THREE.MarchingCubes=function(b,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];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=
|
|
THREE.MarchingCubes=function(b,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];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,f,g){return c+(f-c)*g};this.VIntX=function(c,f,g,h,j,k,m,o,t,p){j=(j-t)/(p-t);t=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=o;g[h]=this.lerp(t[c],t[c+3],j);g[h+1]=this.lerp(t[c+1],t[c+4],j);g[h+2]=this.lerp(t[c+2],t[c+5],j)};this.VIntY=function(c,f,g,h,j,k,m,o,t,p){j=(j-t)/(p-t);t=this.normal_cache;f[h]=k;f[h+1]=m+j*this.delta;f[h+
|
|
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,f,g){return c+(f-c)*g};this.VIntX=function(c,f,g,h,j,k,m,o,t,p){j=(j-t)/(p-t);t=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=o;g[h]=this.lerp(t[c],t[c+3],j);g[h+1]=this.lerp(t[c+1],t[c+4],j);g[h+2]=this.lerp(t[c+2],t[c+5],j)};this.VIntY=function(c,f,g,h,j,k,m,o,t,p){j=(j-t)/(p-t);t=this.normal_cache;f[h]=k;f[h+1]=m+j*this.delta;f[h+
|
|
2]=o;f=c+this.yd*3;g[h]=this.lerp(t[c],t[f],j);g[h+1]=this.lerp(t[c+1],t[f+1],j);g[h+2]=this.lerp(t[c+2],t[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,m,o,t,p){j=(j-t)/(p-t);t=this.normal_cache;f[h]=k;f[h+1]=m;f[h+2]=o+j*this.delta;f=c+this.zd*3;g[h]=this.lerp(t[c],t[f],j);g[h+1]=this.lerp(t[c+1],t[f+1],j);g[h+2]=this.lerp(t[c+2],t[f+2],j)};this.compNorm=function(c){var f=c*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[c-1]-this.field[c+1];this.normal_cache[f+1]=this.field[c-this.yd]-
|
|
2]=o;f=c+this.yd*3;g[h]=this.lerp(t[c],t[f],j);g[h+1]=this.lerp(t[c+1],t[f+1],j);g[h+2]=this.lerp(t[c+2],t[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,m,o,t,p){j=(j-t)/(p-t);t=this.normal_cache;f[h]=k;f[h+1]=m;f[h+2]=o+j*this.delta;f=c+this.zd*3;g[h]=this.lerp(t[c],t[f],j);g[h+1]=this.lerp(t[c+1],t[f+1],j);g[h+2]=this.lerp(t[c+2],t[f+2],j)};this.compNorm=function(c){var f=c*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[c-1]-this.field[c+1];this.normal_cache[f+1]=this.field[c-this.yd]-
|
|
-this.field[c+this.yd];this.normal_cache[f+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,f,g,h,j,k){var m=h+1,o=h+this.yd,t=h+this.zd,p=m+this.yd,y=m+this.zd,u=h+this.yd+this.zd,A=m+this.yd+this.zd,I=0,H=this.field[h],B=this.field[m],U=this.field[o],D=this.field[p],R=this.field[t],L=this.field[y],Q=this.field[u],qa=this.field[A];H<j&&(I|=1);B<j&&(I|=2);U<j&&(I|=8);D<j&&(I|=4);R<j&&(I|=16);L<j&&(I|=32);Q<j&&(I|=128);qa<j&&(I|=64);var la=THREE.edgeTable[I];if(la==0)return 0;
|
|
|
|
-var ra=this.delta,ga=c+ra,ea=f+ra;ra=g+ra;if(la&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,H,B)}if(la&2){this.compNorm(m);this.compNorm(p);this.VIntY(m*3,this.vlist,this.nlist,3,j,ga,f,g,B,D)}if(la&4){this.compNorm(o);this.compNorm(p);this.VIntX(o*3,this.vlist,this.nlist,6,j,c,ea,g,U,D)}if(la&8){this.compNorm(h);this.compNorm(o);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,H,U)}if(la&16){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,
|
|
|
|
-12,j,c,f,ra,R,L)}if(la&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,j,ga,f,ra,L,qa)}if(la&64){this.compNorm(u);this.compNorm(A);this.VIntX(u*3,this.vlist,this.nlist,18,j,c,ea,ra,Q,qa)}if(la&128){this.compNorm(t);this.compNorm(u);this.VIntY(t*3,this.vlist,this.nlist,21,j,c,f,ra,R,Q)}if(la&256){this.compNorm(h);this.compNorm(t);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,H,R)}if(la&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,j,
|
|
|
|
-ga,f,g,B,L)}if(la&1024){this.compNorm(p);this.compNorm(A);this.VIntZ(p*3,this.vlist,this.nlist,30,j,ga,ea,g,D,qa)}if(la&2048){this.compNorm(o);this.compNorm(u);this.VIntZ(o*3,this.vlist,this.nlist,33,j,c,ea,g,U,Q)}I<<=4;for(j=h=0;THREE.triTable[I+j]!=-1;){c=I+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var m=this.count*3;this.positionArray[m]=c[g];this.positionArray[m+
|
|
|
|
|
|
+this.field[c+this.yd];this.normal_cache[f+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,f,g,h,j,k){var m=h+1,o=h+this.yd,t=h+this.zd,p=m+this.yd,y=m+this.zd,u=h+this.yd+this.zd,z=m+this.yd+this.zd,H=0,G=this.field[h],B=this.field[m],R=this.field[o],E=this.field[p],P=this.field[t],L=this.field[y],O=this.field[u],sa=this.field[z];G<j&&(H|=1);B<j&&(H|=2);R<j&&(H|=8);E<j&&(H|=4);P<j&&(H|=16);L<j&&(H|=32);O<j&&(H|=128);sa<j&&(H|=64);var oa=THREE.edgeTable[H];if(oa==0)return 0;
|
|
|
|
+var ta=this.delta,ha=c+ta,fa=f+ta;ta=g+ta;if(oa&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,G,B)}if(oa&2){this.compNorm(m);this.compNorm(p);this.VIntY(m*3,this.vlist,this.nlist,3,j,ha,f,g,B,E)}if(oa&4){this.compNorm(o);this.compNorm(p);this.VIntX(o*3,this.vlist,this.nlist,6,j,c,fa,g,R,E)}if(oa&8){this.compNorm(h);this.compNorm(o);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,G,R)}if(oa&16){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,
|
|
|
|
+12,j,c,f,ta,P,L)}if(oa&32){this.compNorm(y);this.compNorm(z);this.VIntY(y*3,this.vlist,this.nlist,15,j,ha,f,ta,L,sa)}if(oa&64){this.compNorm(u);this.compNorm(z);this.VIntX(u*3,this.vlist,this.nlist,18,j,c,fa,ta,O,sa)}if(oa&128){this.compNorm(t);this.compNorm(u);this.VIntY(t*3,this.vlist,this.nlist,21,j,c,f,ta,P,O)}if(oa&256){this.compNorm(h);this.compNorm(t);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,G,P)}if(oa&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,j,
|
|
|
|
+ha,f,g,B,L)}if(oa&1024){this.compNorm(p);this.compNorm(z);this.VIntZ(p*3,this.vlist,this.nlist,30,j,ha,fa,g,E,sa)}if(oa&2048){this.compNorm(o);this.compNorm(u);this.VIntZ(o*3,this.vlist,this.nlist,33,j,c,fa,g,R,O)}H<<=4;for(j=h=0;THREE.triTable[H+j]!=-1;){c=H+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var m=this.count*3;this.positionArray[m]=c[g];this.positionArray[m+
|
|
1]=c[g+1];this.positionArray[m+2]=c[g+2];this.positionArray[m+3]=c[h];this.positionArray[m+4]=c[h+1];this.positionArray[m+5]=c[h+2];this.positionArray[m+6]=c[j];this.positionArray[m+7]=c[j+1];this.positionArray[m+8]=c[j+2];this.normalArray[m]=f[g];this.normalArray[m+1]=f[g+1];this.normalArray[m+2]=f[g+2];this.normalArray[m+3]=f[h];this.normalArray[m+4]=f[h+1];this.normalArray[m+5]=f[h+2];this.normalArray[m+6]=f[j];this.normalArray[m+7]=f[j+1];this.normalArray[m+8]=f[j+2];this.hasPos=!0;this.hasNormal=
|
|
1]=c[g+1];this.positionArray[m+2]=c[g+2];this.positionArray[m+3]=c[h];this.positionArray[m+4]=c[h+1];this.positionArray[m+5]=c[h+2];this.positionArray[m+6]=c[j];this.positionArray[m+7]=c[j+1];this.positionArray[m+8]=c[j+2];this.normalArray[m]=f[g];this.normalArray[m+1]=f[g+1];this.normalArray[m+2]=f[g+2];this.normalArray[m+3]=f[h];this.normalArray[m+4]=f[h+1];this.normalArray[m+5]=f[h+2];this.normalArray[m+6]=f[j];this.normalArray[m+7]=f[j+1];this.normalArray[m+8]=f[j+2];this.hasPos=!0;this.hasNormal=
|
|
!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;c(this)}};this.addBall=function(c,f,g,h,j){var k=this.size*Math.sqrt(h/j),m=g*this.size,o=f*this.size,t=c*this.size,p=Math.floor(m-k);p<1&&(p=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var y=Math.floor(o-k);y<1&&(y=1);o=Math.floor(o+k);o>this.size-1&&
|
|
!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;c(this)}};this.addBall=function(c,f,g,h,j){var k=this.size*Math.sqrt(h/j),m=g*this.size,o=f*this.size,t=c*this.size,p=Math.floor(m-k);p<1&&(p=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var y=Math.floor(o-k);y<1&&(y=1);o=Math.floor(o+k);o>this.size-1&&
|
|
-(o=this.size-1);var u=Math.floor(t-k);u<1&&(u=1);k=Math.floor(t+k);k>this.size-1&&(k=this.size-1);for(var A,I,H,B,U,D;p<m;p++){t=this.size2*p;I=p/this.size-g;U=I*I;for(I=y;I<o;I++){H=t+this.size*I;A=I/this.size-f;D=A*A;for(A=u;A<k;A++){B=A/this.size-c;B=h/(1.0E-6+B*B+D+U)-j;B>0&&(this.field[H+A]+=B)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,o=this.size,t=this.yd,p=this.zd,y=this.field,u=o*Math.sqrt(c/f);u>o&&(u=o);for(g=0;g<u;g++){h=g/o;h*=h;k=c/(1.0E-4+h)-f;if(k>0)for(h=0;h<o;h++){m=g+h*t;for(j=
|
|
|
|
-0;j<o;j++)y[p*j+m]+=k}}};this.addPlaneY=function(c,f){var g,h,j,k,m,o,t=this.size,p=this.yd,y=this.zd,u=this.field,A=t*Math.sqrt(c/f);A>t&&(A=t);for(h=0;h<A;h++){g=h/t;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=h*p;for(g=0;g<t;g++){o=m+g;for(j=0;j<t;j++)u[y*j+o]+=k}}}};this.addPlaneZ=function(c,f){var g,h,j,k,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=zd*j;for(h=0;h<size;h++){o=m+h*yd;
|
|
|
|
|
|
+(o=this.size-1);var u=Math.floor(t-k);u<1&&(u=1);k=Math.floor(t+k);k>this.size-1&&(k=this.size-1);for(var z,H,G,B,R,E;p<m;p++){t=this.size2*p;H=p/this.size-g;R=H*H;for(H=y;H<o;H++){G=t+this.size*H;z=H/this.size-f;E=z*z;for(z=u;z<k;z++){B=z/this.size-c;B=h/(1.0E-6+B*B+E+R)-j;B>0&&(this.field[G+z]+=B)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,o=this.size,t=this.yd,p=this.zd,y=this.field,u=o*Math.sqrt(c/f);u>o&&(u=o);for(g=0;g<u;g++){h=g/o;h*=h;k=c/(1.0E-4+h)-f;if(k>0)for(h=0;h<o;h++){m=g+h*t;for(j=
|
|
|
|
+0;j<o;j++)y[p*j+m]+=k}}};this.addPlaneY=function(c,f){var g,h,j,k,m,o,t=this.size,p=this.yd,y=this.zd,u=this.field,z=t*Math.sqrt(c/f);z>t&&(z=t);for(h=0;h<z;h++){g=h/t;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=h*p;for(g=0;g<t;g++){o=m+g;for(j=0;j<t;j++)u[y*j+o]+=k}}}};this.addPlaneZ=function(c,f){var g,h,j,k,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=zd*j;for(h=0;h<size;h++){o=m+h*yd;
|
|
for(g=0;g<size;g++)field[o+g]+=k}}}};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 f,g,h,j,k,m,o,t,p,y=this.size-2;for(j=1;j<y;j++){p=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){t=p+this.size*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=t+g;this.polygonize(k,m,o,f,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,f=new THREE.Geometry,
|
|
for(g=0;g<size;g++)field[o+g]+=k}}}};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 f,g,h,j,k,m,o,t,p,y=this.size-2;for(j=1;j<y;j++){p=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){t=p+this.size*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=t+g;this.polygonize(k,m,o,f,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,f=new THREE.Geometry,
|
|
g=[];this.render(function(h){var j,k,m,o,t,p,y,u;for(j=0;j<h.count;j++){y=j*3;t=y+1;u=y+2;k=h.positionArray[y];m=h.positionArray[t];o=h.positionArray[u];p=new THREE.Vector3(k,m,o);k=h.normalArray[y];m=h.normalArray[t];o=h.normalArray[u];y=new THREE.Vector3(k,m,o);y.normalize();t=new THREE.Vertex(p);f.vertices.push(t);g.push(y)}nfaces=h.count/3;for(j=0;j<nfaces;j++){y=(c+j)*3;t=y+1;u=y+2;p=g[y];k=g[t];m=g[u];y=new THREE.Face3(y,t,u,[p,k,m]);f.faces.push(y)}c+=nfaces;h.count=0});return f};this.init(b)};
|
|
g=[];this.render(function(h){var j,k,m,o,t,p,y,u;for(j=0;j<h.count;j++){y=j*3;t=y+1;u=y+2;k=h.positionArray[y];m=h.positionArray[t];o=h.positionArray[u];p=new THREE.Vector3(k,m,o);k=h.normalArray[y];m=h.normalArray[t];o=h.normalArray[u];y=new THREE.Vector3(k,m,o);y.normalize();t=new THREE.Vertex(p);f.vertices.push(t);g.push(y)}nfaces=h.count/3;for(j=0;j<nfaces;j++){y=(c+j)*3;t=y+1;u=y+2;p=g[y];k=g[t];m=g[u];y=new THREE.Face3(y,t,u,[p,k,m]);f.faces.push(y)}c+=nfaces;h.count=0});return f};this.init(b)};
|
|
THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|