|
@@ -12,7 +12,7 @@ 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)};
|
|
|
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};
|
|
|
-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,W,D){D=D.clone().subSelf(B);W=W.clone().subSelf(B);var R=H.clone().subSelf(B);H=D.dot(D);B=D.dot(W);D=D.dot(R);var L=W.dot(W);W=W.dot(R);R=1/(H*L-B*B);L=(L*D-B*W)*R;H=(H*W-B*D)*R;return L>0&&H>0&&L+H<1}var c,f,g,h,j,k,m,o,t,p,
|
|
|
+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.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()};
|
|
@@ -23,8 +23,8 @@ 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,
|
|
|
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,
|
|
|
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();
|
|
|
-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,W=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*W+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*W+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*W+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*W+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,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]=
|
|
|
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=
|
|
|
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]=
|
|
@@ -50,7 +50,7 @@ THREE.Quaternion.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;thi
|
|
|
b.y*f;this.z=b.z*f;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},
|
|
|
multiplySelf:function(b){var d=this.x,c=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=d*b+g*h+c*k-f*j;this.y=c*b+g*j+f*h-d*k;this.z=f*b+g*k+d*j-c*h;this.w=g*b-d*h-c*j-f*k;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,m=this.w,o=m*c+j*g-k*f,t=
|
|
|
m*f+k*c-h*g,p=m*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=o*m+c*-h+t*-k-p*-j;d.y=t*m+c*-j+p*-h-o*-k;d.z=p*m+c*-k+o*-j-t*-h;return d}};
|
|
|
-THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
+THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
THREE.Face3=function(b,d,c,f,g,h){this.a=b;this.b=d;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(b,d,c,f,g,h,j){this.a=b;this.b=d;this.c=c;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
|
|
|
THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
@@ -58,16 +58,16 @@ 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()||
|
|
|
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]);
|
|
|
-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;W=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*W)*qa);e.set((D*A-R*u)*qa,(D*H-R*I)*qa,(D*W-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,W,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=
|
|
|
+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;
|
|
|
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);
|
|
|
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,W,D){u=(I-u)*0.5;H=(H-A)*0.5;return(2*(A-I)+u+H)*D+(-3*(A-I)-2*u-H)*W+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,W=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);W.copy(position);
|
|
|
-R+=W.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,W,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);W=A/(this.points.length-1);for(I=1;I<D-1;I++){H=B+I*(1/D)*(W-B);position=this.getPoint(H);R.push(L.copy(position).clone())}R.push(L.copy(this.points[A]).clone())}this.points=
|
|
|
+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.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=
|
|
@@ -138,38 +138,38 @@ THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)th
|
|
|
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.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,W,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));
|
|
|
+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;W=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,
|
|
|
+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[W]=D[W]||new THREE.RenderableParticle;W++;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.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,W=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,U=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=W=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(V){var na,ia,$,va=V.lights;F.setRGB(0,
|
|
|
-0,0);U.setRGB(0,0,0);G.setRGB(0,0,0);V=0;for(na=va.length;V<na;V++){ia=va[V];$=ia.color;if(ia instanceof THREE.AmbientLight){F.r+=$.r;F.g+=$.g;F.b+=$.b}else if(ia instanceof THREE.DirectionalLight){U.r+=$.r;U.g+=$.g;U.b+=$.b}else if(ia instanceof THREE.PointLight){G.r+=$.r;G.g+=$.g;G.b+=$.b}}}function za(V,na,ia,$){var va,ta,ya,X,Ia=V.lights;V=0;for(va=Ia.length;V<va;V++){ta=Ia[V];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(V,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(V.x-$,V.y-va,V.x+$,V.y+
|
|
|
-va);if(x.instersects(z)){p.save();p.translate(V.x,V.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(V.x-$,V.y-va,V.x+$,V.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(V.x,V.y);p.rotate(-na.rotation);p.scale($,va);ia.program(p);p.restore()}}}function E(V,na,ia,$){b($.opacity);d($.blending);
|
|
|
-p.beginPath();p.moveTo(V.positionScreen.x,V.positionScreen.y);p.lineTo(na.positionScreen.x,na.positionScreen.y);p.closePath();if($ instanceof THREE.LineBasicMaterial){ma.__styleString=$.color.__styleString;V=$.linewidth;if(W!=V)p.lineWidth=W=V;V=$.linecap;if(D!=V)p.lineCap=D=V;V=$.linejoin;if(R!=V)p.lineJoin=R=V;c(ma.__styleString);p.stroke();z.inflate($.linewidth*2)}}function aa(V,na,ia,$,va,ta,ya,X,Ia){f.data.vertices+=3;f.data.faces++;b(X.opacity);d(X.blending);ea=V.positionScreen.x;e=V.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){V=xa.matrixWorldInverse;J.copy(ya.vertexNormalsWorld[0]);T=(J.x*V.n11+J.y*V.n12+J.z*V.n13)*0.5+0.5;O=-(J.x*V.n21+J.y*V.n22+
|
|
|
-J.z*V.n23)*0.5+0.5;J.copy(ya.vertexNormalsWorld[1]);Ba=(J.x*V.n11+J.y*V.n12+J.z*V.n13)*0.5+0.5;La=-(J.x*V.n21+J.y*V.n22+J.z*V.n23)*0.5+0.5;J.copy(ya.vertexNormalsWorld[2]);n=(J.x*V.n11+J.y*V.n12+J.z*V.n13)*0.5+0.5;C=-(J.x*V.n21+J.y*V.n22+J.z*V.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
|
|
|
+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(V.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(V,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(V,na,$,0,1,3,ya,X,Ia);aa(va,ia,ta,1,2,3,ya,X,Ia)}else{ea=V.positionScreen.x;e=V.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,
|
|
|
+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(V.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(V,na,ia,$,va,ta){p.beginPath();p.moveTo(V,na);p.lineTo(ia,$);p.lineTo(va,ta);p.lineTo(V,na);p.closePath()}function fb(V,na,ia,$,va,ta,ya,X){p.beginPath();p.moveTo(V,na);p.lineTo(ia,
|
|
|
-$);p.lineTo(va,ta);p.lineTo(ya,X);p.lineTo(V,na);p.closePath()}function Oa(V,na,ia,$){if(W!=na)p.lineWidth=W=na;if(D!=ia)p.lineCap=D=ia;if(R!=$)p.lineJoin=R=$;c(V);p.stroke();z.inflate(na*2)}function Qa(V){if(B!=V)p.fillStyle=B=V;p.fill()}function cb(V,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-=V;$-=na;va-=V;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;V=V-gb*X-ia*Ia;na=na-eb*X-$*Ia;p.save();p.transform(gb,eb,ia,$,V,na);p.clip();p.drawImage(ya,0,0);p.restore()}}function hb(V,na,ia,$){var va=~~(V.r*255),ta=~~(V.g*255);V=~~(V.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]=V<0?0:V>255?255:V;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(V,na,ia){V=(V-na)/(ia-na);return V*V*(3-2*V)}function $a(V){V=(V+1)*0.5;return V<0?0:V>1?1:V}function Ma(V,na){var ia=na.x-V.x,$=na.y-V.y,va=1/Math.sqrt(ia*ia+$*$);ia*=va;$*=va;na.x+=ia;na.y+=$;V.x-=ia;V.y-=$}var bb,Va,N,Na,Ra,ib,jb,Pa;this.autoClear?this.clear():
|
|
|
+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*=
|
|
@@ -181,13 +181,13 @@ ca.color.__styleString;else if(ca instanceof THREE.MeshDepthMaterial){ra=1-ca.__
|
|
|
"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,W=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,
|
|
|
+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];W.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;W.addPoint(u.positionScreen.x,u.positionScreen.y);W.addPoint(A.positionScreen.x,A.positionScreen.y);if(B.instersects(W)){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);
|
|
|
+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;W.addPoint(u.positionScreen.x,u.positionScreen.y);W.addPoint(A.positionScreen.x,A.positionScreen.y);W.addPoint(I.positionScreen.x,I.positionScreen.y);if(B.instersects(W)){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;W.addPoint(u.positionScreen.x,u.positionScreen.y);W.addPoint(A.positionScreen.x,A.positionScreen.y);W.addPoint(I.positionScreen.x,I.positionScreen.y);W.addPoint(H.positionScreen.x,H.positionScreen.y);if(B.instersects(W)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ha=
|
|
|
+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.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",
|
|
@@ -219,53 +219,53 @@ 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,
|
|
|
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.WebGLRenderer=function(b){function d(n,C,x){var v,z,P,K=n.vertices,F=K.length,U=n.colors,G=U.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=U[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=U[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;
|
|
|
+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 U,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(U=C.length;x<U;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=
|
|
|
+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]){U=F[w];J=U.type;x=U.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(U=U.texture)if(U.image instanceof Array&&U.image.length==
|
|
|
-6){if(U.image.length==6){if(U.needsUpdate){if(U.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,U.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,U.image[J])}else{U.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,U.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,U.image[J]);U.__webglInit=!0}L(e.TEXTURE_CUBE_MAP,U,U.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,
|
|
|
-null);U.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,U.image.__webglTextureCube)}}else Q(U,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!==
|
|
|
+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,U=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]=U[F[x]];x++}}else{F=[];var G=
|
|
|
--1,J=0;U=P.morphTargetInfluences;var M,Z=U.length;x=0;for(P.morphTargetBase!==-1&&(F[P.morphTargetBase]=!0);x<v.numSupportedMorphTargets;){for(M=0;M<Z;M++)if(!F[M]&&U[M]>G){J=M;G=U[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]>=
|
|
|
+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,U,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];U=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+U+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,
|
|
|
+!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,U=n.transparent;U.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(U,z):o(F,z))}else(z=C)&&(z.transparent?o(U,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,U,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;U=F.uniforms;G=F.attributes;if(Aa!==F){e.useProgram(F);Aa=F;e.uniformMatrix4fv(U.projectionMatrix,!1,Xa);e.uniformMatrix4fv(U.viewMatrix,!1,Za);e.uniform3fv(U.directionalLightDirection,P)}v.matrixWorld.flattenToArray(v._objectMatrixArray);e.uniformMatrix4fv(U.objectMatrix,!1,v._objectMatrixArray);
|
|
|
+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,U=[],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,
|
|
|
+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);U[0]=F*K*z.scale.x;U[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,U);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,U=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;U.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(U);C.projectionMatrix.multiplyVector3(U);sa[0]=U.x;sa[1]=U.y;sa[2]=U.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);
|
|
|
+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.001&&F.scale>0.001){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,
|
|
|
+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,U=void 0,G=void 0;U=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;U=void 0;U=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,V=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;
|
|
|
+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++){U=vb[K];G=yb[U];wb&&(Ha=wb[U]);xb&&(Ga=xb[U]);U=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||
|
|
|
+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];V[Ma]=M.x;V[Ma+1]=M.y;V[Ma+2]=M.z;V[Ma+3]=M.w;V[Ma+4]=Z.x;V[Ma+5]=Z.y;V[Ma+6]=Z.z;V[Ma+7]=Z.w;V[Ma+8]=G.x;V[Ma+9]=G.y;V[Ma+10]=G.z;V[Ma+11]=G.w;Ma+=12}if(rb&&Ca)if(U.length==3&&eb)for(Y=0;Y<3;Y++){J=U[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++){U=Ha[Y];ib[cb]=
|
|
|
-U.u;ib[cb+1]=U.v;cb+=2}if(db&&Ga!==undefined&&sa)for(Y=0;Y<3;Y++){U=Ga[Y];jb[hb]=U.u;jb[hb+1]=U.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;
|
|
|
+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+
|
|
@@ -273,15 +273,15 @@ Ra[Qa+10]=Ua.y;Ra[Qa+11]=Ua.z;Qa+=12}if(X)for(fb in X){w=X[fb];if(w.needsUpdate)
|
|
|
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];V[Ma]=M.x;V[Ma+1]=M.y;V[Ma+2]=M.z;V[Ma+3]=M.w;V[Ma+4]=Z.x;V[Ma+5]=Z.y;V[Ma+6]=Z.z;V[Ma+7]=Z.w;V[Ma+8]=G.x;V[Ma+9]=G.y;V[Ma+10]=G.z;V[Ma+11]=G.w;V[Ma+12]=Y.x;V[Ma+13]=Y.y;V[Ma+14]=Y.z;V[Ma+15]=Y.w;Ma+=16}if(rb&&Ca)if(U.length==4&&eb)for(Y=0;Y<4;Y++){J=U[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++){U=Ha[Y];ib[cb]=U.u;ib[cb+1]=U.v;cb+=2}if(db&&Ga!==undefined&&sa)for(Y=0;Y<
|
|
|
-4;Y++){U=Ga[Y];jb[hb]=U.u;jb[hb+1]=U.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=
|
|
|
+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,V,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);
|
|
|
+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 W(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,U,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;U=C(F);J[U]==undefined&&(J[U]={hash:U,counter:0});G=J[U].hash+"_"+J[U].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[U].counter+=1;G=J[U].hash+"_"+J[U].counter;n.geometryGroups[G]==undefined&&(n.geometryGroups[G]={faces:[],materials:F,vertices:0,numMorphTargets:M})}n.geometryGroups[G].faces.push(z);
|
|
|
+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);
|
|
@@ -308,27 +308,27 @@ e.attachShader(_sprite.program,la("fragment",THREE.ShaderLib.sprite.fragmentShad
|
|
|
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 U,G,J;U=J=F=0;for(G=C.length;U<G;U++){P=C[U];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:{U=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(U);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=
|
|
|
+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+U));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;U=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(Y in F)U.push(Y);
|
|
|
-Y=U;F=0;for(U=Y.length;F<U;F++){G=Y[F];Z.uniforms[G]=e.getUniformLocation(Z,G)}U=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(Y=0;Y<x.maxMorphTargets;Y++)U.push("morphTarget"+Y);for(M in C)U.push(M);M=U;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>=
|
|
|
+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,U,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();U=n.__webglObjects.length;for(v=0;v<U;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<U;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<U;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&&
|
|
|
+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&&W(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,U=void 0;K.__webglMorphTargetsBuffers=[];F=0;for(U=
|
|
|
-K.numMorphTargets;F<U;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=U=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){U+=3;sa+=1;Ka+=3}else if(M instanceof THREE.Face4){U+=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=
|
|
|
+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(U*3);if(Ca)K.__normalArray=new Float32Array(U*3);if(Z.hasTangents)K.__tangentArray=new Float32Array(U*4);if(M)K.__colorArray=new Float32Array(U*3);if(J){if(Z.faceUvs.length>0||Z.faceVertexUvs.length>0)K.__uvArray=new Float32Array(U*2);if(Z.faceUvs.length>1||Z.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(U*
|
|
|
-2)}if(F.geometry.skinWeights.length&&F.geometry.skinIndices.length){K.__skinVertexAArray=new Float32Array(U*4);K.__skinVertexBArray=new Float32Array(U*4);K.__skinIndexArray=new Float32Array(U*4);K.__skinWeightArray=new Float32Array(U*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(U*3))}K.__needsSmoothNormals=
|
|
|
+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(U*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=
|
|
|
+!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=
|
|
@@ -377,7 +377,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
|
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
|
fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var d,c,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;c=Array(h);for(d=f=0;d<h;++d){c[d]=Math.exp(-((d-g)*(d-g))/(2*b*b));f+=c[d]}for(d=0;d<h;++d)c[d]/=f;return c}};
|
|
|
-THREE.QuakeCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=
|
|
|
+THREE.QuakeCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=
|
|
|
b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.noFly!==undefined)this.noFly=b.noFly;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.autoForward!==undefined)this.autoForward=b.autoForward;if(b.activeLook!==undefined)this.activeLook=b.activeLook;if(b.heightSpeed!==undefined)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==undefined)this.heightCoef=b.heightCoef;if(b.heightMin!==undefined)this.heightMin=b.heightMin;if(b.heightMax!==undefined)this.heightMax=
|
|
|
b.heightMax;if(b.constrainVertical!==undefined)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==undefined)this.verticalMin=b.verticalMin;if(b.verticalMax!==undefined)this.verticalMax=b.verticalMax;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.freeze=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=
|
|
|
window.innerHeight/2;this.onMouseDown=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(c){this.mouseX=c.clientX-this.windowHalfX;this.mouseY=c.clientY-this.windowHalfY};this.onKeyDown=
|
|
@@ -387,16 +387,16 @@ 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,
|
|
|
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.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,W=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++){W=y*H.chunks[A]/H.total;t.keys[A]={time:W,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:[]},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,
|
|
|
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.005;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;
|
|
|
if(b.createDebugDummy!==undefined)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==undefined)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==undefined)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==undefined)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=
|
|
|
this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(o,t,p){var y,u;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;u=this.verticalAngleMap.dstRange;
|
|
|
this.phi=(this.phi-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[0];y=this.horizontalAngleMap.srcRange;u=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,o,t,p)};this.onMouseMove=function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
|
|
|
this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.Cube(10,10,20),m=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(m,j);b.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation=
|
|
|
d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(o,t){return function(){t.apply(o,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
|
-THREE.FlyCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==undefined)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==undefined)this.dragToLook=b.dragToLook;if(b.autoForward!==undefined)this.autoForward=
|
|
|
+THREE.FlyCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==undefined)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==undefined)this.dragToLook=b.dragToLook;if(b.autoForward!==undefined)this.autoForward=
|
|
|
b.autoForward;if(b.domElement!==undefined)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(c){if(typeof this[c.type]=="function")this[c.type](c)};this.keydown=function(c){if(!c.altKey){switch(c.keyCode){case 16:this.movementSpeedMultiplier=
|
|
|
0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
|
|
|
this.keyup=function(c){switch(c.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
|
|
@@ -414,17 +414,17 @@ this.matrix.n23*B;this.position.z-=this.matrix.n33*B};this.rotateHorizontally=fu
|
|
|
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;
|
|
|
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.Cube=function(b,d,c,f,g,h,j,k,m){function o(H,B,W,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)*W;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+
|
|
|
+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=[],W=0,D=t.vertices.length;W<D;W++){for(var R=t.vertices[W],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[W]=Q;L=!0;break}}if(!L){B[W]=H.length;H.push(new THREE.Vertex(R.position.clone()))}}W=0;for(D=t.faces.length;W<D;W++){R=t.faces[W];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;
|
|
|
+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));
|
|
|
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;
|
|
|
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,
|
|
|
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;
|
|
|
-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.001;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;
|
|
|
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;
|
|
@@ -443,9 +443,9 @@ 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<<
|
|
|
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.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,W,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];W=[];for(k=0;k<p;k++){A=R[o++];
|
|
|
-D=B[A*2];A=B[A*2+1];W[k]=new THREE.UV(D,A)}f.faceVertexUvs[j][m]=W}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];
|
|
|
+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+=
|
|
|
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;
|
|
@@ -454,40 +454,40 @@ d.postMessage(b)},loadAjaxBuffers:function(b,d,c,f,g,h){var j=new XMLHttpRequest
|
|
|
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,
|
|
|
-W=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(W,8),header_bytes:t(b,W+8),vertex_coordinate_bytes:t(b,W+9),normal_coordinate_bytes:t(b,W+10),uv_coordinate_bytes:t(b,W+11),vertex_index_bytes:t(b,W+12),normal_index_bytes:t(b,W+13),uv_index_bytes:t(b,W+14),material_index_bytes:t(b,W+15),nvertices:k(b,W+16),nnormals:k(b,W+16+4),nuvs:k(b,W+16+8),ntri_flat:k(b,W+16+12),
|
|
|
-ntri_smooth:k(b,W+16+16),ntri_flat_uv:k(b,W+16+20),ntri_smooth_uv:k(b,W+16+24),nquad_flat:k(b,W+16+28),nquad_smooth:k(b,W+16+32),nquad_flat_uv:k(b,W+16+36),nquad_smooth_uv:k(b,W+16+40)};W+=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*
|
|
|
+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);W+=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}(W);W+=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}(W);W+=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}(W);ja=W+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,
|
|
|
+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})(W);(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+=
|
|
|
+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)}};
|
|
|
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]){W=ga.objects[u];if(W.geometry!==undefined){if(Q=da.geometries[W.geometry]){ra=[];for(ua=0;ua<W.materials.length;ua++)ra[ua]=da.materials[W.materials[ua]];D=W.position;r=W.rotation;q=W.quaternion;s=W.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=W.visible;da.scene.addObject(object);da.objects[u]=object;if(W.meshCollider){var pa=THREE.CollisionUtils.MeshColliderWBox(object);da.scene.collisions.colliders.push(pa)}if(W.castsShadow){pa=
|
|
|
-new THREE.ShadowVolume(Q);da.scene.addChild(pa);pa.position=object.position;pa.rotation=object.rotation;pa.scale=object.scale}W.trigger&&W.trigger.toLowerCase()!="none"&&(da.triggers[object.name]={type:W.trigger,object:W})}}else{D=W.position;r=W.rotation;q=W.quaternion;s=W.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=W.visible!==undefined?W.visible:!1;da.scene.addObject(object);da.objects[u]=object;da.empties[u]=object}}}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,W,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){W=ga.objects[u];if(W.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(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.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+
|
|
|
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],W=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);W<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,W,D)}if(la&8){this.compNorm(h);this.compNorm(o);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,H,W)}if(la&16){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,
|
|
|
+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,W,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+
|
|
|
+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+
|
|
|
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&&
|
|
|
-(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,W,D;p<m;p++){t=this.size2*p;I=p/this.size-g;W=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+W)-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=
|
|
|
+(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;
|
|
|
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)};
|