|
@@ -24,7 +24,7 @@ THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,m,o,p,t,y,u,A,F){this.n11=
|
|
g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23*
|
|
g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23*
|
|
f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize();
|
|
f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize();
|
|
return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,t=b.n32,y=b.n33,u=b.n34,A=b.n41,F=b.n42,J=b.n43,B=b.n44,U=d.n11,C=d.n12,V=d.n13,O=d.n14,M=d.n21,va=d.n22,
|
|
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,p=b.n31,t=b.n32,y=b.n33,u=b.n34,A=b.n41,F=b.n42,J=b.n43,B=b.n44,U=d.n11,C=d.n12,V=d.n13,O=d.n14,M=d.n21,va=d.n22,
|
|
-la=d.n23,qa=d.n24,fa=d.n31,ia=d.n32,e=d.n33,oa=d.n34;this.n11=c*U+f*M+g*fa;this.n12=c*C+f*va+g*ia;this.n13=c*V+f*la+g*e;this.n14=c*O+f*qa+g*oa+h;this.n21=j*U+k*M+m*fa;this.n22=j*C+k*va+m*ia;this.n23=j*V+k*la+m*e;this.n24=j*O+k*qa+m*oa+o;this.n31=p*U+t*M+y*fa;this.n32=p*C+t*va+y*ia;this.n33=p*V+t*la+y*e;this.n34=p*O+t*qa+y*oa+u;this.n41=A*U+F*M+J*fa;this.n42=A*C+F*va+J*ia;this.n43=A*V+F*la+J*e;this.n44=A*O+F*qa+J*oa+B;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]=
|
|
|
|
|
|
+la=d.n23,qa=d.n24,ga=d.n31,ea=d.n32,e=d.n33,oa=d.n34;this.n11=c*U+f*M+g*ga;this.n12=c*C+f*va+g*ea;this.n13=c*V+f*la+g*e;this.n14=c*O+f*qa+g*oa+h;this.n21=j*U+k*M+m*ga;this.n22=j*C+k*va+m*ea;this.n23=j*V+k*la+m*e;this.n24=j*O+k*qa+m*oa+o;this.n31=p*U+t*M+y*ga;this.n32=p*C+t*va+y*ea;this.n33=p*V+t*la+y*e;this.n34=p*O+t*qa+y*oa+u;this.n41=A*U+F*M+J*ga;this.n42=A*C+F*va+J*ea;this.n43=A*V+F*la+J*e;this.n44=A*O+F*qa+J*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*=
|
|
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,p=this.n33,t=this.n34,y=this.n41,u=this.n42,A=this.n43,F=this.n44;return f*j*o*y-c*k*o*y-f*h*p*y+d*k*p*y+c*h*t*y-d*j*t*y-f*j*m*u+c*k*m*u+f*g*p*u-b*k*p*u-c*g*t*u+b*j*t*u+f*h*m*A-d*k*m*A-f*g*o*A+b*k*o*A+d*g*t*A-b*h*t*A-c*h*m*F+d*j*m*F+c*g*o*F-b*j*o*F-d*g*p*F+b*h*p*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
|
|
b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,p=this.n33,t=this.n34,y=this.n41,u=this.n42,A=this.n43,F=this.n44;return f*j*o*y-c*k*o*y-f*h*p*y+d*k*p*y+c*h*t*y-d*j*t*y-f*j*m*u+c*k*m*u+f*g*p*u-b*k*p*u-c*g*t*u+b*j*t*u+f*h*m*A-d*k*m*A-f*g*o*A+b*k*o*A+d*g*t*A-b*h*t*A-c*h*m*F+d*j*m*F+c*g*o*F-b*j*o*F-d*g*p*F+b*h*p*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
|
|
this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
|
|
this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
|
|
@@ -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},
|
|
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,p=
|
|
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,p=
|
|
m*f+k*c-h*g,t=m*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=o*m+c*-h+p*-k-t*-j;d.y=p*m+c*-j+t*-h-o*-k;d.z=t*m+c*-k+o*-j-p*-h;return d}};
|
|
m*f+k*c-h*g,t=m*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=o*m+c*-h+p*-k-t*-j;d.y=p*m+c*-j+t*-h-o*-k;d.z=t*m+c*-k+o*-j-p*-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.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.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.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.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.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};
|
|
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,9 +58,9 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,c;b=0;for(d=this.f
|
|
c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,c,f,g,h,j,k=new THREE.Vector3,m=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);d=0;for(c=h.vertexNormals.length;d<c;d++)k.addSelf(h.vertexNormals[d]);k.divideScalar(3)}else{d=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,c.position);m.sub(d.position,c.position);k.crossSelf(m)}k.isZero()||
|
|
c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,c,f,g,h,j,k=new THREE.Vector3,m=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);d=0;for(c=h.vertexNormals.length;d<c;d++)k.addSelf(h.vertexNormals[d]);k.divideScalar(3)}else{d=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,c.position);m.sub(d.position,c.position);k.crossSelf(m)}k.isZero()||
|
|
k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,d,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=
|
|
k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,d,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=
|
|
this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(f[c.a]);
|
|
this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(f[c.a]);
|
|
-c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(ea,wa,ta,pa,ca,ka,ma){k=ea.vertices[wa].position;m=ea.vertices[ta].position;o=ea.vertices[pa].position;p=j[ca];t=j[ka];y=j[ma];u=m.x-k.x;A=o.x-k.x;F=m.y-k.y;J=o.y-k.y;B=m.z-k.z;U=o.z-k.z;C=t.u-p.u;V=y.u-p.u;O=t.v-p.v;M=y.v-p.v;va=1/(C*
|
|
|
|
-M-V*O);ia.set((M*u-O*A)*va,(M*F-O*J)*va,(M*B-O*U)*va);e.set((C*A-V*u)*va,(C*J-V*F)*va,(C*U-V*B)*va);qa[wa].addSelf(ia);qa[ta].addSelf(ia);qa[pa].addSelf(ia);fa[wa].addSelf(e);fa[ta].addSelf(e);fa[pa].addSelf(e)}var d,c,f,g,h,j,k,m,o,p,t,y,u,A,F,J,B,U,C,V,O,M,va,la,qa=[],fa=[],ia=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++){qa[d]=new THREE.Vector3;fa[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=qa[g];oa.copy(la);oa.subSelf(Aa.multiplyScalar(Aa.dot(la))).normalize();Da.cross(h.vertexNormals[f],la);g=Da.dot(fa[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(oa.x,
|
|
|
|
|
|
+c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(fa,wa,ta,pa,ca,ka,ma){k=fa.vertices[wa].position;m=fa.vertices[ta].position;o=fa.vertices[pa].position;p=j[ca];t=j[ka];y=j[ma];u=m.x-k.x;A=o.x-k.x;F=m.y-k.y;J=o.y-k.y;B=m.z-k.z;U=o.z-k.z;C=t.u-p.u;V=y.u-p.u;O=t.v-p.v;M=y.v-p.v;va=1/(C*
|
|
|
|
+M-V*O);ea.set((M*u-O*A)*va,(M*F-O*J)*va,(M*B-O*U)*va);e.set((C*A-V*u)*va,(C*J-V*F)*va,(C*U-V*B)*va);qa[wa].addSelf(ea);qa[ta].addSelf(ea);qa[pa].addSelf(ea);ga[wa].addSelf(e);ga[ta].addSelf(e);ga[pa].addSelf(e)}var d,c,f,g,h,j,k,m,o,p,t,y,u,A,F,J,B,U,C,V,O,M,va,la,qa=[],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++){qa[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=qa[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;
|
|
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=
|
|
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,p){if(m[o]===undefined){m[o]={set:{},array:[]};m[o].set[p]=1;m[o].array.push(p)}else if(m[o].set[p]===undefined){m[o].set[p]=1;m[o].array.push(p)}}var c,f,g,h,j,k={};c=0;for(f=this.faces.length;c<f;c++){j=this.faces[c];if(j instanceof THREE.Face3){g=b(j.a,j.b);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.a,j.c);d(k,g,c)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);d(k,g,c);g=b(j.a,j.b);d(k,g,c);
|
|
{radius:b}},computeEdgeFaces:function(){function b(m,o){return Math.min(m,o)+"_"+Math.max(m,o)}function d(m,o,p){if(m[o]===undefined){m[o]={set:{},array:[]};m[o].set[p]=1;m[o].array.push(p)}else if(m[o].set[p]===undefined){m[o].set[p]=1;m[o].array.push(p)}}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);
|
|
@@ -137,58 +137,58 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
|
|
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
|
|
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
|
|
THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
|
|
THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
|
|
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,c){this.color=new THREE.Color(b);this.near=d||1;this.far=c||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
|
|
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,c){this.color=new THREE.Color(b);this.near=d||1;this.far=c||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
|
|
-THREE.Projector=function(){function b(){var ia=m[k]=m[k]||new THREE.RenderableVertex;k++;return ia}function d(ia,e){return e.z-ia.z}function c(ia,e){var oa=0,Da=1,Aa=ia.z+ia.w,da=e.z+e.w,ea=-ia.z+ia.w,wa=-e.z+e.w;if(Aa>=0&&da>=0&&ea>=0&&wa>=0)return!0;else if(Aa<0&&da<0||ea<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(ea<0)oa=Math.max(oa,ea/(ea-wa));else wa<0&&(Da=Math.min(Da,ea/(ea-wa)));if(Da<oa)return!1;else{ia.lerpSelf(e,oa);e.lerpSelf(ia,
|
|
|
|
-1-Da);return!0}}}var f,g,h=[],j,k,m=[],o,p,t=[],y,u=[],A,F,J=[],B,U,C=[],V=new THREE.Vector4,O=new THREE.Vector4,M=new THREE.Matrix4,va=new THREE.Matrix4,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Vector4,fa=new THREE.Vector4;this.projectVector=function(ia,e){M.multiply(e.projectionMatrix,e.matrixWorldInverse);M.multiplyVector3(ia);return ia};this.unprojectVector=function(ia,e){M.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));
|
|
|
|
-M.multiplyVector3(ia);return ia};this.projectObjects=function(ia,e,oa){e=[];var Da,Aa,da;g=0;Aa=ia.objects;ia=0;for(Da=Aa.length;ia<Da;ia++){da=Aa[ia];var ea;if(!(ea=!da.visible))if(ea=da instanceof THREE.Mesh){a:{ea=void 0;for(var wa=da.matrixWorld,ta=-da.geometry.boundingSphere.radius*Math.max(da.scale.x,Math.max(da.scale.y,da.scale.z)),pa=0;pa<6;pa++){ea=la[pa].x*wa.n14+la[pa].y*wa.n24+la[pa].z*wa.n34+la[pa].w;if(ea<=ta){ea=!1;break a}}ea=!0}ea=!ea}if(!ea){ea=h[g]=h[g]||new THREE.RenderableObject;
|
|
|
|
-g++;f=ea;V.copy(da.position);M.multiplyVector3(V);f.object=da;f.z=V.z;e.push(f)}}oa&&e.sort(d);return e};this.projectScene=function(ia,e,oa){var Da=[],Aa=e.near,da=e.far,ea,wa,ta,pa,ca,ka,ma,Fa,ja,ga,Ja,Xa,Za,Ta,R,S,P;U=F=y=p=0;e.matrixAutoUpdate&&e.update(undefined,!0);ia.update(undefined,!1,e);M.multiply(e.projectionMatrix,e.matrixWorldInverse);la[0].set(M.n41-M.n11,M.n42-M.n12,M.n43-M.n13,M.n44-M.n14);la[1].set(M.n41+M.n11,M.n42+M.n12,M.n43+M.n13,M.n44+M.n14);la[2].set(M.n41+M.n21,M.n42+M.n22,
|
|
|
|
-M.n43+M.n23,M.n44+M.n24);la[3].set(M.n41-M.n21,M.n42-M.n22,M.n43-M.n23,M.n44-M.n24);la[4].set(M.n41-M.n31,M.n42-M.n32,M.n43-M.n33,M.n44-M.n34);la[5].set(M.n41+M.n31,M.n42+M.n32,M.n43+M.n33,M.n44+M.n34);for(ea=0;ea<6;ea++){ja=la[ea];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(ia,e,!0);ia=0;for(ea=ja.length;ia<ea;ia++){ga=ja[ia].object;if(ga.visible){Ja=ga.matrixWorld;Xa=ga.matrixRotationWorld;Za=ga.materials;Ta=ga.overdraw;k=0;if(ga instanceof THREE.Mesh){R=ga.geometry;
|
|
|
|
|
|
+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,p,t=[],y,u=[],A,F,J=[],B,U,C=[],V=new THREE.Vector4,O=new THREE.Vector4,M=new THREE.Matrix4,va=new THREE.Matrix4,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Vector4,ga=new THREE.Vector4;this.projectVector=function(ea,e){M.multiply(e.projectionMatrix,e.matrixWorldInverse);M.multiplyVector3(ea);return ea};this.unprojectVector=function(ea,e){M.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));
|
|
|
|
+M.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,ta=-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<=ta){fa=!1;break a}}fa=!0}fa=!fa}if(!fa){fa=h[g]=h[g]||new THREE.RenderableObject;
|
|
|
|
+g++;f=fa;V.copy(da.position);M.multiplyVector3(V);f.object=da;f.z=V.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,ta,pa,ca,ka,ma,Fa,ja,ha,Ja,Xa,Za,Ta,R,S,P;U=F=y=p=0;e.matrixAutoUpdate&&e.update(undefined,!0);ea.update(undefined,!1,e);M.multiply(e.projectionMatrix,e.matrixWorldInverse);la[0].set(M.n41-M.n11,M.n42-M.n12,M.n43-M.n13,M.n44-M.n14);la[1].set(M.n41+M.n11,M.n42+M.n12,M.n43+M.n13,M.n44+M.n14);la[2].set(M.n41+M.n21,M.n42+M.n22,
|
|
|
|
+M.n43+M.n23,M.n44+M.n24);la[3].set(M.n41-M.n21,M.n42-M.n22,M.n43-M.n23,M.n44-M.n24);la[4].set(M.n41-M.n31,M.n42-M.n32,M.n43-M.n33,M.n44-M.n34);la[5].set(M.n41+M.n31,M.n42+M.n32,M.n43+M.n33,M.n44+M.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){R=ha.geometry;
|
|
pa=R.vertices;S=R.faces;R=R.faceVertexUvs;wa=0;for(ta=pa.length;wa<ta;wa++){j=b();j.positionWorld.copy(pa[wa].position);Ja.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);M.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=S.length;pa<wa;pa++){ta=S[pa];if(ta instanceof THREE.Face3){ca=m[ta.a];ka=m[ta.b];ma=m[ta.c];if(ca.visible&&ka.visible&&ma.visible&&
|
|
pa=R.vertices;S=R.faces;R=R.faceVertexUvs;wa=0;for(ta=pa.length;wa<ta;wa++){j=b();j.positionWorld.copy(pa[wa].position);Ja.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);M.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=S.length;pa<wa;pa++){ta=S[pa];if(ta instanceof THREE.Face3){ca=m[ta.a];ka=m[ta.b];ma=m[ta.c];if(ca.visible&&ka.visible&&ma.visible&&
|
|
-(ga.doubleSided||ga.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=t[p]=t[p]||new THREE.RenderableFace3;p++;o=Fa;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma)}else continue}else if(ta instanceof THREE.Face4){ca=m[ta.a];ka=m[ta.b];ma=m[ta.c];Fa=m[ta.d];if(ca.visible&&ka.visible&&ma.visible&&Fa.visible&&(ga.doubleSided||ga.flipSided!=((Fa.positionScreen.x-ca.positionScreen.x)*
|
|
|
|
|
|
+(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=t[p]=t[p]||new THREE.RenderableFace3;p++;o=Fa;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma)}else continue}else if(ta instanceof THREE.Face4){ca=m[ta.a];ka=m[ta.b];ma=m[ta.c];Fa=m[ta.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))){P=u[y]=u[y]||new THREE.RenderableFace4;y++;o=P;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma);o.v4.copy(Fa)}else continue}o.normalWorld.copy(ta.normal);Xa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(ta.centroid);
|
|
(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))){P=u[y]=u[y]||new THREE.RenderableFace4;y++;o=P;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma);o.v4.copy(Fa)}else continue}o.normalWorld.copy(ta.normal);Xa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(ta.centroid);
|
|
-Ja.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);M.multiplyVector3(o.centroidScreen);ma=ta.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=R.length;ca<ka;ca++)if(P=R[ca][pa]){ma=0;for(Fa=P.length;ma<Fa;ma++)o.uvs[ca][ma]=P[ma]}o.meshMaterials=Za;o.faceMaterials=ta.materials;o.overdraw=Ta;o.z=o.centroidScreen.z;Da.push(o)}}else if(ga instanceof THREE.Line){va.multiply(M,Ja);pa=ga.geometry.vertices;
|
|
|
|
-ca=b();ca.positionScreen.copy(pa[0].position);va.multiplyVector4(ca.positionScreen);wa=1;for(ta=pa.length;wa<ta;wa++){ca=b();ca.positionScreen.copy(pa[wa].position);va.multiplyVector4(ca.positionScreen);ka=m[k-2];qa.copy(ca.positionScreen);fa.copy(ka.positionScreen);if(c(qa,fa)){qa.multiplyScalar(1/qa.w);fa.multiplyScalar(1/fa.w);Ja=J[F]=J[F]||new THREE.RenderableLine;F++;A=Ja;A.v1.positionScreen.copy(qa);A.v2.positionScreen.copy(fa);A.z=Math.max(qa.z,fa.z);A.materials=ga.materials;Da.push(A)}}}else if(ga instanceof
|
|
|
|
-THREE.Particle){O.set(ga.matrixWorld.n14,ga.matrixWorld.n24,ga.matrixWorld.n34,1);M.multiplyVector4(O);O.z/=O.w;if(O.z>0&&O.z<1){Ja=C[U]=C[U]||new THREE.RenderableParticle;U++;B=Ja;B.x=O.x/O.w;B.y=O.y/O.w;B.z=O.z;B.rotation=ga.rotation.z;B.scale.x=ga.scale.x*Math.abs(B.x-(O.x+e.projectionMatrix.n11)/(O.w+e.projectionMatrix.n14));B.scale.y=ga.scale.y*Math.abs(B.y-(O.y+e.projectionMatrix.n22)/(O.w+e.projectionMatrix.n24));B.materials=ga.materials;Da.push(B)}}}}oa&&Da.sort(d);return Da}};
|
|
|
|
|
|
+Ja.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);M.multiplyVector3(o.centroidScreen);ma=ta.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=R.length;ca<ka;ca++)if(P=R[ca][pa]){ma=0;for(Fa=P.length;ma<Fa;ma++)o.uvs[ca][ma]=P[ma]}o.meshMaterials=Za;o.faceMaterials=ta.materials;o.overdraw=Ta;o.z=o.centroidScreen.z;Da.push(o)}}else if(ha instanceof THREE.Line){va.multiply(M,Ja);pa=ha.geometry.vertices;
|
|
|
|
+ca=b();ca.positionScreen.copy(pa[0].position);va.multiplyVector4(ca.positionScreen);wa=1;for(ta=pa.length;wa<ta;wa++){ca=b();ca.positionScreen.copy(pa[wa].position);va.multiplyVector4(ca.positionScreen);ka=m[k-2];qa.copy(ca.positionScreen);ga.copy(ka.positionScreen);if(c(qa,ga)){qa.multiplyScalar(1/qa.w);ga.multiplyScalar(1/ga.w);Ja=J[F]=J[F]||new THREE.RenderableLine;F++;A=Ja;A.v1.positionScreen.copy(qa);A.v2.positionScreen.copy(ga);A.z=Math.max(qa.z,ga.z);A.materials=ha.materials;Da.push(A)}}}else if(ha instanceof
|
|
|
|
+THREE.Particle){O.set(ha.matrixWorld.n14,ha.matrixWorld.n24,ha.matrixWorld.n34,1);M.multiplyVector4(O);O.z/=O.w;if(O.z>0&&O.z<1){Ja=C[U]=C[U]||new THREE.RenderableParticle;U++;B=Ja;B.x=O.x/O.w;B.y=O.y/O.w;B.z=O.z;B.rotation=ha.rotation.z;B.scale.x=ha.scale.x*Math.abs(B.x-(O.x+e.projectionMatrix.n11)/(O.w+e.projectionMatrix.n14));B.scale.y=ha.scale.y*Math.abs(B.y-(O.y+e.projectionMatrix.n22)/(O.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,p,t,y,u,A,F;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;F=y.y*h+h;p=0;for(t=y.material.length;p<t;p++){u=y.material[p];if(u instanceof THREE.ParticleDOMMaterial){u=u.domElement;u.style.left=A+"px";u.style.top=F+"px"}}}}}};
|
|
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,p,t,y,u,A,F;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;F=y.y*h+h;p=0;for(t=y.material.length;p<t;p++){u=y.material[p];if(u instanceof THREE.ParticleDOMMaterial){u=u.domElement;u.style.left=A+"px";u.style.top=F+"px"}}}}}};
|
|
THREE.CanvasRenderer=function(){function b(Ga){if(A!=Ga)t.globalAlpha=A=Ga}function d(Ga){if(F!=Ga){switch(Ga){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}F=Ga}}function c(Ga){if(J!=Ga)t.strokeStyle=J=Ga}var f=this,g=null,h=new THREE.Projector,j=document.createElement("canvas"),k,m,o,p,t=j.getContext("2d"),y=new THREE.Color(0),u=0,A=
|
|
THREE.CanvasRenderer=function(){function b(Ga){if(A!=Ga)t.globalAlpha=A=Ga}function d(Ga){if(F!=Ga){switch(Ga){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}F=Ga}}function c(Ga){if(J!=Ga)t.strokeStyle=J=Ga}var f=this,g=null,h=new THREE.Projector,j=document.createElement("canvas"),k,m,o,p,t=j.getContext("2d"),y=new THREE.Color(0),u=0,A=
|
|
-1,F=0,J=null,B=null,U=null,C=null,V=null,O,M,va,la,qa=new THREE.RenderableVertex,fa=new THREE.RenderableVertex,ia,e,oa,Da,Aa,da,ea,wa,ta,pa,ca,ka,ma=new THREE.Color,Fa=new THREE.Color,ja=new THREE.Color,ga=new THREE.Color,Ja=new THREE.Color,Xa,Za,Ta,R,S,P,Ba,La,n,D,x=new THREE.Rectangle,v=new THREE.Rectangle,z=new THREE.Rectangle,Q=!1,K=new THREE.Color,G=new THREE.Color,T=new THREE.Color,H=new THREE.Color,I=new THREE.Vector3,L,Z,Y,ra,Ka,Ca,Ha=16;L=document.createElement("canvas");L.width=L.height=
|
|
|
|
|
|
+1,F=0,J=null,B=null,U=null,C=null,V=null,O,M,va,la,qa=new THREE.RenderableVertex,ga=new THREE.RenderableVertex,ea,e,oa,Da,Aa,da,fa,wa,ta,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,R,S,P,Ba,La,n,D,x=new THREE.Rectangle,v=new THREE.Rectangle,z=new THREE.Rectangle,Q=!1,K=new THREE.Color,G=new THREE.Color,T=new THREE.Color,H=new THREE.Color,I=new THREE.Vector3,L,Z,Y,ra,Ka,Ca,Ha=16;L=document.createElement("canvas");L.width=L.height=
|
|
2;Z=L.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Y=Z.getImageData(0,0,2,2);ra=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;p=m/2;j.width=k;j.height=m;x.set(-o,-p,o,p);A=1;F=0;V=C=U=B=J=null};this.setClearColor=function(Ga,xa){y=Ga;u=xa};
|
|
2;Z=L.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Y=Z.getImageData(0,0,2,2);ra=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;p=m/2;j.width=k;j.height=m;x.set(-o,-p,o,p);A=1;F=0;V=C=U=B=J=null};this.setClearColor=function(Ga,xa){y=Ga;u=xa};
|
|
-this.setClearColorHex=function(Ga,xa){y.setHex(Ga);u=xa};this.clear=function(){t.setTransform(1,0,0,-1,o,p);if(!v.isEmpty()){v.inflate(1);v.minSelf(x);if(y.hex==0&&u==0)t.clearRect(v.getX(),v.getY(),v.getWidth(),v.getHeight());else{d(THREE.NormalBlending);b(1);t.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+u+")";t.fillRect(v.getX(),v.getY(),v.getWidth(),v.getHeight())}v.empty()}};this.render=function(Ga,xa){function Ea(W){var na,ha,$,ua=W.lights;G.setRGB(0,
|
|
|
|
-0,0);T.setRGB(0,0,0);H.setRGB(0,0,0);W=0;for(na=ua.length;W<na;W++){ha=ua[W];$=ha.color;if(ha instanceof THREE.AmbientLight){G.r+=$.r;G.g+=$.g;G.b+=$.b}else if(ha instanceof THREE.DirectionalLight){T.r+=$.r;T.g+=$.g;T.b+=$.b}else if(ha instanceof THREE.PointLight){H.r+=$.r;H.g+=$.g;H.b+=$.b}}}function za(W,na,ha,$){var ua,sa,ya,X,Ia=W.lights;W=0;for(ua=Ia.length;W<ua;W++){sa=Ia[W];ya=sa.color;if(sa instanceof THREE.DirectionalLight){X=ha.dot(sa.position);if(!(X<=0)){X*=sa.intensity;$.r+=ya.r*X;$.g+=
|
|
|
|
-ya.g*X;$.b+=ya.b*X}}else if(sa instanceof THREE.PointLight){X=ha.dot(I.sub(sa.position,na).normalize());if(!(X<=0)){X*=sa.distance==0?1:1-Math.min(na.distanceTo(sa.position)/sa.distance,1);if(X!=0){X*=sa.intensity;$.r+=ya.r*X;$.g+=ya.g*X;$.b+=ya.b*X}}}}}function Ua(W,na,ha){b(ha.opacity);d(ha.blending);var $,ua,sa,ya,X,Ia;if(ha instanceof THREE.ParticleBasicMaterial){if(ha.map){ya=ha.map.image;X=ya.width>>1;Ia=ya.height>>1;ha=na.scale.x*o;sa=na.scale.y*p;$=ha*X;ua=sa*Ia;z.set(W.x-$,W.y-ua,W.x+$,W.y+
|
|
|
|
-ua);if(x.instersects(z)){t.save();t.translate(W.x,W.y);t.rotate(-na.rotation);t.scale(ha,-sa);t.translate(-X,-Ia);t.drawImage(ya,0,0);t.restore()}}}else if(ha instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;ua=na.scale.y*p;z.set(W.x-$,W.y-ua,W.x+$,W.y+ua);if(x.instersects(z)){c(ha.color.__styleString);sa=ha.color.__styleString;if(B!=sa)t.fillStyle=B=sa;t.save();t.translate(W.x,W.y);t.rotate(-na.rotation);t.scale($,ua);ha.program(t);t.restore()}}}function E(W,na,ha,$){b($.opacity);d($.blending);
|
|
|
|
-t.beginPath();t.moveTo(W.positionScreen.x,W.positionScreen.y);t.lineTo(na.positionScreen.x,na.positionScreen.y);t.closePath();if($ instanceof THREE.LineBasicMaterial){ma.__styleString=$.color.__styleString;W=$.linewidth;if(U!=W)t.lineWidth=U=W;W=$.linecap;if(C!=W)t.lineCap=C=W;W=$.linejoin;if(V!=W)t.lineJoin=V=W;c(ma.__styleString);t.stroke();z.inflate($.linewidth*2)}}function aa(W,na,ha,$,ua,sa,ya,X,Ia){f.data.vertices+=3;f.data.faces++;b(X.opacity);d(X.blending);ia=W.positionScreen.x;e=W.positionScreen.y;
|
|
|
|
-oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ha.positionScreen.x;da=ha.positionScreen.y;ab(ia,e,oa,Da,Aa,da);if(X instanceof THREE.MeshBasicMaterial)if(X.map){if(X.map.mapping instanceof THREE.UVMapping){R=ya.uvs[0];cb(ia,e,oa,Da,Aa,da,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].v)}}else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping){W=xa.matrixWorldInverse;I.copy(ya.vertexNormalsWorld[0]);S=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;P=-(I.x*W.n21+I.y*W.n22+
|
|
|
|
-I.z*W.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[1]);Ba=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;La=-(I.x*W.n21+I.y*W.n22+I.z*W.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[2]);n=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;D=-(I.x*W.n21+I.y*W.n22+I.z*W.n23)*0.5+0.5;cb(ia,e,oa,Da,Aa,da,X.envMap.image,S,P,Ba,La,n,D)}}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){R=ya.uvs[0];cb(ia,e,oa,Da,Aa,da,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].v)}d(THREE.SubtractiveBlending)}if(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==3){Fa.r=ja.r=ga.r=G.r;Fa.g=ja.g=ga.g=G.g;Fa.b=ja.b=ga.b=G.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],ga);Ja.r=(ja.r+ga.r)*0.5;Ja.g=(ja.g+ga.g)*0.5;Ja.b=(ja.b+ga.b)*
|
|
|
|
-0.5;Ta=hb(Fa,ja,ga,Ja);cb(ia,e,oa,Da,Aa,da,Ta,0,0,1,0,0,1)}else{K.r=G.r;K.g=G.g;K.b=G.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=
|
|
|
|
-xa.near;Za=xa.far;Fa.r=Fa.g=Fa.b=1-Wa(W.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ga.r=ga.g=ga.b=1-Wa(ha.positionScreen.z,Xa,Za);Ja.r=(ja.r+ga.r)*0.5;Ja.g=(ja.g+ga.g)*0.5;Ja.b=(ja.b+ga.b)*0.5;Ta=hb(Fa,ja,ga,Ja);cb(ia,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,ha,$,ua,sa,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(ua,ha,sa,1,2,3,ya,X,Ia)}else{ia=W.positionScreen.x;e=W.positionScreen.y;oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ha.positionScreen.x;da=ha.positionScreen.y;ea=$.positionScreen.x;wa=$.positionScreen.y;ta=ua.positionScreen.x;pa=ua.positionScreen.y;ca=sa.positionScreen.x;ka=sa.positionScreen.y;if(X instanceof THREE.MeshBasicMaterial){fb(ia,
|
|
|
|
-e,oa,Da,Aa,da,ea,wa);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshLambertMaterial)if(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==4){Fa.r=ja.r=ga.r=Ja.r=G.r;Fa.g=ja.g=ga.g=Ja.g=G.g;Fa.b=ja.b=ga.b=Ja.b=G.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],
|
|
|
|
-ga);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],Ja);Ta=hb(Fa,ja,ga,Ja);ab(ia,e,oa,Da,ea,wa);cb(ia,e,oa,Da,ea,wa,Ta,0,0,1,0,0,1);ab(ta,pa,Aa,da,ca,ka);cb(ta,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}else{K.r=G.r;K.g=G.g;K.b=G.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(ia,e,oa,Da,Aa,da,ea,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else{fb(ia,e,oa,
|
|
|
|
-Da,Aa,da,ea,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(ia,e,oa,Da,Aa,da,ea,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=xa.near;Za=xa.far;Fa.r=
|
|
|
|
-Fa.g=Fa.b=1-Wa(W.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ga.r=ga.g=ga.b=1-Wa($.positionScreen.z,Xa,Za);Ja.r=Ja.g=Ja.b=1-Wa(ha.positionScreen.z,Xa,Za);Ta=hb(Fa,ja,ga,Ja);ab(ia,e,oa,Da,ea,wa);cb(ia,e,oa,Da,ea,wa,Ta,0,0,1,0,0,1);ab(ta,pa,Aa,da,ca,ka);cb(ta,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}}}function ab(W,na,ha,$,ua,sa){t.beginPath();t.moveTo(W,na);t.lineTo(ha,$);t.lineTo(ua,sa);t.lineTo(W,na);t.closePath()}function fb(W,na,ha,$,ua,sa,ya,X){t.beginPath();t.moveTo(W,na);t.lineTo(ha,
|
|
|
|
-$);t.lineTo(ua,sa);t.lineTo(ya,X);t.lineTo(W,na);t.closePath()}function Oa(W,na,ha,$){if(U!=na)t.lineWidth=U=na;if(C!=ha)t.lineCap=C=ha;if(V!=$)t.lineJoin=V=$;c(W);t.stroke();z.inflate(na*2)}function Qa(W){if(B!=W)t.fillStyle=B=W;t.fill()}function cb(W,na,ha,$,ua,sa,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;ha-=W;$-=na;ua-=W;sa-=na;Ya-=X;eb-=Ia;Sa-=X;kb-=Ia;gb=Ya*kb-Sa*eb;if(gb!=0){db=1/gb;gb=(kb*ha-eb*ua)*db;eb=(kb*$-eb*sa)*db;ha=(Ya*ua-
|
|
|
|
-Sa*ha)*db;$=(Ya*sa-Sa*$)*db;W=W-gb*X-ha*Ia;na=na-eb*X-$*Ia;t.save();t.transform(gb,eb,ha,$,W,na);t.clip();t.drawImage(ya,0,0);t.restore()}}function hb(W,na,ha,$){var ua=~~(W.r*255),sa=~~(W.g*255);W=~~(W.b*255);var ya=~~(na.r*255),X=~~(na.g*255);na=~~(na.b*255);var Ia=~~(ha.r*255),Ya=~~(ha.g*255);ha=~~(ha.b*255);var eb=~~($.r*255),Sa=~~($.g*255);$=~~($.b*255);ra[0]=ua<0?0:ua>255?255:ua;ra[1]=sa<0?0:sa>255?255:sa;ra[2]=W<0?0:W>255?255:W;ra[4]=ya<0?0:ya>255?255:ya;ra[5]=X<0?0:X>255?255:X;ra[6]=na<0?
|
|
|
|
-0:na>255?255:na;ra[8]=Ia<0?0:Ia>255?255:Ia;ra[9]=Ya<0?0:Ya>255?255:Ya;ra[10]=ha<0?0:ha>255?255:ha;ra[12]=eb<0?0:eb>255?255:eb;ra[13]=Sa<0?0:Sa>255?255:Sa;ra[14]=$<0?0:$>255?255:$;Z.putImageData(Y,0,0);Ca.drawImage(L,0,0);return Ka}function Wa(W,na,ha){W=(W-na)/(ha-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 ha=na.x-W.x,$=na.y-W.y,ua=1/Math.sqrt(ha*ha+$*$);ha*=ua;$*=ua;na.x+=ha;na.y+=$;W.x-=ha;W.y-=$}var bb,Va,N,Na,Ra,ib,jb,Pa;this.autoClear?this.clear():
|
|
|
|
|
|
+this.setClearColorHex=function(Ga,xa){y.setHex(Ga);u=xa};this.clear=function(){t.setTransform(1,0,0,-1,o,p);if(!v.isEmpty()){v.inflate(1);v.minSelf(x);if(y.hex==0&&u==0)t.clearRect(v.getX(),v.getY(),v.getWidth(),v.getHeight());else{d(THREE.NormalBlending);b(1);t.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+u+")";t.fillRect(v.getX(),v.getY(),v.getWidth(),v.getHeight())}v.empty()}};this.render=function(Ga,xa){function Ea(W){var na,ia,$,ua=W.lights;G.setRGB(0,
|
|
|
|
+0,0);T.setRGB(0,0,0);H.setRGB(0,0,0);W=0;for(na=ua.length;W<na;W++){ia=ua[W];$=ia.color;if(ia instanceof THREE.AmbientLight){G.r+=$.r;G.g+=$.g;G.b+=$.b}else if(ia instanceof THREE.DirectionalLight){T.r+=$.r;T.g+=$.g;T.b+=$.b}else if(ia instanceof THREE.PointLight){H.r+=$.r;H.g+=$.g;H.b+=$.b}}}function za(W,na,ia,$){var ua,sa,ya,X,Ia=W.lights;W=0;for(ua=Ia.length;W<ua;W++){sa=Ia[W];ya=sa.color;if(sa instanceof THREE.DirectionalLight){X=ia.dot(sa.position);if(!(X<=0)){X*=sa.intensity;$.r+=ya.r*X;$.g+=
|
|
|
|
+ya.g*X;$.b+=ya.b*X}}else if(sa instanceof THREE.PointLight){X=ia.dot(I.sub(sa.position,na).normalize());if(!(X<=0)){X*=sa.distance==0?1:1-Math.min(na.distanceTo(sa.position)/sa.distance,1);if(X!=0){X*=sa.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 $,ua,sa,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;sa=na.scale.y*p;$=ia*X;ua=sa*Ia;z.set(W.x-$,W.y-ua,W.x+$,W.y+
|
|
|
|
+ua);if(x.instersects(z)){t.save();t.translate(W.x,W.y);t.rotate(-na.rotation);t.scale(ia,-sa);t.translate(-X,-Ia);t.drawImage(ya,0,0);t.restore()}}}else if(ia instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;ua=na.scale.y*p;z.set(W.x-$,W.y-ua,W.x+$,W.y+ua);if(x.instersects(z)){c(ia.color.__styleString);sa=ia.color.__styleString;if(B!=sa)t.fillStyle=B=sa;t.save();t.translate(W.x,W.y);t.rotate(-na.rotation);t.scale($,ua);ia.program(t);t.restore()}}}function E(W,na,ia,$){b($.opacity);d($.blending);
|
|
|
|
+t.beginPath();t.moveTo(W.positionScreen.x,W.positionScreen.y);t.lineTo(na.positionScreen.x,na.positionScreen.y);t.closePath();if($ instanceof THREE.LineBasicMaterial){ma.__styleString=$.color.__styleString;W=$.linewidth;if(U!=W)t.lineWidth=U=W;W=$.linecap;if(C!=W)t.lineCap=C=W;W=$.linejoin;if(V!=W)t.lineJoin=V=W;c(ma.__styleString);t.stroke();z.inflate($.linewidth*2)}}function aa(W,na,ia,$,ua,sa,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){R=ya.uvs[0];cb(ea,e,oa,Da,Aa,da,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].v)}}else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping){W=xa.matrixWorldInverse;I.copy(ya.vertexNormalsWorld[0]);S=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;P=-(I.x*W.n21+I.y*W.n22+
|
|
|
|
+I.z*W.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[1]);Ba=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;La=-(I.x*W.n21+I.y*W.n22+I.z*W.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[2]);n=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;D=-(I.x*W.n21+I.y*W.n22+I.z*W.n23)*0.5+0.5;cb(ea,e,oa,Da,Aa,da,X.envMap.image,S,P,Ba,La,n,D)}}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){R=ya.uvs[0];cb(ea,e,oa,Da,Aa,da,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].v)}d(THREE.SubtractiveBlending)}if(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==3){Fa.r=ja.r=ha.r=G.r;Fa.g=ja.g=ha.g=G.g;Fa.b=ja.b=ha.b=G.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=G.r;K.g=G.g;K.b=G.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=
|
|
|
|
+xa.near;Za=xa.far;Fa.r=Fa.g=Fa.b=1-Wa(W.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ha.r=ha.g=ha.b=1-Wa(ia.positionScreen.z,Xa,Za);Ja.r=(ja.r+ha.r)*0.5;Ja.g=(ja.g+ha.g)*0.5;Ja.b=(ja.b+ha.b)*0.5;Ta=hb(Fa,ja,ha,Ja);cb(ea,e,oa,Da,Aa,da,Ta,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):
|
|
|
|
+Qa(ma.__styleString)}}function w(W,na,ia,$,ua,sa,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(ua,ia,sa,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;ta=ua.positionScreen.x;pa=ua.positionScreen.y;ca=sa.positionScreen.x;ka=sa.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(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==4){Fa.r=ja.r=ha.r=Ja.r=G.r;Fa.g=ja.g=ha.g=Ja.g=G.g;Fa.b=ja.b=ha.b=Ja.b=G.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(ta,pa,Aa,da,ca,ka);cb(ta,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}else{K.r=G.r;K.g=G.g;K.b=G.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();fb(ea,e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else{fb(ea,e,oa,
|
|
|
|
+Da,Aa,da,fa,wa);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();fb(ea,e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=xa.near;Za=xa.far;Fa.r=
|
|
|
|
+Fa.g=Fa.b=1-Wa(W.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ha.r=ha.g=ha.b=1-Wa($.positionScreen.z,Xa,Za);Ja.r=Ja.g=Ja.b=1-Wa(ia.positionScreen.z,Xa,Za);Ta=hb(Fa,ja,ha,Ja);ab(ea,e,oa,Da,fa,wa);cb(ea,e,oa,Da,fa,wa,Ta,0,0,1,0,0,1);ab(ta,pa,Aa,da,ca,ka);cb(ta,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}}}function ab(W,na,ia,$,ua,sa){t.beginPath();t.moveTo(W,na);t.lineTo(ia,$);t.lineTo(ua,sa);t.lineTo(W,na);t.closePath()}function fb(W,na,ia,$,ua,sa,ya,X){t.beginPath();t.moveTo(W,na);t.lineTo(ia,
|
|
|
|
+$);t.lineTo(ua,sa);t.lineTo(ya,X);t.lineTo(W,na);t.closePath()}function Oa(W,na,ia,$){if(U!=na)t.lineWidth=U=na;if(C!=ia)t.lineCap=C=ia;if(V!=$)t.lineJoin=V=$;c(W);t.stroke();z.inflate(na*2)}function Qa(W){if(B!=W)t.fillStyle=B=W;t.fill()}function cb(W,na,ia,$,ua,sa,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;ua-=W;sa-=na;Ya-=X;eb-=Ia;Sa-=X;kb-=Ia;gb=Ya*kb-Sa*eb;if(gb!=0){db=1/gb;gb=(kb*ia-eb*ua)*db;eb=(kb*$-eb*sa)*db;ia=(Ya*ua-
|
|
|
|
+Sa*ia)*db;$=(Ya*sa-Sa*$)*db;W=W-gb*X-ia*Ia;na=na-eb*X-$*Ia;t.save();t.transform(gb,eb,ia,$,W,na);t.clip();t.drawImage(ya,0,0);t.restore()}}function hb(W,na,ia,$){var ua=~~(W.r*255),sa=~~(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);ra[0]=ua<0?0:ua>255?255:ua;ra[1]=sa<0?0:sa>255?255:sa;ra[2]=W<0?0:W>255?255:W;ra[4]=ya<0?0:ya>255?255:ya;ra[5]=X<0?0:X>255?255:X;ra[6]=na<0?
|
|
|
|
+0:na>255?255:na;ra[8]=Ia<0?0:Ia>255?255:Ia;ra[9]=Ya<0?0:Ya>255?255:Ya;ra[10]=ia<0?0:ia>255?255:ia;ra[12]=eb<0?0:eb>255?255:eb;ra[13]=Sa<0?0:Sa>255?255:Sa;ra[14]=$<0?0:$>255?255:$;Z.putImageData(Y,0,0);Ca.drawImage(L,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,ua=1/Math.sqrt(ia*ia+$*$);ia*=ua;$*=ua;na.x+=ia;na.y+=$;W.x-=ia;W.y-=$}var bb,Va,N,Na,Ra,ib,jb,Pa;this.autoClear?this.clear():
|
|
t.setTransform(1,0,0,-1,o,p);f.data.vertices=0;f.data.faces=0;g=h.projectScene(Ga,xa,this.sortElements);(Q=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){O=N;O.x*=o;O.y*=p;Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&Ua(O,N,Pa,Ga)}}else if(N instanceof THREE.RenderableLine){O=N.v1;M=N.v2;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;z.addPoint(O.positionScreen.x,
|
|
t.setTransform(1,0,0,-1,o,p);f.data.vertices=0;f.data.faces=0;g=h.projectScene(Ga,xa,this.sortElements);(Q=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){O=N;O.x*=o;O.y*=p;Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&Ua(O,N,Pa,Ga)}}else if(N instanceof THREE.RenderableLine){O=N.v1;M=N.v2;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;z.addPoint(O.positionScreen.x,
|
|
O.positionScreen.y);z.addPoint(M.positionScreen.x,M.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&E(O,M,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace3){O=N.v1;M=N.v2;va=N.v3;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,va.positionScreen);Ma(va.positionScreen,O.positionScreen)}z.add3Points(O.positionScreen.x,
|
|
O.positionScreen.y);z.addPoint(M.positionScreen.x,M.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&E(O,M,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace3){O=N.v1;M=N.v2;va=N.v3;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,va.positionScreen);Ma(va.positionScreen,O.positionScreen)}z.add3Points(O.positionScreen.x,
|
|
O.positionScreen.y,M.positionScreen.x,M.positionScreen.y,va.positionScreen.x,va.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(O,M,va,0,1,2,N,Pa,Ga)}else Pa.opacity!=0&&aa(O,M,va,0,1,2,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace4){O=N.v1;M=N.v2;va=N.v3;la=N.v4;O.positionScreen.x*=o;O.positionScreen.y*=
|
|
O.positionScreen.y,M.positionScreen.x,M.positionScreen.y,va.positionScreen.x,va.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(O,M,va,0,1,2,N,Pa,Ga)}else Pa.opacity!=0&&aa(O,M,va,0,1,2,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace4){O=N.v1;M=N.v2;va=N.v3;la=N.v4;O.positionScreen.x*=o;O.positionScreen.y*=
|
|
-p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;la.positionScreen.x*=o;la.positionScreen.y*=p;qa.positionScreen.copy(M.positionScreen);fa.positionScreen.copy(la.positionScreen);if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,la.positionScreen);Ma(la.positionScreen,O.positionScreen);Ma(va.positionScreen,qa.positionScreen);Ma(va.positionScreen,fa.positionScreen)}z.addPoint(O.positionScreen.x,O.positionScreen.y);z.addPoint(M.positionScreen.x,
|
|
|
|
-M.positionScreen.y);z.addPoint(va.positionScreen.x,va.positionScreen.y);z.addPoint(la.positionScreen.x,la.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&w(O,M,va,la,qa,fa,N,Pa,Ga)}else Pa.opacity!=0&&w(O,M,va,la,qa,fa,N,Pa,Ga)}}}v.addRectangle(z)}t.setTransform(1,0,0,1,0,0)}};
|
|
|
|
-THREE.SVGRenderer=function(){function b(ea,wa,ta){var pa,ca,ka,ma;pa=0;for(ca=ea.lights.length;pa<ca;pa++){ka=ea.lights[pa];if(ka instanceof THREE.DirectionalLight){ma=wa.normalWorld.dot(ka.position)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}else if(ka instanceof THREE.PointLight){fa.sub(ka.position,wa.centroidWorld);fa.normalize();ma=wa.normalWorld.dot(fa)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}}}function d(ea,wa,
|
|
|
|
-ta,pa,ca,ka){h.data.vertices+=3;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(ca instanceof THREE.MeshBasicMaterial)V.__styleString=ca.color.__styleString;else if(ca instanceof THREE.MeshLambertMaterial)if(C){O.r=M.r;O.g=M.g;O.b=M.b;b(ka,pa,O);V.r=ca.color.r*O.r;V.g=ca.color.g*O.g;V.b=ca.color.b*O.b;V.updateStyleString()}else V.__styleString=
|
|
|
|
|
|
+p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;la.positionScreen.x*=o;la.positionScreen.y*=p;qa.positionScreen.copy(M.positionScreen);ga.positionScreen.copy(la.positionScreen);if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,la.positionScreen);Ma(la.positionScreen,O.positionScreen);Ma(va.positionScreen,qa.positionScreen);Ma(va.positionScreen,ga.positionScreen)}z.addPoint(O.positionScreen.x,O.positionScreen.y);z.addPoint(M.positionScreen.x,
|
|
|
|
+M.positionScreen.y);z.addPoint(va.positionScreen.x,va.positionScreen.y);z.addPoint(la.positionScreen.x,la.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&w(O,M,va,la,qa,ga,N,Pa,Ga)}else Pa.opacity!=0&&w(O,M,va,la,qa,ga,N,Pa,Ga)}}}v.addRectangle(z)}t.setTransform(1,0,0,1,0,0)}};
|
|
|
|
+THREE.SVGRenderer=function(){function b(fa,wa,ta){var pa,ca,ka,ma;pa=0;for(ca=fa.lights.length;pa<ca;pa++){ka=fa.lights[pa];if(ka instanceof THREE.DirectionalLight){ma=wa.normalWorld.dot(ka.position)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}else if(ka instanceof THREE.PointLight){ga.sub(ka.position,wa.centroidWorld);ga.normalize();ma=wa.normalWorld.dot(ga)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}}}function d(fa,wa,
|
|
|
|
+ta,pa,ca,ka){h.data.vertices+=3;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(ca instanceof THREE.MeshBasicMaterial)V.__styleString=ca.color.__styleString;else if(ca instanceof THREE.MeshLambertMaterial)if(C){O.r=M.r;O.g=M.g;O.b=M.b;b(ka,pa,O);V.r=ca.color.r*O.r;V.g=ca.color.g*O.g;V.b=ca.color.b*O.b;V.updateStyleString()}else V.__styleString=
|
|
ca.color.__styleString;else if(ca instanceof THREE.MeshDepthMaterial){qa=1-ca.__2near/(ca.__farPlusNear-pa.z*ca.__farMinusNear);V.setRGB(qa,qa,qa)}else ca instanceof THREE.MeshNormalMaterial&&V.setRGB(g(pa.normalWorld.x),g(pa.normalWorld.y),g(pa.normalWorld.z));ca.wireframe?oa.setAttribute("style","fill: none; stroke: "+V.__styleString+"; stroke-width: "+ca.wireframeLinewidth+"; stroke-opacity: "+ca.opacity+"; stroke-linecap: "+ca.wireframeLinecap+"; stroke-linejoin: "+ca.wireframeLinejoin):oa.setAttribute("style",
|
|
ca.color.__styleString;else if(ca instanceof THREE.MeshDepthMaterial){qa=1-ca.__2near/(ca.__farPlusNear-pa.z*ca.__farMinusNear);V.setRGB(qa,qa,qa)}else ca instanceof THREE.MeshNormalMaterial&&V.setRGB(g(pa.normalWorld.x),g(pa.normalWorld.y),g(pa.normalWorld.z));ca.wireframe?oa.setAttribute("style","fill: none; stroke: "+V.__styleString+"; stroke-width: "+ca.wireframeLinewidth+"; stroke-opacity: "+ca.opacity+"; stroke-linecap: "+ca.wireframeLinecap+"; stroke-linejoin: "+ca.wireframeLinejoin):oa.setAttribute("style",
|
|
-"fill: "+V.__styleString+"; fill-opacity: "+ca.opacity);m.appendChild(oa)}function c(ea,wa,ta,pa,ca,ka,ma){h.data.vertices+=4;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)V.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(C){O.r=
|
|
|
|
|
|
+"fill: "+V.__styleString+"; fill-opacity: "+ca.opacity);m.appendChild(oa)}function c(fa,wa,ta,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 "+ta.positionScreen.x+","+ta.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)V.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(C){O.r=
|
|
M.r;O.g=M.g;O.b=M.b;b(ma,ca,O);V.r=ka.color.r*O.r;V.g=ka.color.g*O.g;V.b=ka.color.b*O.b;V.updateStyleString()}else V.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshDepthMaterial){qa=1-ka.__2near/(ka.__farPlusNear-ca.z*ka.__farMinusNear);V.setRGB(qa,qa,qa)}else ka instanceof THREE.MeshNormalMaterial&&V.setRGB(g(ca.normalWorld.x),g(ca.normalWorld.y),g(ca.normalWorld.z));ka.wireframe?oa.setAttribute("style","fill: none; stroke: "+V.__styleString+"; stroke-width: "+ka.wireframeLinewidth+
|
|
M.r;O.g=M.g;O.b=M.b;b(ma,ca,O);V.r=ka.color.r*O.r;V.g=ka.color.g*O.g;V.b=ka.color.b*O.b;V.updateStyleString()}else V.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshDepthMaterial){qa=1-ka.__2near/(ka.__farPlusNear-ca.z*ka.__farMinusNear);V.setRGB(qa,qa,qa)}else ka instanceof THREE.MeshNormalMaterial&&V.setRGB(g(ca.normalWorld.x),g(ca.normalWorld.y),g(ca.normalWorld.z));ka.wireframe?oa.setAttribute("style","fill: none; stroke: "+V.__styleString+"; stroke-width: "+ka.wireframeLinewidth+
|
|
-"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):oa.setAttribute("style","fill: "+V.__styleString+"; fill-opacity: "+ka.opacity);m.appendChild(oa)}function f(ea){if(ia[ea]==null){ia[ea]=document.createElementNS("http://www.w3.org/2000/svg","path");da==0&&ia[ea].setAttribute("shape-rendering","crispEdges")}return ia[ea]}function g(ea){return ea<0?Math.min((1+ea)*0.5,0.5):0.5+Math.min(ea*0.5,0.5)}var h=this,j=null,k=new THREE.Projector,
|
|
|
|
-m=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,t,y,u,A,F,J,B=new THREE.Rectangle,U=new THREE.Rectangle,C=!1,V=new THREE.Color(16777215),O=new THREE.Color(16777215),M=new THREE.Color(0),va=new THREE.Color(0),la=new THREE.Color(0),qa,fa=new THREE.Vector3,ia=[],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(ea){switch(ea){case "high":da=1;break;case "low":da=0}};this.setSize=function(ea,
|
|
|
|
-wa){o=ea;p=wa;t=o/2;y=p/2;m.setAttribute("viewBox",-t+" "+-y+" "+o+" "+p);m.setAttribute("width",o);m.setAttribute("height",p);B.set(-t,-y,t,y)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(ea,wa){var ta,pa,ca,ka,ma,Fa,ja,ga;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;j=k.projectScene(ea,wa,this.sortElements);Aa=Da=0;if(C=ea.lights.length>0){ja=ea.lights;M.setRGB(0,0,0);va.setRGB(0,0,0);la.setRGB(0,0,0);ta=0;for(pa=ja.length;ta<
|
|
|
|
|
|
+"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):oa.setAttribute("style","fill: "+V.__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,p,t,y,u,A,F,J,B=new THREE.Rectangle,U=new THREE.Rectangle,C=!1,V=new THREE.Color(16777215),O=new THREE.Color(16777215),M=new THREE.Color(0),va=new THREE.Color(0),la=new THREE.Color(0),qa,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;p=wa;t=o/2;y=p/2;m.setAttribute("viewBox",-t+" "+-y+" "+o+" "+p);m.setAttribute("width",o);m.setAttribute("height",p);B.set(-t,-y,t,y)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(fa,wa){var ta,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(C=fa.lights.length>0){ja=fa.lights;M.setRGB(0,0,0);va.setRGB(0,0,0);la.setRGB(0,0,0);ta=0;for(pa=ja.length;ta<
|
|
pa;ta++){ca=ja[ta];ka=ca.color;if(ca instanceof THREE.AmbientLight){M.r+=ka.r;M.g+=ka.g;M.b+=ka.b}else if(ca instanceof THREE.DirectionalLight){va.r+=ka.r;va.g+=ka.g;va.b+=ka.b}else if(ca instanceof THREE.PointLight){la.r+=ka.r;la.g+=ka.g;la.b+=ka.b}}}ta=0;for(pa=j.length;ta<pa;ta++){ja=j[ta];U.empty();if(ja instanceof THREE.RenderableParticle){u=ja;u.x*=t;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*=t;u.positionScreen.y*=
|
|
pa;ta++){ca=ja[ta];ka=ca.color;if(ca instanceof THREE.AmbientLight){M.r+=ka.r;M.g+=ka.g;M.b+=ka.b}else if(ca instanceof THREE.DirectionalLight){va.r+=ka.r;va.g+=ka.g;va.b+=ka.b}else if(ca instanceof THREE.PointLight){la.r+=ka.r;la.g+=ka.g;la.b+=ka.b}}}ta=0;for(pa=j.length;ta<pa;ta++){ja=j[ta];U.empty();if(ja instanceof THREE.RenderableParticle){u=ja;u.x*=t;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*=t;u.positionScreen.y*=
|
|
--y;A.positionScreen.x*=t;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((ga=ja.materials[ca++])&&ga.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(ga instanceof THREE.LineBasicMaterial){V.__styleString=ga.color.__styleString;oa.setAttribute("style","fill: none; stroke: "+V.__styleString+"; stroke-width: "+ga.linewidth+"; stroke-opacity: "+ga.opacity+"; stroke-linecap: "+ga.linecap+"; stroke-linejoin: "+ga.linejoin);m.appendChild(oa)}}}}else if(ja instanceof THREE.RenderableFace3){u=ja.v1;A=ja.v2;F=ja.v3;u.positionScreen.x*=t;u.positionScreen.y*=-y;A.positionScreen.x*=
|
|
|
|
-t;A.positionScreen.y*=-y;F.positionScreen.x*=t;F.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);U.addPoint(F.positionScreen.x,F.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ga=ja.meshMaterials[ca++];if(ga instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(ga=ja.faceMaterials[ma++])&&ga.opacity!=0&&d(u,A,F,ja,ga,ea)}else ga&&ga.opacity!=0&&d(u,A,F,ja,ga,ea)}}}else if(ja instanceof
|
|
|
|
-THREE.RenderableFace4){u=ja.v1;A=ja.v2;F=ja.v3;J=ja.v4;u.positionScreen.x*=t;u.positionScreen.y*=-y;A.positionScreen.x*=t;A.positionScreen.y*=-y;F.positionScreen.x*=t;F.positionScreen.y*=-y;J.positionScreen.x*=t;J.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);U.addPoint(F.positionScreen.x,F.positionScreen.y);U.addPoint(J.positionScreen.x,J.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ga=
|
|
|
|
-ja.meshMaterials[ca++];if(ga instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(ga=ja.faceMaterials[ma++])&&ga.opacity!=0&&c(u,A,F,J,ja,ga,ea)}else ga&&ga.opacity!=0&&c(u,A,F,J,ja,ga,ea)}}}}}};
|
|
|
|
|
|
+-y;A.positionScreen.x*=t;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){V.__styleString=ha.color.__styleString;oa.setAttribute("style","fill: none; stroke: "+V.__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;F=ja.v3;u.positionScreen.x*=t;u.positionScreen.y*=-y;A.positionScreen.x*=
|
|
|
|
+t;A.positionScreen.y*=-y;F.positionScreen.x*=t;F.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);U.addPoint(F.positionScreen.x,F.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,F,ja,ha,fa)}else ha&&ha.opacity!=0&&d(u,A,F,ja,ha,fa)}}}else if(ja instanceof
|
|
|
|
+THREE.RenderableFace4){u=ja.v1;A=ja.v2;F=ja.v3;J=ja.v4;u.positionScreen.x*=t;u.positionScreen.y*=-y;A.positionScreen.x*=t;A.positionScreen.y*=-y;F.positionScreen.x*=t;F.positionScreen.y*=-y;J.positionScreen.x*=t;J.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);U.addPoint(F.positionScreen.x,F.positionScreen.y);U.addPoint(J.positionScreen.x,J.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,F,J,ja,ha,fa)}else ha&&ha.opacity!=0&&c(u,A,F,J,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",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
|
|
@@ -220,7 +220,7 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
|
|
THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
THREE.WebGLRenderer=function(b){function d(n,D,x){var v,z,Q,K=n.vertices,G=K.length,T=n.colors,H=T.length,I=n.__vertexArray,L=n.__colorArray,Z=n.__sortArray,Y=n.__dirtyVertices,ra=n.__dirtyColors;if(x.sortParticles){Ja.multiplySelf(x.matrixWorld);for(v=0;v<G;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<G;v++){z=K[Z[v][1]].position;Q=v*3;I[Q]=z.x;I[Q+1]=z.y;I[Q+2]=z.z}for(v=0;v<H;v++){Q=v*3;color=T[Z[v][1]];L[Q]=color.r;
|
|
THREE.WebGLRenderer=function(b){function d(n,D,x){var v,z,Q,K=n.vertices,G=K.length,T=n.colors,H=T.length,I=n.__vertexArray,L=n.__colorArray,Z=n.__sortArray,Y=n.__dirtyVertices,ra=n.__dirtyColors;if(x.sortParticles){Ja.multiplySelf(x.matrixWorld);for(v=0;v<G;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<G;v++){z=K[Z[v][1]].position;Q=v*3;I[Q]=z.x;I[Q+1]=z.y;I[Q+2]=z.z}for(v=0;v<H;v++){Q=v*3;color=T[Z[v][1]];L[Q]=color.r;
|
|
-L[Q+1]=color.g;L[Q+2]=color.b}}else{if(Y)for(v=0;v<G;v++){z=K[v].position;Q=v*3;I[Q]=z.x;I[Q+1]=z.y;I[Q+2]=z.z}if(ra)for(v=0;v<H;v++){color=T[v];Q=v*3;L[Q]=color.r;L[Q+1]=color.g;L[Q+2]=color.b}}if(Y||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,D)}if(ra||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,D)}}function c(n,D,x,v,z){v.program||ia.initMaterial(v,D,x,z);var Q=v.program,K=Q.uniforms,G=v.uniforms;
|
|
|
|
|
|
+L[Q+1]=color.g;L[Q+2]=color.b}}else{if(Y)for(v=0;v<G;v++){z=K[v].position;Q=v*3;I[Q]=z.x;I[Q+1]=z.y;I[Q+2]=z.z}if(ra)for(v=0;v<H;v++){color=T[v];Q=v*3;L[Q]=color.r;L[Q+1]=color.g;L[Q+2]=color.b}}if(Y||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,D)}if(ra||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,D)}}function c(n,D,x,v,z){v.program||ea.initMaterial(v,D,x,z);var Q=v.program,K=Q.uniforms,G=v.uniforms;
|
|
if(Q!=Aa){e.useProgram(Q);Aa=Q}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)){G.fogColor.value=x.color;if(x instanceof THREE.Fog){G.fogNear.value=x.near;G.fogFar.value=x.far}else if(x instanceof THREE.FogExp2)G.fogDensity.value=x.density}if(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||
|
|
if(Q!=Aa){e.useProgram(Q);Aa=Q}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)){G.fogColor.value=x.color;if(x instanceof THREE.Fog){G.fogNear.value=x.near;G.fogFar.value=x.far}else if(x instanceof THREE.FogExp2)G.fogDensity.value=x.density}if(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||
|
|
v.lights){var T,H,I=0,L=0,Z=0,Y,ra,Ka,Ca,Ha=R,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=H=Ca=0;for(T=D.length;x<T;x++){H=D[x];Y=H.color;ra=H.position;Ka=H.intensity;Ca=H.distance;if(H instanceof THREE.AmbientLight){I+=Y.r;L+=Y.g;Z+=Y.b}else if(H 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]=ra.x;xa[Ca+1]=ra.y;xa[Ca+2]=ra.z;E+=1}else if(H instanceof THREE.PointLight){H=
|
|
v.lights){var T,H,I=0,L=0,Z=0,Y,ra,Ka,Ca,Ha=R,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=H=Ca=0;for(T=D.length;x<T;x++){H=D[x];Y=H.color;ra=H.position;Ka=H.intensity;Ca=H.distance;if(H instanceof THREE.AmbientLight){I+=Y.r;L+=Y.g;Z+=Y.b}else if(H 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]=ra.x;xa[Ca+1]=ra.y;xa[Ca+2]=ra.z;E+=1}else if(H instanceof THREE.PointLight){H=
|
|
aa*3;Ea[H]=Y.r*Ka;Ea[H+1]=Y.g*Ka;Ea[H+2]=Y.b*Ka;za[H]=ra.x;za[H+1]=ra.y;za[H+2]=ra.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]=I;Ha.ambient[1]=L;Ha.ambient[2]=Z;x=R;G.enableLighting.value=x.directional.length+x.point.length;G.ambientLightColor.value=x.ambient;G.directionalLightColor.value=x.directional.colors;G.directionalLightDirection.value=x.directional.positions;G.pointLightColor.value=x.point.colors;
|
|
aa*3;Ea[H]=Y.r*Ka;Ea[H+1]=Y.g*Ka;Ea[H+2]=Y.b*Ka;za[H]=ra.x;za[H+1]=ra.y;za[H+2]=ra.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]=I;Ha.ambient[1]=L;Ha.ambient[2]=Z;x=R;G.enableLighting.value=x.directional.length+x.point.length;G.ambientLightColor.value=x.ambient;G.directionalLightColor.value=x.directional.colors;G.directionalLightDirection.value=x.directional.positions;G.pointLightColor.value=x.point.colors;
|
|
@@ -236,65 +236,65 @@ e.vertexAttribPointer(D.position,3,e.FLOAT,!1,0,0)}else if(D.position>=0){e.bind
|
|
0){D=v.attributes[K];e.bindBuffer(e.ARRAY_BUFFER,D.buffer);e.vertexAttribPointer(n[K],D.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,
|
|
0){D=v.attributes[K];e.bindBuffer(e.ARRAY_BUFFER,D.buffer);e.vertexAttribPointer(n[K],D.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,
|
|
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(Q instanceof THREE.Mesh){if(v.wireframe){e.lineWidth(v.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglLineBuffer);e.drawElements(e.LINES,
|
|
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(Q 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)}ia.data.vertices+=z.__webglFaceCount;ia.data.faces+=z.__webglFaceCount/3}else if(Q instanceof THREE.Line){Q=Q.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(Q,0,z.__webglLineCount)}else if(Q instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,z.__webglParticleCount);else Q instanceof THREE.Ribbon&&
|
|
|
|
-e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount)}}function g(n,D,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(D.attributes.position);e.vertexAttribPointer(D.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,Q,K,G,T,H,I,L,Z,Y=n.count*3;for(Z=0;Z<Y;Z+=9){x=n.normalArray;v=x[Z];z=x[Z+1];Q=x[Z+2];K=x[Z+3];T=x[Z+4];I=x[Z+5];G=x[Z+6];H=x[Z+7];L=x[Z+8];v=(v+K+G)/3;z=(z+T+H)/3;Q=(Q+I+L)/3;x[Z]=v;x[Z+1]=z;x[Z+2]=Q;x[Z+3]=v;x[Z+4]=z;x[Z+5]=Q;x[Z+6]=v;x[Z+7]=z;x[Z+8]=Q}}e.bufferData(e.ARRAY_BUFFER,n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(D.attributes.normal);e.vertexAttribPointer(D.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(ta!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ta=n.flipSided}}function j(n){if(ca!=n){n?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ca=n}}function k(n){ga[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);ga[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);ga[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);ga[3].set(n.n41-n.n21,n.n42-n.n22,
|
|
|
|
-n.n43-n.n23,n.n44-n.n24);ga[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);ga[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var D;for(n=0;n<6;n++){D=ga[n];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}}function m(n){for(var D=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=ga[v].x*D.n14+ga[v].y*D.n24+ga[v].z*D.n34+ga[v].w;if(n<=x)return!1}return!0}function o(n,D){n.list[n.count]=D;n.count+=1}function p(n){var D,
|
|
|
|
-x,v=n.object,z=n.opaque,Q=n.transparent;Q.count=0;n=z.count=0;for(D=v.materials.length;n<D;n++){x=v.materials[n];x.transparent?o(Q,x):o(z,x)}}function t(n){var D,x,v,z,Q=n.object,K=n.buffer,G=n.opaque,T=n.transparent;T.count=0;n=G.count=0;for(v=Q.materials.length;n<v;n++){D=Q.materials[n];if(D instanceof THREE.MeshFaceMaterial){D=0;for(x=K.materials.length;D<x;D++)(z=K.materials[D])&&(z.transparent?o(T,z):o(G,z))}else(z=D)&&(z.transparent?o(T,z):o(G,z))}}function y(n,D){return D.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 D,x=n.lights.length,v,z=n.lights,Q=[],K,G,T,H,I,L=n.__webglShadowVolumes.length;for(D=0;D<x;D++){v=n.lights[D];if(v instanceof THREE.DirectionalLight&&v.castShadow){Q[0]=-v.position.x;Q[1]=-v.position.y;Q[2]=-v.position.z;for(I=0;I<L;I++){v=n.__webglShadowVolumes[I].object;
|
|
|
|
-K=n.__webglShadowVolumes[I].buffer;G=v.materials[0];G.program||ia.initMaterial(G,z,undefined,v);G=G.program;T=G.uniforms;H=G.attributes;if(Aa!==G){e.useProgram(G);Aa=G;e.uniformMatrix4fv(T.projectionMatrix,!1,Xa);e.uniformMatrix4fv(T.viewMatrix,!1,Za);e.uniform3fv(T.directionalLightDirection,Q)}v.matrixWorld.flattenToArray(v._objectMatrixArray);e.uniformMatrix4fv(T.objectMatrix,!1,v._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,K.__webglVertexBuffer);e.vertexAttribPointer(H.position,3,e.FLOAT,!1,
|
|
|
|
-0,0);e.bindBuffer(e.ARRAY_BUFFER,K.__webglNormalBuffer);e.vertexAttribPointer(H.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=S.program;
|
|
|
|
-e.useProgram(S.program);e.uniformMatrix4fv(S.projectionLocation,!1,Xa);e.uniform1f(S.darknessLocation,S.darkness);e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.vertexAttribPointer(S.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(S.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,S.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(ea)}function A(n,
|
|
|
|
-D){var x,v,z;x=_sprite.attributes;var Q=_sprite.uniforms,K=ja/Fa,G,T=[],H=Fa*0.5,I=ja*0.5,L=!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(Q.projectionMatrix,!1,Xa);e.activeTexture(e.TEXTURE0);e.uniform1i(Q.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(D.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(Q.useScreenCoordinates,
|
|
|
|
-1);e.uniform3f(Q.screenPosition,(z.position.x-H)/H,(I-z.position.y)/I,Math.max(0,Math.min(1,z.position.z)))}else{e.uniform1i(Q.useScreenCoordinates,0);e.uniform1i(Q.affectedByDistance,z.affectedByDistance?1:0);e.uniformMatrix4fv(Q.modelViewMatrix,!1,z._modelViewMatrixArray)}G=z.map.image.width/(z.affectedByDistance?1:ja);T[0]=G*K*z.scale.x;T[1]=G*z.scale.y;e.uniform2f(Q.uvScale,z.uvScale.x,z.uvScale.y);e.uniform2f(Q.uvOffset,z.uvOffset.x,z.uvOffset.y);e.uniform2f(Q.alignment,z.alignment.x,z.alignment.y);
|
|
|
|
-e.uniform1f(Q.opacity,z.opacity);e.uniform1f(Q.rotation,z.rotation);e.uniform2fv(Q.scale,T);if(z.mergeWith3D&&!L){e.enable(e.DEPTH_TEST);L=!0}else if(!z.mergeWith3D&&L){e.disable(e.DEPTH_TEST);L=!1}V(z.blending);M(z.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(ea)}function F(n,D){var x,v,z=n.__webglLensFlares.length,Q,K,G,T=new THREE.Vector3,H=ja/Fa,I=Fa*0.5,L=ja*0.5,Z=16/ja,Y=[Z*H,Z],ra=[1,1,0],Ka=[1,1],Ca=P.uniforms;x=P.attributes;
|
|
|
|
-e.useProgram(P.program);Aa=P.program;pa="";if(!Ba){e.enableVertexAttribArray(P.attributes.vertex);e.enableVertexAttribArray(P.attributes.uv);Ba=!0}e.uniform1i(Ca.occlusionMap,0);e.uniform1i(Ca.map,1);e.bindBuffer(e.ARRAY_BUFFER,P.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,P.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);
|
|
|
|
-e.activeTexture(e.TEXTURE1);for(v=0;v<z;v++){x=n.__webglLensFlares[v].object;T.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);D.matrixWorldInverse.multiplyVector3(T);D.projectionMatrix.multiplyVector3(T);ra[0]=T.x;ra[1]=T.y;ra[2]=T.z;Ka[0]=ra[0]*I+I;Ka[1]=ra[1]*L+L;if(P.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ja){e.bindTexture(e.TEXTURE_2D,P.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,
|
|
|
|
-ra);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,P.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,P.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=ra[0];x.positionScreen.y=ra[1];x.positionScreen.z=ra[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(Ca.renderType,
|
|
|
|
-2);e.enable(e.BLEND);Q=0;for(K=x.lensFlares.length;Q<K;Q++){G=x.lensFlares[Q];if(G.opacity>0.0010&&G.scale>0.0010){ra[0]=G.x;ra[1]=G.y;ra[2]=G.z;Z=G.size*G.scale/ja;Y[0]=Z*H;Y[1]=Z;e.uniform3fv(Ca.screenPosition,ra);e.uniform2fv(Ca.scale,Y);e.uniform1f(Ca.rotation,G.rotation);e.uniform1f(Ca.opacity,G.opacity);V(G.blending);M(G.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(ea)}function J(n,D){n._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,
|
|
|
|
-n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function B(n){var D,x,v,z,Q;if(n instanceof THREE.Mesh){x=n.geometry;for(D in x.geometryGroups){v=x.geometryGroups[D];Q=!1;for(z in v.__webglCustomAttributes)if(v.__webglCustomAttributes[z].needsUpdate){Q=!0;break}if(x.__dirtyVertices||x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||Q){Q=e.DYNAMIC_DRAW;var K=void 0,
|
|
|
|
-G=void 0,T=void 0,H=void 0;T=void 0;var I=void 0,L=void 0,Z=void 0,Y=void 0,ra=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;L=void 0;Z=void 0;H=void 0;Y=void 0;H=void 0;var E=void 0,aa=void 0;L=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;H=void 0;Y=void 0;I=void 0;T=void 0;T=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,ha=v.__skinVertexAArray,$=v.__skinVertexBArray,ua=v.__skinIndexArray,sa=v.__skinWeightArray,ya=v.__morphTargetsArrays,X=v.__webglCustomAttributes;w=void 0;var Ia=v.__faceArray,Ya=v.__lineArray,eb=v.__needsSmoothNormals;Ka=v.__vertexColorType;ra=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(G=vb.length;K<G;K++){T=vb[K];H=yb[T];wb&&(Ha=wb[T]);xb&&(Ga=xb[T]);T=H.vertexNormals;I=H.normal;L=H.vertexColors;
|
|
|
|
-Z=H.color;Y=H.vertexTangents;if(H instanceof THREE.Face3){if(kb){xa=nb[H.a].position;Ea=nb[H.b].position;za=nb[H.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[H.a];w.array[E+1]=w.value[H.b];w.array[E+2]=w.value[H.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[H.a];Ea=w.value[H.b];za=w.value[H.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[H.a].position;Ea=morphTargets[E].vertices[H.b].position;za=morphTargets[E].vertices[H.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[H.a];aa=lb[H.b];w=lb[H.c];sa[N]=E.x;sa[N+1]=E.y;sa[N+2]=E.z;sa[N+3]=E.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=w.x;sa[N+9]=w.y;sa[N+10]=w.z;sa[N+11]=w.w;E=qb[H.a];aa=qb[H.b];w=qb[H.c];ua[N]=E.x;ua[N+1]=E.y;ua[N+2]=E.z;ua[N+3]=E.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=w.x;ua[N+9]=w.y;ua[N+10]=w.z;ua[N+11]=w.w;E=ob[H.a];aa=ob[H.b];w=ob[H.c];ha[N]=E.x;ha[N+1]=E.y;ha[N+2]=E.z;ha[N+
|
|
|
|
-3]=1;ha[N+4]=aa.x;ha[N+5]=aa.y;ha[N+6]=aa.z;ha[N+7]=1;ha[N+8]=w.x;ha[N+9]=w.y;ha[N+10]=w.z;ha[N+11]=1;E=pb[H.a];aa=pb[H.b];w=pb[H.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(L.length==3&&Ka==THREE.VertexColors){H=L[0];E=L[1];aa=L[2]}else aa=E=H=Z;na[Va]=H.r;na[Va+1]=H.g;na[Va+2]=H.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){L=
|
|
|
|
-Y[0];Z=Y[1];H=Y[2];W[Ma]=L.x;W[Ma+1]=L.y;W[Ma+2]=L.z;W[Ma+3]=L.w;W[Ma+4]=Z.x;W[Ma+5]=Z.y;W[Ma+6]=Z.z;W[Ma+7]=Z.w;W[Ma+8]=H.x;W[Ma+9]=H.y;W[Ma+10]=H.z;W[Ma+11]=H.w;Ma+=12}if(rb&&Ca)if(T.length==3&&eb)for(Y=0;Y<3;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<3;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.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(H instanceof THREE.Face4){if(kb){xa=nb[H.a].position;Ea=nb[H.b].position;za=nb[H.c].position;Ua=nb[H.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[H.a];w.array[E+1]=w.value[H.b];w.array[E+2]=w.value[H.c];w.array[E+2]=w.value[H.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+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.array[E+2]=w.value[aa+3];w.offsetSrc+=4}w.offset+=4}else{if(w.boundTo===undefined||
|
|
|
|
-w.boundTo==="vertices"){xa=w.value[H.a];Ea=w.value[H.b];za=w.value[H.c];Ua=w.value[H.d]}else if(w.boundTo==="faces"){xa=w.value[aa];Ea=w.value[aa];za=w.value[aa];Ua=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){xa=w.value[aa+0];Ea=w.value[aa+1];za=w.value[aa+2];Ua=w.value[aa+3];w.offsetSrc+=4}if(w.size===2){w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=Ea.x;w.array[E+3]=Ea.y;w.array[E+4]=za.x;w.array[E+5]=za.y;w.array[E+6]=Ua.x;w.array[E+7]=Ua.y;w.offset+=8}else if(w.size===3){if(w.type===
|
|
|
|
-"c"){w.array[E+0]=xa.r;w.array[E+1]=xa.g;w.array[E+2]=xa.b;w.array[E+3]=Ea.r;w.array[E+4]=Ea.g;w.array[E+5]=Ea.b;w.array[E+6]=za.r;w.array[E+7]=za.g;w.array[E+8]=za.b;w.array[E+9]=Ua.r;w.array[E+10]=Ua.g;w.array[E+11]=Ua.b}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=Ea.x;w.array[E+4]=Ea.y;w.array[E+5]=Ea.z;w.array[E+6]=za.x;w.array[E+7]=za.y;w.array[E+8]=za.z;w.array[E+9]=Ua.x;w.array[E+10]=Ua.y;w.array[E+11]=Ua.z}w.offset+=12}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+
|
|
|
|
-2]=xa.z;w.array[E+3]=xa.w;w.array[E+4]=Ea.x;w.array[E+5]=Ea.y;w.array[E+6]=Ea.z;w.array[E+7]=Ea.w;w.array[E+8]=za.x;w.array[E+9]=za.y;w.array[E+10]=za.z;w.array[E+11]=za.w;w.array[E+12]=Ua.x;w.array[E+13]=Ua.y;w.array[E+14]=Ua.z;w.array[E+15]=Ua.w;w.offset+=16}}}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){xa=morphTargets[E].vertices[H.a].position;Ea=morphTargets[E].vertices[H.b].position;za=morphTargets[E].vertices[H.c].position;Ua=morphTargets[E].vertices[H.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[H.a];aa=lb[H.b];w=lb[H.c];ab=lb[H.d];sa[N]=E.x;sa[N+1]=E.y;sa[N+2]=E.z;sa[N+3]=E.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=w.x;sa[N+9]=w.y;sa[N+10]=w.z;sa[N+11]=w.w;sa[N+12]=ab.x;sa[N+13]=ab.y;sa[N+14]=ab.z;sa[N+15]=ab.w;E=qb[H.a];aa=qb[H.b];w=qb[H.c];ab=qb[H.d];ua[N]=E.x;ua[N+1]=E.y;ua[N+2]=E.z;ua[N+3]=E.w;ua[N+
|
|
|
|
-4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=w.x;ua[N+9]=w.y;ua[N+10]=w.z;ua[N+11]=w.w;ua[N+12]=ab.x;ua[N+13]=ab.y;ua[N+14]=ab.z;ua[N+15]=ab.w;E=ob[H.a];aa=ob[H.b];w=ob[H.c];ab=ob[H.d];ha[N]=E.x;ha[N+1]=E.y;ha[N+2]=E.z;ha[N+3]=1;ha[N+4]=aa.x;ha[N+5]=aa.y;ha[N+6]=aa.z;ha[N+7]=1;ha[N+8]=w.x;ha[N+9]=w.y;ha[N+10]=w.z;ha[N+11]=1;ha[N+12]=ab.x;ha[N+13]=ab.y;ha[N+14]=ab.z;ha[N+15]=1;E=pb[H.a];aa=pb[H.b];w=pb[H.c];H=pb[H.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]=H.x;$[N+13]=H.y;$[N+14]=H.z;$[N+15]=1;N+=16}if(tb&&Ka){if(L.length==4&&Ka==THREE.VertexColors){H=L[0];E=L[1];aa=L[2];L=L[3]}else L=aa=E=H=Z;na[Va]=H.r;na[Va+1]=H.g;na[Va+2]=H.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]=L.r;na[Va+10]=L.g;na[Va+11]=L.b;Va+=12}if(sb&&Sa.hasTangents){L=Y[0];Z=Y[1];H=Y[2];Y=Y[3];W[Ma]=L.x;W[Ma+1]=L.y;W[Ma+2]=L.z;W[Ma+3]=L.w;W[Ma+4]=Z.x;W[Ma+5]=Z.y;W[Ma+6]=
|
|
|
|
-Z.z;W[Ma+7]=Z.w;W[Ma+8]=H.x;W[Ma+9]=H.y;W[Ma+10]=H.z;W[Ma+11]=H.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(T.length==4&&eb)for(Y=0;Y<4;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<4;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.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(G=mb.length;K<G;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,Q)}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,Q);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],Q)}}if(tb&&Va>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,Q)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,Q)}if(sb&&Sa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,v.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,W,Q)}if(db&&cb>0){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
-v.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,Q)}if(db&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,jb,Q)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,Q);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,Q)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ha,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexBBuffer);
|
|
|
|
-e.bufferData(e.ARRAY_BUFFER,$,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ua,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,sa,Q)}}}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;D=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;
|
|
|
|
-Q=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ca;G++){ra=Ka[G].position;z=G*3;Ha[z]=ra.x;Ha[z+1]=ra.y;Ha[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,D)}if(Ga){for(G=0;G<Q;G++){color=v[G];z=G*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,D)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Line){x=n.geometry;
|
|
|
|
-if(x.__dirtyVertices||x.__dirtyColors){n=x;D=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;Q=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ca;G++){ra=Ka[G].position;z=G*3;Ha[z]=ra.x;Ha[z+1]=ra.y;Ha[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,D)}if(Ga){for(G=0;G<Q;G++){color=v[G];z=G*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,D)}}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 D(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,Q,K,G,T,H,I={},L=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};z=0;for(Q=n.faces.length;z<Q;z++){K=n.faces[z];G=
|
|
|
|
-K.materials;T=D(G);I[T]==undefined&&(I[T]={hash:T,counter:0});H=I[T].hash+"_"+I[T].counter;n.geometryGroups[H]==undefined&&(n.geometryGroups[H]={faces:[],materials:G,vertices:0,numMorphTargets:L});K=K instanceof THREE.Face3?3:4;if(n.geometryGroups[H].vertices+K>65535){I[T].counter+=1;H=I[T].hash+"_"+I[T].counter;n.geometryGroups[H]==undefined&&(n.geometryGroups[H]={faces:[],materials:G,vertices:0,numMorphTargets:L})}n.geometryGroups[H].faces.push(z);n.geometryGroups[H].vertices+=K}}function C(n,D,
|
|
|
|
-x){n.push({buffer:D,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function V(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 O(n,D,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,fa(D.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,fa(D.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,fa(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,fa(D.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,
|
|
|
|
-qa(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,qa(D.minFilter))}}function M(n,D){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}O(e.TEXTURE_2D,n,n.image);e.bindTexture(e.TEXTURE_2D,null);n.needsUpdate=!1}e.activeTexture(e.TEXTURE0+
|
|
|
|
-D);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function va(n){if(n&&!n.__webglFramebuffer){if(n.depthBuffer===undefined)n.depthBuffer=!0;if(n.stencilBuffer===undefined)n.stencilBuffer=!0;n.__webglFramebuffer=e.createFramebuffer();n.__webglRenderbuffer=e.createRenderbuffer();n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,fa(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,fa(n.wrapT));e.texParameteri(e.TEXTURE_2D,
|
|
|
|
-e.TEXTURE_MAG_FILTER,fa(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,fa(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,fa(n.format),n.width,n.height,0,fa(n.format),fa(n.type),null);e.bindRenderbuffer(e.RENDERBUFFER,n.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.__webglTexture,0);if(n.depthBuffer&&!n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height);
|
|
|
|
-e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var D,x;if(n){D=
|
|
|
|
-n.__webglFramebuffer;x=n.width;n=n.height}else{D=null;x=Fa;n=ja}if(D!=da){e.bindFramebuffer(e.FRAMEBUFFER,D);e.viewport(ka,ma,x,n);da=D}}function la(n,D){var x;if(n=="fragment")x=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,D);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(D);return null}return x}function qa(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
|
|
|
|
-default:return e.LINEAR}}function fa(n){switch(n){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
|
|
|
|
|
|
+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(Q instanceof THREE.Line){Q=Q.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(Q,0,z.__webglLineCount);ea.data.drawCalls++}else if(Q instanceof THREE.ParticleSystem){e.drawArrays(e.POINTS,0,z.__webglParticleCount);
|
|
|
|
+ea.data.drawCalls++}else if(Q instanceof THREE.Ribbon){e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount);ea.data.drawCalls++}}}function g(n,D,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(D.attributes.position);e.vertexAttribPointer(D.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,Q,K,G,T,H,I,L,Z,Y=n.count*3;for(Z=0;Z<Y;Z+=9){x=n.normalArray;v=x[Z];z=x[Z+1];Q=x[Z+2];K=x[Z+3];T=x[Z+4];I=x[Z+5];G=x[Z+6];H=x[Z+7];L=x[Z+8];v=(v+K+G)/3;z=(z+T+H)/3;Q=(Q+I+L)/3;x[Z]=v;x[Z+1]=z;x[Z+2]=Q;x[Z+3]=v;x[Z+4]=z;x[Z+5]=Q;x[Z+6]=v;x[Z+7]=z;x[Z+8]=Q}}e.bufferData(e.ARRAY_BUFFER,n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(D.attributes.normal);e.vertexAttribPointer(D.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(ta!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ta=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 D;for(n=0;n<6;n++){D=ha[n];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}}function m(n){for(var D=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*D.n14+ha[v].y*D.n24+ha[v].z*D.n34+ha[v].w;if(n<=x)return!1}return!0}function o(n,
|
|
|
|
+D){n.list[n.count]=D;n.count+=1}function p(n){var D,x,v=n.object,z=n.opaque,Q=n.transparent;Q.count=0;n=z.count=0;for(D=v.materials.length;n<D;n++){x=v.materials[n];x.transparent?o(Q,x):o(z,x)}}function t(n){var D,x,v,z,Q=n.object,K=n.buffer,G=n.opaque,T=n.transparent;T.count=0;n=G.count=0;for(v=Q.materials.length;n<v;n++){D=Q.materials[n];if(D instanceof THREE.MeshFaceMaterial){D=0;for(x=K.materials.length;D<x;D++)(z=K.materials[D])&&(z.transparent?o(T,z):o(G,z))}else(z=D)&&(z.transparent?o(T,z):
|
|
|
|
+o(G,z))}}function y(n,D){return D.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 D,x=n.lights.length,v,z=n.lights,Q=[],K,G,T,H,I,L=n.__webglShadowVolumes.length;for(D=0;D<x;D++){v=n.lights[D];if(v instanceof THREE.DirectionalLight&&v.castShadow){Q[0]=
|
|
|
|
+-v.position.x;Q[1]=-v.position.y;Q[2]=-v.position.z;for(I=0;I<L;I++){v=n.__webglShadowVolumes[I].object;K=n.__webglShadowVolumes[I].buffer;G=v.materials[0];G.program||ea.initMaterial(G,z,undefined,v);G=G.program;T=G.uniforms;H=G.attributes;if(Aa!==G){e.useProgram(G);Aa=G;e.uniformMatrix4fv(T.projectionMatrix,!1,Xa);e.uniformMatrix4fv(T.viewMatrix,!1,Za);e.uniform3fv(T.directionalLightDirection,Q)}v.matrixWorld.flattenToArray(v._objectMatrixArray);e.uniformMatrix4fv(T.objectMatrix,!1,v._objectMatrixArray);
|
|
|
|
+e.bindBuffer(e.ARRAY_BUFFER,K.__webglVertexBuffer);e.vertexAttribPointer(H.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,K.__webglNormalBuffer);e.vertexAttribPointer(H.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=S.program;e.useProgram(S.program);e.uniformMatrix4fv(S.projectionLocation,!1,Xa);e.uniform1f(S.darknessLocation,S.darkness);e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.vertexAttribPointer(S.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(S.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,S.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,D){var x,v,z;x=_sprite.attributes;var Q=_sprite.uniforms,K=ja/Fa,G,T=[],H=Fa*0.5,I=ja*0.5,L=!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(Q.projectionMatrix,!1,Xa);e.activeTexture(e.TEXTURE0);e.uniform1i(Q.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(D.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(Q.useScreenCoordinates,1);e.uniform3f(Q.screenPosition,(z.position.x-H)/H,(I-z.position.y)/I,Math.max(0,Math.min(1,z.position.z)))}else{e.uniform1i(Q.useScreenCoordinates,0);e.uniform1i(Q.affectedByDistance,z.affectedByDistance?1:0);e.uniformMatrix4fv(Q.modelViewMatrix,!1,z._modelViewMatrixArray)}G=z.map.image.width/(z.affectedByDistance?1:ja);T[0]=G*K*z.scale.x;T[1]=
|
|
|
|
+G*z.scale.y;e.uniform2f(Q.uvScale,z.uvScale.x,z.uvScale.y);e.uniform2f(Q.uvOffset,z.uvOffset.x,z.uvOffset.y);e.uniform2f(Q.alignment,z.alignment.x,z.alignment.y);e.uniform1f(Q.opacity,z.opacity);e.uniform1f(Q.rotation,z.rotation);e.uniform2fv(Q.scale,T);if(z.mergeWith3D&&!L){e.enable(e.DEPTH_TEST);L=!0}else if(!z.mergeWith3D&&L){e.disable(e.DEPTH_TEST);L=!1}V(z.blending);M(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 F(n,
|
|
|
|
+D){var x,v,z=n.__webglLensFlares.length,Q,K,G,T=new THREE.Vector3,H=ja/Fa,I=Fa*0.5,L=ja*0.5,Z=16/ja,Y=[Z*H,Z],ra=[1,1,0],Ka=[1,1],Ca=P.uniforms;x=P.attributes;e.useProgram(P.program);Aa=P.program;pa="";if(!Ba){e.enableVertexAttribArray(P.attributes.vertex);e.enableVertexAttribArray(P.attributes.uv);Ba=!0}e.uniform1i(Ca.occlusionMap,0);e.uniform1i(Ca.map,1);e.bindBuffer(e.ARRAY_BUFFER,P.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,
|
|
|
|
+P.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);e.activeTexture(e.TEXTURE1);for(v=0;v<z;v++){x=n.__webglLensFlares[v].object;T.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);D.matrixWorldInverse.multiplyVector3(T);D.projectionMatrix.multiplyVector3(T);ra[0]=T.x;ra[1]=T.y;ra[2]=T.z;Ka[0]=ra[0]*I+I;Ka[1]=ra[1]*L+L;if(P.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ja){e.bindTexture(e.TEXTURE_2D,P.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,ra);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,P.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,P.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=
|
|
|
|
+ra[0];x.positionScreen.y=ra[1];x.positionScreen.z=ra[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(Ca.renderType,2);e.enable(e.BLEND);Q=0;for(K=x.lensFlares.length;Q<K;Q++){G=x.lensFlares[Q];if(G.opacity>0.001&&G.scale>0.001){ra[0]=G.x;ra[1]=G.y;ra[2]=G.z;Z=G.size*G.scale/ja;Y[0]=Z*H;Y[1]=Z;e.uniform3fv(Ca.screenPosition,ra);e.uniform2fv(Ca.scale,Y);e.uniform1f(Ca.rotation,G.rotation);e.uniform1f(Ca.opacity,G.opacity);V(G.blending);M(G.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 J(n,D){n._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function B(n){var D,x,v,z,Q;if(n instanceof THREE.Mesh){x=n.geometry;for(D in x.geometryGroups){v=x.geometryGroups[D];Q=!1;for(z in v.__webglCustomAttributes)if(v.__webglCustomAttributes[z].needsUpdate){Q=!0;break}if(x.__dirtyVertices||
|
|
|
|
+x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||Q){Q=e.DYNAMIC_DRAW;var K=void 0,G=void 0,T=void 0,H=void 0;T=void 0;var I=void 0,L=void 0,Z=void 0,Y=void 0,ra=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;L=void 0;Z=void 0;H=void 0;Y=void 0;H=void 0;var E=void 0,aa=void 0;L=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;H=void 0;Y=void 0;I=void 0;T=void 0;T=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,ua=v.__skinIndexArray,sa=v.__skinWeightArray,ya=v.__morphTargetsArrays,X=v.__webglCustomAttributes;w=void 0;var Ia=v.__faceArray,Ya=v.__lineArray,eb=v.__needsSmoothNormals;
|
|
|
|
+Ka=v.__vertexColorType;ra=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(G=vb.length;K<G;K++){T=vb[K];H=yb[T];wb&&(Ha=wb[T]);xb&&(Ga=xb[T]);T=H.vertexNormals;I=H.normal;L=H.vertexColors;Z=H.color;Y=H.vertexTangents;if(H instanceof THREE.Face3){if(kb){xa=nb[H.a].position;Ea=nb[H.b].position;za=nb[H.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[H.a];w.array[E+1]=w.value[H.b];w.array[E+2]=w.value[H.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[H.a];Ea=w.value[H.b];za=w.value[H.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[H.a].position;Ea=morphTargets[E].vertices[H.b].position;
|
|
|
|
+za=morphTargets[E].vertices[H.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[H.a];aa=lb[H.b];w=lb[H.c];sa[N]=E.x;sa[N+1]=E.y;sa[N+2]=E.z;sa[N+3]=E.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=w.x;sa[N+9]=w.y;sa[N+10]=w.z;sa[N+11]=w.w;E=qb[H.a];aa=qb[H.b];w=qb[H.c];ua[N]=E.x;ua[N+1]=E.y;ua[N+2]=E.z;ua[N+3]=E.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=
|
|
|
|
+w.x;ua[N+9]=w.y;ua[N+10]=w.z;ua[N+11]=w.w;E=ob[H.a];aa=ob[H.b];w=ob[H.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[H.a];aa=pb[H.b];w=pb[H.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(L.length==3&&Ka==THREE.VertexColors){H=L[0];E=L[1];aa=L[2]}else aa=E=H=Z;na[Va]=H.r;na[Va+1]=H.g;na[Va+2]=H.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){L=Y[0];Z=Y[1];H=Y[2];W[Ma]=L.x;W[Ma+1]=L.y;W[Ma+2]=L.z;W[Ma+3]=L.w;W[Ma+4]=Z.x;W[Ma+5]=Z.y;W[Ma+6]=Z.z;W[Ma+7]=Z.w;W[Ma+8]=H.x;W[Ma+9]=H.y;W[Ma+10]=H.z;W[Ma+11]=H.w;Ma+=12}if(rb&&Ca)if(T.length==3&&eb)for(Y=0;Y<3;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<3;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ha[Y];ib[cb]=
|
|
|
|
+T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.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(H instanceof THREE.Face4){if(kb){xa=nb[H.a].position;Ea=nb[H.b].position;za=nb[H.c].position;Ua=nb[H.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[H.a];w.array[E+1]=w.value[H.b];w.array[E+2]=w.value[H.c];w.array[E+2]=w.value[H.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+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.array[E+2]=w.value[aa+3];w.offsetSrc+=4}w.offset+=4}else{if(w.boundTo===undefined||w.boundTo==="vertices"){xa=w.value[H.a];Ea=w.value[H.b];za=w.value[H.c];Ua=w.value[H.d]}else if(w.boundTo==="faces"){xa=w.value[aa];Ea=w.value[aa];za=w.value[aa];Ua=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){xa=w.value[aa+0];Ea=w.value[aa+1];za=w.value[aa+2];Ua=w.value[aa+3];w.offsetSrc+=4}if(w.size===2){w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=Ea.x;w.array[E+
|
|
|
|
+3]=Ea.y;w.array[E+4]=za.x;w.array[E+5]=za.y;w.array[E+6]=Ua.x;w.array[E+7]=Ua.y;w.offset+=8}else if(w.size===3){if(w.type==="c"){w.array[E+0]=xa.r;w.array[E+1]=xa.g;w.array[E+2]=xa.b;w.array[E+3]=Ea.r;w.array[E+4]=Ea.g;w.array[E+5]=Ea.b;w.array[E+6]=za.r;w.array[E+7]=za.g;w.array[E+8]=za.b;w.array[E+9]=Ua.r;w.array[E+10]=Ua.g;w.array[E+11]=Ua.b}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=Ea.x;w.array[E+4]=Ea.y;w.array[E+5]=Ea.z;w.array[E+6]=za.x;w.array[E+7]=za.y;w.array[E+
|
|
|
|
+8]=za.z;w.array[E+9]=Ua.x;w.array[E+10]=Ua.y;w.array[E+11]=Ua.z}w.offset+=12}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=xa.w;w.array[E+4]=Ea.x;w.array[E+5]=Ea.y;w.array[E+6]=Ea.z;w.array[E+7]=Ea.w;w.array[E+8]=za.x;w.array[E+9]=za.y;w.array[E+10]=za.z;w.array[E+11]=za.w;w.array[E+12]=Ua.x;w.array[E+13]=Ua.y;w.array[E+14]=Ua.z;w.array[E+15]=Ua.w;w.offset+=16}}}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){xa=morphTargets[E].vertices[H.a].position;Ea=morphTargets[E].vertices[H.b].position;
|
|
|
|
+za=morphTargets[E].vertices[H.c].position;Ua=morphTargets[E].vertices[H.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[H.a];aa=lb[H.b];w=lb[H.c];ab=lb[H.d];sa[N]=E.x;sa[N+1]=E.y;sa[N+2]=E.z;sa[N+3]=E.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=w.x;sa[N+9]=w.y;sa[N+10]=w.z;sa[N+11]=w.w;sa[N+12]=ab.x;sa[N+13]=ab.y;sa[N+14]=ab.z;
|
|
|
|
+sa[N+15]=ab.w;E=qb[H.a];aa=qb[H.b];w=qb[H.c];ab=qb[H.d];ua[N]=E.x;ua[N+1]=E.y;ua[N+2]=E.z;ua[N+3]=E.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=w.x;ua[N+9]=w.y;ua[N+10]=w.z;ua[N+11]=w.w;ua[N+12]=ab.x;ua[N+13]=ab.y;ua[N+14]=ab.z;ua[N+15]=ab.w;E=ob[H.a];aa=ob[H.b];w=ob[H.c];ab=ob[H.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[H.a];
|
|
|
|
+aa=pb[H.b];w=pb[H.c];H=pb[H.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]=H.x;$[N+13]=H.y;$[N+14]=H.z;$[N+15]=1;N+=16}if(tb&&Ka){if(L.length==4&&Ka==THREE.VertexColors){H=L[0];E=L[1];aa=L[2];L=L[3]}else L=aa=E=H=Z;na[Va]=H.r;na[Va+1]=H.g;na[Va+2]=H.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]=L.r;na[Va+10]=L.g;na[Va+11]=L.b;Va+=12}if(sb&&Sa.hasTangents){L=Y[0];
|
|
|
|
+Z=Y[1];H=Y[2];Y=Y[3];W[Ma]=L.x;W[Ma+1]=L.y;W[Ma+2]=L.z;W[Ma+3]=L.w;W[Ma+4]=Z.x;W[Ma+5]=Z.y;W[Ma+6]=Z.z;W[Ma+7]=Z.w;W[Ma+8]=H.x;W[Ma+9]=H.y;W[Ma+10]=H.z;W[Ma+11]=H.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(T.length==4&&eb)for(Y=0;Y<4;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<4;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<
|
|
|
|
+4;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.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(G=mb.length;K<G;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,Q)}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,Q);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],Q)}}if(tb&&Va>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,Q)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,Q)}if(sb&&Sa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
+v.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,W,Q)}if(db&&cb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,Q)}if(db&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,jb,Q)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,Q);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,Q)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexABuffer);
|
|
|
|
+e.bufferData(e.ARRAY_BUFFER,ia,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,$,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ua,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,sa,Q)}}}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;D=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;Q=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ca;G++){ra=Ka[G].position;z=G*3;Ha[z]=ra.x;Ha[z+1]=ra.y;Ha[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,D)}if(Ga){for(G=0;G<Q;G++){color=v[G];z=G*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,D)}}x.__dirtyVertices=
|
|
|
|
+!1;x.__dirtyColors=!1}else if(n instanceof THREE.Line){x=n.geometry;if(x.__dirtyVertices||x.__dirtyColors){n=x;D=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;Q=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ca;G++){ra=Ka[G].position;z=G*3;Ha[z]=ra.x;Ha[z+1]=ra.y;Ha[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,D)}if(Ga){for(G=0;G<Q;G++){color=v[G];z=G*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,D)}}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 D(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,Q,K,G,T,H,I={},L=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};
|
|
|
|
+z=0;for(Q=n.faces.length;z<Q;z++){K=n.faces[z];G=K.materials;T=D(G);I[T]==undefined&&(I[T]={hash:T,counter:0});H=I[T].hash+"_"+I[T].counter;n.geometryGroups[H]==undefined&&(n.geometryGroups[H]={faces:[],materials:G,vertices:0,numMorphTargets:L});K=K instanceof THREE.Face3?3:4;if(n.geometryGroups[H].vertices+K>65535){I[T].counter+=1;H=I[T].hash+"_"+I[T].counter;n.geometryGroups[H]==undefined&&(n.geometryGroups[H]={faces:[],materials:G,vertices:0,numMorphTargets:L})}n.geometryGroups[H].faces.push(z);
|
|
|
|
+n.geometryGroups[H].vertices+=K}}function C(n,D,x){n.push({buffer:D,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function V(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 O(n,D,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,ga(D.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,ga(D.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,ga(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ga(D.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,qa(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,qa(D.minFilter))}}function M(n,D){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}O(e.TEXTURE_2D,n,n.image);e.bindTexture(e.TEXTURE_2D,null);
|
|
|
|
+n.needsUpdate=!1}e.activeTexture(e.TEXTURE0+D);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function va(n){if(n&&!n.__webglFramebuffer){if(n.depthBuffer===undefined)n.depthBuffer=!0;if(n.stencilBuffer===undefined)n.stencilBuffer=!0;n.__webglFramebuffer=e.createFramebuffer();n.__webglRenderbuffer=e.createRenderbuffer();n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,ga(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,
|
|
|
|
+ga(n.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,ga(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,ga(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,ga(n.format),n.width,n.height,0,ga(n.format),ga(n.type),null);e.bindRenderbuffer(e.RENDERBUFFER,n.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.__webglTexture,0);if(n.depthBuffer&&!n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,
|
|
|
|
+e.DEPTH_COMPONENT16,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,
|
|
|
|
+null)}var D,x;if(n){D=n.__webglFramebuffer;x=n.width;n=n.height}else{D=null;x=Fa;n=ja}if(D!=da){e.bindFramebuffer(e.FRAMEBUFFER,D);e.viewport(ka,ma,x,n);da=D}}function la(n,D){var x;if(n=="fragment")x=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,D);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(D);return null}return x}function qa(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
|
|
|
|
+default:return e.LINEAR}}function ga(n){switch(n){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
|
|
case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}
|
|
case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}
|
|
-var ia=this,e,oa=document.createElement("canvas"),Da=[],Aa=null,da=null,ea=!0,wa=null,ta=null,pa=null,ca=null,ka=0,ma=0,Fa=0,ja=0,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ja=new THREE.Matrix4,Xa=new Float32Array(16),Za=new Float32Array(16),Ta=new THREE.Vector4,R={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;
|
|
|
|
-antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,faces:0};this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=!0;(function(n,D,x,v){try{if(!(e=oa.getContext("experimental-webgl",{antialias:n,stencil:v})))throw"Error creating WebGL context.";}catch(z){console.error(z)}console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+
|
|
|
|
-" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(D.r,D.g,D.b,x)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var S={};S.vertices=new Float32Array(12);S.faces=new Uint16Array(6);
|
|
|
|
-S.darkness=0.5;S.vertices[0]=-20;S.vertices[1]=-20;S.vertices[2]=-1;S.vertices[3]=20;S.vertices[4]=-20;S.vertices[5]=-1;S.vertices[6]=20;S.vertices[7]=20;S.vertices[8]=-1;S.vertices[9]=-20;S.vertices[10]=20;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=e.createBuffer();S.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,S.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
|
|
|
|
|
|
+var ea=this,e,oa=document.createElement("canvas"),Da=[],Aa=null,da=null,fa=!0,wa=null,ta=null,pa=null,ca=null,ka=0,ma=0,Fa=0,ja=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ja=new THREE.Matrix4,Xa=new Float32Array(16),Za=new Float32Array(16),Ta=new THREE.Vector4,R={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;
|
|
|
|
+antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=!0;(function(n,D,x,v){try{if(!(e=oa.getContext("experimental-webgl",{antialias:n,stencil:v})))throw"Error creating WebGL context.";}catch(z){console.error(z)}console.log(navigator.userAgent+" | "+
|
|
|
|
+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(D.r,D.g,D.b,x)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var S={};S.vertices=new Float32Array(12);
|
|
|
|
+S.faces=new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-20;S.vertices[1]=-20;S.vertices[2]=-1;S.vertices[3]=20;S.vertices[4]=-20;S.vertices[5]=-1;S.vertices[6]=20;S.vertices[7]=20;S.vertices[8]=-1;S.vertices[9]=-20;S.vertices[10]=20;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=e.createBuffer();S.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,S.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
|
|
S.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,S.faces,e.STATIC_DRAW);S.program=e.createProgram();e.attachShader(S.program,la("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(S.program,la("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(S.program);S.vertexLocation=e.getAttribLocation(S.program,"position");S.projectionLocation=e.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=e.getUniformLocation(S.program,"darkness")}var P={};P.vertices=
|
|
S.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,S.faces,e.STATIC_DRAW);S.program=e.createProgram();e.attachShader(S.program,la("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(S.program,la("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(S.program);S.vertexLocation=e.getAttribLocation(S.program,"position");S.projectionLocation=e.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=e.getUniformLocation(S.program,"darkness")}var P={};P.vertices=
|
|
new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;b=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=3;P.vertexBuffer=e.createBuffer();P.elementBuffer=e.createBuffer();
|
|
new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;b=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=3;P.vertexBuffer=e.createBuffer();P.elementBuffer=e.createBuffer();
|
|
P.tempTexture=e.createTexture();P.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,P.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,P.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,P.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,P.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);
|
|
P.tempTexture=e.createTexture();P.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,P.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,P.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,P.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,P.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);
|
|
@@ -306,7 +306,7 @@ e.getUniformLocation(P.program,"screenPosition");var Ba=!1;_sprite={};_sprite.ve
|
|
e.attachShader(_sprite.program,la("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,la("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=e.getUniformLocation(_sprite.program,
|
|
e.attachShader(_sprite.program,la("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,la("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=e.getUniformLocation(_sprite.program,
|
|
"uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=e.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=e.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
|
|
"uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=e.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=e.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
|
|
e.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=e.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");var La=!1;this.setSize=function(n,D){oa.width=n;oa.height=D;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(n,D,x,v){ka=n;ma=D;Fa=x;ja=v;e.viewport(ka,ma,Fa,
|
|
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,D){oa.width=n;oa.height=D;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(n,D,x,v){ka=n;ma=D;Fa=x;ja=v;e.viewport(ka,ma,Fa,
|
|
-ja)};this.setScissor=function(n,D,x,v){e.scissor(n,D,x,v)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){ea=n;e.depthMask(n)};this.setClearColorHex=function(n,D){var x=new THREE.Color(n);e.clearColor(x.r,x.g,x.b,D)};this.setClearColor=function(n,D){e.clearColor(n.r,n.g,n.b,D)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){S.darkness=
|
|
|
|
|
|
+ja)};this.setScissor=function(n,D,x,v){e.scissor(n,D,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,D){var x=new THREE.Color(n);e.clearColor(x.r,x.g,x.b,D)};this.setClearColor=function(n,D){e.clearColor(n.r,n.g,n.b,D)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){S.darkness=
|
|
n};this.getContext=function(){return e};this.initMaterial=function(n,D,x,v){var z,Q,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
|
|
n};this.getContext=function(){return e};this.initMaterial=function(n,D,x,v){var z,Q,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 G=THREE.ShaderLib[K];n.uniforms=THREE.UniformsUtils.clone(G.uniforms);n.vertexShader=G.vertexShader;n.fragmentShader=G.fragmentShader}var T,H,I;T=I=G=0;for(H=D.length;T<H;T++){Q=D[T];Q instanceof THREE.DirectionalLight&&I++;Q instanceof THREE.PointLight&&G++}if(G+I<=4)D=I;else{D=Math.ceil(4*I/(G+I));G=4-D}Q={directional:D,point:G};I=50;if(v!==undefined&&v instanceof THREE.SkinnedMesh)I=v.bones.length;var L;a:{T=n.fragmentShader;H=n.vertexShader;
|
|
THREE.ParticleBasicMaterial&&(K="particle_basic");if(K){var G=THREE.ShaderLib[K];n.uniforms=THREE.UniformsUtils.clone(G.uniforms);n.vertexShader=G.vertexShader;n.fragmentShader=G.fragmentShader}var T,H,I;T=I=G=0;for(H=D.length;T<H;T++){Q=D[T];Q instanceof THREE.DirectionalLight&&I++;Q instanceof THREE.PointLight&&G++}if(G+I<=4)D=I;else{D=Math.ceil(4*I/(G+I));G=4-D}Q={directional:D,point:G};I=50;if(v!==undefined&&v instanceof THREE.SkinnedMesh)I=v.bones.length;var L;a:{T=n.fragmentShader;H=n.vertexShader;
|
|
G=n.uniforms;D=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:Q.directional,maxPointLights:Q.point,maxBones:I};var Z;Q=[];if(K)Q.push(K);else{Q.push(T);Q.push(H)}for(Z in x){Q.push(Z);Q.push(x[Z])}K=Q.join();Z=0;for(Q=Da.length;Z<Q;Z++)if(Da[Z].code==K){L=Da[Z].program;break a}Z=e.createProgram();prefix_fragment=
|
|
G=n.uniforms;D=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:Q.directional,maxPointLights:Q.point,maxBones:I};var Z;Q=[];if(K)Q.push(K);else{Q.push(T);Q.push(H)}for(Z in x){Q.push(Z);Q.push(x[Z])}K=Q.join();Z=0;for(Q=Da.length;Z<Q;Z++)if(Da[Z].code==K){L=Da[Z].program;break a}Z=e.createProgram();prefix_fragment=
|
|
@@ -316,26 +316,26 @@ e.attachShader(Z,la("fragment",prefix_fragment+T));e.attachShader(Z,la("vertex",
|
|
Y=T;G=0;for(T=Y.length;G<T;G++){H=Y[G];Z.uniforms[H]=e.getUniformLocation(Z,H)}T=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(Y=0;Y<x.maxMorphTargets;Y++)T.push("morphTarget"+Y);for(L in D)T.push(L);L=T;Y=0;for(D=L.length;Y<D;Y++){x=L[Y];Z.attributes[x]=e.getAttribLocation(Z,x)}Da.push({program:Z,code:K});L=Z}n.program=L;L=n.program.attributes;e.enableVertexAttribArray(L.position);L.color>=0&&e.enableVertexAttribArray(L.color);L.normal>=
|
|
Y=T;G=0;for(T=Y.length;G<T;G++){H=Y[G];Z.uniforms[H]=e.getUniformLocation(Z,H)}T=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(Y=0;Y<x.maxMorphTargets;Y++)T.push("morphTarget"+Y);for(L in D)T.push(L);L=T;Y=0;for(D=L.length;Y<D;Y++){x=L[Y];Z.attributes[x]=e.getAttribLocation(Z,x)}Da.push({program:Z,code:K});L=Z}n.program=L;L=n.program.attributes;e.enableVertexAttribArray(L.position);L.color>=0&&e.enableVertexAttribArray(L.color);L.normal>=
|
|
0&&e.enableVertexAttribArray(L.normal);L.tangent>=0&&e.enableVertexAttribArray(L.tangent);if(n.skinning&&L.skinVertexA>=0&&L.skinVertexB>=0&&L.skinIndex>=0&&L.skinWeight>=0){e.enableVertexAttribArray(L.skinVertexA);e.enableVertexAttribArray(L.skinVertexB);e.enableVertexAttribArray(L.skinIndex);e.enableVertexAttribArray(L.skinWeight)}for(z in n.attributes)L[z]>=0&&e.enableVertexAttribArray(L[z]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(L.morphTarget0>=0){e.enableVertexAttribArray(L.morphTarget0);
|
|
0&&e.enableVertexAttribArray(L.normal);L.tangent>=0&&e.enableVertexAttribArray(L.tangent);if(n.skinning&&L.skinVertexA>=0&&L.skinVertexB>=0&&L.skinIndex>=0&&L.skinWeight>=0){e.enableVertexAttribArray(L.skinVertexA);e.enableVertexAttribArray(L.skinVertexB);e.enableVertexAttribArray(L.skinIndex);e.enableVertexAttribArray(L.skinWeight)}for(z in n.attributes)L[z]>=0&&e.enableVertexAttribArray(L[z]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(L.morphTarget0>=0){e.enableVertexAttribArray(L.morphTarget0);
|
|
n.numSupportedMorphTargets++}if(L.morphTarget1>=0){e.enableVertexAttribArray(L.morphTarget1);n.numSupportedMorphTargets++}if(L.morphTarget2>=0){e.enableVertexAttribArray(L.morphTarget2);n.numSupportedMorphTargets++}if(L.morphTarget3>=0){e.enableVertexAttribArray(L.morphTarget3);n.numSupportedMorphTargets++}if(L.morphTarget4>=0){e.enableVertexAttribArray(L.morphTarget4);n.numSupportedMorphTargets++}if(L.morphTarget5>=0){e.enableVertexAttribArray(L.morphTarget5);n.numSupportedMorphTargets++}if(L.morphTarget6>=
|
|
n.numSupportedMorphTargets++}if(L.morphTarget1>=0){e.enableVertexAttribArray(L.morphTarget1);n.numSupportedMorphTargets++}if(L.morphTarget2>=0){e.enableVertexAttribArray(L.morphTarget2);n.numSupportedMorphTargets++}if(L.morphTarget3>=0){e.enableVertexAttribArray(L.morphTarget3);n.numSupportedMorphTargets++}if(L.morphTarget4>=0){e.enableVertexAttribArray(L.morphTarget4);n.numSupportedMorphTargets++}if(L.morphTarget5>=0){e.enableVertexAttribArray(L.morphTarget5);n.numSupportedMorphTargets++}if(L.morphTarget6>=
|
|
-0){e.enableVertexAttribArray(L.morphTarget6);n.numSupportedMorphTargets++}if(L.morphTarget7>=0){e.enableVertexAttribArray(L.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,D,x,v){var z,Q,K,G,T,H,I,L,Z=n.lights,Y=n.fog;ia.data.vertices=0;ia.data.faces=0;D.matrixAutoUpdate&&D.update(undefined,!0);n.update(undefined,!1,D);D.matrixWorldInverse.flattenToArray(Za);
|
|
|
|
-D.projectionMatrix.flattenToArray(Xa);Ja.multiply(D.projectionMatrix,D.matrixWorldInverse);k(Ja);this.initWebGLObjects(n);va(x);(this.autoClear||v)&&this.clear();T=n.__webglObjects.length;for(v=0;v<T;v++){z=n.__webglObjects[v];I=z.object;if(I.visible)if(!(I instanceof THREE.Mesh)||m(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);J(I,D);t(z);z.render=!0;if(this.sortObjects){Ta.copy(I.position);Ja.multiplyVector3(Ta);z.z=Ta.z}}else z.render=!1;else z.render=!1}this.sortObjects&&n.__webglObjects.sort(y);
|
|
|
|
-H=n.__webglObjectsImmediate.length;for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);J(I,D);p(z)}}V(THREE.NormalBlending);for(v=0;v<T;v++){z=n.__webglObjects[v];if(z.render){I=z.object;L=z.buffer;K=z.opaque;h(I);for(z=0;z<K.count;z++){G=K.list[z];j(G.depthTest);f(D,Z,Y,G,L,I)}}}for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){K=z.opaque;h(I);for(z=0;z<K.count;z++){G=K.list[z];j(G.depthTest);
|
|
|
|
-Q=c(D,Z,Y,G,I);I.render(function(ra){g(ra,Q,G.shading)})}}}for(v=0;v<T;v++){z=n.__webglObjects[v];if(z.render){I=z.object;L=z.buffer;K=z.transparent;h(I);for(z=0;z<K.count;z++){G=K.list[z];V(G.blending);j(G.depthTest);f(D,Z,Y,G,L,I)}}}for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){K=z.transparent;h(I);for(z=0;z<K.count;z++){G=K.list[z];V(G.blending);j(G.depthTest);Q=c(D,Z,Y,G,I);I.render(function(ra){g(ra,Q,G.shading)})}}}n.__webglSprites.length&&A(n,D);stencil&&n.__webglShadowVolumes.length&&
|
|
|
|
-n.lights.length&&u(n);n.__webglLensFlares.length&&F(n,D);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 D=n.__objectsAdded[0],x=n,v=void 0,z=void 0,Q=void 0;
|
|
|
|
-if(D._modelViewMatrix==undefined){D._modelViewMatrix=new THREE.Matrix4;D._normalMatrixArray=new Float32Array(9);D._modelViewMatrixArray=new Float32Array(16);D._objectMatrixArray=new Float32Array(16);D.matrixWorld.flattenToArray(D._objectMatrixArray)}if(D instanceof THREE.Mesh){z=D.geometry;z.geometryGroups==undefined&&U(z);for(v in z.geometryGroups){Q=z.geometryGroups[v];if(!Q.__webglVertexBuffer){var K=Q;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 G=void 0,T=void 0;K.__webglMorphTargetsBuffers=[];G=0;for(T=K.numMorphTargets;G<T;G++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}K=
|
|
|
|
-Q;G=D;var H=void 0,I=void 0,L=void 0;L=void 0;var Z=void 0,Y=void 0,ra=void 0,Ka=ra=T=0;I=void 0;L=void 0;var Ca=void 0;H=void 0;I=void 0;Z=G.geometry;Ca=Z.faces;Y=K.faces;H=0;for(I=Y.length;H<I;H++){L=Y[H];L=Ca[L];if(L instanceof THREE.Face3){T+=3;ra+=1;Ka+=3}else if(L instanceof THREE.Face4){T+=4;ra+=2;Ka+=4}}H=K;I=G;Ca=void 0;Y=void 0;var Ha=void 0,Ga=void 0;Ha=void 0;L=[];Ca=0;for(Y=I.materials.length;Ca<Y;Ca++){Ha=I.materials[Ca];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=H.materials.length;Ha<
|
|
|
|
-l;Ha++)(Ga=H.materials[Ha])&&L.push(Ga)}else(Ga=Ha)&&L.push(Ga)}H=L;a:{I=void 0;Ca=void 0;Y=H.length;for(I=0;I<Y;I++){Ca=H[I];if(Ca.map||Ca.lightMap||Ca instanceof THREE.MeshShaderMaterial){I=!0;break a}}I=!1}a:{Ca=H;Y=void 0;L=void 0;Ha=Ca.length;for(Y=0;Y<Ha;Y++){L=Ca[Y];if(!(L instanceof THREE.MeshBasicMaterial&&!L.envMap||L instanceof THREE.MeshDepthMaterial)){Ca=L&&L.shading!=undefined&&L.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}Ca=!1}a:{Y=void 0;L=void 0;Ha=
|
|
|
|
-H.length;for(Y=0;Y<Ha;Y++){L=H[Y];if(L.vertexColors){L=L.vertexColors;break a}}L=!1}K.__vertexArray=new Float32Array(T*3);if(Ca)K.__normalArray=new Float32Array(T*3);if(Z.hasTangents)K.__tangentArray=new Float32Array(T*4);if(L)K.__colorArray=new Float32Array(T*3);if(I){if(Z.faceUvs.length>0||Z.faceVertexUvs.length>0)K.__uvArray=new Float32Array(T*2);if(Z.faceUvs.length>1||Z.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(T*2)}if(G.geometry.skinWeights.length&&G.geometry.skinIndices.length){K.__skinVertexAArray=
|
|
|
|
-new Float32Array(T*4);K.__skinVertexBArray=new Float32Array(T*4);K.__skinIndexArray=new Float32Array(T*4);K.__skinWeightArray=new Float32Array(T*4)}K.__faceArray=new Uint16Array(ra*3+(G.geometry.edgeFaces?G.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(T*3))}K.__needsSmoothNormals=Ca==THREE.SmoothShading;K.__uvType=I;K.__vertexColorType=L;K.__normalType=
|
|
|
|
-Ca;K.__webglFaceCount=ra*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0);K.__webglLineCount=Ka*2;Z=0;for(Y=H.length;Z<Y;Z++)if(H[Z].attributes){K.__webglCustomAttributes={};for(a in H[Z].attributes){I=H[Z].attributes[a];if(!I.__webglInitialized||I.createUniqueBuffers){I.__webglInitialized=!0;ra=1;if(I.type==="v2")ra=2;else if(I.type==="v3")ra=3;else if(I.type==="v4")ra=4;else I.type==="c"&&(ra=3);I.size=ra;I.needsUpdate=!0;I.array=new Float32Array(T*ra);I.buffer=e.createBuffer();I.buffer.belongsToAttribute=
|
|
|
|
-a}K.__webglCustomAttributes[a]=I}}z.__dirtyVertices=!0;z.__dirtyMorphTargets=!0;z.__dirtyElements=!0;z.__dirtyUvs=!0;z.__dirtyNormals=!0;z.__dirtyTangents=!0;z.__dirtyColors=!0}D instanceof THREE.ShadowVolume?C(x.__webglShadowVolumes,Q,D):C(x.__webglObjects,Q,D)}}else if(D instanceof THREE.LensFlare)C(x.__webglLensFlares,undefined,D);else if(D instanceof THREE.Ribbon){z=D.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;
|
|
|
|
-v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*3);v.__webglVertexCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(D instanceof THREE.Line){z=D.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*3);v.__webglLineCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(D instanceof
|
|
|
|
-THREE.ParticleSystem){z=D.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*3);v.__sortArray=[];v.__webglParticleCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(THREE.MarchingCubes!==undefined&&D instanceof THREE.MarchingCubes)x.__webglObjectsImmediate.push({object:D,opaque:{list:[],count:0},transparent:{list:[],
|
|
|
|
-count:0}});else D instanceof THREE.Sprite&&x.__webglSprites.push(D);n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){D=n.__objectsRemoved[0];x=n;z=void 0;v=void 0;if(D instanceof THREE.Mesh)for(z=x.__webglObjects.length-1;z>=0;z--){v=x.__webglObjects[z].object;if(D==v){x.__webglObjects.splice(z,1);break}}else if(D instanceof THREE.Sprite)for(z=x.__webglSprites.length-1;z>=0;z--){v=x.__webglSprites[z];if(D==v){x.__webglSprites.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}D=0;for(x=
|
|
|
|
-n.__webglObjects.length;D<x;D++)B(n.__webglObjects[D].object,n);D=0;for(x=n.__webglShadowVolumes.length;D<x;D++)B(n.__webglShadowVolumes[D].object,n);D=0;for(x=n.__webglLensFlares.length;D<x;D++)B(n.__webglLensFlares[D].object,n)};this.setFaceCulling=function(n,D){if(n){!D||D=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(n=="back")e.cullFace(e.BACK);else n=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
|
-0}};
|
|
|
|
-THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBAFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==undefined?
|
|
|
|
-c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==undefined?c.stencilBuffer:!0};
|
|
|
|
|
|
+0){e.enableVertexAttribArray(L.morphTarget6);n.numSupportedMorphTargets++}if(L.morphTarget7>=0){e.enableVertexAttribArray(L.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,D,x,v){var z,Q,K,G,T,H,I,L,Z=n.lights,Y=n.fog;ea.data.vertices=0;ea.data.faces=0;ea.data.drawCalls=0;D.matrixAutoUpdate&&D.update(undefined,!0);n.update(undefined,!1,
|
|
|
|
+D);D.matrixWorldInverse.flattenToArray(Za);D.projectionMatrix.flattenToArray(Xa);Ja.multiply(D.projectionMatrix,D.matrixWorldInverse);k(Ja);this.initWebGLObjects(n);va(x);(this.autoClear||v)&&this.clear();T=n.__webglObjects.length;for(v=0;v<T;v++){z=n.__webglObjects[v];I=z.object;if(I.visible)if(!(I instanceof THREE.Mesh)||m(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);J(I,D);t(z);z.render=!0;if(this.sortObjects){Ta.copy(I.position);Ja.multiplyVector3(Ta);z.z=Ta.z}}else z.render=!1;else z.render=
|
|
|
|
+!1}this.sortObjects&&n.__webglObjects.sort(y);H=n.__webglObjectsImmediate.length;for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);J(I,D);p(z)}}V(THREE.NormalBlending);for(v=0;v<T;v++){z=n.__webglObjects[v];if(z.render){I=z.object;L=z.buffer;K=z.opaque;h(I);for(z=0;z<K.count;z++){G=K.list[z];j(G.depthTest);f(D,Z,Y,G,L,I)}}}for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){K=z.opaque;
|
|
|
|
+h(I);for(z=0;z<K.count;z++){G=K.list[z];j(G.depthTest);Q=c(D,Z,Y,G,I);I.render(function(ra){g(ra,Q,G.shading)})}}}for(v=0;v<T;v++){z=n.__webglObjects[v];if(z.render){I=z.object;L=z.buffer;K=z.transparent;h(I);for(z=0;z<K.count;z++){G=K.list[z];V(G.blending);j(G.depthTest);f(D,Z,Y,G,L,I)}}}for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){K=z.transparent;h(I);for(z=0;z<K.count;z++){G=K.list[z];V(G.blending);j(G.depthTest);Q=c(D,Z,Y,G,I);I.render(function(ra){g(ra,Q,G.shading)})}}}n.__webglSprites.length&&
|
|
|
|
+A(n,D);stencil&&n.__webglShadowVolumes.length&&n.lights.length&&u(n);n.__webglLensFlares.length&&F(n,D);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 D=
|
|
|
|
+n.__objectsAdded[0],x=n,v=void 0,z=void 0,Q=void 0;if(D._modelViewMatrix==undefined){D._modelViewMatrix=new THREE.Matrix4;D._normalMatrixArray=new Float32Array(9);D._modelViewMatrixArray=new Float32Array(16);D._objectMatrixArray=new Float32Array(16);D.matrixWorld.flattenToArray(D._objectMatrixArray)}if(D instanceof THREE.Mesh){z=D.geometry;z.geometryGroups==undefined&&U(z);for(v in z.geometryGroups){Q=z.geometryGroups[v];if(!Q.__webglVertexBuffer){var K=Q;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 G=void 0,T=void 0;K.__webglMorphTargetsBuffers=[];G=0;for(T=
|
|
|
|
+K.numMorphTargets;G<T;G++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}K=Q;G=D;var H=void 0,I=void 0,L=void 0;L=void 0;var Z=void 0,Y=void 0,ra=void 0,Ka=ra=T=0;I=void 0;L=void 0;var Ca=void 0;H=void 0;I=void 0;Z=G.geometry;Ca=Z.faces;Y=K.faces;H=0;for(I=Y.length;H<I;H++){L=Y[H];L=Ca[L];if(L instanceof THREE.Face3){T+=3;ra+=1;Ka+=3}else if(L instanceof THREE.Face4){T+=4;ra+=2;Ka+=4}}H=K;I=G;Ca=void 0;Y=void 0;var Ha=void 0,Ga=void 0;Ha=void 0;L=[];Ca=0;for(Y=I.materials.length;Ca<Y;Ca++){Ha=
|
|
|
|
+I.materials[Ca];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=H.materials.length;Ha<l;Ha++)(Ga=H.materials[Ha])&&L.push(Ga)}else(Ga=Ha)&&L.push(Ga)}H=L;a:{I=void 0;Ca=void 0;Y=H.length;for(I=0;I<Y;I++){Ca=H[I];if(Ca.map||Ca.lightMap||Ca instanceof THREE.MeshShaderMaterial){I=!0;break a}}I=!1}a:{Ca=H;Y=void 0;L=void 0;Ha=Ca.length;for(Y=0;Y<Ha;Y++){L=Ca[Y];if(!(L instanceof THREE.MeshBasicMaterial&&!L.envMap||L instanceof THREE.MeshDepthMaterial)){Ca=L&&L.shading!=undefined&&L.shading==THREE.SmoothShading?
|
|
|
|
+THREE.SmoothShading:THREE.FlatShading;break a}}Ca=!1}a:{Y=void 0;L=void 0;Ha=H.length;for(Y=0;Y<Ha;Y++){L=H[Y];if(L.vertexColors){L=L.vertexColors;break a}}L=!1}K.__vertexArray=new Float32Array(T*3);if(Ca)K.__normalArray=new Float32Array(T*3);if(Z.hasTangents)K.__tangentArray=new Float32Array(T*4);if(L)K.__colorArray=new Float32Array(T*3);if(I){if(Z.faceUvs.length>0||Z.faceVertexUvs.length>0)K.__uvArray=new Float32Array(T*2);if(Z.faceUvs.length>1||Z.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(T*
|
|
|
|
+2)}if(G.geometry.skinWeights.length&&G.geometry.skinIndices.length){K.__skinVertexAArray=new Float32Array(T*4);K.__skinVertexBArray=new Float32Array(T*4);K.__skinIndexArray=new Float32Array(T*4);K.__skinWeightArray=new Float32Array(T*4)}K.__faceArray=new Uint16Array(ra*3+(G.geometry.edgeFaces?G.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(T*3))}K.__needsSmoothNormals=
|
|
|
|
+Ca==THREE.SmoothShading;K.__uvType=I;K.__vertexColorType=L;K.__normalType=Ca;K.__webglFaceCount=ra*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0);K.__webglLineCount=Ka*2;Z=0;for(Y=H.length;Z<Y;Z++)if(H[Z].attributes){K.__webglCustomAttributes={};for(a in H[Z].attributes){I=H[Z].attributes[a];if(!I.__webglInitialized||I.createUniqueBuffers){I.__webglInitialized=!0;ra=1;if(I.type==="v2")ra=2;else if(I.type==="v3")ra=3;else if(I.type==="v4")ra=4;else I.type==="c"&&(ra=3);I.size=ra;I.needsUpdate=
|
|
|
|
+!0;I.array=new Float32Array(T*ra);I.buffer=e.createBuffer();I.buffer.belongsToAttribute=a}K.__webglCustomAttributes[a]=I}}z.__dirtyVertices=!0;z.__dirtyMorphTargets=!0;z.__dirtyElements=!0;z.__dirtyUvs=!0;z.__dirtyNormals=!0;z.__dirtyTangents=!0;z.__dirtyColors=!0}D instanceof THREE.ShadowVolume?C(x.__webglShadowVolumes,Q,D):C(x.__webglObjects,Q,D)}}else if(D instanceof THREE.LensFlare)C(x.__webglLensFlares,undefined,D);else if(D instanceof THREE.Ribbon){z=D.geometry;if(!z.__webglVertexBuffer){v=
|
|
|
|
+z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*3);v.__webglVertexCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(D instanceof THREE.Line){z=D.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*
|
|
|
|
+3);v.__webglLineCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(D instanceof THREE.ParticleSystem){z=D.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*3);v.__sortArray=[];v.__webglParticleCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(THREE.MarchingCubes!==undefined&&D instanceof
|
|
|
|
+THREE.MarchingCubes)x.__webglObjectsImmediate.push({object:D,opaque:{list:[],count:0},transparent:{list:[],count:0}});else D instanceof THREE.Sprite&&x.__webglSprites.push(D);n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){D=n.__objectsRemoved[0];x=n;z=void 0;v=void 0;if(D instanceof THREE.Mesh)for(z=x.__webglObjects.length-1;z>=0;z--){v=x.__webglObjects[z].object;if(D==v){x.__webglObjects.splice(z,1);break}}else if(D instanceof THREE.Sprite)for(z=x.__webglSprites.length-1;z>=0;z--){v=
|
|
|
|
+x.__webglSprites[z];if(D==v){x.__webglSprites.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}D=0;for(x=n.__webglObjects.length;D<x;D++)B(n.__webglObjects[D].object,n);D=0;for(x=n.__webglShadowVolumes.length;D<x;D++)B(n.__webglShadowVolumes[D].object,n);D=0;for(x=n.__webglLensFlares.length;D<x;D++)B(n.__webglLensFlares[D].object,n)};this.setFaceCulling=function(n,D){if(n){!D||D=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(n=="back")e.cullFace(e.BACK);else n=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);
|
|
|
|
+e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
|
+THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBAFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==
|
|
|
|
+undefined?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==undefined?c.stencilBuffer:!0};
|
|
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,c){c&&b.update(undefined,!1,d);c=b.sounds;var f,g=c.length;for(f=0;f<g;f++){b=c[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,c){c&&b.update(undefined,!1,d);c=b.sounds;var f,g=c.length;for(f=0;f<g;f++){b=c[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
|
|
THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
|
|
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
@@ -375,7 +375,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}"},
|
|
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}",
|
|
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}};
|
|
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.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=
|
|
|
|
|
|
+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=
|
|
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.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=
|
|
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=
|
|
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,14 +387,14 @@ this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.o
|
|
THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
|
|
THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
|
|
THREE.PathCamera=function(b){function d(o,p,t,y){var u={name:t,fps:0.6,length:y,hierarchy:[]},A,F=p.getControlPointsArray(),J=p.getLength(),B=F.length,U=0;A=B-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[A]={time:y,pos:F[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<B-1;A++){U=y*J.chunks[A]/J.total;p.keys[A]={time:U,pos:F[A]}}u.hierarchy[0]=p;THREE.AnimationHandler.add(u);return new THREE.Animation(o,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(o,p){var t,
|
|
THREE.PathCamera=function(b){function d(o,p,t,y){var u={name:t,fps:0.6,length:y,hierarchy:[]},A,F=p.getControlPointsArray(),J=p.getLength(),B=F.length,U=0;A=B-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[A]={time:y,pos:F[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<B-1;A++){U=y*J.chunks[A]/J.total;p.keys[A]={time:U,pos:F[A]}}u.hierarchy[0]=p;THREE.AnimationHandler.add(u);return new THREE.Animation(o,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(o,p){var t,
|
|
y,u=new THREE.Geometry;for(t=0;t<o.points.length*p;t++){y=t/(o.points.length*p);y=o.getPoint(y);u.vertices[t]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return u}function f(o,p){var t=c(p,10),y=c(p,10),u=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,u);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);y=new THREE.Sphere(1,
|
|
y,u=new THREE.Geometry;for(t=0;t<o.points.length*p;t++){y=t/(o.points.length*p);y=o.getPoint(y);u.vertices[t]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return u}function f(o,p){var t=c(p,10),y=c(p,10),u=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,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<p.points.length;i++){t=new THREE.Mesh(y,u);t.position.copy(p.points[i]);t.updateMatrix();o.addChild(t)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
|
|
|
|
|
|
+16,8);u=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){t=new THREE.Mesh(y,u);t.position.copy(p.points[i]);t.updateMatrix();o.addChild(t)}}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=
|
|
!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
|
|
!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
|
|
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=
|
|
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,p,t){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.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,p,t){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,p,t)};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.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,p,t)};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=
|
|
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,p){return function(){p.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;
|
|
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,p){return function(){p.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.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=
|
|
|
|
|
|
+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=
|
|
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=
|
|
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()}};
|
|
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;
|
|
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;
|
|
@@ -412,8 +412,8 @@ this.matrix.n23*B;this.position.z-=this.matrix.n33*B};this.rotateHorizontally=fu
|
|
function(B){u=(B.clientX-F)/window.innerWidth;A=(B.clientY-J)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(B){switch(B.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;
|
|
function(B){u=(B.clientX-F)/window.innerWidth;A=(B.clientY-J)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(B){switch(B.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;
|
|
case 40:case 83:p=-1;break;case 39:case 68:t=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:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=0;break;case 39:case 68:t=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:y=0;break;case 70:y=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
case 40:case 83:p=-1;break;case 39:case 68:t=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:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=0;break;case 39:case 68:t=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:y=0;break;case 70:y=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
|
|
THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
|
|
-THREE.Cube=function(b,d,c,f,g,h,j,k,m){function o(J,B,U,C,V,O,M,va){var la,qa,fa=f||1,ia=g||1,e=V/2,oa=O/2,Da=p.vertices.length;if(J=="x"&&B=="y"||J=="y"&&B=="x")la="z";else if(J=="x"&&B=="z"||J=="z"&&B=="x"){la="y";ia=h||1}else if(J=="z"&&B=="y"||J=="y"&&B=="z"){la="x";fa=h||1}var Aa=fa+1,da=ia+1;V/=fa;var ea=O/ia;for(qa=0;qa<da;qa++)for(O=0;O<Aa;O++){var wa=new THREE.Vector3;wa[J]=(O*V-e)*U;wa[B]=(qa*ea-oa)*C;wa[la]=M;p.vertices.push(new THREE.Vertex(wa))}for(qa=0;qa<ia;qa++)for(O=0;O<fa;O++){p.faces.push(new THREE.Face4(O+
|
|
|
|
-Aa*qa+Da,O+Aa*(qa+1)+Da,O+1+Aa*(qa+1)+Da,O+1+Aa*qa+Da,null,null,va));p.faceVertexUvs[0].push([new THREE.UV(O/fa,qa/ia),new THREE.UV(O/fa,(qa+1)/ia),new THREE.UV((O+1)/fa,(qa+1)/ia),new THREE.UV((O+1)/fa,qa/ia)])}}THREE.Geometry.call(this);var p=this,t=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 F in m)this.sides[F]!=
|
|
|
|
|
|
+THREE.Cube=function(b,d,c,f,g,h,j,k,m){function o(J,B,U,C,V,O,M,va){var la,qa,ga=f||1,ea=g||1,e=V/2,oa=O/2,Da=p.vertices.length;if(J=="x"&&B=="y"||J=="y"&&B=="x")la="z";else if(J=="x"&&B=="z"||J=="z"&&B=="x"){la="y";ea=h||1}else if(J=="z"&&B=="y"||J=="y"&&B=="z"){la="x";ga=h||1}var Aa=ga+1,da=ea+1;V/=ga;var fa=O/ea;for(qa=0;qa<da;qa++)for(O=0;O<Aa;O++){var wa=new THREE.Vector3;wa[J]=(O*V-e)*U;wa[B]=(qa*fa-oa)*C;wa[la]=M;p.vertices.push(new THREE.Vertex(wa))}for(qa=0;qa<ea;qa++)for(O=0;O<ga;O++){p.faces.push(new THREE.Face4(O+
|
|
|
|
+Aa*qa+Da,O+Aa*(qa+1)+Da,O+1+Aa*(qa+1)+Da,O+1+Aa*qa+Da,null,null,va));p.faceVertexUvs[0].push([new THREE.UV(O/ga,qa/ea),new THREE.UV(O/ga,(qa+1)/ea),new THREE.UV((O+1)/ga,(qa+1)/ea),new THREE.UV((O+1)/ga,qa/ea)])}}THREE.Geometry.call(this);var p=this,t=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 F in m)this.sides[F]!=
|
|
undefined&&(this.sides[F]=m[F]);this.sides.px&&o("z","y",1*k,-1,c,d,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,c,d,t,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 J=[],B=[],U=0,C=p.vertices.length;U<C;U++){for(var V=p.vertices[U],O=!1,M=0,va=J.length;M<va;M++){var la=
|
|
undefined&&(this.sides[F]=m[F]);this.sides.px&&o("z","y",1*k,-1,c,d,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,c,d,t,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 J=[],B=[],U=0,C=p.vertices.length;U<C;U++){for(var V=p.vertices[U],O=!1,M=0,va=J.length;M<va;M++){var la=
|
|
J[M];if(V.position.x==la.position.x&&V.position.y==la.position.y&&V.position.z==la.position.z){B[U]=M;O=!0;break}}if(!O){B[U]=J.length;J.push(new THREE.Vertex(V.position.clone()))}}U=0;for(C=p.faces.length;U<C;U++){V=p.faces[U];V.a=B[V.a];V.b=B[V.b];V.c=B[V.c];V.d=B[V.d]}p.vertices=J})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
|
|
J[M];if(V.position.x==la.position.x&&V.position.y==la.position.y&&V.position.z==la.position.z){B[U]=M;O=!0;break}}if(!O){B[U]=J.length;J.push(new THREE.Vertex(V.position.clone()))}}U=0;for(C=p.faces.length;U<C;U++){V=p.faces[U];V.a=B[V.a];V.b=B[V.b];V.c=B[V.c];V.d=B[V.d]}p.vertices=J})();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,p=f/2;for(m=0;m<b;m++)j(Math.sin(o*m/b)*d,Math.cos(o*m/b)*d,-p);for(m=0;m<b;m++)j(Math.sin(o*m/b)*c,Math.cos(o*m/b)*c,p);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,-p-(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,p+(g||0));
|
|
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,p=f/2;for(m=0;m<b;m++)j(Math.sin(o*m/b)*d,Math.cos(o*m/b)*d,-p);for(m=0;m<b;m++)j(Math.sin(o*m/b)*c,Math.cos(o*m/b)*c,p);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,-p-(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,p+(g||0));
|
|
@@ -422,7 +422,7 @@ f));c instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.
|
|
THREE.Icosahedron=function(b){function d(t,y,u){var A=Math.sqrt(t*t+y*y+u*u);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/A,y/A,u/A)))-1}function c(t,y,u,A){A.faces.push(new THREE.Face3(t,y,u))}function f(t,y){var u=g.vertices[t].position,A=g.vertices[y].position;return d((u.x+A.x)/2,(u.y+A.y)/2,(u.z+A.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
|
|
THREE.Icosahedron=function(b){function d(t,y,u){var A=Math.sqrt(t*t+y*y+u*u);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/A,y/A,u/A)))-1}function c(t,y,u,A){A.faces.push(new THREE.Face3(t,y,u))}function f(t,y){var u=g.vertices[t].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),p=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,m,p,j);c(h.faces[k].b,o,m,j);c(h.faces[k].c,
|
|
1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var m=f(h.faces[k].a,h.faces[k].b),o=f(h.faces[k].b,h.faces[k].c),p=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,m,p,j);c(h.faces[k].b,o,m,j);c(h.faces[k].c,
|
|
p,o,j);c(m,o,p,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;
|
|
p,o,j);c(m,o,p,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
|
|
-THREE.Lathe=function(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;c=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(d),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));c[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.0010;m+=d){for(k=0;k<c.length;k++)if(m<this.angle){c[k]=j.multiplyVector3(c[k].clone());this.vertices.push(new THREE.Vertex(c[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);
|
|
|
|
|
|
+THREE.Lathe=function(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;c=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(d),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));c[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.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);
|
|
for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
|
|
for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
|
|
THREE.Plane=function(b,d,c,f){THREE.Geometry.call(this);var g,h=b/2,j=d/2;c=c||1;f=f||1;var k=c+1,m=f+1;b/=c;var o=d/f;for(g=0;g<m;g++)for(d=0;d<k;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*b-h,-(g*o-j),0)));for(g=0;g<f;g++)for(d=0;d<c;d++){this.faces.push(new THREE.Face4(d+k*g,d+k*(g+1),d+1+k*(g+1),d+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(d/c,g/f),new THREE.UV(d/c,(g+1)/f),new THREE.UV((d+1)/c,(g+1)/f),new THREE.UV((d+1)/c,g/f)])}this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.Plane=function(b,d,c,f){THREE.Geometry.call(this);var g,h=b/2,j=d/2;c=c||1;f=f||1;var k=c+1,m=f+1;b/=c;var o=d/f;for(g=0;g<m;g++)for(d=0;d<k;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*b-h,-(g*o-j),0)));for(g=0;g<f;g++)for(d=0;d<c;d++){this.faces.push(new THREE.Face4(d+k*g,d+k*(g+1),d+1+k*(g+1),d+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(d/c,g/f),new THREE.UV(d/c,(g+1)/f),new THREE.UV((d+1)/c,(g+1)/f),new THREE.UV((d+1)/c,g/f)])}this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
|
|
THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
|
|
@@ -450,39 +450,39 @@ j=b.edges[g+1];f.edges.push(new THREE.Edge(f.vertices[h],f.vertices[j],h,j))}}})
|
|
THREE.BinaryLoader.prototype={load:function(b){var d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,c,g,f,h)};d.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
|
|
THREE.BinaryLoader.prototype={load:function(b){var d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,c,g,f,h)};d.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
|
|
d.postMessage(b)},loadAjaxBuffers:function(b,d,c,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,c,g,d):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){m==0&&(m=j.getResponseHeader("Content-Length"));h({total:m,loaded:j.responseText.length})}}else j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
|
|
d.postMessage(b)},loadAjaxBuffers:function(b,d,c,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,c,g,d):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){m==0&&(m=j.getResponseHeader("Content-Length"));h({total:m,loaded:j.responseText.length})}}else j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
|
|
j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(R,S){var P=p(R,S),Ba=p(R,S+1),La=p(R,S+2),n=p(R,S+3),D=(n<<1&255|La>>7)-127;P|=(La&127)<<16|Ba<<8;if(P==0&&D==-127)return 0;return(1-2*(n>>7))*(1+P*Math.pow(2,-23))*Math.pow(2,D)}function k(R,S){var P=p(R,S),Ba=p(R,S+1),La=p(R,S+2);return(p(R,S+3)<<24)+(La<<16)+(Ba<<8)+P}function m(R,S){var P=p(R,S);return(p(R,S+1)<<8)+P}function o(R,S){var P=p(R,S);return P>127?P-256:P}function p(R,
|
|
j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(R,S){var P=p(R,S),Ba=p(R,S+1),La=p(R,S+2),n=p(R,S+3),D=(n<<1&255|La>>7)-127;P|=(La&127)<<16|Ba<<8;if(P==0&&D==-127)return 0;return(1-2*(n>>7))*(1+P*Math.pow(2,-23))*Math.pow(2,D)}function k(R,S){var P=p(R,S),Ba=p(R,S+1),La=p(R,S+2);return(p(R,S+3)<<24)+(La<<16)+(Ba<<8)+P}function m(R,S){var P=p(R,S);return(p(R,S+1)<<8)+P}function o(R,S){var P=p(R,S);return P>127?P-256:P}function p(R,
|
|
-S){return R.charCodeAt(S)&255}function t(R){var S,P,Ba;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);R=m(b,R+la);THREE.BinaryLoader.prototype.f3(B,S,P,Ba,R)}function y(R){var S,P,Ba,La,n,D;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);La=m(b,R+la);n=k(b,R+qa);D=k(b,R+fa);R=k(b,R+ia);THREE.BinaryLoader.prototype.f3n(B,V,S,P,Ba,La,n,D,R)}function u(R){var S,P,Ba,La;S=k(b,R);P=k(b,R+e);Ba=k(b,R+oa);La=k(b,R+Da);R=m(b,R+Aa);THREE.BinaryLoader.prototype.f4(B,S,P,Ba,La,R)}function A(R){var S,P,Ba,La,n,D,x,v;S=k(b,R);P=k(b,R+e);
|
|
|
|
-Ba=k(b,R+oa);La=k(b,R+Da);n=m(b,R+Aa);D=k(b,R+da);x=k(b,R+ea);v=k(b,R+wa);R=k(b,R+ta);THREE.BinaryLoader.prototype.f4n(B,V,S,P,Ba,La,n,D,x,v,R)}function F(R){var S,P;S=k(b,R);P=k(b,R+pa);R=k(b,R+ca);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[R*2],O[R*2+1])}function J(R){var S,P,Ba;S=k(b,R);P=k(b,R+ka);Ba=k(b,R+ma);R=k(b,R+Fa);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[Ba*2],O[Ba*2+1],O[R*2],O[R*2+1])}var B=this,
|
|
|
|
-U=0,C,V=[],O=[],M,va,la,qa,fa,ia,e,oa,Da,Aa,da,ea,wa,ta,pa,ca,ka,ma,Fa,ja,ga,Ja,Xa,Za,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,f,h);C={signature:b.substr(U,8),header_bytes:p(b,U+8),vertex_coordinate_bytes:p(b,U+9),normal_coordinate_bytes:p(b,U+10),uv_coordinate_bytes:p(b,U+11),vertex_index_bytes:p(b,U+12),normal_index_bytes:p(b,U+13),uv_index_bytes:p(b,U+14),material_index_bytes:p(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+=C.header_bytes;M=C.vertex_index_bytes;va=C.vertex_index_bytes*2;la=C.vertex_index_bytes*3;qa=C.vertex_index_bytes*3+C.material_index_bytes;fa=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;ia=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;e=C.vertex_index_bytes;oa=C.vertex_index_bytes*
|
|
|
|
-2;Da=C.vertex_index_bytes*3;Aa=C.vertex_index_bytes*4;da=C.vertex_index_bytes*4+C.material_index_bytes;ea=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;wa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ta=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;pa=C.uv_index_bytes;ca=C.uv_index_bytes*2;ka=C.uv_index_bytes;ma=C.uv_index_bytes*2;Fa=C.uv_index_bytes*3;h=C.vertex_index_bytes*3+C.material_index_bytes;Ta=C.vertex_index_bytes*4+C.material_index_bytes;
|
|
|
|
-ja=C.ntri_flat*h;ga=C.ntri_smooth*(h+C.normal_index_bytes*3);Ja=C.ntri_flat_uv*(h+C.uv_index_bytes*3);Xa=C.ntri_smooth_uv*(h+C.normal_index_bytes*3+C.uv_index_bytes*3);Za=C.nquad_flat*Ta;h=C.nquad_smooth*(Ta+C.normal_index_bytes*4);Ta=C.nquad_flat_uv*(Ta+C.uv_index_bytes*4);U+=function(R){for(var S,P,Ba,La=C.vertex_coordinate_bytes*3,n=R+C.nvertices*La;R<n;R+=La){S=j(b,R);P=j(b,R+C.vertex_coordinate_bytes);Ba=j(b,R+C.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(B,S,P,Ba)}return C.nvertices*
|
|
|
|
-La}(U);U+=function(R){for(var S,P,Ba,La=C.normal_coordinate_bytes*3,n=R+C.nnormals*La;R<n;R+=La){S=o(b,R);P=o(b,R+C.normal_coordinate_bytes);Ba=o(b,R+C.normal_coordinate_bytes*2);V.push(S/127,P/127,Ba/127)}return C.nnormals*La}(U);U+=function(R){for(var S,P,Ba=C.uv_coordinate_bytes*2,La=R+C.nuvs*Ba;R<La;R+=Ba){S=j(b,R);P=j(b,R+C.uv_coordinate_bytes);O.push(S,P)}return C.nuvs*Ba}(U);ja=U+ja;ga=ja+ga;Ja=ga+Ja;Xa=Ja+Xa;Za=Xa+Za;h=Za+h;Ta=h+Ta;(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes,
|
|
|
|
-Ba=P+C.uv_index_bytes*3,La=R+C.ntri_flat_uv*Ba;for(S=R;S<La;S+=Ba){t(S);F(S+P)}return La-R})(ga);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,Ba=P+C.uv_index_bytes*3,La=R+C.ntri_smooth_uv*Ba;for(S=R;S<La;S+=Ba){y(S);F(S+P)}return La-R})(Ja);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes,Ba=P+C.uv_index_bytes*4,La=R+C.nquad_flat_uv*Ba;for(S=R;S<La;S+=Ba){u(S);J(S+P)}return La-R})(h);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes+
|
|
|
|
|
|
+S){return R.charCodeAt(S)&255}function t(R){var S,P,Ba;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);R=m(b,R+la);THREE.BinaryLoader.prototype.f3(B,S,P,Ba,R)}function y(R){var S,P,Ba,La,n,D;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);La=m(b,R+la);n=k(b,R+qa);D=k(b,R+ga);R=k(b,R+ea);THREE.BinaryLoader.prototype.f3n(B,V,S,P,Ba,La,n,D,R)}function u(R){var S,P,Ba,La;S=k(b,R);P=k(b,R+e);Ba=k(b,R+oa);La=k(b,R+Da);R=m(b,R+Aa);THREE.BinaryLoader.prototype.f4(B,S,P,Ba,La,R)}function A(R){var S,P,Ba,La,n,D,x,v;S=k(b,R);P=k(b,R+e);
|
|
|
|
+Ba=k(b,R+oa);La=k(b,R+Da);n=m(b,R+Aa);D=k(b,R+da);x=k(b,R+fa);v=k(b,R+wa);R=k(b,R+ta);THREE.BinaryLoader.prototype.f4n(B,V,S,P,Ba,La,n,D,x,v,R)}function F(R){var S,P;S=k(b,R);P=k(b,R+pa);R=k(b,R+ca);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[R*2],O[R*2+1])}function J(R){var S,P,Ba;S=k(b,R);P=k(b,R+ka);Ba=k(b,R+ma);R=k(b,R+Fa);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[Ba*2],O[Ba*2+1],O[R*2],O[R*2+1])}var B=this,
|
|
|
|
+U=0,C,V=[],O=[],M,va,la,qa,ga,ea,e,oa,Da,Aa,da,fa,wa,ta,pa,ca,ka,ma,Fa,ja,ha,Ja,Xa,Za,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,f,h);C={signature:b.substr(U,8),header_bytes:p(b,U+8),vertex_coordinate_bytes:p(b,U+9),normal_coordinate_bytes:p(b,U+10),uv_coordinate_bytes:p(b,U+11),vertex_index_bytes:p(b,U+12),normal_index_bytes:p(b,U+13),uv_index_bytes:p(b,U+14),material_index_bytes:p(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+=C.header_bytes;M=C.vertex_index_bytes;va=C.vertex_index_bytes*2;la=C.vertex_index_bytes*3;qa=C.vertex_index_bytes*3+C.material_index_bytes;ga=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;ea=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;e=C.vertex_index_bytes;oa=C.vertex_index_bytes*
|
|
|
|
+2;Da=C.vertex_index_bytes*3;Aa=C.vertex_index_bytes*4;da=C.vertex_index_bytes*4+C.material_index_bytes;fa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;wa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ta=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;pa=C.uv_index_bytes;ca=C.uv_index_bytes*2;ka=C.uv_index_bytes;ma=C.uv_index_bytes*2;Fa=C.uv_index_bytes*3;h=C.vertex_index_bytes*3+C.material_index_bytes;Ta=C.vertex_index_bytes*4+C.material_index_bytes;
|
|
|
|
+ja=C.ntri_flat*h;ha=C.ntri_smooth*(h+C.normal_index_bytes*3);Ja=C.ntri_flat_uv*(h+C.uv_index_bytes*3);Xa=C.ntri_smooth_uv*(h+C.normal_index_bytes*3+C.uv_index_bytes*3);Za=C.nquad_flat*Ta;h=C.nquad_smooth*(Ta+C.normal_index_bytes*4);Ta=C.nquad_flat_uv*(Ta+C.uv_index_bytes*4);U+=function(R){for(var S,P,Ba,La=C.vertex_coordinate_bytes*3,n=R+C.nvertices*La;R<n;R+=La){S=j(b,R);P=j(b,R+C.vertex_coordinate_bytes);Ba=j(b,R+C.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(B,S,P,Ba)}return C.nvertices*
|
|
|
|
+La}(U);U+=function(R){for(var S,P,Ba,La=C.normal_coordinate_bytes*3,n=R+C.nnormals*La;R<n;R+=La){S=o(b,R);P=o(b,R+C.normal_coordinate_bytes);Ba=o(b,R+C.normal_coordinate_bytes*2);V.push(S/127,P/127,Ba/127)}return C.nnormals*La}(U);U+=function(R){for(var S,P,Ba=C.uv_coordinate_bytes*2,La=R+C.nuvs*Ba;R<La;R+=Ba){S=j(b,R);P=j(b,R+C.uv_coordinate_bytes);O.push(S,P)}return C.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(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes,
|
|
|
|
+Ba=P+C.uv_index_bytes*3,La=R+C.ntri_flat_uv*Ba;for(S=R;S<La;S+=Ba){t(S);F(S+P)}return La-R})(ha);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,Ba=P+C.uv_index_bytes*3,La=R+C.ntri_smooth_uv*Ba;for(S=R;S<La;S+=Ba){y(S);F(S+P)}return La-R})(Ja);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes,Ba=P+C.uv_index_bytes*4,La=R+C.nquad_flat_uv*Ba;for(S=R;S<La;S+=Ba){u(S);J(S+P)}return La-R})(h);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes+
|
|
C.normal_index_bytes*4,Ba=P+C.uv_index_bytes*4,La=R+C.nquad_smooth_uv*Ba;for(S=R;S<La;S+=Ba){A(S);J(S+P)}return La-R})(Ta);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes,Ba=R+C.ntri_flat*P;for(S=R;S<Ba;S+=P)t(S);return Ba-R})(U);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,Ba=R+C.ntri_smooth*P;for(S=R;S<Ba;S+=P)y(S);return Ba-R})(ja);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes,Ba=R+C.nquad_flat*P;for(S=R;S<Ba;S+=
|
|
C.normal_index_bytes*4,Ba=P+C.uv_index_bytes*4,La=R+C.nquad_smooth_uv*Ba;for(S=R;S<La;S+=Ba){A(S);J(S+P)}return La-R})(Ta);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes,Ba=R+C.ntri_flat*P;for(S=R;S<Ba;S+=P)t(S);return Ba-R})(U);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,Ba=R+C.ntri_smooth*P;for(S=R;S<Ba;S+=P)y(S);return Ba-R})(ja);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes,Ba=R+C.nquad_flat*P;for(S=R;S<Ba;S+=
|
|
P)u(S);return Ba-R})(Xa);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,Ba=R+C.nquad_smooth*P;for(S=R;S<Ba;S+=P)A(S);return Ba-R})(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,
|
|
P)u(S);return Ba-R})(Xa);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,Ba=R+C.nquad_smooth*P;for(S=R;S<Ba;S+=P)A(S);return Ba-R})(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],p=d[k*3+1];k=d[k*3+2];var t=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,p,k),new THREE.Vector3(t,y,m)],null,h))},f4n:function(b,d,c,f,g,h,j,k,m,o,p){j=b.materials[j];var t=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 F=d[p*3],J=d[p*3+1];p=d[p*3+2];b.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(d[k*
|
|
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],p=d[k*3+1];k=d[k*3+2];var t=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,p,k),new THREE.Vector3(t,y,m)],null,h))},f4n:function(b,d,c,f,g,h,j,k,m,o,p){j=b.materials[j];var t=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 F=d[p*3],J=d[p*3+1];p=d[p*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(t,y,m),new THREE.Vector3(u,A,o),new THREE.Vector3(F,J,p)],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)}};
|
|
3],d[k*3+1],d[k*3+2]),new THREE.Vector3(t,y,m),new THREE.Vector3(u,A,o),new THREE.Vector3(F,J,p)],null,j))},uv3:function(b,d,c,f,g,h,j){var k=[];k.push(new THREE.UV(d,c));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,d,c,f,g,h,j,k,m){var o=[];o.push(new THREE.UV(d,c));o.push(new THREE.UV(f,g));o.push(new THREE.UV(h,j));o.push(new THREE.UV(k,m));b.push(o)}};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
-THREE.SceneLoader.prototype={load:function(b,d){var c=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(h){function j(pa,ca){return ca=="relativeToHTML"?pa:g+"/"+pa}function k(){for(u in fa.objects)if(!da.objects[u]){U=fa.objects[u];if(U.geometry!==undefined){if(M=da.geometries[U.geometry]){qa=[];for(ta=0;ta<U.materials.length;ta++)qa[ta]=da.materials[U.materials[ta]];C=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;qa.length==0&&(qa[0]=
|
|
|
|
|
|
+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(M=da.geometries[U.geometry]){qa=[];for(ta=0;ta<U.materials.length;ta++)qa[ta]=da.materials[U.materials[ta]];C=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;qa.length==0&&(qa[0]=
|
|
new THREE.MeshFaceMaterial);qa.length>1&&(qa=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,qa);object.name=u;object.position.set(C[0],C[1],C[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.MeshFaceMaterial);qa.length>1&&(qa=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,qa);object.name=u;object.position.set(C[0],C[1],C[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(M);da.scene.addChild(pa);pa.position=object.position;pa.rotation=object.rotation;pa.scale=object.scale}U.trigger&&U.trigger.toLowerCase()!="none"&&(da.triggers[object.name]={type:U.trigger,object:U})}}else{C=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;object=new THREE.Object3D;object.name=u;object.position.set(C[0],C[1],C[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],
|
|
new THREE.ShadowVolume(M);da.scene.addChild(pa);pa.position=object.position;pa.rotation=object.rotation;pa.scale=object.scale}U.trigger&&U.trigger.toLowerCase()!="none"&&(da.triggers[object.name]={type:U.trigger,object:U})}}else{C=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;object=new THREE.Object3D;object.name=u;object.position.set(C[0],C[1],C[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}}}function m(pa){return function(ca){da.geometries[pa]=ca;k();e-=1;c.onLoadComplete();p()}}function o(pa){return function(ca){da.geometries[pa]=ca}}function p(){c.callbackProgress({totalModels:Da,totalTextures:Aa,loadedModels:Da-e,loadedTextures:Aa-oa},da);c.onLoadProgress();e==0&&oa==0&&d(da)}var t,y,u,A,F,J,B,U,C,V,O,M,va,la,qa,fa,ia,e,oa,Da,Aa,da;fa=h.data;h=new THREE.BinaryLoader;
|
|
|
|
-ia=new THREE.JSONLoader;oa=e=0;da={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var ea=!1;for(u in fa.objects){U=fa.objects[u];if(U.meshCollider){ea=!0;break}}if(ea)da.scene.collisions=new THREE.CollisionSystem;if(fa.transform){ea=fa.transform.position;V=fa.transform.rotation;var wa=fa.transform.scale;ea&&da.scene.position.set(ea[0],ea[1],ea[2]);V&&da.scene.rotation.set(V[0],V[1],V[2]);wa&&da.scene.scale.set(wa[0],wa[1],
|
|
|
|
-wa[2]);(ea||V||wa)&&da.scene.updateMatrix()}ea=function(){oa-=1;p();c.onLoadComplete()};for(F in fa.cameras){V=fa.cameras[F];if(V.type=="perspective")va=new THREE.Camera(V.fov,V.aspect,V.near,V.far);else if(V.type=="ortho"){va=new THREE.Camera;va.projectionMatrix=THREE.Matrix4.makeOrtho(V.left,V.right,V.top,V.bottom,V.near,V.far)}C=V.position;V=V.target;va.position.set(C[0],C[1],C[2]);va.target.position.set(V[0],V[1],V[2]);da.cameras[F]=va}for(A in fa.lights){F=fa.lights[A];va=F.color!==undefined?
|
|
|
|
-F.color:16777215;V=F.intensity!==undefined?F.intensity:1;if(F.type=="directional"){C=F.direction;light=new THREE.DirectionalLight(va,V);light.position.set(C[0],C[1],C[2]);light.position.normalize()}else if(F.type=="point"){C=F.position;light=new THREE.PointLight(va,V);light.position.set(C[0],C[1],C[2])}da.scene.addLight(light);da.lights[A]=light}for(J in fa.fogs){A=fa.fogs[J];if(A.type=="linear")la=new THREE.Fog(0,A.near,A.far);else A.type=="exp2"&&(la=new THREE.FogExp2(0,A.density));V=A.color;la.color.setRGB(V[0],
|
|
|
|
-V[1],V[2]);da.fogs[J]=la}if(da.cameras&&fa.defaults.camera)da.currentCamera=da.cameras[fa.defaults.camera];if(da.fogs&&fa.defaults.fog)da.scene.fog=da.fogs[fa.defaults.fog];V=fa.defaults.bgcolor;da.bgColor=new THREE.Color;da.bgColor.setRGB(V[0],V[1],V[2]);da.bgColorAlpha=fa.defaults.bgalpha;for(t in fa.geometries){J=fa.geometries[t];if(J.type=="bin_mesh"||J.type=="ascii_mesh"){e+=1;c.onLoadStart()}}Da=e;for(t in fa.geometries){J=fa.geometries[t];if(J.type=="cube"){M=new THREE.Cube(J.width,J.height,
|
|
|
|
|
|
+s[2]);object.visible=U.visible!==undefined?U.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();p()}}function o(pa){return function(ca){da.geometries[pa]=ca}}function p(){c.callbackProgress({totalModels:Da,totalTextures:Aa,loadedModels:Da-e,loadedTextures:Aa-oa},da);c.onLoadProgress();e==0&&oa==0&&d(da)}var t,y,u,A,F,J,B,U,C,V,O,M,va,la,qa,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;V=ga.transform.rotation;var wa=ga.transform.scale;fa&&da.scene.position.set(fa[0],fa[1],fa[2]);V&&da.scene.rotation.set(V[0],V[1],V[2]);wa&&da.scene.scale.set(wa[0],wa[1],
|
|
|
|
+wa[2]);(fa||V||wa)&&da.scene.updateMatrix()}fa=function(){oa-=1;p();c.onLoadComplete()};for(F in ga.cameras){V=ga.cameras[F];if(V.type=="perspective")va=new THREE.Camera(V.fov,V.aspect,V.near,V.far);else if(V.type=="ortho"){va=new THREE.Camera;va.projectionMatrix=THREE.Matrix4.makeOrtho(V.left,V.right,V.top,V.bottom,V.near,V.far)}C=V.position;V=V.target;va.position.set(C[0],C[1],C[2]);va.target.position.set(V[0],V[1],V[2]);da.cameras[F]=va}for(A in ga.lights){F=ga.lights[A];va=F.color!==undefined?
|
|
|
|
+F.color:16777215;V=F.intensity!==undefined?F.intensity:1;if(F.type=="directional"){C=F.direction;light=new THREE.DirectionalLight(va,V);light.position.set(C[0],C[1],C[2]);light.position.normalize()}else if(F.type=="point"){C=F.position;light=new THREE.PointLight(va,V);light.position.set(C[0],C[1],C[2])}da.scene.addLight(light);da.lights[A]=light}for(J in ga.fogs){A=ga.fogs[J];if(A.type=="linear")la=new THREE.Fog(0,A.near,A.far);else A.type=="exp2"&&(la=new THREE.FogExp2(0,A.density));V=A.color;la.color.setRGB(V[0],
|
|
|
|
+V[1],V[2]);da.fogs[J]=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];V=ga.defaults.bgcolor;da.bgColor=new THREE.Color;da.bgColor.setRGB(V[0],V[1],V[2]);da.bgColorAlpha=ga.defaults.bgalpha;for(t in ga.geometries){J=ga.geometries[t];if(J.type=="bin_mesh"||J.type=="ascii_mesh"){e+=1;c.onLoadStart()}}Da=e;for(t in ga.geometries){J=ga.geometries[t];if(J.type=="cube"){M=new THREE.Cube(J.width,J.height,
|
|
J.depth,J.segmentsWidth,J.segmentsHeight,J.segmentsDepth,null,J.flipped,J.sides);da.geometries[t]=M}else if(J.type=="plane"){M=new THREE.Plane(J.width,J.height,J.segmentsWidth,J.segmentsHeight);da.geometries[t]=M}else if(J.type=="sphere"){M=new THREE.Sphere(J.radius,J.segmentsWidth,J.segmentsHeight);da.geometries[t]=M}else if(J.type=="cylinder"){M=new THREE.Cylinder(J.numSegs,J.topRad,J.botRad,J.height,J.topOffset,J.botOffset);da.geometries[t]=M}else if(J.type=="torus"){M=new THREE.Torus(J.radius,
|
|
J.depth,J.segmentsWidth,J.segmentsHeight,J.segmentsDepth,null,J.flipped,J.sides);da.geometries[t]=M}else if(J.type=="plane"){M=new THREE.Plane(J.width,J.height,J.segmentsWidth,J.segmentsHeight);da.geometries[t]=M}else if(J.type=="sphere"){M=new THREE.Sphere(J.radius,J.segmentsWidth,J.segmentsHeight);da.geometries[t]=M}else if(J.type=="cylinder"){M=new THREE.Cylinder(J.numSegs,J.topRad,J.botRad,J.height,J.topOffset,J.botOffset);da.geometries[t]=M}else if(J.type=="torus"){M=new THREE.Torus(J.radius,
|
|
-J.tube,J.segmentsR,J.segmentsT);da.geometries[t]=M}else if(J.type=="icosahedron"){M=new THREE.Icosahedron(J.subdivisions);da.geometries[t]=M}else if(J.type=="bin_mesh")h.load({model:j(J.url,fa.urlBaseType),callback:m(t)});else if(J.type=="ascii_mesh")ia.load({model:j(J.url,fa.urlBaseType),callback:m(t)});else if(J.type=="embedded_mesh")(J=fa.embeds[J.id])&&ia.createModel(J,o(t),"")}for(B in fa.textures){t=fa.textures[B];if(t.url instanceof Array){oa+=t.url.length;for(h=0;h<t.url.length;h++)c.onLoadStart()}else{oa+=
|
|
|
|
-1;c.onLoadStart()}}Aa=oa;for(B in fa.textures){t=fa.textures[B];if(t.mapping!=undefined&&THREE[t.mapping]!=undefined)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){h=[];for(var ta=0;ta<t.url.length;ta++)h[ta]=j(t.url[ta],fa.urlBaseType);h=THREE.ImageUtils.loadTextureCube(h,t.mapping,ea)}else{h=THREE.ImageUtils.loadTexture(j(t.url,fa.urlBaseType),t.mapping,ea);if(THREE[t.minFilter]!=undefined)h.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=undefined)h.magFilter=THREE[t.magFilter]}da.textures[B]=
|
|
|
|
-h}for(y in fa.materials){B=fa.materials[y];for(O in B.parameters)if(O=="envMap"||O=="map"||O=="lightMap")B.parameters[O]=da.textures[B.parameters[O]];else if(O=="shading")B.parameters[O]=B.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")B.parameters[O]=THREE[B.parameters[O]]?THREE[B.parameters[O]]:THREE.NormalBlending;else if(O=="combine")B.parameters[O]=B.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(O=="vertexColors")if(B.parameters[O]==
|
|
|
|
|
|
+J.tube,J.segmentsR,J.segmentsT);da.geometries[t]=M}else if(J.type=="icosahedron"){M=new THREE.Icosahedron(J.subdivisions);da.geometries[t]=M}else if(J.type=="bin_mesh")h.load({model:j(J.url,ga.urlBaseType),callback:m(t)});else if(J.type=="ascii_mesh")ea.load({model:j(J.url,ga.urlBaseType),callback:m(t)});else if(J.type=="embedded_mesh")(J=ga.embeds[J.id])&&ea.createModel(J,o(t),"")}for(B in ga.textures){t=ga.textures[B];if(t.url instanceof Array){oa+=t.url.length;for(h=0;h<t.url.length;h++)c.onLoadStart()}else{oa+=
|
|
|
|
+1;c.onLoadStart()}}Aa=oa;for(B in ga.textures){t=ga.textures[B];if(t.mapping!=undefined&&THREE[t.mapping]!=undefined)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){h=[];for(var ta=0;ta<t.url.length;ta++)h[ta]=j(t.url[ta],ga.urlBaseType);h=THREE.ImageUtils.loadTextureCube(h,t.mapping,fa)}else{h=THREE.ImageUtils.loadTexture(j(t.url,ga.urlBaseType),t.mapping,fa);if(THREE[t.minFilter]!=undefined)h.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=undefined)h.magFilter=THREE[t.magFilter]}da.textures[B]=
|
|
|
|
+h}for(y in ga.materials){B=ga.materials[y];for(O in B.parameters)if(O=="envMap"||O=="map"||O=="lightMap")B.parameters[O]=da.textures[B.parameters[O]];else if(O=="shading")B.parameters[O]=B.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")B.parameters[O]=THREE[B.parameters[O]]?THREE[B.parameters[O]]:THREE.NormalBlending;else if(O=="combine")B.parameters[O]=B.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(O=="vertexColors")if(B.parameters[O]==
|
|
"face")B.parameters[O]=THREE.FaceColors;else if(B.parameters[O])B.parameters[O]=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)}}};
|
|
"face")B.parameters[O]=THREE.FaceColors;else if(B.parameters[O])B.parameters[O]=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=
|
|
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,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=o;g[h]=this.lerp(p[c],p[c+3],j);g[h+1]=this.lerp(p[c+1],p[c+4],j);g[h+2]=this.lerp(p[c+2],p[c+5],j)};this.VIntY=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k;f[h+1]=m+j*this.delta;f[h+
|
|
0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,f,g){return c+(f-c)*g};this.VIntX=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=o;g[h]=this.lerp(p[c],p[c+3],j);g[h+1]=this.lerp(p[c+1],p[c+4],j);g[h+2]=this.lerp(p[c+2],p[c+5],j)};this.VIntY=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=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(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=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(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[f+2],j)};this.compNorm=function(c){var f=c*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[c-1]-this.field[c+1];this.normal_cache[f+1]=this.field[c-this.yd]-
|
|
2]=o;f=c+this.yd*3;g[h]=this.lerp(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=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(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[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,p=h+this.zd,t=m+this.yd,y=m+this.zd,u=h+this.yd+this.zd,A=m+this.yd+this.zd,F=0,J=this.field[h],B=this.field[m],U=this.field[o],C=this.field[t],V=this.field[p],O=this.field[y],M=this.field[u],va=this.field[A];J<j&&(F|=1);B<j&&(F|=2);U<j&&(F|=8);C<j&&(F|=4);V<j&&(F|=16);O<j&&(F|=32);M<j&&(F|=128);va<j&&(F|=64);var la=THREE.edgeTable[F];if(la==0)return 0;
|
|
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,p=h+this.zd,t=m+this.yd,y=m+this.zd,u=h+this.yd+this.zd,A=m+this.yd+this.zd,F=0,J=this.field[h],B=this.field[m],U=this.field[o],C=this.field[t],V=this.field[p],O=this.field[y],M=this.field[u],va=this.field[A];J<j&&(F|=1);B<j&&(F|=2);U<j&&(F|=8);C<j&&(F|=4);V<j&&(F|=16);O<j&&(F|=32);M<j&&(F|=128);va<j&&(F|=64);var la=THREE.edgeTable[F];if(la==0)return 0;
|
|
-var qa=this.delta,fa=c+qa,ia=f+qa;qa=g+qa;if(la&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,J,B)}if(la&2){this.compNorm(m);this.compNorm(t);this.VIntY(m*3,this.vlist,this.nlist,3,j,fa,f,g,B,C)}if(la&4){this.compNorm(o);this.compNorm(t);this.VIntX(o*3,this.vlist,this.nlist,6,j,c,ia,g,U,C)}if(la&8){this.compNorm(h);this.compNorm(o);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,J,U)}if(la&16){this.compNorm(p);this.compNorm(y);this.VIntX(p*3,this.vlist,this.nlist,
|
|
|
|
-12,j,c,f,qa,V,O)}if(la&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,j,fa,f,qa,O,va)}if(la&64){this.compNorm(u);this.compNorm(A);this.VIntX(u*3,this.vlist,this.nlist,18,j,c,ia,qa,M,va)}if(la&128){this.compNorm(p);this.compNorm(u);this.VIntY(p*3,this.vlist,this.nlist,21,j,c,f,qa,V,M)}if(la&256){this.compNorm(h);this.compNorm(p);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,J,V)}if(la&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,j,
|
|
|
|
-fa,f,g,B,O)}if(la&1024){this.compNorm(t);this.compNorm(A);this.VIntZ(t*3,this.vlist,this.nlist,30,j,fa,ia,g,C,va)}if(la&2048){this.compNorm(o);this.compNorm(u);this.VIntZ(o*3,this.vlist,this.nlist,33,j,c,ia,g,U,M)}F<<=4;for(j=h=0;THREE.triTable[F+j]!=-1;){c=F+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+
|
|
|
|
|
|
+var qa=this.delta,ga=c+qa,ea=f+qa;qa=g+qa;if(la&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,J,B)}if(la&2){this.compNorm(m);this.compNorm(t);this.VIntY(m*3,this.vlist,this.nlist,3,j,ga,f,g,B,C)}if(la&4){this.compNorm(o);this.compNorm(t);this.VIntX(o*3,this.vlist,this.nlist,6,j,c,ea,g,U,C)}if(la&8){this.compNorm(h);this.compNorm(o);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,J,U)}if(la&16){this.compNorm(p);this.compNorm(y);this.VIntX(p*3,this.vlist,this.nlist,
|
|
|
|
+12,j,c,f,qa,V,O)}if(la&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,j,ga,f,qa,O,va)}if(la&64){this.compNorm(u);this.compNorm(A);this.VIntX(u*3,this.vlist,this.nlist,18,j,c,ea,qa,M,va)}if(la&128){this.compNorm(p);this.compNorm(u);this.VIntY(p*3,this.vlist,this.nlist,21,j,c,f,qa,V,M)}if(la&256){this.compNorm(h);this.compNorm(p);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,J,V)}if(la&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,j,
|
|
|
|
+ga,f,g,B,O)}if(la&1024){this.compNorm(t);this.compNorm(A);this.VIntZ(t*3,this.vlist,this.nlist,30,j,ga,ea,g,C,va)}if(la&2048){this.compNorm(o);this.compNorm(u);this.VIntZ(o*3,this.vlist,this.nlist,33,j,c,ea,g,U,M)}F<<=4;for(j=h=0;THREE.triTable[F+j]!=-1;){c=F+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var m=this.count*3;this.positionArray[m]=c[g];this.positionArray[m+
|
|
1]=c[g+1];this.positionArray[m+2]=c[g+2];this.positionArray[m+3]=c[h];this.positionArray[m+4]=c[h+1];this.positionArray[m+5]=c[h+2];this.positionArray[m+6]=c[j];this.positionArray[m+7]=c[j+1];this.positionArray[m+8]=c[j+2];this.normalArray[m]=f[g];this.normalArray[m+1]=f[g+1];this.normalArray[m+2]=f[g+2];this.normalArray[m+3]=f[h];this.normalArray[m+4]=f[h+1];this.normalArray[m+5]=f[h+2];this.normalArray[m+6]=f[j];this.normalArray[m+7]=f[j+1];this.normalArray[m+8]=f[j+2];this.hasPos=!0;this.hasNormal=
|
|
1]=c[g+1];this.positionArray[m+2]=c[g+2];this.positionArray[m+3]=c[h];this.positionArray[m+4]=c[h+1];this.positionArray[m+5]=c[h+2];this.positionArray[m+6]=c[j];this.positionArray[m+7]=c[j+1];this.positionArray[m+8]=c[j+2];this.normalArray[m]=f[g];this.normalArray[m+1]=f[g+1];this.normalArray[m+2]=f[g+2];this.normalArray[m+3]=f[h];this.normalArray[m+4]=f[h+1];this.normalArray[m+5]=f[h+2];this.normalArray[m+6]=f[j];this.normalArray[m+7]=f[j+1];this.normalArray[m+8]=f[j+2];this.hasPos=!0;this.hasNormal=
|
|
!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;c(this)}};this.addBall=function(c,f,g,h,j){var k=this.size*Math.sqrt(h/j),m=g*this.size,o=f*this.size,p=c*this.size,t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var y=Math.floor(o-k);y<1&&(y=1);o=Math.floor(o+k);o>this.size-1&&
|
|
!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;c(this)}};this.addBall=function(c,f,g,h,j){var k=this.size*Math.sqrt(h/j),m=g*this.size,o=f*this.size,p=c*this.size,t=Math.floor(m-k);t<1&&(t=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(p-k);u<1&&(u=1);k=Math.floor(p+k);k>this.size-1&&(k=this.size-1);for(var A,F,J,B,U,C;t<m;t++){p=this.size2*t;F=t/this.size-g;U=F*F;for(F=y;F<o;F++){J=p+this.size*F;A=F/this.size-f;C=A*A;for(A=u;A<k;A++){B=A/this.size-c;B=h/(1.0E-6+B*B+C+U)-j;B>0&&(this.field[J+A]+=B)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,o=this.size,p=this.yd,t=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*p;for(j=
|
|
(o=this.size-1);var u=Math.floor(p-k);u<1&&(u=1);k=Math.floor(p+k);k>this.size-1&&(k=this.size-1);for(var A,F,J,B,U,C;t<m;t++){p=this.size2*t;F=t/this.size-g;U=F*F;for(F=y;F<o;F++){J=p+this.size*F;A=F/this.size-f;C=A*A;for(A=u;A<k;A++){B=A/this.size-c;B=h/(1.0E-6+B*B+C+U)-j;B>0&&(this.field[J+A]+=B)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,o=this.size,p=this.yd,t=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*p;for(j=
|