|
@@ -25,9 +25,9 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=
|
|
|
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,g,j,h,k,m,o,p,u,v,t,x,w){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=j;this.n23=h;this.n24=k;this.n31=m;this.n32=o;this.n33=p;this.n34=u;this.n41=v;this.n42=t;this.n43=x;this.n44=w;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
|
|
|
c,e){var f=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());g.cross(j,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=j.x;this.n21=f.y;this.n22=g.y;this.n23=j.y;this.n31=f.z;this.n32=g.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;
|
|
|
b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
|
|
|
-e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,u=b.n32,v=b.n33,t=b.n34,x=b.n41,w=b.n42,A=b.n43,y=b.n44,G=c.n11,D=c.n12,
|
|
|
-I=c.n13,J=c.n14,C=c.n21,B=c.n22,L=c.n23,E=c.n24,V=c.n31,H=c.n32,S=c.n33,K=c.n34,Q=c.n41,n=c.n42,T=c.n43,X=c.n44;this.n11=e*G+f*C+g*V+j*Q;this.n12=e*D+f*B+g*H+j*n;this.n13=e*I+f*L+g*S+j*T;this.n14=e*J+f*E+g*K+j*X;this.n21=h*G+k*C+m*V+o*Q;this.n22=h*D+k*B+m*H+o*n;this.n23=h*I+k*L+m*S+o*T;this.n24=h*J+k*E+m*K+o*X;this.n31=p*G+u*C+v*V+t*Q;this.n32=p*D+u*B+v*H+t*n;this.n33=p*I+u*L+v*S+t*T;this.n34=p*J+u*E+v*K+t*X;this.n41=x*G+w*C+A*V+y*Q;this.n42=x*D+w*B+A*H+y*n;this.n43=x*I+w*L+A*S+y*T;this.n44=x*J+w*
|
|
|
-E+A*K+y*X;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[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*=
|
|
|
+e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,u=b.n32,v=b.n33,t=b.n34,x=b.n41,w=b.n42,A=b.n43,y=b.n44,G=c.n11,E=c.n12,
|
|
|
+I=c.n13,J=c.n14,C=c.n21,B=c.n22,L=c.n23,D=c.n24,V=c.n31,H=c.n32,S=c.n33,K=c.n34,Q=c.n41,n=c.n42,T=c.n43,X=c.n44;this.n11=e*G+f*C+g*V+j*Q;this.n12=e*E+f*B+g*H+j*n;this.n13=e*I+f*L+g*S+j*T;this.n14=e*J+f*D+g*K+j*X;this.n21=h*G+k*C+m*V+o*Q;this.n22=h*E+k*B+m*H+o*n;this.n23=h*I+k*L+m*S+o*T;this.n24=h*J+k*D+m*K+o*X;this.n31=p*G+u*C+v*V+t*Q;this.n32=p*E+u*B+v*H+t*n;this.n33=p*I+u*L+v*S+t*T;this.n34=p*J+u*D+v*K+t*X;this.n41=x*G+w*C+A*V+y*Q;this.n42=x*E+w*B+A*H+y*n;this.n43=x*I+w*L+A*S+y*T;this.n44=x*J+w*
|
|
|
+D+A*K+y*X;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[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,c=this.n12,e=this.n13,f=this.n14,g=this.n21,j=this.n22,h=this.n23,k=this.n24,m=this.n31,o=this.n32,p=this.n33,u=this.n34,v=this.n41,t=this.n42,x=this.n43,w=this.n44;return f*h*o*v-e*k*o*v-f*j*p*v+c*k*p*v+e*j*u*v-c*h*u*v-f*h*m*t+e*k*m*t+f*g*p*t-b*k*p*t-e*g*u*t+b*h*u*t+f*j*m*x-c*k*m*x-f*g*o*x+b*k*o*x+c*g*u*x-b*j*u*x-e*j*m*w+c*h*m*w+e*g*o*w-b*h*o*w-c*g*p*w+b*j*p*w},
|
|
|
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.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;
|
|
@@ -65,9 +65,9 @@ THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function()
|
|
|
e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,j,h,k=new THREE.Vector3,m=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(b&&j.vertexNormals.length){k.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)k.addSelf(j.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],h=this.vertices[j.c],k.sub(h.position,e.position),m.sub(c.position,e.position),k.crossSelf(m);k.isZero()||
|
|
|
k.normalize();j.normal.copy(k)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
|
|
|
this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
|
|
|
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,e,f,g,j,n){k=b.vertices[c].position;m=b.vertices[e].position;o=b.vertices[f].position;p=h[g];u=h[j];v=h[n];t=m.x-k.x;x=o.x-k.x;w=m.y-k.y;A=o.y-k.y;y=m.z-k.z;G=o.z-k.z;D=u.u-p.u;I=v.u-p.u;J=u.v-p.v;C=v.v-p.v;B=1/(D*C-I*J);H.set((C*t-J*x)*
|
|
|
-B,(C*w-J*A)*B,(C*y-J*G)*B);S.set((D*x-I*t)*B,(D*A-I*w)*B,(D*G-I*y)*B);E[c].addSelf(H);E[e].addSelf(H);E[f].addSelf(H);V[c].addSelf(S);V[e].addSelf(S);V[f].addSelf(S)}var c,e,f,g,j,h,k,m,o,p,u,v,t,x,w,A,y,G,D,I,J,C,B,L,E=[],V=[],H=new THREE.Vector3,S=new THREE.Vector3,K=new THREE.Vector3,Q=new THREE.Vector3,n=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)E[c]=new THREE.Vector3,V[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],h=this.faceVertexUvs[0][c],j instanceof
|
|
|
-THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var T=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)n.copy(j.vertexNormals[f]),g=j[T[f]],L=E[g],K.copy(L),K.subSelf(n.multiplyScalar(n.dot(L))).normalize(),Q.cross(j.vertexNormals[f],L),g=Q.dot(V[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(K.x,K.y,K.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
|
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,e,f,g,j,n){k=b.vertices[c].position;m=b.vertices[e].position;o=b.vertices[f].position;p=h[g];u=h[j];v=h[n];t=m.x-k.x;x=o.x-k.x;w=m.y-k.y;A=o.y-k.y;y=m.z-k.z;G=o.z-k.z;E=u.u-p.u;I=v.u-p.u;J=u.v-p.v;C=v.v-p.v;B=1/(E*C-I*J);H.set((C*t-J*x)*
|
|
|
+B,(C*w-J*A)*B,(C*y-J*G)*B);S.set((E*x-I*t)*B,(E*A-I*w)*B,(E*G-I*y)*B);D[c].addSelf(H);D[e].addSelf(H);D[f].addSelf(H);V[c].addSelf(S);V[e].addSelf(S);V[f].addSelf(S)}var c,e,f,g,j,h,k,m,o,p,u,v,t,x,w,A,y,G,E,I,J,C,B,L,D=[],V=[],H=new THREE.Vector3,S=new THREE.Vector3,K=new THREE.Vector3,Q=new THREE.Vector3,n=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)D[c]=new THREE.Vector3,V[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],h=this.faceVertexUvs[0][c],j instanceof
|
|
|
+THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var T=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)n.copy(j.vertexNormals[f]),g=j[T[f]],L=D[g],K.copy(L),K.subSelf(n.multiplyScalar(n.dot(L))).normalize(),Q.cross(j.vertexNormals[f],L),g=Q.dot(V[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(K.x,K.y,K.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 c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];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=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,e){b[c]===
|
|
|
void 0?(b[c]={set:{},array:[]},b[c].set[e]=1,b[c].array.push(e)):b[c].set[e]===void 0&&(b[c].set[e]=1,b[c].array.push(e))}var e,f,g,j,h,k={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.a,h.c),c(k,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),c(k,g,e),g=b(h.a,h.b),c(k,g,e),g=b(h.a,h.d),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.d),c(k,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];j=h.vertexIndices[1];
|
|
@@ -131,58 +131,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.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};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 c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
|
|
|
THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
|
|
|
-THREE.Projector=function(){function b(){var b=m[k]=m[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,h=b.z+b.w,g=c.z+c.w,j=-b.z+b.w,k=-c.z+c.w;return h>=0&&g>=0&&j>=0&&k>=0?!0:h<0&&g<0||j<0&&k<0?!1:(h<0?e=Math.max(e,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),j<0?e=Math.max(e,j/(j-k)):k<0&&(f=Math.min(f,j/(j-k))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,g,j=[],h,k,m=[],o,p,u=[],v,t=[],x,w,A=[],y,G,D=[],I=new THREE.Vector4,J=new THREE.Vector4,
|
|
|
-C=new THREE.Matrix4,B=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,V=new THREE.Vector4;this.projectVector=function(b,c){C.multiply(c.projectionMatrix,c.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,c){C.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],k,n,m;g=0;n=
|
|
|
+THREE.Projector=function(){function b(){var b=m[k]=m[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,h=b.z+b.w,g=c.z+c.w,j=-b.z+b.w,k=-c.z+c.w;return h>=0&&g>=0&&j>=0&&k>=0?!0:h<0&&g<0||j<0&&k<0?!1:(h<0?e=Math.max(e,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),j<0?e=Math.max(e,j/(j-k)):k<0&&(f=Math.min(f,j/(j-k))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,g,j=[],h,k,m=[],o,p,u=[],v,t=[],x,w,A=[],y,G,E=[],I=new THREE.Vector4,J=new THREE.Vector4,
|
|
|
+C=new THREE.Matrix4,B=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,V=new THREE.Vector4;this.projectVector=function(b,c){C.multiply(c.projectionMatrix,c.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,c){C.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],k,n,m;g=0;n=
|
|
|
b.objects;b=0;for(k=n.length;b<k;b++){m=n[b];var u;if(!(u=!m.visible))if(u=m instanceof THREE.Mesh){a:{u=void 0;for(var o=m.matrixWorld,t=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),p=0;p<6;p++)if(u=L[p].x*o.n14+L[p].y*o.n24+L[p].z*o.n34+L[p].w,u<=t){u=!1;break a}u=!0}u=!u}if(!u)u=j[g]=j[g]||new THREE.RenderableObject,g++,f=u,I.copy(m.position),C.multiplyVector3(I),f.object=m,f.z=I.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,j){var I=[],
|
|
|
n=g.near,T=g.far,X,M,W,ha,ca,fa,ga,$,Y,P,ea,Z,da,ia,U,ja,pa;G=w=v=p=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);C.multiply(g.projectionMatrix,g.matrixWorldInverse);L[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);L[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);L[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);L[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);L[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);L[5].set(C.n41+C.n31,C.n42+
|
|
|
C.n32,C.n43+C.n33,C.n44+C.n34);for(X=0;X<6;X++)Y=L[X],Y.divideScalar(Math.sqrt(Y.x*Y.x+Y.y*Y.y+Y.z*Y.z));Y=this.projectObjects(f,g,!0);f=0;for(X=Y.length;f<X;f++)if(P=Y[f].object,P.visible)if(ea=P.matrixWorld,Z=P.matrixRotationWorld,da=P.materials,ia=P.overdraw,k=0,P instanceof THREE.Mesh){U=P.geometry;ha=U.vertices;ja=U.faces;U=U.faceVertexUvs;M=0;for(W=ha.length;M<W;M++)h=b(),h.positionWorld.copy(ha[M].position),ea.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),C.multiplyVector4(h.positionScreen),
|
|
|
h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>n&&h.positionScreen.z<T;ha=0;for(M=ja.length;ha<M;ha++){W=ja[ha];if(W instanceof THREE.Face3)if(ca=m[W.a],fa=m[W.b],ga=m[W.c],ca.visible&&fa.visible&&ga.visible&&(P.doubleSided||P.flipSided!=(ga.positionScreen.x-ca.positionScreen.x)*(fa.positionScreen.y-ca.positionScreen.y)-(ga.positionScreen.y-ca.positionScreen.y)*(fa.positionScreen.x-ca.positionScreen.x)<0))$=u[p]=u[p]||new THREE.RenderableFace3,
|
|
|
p++,o=$,o.v1.copy(ca),o.v2.copy(fa),o.v3.copy(ga);else continue;else if(W instanceof THREE.Face4)if(ca=m[W.a],fa=m[W.b],ga=m[W.c],$=m[W.d],ca.visible&&fa.visible&&ga.visible&&$.visible&&(P.doubleSided||P.flipSided!=(($.positionScreen.x-ca.positionScreen.x)*(fa.positionScreen.y-ca.positionScreen.y)-($.positionScreen.y-ca.positionScreen.y)*(fa.positionScreen.x-ca.positionScreen.x)<0||(fa.positionScreen.x-ga.positionScreen.x)*($.positionScreen.y-ga.positionScreen.y)-(fa.positionScreen.y-ga.positionScreen.y)*
|
|
|
($.positionScreen.x-ga.positionScreen.x)<0)))pa=t[v]=t[v]||new THREE.RenderableFace4,v++,o=pa,o.v1.copy(ca),o.v2.copy(fa),o.v3.copy(ga),o.v4.copy($);else continue;o.normalWorld.copy(W.normal);Z.multiplyVector3(o.normalWorld);o.centroidWorld.copy(W.centroid);ea.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);C.multiplyVector3(o.centroidScreen);ga=W.vertexNormals;ca=0;for(fa=ga.length;ca<fa;ca++)$=o.vertexNormalsWorld[ca],$.copy(ga[ca]),Z.multiplyVector3($);ca=0;for(fa=U.length;ca<
|
|
|
-fa;ca++)if(pa=U[ca][ha]){ga=0;for($=pa.length;ga<$;ga++)o.uvs[ca][ga]=pa[ga]}o.meshMaterials=da;o.faceMaterials=W.materials;o.overdraw=ia;o.z=o.centroidScreen.z;I.push(o)}}else if(P instanceof THREE.Line){B.multiply(C,ea);ha=P.geometry.vertices;ca=b();ca.positionScreen.copy(ha[0].position);B.multiplyVector4(ca.positionScreen);M=1;for(W=ha.length;M<W;M++)if(ca=b(),ca.positionScreen.copy(ha[M].position),B.multiplyVector4(ca.positionScreen),fa=m[k-2],E.copy(ca.positionScreen),V.copy(fa.positionScreen),
|
|
|
-e(E,V))E.multiplyScalar(1/E.w),V.multiplyScalar(1/V.w),ea=A[w]=A[w]||new THREE.RenderableLine,w++,x=ea,x.v1.positionScreen.copy(E),x.v2.positionScreen.copy(V),x.z=Math.max(E.z,V.z),x.materials=P.materials,I.push(x)}else if(P instanceof THREE.Particle&&(J.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34,1),C.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))ea=D[G]=D[G]||new THREE.RenderableParticle,G++,y=ea,y.x=J.x/J.w,y.y=J.y/J.w,y.z=J.z,y.rotation=P.rotation.z,y.scale.x=P.scale.x*Math.abs(y.x-
|
|
|
+fa;ca++)if(pa=U[ca][ha]){ga=0;for($=pa.length;ga<$;ga++)o.uvs[ca][ga]=pa[ga]}o.meshMaterials=da;o.faceMaterials=W.materials;o.overdraw=ia;o.z=o.centroidScreen.z;I.push(o)}}else if(P instanceof THREE.Line){B.multiply(C,ea);ha=P.geometry.vertices;ca=b();ca.positionScreen.copy(ha[0].position);B.multiplyVector4(ca.positionScreen);M=1;for(W=ha.length;M<W;M++)if(ca=b(),ca.positionScreen.copy(ha[M].position),B.multiplyVector4(ca.positionScreen),fa=m[k-2],D.copy(ca.positionScreen),V.copy(fa.positionScreen),
|
|
|
+e(D,V))D.multiplyScalar(1/D.w),V.multiplyScalar(1/V.w),ea=A[w]=A[w]||new THREE.RenderableLine,w++,x=ea,x.v1.positionScreen.copy(D),x.v2.positionScreen.copy(V),x.z=Math.max(D.z,V.z),x.materials=P.materials,I.push(x)}else if(P instanceof THREE.Particle&&(J.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34,1),C.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))ea=E[G]=E[G]||new THREE.RenderableParticle,G++,y=ea,y.x=J.x/J.w,y.y=J.y/J.w,y.z=J.z,y.rotation=P.rotation.z,y.scale.x=P.scale.x*Math.abs(y.x-
|
|
|
(J.x+g.projectionMatrix.n11)/(J.w+g.projectionMatrix.n14)),y.scale.y=P.scale.y*Math.abs(y.y-(J.y+g.projectionMatrix.n22)/(J.w+g.projectionMatrix.n24)),y.materials=P.materials,I.push(y);j&&I.sort(c);return I}};
|
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;j=f/2};this.render=function(e,f){var m,o,p,u,v,t,x,w;b=c.projectScene(e,f);m=0;for(o=b.length;m<o;m++)if(v=b[m],v instanceof THREE.RenderableParticle){x=v.x*g+g;w=v.y*j+j;p=0;for(u=v.material.length;p<u;p++)if(t=v.material[p],t instanceof THREE.ParticleDOMMaterial)t=t.domElement,t.style.left=x+"px",t.style.top=w+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(b){function c(b){if(A!=b)t.globalAlpha=A=b}function e(b){if(y!=b){switch(b){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}y=b}}function f(b){if(G!=b)t.strokeStyle=G=b}function g(b){if(D!=b)t.fillStyle=D=b}var j=this,h=null,k=new THREE.Projector,b=b||{},m=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
-o,p,u,v,t=m.getContext("2d"),x=new THREE.Color(0),w=0,A=1,y=0,G=null,D=null,I=null,J=null,C=null,B,L,E,V,H=new THREE.RenderableVertex,S=new THREE.RenderableVertex,K,Q,n,T,X,M,W,ha,ca,fa,ga,$,Y=new THREE.Color(0),P=new THREE.Color(0),ea=new THREE.Color(0),Z=new THREE.Color(0),da=new THREE.Color(0),ia=[],U,ja,pa,la,ma,Fa,ya,Ia,Ja,Ta,ra=new THREE.Rectangle,na=new THREE.Rectangle,aa=new THREE.Rectangle,xa=!1,va=new THREE.Color,oa=new THREE.Color,Da=new THREE.Color,Ga=new THREE.Color,sa=new THREE.Vector3,
|
|
|
+THREE.CanvasRenderer=function(b){function c(b){if(A!=b)t.globalAlpha=A=b}function e(b){if(y!=b){switch(b){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}y=b}}function f(b){if(G!=b)t.strokeStyle=G=b}function g(b){if(E!=b)t.fillStyle=E=b}var j=this,h=null,k=new THREE.Projector,b=b||{},m=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
+o,p,u,v,t=m.getContext("2d"),x=new THREE.Color(0),w=0,A=1,y=0,G=null,E=null,I=null,J=null,C=null,B,L,D,V,H=new THREE.RenderableVertex,S=new THREE.RenderableVertex,K,Q,n,T,X,M,W,ha,ca,fa,ga,$,Y=new THREE.Color(0),P=new THREE.Color(0),ea=new THREE.Color(0),Z=new THREE.Color(0),da=new THREE.Color(0),ia=[],U,ja,pa,la,ma,Fa,ya,Ia,Ja,Ta,ra=new THREE.Rectangle,na=new THREE.Rectangle,aa=new THREE.Rectangle,xa=!1,va=new THREE.Color,oa=new THREE.Color,Da=new THREE.Color,Ga=new THREE.Color,sa=new THREE.Vector3,
|
|
|
R,Aa,ka,za,Wa,Ba,b=16;R=document.createElement("canvas");R.width=R.height=2;Aa=R.getContext("2d");Aa.fillStyle="rgba(0,0,0,1)";Aa.fillRect(0,0,2,2);ka=Aa.getImageData(0,0,2,2);za=ka.data;Wa=document.createElement("canvas");Wa.width=Wa.height=b;Ba=Wa.getContext("2d");Ba.translate(-b/2,-b/2);Ba.scale(b,b);b--;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,c){o=b;p=c;u=Math.floor(o/2);v=Math.floor(p/2);m.width=o;m.height=
|
|
|
-p;ra.set(-u,-v,u,v);na.set(-u,-v,u,v);A=1;y=0;C=J=I=D=G=null};this.setClearColor=function(b,c){x.copy(b);w=c;na.set(-u,-v,u,v)};this.setClearColorHex=function(b,c){x.setHex(b);w=c;na.set(-u,-v,u,v)};this.clear=function(){t.setTransform(1,0,0,-1,u,v);na.isEmpty()||(na.minSelf(ra),na.inflate(2),w<1&&t.clearRect(Math.floor(na.getX()),Math.floor(na.getY()),Math.floor(na.getWidth()),Math.floor(na.getHeight())),w>0&&(e(THREE.NormalBlending),c(1),g("rgba("+Math.floor(x.r*255)+","+Math.floor(x.g*255)+","+
|
|
|
+p;ra.set(-u,-v,u,v);na.set(-u,-v,u,v);A=1;y=0;C=J=I=E=G=null};this.setClearColor=function(b,c){x.copy(b);w=c;na.set(-u,-v,u,v)};this.setClearColorHex=function(b,c){x.setHex(b);w=c;na.set(-u,-v,u,v)};this.clear=function(){t.setTransform(1,0,0,-1,u,v);na.isEmpty()||(na.minSelf(ra),na.inflate(2),w<1&&t.clearRect(Math.floor(na.getX()),Math.floor(na.getY()),Math.floor(na.getWidth()),Math.floor(na.getHeight())),w>0&&(e(THREE.NormalBlending),c(1),g("rgba("+Math.floor(x.r*255)+","+Math.floor(x.g*255)+","+
|
|
|
Math.floor(x.b*255)+","+w+")"),t.fillRect(Math.floor(na.getX()),Math.floor(na.getY()),Math.floor(na.getWidth()),Math.floor(na.getHeight()))),na.empty())};this.render=function(b,m){function o(b){var c,e,f,h=b.lights;oa.setRGB(0,0,0);Da.setRGB(0,0,0);Ga.setRGB(0,0,0);b=0;for(c=h.length;b<c;b++)e=h[b],f=e.color,e instanceof THREE.AmbientLight?(oa.r+=f.r,oa.g+=f.g,oa.b+=f.b):e instanceof THREE.DirectionalLight?(Da.r+=f.r,Da.g+=f.g,Da.b+=f.b):e instanceof THREE.PointLight&&(Ga.r+=f.r,Ga.g+=f.g,Ga.b+=f.b)}
|
|
|
function p(b,c,e,f){var h,g,j,k,n=b.lights,b=0;for(h=n.length;b<h;b++)g=n[b],j=g.color,g instanceof THREE.DirectionalLight?(k=e.dot(g.position),k<=0||(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)):g instanceof THREE.PointLight&&(k=e.dot(sa.sub(g.position,c).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(c.distanceTo(g.position)/g.distance,1),k!=0&&(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)))}function x(b,h,j){c(j.opacity);e(j.blending);var k,n,m,o,p,ka;if(j instanceof THREE.ParticleBasicMaterial){if(j.map)o=
|
|
|
j.map.image,p=o.width>>1,ka=o.height>>1,j=h.scale.x*u,m=h.scale.y*v,k=j*p,n=m*ka,aa.set(b.x-k,b.y-n,b.x+k,b.y+n),ra.instersects(aa)&&(t.save(),t.translate(b.x,b.y),t.rotate(-h.rotation),t.scale(j,-m),t.translate(-p,-ka),t.drawImage(o,0,0),t.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*u,n=h.scale.y*v,aa.set(b.x-k,b.y-n,b.x+k,b.y+n),ra.instersects(aa)&&(f(j.color.getContextStyle()),g(j.color.getContextStyle()),t.save(),t.translate(b.x,b.y),t.rotate(-h.rotation),t.scale(k,
|
|
|
n),j.program(t),t.restore()))}function w(b,h,g,j){c(j.opacity);e(j.blending);t.beginPath();t.moveTo(b.positionScreen.x,b.positionScreen.y);t.lineTo(h.positionScreen.x,h.positionScreen.y);t.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(I!=b)t.lineWidth=I=b;b=j.linecap;if(J!=b)t.lineCap=J=b;b=j.linejoin;if(C!=b)t.lineJoin=C=b;f(j.color.getContextStyle());t.stroke();aa.inflate(j.linewidth*2)}}function A(b,f,h,g,k,u,o,t,ka){j.data.vertices+=3;j.data.faces++;c(t.opacity);e(t.blending);
|
|
|
-K=b.positionScreen.x;Q=b.positionScreen.y;n=f.positionScreen.x;T=f.positionScreen.y;X=h.positionScreen.x;M=h.positionScreen.y;D(K,Q,n,T,X,M);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(la=o.uvs[0],Za(K,Q,n,T,X,M,la[g].u,la[g].v,la[k].u,la[k].v,la[u].u,la[u].v,t.map));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=m.matrixWorldInverse,sa.copy(o.vertexNormalsWorld[0]),ma=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Fa=
|
|
|
+K=b.positionScreen.x;Q=b.positionScreen.y;n=f.positionScreen.x;T=f.positionScreen.y;X=h.positionScreen.x;M=h.positionScreen.y;E(K,Q,n,T,X,M);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(la=o.uvs[0],Za(K,Q,n,T,X,M,la[g].u,la[g].v,la[k].u,la[k].v,la[u].u,la[u].v,t.map));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=m.matrixWorldInverse,sa.copy(o.vertexNormalsWorld[0]),ma=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Fa=
|
|
|
-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,sa.copy(o.vertexNormalsWorld[1]),ya=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Ia=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,sa.copy(o.vertexNormalsWorld[2]),Ja=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Ta=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,Za(K,Q,n,T,X,M,ma,Fa,ya,Ia,Ja,Ta,t.envMap)}else t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&
|
|
|
(t.map.mapping instanceof THREE.UVMapping&&(la=o.uvs[0],Za(K,Q,n,T,X,M,la[g].u,la[g].v,la[k].u,la[k].v,la[u].u,la[u].v,t.map)),e(THREE.SubtractiveBlending)),xa?!t.wireframe&&t.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(P.r=ea.r=Z.r=oa.r,P.g=ea.g=Z.g=oa.g,P.b=ea.b=Z.b=oa.b,p(ka,o.v1.positionWorld,o.vertexNormalsWorld[0],P),p(ka,o.v2.positionWorld,o.vertexNormalsWorld[1],ea),p(ka,o.v3.positionWorld,o.vertexNormalsWorld[2],Z),da.r=(ea.r+Z.r)*0.5,da.g=(ea.g+Z.g)*0.5,da.b=(ea.b+Z.b)*
|
|
|
0.5,pa=Xa(P,ea,Z,da),Ua(K,Q,n,T,X,M,0,0,1,0,0,1,pa)):(va.r=oa.r,va.g=oa.g,va.b=oa.b,p(ka,o.centroidWorld,o.normalWorld,va),Y.r=Math.max(0,Math.min(t.color.r*va.r,1)),Y.g=Math.max(0,Math.min(t.color.g*va.g,1)),Y.b=Math.max(0,Math.min(t.color.b*va.b,1)),t.wireframe?Ka(Y,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Y)):t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color);else if(t instanceof THREE.MeshDepthMaterial)U=m.near,ja=m.far,P.r=P.g=
|
|
|
P.b=1-Oa(b.positionScreen.z,U,ja),ea.r=ea.g=ea.b=1-Oa(f.positionScreen.z,U,ja),Z.r=Z.g=Z.b=1-Oa(h.positionScreen.z,U,ja),da.r=(ea.r+Z.r)*0.5,da.g=(ea.g+Z.g)*0.5,da.b=(ea.b+Z.b)*0.5,pa=Xa(P,ea,Z,da),Ua(K,Q,n,T,X,M,0,0,1,0,0,1,pa);else if(t instanceof THREE.MeshNormalMaterial)Y.r=Va(o.normalWorld.x),Y.g=Va(o.normalWorld.y),Y.b=Va(o.normalWorld.z),t.wireframe?Ka(Y,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Y)}function y(b,f,h,g,k,u,o,t,ka){j.data.vertices+=4;j.data.faces++;c(t.opacity);
|
|
|
e(t.blending);if(t.map||t.envMap)A(b,f,g,0,1,3,o,t,ka),A(k,h,u,1,2,3,o,t,ka);else if(K=b.positionScreen.x,Q=b.positionScreen.y,n=f.positionScreen.x,T=f.positionScreen.y,X=h.positionScreen.x,M=h.positionScreen.y,W=g.positionScreen.x,ha=g.positionScreen.y,ca=k.positionScreen.x,fa=k.positionScreen.y,ga=u.positionScreen.x,$=u.positionScreen.y,t instanceof THREE.MeshBasicMaterial)G(K,Q,n,T,X,M,W,ha),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color);else if(t instanceof
|
|
|
-THREE.MeshLambertMaterial)xa?!t.wireframe&&t.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==4?(P.r=ea.r=Z.r=da.r=oa.r,P.g=ea.g=Z.g=da.g=oa.g,P.b=ea.b=Z.b=da.b=oa.b,p(ka,o.v1.positionWorld,o.vertexNormalsWorld[0],P),p(ka,o.v2.positionWorld,o.vertexNormalsWorld[1],ea),p(ka,o.v4.positionWorld,o.vertexNormalsWorld[3],Z),p(ka,o.v3.positionWorld,o.vertexNormalsWorld[2],da),pa=Xa(P,ea,Z,da),D(K,Q,n,T,W,ha),Ua(K,Q,n,T,W,ha,0,0,1,0,0,1,pa),D(ca,fa,X,M,ga,$),Ua(ca,fa,X,M,ga,$,1,0,1,1,0,1,pa)):(va.r=
|
|
|
+THREE.MeshLambertMaterial)xa?!t.wireframe&&t.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==4?(P.r=ea.r=Z.r=da.r=oa.r,P.g=ea.g=Z.g=da.g=oa.g,P.b=ea.b=Z.b=da.b=oa.b,p(ka,o.v1.positionWorld,o.vertexNormalsWorld[0],P),p(ka,o.v2.positionWorld,o.vertexNormalsWorld[1],ea),p(ka,o.v4.positionWorld,o.vertexNormalsWorld[3],Z),p(ka,o.v3.positionWorld,o.vertexNormalsWorld[2],da),pa=Xa(P,ea,Z,da),E(K,Q,n,T,W,ha),Ua(K,Q,n,T,W,ha,0,0,1,0,0,1,pa),E(ca,fa,X,M,ga,$),Ua(ca,fa,X,M,ga,$,1,0,1,1,0,1,pa)):(va.r=
|
|
|
oa.r,va.g=oa.g,va.b=oa.b,p(ka,o.centroidWorld,o.normalWorld,va),Y.r=Math.max(0,Math.min(t.color.r*va.r,1)),Y.g=Math.max(0,Math.min(t.color.g*va.g,1)),Y.b=Math.max(0,Math.min(t.color.b*va.b,1)),G(K,Q,n,T,X,M,W,ha),t.wireframe?Ka(Y,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Y)):(G(K,Q,n,T,X,M,W,ha),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color));else if(t instanceof THREE.MeshNormalMaterial)Y.r=Va(o.normalWorld.x),Y.g=Va(o.normalWorld.y),
|
|
|
-Y.b=Va(o.normalWorld.z),G(K,Q,n,T,X,M,W,ha),t.wireframe?Ka(Y,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Y);else if(t instanceof THREE.MeshDepthMaterial)U=m.near,ja=m.far,P.r=P.g=P.b=1-Oa(b.positionScreen.z,U,ja),ea.r=ea.g=ea.b=1-Oa(f.positionScreen.z,U,ja),Z.r=Z.g=Z.b=1-Oa(g.positionScreen.z,U,ja),da.r=da.g=da.b=1-Oa(h.positionScreen.z,U,ja),pa=Xa(P,ea,Z,da),D(K,Q,n,T,W,ha),Ua(K,Q,n,T,W,ha,0,0,1,0,0,1,pa),D(ca,fa,X,M,ga,$),Ua(ca,fa,X,M,ga,$,1,0,1,1,0,1,pa)}function D(b,c,e,f,
|
|
|
+Y.b=Va(o.normalWorld.z),G(K,Q,n,T,X,M,W,ha),t.wireframe?Ka(Y,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Y);else if(t instanceof THREE.MeshDepthMaterial)U=m.near,ja=m.far,P.r=P.g=P.b=1-Oa(b.positionScreen.z,U,ja),ea.r=ea.g=ea.b=1-Oa(f.positionScreen.z,U,ja),Z.r=Z.g=Z.b=1-Oa(g.positionScreen.z,U,ja),da.r=da.g=da.b=1-Oa(h.positionScreen.z,U,ja),pa=Xa(P,ea,Z,da),E(K,Q,n,T,W,ha),Ua(K,Q,n,T,W,ha,0,0,1,0,0,1,pa),E(ca,fa,X,M,ga,$),Ua(ca,fa,X,M,ga,$,1,0,1,1,0,1,pa)}function E(b,c,e,f,
|
|
|
h,g){t.beginPath();t.moveTo(b,c);t.lineTo(e,f);t.lineTo(h,g);t.lineTo(b,c);t.closePath()}function G(b,c,e,f,h,g,j,k){t.beginPath();t.moveTo(b,c);t.lineTo(e,f);t.lineTo(h,g);t.lineTo(j,k);t.lineTo(b,c);t.closePath()}function Ka(b,c,e,h){if(I!=c)t.lineWidth=I=c;if(J!=e)t.lineCap=J=e;if(C!=h)t.lineJoin=C=h;f(b.getContextStyle());t.stroke();aa.inflate(c*2)}function La(b){g(b.getContextStyle());t.fill()}function Za(b,c,e,f,h,j,k,n,m,o,u,p,ka){if(ka.image.width!=0){if(ka.needsUpdate==!0||ia[ka.id]==void 0){var v=
|
|
|
ka.wrapS==THREE.RepeatWrapping,Ba=ka.wrapT==THREE.RepeatWrapping;ia[ka.id]=t.createPattern(ka.image,v&&Ba?"repeat":v&&!Ba?"repeat-x":!v&&Ba?"repeat-y":"no-repeat");ka.needsUpdate=!1}g(ia[ka.id]);var v=ka.offset.x/ka.repeat.x,Ba=ka.offset.y/ka.repeat.y,x=(ka.image.width-1)*ka.repeat.x,ka=(ka.image.height-1)*ka.repeat.y,k=(k+v)*x,n=(n+Ba)*ka,m=(m+v)*x,o=(o+Ba)*ka,u=(u+v)*x,p=(p+Ba)*ka;e-=b;f-=c;h-=b;j-=c;m-=k;o-=n;u-=k;p-=n;v=1/(m*p-u*o);ka=(p*e-o*h)*v;o=(p*f-o*j)*v;e=(m*h-u*e)*v;f=(m*j-u*f)*v;b=b-
|
|
|
ka*k-e*n;c=c-o*k-f*n;t.save();t.transform(ka,o,e,f,b,c);t.fill();t.restore()}}function Ua(b,c,e,f,h,g,j,k,n,m,o,u,ka){var p,v;p=ka.width-1;v=ka.height-1;j*=p;k*=v;n*=p;m*=v;o*=p;u*=v;e-=b;f-=c;h-=b;g-=c;n-=j;m-=k;o-=j;u-=k;v=1/(n*u-o*m);p=(u*e-m*h)*v;m=(u*f-m*g)*v;e=(n*h-o*e)*v;f=(n*g-o*f)*v;b=b-p*j-e*k;c=c-m*j-f*k;t.save();t.transform(p,m,e,f,b,c);t.clip();t.drawImage(ka,0,0);t.restore()}function Xa(b,c,e,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),j=~~(c.r*255),k=~~(c.g*255),c=~~(c.b*255),
|
|
|
n=~~(e.r*255),m=~~(e.g*255),e=~~(e.b*255),t=~~(f.r*255),o=~~(f.g*255),f=~~(f.b*255);za[0]=h<0?0:h>255?255:h;za[1]=g<0?0:g>255?255:g;za[2]=b<0?0:b>255?255:b;za[4]=j<0?0:j>255?255:j;za[5]=k<0?0:k>255?255:k;za[6]=c<0?0:c>255?255:c;za[8]=n<0?0:n>255?255:n;za[9]=m<0?0:m>255?255:m;za[10]=e<0?0:e>255?255:e;za[12]=t<0?0:t>255?255:t;za[13]=o<0?0:o>255?255:o;za[14]=f<0?0:f>255?255:f;Aa.putImageData(ka,0,0);Ba.drawImage(R,0,0);return Wa}function Oa(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Va(b){b=(b+
|
|
|
1)*0.5;return b<0?0:b>1?1:b}function Ma(b,c){var e=c.x-b.x,f=c.y-b.y,h=e*e+f*f;h!=0&&(h=1/Math.sqrt(h),e*=h,f*=h,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Ya,$a,qa,Ca,Na,F,z,N;this.autoClear?this.clear():t.setTransform(1,0,0,-1,u,v);j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,m,this.sortElements);(xa=b.lights.length>0)&&o(b);Ya=0;for($a=h.length;Ya<$a;Ya++){qa=h[Ya];aa.empty();if(qa instanceof THREE.RenderableParticle){B=qa;B.x*=u;B.y*=v;Ca=0;for(Na=qa.materials.length;Ca<Na;)N=qa.materials[Ca++],
|
|
|
-N.opacity!=0&&x(B,qa,N,b)}else if(qa instanceof THREE.RenderableLine){if(B=qa.v1,L=qa.v2,B.positionScreen.x*=u,B.positionScreen.y*=v,L.positionScreen.x*=u,L.positionScreen.y*=v,aa.addPoint(B.positionScreen.x,B.positionScreen.y),aa.addPoint(L.positionScreen.x,L.positionScreen.y),ra.instersects(aa)){Ca=0;for(Na=qa.materials.length;Ca<Na;)N=qa.materials[Ca++],N.opacity!=0&&w(B,L,qa,N,b)}}else if(qa instanceof THREE.RenderableFace3){if(B=qa.v1,L=qa.v2,E=qa.v3,B.positionScreen.x*=u,B.positionScreen.y*=
|
|
|
-v,L.positionScreen.x*=u,L.positionScreen.y*=v,E.positionScreen.x*=u,E.positionScreen.y*=v,qa.overdraw&&(Ma(B.positionScreen,L.positionScreen),Ma(L.positionScreen,E.positionScreen),Ma(E.positionScreen,B.positionScreen)),aa.add3Points(B.positionScreen.x,B.positionScreen.y,L.positionScreen.x,L.positionScreen.y,E.positionScreen.x,E.positionScreen.y),ra.instersects(aa)){Ca=0;for(Na=qa.meshMaterials.length;Ca<Na;)if(N=qa.meshMaterials[Ca++],N instanceof THREE.MeshFaceMaterial){F=0;for(z=qa.faceMaterials.length;F<
|
|
|
-z;)(N=qa.faceMaterials[F++])&&N.opacity!=0&&A(B,L,E,0,1,2,qa,N,b)}else N.opacity!=0&&A(B,L,E,0,1,2,qa,N,b)}}else if(qa instanceof THREE.RenderableFace4&&(B=qa.v1,L=qa.v2,E=qa.v3,V=qa.v4,B.positionScreen.x*=u,B.positionScreen.y*=v,L.positionScreen.x*=u,L.positionScreen.y*=v,E.positionScreen.x*=u,E.positionScreen.y*=v,V.positionScreen.x*=u,V.positionScreen.y*=v,H.positionScreen.copy(L.positionScreen),S.positionScreen.copy(V.positionScreen),qa.overdraw&&(Ma(B.positionScreen,L.positionScreen),Ma(L.positionScreen,
|
|
|
-V.positionScreen),Ma(V.positionScreen,B.positionScreen),Ma(E.positionScreen,H.positionScreen),Ma(E.positionScreen,S.positionScreen)),aa.addPoint(B.positionScreen.x,B.positionScreen.y),aa.addPoint(L.positionScreen.x,L.positionScreen.y),aa.addPoint(E.positionScreen.x,E.positionScreen.y),aa.addPoint(V.positionScreen.x,V.positionScreen.y),ra.instersects(aa))){Ca=0;for(Na=qa.meshMaterials.length;Ca<Na;)if(N=qa.meshMaterials[Ca++],N instanceof THREE.MeshFaceMaterial){F=0;for(z=qa.faceMaterials.length;F<
|
|
|
-z;)(N=qa.faceMaterials[F++])&&N.opacity!=0&&y(B,L,E,V,H,S,qa,N,b)}else N.opacity!=0&&y(B,L,E,V,H,S,qa,N,b)}na.addRectangle(aa)}t.setTransform(1,0,0,1,0,0)}};
|
|
|
+N.opacity!=0&&x(B,qa,N,b)}else if(qa instanceof THREE.RenderableLine){if(B=qa.v1,L=qa.v2,B.positionScreen.x*=u,B.positionScreen.y*=v,L.positionScreen.x*=u,L.positionScreen.y*=v,aa.addPoint(B.positionScreen.x,B.positionScreen.y),aa.addPoint(L.positionScreen.x,L.positionScreen.y),ra.instersects(aa)){Ca=0;for(Na=qa.materials.length;Ca<Na;)N=qa.materials[Ca++],N.opacity!=0&&w(B,L,qa,N,b)}}else if(qa instanceof THREE.RenderableFace3){if(B=qa.v1,L=qa.v2,D=qa.v3,B.positionScreen.x*=u,B.positionScreen.y*=
|
|
|
+v,L.positionScreen.x*=u,L.positionScreen.y*=v,D.positionScreen.x*=u,D.positionScreen.y*=v,qa.overdraw&&(Ma(B.positionScreen,L.positionScreen),Ma(L.positionScreen,D.positionScreen),Ma(D.positionScreen,B.positionScreen)),aa.add3Points(B.positionScreen.x,B.positionScreen.y,L.positionScreen.x,L.positionScreen.y,D.positionScreen.x,D.positionScreen.y),ra.instersects(aa)){Ca=0;for(Na=qa.meshMaterials.length;Ca<Na;)if(N=qa.meshMaterials[Ca++],N instanceof THREE.MeshFaceMaterial){F=0;for(z=qa.faceMaterials.length;F<
|
|
|
+z;)(N=qa.faceMaterials[F++])&&N.opacity!=0&&A(B,L,D,0,1,2,qa,N,b)}else N.opacity!=0&&A(B,L,D,0,1,2,qa,N,b)}}else if(qa instanceof THREE.RenderableFace4&&(B=qa.v1,L=qa.v2,D=qa.v3,V=qa.v4,B.positionScreen.x*=u,B.positionScreen.y*=v,L.positionScreen.x*=u,L.positionScreen.y*=v,D.positionScreen.x*=u,D.positionScreen.y*=v,V.positionScreen.x*=u,V.positionScreen.y*=v,H.positionScreen.copy(L.positionScreen),S.positionScreen.copy(V.positionScreen),qa.overdraw&&(Ma(B.positionScreen,L.positionScreen),Ma(L.positionScreen,
|
|
|
+V.positionScreen),Ma(V.positionScreen,B.positionScreen),Ma(D.positionScreen,H.positionScreen),Ma(D.positionScreen,S.positionScreen)),aa.addPoint(B.positionScreen.x,B.positionScreen.y),aa.addPoint(L.positionScreen.x,L.positionScreen.y),aa.addPoint(D.positionScreen.x,D.positionScreen.y),aa.addPoint(V.positionScreen.x,V.positionScreen.y),ra.instersects(aa))){Ca=0;for(Na=qa.meshMaterials.length;Ca<Na;)if(N=qa.meshMaterials[Ca++],N instanceof THREE.MeshFaceMaterial){F=0;for(z=qa.faceMaterials.length;F<
|
|
|
+z;)(N=qa.faceMaterials[F++])&&N.opacity!=0&&y(B,L,D,V,H,S,qa,N,b)}else N.opacity!=0&&y(B,L,D,V,H,S,qa,N,b)}na.addRectangle(aa)}t.setTransform(1,0,0,1,0,0)}};
|
|
|
THREE.SVGRenderer=function(){function b(b,c,e){var f,h,g,j;f=0;for(h=b.lights.length;f<h;f++)g=b.lights[f],g instanceof THREE.DirectionalLight?(j=c.normalWorld.dot(g.position)*g.intensity,j>0&&(e.r+=g.color.r*j,e.g+=g.color.g*j,e.b+=g.color.b*j)):g instanceof THREE.PointLight&&(V.sub(g.position,c.centroidWorld),V.normalize(),j=c.normalWorld.dot(V)*g.intensity,j>0&&(e.r+=g.color.r*j,e.g+=g.color.g*j,e.b+=g.color.b*j))}function c(c,e,h,k,n,t){j.data.vertices+=3;j.data.faces++;K=f(Q++);K.setAttribute("d",
|
|
|
-"M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?I.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(J.r=C.r,J.g=C.g,J.b=C.b,b(t,k,J),I.r=Math.max(0,Math.min(n.color.r*J.r,1)),I.g=Math.max(0,Math.min(n.color.g*J.g,1)),I.b=Math.max(0,Math.min(n.color.b*J.b,1))):I.copy(n.color):n instanceof THREE.MeshDepthMaterial?(E=1-n.__2near/(n.__farPlusNear-k.z*n.__farMinusNear),
|
|
|
-I.setRGB(E,E,E)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(g(k.normalWorld.x),g(k.normalWorld.y),g(k.normalWorld.z));n.wireframe?K.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):K.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+n.opacity);m.appendChild(K)}function e(c,e,h,k,n,t,o){j.data.vertices+=4;j.data.faces++;
|
|
|
-K=f(Q++);K.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?I.copy(t.color):t instanceof THREE.MeshLambertMaterial?D?(J.r=C.r,J.g=C.g,J.b=C.b,b(o,n,J),I.r=Math.max(0,Math.min(t.color.r*J.r,1)),I.g=Math.max(0,Math.min(t.color.g*J.g,1)),I.b=Math.max(0,Math.min(t.color.b*J.b,1))):I.copy(t.color):t instanceof
|
|
|
-THREE.MeshDepthMaterial?(E=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),I.setRGB(E,E,E)):t instanceof THREE.MeshNormalMaterial&&I.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));t.wireframe?K.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):K.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+
|
|
|
-t.opacity);m.appendChild(K)}function f(b){H[b]==null&&(H[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),T==0&&H[b].setAttribute("shape-rendering","crispEdges"));return H[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var j=this,h=null,k=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,u,v,t,x,w,A,y=new THREE.Rectangle,G=new THREE.Rectangle,D=!1,I=new THREE.Color(16777215),J=new THREE.Color(16777215),C=new THREE.Color(0),B=new THREE.Color(0),
|
|
|
-L=new THREE.Color(0),E,V=new THREE.Vector3,H=[],S=[],K,Q,n,T=1;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":T=1;break;case "low":T=0}};this.setSize=function(b,c){o=b;p=c;u=o/2;v=p/2;m.setAttribute("viewBox",-u+" "+-v+" "+o+" "+p);m.setAttribute("width",o);m.setAttribute("height",p);y.set(-u,-v,u,v)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=
|
|
|
-function(b,f){var g,o,p,I,J,H,E,P;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,f,this.sortElements);n=Q=0;if(D=b.lights.length>0){E=b.lights;C.setRGB(0,0,0);B.setRGB(0,0,0);L.setRGB(0,0,0);g=0;for(o=E.length;g<o;g++)p=E[g],I=p.color,p instanceof THREE.AmbientLight?(C.r+=I.r,C.g+=I.g,C.b+=I.b):p instanceof THREE.DirectionalLight?(B.r+=I.r,B.g+=I.g,B.b+=I.b):p instanceof THREE.PointLight&&(L.r+=I.r,L.g+=I.g,L.b+=I.b)}g=0;for(o=h.length;g<o;g++)if(E=h[g],G.empty(),
|
|
|
-E instanceof THREE.RenderableParticle){t=E;t.x*=u;t.y*=-v;p=0;for(I=E.materials.length;p<I;)p++}else if(E instanceof THREE.RenderableLine){if(t=E.v1,x=E.v2,t.positionScreen.x*=u,t.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,G.addPoint(t.positionScreen.x,t.positionScreen.y),G.addPoint(x.positionScreen.x,x.positionScreen.y),y.instersects(G)){p=0;for(I=E.materials.length;p<I;)if((P=E.materials[p++])&&P.opacity!=0){J=t;H=x;var ea=n++;S[ea]==null&&(S[ea]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"line"),T==0&&S[ea].setAttribute("shape-rendering","crispEdges"));K=S[ea];K.setAttribute("x1",J.positionScreen.x);K.setAttribute("y1",J.positionScreen.y);K.setAttribute("x2",H.positionScreen.x);K.setAttribute("y2",H.positionScreen.y);P instanceof THREE.LineBasicMaterial&&(K.setAttribute("style","fill: none; stroke: "+P.color.getContextStyle()+"; stroke-width: "+P.linewidth+"; stroke-opacity: "+P.opacity+"; stroke-linecap: "+P.linecap+"; stroke-linejoin: "+P.linejoin),m.appendChild(K))}}}else if(E instanceof
|
|
|
-THREE.RenderableFace3){if(t=E.v1,x=E.v2,w=E.v3,t.positionScreen.x*=u,t.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,G.addPoint(t.positionScreen.x,t.positionScreen.y),G.addPoint(x.positionScreen.x,x.positionScreen.y),G.addPoint(w.positionScreen.x,w.positionScreen.y),y.instersects(G)){p=0;for(I=E.meshMaterials.length;p<I;)if(P=E.meshMaterials[p++],P instanceof THREE.MeshFaceMaterial){J=0;for(H=E.faceMaterials.length;J<H;)(P=E.faceMaterials[J++])&&
|
|
|
-P.opacity!=0&&c(t,x,w,E,P,b)}else P&&P.opacity!=0&&c(t,x,w,E,P,b)}}else if(E instanceof THREE.RenderableFace4&&(t=E.v1,x=E.v2,w=E.v3,A=E.v4,t.positionScreen.x*=u,t.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,A.positionScreen.x*=u,A.positionScreen.y*=-v,G.addPoint(t.positionScreen.x,t.positionScreen.y),G.addPoint(x.positionScreen.x,x.positionScreen.y),G.addPoint(w.positionScreen.x,w.positionScreen.y),G.addPoint(A.positionScreen.x,A.positionScreen.y),
|
|
|
-y.instersects(G))){p=0;for(I=E.meshMaterials.length;p<I;)if(P=E.meshMaterials[p++],P instanceof THREE.MeshFaceMaterial){J=0;for(H=E.faceMaterials.length;J<H;)(P=E.faceMaterials[J++])&&P.opacity!=0&&e(t,x,w,A,E,P,b)}else P&&P.opacity!=0&&e(t,x,w,A,E,P,b)}}};
|
|
|
+"M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?I.copy(n.color):n instanceof THREE.MeshLambertMaterial?E?(J.r=C.r,J.g=C.g,J.b=C.b,b(t,k,J),I.r=Math.max(0,Math.min(n.color.r*J.r,1)),I.g=Math.max(0,Math.min(n.color.g*J.g,1)),I.b=Math.max(0,Math.min(n.color.b*J.b,1))):I.copy(n.color):n instanceof THREE.MeshDepthMaterial?(D=1-n.__2near/(n.__farPlusNear-k.z*n.__farMinusNear),
|
|
|
+I.setRGB(D,D,D)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(g(k.normalWorld.x),g(k.normalWorld.y),g(k.normalWorld.z));n.wireframe?K.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):K.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+n.opacity);m.appendChild(K)}function e(c,e,h,k,n,t,o){j.data.vertices+=4;j.data.faces++;
|
|
|
+K=f(Q++);K.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?I.copy(t.color):t instanceof THREE.MeshLambertMaterial?E?(J.r=C.r,J.g=C.g,J.b=C.b,b(o,n,J),I.r=Math.max(0,Math.min(t.color.r*J.r,1)),I.g=Math.max(0,Math.min(t.color.g*J.g,1)),I.b=Math.max(0,Math.min(t.color.b*J.b,1))):I.copy(t.color):t instanceof
|
|
|
+THREE.MeshDepthMaterial?(D=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),I.setRGB(D,D,D)):t instanceof THREE.MeshNormalMaterial&&I.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));t.wireframe?K.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):K.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+
|
|
|
+t.opacity);m.appendChild(K)}function f(b){H[b]==null&&(H[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),T==0&&H[b].setAttribute("shape-rendering","crispEdges"));return H[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var j=this,h=null,k=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,u,v,t,x,w,A,y=new THREE.Rectangle,G=new THREE.Rectangle,E=!1,I=new THREE.Color(16777215),J=new THREE.Color(16777215),C=new THREE.Color(0),B=new THREE.Color(0),
|
|
|
+L=new THREE.Color(0),D,V=new THREE.Vector3,H=[],S=[],K,Q,n,T=1;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":T=1;break;case "low":T=0}};this.setSize=function(b,c){o=b;p=c;u=o/2;v=p/2;m.setAttribute("viewBox",-u+" "+-v+" "+o+" "+p);m.setAttribute("width",o);m.setAttribute("height",p);y.set(-u,-v,u,v)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=
|
|
|
+function(b,f){var g,o,p,I,J,H,D,P;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,f,this.sortElements);n=Q=0;if(E=b.lights.length>0){D=b.lights;C.setRGB(0,0,0);B.setRGB(0,0,0);L.setRGB(0,0,0);g=0;for(o=D.length;g<o;g++)p=D[g],I=p.color,p instanceof THREE.AmbientLight?(C.r+=I.r,C.g+=I.g,C.b+=I.b):p instanceof THREE.DirectionalLight?(B.r+=I.r,B.g+=I.g,B.b+=I.b):p instanceof THREE.PointLight&&(L.r+=I.r,L.g+=I.g,L.b+=I.b)}g=0;for(o=h.length;g<o;g++)if(D=h[g],G.empty(),
|
|
|
+D instanceof THREE.RenderableParticle){t=D;t.x*=u;t.y*=-v;p=0;for(I=D.materials.length;p<I;)p++}else if(D instanceof THREE.RenderableLine){if(t=D.v1,x=D.v2,t.positionScreen.x*=u,t.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,G.addPoint(t.positionScreen.x,t.positionScreen.y),G.addPoint(x.positionScreen.x,x.positionScreen.y),y.instersects(G)){p=0;for(I=D.materials.length;p<I;)if((P=D.materials[p++])&&P.opacity!=0){J=t;H=x;var ea=n++;S[ea]==null&&(S[ea]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"line"),T==0&&S[ea].setAttribute("shape-rendering","crispEdges"));K=S[ea];K.setAttribute("x1",J.positionScreen.x);K.setAttribute("y1",J.positionScreen.y);K.setAttribute("x2",H.positionScreen.x);K.setAttribute("y2",H.positionScreen.y);P instanceof THREE.LineBasicMaterial&&(K.setAttribute("style","fill: none; stroke: "+P.color.getContextStyle()+"; stroke-width: "+P.linewidth+"; stroke-opacity: "+P.opacity+"; stroke-linecap: "+P.linecap+"; stroke-linejoin: "+P.linejoin),m.appendChild(K))}}}else if(D instanceof
|
|
|
+THREE.RenderableFace3){if(t=D.v1,x=D.v2,w=D.v3,t.positionScreen.x*=u,t.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,G.addPoint(t.positionScreen.x,t.positionScreen.y),G.addPoint(x.positionScreen.x,x.positionScreen.y),G.addPoint(w.positionScreen.x,w.positionScreen.y),y.instersects(G)){p=0;for(I=D.meshMaterials.length;p<I;)if(P=D.meshMaterials[p++],P instanceof THREE.MeshFaceMaterial){J=0;for(H=D.faceMaterials.length;J<H;)(P=D.faceMaterials[J++])&&
|
|
|
+P.opacity!=0&&c(t,x,w,D,P,b)}else P&&P.opacity!=0&&c(t,x,w,D,P,b)}}else if(D instanceof THREE.RenderableFace4&&(t=D.v1,x=D.v2,w=D.v3,A=D.v4,t.positionScreen.x*=u,t.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,A.positionScreen.x*=u,A.positionScreen.y*=-v,G.addPoint(t.positionScreen.x,t.positionScreen.y),G.addPoint(x.positionScreen.x,x.positionScreen.y),G.addPoint(w.positionScreen.x,w.positionScreen.y),G.addPoint(A.positionScreen.x,A.positionScreen.y),
|
|
|
+y.instersects(G))){p=0;for(I=D.meshMaterials.length;p<I;)if(P=D.meshMaterials[p++],P instanceof THREE.MeshFaceMaterial){J=0;for(H=D.faceMaterials.length;J<H;)(P=D.faceMaterials[J++])&&P.opacity!=0&&e(t,x,w,A,D,P,b)}else P&&P.opacity!=0&&e(t,x,w,A,D,P,b)}}};
|
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
|
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
|
|
@@ -223,9 +223,9 @@ for(f=0;f<m;f++)g=f*3,color=t[p[f][1]],u[g]=color.r,u[g+1]=color.g,u[g+2]=color.
|
|
|
y.x,f.array[m+1]=y.y,f.array[m+2]=y.z,f.array[m+3]=y.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<k;f++)h=j[f].position,g=f*3,o[g]=h.x,o[g+1]=h.y,o[g+2]=h.z;if(x)for(f=0;f<m;f++)color=t[f],g=f*3,u[g]=color.r,u[g+1]=color.g,u[g+2]=color.b;if(A)for(w in A)if(f=A[w],f.__original.needsUpdate){t=f.value.length;for(g=0;g<t;g++){m=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[m]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[g];f.size===2?(f.array[m]=
|
|
|
y.x,f.array[m+1]=y.y):f.size===3?f.type==="c"?(f.array[m]=y.r,f.array[m+1]=y.g,f.array[m+2]=y.b):(f.array[m]=y.x,f.array[m+1]=y.y,f.array[m+2]=y.z):(f.array[m]=y.x,f.array[m+1]=y.y,f.array[m+2]=y.z,f.array[m+3]=y.w)}f.offset+=f.size}}}if(v||e.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,o,c);if(x||e.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,b.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,u,c);if(A)for(w in A)if(f=A[w],f.__original.needsUpdate||e.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,
|
|
|
f.buffer),n.bufferData(n.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,h){f.program||Q.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(Q.maxMorphTargets);for(var g=0,j=Q.maxMorphTargets;g<j;g++)h.__webglMorphTargetInfluences[g]=0}var g=f.program,j=g.uniforms,k=f.uniforms;g!=X&&(n.useProgram(g),X=g);n.uniformMatrix4fv(j.projectionMatrix,!1,pa);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
|
|
|
-f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(k.fogColor.value=e.color,e instanceof THREE.Fog)k.fogNear.value=e.near,k.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)k.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var m,t,o,u=0,p=0,v=0,x,y,A,w=Fa,D=w.directional.colors,G=w.directional.positions,I=w.point.colors,U=w.point.positions,C=w.point.distances,
|
|
|
-J=0,E=0,e=t=A=0;for(m=c.length;e<m;e++)if(t=c[e],o=t.color,x=t.position,y=t.intensity,A=t.distance,t instanceof THREE.AmbientLight)u+=o.r,p+=o.g,v+=o.b;else if(t instanceof THREE.DirectionalLight)A=J*3,D[A]=o.r*y,D[A+1]=o.g*y,D[A+2]=o.b*y,G[A]=x.x,G[A+1]=x.y,G[A+2]=x.z,J+=1;else if(t instanceof THREE.SpotLight)A=J*3,D[A]=o.r*y,D[A+1]=o.g*y,D[A+2]=o.b*y,o=1/x.length(),G[A]=x.x*o,G[A+1]=x.y*o,G[A+2]=x.z*o,J+=1;else if(t instanceof THREE.PointLight)t=E*3,I[t]=o.r*y,I[t+1]=o.g*y,I[t+2]=o.b*y,U[t]=x.x,
|
|
|
-U[t+1]=x.y,U[t+2]=x.z,C[E]=A,E+=1;for(e=J*3;e<D.length;e++)D[e]=0;for(e=E*3;e<I.length;e++)I[e]=0;w.point.length=E;w.directional.length=J;w.ambient[0]=u;w.ambient[1]=p;w.ambient[2]=v;c=Fa;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=
|
|
|
+f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(k.fogColor.value=e.color,e instanceof THREE.Fog)k.fogNear.value=e.near,k.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)k.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var m,t,o,u=0,p=0,v=0,x,y,A,w=Fa,E=w.directional.colors,G=w.directional.positions,I=w.point.colors,U=w.point.positions,C=w.point.distances,
|
|
|
+D=0,J=0,e=t=A=0;for(m=c.length;e<m;e++)if(t=c[e],o=t.color,x=t.position,y=t.intensity,A=t.distance,t instanceof THREE.AmbientLight)u+=o.r,p+=o.g,v+=o.b;else if(t instanceof THREE.DirectionalLight)A=D*3,E[A]=o.r*y,E[A+1]=o.g*y,E[A+2]=o.b*y,G[A]=x.x,G[A+1]=x.y,G[A+2]=x.z,D+=1;else if(t instanceof THREE.SpotLight)A=D*3,E[A]=o.r*y,E[A+1]=o.g*y,E[A+2]=o.b*y,o=1/x.length(),G[A]=x.x*o,G[A+1]=x.y*o,G[A+2]=x.z*o,D+=1;else if(t instanceof THREE.PointLight)t=J*3,I[t]=o.r*y,I[t+1]=o.g*y,I[t+2]=o.b*y,U[t]=x.x,
|
|
|
+U[t+1]=x.y,U[t+2]=x.z,C[J]=A,J+=1;for(e=D*3;e<E.length;e++)E[e]=0;for(e=J*3;e<I.length;e++)I[e]=0;w.point.length=J;w.directional.length=D;w.ambient[0]=u;w.ambient[1]=p;w.ambient[2]=v;c=Fa;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=
|
|
|
c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity,(k.map.texture=f.map)&&k.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),k.lightMap.texture=f.lightMap,k.envMap.texture=f.envMap,k.reflectivity.value=f.reflectivity,k.refractionRatio.value=f.refractionRatio,k.combine.value=f.combine,k.useRefract.value=f.envMap&&f.envMap.mapping instanceof
|
|
|
THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)k.psColor.value=f.color,k.opacity.value=f.opacity,k.size.value=f.size,k.scale.value=ya.height/2,k.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)k.ambient.value=f.ambient,k.specular.value=f.specular,k.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=
|
|
|
f.opacity;else if(f instanceof THREE.MeshNormalMaterial)k.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&k.shadowMatrix){for(c=0;c<xa.length;c++)k.shadowMatrix.value[c]=xa[c],k.shadowMap.texture[c]=Q.shadowMap[c];k.shadowDarkness.value=Q.shadowMapDarkness;k.shadowBias.value=Q.shadowMapBias}for(var ja in k)if(m=g.uniforms[ja])if(e=k[ja],u=e.type,c=e.value,u=="i")n.uniform1i(m,c);else if(u=="f")n.uniform1f(m,c);else if(u=="v2")n.uniform2f(m,c.x,c.y);else if(u=="v3")n.uniform3f(m,c.x,c.y,
|
|
@@ -245,20 +245,20 @@ n.bufferData(n.ARRAY_BUFFER,b.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttrib
|
|
|
6]=f,e[p+7]=g,e[p+8]=h}n.bufferData(n.ARRAY_BUFFER,b.normalArray,n.DYNAMIC_DRAW);n.enableVertexAttribArray(c.attributes.normal);n.vertexAttribPointer(c.attributes.normal,3,n.FLOAT,!1,0,0)}n.drawArrays(n.TRIANGLES,0,b.count);b.count=0}function j(b){if(ha!=b.doubleSided)b.doubleSided?n.disable(n.CULL_FACE):n.enable(n.CULL_FACE),ha=b.doubleSided;if(ca!=b.flipSided)b.flipSided?n.frontFace(n.CW):n.frontFace(n.CCW),ca=b.flipSided}function h(b){ga!=b&&(b?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),ga=
|
|
|
b)}function k(b,c,e){$!=b&&(b?n.enable(n.POLYGON_OFFSET_FILL):n.disable(n.POLYGON_OFFSET_FILL),$=b);if(b&&(Y!=c||P!=e))n.polygonOffset(c,e),Y=c,P=e}function m(b){U[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);U[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);U[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);U[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);U[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);U[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+
|
|
|
b.n34);for(var c,b=0;b<6;b++)c=U[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function o(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=U[f].x*c.n14+U[f].y*c.n24+U[f].z*c.n34+U[f].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function u(b){var c,e,f=b.object,g=b.opaque,h=b.transparent;h.count=0;b=g.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?p(h,e):p(g,e)}
|
|
|
-function v(b){var c,e,f,g,h=b.object,j=b.buffer,k=b.opaque,n=b.transparent;n.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=j.materials.length;c<e;c++)(g=j.materials[c])&&(g.transparent?p(n,g):p(k,g))}else(g=c)&&(g.transparent?p(n,g):p(k,g))}function t(b,c){return c.z-b.z}function x(b,c){var k,t,u,p=0,v,x,y,w,D=b.lights;aa||(aa=new THREE.Camera(Q.shadowCameraFov,c.aspect,Q.shadowCameraNear,Q.shadowCameraFar));k=0;for(t=D.length;k<
|
|
|
-t;k++)if(u=D[k],u instanceof THREE.SpotLight&&u.castShadow){Q.shadowMap[p]||(Q.shadowMap[p]=new THREE.WebGLRenderTarget(Q.shadowMapWidth,Q.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));xa[p]||(xa[p]=new THREE.Matrix4);v=Q.shadowMap[p];x=xa[p];aa.position.copy(u.position);aa.target.position.copy(u.target.position);aa.update(void 0,!0);b.update(void 0,!1,aa);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(aa.projectionMatrix);
|
|
|
-x.multiplySelf(aa.matrixWorldInverse);aa.matrixWorldInverse.flattenToArray(la);aa.projectionMatrix.flattenToArray(pa);ja.multiply(aa.projectionMatrix,aa.matrixWorldInverse);m(ja);Q.initWebGLObjects(b);E(v);n.clearColor(1,1,1,1);Q.clear();n.clearColor(ra.r,ra.g,ra.b,na);x=b.__webglObjects.length;u=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)y=b.__webglObjects[v],w=y.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||o(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),A(w,aa,!1),y.render=
|
|
|
-!0):y.render=!1:y.render=!1;h(!0);C(THREE.NormalBlending);for(v=0;v<x;v++)if(y=b.__webglObjects[v],y.render)w=y.object,buffer=y.buffer,j(w),y=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Da:oa,f(aa,D,null,y,buffer,w);for(v=0;v<u;v++)y=b.__webglObjectsImmediate[v],w=y.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),A(w,aa,!1),j(w),program=e(aa,D,null,oa,w),w.render(function(b){g(b,program,oa.shading)}));p++}}function w(b,
|
|
|
+function v(b){var c,e,f,g,h=b.object,j=b.buffer,k=b.opaque,n=b.transparent;n.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=j.materials.length;c<e;c++)(g=j.materials[c])&&(g.transparent?p(n,g):p(k,g))}else(g=c)&&(g.transparent?p(n,g):p(k,g))}function t(b,c){return c.z-b.z}function x(b,c){var k,t,u,p=0,v,x,y,w,E=b.lights;aa||(aa=new THREE.Camera(Q.shadowCameraFov,c.aspect,Q.shadowCameraNear,Q.shadowCameraFar));k=0;for(t=E.length;k<
|
|
|
+t;k++)if(u=E[k],u instanceof THREE.SpotLight&&u.castShadow){Q.shadowMap[p]||(Q.shadowMap[p]=new THREE.WebGLRenderTarget(Q.shadowMapWidth,Q.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));xa[p]||(xa[p]=new THREE.Matrix4);v=Q.shadowMap[p];x=xa[p];aa.position.copy(u.position);aa.target.position.copy(u.target.position);aa.update(void 0,!0);b.update(void 0,!1,aa);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(aa.projectionMatrix);
|
|
|
+x.multiplySelf(aa.matrixWorldInverse);aa.matrixWorldInverse.flattenToArray(la);aa.projectionMatrix.flattenToArray(pa);ja.multiply(aa.projectionMatrix,aa.matrixWorldInverse);m(ja);Q.initWebGLObjects(b);D(v);n.clearColor(1,1,1,1);Q.clear();n.clearColor(ra.r,ra.g,ra.b,na);x=b.__webglObjects.length;u=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)y=b.__webglObjects[v],w=y.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||o(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),A(w,aa,!1),y.render=
|
|
|
+!0):y.render=!1:y.render=!1;h(!0);C(THREE.NormalBlending);for(v=0;v<x;v++)if(y=b.__webglObjects[v],y.render)w=y.object,buffer=y.buffer,j(w),y=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Da:oa,f(aa,E,null,y,buffer,w);for(v=0;v<u;v++)y=b.__webglObjectsImmediate[v],w=y.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),A(w,aa,!1),j(w),program=e(aa,E,null,oa,w),w.render(function(b){g(b,program,oa.shading)}));p++}}function w(b,
|
|
|
c){var e,f,g;e=R.attributes;var h=R.uniforms,j=ia/da,k,m=[],u=da*0.5,o=ia*0.5,p=!0;n.useProgram(R.program);X=R.program;ga=fa=-1;Aa||(n.enableVertexAttribArray(R.attributes.position),n.enableVertexAttribArray(R.attributes.uv),Aa=!0);n.disable(n.CULL_FACE);n.enable(n.BLEND);n.depthMask(!0);n.bindBuffer(n.ARRAY_BUFFER,R.vertexBuffer);n.vertexAttribPointer(e.position,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(e.uv,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,R.elementBuffer);n.uniformMatrix4fv(h.projectionMatrix,
|
|
|
!1,pa);n.activeTexture(n.TEXTURE0);n.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(t);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(n.uniform1i(h.useScreenCoordinates,1),n.uniform3f(h.screenPosition,
|
|
|
(g.position.x-u)/u,(o-g.position.y)/o,Math.max(0,Math.min(1,g.position.z)))):(n.uniform1i(h.useScreenCoordinates,0),n.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),n.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),k=g.map.image.width/(g.scaleByViewport?ia:1),m[0]=k*j*g.scale.x,m[1]=k*g.scale.y,n.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),n.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),n.uniform2f(h.alignment,g.alignment.x,g.alignment.y),n.uniform1f(h.opacity,g.opacity),
|
|
|
n.uniform1f(h.rotation,g.rotation),n.uniform2fv(h.scale,m),g.mergeWith3D&&!p?(n.enable(n.DEPTH_TEST),p=!0):!g.mergeWith3D&&p&&(n.disable(n.DEPTH_TEST),p=!1),C(g.blending),L(g.map,0),n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0));n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(W)}function A(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function y(b){var c,
|
|
|
-e,f,g;g=b.__materials;b=0;for(e=g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function G(b){var c,e,f,g;g=b.__materials;b=0;for(e=g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function D(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function I(b){function c(b){var g=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?g.push("undefined"):g.push(b[e].id);return g.join("_")}var e,
|
|
|
+e,f,g;g=b.__materials;b=0;for(e=g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function G(b){var c,e,f,g;g=b.__materials;b=0;for(e=g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function E(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function I(b){function c(b){var g=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?g.push("undefined"):g.push(b[e].id);return g.join("_")}var e,
|
|
|
f,g,h,j,k,n,m,t={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(h=b.faces.length;g<h;g++)j=b.faces[g],k=j.materials,n=c(k),t[n]==void 0&&(t[n]={hash:n,counter:0}),m=t[n].hash+"_"+t[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:k,vertices:0,numMorphTargets:u}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[m].vertices+j>65535&&(t[n].counter+=1,m=t[n].hash+"_"+t[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],
|
|
|
materials:k,vertices:0,numMorphTargets:u})),b.geometryGroups[m].faces.push(g),b.geometryGroups[m].vertices+=j}function J(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function C(b){if(b!=fa){switch(b){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);
|
|
|
n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}fa=b}}function B(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(n.texParameteri(b,n.TEXTURE_WRAP_S,K(c.wrapS)),n.texParameteri(b,n.TEXTURE_WRAP_T,K(c.wrapT)),n.texParameteri(b,n.TEXTURE_MAG_FILTER,K(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,K(c.minFilter)),n.generateMipmap(b)):(n.texParameteri(b,n.TEXTURE_WRAP_S,
|
|
|
n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_MAG_FILTER,S(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,S(c.minFilter)))}function L(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=n.createTexture(),b.__webglInit=!0;n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?n.texImage2D(n.TEXTURE_2D,0,K(b.format),b.image.width,b.image.height,0,K(b.format),n.UNSIGNED_BYTE,b.image.data):
|
|
|
-n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,b.image);B(n.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+c),n.bindTexture(n.TEXTURE_2D,b.__webglTexture)}function E(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=n.createRenderbuffer();b.__webglTexture=n.createTexture();if(c){n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture);
|
|
|
+n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,b.image);B(n.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+c),n.bindTexture(n.TEXTURE_2D,b.__webglTexture)}function D(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=n.createRenderbuffer();b.__webglTexture=n.createTexture();if(c){n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture);
|
|
|
B(n.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var e=0;e<6;e++)b.__webglFramebuffer[e]=n.createFramebuffer(),n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,K(b.format),b.width,b.height,0,K(b.format),K(b.type),null)}else b.__webglFramebuffer=n.createFramebuffer(),n.bindTexture(n.TEXTURE_2D,b.__webglTexture),B(n.TEXTURE_2D,b,b),n.texImage2D(n.TEXTURE_2D,0,K(b.format),b.width,b.height,0,K(b.format),K(b.type),null);n.bindRenderbuffer(n.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(e=0;e<6;++e)n.bindFramebuffer(n.FRAMEBUFFER,
|
|
|
b.__webglFramebuffer[e]),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+e,b.__webglTexture,0);else n.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&
|
|
|
b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,b.width,b.height);c?n.bindTexture(n.TEXTURE_CUBE_MAP,null):n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null)}var f,g;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height,
|
|
@@ -269,65 +269,65 @@ case THREE.IntType:return n.INT;case THREE.UnsignedShortType:return n.UNSIGNED_I
|
|
|
new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Matrix4,pa=new Float32Array(16),la=new Float32Array(16),ma=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ya=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ia=b.stencil!==void 0?b.stencil:!0,Ja=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Ta=b.antialias!==void 0?b.antialias:!1,ra=b.clearColor!==void 0?new THREE.Color(b.clearColor):
|
|
|
new THREE.Color(0),na=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ya;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var aa,xa=[],b=THREE.ShaderLib.depthRGBA,
|
|
|
va=THREE.UniformsUtils.clone(b.uniforms),oa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:va}),Da=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:va,morphTargets:!0});oa._shadowPass=!0;Da._shadowPass=!0;try{if(!(n=ya.getContext("experimental-webgl",{antialias:Ta,stencil:Ia,preserveDrawingBuffer:Ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+
|
|
|
-" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}n.clearColor(0,0,0,1);n.clearDepth(1);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(ra.r,ra.g,ra.b,na);this.context=n;var sa=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,R={};R.vertices=new Float32Array(16);
|
|
|
-R.faces=new Uint16Array(6);i=0;R.vertices[i++]=-1;R.vertices[i++]=-1;R.vertices[i++]=0;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=-1;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=0;R.vertices[i++]=-1;R.vertices[i++]=1;R.vertices[i++]=0;i=R.vertices[i++]=0;R.faces[i++]=0;R.faces[i++]=1;R.faces[i++]=2;R.faces[i++]=0;R.faces[i++]=2;R.faces[i++]=3;R.vertexBuffer=n.createBuffer();R.elementBuffer=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,
|
|
|
-R.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,R.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,R.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,R.faces,n.STATIC_DRAW);R.program=n.createProgram();n.attachShader(R.program,H("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(R.program,H("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(R.program);R.attributes={};R.uniforms={};R.attributes.position=n.getAttribLocation(R.program,"position");R.attributes.uv=n.getAttribLocation(R.program,
|
|
|
-"uv");R.uniforms.uvOffset=n.getUniformLocation(R.program,"uvOffset");R.uniforms.uvScale=n.getUniformLocation(R.program,"uvScale");R.uniforms.rotation=n.getUniformLocation(R.program,"rotation");R.uniforms.scale=n.getUniformLocation(R.program,"scale");R.uniforms.alignment=n.getUniformLocation(R.program,"alignment");R.uniforms.map=n.getUniformLocation(R.program,"map");R.uniforms.opacity=n.getUniformLocation(R.program,"opacity");R.uniforms.useScreenCoordinates=n.getUniformLocation(R.program,"useScreenCoordinates");
|
|
|
-R.uniforms.affectedByDistance=n.getUniformLocation(R.program,"affectedByDistance");R.uniforms.screenPosition=n.getUniformLocation(R.program,"screenPosition");R.uniforms.modelViewMatrix=n.getUniformLocation(R.program,"modelViewMatrix");R.uniforms.projectionMatrix=n.getUniformLocation(R.program,"projectionMatrix");var Aa=!1;this.setSize=function(b,c){ya.width=b;ya.height=c;this.setViewport(0,0,ya.width,ya.height)};this.setViewport=function(b,c,e,f){ea=b;Z=c;da=e;ia=f;n.viewport(ea,Z,da,ia)};this.setScissor=
|
|
|
-function(b,c,e,f){n.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){W=b;n.depthMask(b)};this.setClearColorHex=function(b,c){ra.setHex(b);na=c;n.clearColor(ra.r,ra.g,ra.b,na)};this.setClearColor=function(b,c){ra.copy(b);na=c;n.clearColor(ra.r,ra.g,ra.b,na)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)};this.getContext=function(){return n};this.initMaterial=
|
|
|
-function(b,c,e,f){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=
|
|
|
-k.fragmentShader}var m,t,u;m=u=k=0;for(t=c.length;m<t;m++)h=c[m],h instanceof THREE.SpotLight&&u++,h instanceof THREE.DirectionalLight&&u++,h instanceof THREE.PointLight&&k++;k+u<=_maxLights?m=u:(m=Math.ceil(_maxLights*u/(k+u)),k=_maxLights-m);h={directional:m,point:k};k=u=0;for(m=c.length;k<m;k++)t=c[k],t instanceof THREE.SpotLight&&t.castShadow&&u++;var o=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)o=f.bones.length;var p;a:{m=b.fragmentShader;t=b.vertexShader;var k=b.uniforms,c=b.attributes,
|
|
|
-e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(m),f.push(t));
|
|
|
-for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=T.length;v<f;v++)if(T[v].code==j){p=T[v].program;break a}v=n.createProgram();f=[sa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?
|
|
|
-"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}n.clearColor(0,0,0,1);n.clearDepth(1);n.clearStencil(0);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(ra.r,ra.g,ra.b,na);this.context=n;var sa=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,
|
|
|
+R={};R.vertices=new Float32Array(16);R.faces=new Uint16Array(6);i=0;R.vertices[i++]=-1;R.vertices[i++]=-1;R.vertices[i++]=0;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=-1;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=0;R.vertices[i++]=-1;R.vertices[i++]=1;R.vertices[i++]=0;i=R.vertices[i++]=0;R.faces[i++]=0;R.faces[i++]=1;R.faces[i++]=2;R.faces[i++]=0;R.faces[i++]=2;R.faces[i++]=3;R.vertexBuffer=n.createBuffer();R.elementBuffer=n.createBuffer();
|
|
|
+n.bindBuffer(n.ARRAY_BUFFER,R.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,R.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,R.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,R.faces,n.STATIC_DRAW);R.program=n.createProgram();n.attachShader(R.program,H("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(R.program,H("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(R.program);R.attributes={};R.uniforms={};R.attributes.position=n.getAttribLocation(R.program,"position");
|
|
|
+R.attributes.uv=n.getAttribLocation(R.program,"uv");R.uniforms.uvOffset=n.getUniformLocation(R.program,"uvOffset");R.uniforms.uvScale=n.getUniformLocation(R.program,"uvScale");R.uniforms.rotation=n.getUniformLocation(R.program,"rotation");R.uniforms.scale=n.getUniformLocation(R.program,"scale");R.uniforms.alignment=n.getUniformLocation(R.program,"alignment");R.uniforms.map=n.getUniformLocation(R.program,"map");R.uniforms.opacity=n.getUniformLocation(R.program,"opacity");R.uniforms.useScreenCoordinates=
|
|
|
+n.getUniformLocation(R.program,"useScreenCoordinates");R.uniforms.affectedByDistance=n.getUniformLocation(R.program,"affectedByDistance");R.uniforms.screenPosition=n.getUniformLocation(R.program,"screenPosition");R.uniforms.modelViewMatrix=n.getUniformLocation(R.program,"modelViewMatrix");R.uniforms.projectionMatrix=n.getUniformLocation(R.program,"projectionMatrix");var Aa=!1;this.setSize=function(b,c){ya.width=b;ya.height=c;this.setViewport(0,0,ya.width,ya.height)};this.setViewport=function(b,c,
|
|
|
+e,f){ea=b;Z=c;da=e;ia=f;n.viewport(ea,Z,da,ia)};this.setScissor=function(b,c,e,f){n.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){W=b;n.depthMask(b)};this.setClearColorHex=function(b,c){ra.setHex(b);na=c;n.clearColor(ra.r,ra.g,ra.b,na)};this.setClearColor=function(b,c){ra.copy(b);na=c;n.clearColor(ra.r,ra.g,ra.b,na)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)};
|
|
|
+this.getContext=function(){return n};this.initMaterial=function(b,c,e,f){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);
|
|
|
+b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var m,t,u;m=u=k=0;for(t=c.length;m<t;m++)h=c[m],h instanceof THREE.SpotLight&&u++,h instanceof THREE.DirectionalLight&&u++,h instanceof THREE.PointLight&&k++;k+u<=_maxLights?m=u:(m=Math.ceil(_maxLights*u/(k+u)),k=_maxLights-m);h={directional:m,point:k};k=u=0;for(m=c.length;k<m;k++)t=c[k],t instanceof THREE.SpotLight&&t.castShadow&&u++;var o=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)o=f.bones.length;var p;a:{m=b.fragmentShader;
|
|
|
+t=b.vertexShader;var k=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},
|
|
|
+v,f=[];j?f.push(j):(f.push(m),f.push(t));for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=T.length;v<f;v++)if(T[v].code==j){p=T[v].program;break a}v=n.createProgram();f=[sa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?
|
|
|
+"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":
|
|
|
"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");n.attachShader(v,H("fragment",h+m));n.attachShader(v,H("vertex",f+t));n.linkProgram(v);n.getProgramParameter(v,n.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+n.getProgramParameter(v,n.VALIDATE_STATUS)+", gl error ["+n.getError()+"]");v.uniforms=
|
|
|
{};v.attributes={};var x,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in k)f.push(x);x=f;f=0;for(k=x.length;f<k;f++)m=x[f],v.uniforms[m]=n.getUniformLocation(v,m);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<e.maxMorphTargets;x++)f.push("morphTarget"+x);for(p in c)f.push(p);p=f;x=0;for(c=p.length;x<c;x++)e=
|
|
|
p[x],v.attributes[e]=n.getAttribLocation(v,e);T.push({program:v,code:j});p=v}b.program=p;p=b.program.attributes;p.position>=0&&n.enableVertexAttribArray(p.position);p.color>=0&&n.enableVertexAttribArray(p.color);p.normal>=0&&n.enableVertexAttribArray(p.normal);p.tangent>=0&&n.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(n.enableVertexAttribArray(p.skinVertexA),n.enableVertexAttribArray(p.skinVertexB),n.enableVertexAttribArray(p.skinIndex),
|
|
|
-n.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&n.enableVertexAttribArray(p[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)x="morphTarget"+g,p[x]>=0&&(n.enableVertexAttribArray(p[x]),b.numSupportedMorphTargets++)};this.render=function(b,c,n,p){var y,D,G,I,U,J,H,B,L=b.lights,P=b.fog;this.shadowMapEnabled&&x(b,c);Q.data.vertices=0;Q.data.faces=0;Q.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
|
|
|
-!1,c);c.matrixWorldInverse.flattenToArray(la);c.projectionMatrix.flattenToArray(pa);ja.multiply(c.projectionMatrix,c.matrixWorldInverse);m(ja);this.initWebGLObjects(b);E(n);(this.autoClear||p)&&this.clear();U=b.__webglObjects.length;for(p=0;p<U;p++)if(y=b.__webglObjects[p],H=y.object,H.visible)if(!(H instanceof THREE.Mesh)||o(H)){if(H.matrixWorld.flattenToArray(H._objectMatrixArray),A(H,c,!0),v(y),y.render=!0,this.sortObjects)y.object.renderDepth?y.z=y.object.renderDepth:(ma.copy(H.position),ja.multiplyVector3(ma),
|
|
|
-y.z=ma.z)}else y.render=!1;else y.render=!1;this.sortObjects&&b.__webglObjects.sort(t);J=b.__webglObjectsImmediate.length;for(p=0;p<J;p++)y=b.__webglObjectsImmediate[p],H=y.object,H.visible&&(H.matrixAutoUpdate&&H.matrixWorld.flattenToArray(H._objectMatrixArray),A(H,c,!0),u(y));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);C(b.overrideMaterial.blending);for(p=0;p<U;p++)if(y=b.__webglObjects[p],y.render)H=y.object,B=y.buffer,j(H),f(c,L,P,b.overrideMaterial,B,H);for(p=0;p<J;p++)y=b.__webglObjectsImmediate[p],
|
|
|
-H=y.object,H.visible&&(j(H),D=e(c,L,P,b.overrideMaterial,H),H.render(function(c){g(c,D,b.overrideMaterial.shading)}))}else{C(THREE.NormalBlending);for(p=U-1;p>=0;p--)if(y=b.__webglObjects[p],y.render){H=y.object;B=y.buffer;G=y.opaque;j(H);for(y=0;y<G.count;y++)I=G.list[y],h(I.depthTest),k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,L,P,I,B,H)}for(p=0;p<J;p++)if(y=b.__webglObjectsImmediate[p],H=y.object,H.visible){G=y.opaque;j(H);for(y=0;y<G.count;y++)I=G.list[y],h(I.depthTest),
|
|
|
-k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),D=e(c,L,P,I,H),H.render(function(b){g(b,D,I.shading)})}for(p=0;p<U;p++)if(y=b.__webglObjects[p],y.render){H=y.object;B=y.buffer;G=y.transparent;j(H);for(y=0;y<G.count;y++)I=G.list[y],C(I.blending),h(I.depthTest),k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,L,P,I,B,H)}for(p=0;p<J;p++)if(y=b.__webglObjectsImmediate[p],H=y.object,H.visible){G=y.transparent;j(H);for(y=0;y<G.count;y++)I=G.list[y],C(I.blending),h(I.depthTest),
|
|
|
-k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),D=e(c,L,P,I,H),H.render(function(b){g(b,D,I.shading)})}}b.__webglSprites.length&&w(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&V(n)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,g=void 0,h=void 0,j=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,
|
|
|
-e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(g in h=e.geometry,h.geometryGroups==void 0&&I(h),h.geometryGroups){j=h.geometryGroups[g];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=n.createBuffer();k.__webglNormalBuffer=n.createBuffer();k.__webglTangentBuffer=n.createBuffer();k.__webglColorBuffer=n.createBuffer();k.__webglUVBuffer=
|
|
|
-n.createBuffer();k.__webglUV2Buffer=n.createBuffer();k.__webglSkinVertexABuffer=n.createBuffer();k.__webglSkinVertexBBuffer=n.createBuffer();k.__webglSkinIndicesBuffer=n.createBuffer();k.__webglSkinWeightsBuffer=n.createBuffer();k.__webglFaceBuffer=n.createBuffer();k.__webglLineBuffer=n.createBuffer();if(k.numMorphTargets){var m=void 0,t=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(t=k.numMorphTargets;m<t;m++)k.__webglMorphTargetsBuffers.push(n.createBuffer())}for(var k=j,m=e,p=void 0,u=void 0,
|
|
|
-o=void 0,v=o=void 0,x=void 0,w=void 0,A=w=t=0,U=o=u=void 0,H=U=u=p=void 0,o=void 0,v=m.geometry,x=v.faces,U=k.faces,p=0,u=U.length;p<u;p++)o=U[p],o=x[o],o instanceof THREE.Face3?(t+=3,w+=1,A+=3):o instanceof THREE.Face4&&(t+=4,w+=2,A+=4);for(var p=k,u=m,C=U=x=void 0,E=void 0,C=void 0,o=[],x=0,U=u.materials.length;x<U;x++)if(C=u.materials[x],C instanceof THREE.MeshFaceMaterial){C=0;for(l=p.materials.length;C<l;C++)(E=p.materials[C])&&o.push(E)}else(E=C)&&o.push(E);p=o;k.__materials=p;a:{x=u=void 0;
|
|
|
-U=p.length;for(u=0;u<U;u++)if(x=p[u],x.map||x.lightMap||x instanceof THREE.MeshShaderMaterial){u=!0;break a}u=!1}a:{U=x=void 0;o=p.length;for(x=0;x<o;x++)if(U=p[x],!(U instanceof THREE.MeshBasicMaterial&&!U.envMap||U instanceof THREE.MeshDepthMaterial)){U=U&&U.shading!=void 0&&U.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}U=!1}a:{o=x=void 0;C=p.length;for(x=0;x<C;x++)if(o=p[x],o.vertexColors){o=o.vertexColors;break a}o=!1}k.__vertexArray=new Float32Array(t*3);if(U)k.__normalArray=
|
|
|
-new Float32Array(t*3);if(v.hasTangents)k.__tangentArray=new Float32Array(t*4);if(o)k.__colorArray=new Float32Array(t*3);if(u){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)k.__uvArray=new Float32Array(t*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(t*2)}if(m.geometry.skinWeights.length&&m.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(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(A*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];v=0;for(x=k.numMorphTargets;v<x;v++)k.__morphTargetsArrays.push(new Float32Array(t*3))}k.__needsSmoothNormals=U==THREE.SmoothShading;k.__uvType=u;k.__vertexColorType=o;k.__normalType=U;k.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=A*2;v=0;for(x=p.length;v<
|
|
|
-x;v++)if(u=p[v],u.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in u.attributes){o=u.attributes[a];U={};for(H in o)U[H]=o[H];if(!U.__webglInitialized||U.createUniqueBuffers)U.__webglInitialized=!0,w=1,U.type==="v2"?w=2:U.type==="v3"?w=3:U.type==="v4"?w=4:U.type==="c"&&(w=3),U.size=w,U.array=new Float32Array(t*w),U.buffer=n.createBuffer(),U.buffer.belongsToAttribute=a,o.needsUpdate=!0,U.__original=o;k.__webglCustomAttributes[a]=U}}k.__inittedArrays=!0;h.__dirtyVertices=
|
|
|
-!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}J(f.__webglObjects,j,e)}else if(e instanceof THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=n.createBuffer(),g.__webglColorBuffer=n.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*3),g.__webglVertexCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;J(f.__webglObjects,h,e)}else if(e instanceof
|
|
|
-THREE.Line){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=n.createBuffer(),g.__webglColorBuffer=n.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*3),g.__webglLineCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;J(f.__webglObjects,h,e)}else if(e instanceof THREE.ParticleSystem){h=e.geometry;if(!h.__webglVertexBuffer){g=h;g.__webglVertexBuffer=n.createBuffer();g.__webglColorBuffer=n.createBuffer();g=h;j=e;k=g.vertices.length;
|
|
|
-g.__vertexArray=new Float32Array(k*3);g.__colorArray=new Float32Array(k*3);g.__sortArray=[];g.__webglParticleCount=k;g.__materials=j.materials;H=t=m=void 0;m=0;for(t=j.materials.length;m<t;m++)if(H=j.materials[m],H.attributes){if(g.__webglCustomAttributes===void 0)g.__webglCustomAttributes={};for(a in H.attributes){originalAttribute=H.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=
|
|
|
-!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=n.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;g.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=!0;h.__dirtyColors=!0}J(f.__webglObjects,h,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?
|
|
|
-f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)D(e.__webglObjects,f);else if(f instanceof THREE.Sprite){e=e.__webglSprites;h=void 0;for(h=e.length-1;h>=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof
|
|
|
-THREE.MarchingCubes&&D(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(g=b.__webglObjects[e].object,m=k=h=j=void 0,g instanceof THREE.Mesh){h=g.geometry;for(j in h.geometryGroups)if(k=h.geometryGroups[j],m=y(k),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=k,t=n.DYNAMIC_DRAW,H=!h.dynamic,m.__inittedArrays){var ja=A=w=void 0,B=void 0,L=ja=void 0,P=void 0,
|
|
|
-pa=void 0,K=void 0,M=E=C=o=U=x=u=p=v=void 0,F=B=K=B=pa=P=void 0,z=void 0,N=z=F=P=void 0,Q=void 0,S=N=z=F=ja=ja=L=K=B=N=z=F=Q=N=z=F=Q=N=z=F=void 0,la=0,R=0,ea=0,ca=0,V=0,T=0,Z=0,X=0,da=0,O=0,W=0,N=F=0,N=void 0,Y=m.__vertexArray,ga=m.__uvArray,ha=m.__uv2Array,fa=m.__normalArray,ma=m.__tangentArray,$=m.__colorArray,ia=m.__skinVertexAArray,aa=m.__skinVertexBArray,ta=m.__skinIndexArray,ua=m.__skinWeightArray,sa=m.__morphTargetsArrays,na=m.__webglCustomAttributes,z=void 0,ra=m.__faceArray,oa=m.__lineArray,
|
|
|
-ya=m.__needsSmoothNormals,p=m.__vertexColorType,v=m.__uvType,u=m.__normalType,wa=g.geometry,Fa=wa.__dirtyVertices,va=wa.__dirtyElements,xa=wa.__dirtyUvs,Aa=wa.__dirtyNormals,Ia=wa.__dirtyTangents,Ja=wa.__dirtyColors,Da=wa.__dirtyMorphTargets,Pa=wa.vertices,Ga=m.faces,Ta=wa.faces,ab=wa.faceVertexUvs[0],bb=wa.faceVertexUvs[1],Qa=wa.skinVerticesA,Ra=wa.skinVerticesB,Sa=wa.skinIndices,Ha=wa.skinWeights,Ea=wa.morphTargets;if(na)for(S in na)na[S].offset=0,na[S].offsetSrc=0;w=0;for(A=Ga.length;w<A;w++)if(ja=
|
|
|
-Ga[w],B=Ta[ja],ab&&(x=ab[ja]),bb&&(U=bb[ja]),ja=B.vertexNormals,L=B.normal,P=B.vertexColors,pa=B.color,K=B.vertexTangents,B instanceof THREE.Face3){if(Fa)o=Pa[B.a].position,C=Pa[B.b].position,E=Pa[B.c].position,Y[R]=o.x,Y[R+1]=o.y,Y[R+2]=o.z,Y[R+3]=C.x,Y[R+4]=C.y,Y[R+5]=C.z,Y[R+6]=E.x,Y[R+7]=E.y,Y[R+8]=E.z,R+=9;if(na)for(S in na)if(z=na[S],z.__original.needsUpdate)F=z.offset,N=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F]=z.value[B.a],z.array[F+1]=z.value[B.b],z.array[F+
|
|
|
-2]=z.value[B.c]):z.boundTo==="faces"?(N=z.value[N],z.array[F]=N,z.array[F+1]=N,z.array[F+2]=N,z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F]=z.value[N],z.array[F+1]=z.value[N+1],z.array[F+2]=z.value[N+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(o=z.value[B.a],C=z.value[B.b],E=z.value[B.c]):z.boundTo==="faces"?(E=C=o=N=z.value[N],z.offsetSrc++):z.boundTo==="faceVertices"&&(o=z.value[N],C=z.value[N+1],E=z.value[N+2],z.offsetSrc+=3),z.size===2?(z.array[F]=o.x,
|
|
|
-z.array[F+1]=o.y,z.array[F+2]=C.x,z.array[F+3]=C.y,z.array[F+4]=E.x,z.array[F+5]=E.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[F]=o.r,z.array[F+1]=o.g,z.array[F+2]=o.b,z.array[F+3]=C.r,z.array[F+4]=C.g,z.array[F+5]=C.b,z.array[F+6]=E.r,z.array[F+7]=E.g,z.array[F+8]=E.b):(z.array[F]=o.x,z.array[F+1]=o.y,z.array[F+2]=o.z,z.array[F+3]=C.x,z.array[F+4]=C.y,z.array[F+5]=C.z,z.array[F+6]=E.x,z.array[F+7]=E.y,z.array[F+8]=E.z),z.offset+=9):(z.array[F]=o.x,z.array[F+1]=o.y,z.array[F+2]=o.z,z.array[F+
|
|
|
-3]=o.w,z.array[F+4]=C.x,z.array[F+5]=C.y,z.array[F+6]=C.z,z.array[F+7]=C.w,z.array[F+8]=E.x,z.array[F+9]=E.y,z.array[F+10]=E.z,z.array[F+11]=E.w,z.offset+=12));if(Da){F=0;for(z=Ea.length;F<z;F++)o=Ea[F].vertices[B.a].position,C=Ea[F].vertices[B.b].position,E=Ea[F].vertices[B.c].position,N=sa[F],N[W]=o.x,N[W+1]=o.y,N[W+2]=o.z,N[W+3]=C.x,N[W+4]=C.y,N[W+5]=C.z,N[W+6]=E.x,N[W+7]=E.y,N[W+8]=E.z;W+=9}if(Ha.length)F=Ha[B.a],z=Ha[B.b],N=Ha[B.c],ua[O]=F.x,ua[O+1]=F.y,ua[O+2]=F.z,ua[O+3]=F.w,ua[O+4]=z.x,ua[O+
|
|
|
-5]=z.y,ua[O+6]=z.z,ua[O+7]=z.w,ua[O+8]=N.x,ua[O+9]=N.y,ua[O+10]=N.z,ua[O+11]=N.w,F=Sa[B.a],z=Sa[B.b],N=Sa[B.c],ta[O]=F.x,ta[O+1]=F.y,ta[O+2]=F.z,ta[O+3]=F.w,ta[O+4]=z.x,ta[O+5]=z.y,ta[O+6]=z.z,ta[O+7]=z.w,ta[O+8]=N.x,ta[O+9]=N.y,ta[O+10]=N.z,ta[O+11]=N.w,F=Qa[B.a],z=Qa[B.b],N=Qa[B.c],ia[O]=F.x,ia[O+1]=F.y,ia[O+2]=F.z,ia[O+3]=1,ia[O+4]=z.x,ia[O+5]=z.y,ia[O+6]=z.z,ia[O+7]=1,ia[O+8]=N.x,ia[O+9]=N.y,ia[O+10]=N.z,ia[O+11]=1,F=Ra[B.a],z=Ra[B.b],N=Ra[B.c],aa[O]=F.x,aa[O+1]=F.y,aa[O+2]=F.z,aa[O+3]=1,aa[O+
|
|
|
-4]=z.x,aa[O+5]=z.y,aa[O+6]=z.z,aa[O+7]=1,aa[O+8]=N.x,aa[O+9]=N.y,aa[O+10]=N.z,aa[O+11]=1,O+=12;if(Ja&&p)P.length==3&&p==THREE.VertexColors?(B=P[0],F=P[1],z=P[2]):z=F=B=pa,$[da]=B.r,$[da+1]=B.g,$[da+2]=B.b,$[da+3]=F.r,$[da+4]=F.g,$[da+5]=F.b,$[da+6]=z.r,$[da+7]=z.g,$[da+8]=z.b,da+=9;if(Ia&&wa.hasTangents)P=K[0],pa=K[1],B=K[2],ma[Z]=P.x,ma[Z+1]=P.y,ma[Z+2]=P.z,ma[Z+3]=P.w,ma[Z+4]=pa.x,ma[Z+5]=pa.y,ma[Z+6]=pa.z,ma[Z+7]=pa.w,ma[Z+8]=B.x,ma[Z+9]=B.y,ma[Z+10]=B.z,ma[Z+11]=B.w,Z+=12;if(Aa&&u)if(ja.length==
|
|
|
-3&&ya)for(K=0;K<3;K++)L=ja[K],fa[T]=L.x,fa[T+1]=L.y,fa[T+2]=L.z,T+=3;else for(K=0;K<3;K++)fa[T]=L.x,fa[T+1]=L.y,fa[T+2]=L.z,T+=3;if(xa&&x!==void 0&&v)for(K=0;K<3;K++)ja=x[K],ga[ea]=ja.u,ga[ea+1]=ja.v,ea+=2;if(xa&&U!==void 0&&v)for(K=0;K<3;K++)ja=U[K],ha[ca]=ja.u,ha[ca+1]=ja.v,ca+=2;va&&(ra[V]=la,ra[V+1]=la+1,ra[V+2]=la+2,V+=3,oa[X]=la,oa[X+1]=la+1,oa[X+2]=la,oa[X+3]=la+2,oa[X+4]=la+1,oa[X+5]=la+2,X+=6,la+=3)}else if(B instanceof THREE.Face4){if(Fa)o=Pa[B.a].position,C=Pa[B.b].position,E=Pa[B.c].position,
|
|
|
-M=Pa[B.d].position,Y[R]=o.x,Y[R+1]=o.y,Y[R+2]=o.z,Y[R+3]=C.x,Y[R+4]=C.y,Y[R+5]=C.z,Y[R+6]=E.x,Y[R+7]=E.y,Y[R+8]=E.z,Y[R+9]=M.x,Y[R+10]=M.y,Y[R+11]=M.z,R+=12;if(na)for(S in na)if(z=na[S],z.__original.needsUpdate)F=z.offset,N=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F]=z.value[B.a],z.array[F+1]=z.value[B.b],z.array[F+2]=z.value[B.c],z.array[F+3]=z.value[B.d]):z.boundTo==="faces"?(N=z.value[N],z.array[F]=N,z.array[F+1]=N,z.array[F+2]=N,z.array[F+3]=N,z.offsetSrc++):
|
|
|
-z.boundTo==="faceVertices"&&(z.array[F]=z.value[N],z.array[F+1]=z.value[N+1],z.array[F+2]=z.value[N+2],z.array[F+3]=z.value[N+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(o=z.value[B.a],C=z.value[B.b],E=z.value[B.c],M=z.value[B.d]):z.boundTo==="faces"?(M=E=C=o=N=z.value[N],z.offsetSrc++):z.boundTo==="faceVertices"&&(o=z.value[N],C=z.value[N+1],E=z.value[N+2],M=z.value[N+3],z.offsetSrc+=4),z.size===2?(z.array[F]=o.x,z.array[F+1]=o.y,z.array[F+2]=C.x,z.array[F+3]=C.y,
|
|
|
-z.array[F+4]=E.x,z.array[F+5]=E.y,z.array[F+6]=M.x,z.array[F+7]=M.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[F]=o.r,z.array[F+1]=o.g,z.array[F+2]=o.b,z.array[F+3]=C.r,z.array[F+4]=C.g,z.array[F+5]=C.b,z.array[F+6]=E.r,z.array[F+7]=E.g,z.array[F+8]=E.b,z.array[F+9]=M.r,z.array[F+10]=M.g,z.array[F+11]=M.b):(z.array[F]=o.x,z.array[F+1]=o.y,z.array[F+2]=o.z,z.array[F+3]=C.x,z.array[F+4]=C.y,z.array[F+5]=C.z,z.array[F+6]=E.x,z.array[F+7]=E.y,z.array[F+8]=E.z,z.array[F+9]=M.x,z.array[F+10]=M.y,z.array[F+
|
|
|
-11]=M.z),z.offset+=12):(z.array[F]=o.x,z.array[F+1]=o.y,z.array[F+2]=o.z,z.array[F+3]=o.w,z.array[F+4]=C.x,z.array[F+5]=C.y,z.array[F+6]=C.z,z.array[F+7]=C.w,z.array[F+8]=E.x,z.array[F+9]=E.y,z.array[F+10]=E.z,z.array[F+11]=E.w,z.array[F+12]=M.x,z.array[F+13]=M.y,z.array[F+14]=M.z,z.array[F+15]=M.w,z.offset+=16));if(Da){F=0;for(z=Ea.length;F<z;F++)o=Ea[F].vertices[B.a].position,C=Ea[F].vertices[B.b].position,E=Ea[F].vertices[B.c].position,M=Ea[F].vertices[B.d].position,N=sa[F],N[W]=o.x,N[W+1]=o.y,
|
|
|
-N[W+2]=o.z,N[W+3]=C.x,N[W+4]=C.y,N[W+5]=C.z,N[W+6]=E.x,N[W+7]=E.y,N[W+8]=E.z,N[W+9]=M.x,N[W+10]=M.y,N[W+11]=M.z;W+=12}if(Ha.length)F=Ha[B.a],z=Ha[B.b],N=Ha[B.c],Q=Ha[B.d],ua[O]=F.x,ua[O+1]=F.y,ua[O+2]=F.z,ua[O+3]=F.w,ua[O+4]=z.x,ua[O+5]=z.y,ua[O+6]=z.z,ua[O+7]=z.w,ua[O+8]=N.x,ua[O+9]=N.y,ua[O+10]=N.z,ua[O+11]=N.w,ua[O+12]=Q.x,ua[O+13]=Q.y,ua[O+14]=Q.z,ua[O+15]=Q.w,F=Sa[B.a],z=Sa[B.b],N=Sa[B.c],Q=Sa[B.d],ta[O]=F.x,ta[O+1]=F.y,ta[O+2]=F.z,ta[O+3]=F.w,ta[O+4]=z.x,ta[O+5]=z.y,ta[O+6]=z.z,ta[O+7]=z.w,
|
|
|
-ta[O+8]=N.x,ta[O+9]=N.y,ta[O+10]=N.z,ta[O+11]=N.w,ta[O+12]=Q.x,ta[O+13]=Q.y,ta[O+14]=Q.z,ta[O+15]=Q.w,F=Qa[B.a],z=Qa[B.b],N=Qa[B.c],Q=Qa[B.d],ia[O]=F.x,ia[O+1]=F.y,ia[O+2]=F.z,ia[O+3]=1,ia[O+4]=z.x,ia[O+5]=z.y,ia[O+6]=z.z,ia[O+7]=1,ia[O+8]=N.x,ia[O+9]=N.y,ia[O+10]=N.z,ia[O+11]=1,ia[O+12]=Q.x,ia[O+13]=Q.y,ia[O+14]=Q.z,ia[O+15]=1,F=Ra[B.a],z=Ra[B.b],N=Ra[B.c],B=Ra[B.d],aa[O]=F.x,aa[O+1]=F.y,aa[O+2]=F.z,aa[O+3]=1,aa[O+4]=z.x,aa[O+5]=z.y,aa[O+6]=z.z,aa[O+7]=1,aa[O+8]=N.x,aa[O+9]=N.y,aa[O+10]=N.z,aa[O+
|
|
|
-11]=1,aa[O+12]=B.x,aa[O+13]=B.y,aa[O+14]=B.z,aa[O+15]=1,O+=16;if(Ja&&p)P.length==4&&p==THREE.VertexColors?(B=P[0],F=P[1],z=P[2],P=P[3]):P=z=F=B=pa,$[da]=B.r,$[da+1]=B.g,$[da+2]=B.b,$[da+3]=F.r,$[da+4]=F.g,$[da+5]=F.b,$[da+6]=z.r,$[da+7]=z.g,$[da+8]=z.b,$[da+9]=P.r,$[da+10]=P.g,$[da+11]=P.b,da+=12;if(Ia&&wa.hasTangents)P=K[0],pa=K[1],B=K[2],K=K[3],ma[Z]=P.x,ma[Z+1]=P.y,ma[Z+2]=P.z,ma[Z+3]=P.w,ma[Z+4]=pa.x,ma[Z+5]=pa.y,ma[Z+6]=pa.z,ma[Z+7]=pa.w,ma[Z+8]=B.x,ma[Z+9]=B.y,ma[Z+10]=B.z,ma[Z+11]=B.w,ma[Z+
|
|
|
-12]=K.x,ma[Z+13]=K.y,ma[Z+14]=K.z,ma[Z+15]=K.w,Z+=16;if(Aa&&u)if(ja.length==4&&ya)for(K=0;K<4;K++)L=ja[K],fa[T]=L.x,fa[T+1]=L.y,fa[T+2]=L.z,T+=3;else for(K=0;K<4;K++)fa[T]=L.x,fa[T+1]=L.y,fa[T+2]=L.z,T+=3;if(xa&&x!==void 0&&v)for(K=0;K<4;K++)ja=x[K],ga[ea]=ja.u,ga[ea+1]=ja.v,ea+=2;if(xa&&U!==void 0&&v)for(K=0;K<4;K++)ja=U[K],ha[ca]=ja.u,ha[ca+1]=ja.v,ca+=2;va&&(ra[V]=la,ra[V+1]=la+1,ra[V+2]=la+3,ra[V+3]=la+1,ra[V+4]=la+2,ra[V+5]=la+3,V+=6,oa[X]=la,oa[X+1]=la+1,oa[X+2]=la,oa[X+3]=la+3,oa[X+4]=la+1,
|
|
|
-oa[X+5]=la+2,oa[X+6]=la+2,oa[X+7]=la+3,X+=8,la+=4)}Fa&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,Y,t));if(na)for(S in na)z=na[S],z.__original.needsUpdate&&(n.bindBuffer(n.ARRAY_BUFFER,z.buffer),n.bufferData(n.ARRAY_BUFFER,z.array,t));if(Da){F=0;for(z=Ea.length;F<z;F++)n.bindBuffer(n.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[F]),n.bufferData(n.ARRAY_BUFFER,sa[F],t)}Ja&&da>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,$,t));Aa&&
|
|
|
-(n.bindBuffer(n.ARRAY_BUFFER,m.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,fa,t));Ia&&wa.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,ma,t));xa&&ea>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,ga,t));xa&&ca>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUV2Buffer),n.bufferData(n.ARRAY_BUFFER,ha,t));va&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,ra,t),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,
|
|
|
-m.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,oa,t));O>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,ia,t),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,aa,t),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,ta,t),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,ua,t));H&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,
|
|
|
-delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;G(k)}else if(g instanceof THREE.Ribbon){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=n.DYNAMIC_DRAW;k=A=w=w=
|
|
|
-void 0;v=g.vertices;m=g.colors;p=v.length;t=m.length;u=g.__vertexArray;H=g.__colorArray;x=g.__dirtyColors;if(g.__dirtyVertices){for(w=0;w<p;w++)A=v[w].position,k=w*3,u[k]=A.x,u[k+1]=A.y,u[k+2]=A.z;n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,u,j)}if(x){for(w=0;w<t;w++)color=m[w],k=w*3,H[k]=color.r,H[k+1]=color.g,H[k+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,H,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof
|
|
|
-THREE.Line){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=n.DYNAMIC_DRAW;k=A=w=w=void 0;v=g.vertices;m=g.colors;p=v.length;t=m.length;u=g.__vertexArray;H=g.__colorArray;x=g.__dirtyColors;if(g.__dirtyVertices){for(w=0;w<p;w++)A=v[w].position,k=w*3,u[k]=A.x,u[k+1]=A.y,u[k+2]=A.z;n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,u,j)}if(x){for(w=0;w<t;w++)color=m[w],k=w*3,H[k]=color.r,H[k+1]=color.g,H[k+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer);
|
|
|
-n.bufferData(n.ARRAY_BUFFER,H,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem)h=g.geometry,m=y(h),(h.__dirtyVertices||h.__dirtyColors||g.sortParticles||m)&&c(h,n.DYNAMIC_DRAW,g),h.__dirtyVertices=!1,h.__dirtyColors=!1,G(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?n.frontFace(n.CCW):n.frontFace(n.CW),b=="back"?n.cullFace(n.BACK):b=="front"?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK),n.enable(n.CULL_FACE)):n.disable(n.CULL_FACE)};this.supportsVertexTextures=
|
|
|
-function(){return sa}};
|
|
|
+n.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&n.enableVertexAttribArray(p[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)x="morphTarget"+g,p[x]>=0&&(n.enableVertexAttribArray(p[x]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,e,f){D(b);b=0;c&&(b|=n.COLOR_BUFFER_BIT);e&&(b|=n.DEPTH_BUFFER_BIT);f&&(b|=n.STENCIL_BUFFER_BIT);n.clear(b)};this.render=function(b,c,n,p){var y,E,G,I,U,J,H,B,L=b.lights,
|
|
|
+P=b.fog;this.shadowMapEnabled&&x(b,c);Q.data.vertices=0;Q.data.faces=0;Q.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(la);c.projectionMatrix.flattenToArray(pa);ja.multiply(c.projectionMatrix,c.matrixWorldInverse);m(ja);this.initWebGLObjects(b);D(n);(this.autoClear||p)&&this.clear();U=b.__webglObjects.length;for(p=0;p<U;p++)if(y=b.__webglObjects[p],H=y.object,H.visible)if(!(H instanceof THREE.Mesh)||o(H)){if(H.matrixWorld.flattenToArray(H._objectMatrixArray),
|
|
|
+A(H,c,!0),v(y),y.render=!0,this.sortObjects)y.object.renderDepth?y.z=y.object.renderDepth:(ma.copy(H.position),ja.multiplyVector3(ma),y.z=ma.z)}else y.render=!1;else y.render=!1;this.sortObjects&&b.__webglObjects.sort(t);J=b.__webglObjectsImmediate.length;for(p=0;p<J;p++)y=b.__webglObjectsImmediate[p],H=y.object,H.visible&&(H.matrixAutoUpdate&&H.matrixWorld.flattenToArray(H._objectMatrixArray),A(H,c,!0),u(y));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);C(b.overrideMaterial.blending);for(p=
|
|
|
+0;p<U;p++)if(y=b.__webglObjects[p],y.render)H=y.object,B=y.buffer,j(H),f(c,L,P,b.overrideMaterial,B,H);for(p=0;p<J;p++)y=b.__webglObjectsImmediate[p],H=y.object,H.visible&&(j(H),E=e(c,L,P,b.overrideMaterial,H),H.render(function(c){g(c,E,b.overrideMaterial.shading)}))}else{C(THREE.NormalBlending);for(p=U-1;p>=0;p--)if(y=b.__webglObjects[p],y.render){H=y.object;B=y.buffer;G=y.opaque;j(H);for(y=0;y<G.count;y++)I=G.list[y],h(I.depthTest),k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,
|
|
|
+L,P,I,B,H)}for(p=0;p<J;p++)if(y=b.__webglObjectsImmediate[p],H=y.object,H.visible){G=y.opaque;j(H);for(y=0;y<G.count;y++)I=G.list[y],h(I.depthTest),k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),E=e(c,L,P,I,H),H.render(function(b){g(b,E,I.shading)})}for(p=0;p<U;p++)if(y=b.__webglObjects[p],y.render){H=y.object;B=y.buffer;G=y.transparent;j(H);for(y=0;y<G.count;y++)I=G.list[y],C(I.blending),h(I.depthTest),k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,L,P,I,B,H)}for(p=
|
|
|
+0;p<J;p++)if(y=b.__webglObjectsImmediate[p],H=y.object,H.visible){G=y.transparent;j(H);for(y=0;y<G.count;y++)I=G.list[y],C(I.blending),h(I.depthTest),k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),E=e(c,L,P,I,H),H.render(function(b){g(b,E,I.shading)})}}b.__webglSprites.length&&w(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&V(n)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];
|
|
|
+for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,g=void 0,h=void 0,j=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(g in h=e.geometry,h.geometryGroups==void 0&&I(h),h.geometryGroups){j=h.geometryGroups[g];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=
|
|
|
+n.createBuffer();k.__webglNormalBuffer=n.createBuffer();k.__webglTangentBuffer=n.createBuffer();k.__webglColorBuffer=n.createBuffer();k.__webglUVBuffer=n.createBuffer();k.__webglUV2Buffer=n.createBuffer();k.__webglSkinVertexABuffer=n.createBuffer();k.__webglSkinVertexBBuffer=n.createBuffer();k.__webglSkinIndicesBuffer=n.createBuffer();k.__webglSkinWeightsBuffer=n.createBuffer();k.__webglFaceBuffer=n.createBuffer();k.__webglLineBuffer=n.createBuffer();if(k.numMorphTargets){var m=void 0,t=void 0;k.__webglMorphTargetsBuffers=
|
|
|
+[];m=0;for(t=k.numMorphTargets;m<t;m++)k.__webglMorphTargetsBuffers.push(n.createBuffer())}for(var k=j,m=e,p=void 0,u=void 0,o=void 0,v=o=void 0,x=void 0,w=void 0,A=w=t=0,U=o=u=void 0,H=U=u=p=void 0,o=void 0,v=m.geometry,x=v.faces,U=k.faces,p=0,u=U.length;p<u;p++)o=U[p],o=x[o],o instanceof THREE.Face3?(t+=3,w+=1,A+=3):o instanceof THREE.Face4&&(t+=4,w+=2,A+=4);for(var p=k,u=m,D=U=x=void 0,C=void 0,D=void 0,o=[],x=0,U=u.materials.length;x<U;x++)if(D=u.materials[x],D instanceof THREE.MeshFaceMaterial){D=
|
|
|
+0;for(l=p.materials.length;D<l;D++)(C=p.materials[D])&&o.push(C)}else(C=D)&&o.push(C);p=o;k.__materials=p;a:{x=u=void 0;U=p.length;for(u=0;u<U;u++)if(x=p[u],x.map||x.lightMap||x instanceof THREE.MeshShaderMaterial){u=!0;break a}u=!1}a:{U=x=void 0;o=p.length;for(x=0;x<o;x++)if(U=p[x],!(U instanceof THREE.MeshBasicMaterial&&!U.envMap||U instanceof THREE.MeshDepthMaterial)){U=U&&U.shading!=void 0&&U.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}U=!1}a:{o=x=void 0;D=p.length;
|
|
|
+for(x=0;x<D;x++)if(o=p[x],o.vertexColors){o=o.vertexColors;break a}o=!1}k.__vertexArray=new Float32Array(t*3);if(U)k.__normalArray=new Float32Array(t*3);if(v.hasTangents)k.__tangentArray=new Float32Array(t*4);if(o)k.__colorArray=new Float32Array(t*3);if(u){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)k.__uvArray=new Float32Array(t*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(t*2)}if(m.geometry.skinWeights.length&&m.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(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(A*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];v=0;for(x=k.numMorphTargets;v<x;v++)k.__morphTargetsArrays.push(new Float32Array(t*3))}k.__needsSmoothNormals=U==THREE.SmoothShading;k.__uvType=u;k.__vertexColorType=o;k.__normalType=
|
|
|
+U;k.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=A*2;v=0;for(x=p.length;v<x;v++)if(u=p[v],u.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in u.attributes){o=u.attributes[a];U={};for(H in o)U[H]=o[H];if(!U.__webglInitialized||U.createUniqueBuffers)U.__webglInitialized=!0,w=1,U.type==="v2"?w=2:U.type==="v3"?w=3:U.type==="v4"?w=4:U.type==="c"&&(w=3),U.size=w,U.array=new Float32Array(t*w),U.buffer=n.createBuffer(),
|
|
|
+U.buffer.belongsToAttribute=a,o.needsUpdate=!0,U.__original=o;k.__webglCustomAttributes[a]=U}}k.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}J(f.__webglObjects,j,e)}else if(e instanceof THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=n.createBuffer(),g.__webglColorBuffer=n.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=
|
|
|
+new Float32Array(j*3),g.__webglVertexCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;J(f.__webglObjects,h,e)}else if(e instanceof THREE.Line){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=n.createBuffer(),g.__webglColorBuffer=n.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*3),g.__webglLineCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;J(f.__webglObjects,h,e)}else if(e instanceof THREE.ParticleSystem){h=e.geometry;
|
|
|
+if(!h.__webglVertexBuffer){g=h;g.__webglVertexBuffer=n.createBuffer();g.__webglColorBuffer=n.createBuffer();g=h;j=e;k=g.vertices.length;g.__vertexArray=new Float32Array(k*3);g.__colorArray=new Float32Array(k*3);g.__sortArray=[];g.__webglParticleCount=k;g.__materials=j.materials;H=t=m=void 0;m=0;for(t=j.materials.length;m<t;m++)if(H=j.materials[m],H.attributes){if(g.__webglCustomAttributes===void 0)g.__webglCustomAttributes={};for(a in H.attributes){originalAttribute=H.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
|
|
|
+originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=n.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;g.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=
|
|
|
+!0;h.__dirtyColors=!0}J(f.__webglObjects,h,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)E(e.__webglObjects,f);else if(f instanceof
|
|
|
+THREE.Sprite){e=e.__webglSprites;h=void 0;for(h=e.length-1;h>=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof THREE.MarchingCubes&&E(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(g=b.__webglObjects[e].object,m=k=h=j=void 0,g instanceof THREE.Mesh){h=g.geometry;for(j in h.geometryGroups)if(k=h.geometryGroups[j],m=y(k),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
|
|
|
+m)if(m=k,t=n.DYNAMIC_DRAW,H=!h.dynamic,m.__inittedArrays){var ja=A=w=void 0,B=void 0,L=ja=void 0,P=void 0,pa=void 0,K=void 0,M=C=D=o=U=x=u=p=v=void 0,F=B=K=B=pa=P=void 0,z=void 0,N=z=F=P=void 0,Q=void 0,S=N=z=F=ja=ja=L=K=B=N=z=F=Q=N=z=F=Q=N=z=F=void 0,la=0,R=0,ea=0,ca=0,V=0,T=0,Z=0,X=0,da=0,O=0,W=0,N=F=0,N=void 0,Y=m.__vertexArray,ga=m.__uvArray,ha=m.__uv2Array,fa=m.__normalArray,ma=m.__tangentArray,$=m.__colorArray,ia=m.__skinVertexAArray,aa=m.__skinVertexBArray,ta=m.__skinIndexArray,ua=m.__skinWeightArray,
|
|
|
+sa=m.__morphTargetsArrays,na=m.__webglCustomAttributes,z=void 0,ra=m.__faceArray,oa=m.__lineArray,ya=m.__needsSmoothNormals,p=m.__vertexColorType,v=m.__uvType,u=m.__normalType,wa=g.geometry,Fa=wa.__dirtyVertices,va=wa.__dirtyElements,xa=wa.__dirtyUvs,Aa=wa.__dirtyNormals,Ia=wa.__dirtyTangents,Ja=wa.__dirtyColors,Da=wa.__dirtyMorphTargets,Pa=wa.vertices,Ga=m.faces,Ta=wa.faces,ab=wa.faceVertexUvs[0],bb=wa.faceVertexUvs[1],Qa=wa.skinVerticesA,Ra=wa.skinVerticesB,Sa=wa.skinIndices,Ha=wa.skinWeights,Ea=
|
|
|
+wa.morphTargets;if(na)for(S in na)na[S].offset=0,na[S].offsetSrc=0;w=0;for(A=Ga.length;w<A;w++)if(ja=Ga[w],B=Ta[ja],ab&&(x=ab[ja]),bb&&(U=bb[ja]),ja=B.vertexNormals,L=B.normal,P=B.vertexColors,pa=B.color,K=B.vertexTangents,B instanceof THREE.Face3){if(Fa)o=Pa[B.a].position,D=Pa[B.b].position,C=Pa[B.c].position,Y[R]=o.x,Y[R+1]=o.y,Y[R+2]=o.z,Y[R+3]=D.x,Y[R+4]=D.y,Y[R+5]=D.z,Y[R+6]=C.x,Y[R+7]=C.y,Y[R+8]=C.z,R+=9;if(na)for(S in na)if(z=na[S],z.__original.needsUpdate)F=z.offset,N=z.offsetSrc,z.size===
|
|
|
+1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F]=z.value[B.a],z.array[F+1]=z.value[B.b],z.array[F+2]=z.value[B.c]):z.boundTo==="faces"?(N=z.value[N],z.array[F]=N,z.array[F+1]=N,z.array[F+2]=N,z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F]=z.value[N],z.array[F+1]=z.value[N+1],z.array[F+2]=z.value[N+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(o=z.value[B.a],D=z.value[B.b],C=z.value[B.c]):z.boundTo==="faces"?(C=D=o=N=z.value[N],z.offsetSrc++):z.boundTo===
|
|
|
+"faceVertices"&&(o=z.value[N],D=z.value[N+1],C=z.value[N+2],z.offsetSrc+=3),z.size===2?(z.array[F]=o.x,z.array[F+1]=o.y,z.array[F+2]=D.x,z.array[F+3]=D.y,z.array[F+4]=C.x,z.array[F+5]=C.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[F]=o.r,z.array[F+1]=o.g,z.array[F+2]=o.b,z.array[F+3]=D.r,z.array[F+4]=D.g,z.array[F+5]=D.b,z.array[F+6]=C.r,z.array[F+7]=C.g,z.array[F+8]=C.b):(z.array[F]=o.x,z.array[F+1]=o.y,z.array[F+2]=o.z,z.array[F+3]=D.x,z.array[F+4]=D.y,z.array[F+5]=D.z,z.array[F+6]=C.x,z.array[F+
|
|
|
+7]=C.y,z.array[F+8]=C.z),z.offset+=9):(z.array[F]=o.x,z.array[F+1]=o.y,z.array[F+2]=o.z,z.array[F+3]=o.w,z.array[F+4]=D.x,z.array[F+5]=D.y,z.array[F+6]=D.z,z.array[F+7]=D.w,z.array[F+8]=C.x,z.array[F+9]=C.y,z.array[F+10]=C.z,z.array[F+11]=C.w,z.offset+=12));if(Da){F=0;for(z=Ea.length;F<z;F++)o=Ea[F].vertices[B.a].position,D=Ea[F].vertices[B.b].position,C=Ea[F].vertices[B.c].position,N=sa[F],N[W]=o.x,N[W+1]=o.y,N[W+2]=o.z,N[W+3]=D.x,N[W+4]=D.y,N[W+5]=D.z,N[W+6]=C.x,N[W+7]=C.y,N[W+8]=C.z;W+=9}if(Ha.length)F=
|
|
|
+Ha[B.a],z=Ha[B.b],N=Ha[B.c],ua[O]=F.x,ua[O+1]=F.y,ua[O+2]=F.z,ua[O+3]=F.w,ua[O+4]=z.x,ua[O+5]=z.y,ua[O+6]=z.z,ua[O+7]=z.w,ua[O+8]=N.x,ua[O+9]=N.y,ua[O+10]=N.z,ua[O+11]=N.w,F=Sa[B.a],z=Sa[B.b],N=Sa[B.c],ta[O]=F.x,ta[O+1]=F.y,ta[O+2]=F.z,ta[O+3]=F.w,ta[O+4]=z.x,ta[O+5]=z.y,ta[O+6]=z.z,ta[O+7]=z.w,ta[O+8]=N.x,ta[O+9]=N.y,ta[O+10]=N.z,ta[O+11]=N.w,F=Qa[B.a],z=Qa[B.b],N=Qa[B.c],ia[O]=F.x,ia[O+1]=F.y,ia[O+2]=F.z,ia[O+3]=1,ia[O+4]=z.x,ia[O+5]=z.y,ia[O+6]=z.z,ia[O+7]=1,ia[O+8]=N.x,ia[O+9]=N.y,ia[O+10]=N.z,
|
|
|
+ia[O+11]=1,F=Ra[B.a],z=Ra[B.b],N=Ra[B.c],aa[O]=F.x,aa[O+1]=F.y,aa[O+2]=F.z,aa[O+3]=1,aa[O+4]=z.x,aa[O+5]=z.y,aa[O+6]=z.z,aa[O+7]=1,aa[O+8]=N.x,aa[O+9]=N.y,aa[O+10]=N.z,aa[O+11]=1,O+=12;if(Ja&&p)P.length==3&&p==THREE.VertexColors?(B=P[0],F=P[1],z=P[2]):z=F=B=pa,$[da]=B.r,$[da+1]=B.g,$[da+2]=B.b,$[da+3]=F.r,$[da+4]=F.g,$[da+5]=F.b,$[da+6]=z.r,$[da+7]=z.g,$[da+8]=z.b,da+=9;if(Ia&&wa.hasTangents)P=K[0],pa=K[1],B=K[2],ma[Z]=P.x,ma[Z+1]=P.y,ma[Z+2]=P.z,ma[Z+3]=P.w,ma[Z+4]=pa.x,ma[Z+5]=pa.y,ma[Z+6]=pa.z,
|
|
|
+ma[Z+7]=pa.w,ma[Z+8]=B.x,ma[Z+9]=B.y,ma[Z+10]=B.z,ma[Z+11]=B.w,Z+=12;if(Aa&&u)if(ja.length==3&&ya)for(K=0;K<3;K++)L=ja[K],fa[T]=L.x,fa[T+1]=L.y,fa[T+2]=L.z,T+=3;else for(K=0;K<3;K++)fa[T]=L.x,fa[T+1]=L.y,fa[T+2]=L.z,T+=3;if(xa&&x!==void 0&&v)for(K=0;K<3;K++)ja=x[K],ga[ea]=ja.u,ga[ea+1]=ja.v,ea+=2;if(xa&&U!==void 0&&v)for(K=0;K<3;K++)ja=U[K],ha[ca]=ja.u,ha[ca+1]=ja.v,ca+=2;va&&(ra[V]=la,ra[V+1]=la+1,ra[V+2]=la+2,V+=3,oa[X]=la,oa[X+1]=la+1,oa[X+2]=la,oa[X+3]=la+2,oa[X+4]=la+1,oa[X+5]=la+2,X+=6,la+=
|
|
|
+3)}else if(B instanceof THREE.Face4){if(Fa)o=Pa[B.a].position,D=Pa[B.b].position,C=Pa[B.c].position,M=Pa[B.d].position,Y[R]=o.x,Y[R+1]=o.y,Y[R+2]=o.z,Y[R+3]=D.x,Y[R+4]=D.y,Y[R+5]=D.z,Y[R+6]=C.x,Y[R+7]=C.y,Y[R+8]=C.z,Y[R+9]=M.x,Y[R+10]=M.y,Y[R+11]=M.z,R+=12;if(na)for(S in na)if(z=na[S],z.__original.needsUpdate)F=z.offset,N=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F]=z.value[B.a],z.array[F+1]=z.value[B.b],z.array[F+2]=z.value[B.c],z.array[F+3]=z.value[B.d]):z.boundTo===
|
|
|
+"faces"?(N=z.value[N],z.array[F]=N,z.array[F+1]=N,z.array[F+2]=N,z.array[F+3]=N,z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F]=z.value[N],z.array[F+1]=z.value[N+1],z.array[F+2]=z.value[N+2],z.array[F+3]=z.value[N+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(o=z.value[B.a],D=z.value[B.b],C=z.value[B.c],M=z.value[B.d]):z.boundTo==="faces"?(M=C=D=o=N=z.value[N],z.offsetSrc++):z.boundTo==="faceVertices"&&(o=z.value[N],D=z.value[N+1],C=z.value[N+2],M=z.value[N+3],
|
|
|
+z.offsetSrc+=4),z.size===2?(z.array[F]=o.x,z.array[F+1]=o.y,z.array[F+2]=D.x,z.array[F+3]=D.y,z.array[F+4]=C.x,z.array[F+5]=C.y,z.array[F+6]=M.x,z.array[F+7]=M.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[F]=o.r,z.array[F+1]=o.g,z.array[F+2]=o.b,z.array[F+3]=D.r,z.array[F+4]=D.g,z.array[F+5]=D.b,z.array[F+6]=C.r,z.array[F+7]=C.g,z.array[F+8]=C.b,z.array[F+9]=M.r,z.array[F+10]=M.g,z.array[F+11]=M.b):(z.array[F]=o.x,z.array[F+1]=o.y,z.array[F+2]=o.z,z.array[F+3]=D.x,z.array[F+4]=D.y,z.array[F+5]=
|
|
|
+D.z,z.array[F+6]=C.x,z.array[F+7]=C.y,z.array[F+8]=C.z,z.array[F+9]=M.x,z.array[F+10]=M.y,z.array[F+11]=M.z),z.offset+=12):(z.array[F]=o.x,z.array[F+1]=o.y,z.array[F+2]=o.z,z.array[F+3]=o.w,z.array[F+4]=D.x,z.array[F+5]=D.y,z.array[F+6]=D.z,z.array[F+7]=D.w,z.array[F+8]=C.x,z.array[F+9]=C.y,z.array[F+10]=C.z,z.array[F+11]=C.w,z.array[F+12]=M.x,z.array[F+13]=M.y,z.array[F+14]=M.z,z.array[F+15]=M.w,z.offset+=16));if(Da){F=0;for(z=Ea.length;F<z;F++)o=Ea[F].vertices[B.a].position,D=Ea[F].vertices[B.b].position,
|
|
|
+C=Ea[F].vertices[B.c].position,M=Ea[F].vertices[B.d].position,N=sa[F],N[W]=o.x,N[W+1]=o.y,N[W+2]=o.z,N[W+3]=D.x,N[W+4]=D.y,N[W+5]=D.z,N[W+6]=C.x,N[W+7]=C.y,N[W+8]=C.z,N[W+9]=M.x,N[W+10]=M.y,N[W+11]=M.z;W+=12}if(Ha.length)F=Ha[B.a],z=Ha[B.b],N=Ha[B.c],Q=Ha[B.d],ua[O]=F.x,ua[O+1]=F.y,ua[O+2]=F.z,ua[O+3]=F.w,ua[O+4]=z.x,ua[O+5]=z.y,ua[O+6]=z.z,ua[O+7]=z.w,ua[O+8]=N.x,ua[O+9]=N.y,ua[O+10]=N.z,ua[O+11]=N.w,ua[O+12]=Q.x,ua[O+13]=Q.y,ua[O+14]=Q.z,ua[O+15]=Q.w,F=Sa[B.a],z=Sa[B.b],N=Sa[B.c],Q=Sa[B.d],ta[O]=
|
|
|
+F.x,ta[O+1]=F.y,ta[O+2]=F.z,ta[O+3]=F.w,ta[O+4]=z.x,ta[O+5]=z.y,ta[O+6]=z.z,ta[O+7]=z.w,ta[O+8]=N.x,ta[O+9]=N.y,ta[O+10]=N.z,ta[O+11]=N.w,ta[O+12]=Q.x,ta[O+13]=Q.y,ta[O+14]=Q.z,ta[O+15]=Q.w,F=Qa[B.a],z=Qa[B.b],N=Qa[B.c],Q=Qa[B.d],ia[O]=F.x,ia[O+1]=F.y,ia[O+2]=F.z,ia[O+3]=1,ia[O+4]=z.x,ia[O+5]=z.y,ia[O+6]=z.z,ia[O+7]=1,ia[O+8]=N.x,ia[O+9]=N.y,ia[O+10]=N.z,ia[O+11]=1,ia[O+12]=Q.x,ia[O+13]=Q.y,ia[O+14]=Q.z,ia[O+15]=1,F=Ra[B.a],z=Ra[B.b],N=Ra[B.c],B=Ra[B.d],aa[O]=F.x,aa[O+1]=F.y,aa[O+2]=F.z,aa[O+3]=1,
|
|
|
+aa[O+4]=z.x,aa[O+5]=z.y,aa[O+6]=z.z,aa[O+7]=1,aa[O+8]=N.x,aa[O+9]=N.y,aa[O+10]=N.z,aa[O+11]=1,aa[O+12]=B.x,aa[O+13]=B.y,aa[O+14]=B.z,aa[O+15]=1,O+=16;if(Ja&&p)P.length==4&&p==THREE.VertexColors?(B=P[0],F=P[1],z=P[2],P=P[3]):P=z=F=B=pa,$[da]=B.r,$[da+1]=B.g,$[da+2]=B.b,$[da+3]=F.r,$[da+4]=F.g,$[da+5]=F.b,$[da+6]=z.r,$[da+7]=z.g,$[da+8]=z.b,$[da+9]=P.r,$[da+10]=P.g,$[da+11]=P.b,da+=12;if(Ia&&wa.hasTangents)P=K[0],pa=K[1],B=K[2],K=K[3],ma[Z]=P.x,ma[Z+1]=P.y,ma[Z+2]=P.z,ma[Z+3]=P.w,ma[Z+4]=pa.x,ma[Z+
|
|
|
+5]=pa.y,ma[Z+6]=pa.z,ma[Z+7]=pa.w,ma[Z+8]=B.x,ma[Z+9]=B.y,ma[Z+10]=B.z,ma[Z+11]=B.w,ma[Z+12]=K.x,ma[Z+13]=K.y,ma[Z+14]=K.z,ma[Z+15]=K.w,Z+=16;if(Aa&&u)if(ja.length==4&&ya)for(K=0;K<4;K++)L=ja[K],fa[T]=L.x,fa[T+1]=L.y,fa[T+2]=L.z,T+=3;else for(K=0;K<4;K++)fa[T]=L.x,fa[T+1]=L.y,fa[T+2]=L.z,T+=3;if(xa&&x!==void 0&&v)for(K=0;K<4;K++)ja=x[K],ga[ea]=ja.u,ga[ea+1]=ja.v,ea+=2;if(xa&&U!==void 0&&v)for(K=0;K<4;K++)ja=U[K],ha[ca]=ja.u,ha[ca+1]=ja.v,ca+=2;va&&(ra[V]=la,ra[V+1]=la+1,ra[V+2]=la+3,ra[V+3]=la+1,
|
|
|
+ra[V+4]=la+2,ra[V+5]=la+3,V+=6,oa[X]=la,oa[X+1]=la+1,oa[X+2]=la,oa[X+3]=la+3,oa[X+4]=la+1,oa[X+5]=la+2,oa[X+6]=la+2,oa[X+7]=la+3,X+=8,la+=4)}Fa&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,Y,t));if(na)for(S in na)z=na[S],z.__original.needsUpdate&&(n.bindBuffer(n.ARRAY_BUFFER,z.buffer),n.bufferData(n.ARRAY_BUFFER,z.array,t));if(Da){F=0;for(z=Ea.length;F<z;F++)n.bindBuffer(n.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[F]),n.bufferData(n.ARRAY_BUFFER,sa[F],t)}Ja&&da>
|
|
|
+0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,$,t));Aa&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,fa,t));Ia&&wa.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,ma,t));xa&&ea>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,ga,t));xa&&ca>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUV2Buffer),n.bufferData(n.ARRAY_BUFFER,ha,t));va&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,
|
|
|
+m.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,ra,t),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,oa,t));O>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,ia,t),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,aa,t),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,ta,t),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,
|
|
|
+ua,t));H&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;G(k)}else if(g instanceof THREE.Ribbon){h=
|
|
|
+g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=n.DYNAMIC_DRAW;k=A=w=w=void 0;v=g.vertices;m=g.colors;p=v.length;t=m.length;u=g.__vertexArray;H=g.__colorArray;x=g.__dirtyColors;if(g.__dirtyVertices){for(w=0;w<p;w++)A=v[w].position,k=w*3,u[k]=A.x,u[k+1]=A.y,u[k+2]=A.z;n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,u,j)}if(x){for(w=0;w<t;w++)color=m[w],k=w*3,H[k]=color.r,H[k+1]=color.g,H[k+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,
|
|
|
+H,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.Line){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=n.DYNAMIC_DRAW;k=A=w=w=void 0;v=g.vertices;m=g.colors;p=v.length;t=m.length;u=g.__vertexArray;H=g.__colorArray;x=g.__dirtyColors;if(g.__dirtyVertices){for(w=0;w<p;w++)A=v[w].position,k=w*3,u[k]=A.x,u[k+1]=A.y,u[k+2]=A.z;n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,u,j)}if(x){for(w=0;w<t;w++)color=m[w],k=w*3,H[k]=color.r,H[k+1]=color.g,
|
|
|
+H[k+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,H,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem)h=g.geometry,m=y(h),(h.__dirtyVertices||h.__dirtyColors||g.sortParticles||m)&&c(h,n.DYNAMIC_DRAW,g),h.__dirtyVertices=!1,h.__dirtyColors=!1,G(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?n.frontFace(n.CCW):n.frontFace(n.CW),b=="back"?n.cullFace(n.BACK):b=="front"?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK),
|
|
|
+n.enable(n.CULL_FACE)):n.disable(n.CULL_FACE)};this.supportsVertexTextures=function(){return sa}};
|
|
|
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
|
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,e){THREE.WebGLRenderTarget.call(this,b,c,e);this.activeCubeFace=0};
|
|
@@ -475,9 +475,9 @@ f)),this.faceVertexUvs[0].push(g);this.computeCentroids();this.computeFaceNormal
|
|
|
THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,j=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);g.set(b.x-e.x,b.y-e.y);f=f.normalize();g=g.normalize();h.set(-f.y,f.x);j.set(g.y,-g.x);k.copy(b).addSelf(h);m.copy(b).addSelf(j);if(k.equals(m))return j.clone();
|
|
|
k.copy(c).addSelf(h);m.copy(e).addSelf(j);h=f.dot(j);j=m.subSelf(k).dot(j);h==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=h;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(H=b.length;--H>=0;){ga=H;$=H-1;$<0&&($=b.length-
|
|
|
-1);for(var c=0,e=t+p*2,c=0;c<e;c++){var f=X*c,g=X*(c+1),h=Y+ga+f,j=Y+ga+g,n=h,f=Y+$+f,g=Y+$+g,o=j;n+=V;f+=V;g+=V;o+=V;E.faces.push(new THREE.Face4(n,f,g,o,null,null,I));I&&(n=c/e,f=(c+1)/e,g=k+m*2,h=(E.vertices[h].position.z+m)/g,j=(E.vertices[j].position.z+m)/g,E.faceVertexUvs[0].push([new THREE.UV(h,n),new THREE.UV(j,n),new THREE.UV(j,f),new THREE.UV(h,f)]))}}}function j(b,c,e){E.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=V;c+=V;e+=V;E.faces.push(new THREE.Face3(b,
|
|
|
-c,e,null,null,D));if(D){var f=J.maxY,g=J.maxX,h=E.vertices[c].position.x,c=E.vertices[c].position.y,j=E.vertices[e].position.x,e=E.vertices[e].position.y;E.faceVertexUvs[0].push([new THREE.UV(E.vertices[b].position.x/g,E.vertices[b].position.y/f),new THREE.UV(h/g,c/f),new THREE.UV(j/g,e/f)])}}var k=c.amount!==void 0?c.amount:100,m=c.bevelThickness!==void 0?c.bevelThickness:6,o=c.bevelSize!==void 0?c.bevelSize:m-2,p=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
-!0,v=c.curveSegments!==void 0?c.curveSegments:12,t=c.steps!==void 0?c.steps:1,x=c.bendPath,w=c.extrudePath,A,y=!1,G=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,I=c.extrudeMaterial,J=this.shapebb;if(w)A=w.getPoints(v),t=A.length,y=!0,u=!1;u||(o=m=p=0);var C,B,L,E=this,V=this.vertices.length;x&&b.addWrapPath(x);v=G?b.extractAllSpacedPoints(v):b.extractAllPoints(v);x=v.shape;v=v.holes;if(w=!THREE.Shape.Utils.isClockWise(x)){x=x.reverse();B=0;for(L=v.length;B<L;B++)C=v[B],THREE.Shape.Utils.isClockWise(C)&&
|
|
|
+1);for(var c=0,e=t+p*2,c=0;c<e;c++){var f=X*c,g=X*(c+1),h=Y+ga+f,j=Y+ga+g,n=h,f=Y+$+f,g=Y+$+g,o=j;n+=V;f+=V;g+=V;o+=V;D.faces.push(new THREE.Face4(n,f,g,o,null,null,I));I&&(n=c/e,f=(c+1)/e,g=k+m*2,h=(D.vertices[h].position.z+m)/g,j=(D.vertices[j].position.z+m)/g,D.faceVertexUvs[0].push([new THREE.UV(h,n),new THREE.UV(j,n),new THREE.UV(j,f),new THREE.UV(h,f)]))}}}function j(b,c,e){D.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=V;c+=V;e+=V;D.faces.push(new THREE.Face3(b,
|
|
|
+c,e,null,null,E));if(E){var f=J.maxY,g=J.maxX,h=D.vertices[c].position.x,c=D.vertices[c].position.y,j=D.vertices[e].position.x,e=D.vertices[e].position.y;D.faceVertexUvs[0].push([new THREE.UV(D.vertices[b].position.x/g,D.vertices[b].position.y/f),new THREE.UV(h/g,c/f),new THREE.UV(j/g,e/f)])}}var k=c.amount!==void 0?c.amount:100,m=c.bevelThickness!==void 0?c.bevelThickness:6,o=c.bevelSize!==void 0?c.bevelSize:m-2,p=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
+!0,v=c.curveSegments!==void 0?c.curveSegments:12,t=c.steps!==void 0?c.steps:1,x=c.bendPath,w=c.extrudePath,A,y=!1,G=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,E=c.material,I=c.extrudeMaterial,J=this.shapebb;if(w)A=w.getPoints(v),t=A.length,y=!0,u=!1;u||(o=m=p=0);var C,B,L,D=this,V=this.vertices.length;x&&b.addWrapPath(x);v=G?b.extractAllSpacedPoints(v):b.extractAllPoints(v);x=v.shape;v=v.holes;if(w=!THREE.Shape.Utils.isClockWise(x)){x=x.reverse();B=0;for(L=v.length;B<L;B++)C=v[B],THREE.Shape.Utils.isClockWise(C)&&
|
|
|
(v[B]=C.reverse());w=!1}w=THREE.Shape.Utils.triangulateShape(x,v);G=x;B=0;for(L=v.length;B<L;B++)C=v[B],x=x.concat(C);var H,S,K,Q,n,T,X=x.length,M=w.length,W=[];H=0;S=G.length;ga=S-1;for($=H+1;H<S;H++,ga++,$++)ga==S&&(ga=0),$==S&&($=0),W[H]=f(G[H],G[ga],G[$]);var ha=[],ca,fa=W.concat();B=0;for(L=v.length;B<L;B++){C=v[B];ca=[];H=0;S=C.length;ga=S-1;for($=H+1;H<S;H++,ga++,$++)ga==S&&(ga=0),$==S&&($=0),ca[H]=f(C[H],C[ga],C[$]);ha.push(ca);fa=fa.concat(ca)}for(K=0;K<p;K++){Q=K/p;n=m*(1-Q);Q=o*Math.sin(Q*
|
|
|
Math.PI/2);H=0;for(S=G.length;H<S;H++)T=e(G[H],W[H],Q),j(T.x,T.y,-n);B=0;for(L=v.length;B<L;B++){C=v[B];ca=ha[B];H=0;for(S=C.length;H<S;H++)T=e(C[H],ca[H],Q),j(T.x,T.y,-n)}}Q=o;for(H=0;H<X;H++)T=u?e(x[H],fa[H],Q):x[H],y?j(T.x,T.y+A[0].y,A[0].x):j(T.x,T.y,0);for(K=1;K<=t;K++)for(H=0;H<X;H++)T=u?e(x[H],fa[H],Q):x[H],y?j(T.x,T.y+A[K-1].y,A[K-1].x):j(T.x,T.y,k/t*K);for(K=p-1;K>=0;K--){Q=K/p;n=m*(1-Q);Q=o*Math.sin(Q*Math.PI/2);H=0;for(S=G.length;H<S;H++)T=e(G[H],W[H],Q),j(T.x,T.y,k+n);B=0;for(L=v.length;B<
|
|
|
L;B++){C=v[B];ca=ha[B];H=0;for(S=C.length;H<S;H++)T=e(C[H],ca[H],Q),y?j(T.x,T.y+A[t-1].y,A[t-1].x+n):j(T.x,T.y,k+n)}}if(u){u=X*0;for(H=0;H<M;H++)o=w[H],h(o[2]+u,o[1]+u,o[0]+u);u=X*(t+p*2);for(H=0;H<M;H++)o=w[H],h(o[0]+u,o[1]+u,o[2]+u)}else{for(H=0;H<M;H++)o=w[H],h(o[2],o[1],o[0]);for(H=0;H<M;H++)o=w[H],h(o[0]+X*t,o[1]+X*t,o[2]+X*t)}var ga,$,Y=0;g(G);Y+=G.length;B=0;for(L=v.length;B<L;B++)C=v[B],g(C),Y+=C.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
@@ -499,8 +499,8 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
|
|
|
this.getFace(),e=this.size/c.resolution,f=0,g=String(b).split(""),j=g.length,h=[],b=0;b<j;b++){var k=new THREE.Path,k=this.extractGlyphPoints(g[b],c,e,f,k);f+=k.offset;h.push(k.path)}return{paths:h,offset:f/2}},extractGlyphPoints:function(b,c,e,f,g){var j=[],h,k,m,o,p,u,v,t,x,w,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));m=c.length;for(b=0;b<m;)switch(k=c[b++],k){case "m":k=c[b++]*e+f;o=c[b++]*e;j.push(new THREE.Vector2(k,
|
|
|
o));g.moveTo(k,o);break;case "l":k=c[b++]*e+f;o=c[b++]*e;j.push(new THREE.Vector2(k,o));g.lineTo(k,o);break;case "q":k=c[b++]*e+f;o=c[b++]*e;v=c[b++]*e+f;t=c[b++]*e;g.quadraticCurveTo(v,t,k,o);if(h=j[j.length-1]){p=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var y=h/divisions,G=THREE.Shape.Utils.b2(y,p,v,k),y=THREE.Shape.Utils.b2(y,u,t,o);j.push(new THREE.Vector2(G,y))}}break;case "b":if(k=c[b++]*e+f,o=c[b++]*e,v=c[b++]*e+f,t=c[b++]*-e,x=c[b++]*e+f,w=c[b++]*-e,g.bezierCurveTo(k,o,
|
|
|
v,t,x,w),h=j[j.length-1]){p=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)y=h/divisions,G=THREE.Shape.Utils.b3(y,p,v,x,k),y=THREE.Shape.Utils.b3(y,u,t,w,o),j.push(new THREE.Vector2(G,y))}}}return{offset:A.ha*e,points:j,path:g}}}};
|
|
|
-(function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,h=0;h<c;j=h++)g+=b[j].x*b[h].y-b[h].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var j=[],h=[],k=[],m,o,p;if(c(b)>0)for(o=0;o<g;o++)h[o]=o;else for(o=0;o<g;o++)h[o]=g-1-o;var u=2*g;for(o=g-1;g>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return k;return j}m=o;g<=m&&(m=0);o=m+1;g<=o&&(o=0);p=o+1;g<=p&&(p=0);var v;a:{v=b;var t=m,x=o,w=p,A=g,y=h,G=void 0,D=void 0,I=void 0,
|
|
|
-J=void 0,C=void 0,B=void 0,L=void 0,E=void 0,V=void 0,D=v[y[t]].x,I=v[y[t]].y,J=v[y[x]].x,C=v[y[x]].y,B=v[y[w]].x,L=v[y[w]].y;if(1.0E-10>(J-D)*(L-I)-(C-I)*(B-D))v=!1;else{for(G=0;G<A;G++)if(!(G==t||G==x||G==w)){var E=v[y[G]].x,V=v[y[G]].y,H=void 0,S=void 0,K=void 0,Q=void 0,n=void 0,T=void 0,X=void 0,M=void 0,W=void 0,ha=void 0,ca=void 0,fa=void 0,H=K=n=void 0,H=B-J,S=L-C,K=D-B,Q=I-L,n=J-D,T=C-I,X=E-D,M=V-I,W=E-J,ha=V-C,ca=E-B,fa=V-L,H=H*ha-S*W,n=n*M-T*X,K=K*fa-Q*ca;if(H>=0&&K>=0&&n>=0){v=!1;break a}}v=
|
|
|
+(function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,h=0;h<c;j=h++)g+=b[j].x*b[h].y-b[h].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var j=[],h=[],k=[],m,o,p;if(c(b)>0)for(o=0;o<g;o++)h[o]=o;else for(o=0;o<g;o++)h[o]=g-1-o;var u=2*g;for(o=g-1;g>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return k;return j}m=o;g<=m&&(m=0);o=m+1;g<=o&&(o=0);p=o+1;g<=p&&(p=0);var v;a:{v=b;var t=m,x=o,w=p,A=g,y=h,G=void 0,E=void 0,I=void 0,
|
|
|
+J=void 0,C=void 0,B=void 0,L=void 0,D=void 0,V=void 0,E=v[y[t]].x,I=v[y[t]].y,J=v[y[x]].x,C=v[y[x]].y,B=v[y[w]].x,L=v[y[w]].y;if(1.0E-10>(J-E)*(L-I)-(C-I)*(B-E))v=!1;else{for(G=0;G<A;G++)if(!(G==t||G==x||G==w)){var D=v[y[G]].x,V=v[y[G]].y,H=void 0,S=void 0,K=void 0,Q=void 0,n=void 0,T=void 0,X=void 0,M=void 0,W=void 0,ha=void 0,ca=void 0,fa=void 0,H=K=n=void 0,H=B-J,S=L-C,K=E-B,Q=I-L,n=J-E,T=C-I,X=D-E,M=V-I,W=D-J,ha=V-C,ca=D-B,fa=V-L,H=H*ha-S*W,n=n*M-T*X,K=K*fa-Q*ca;if(H>=0&&K>=0&&n>=0){v=!1;break a}}v=
|
|
|
!0}}if(v){j.push([b[h[m]],b[h[o]],b[h[p]]]);k.push([h[m],h[o],h[p]]);m=o;for(p=o+1;p<g;m++,p++)h[m]=h[p];g--;u=2*g}}if(f)return k;return j};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(b,c,e,f,g){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var j=f/this.segmentsT*this.arc,h=e/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(j);g.y=this.radius*Math.sin(j);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(h))*Math.cos(j);k.y=(this.radius+this.tube*Math.cos(h))*Math.sin(j);k.z=
|
|
|
this.tube*Math.sin(h);this.vertices.push(new THREE.Vertex(k));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(k.clone().subSelf(g).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var g=(this.segmentsT+1)*e+f-1,j=(this.segmentsT+1)*(e-1)+f-1,h=(this.segmentsT+1)*(e-1)+f,k=(this.segmentsT+1)*e+f,m=new THREE.Face4(g,j,h,k,[c[g],c[j],c[h],c[k]]);m.normal.addSelf(c[g]);m.normal.addSelf(c[j]);m.normal.addSelf(c[h]);m.normal.addSelf(c[k]);m.normal.normalize();this.faces.push(m);
|
|
@@ -518,59 +518,59 @@ else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=j(b.colorSpe
|
|
|
b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var o=THREE.ShaderUtils.lib.normal,p=THREE.UniformsUtils.clone(o.uniforms),u=h.color;k=h.specular;m=h.ambient;var v=h.shininess;p.tNormal.texture=h.normalMap;if(b.mapNormalFactor)p.uNormalScale.value=b.mapNormalFactor;if(h.map)p.tDiffuse.texture=h.map,p.enableDiffuse.value=!0;if(h.specularMap)p.tSpecular.texture=h.specularMap,p.enableSpecular.value=!0;if(h.lightMap)p.tAO.texture=
|
|
|
h.lightMap,p.enableAO.value=!0;p.uDiffuseColor.value.setHex(u);p.uSpecularColor.value.setHex(k);p.uAmbientColor.value.setHex(m);p.uShininess.value=v;if(h.opacity)p.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:p,lights:!0,fog:!0})}else h=new THREE[k](h);return h},constructor:THREE.Loader};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
|
|
|
THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,m,o,p,u,v,t,x,w,A,y,G,D,I=b.faces;u=b.vertices;var J=b.normals,C=b.colors,B=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&B++;for(e=0;e<B;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];o=0;for(p=u.length;o<p;)v=new THREE.Vertex,v.position.x=u[o++]*c,v.position.y=
|
|
|
-u[o++]*c,v.position.z=u[o++]*c,f.vertices.push(v);o=0;for(p=I.length;o<p;){c=I[o++];u=c&1;m=c&2;e=c&4;g=c&8;t=c&16;v=c&32;w=c&64;c&=128;u?(A=new THREE.Face4,A.a=I[o++],A.b=I[o++],A.c=I[o++],A.d=I[o++],u=4):(A=new THREE.Face3,A.a=I[o++],A.b=I[o++],A.c=I[o++],u=3);if(m)m=I[o++],A.materials=f.materials[m];m=f.faces.length;if(e)for(e=0;e<B;e++)y=b.uvs[e],x=I[o++],D=y[x*2],x=y[x*2+1],f.faceUvs[e][m]=new THREE.UV(D,x);if(g)for(e=0;e<B;e++){y=b.uvs[e];G=[];for(g=0;g<u;g++)x=I[o++],D=y[x*2],x=y[x*2+1],G[g]=
|
|
|
-new THREE.UV(D,x);f.faceVertexUvs[e][m]=G}if(t)t=I[o++]*3,g=new THREE.Vector3,g.x=J[t++],g.y=J[t++],g.z=J[t],A.normal=g;if(v)for(e=0;e<u;e++)t=I[o++]*3,g=new THREE.Vector3,g.x=J[t++],g.y=J[t++],g.z=J[t],A.vertexNormals.push(g);if(w)v=I[o++],v=new THREE.Color(C[v]),A.color=v;if(c)for(e=0;e<u;e++)v=I[o++],v=new THREE.Color(C[v]),A.vertexColors.push(v);f.faces.push(A)}}})(g);(function(){var c,e,g,m;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],m=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,m,o,p,u,v,t,x,w,A,y,G,E,I=b.faces;u=b.vertices;var J=b.normals,C=b.colors,B=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&B++;for(e=0;e<B;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];o=0;for(p=u.length;o<p;)v=new THREE.Vertex,v.position.x=u[o++]*c,v.position.y=
|
|
|
+u[o++]*c,v.position.z=u[o++]*c,f.vertices.push(v);o=0;for(p=I.length;o<p;){c=I[o++];u=c&1;m=c&2;e=c&4;g=c&8;t=c&16;v=c&32;w=c&64;c&=128;u?(A=new THREE.Face4,A.a=I[o++],A.b=I[o++],A.c=I[o++],A.d=I[o++],u=4):(A=new THREE.Face3,A.a=I[o++],A.b=I[o++],A.c=I[o++],u=3);if(m)m=I[o++],A.materials=f.materials[m];m=f.faces.length;if(e)for(e=0;e<B;e++)y=b.uvs[e],x=I[o++],E=y[x*2],x=y[x*2+1],f.faceUvs[e][m]=new THREE.UV(E,x);if(g)for(e=0;e<B;e++){y=b.uvs[e];G=[];for(g=0;g<u;g++)x=I[o++],E=y[x*2],x=y[x*2+1],G[g]=
|
|
|
+new THREE.UV(E,x);f.faceVertexUvs[e][m]=G}if(t)t=I[o++]*3,g=new THREE.Vector3,g.x=J[t++],g.y=J[t++],g.z=J[t],A.normal=g;if(v)for(e=0;e<u;e++)t=I[o++]*3,g=new THREE.Vector3,g.x=J[t++],g.y=J[t++],g.z=J[t],A.vertexNormals.push(g);if(w)v=I[o++],v=new THREE.Color(C[v]),A.color=v;if(c)for(e=0;e<u;e++)v=I[o++],v=new THREE.Color(C[v]),A.vertexColors.push(v);f.faces.push(A)}}})(g);(function(){var c,e,g,m;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],m=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
m,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],m=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,m,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,m,o,p,u,v,t,x;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];t=f.morphTargets[e].vertices;x=b.morphTargets[e].vertices;m=0;for(o=x.length;m<o;m+=3)p=x[m]*c,u=x[m+1]*
|
|
|
c,v=x[m+2]*c,t.push(new THREE.Vertex(new THREE.Vector3(p,u,v)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];o=f.morphColors[e].colors;p=b.morphColors[e].colors;c=0;for(m=p.length;c<m;c+=3)u=new THREE.Color(16755200),u.setRGB(p[c],p[c+1],p[c+2]),o.push(u)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
|
|
|
f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),j=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,j)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
|
|
|
c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,j){var h=new XMLHttpRequest,k=f+"/"+b,m=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,g,c):alert("Couldn't load ["+k+"] ["+h.status+"]"):h.readyState==3?j&&(m==0&&(m=h.getResponseHeader("Content-Length")),j({total:m,loaded:h.responseText.length})):h.readyState==2&&(m=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=p(b,c),g=p(b,c+1),h=p(b,c+2),j=p(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=p(b,c),f=p(b,c+1),h=p(b,c+2);return(p(b,c+3)<<24)+(h<<16)+(f<<8)+e}function m(b,c){var e=p(b,c);return(p(b,c+1)<<8)+e}function o(b,c){var e=p(b,c);return e>127?e-256:e}function p(b,
|
|
|
-c){return b.charCodeAt(c)&255}function u(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+B);c=m(b,c+L);THREE.BinaryLoader.prototype.f3(y,e,f,h,c)}function v(c){var e,f,h,j,n,o;e=g(b,c);f=g(b,c+C);h=g(b,c+B);j=m(b,c+L);n=g(b,c+E);o=g(b,c+V);c=g(b,c+H);THREE.BinaryLoader.prototype.f3n(y,I,e,f,h,j,n,o,c)}function t(c){var e,f,h,j;e=g(b,c);f=g(b,c+S);h=g(b,c+K);j=g(b,c+Q);c=m(b,c+n);THREE.BinaryLoader.prototype.f4(y,e,f,h,j,c)}function x(c){var e,f,h,j,o,p,t,u;e=g(b,c);f=g(b,c+S);h=g(b,c+K);j=g(b,c+Q);o=m(b,
|
|
|
-c+n);p=g(b,c+T);t=g(b,c+X);u=g(b,c+M);c=g(b,c+W);THREE.BinaryLoader.prototype.f4n(y,I,e,f,h,j,o,p,t,u,c)}function w(c){var e,f;e=g(b,c);f=g(b,c+ha);c=g(b,c+ca);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],J[e*2],J[e*2+1],J[f*2],J[f*2+1],J[c*2],J[c*2+1])}function A(c){var e,f,h;e=g(b,c);f=g(b,c+fa);h=g(b,c+ga);c=g(b,c+$);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],J[e*2],J[e*2+1],J[f*2],J[f*2+1],J[h*2],J[h*2+1],J[c*2],J[c*2+1])}var y=this,G=0,D,I=[],J=[],C,B,L,E,V,H,S,K,Q,n,T,X,M,W,
|
|
|
-ha,ca,fa,ga,$,Y,P,ea,Z,da,ia;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);D={signature:b.substr(G,8),header_bytes:p(b,G+8),vertex_coordinate_bytes:p(b,G+9),normal_coordinate_bytes:p(b,G+10),uv_coordinate_bytes:p(b,G+11),vertex_index_bytes:p(b,G+12),normal_index_bytes:p(b,G+13),uv_index_bytes:p(b,G+14),material_index_bytes:p(b,G+15),nvertices:g(b,G+16),nnormals:g(b,G+16+4),nuvs:g(b,G+16+8),ntri_flat:g(b,G+16+12),ntri_smooth:g(b,G+16+16),ntri_flat_uv:g(b,G+16+20),ntri_smooth_uv:g(b,
|
|
|
-G+16+24),nquad_flat:g(b,G+16+28),nquad_smooth:g(b,G+16+32),nquad_flat_uv:g(b,G+16+36),nquad_smooth_uv:g(b,G+16+40)};G+=D.header_bytes;C=D.vertex_index_bytes;B=D.vertex_index_bytes*2;L=D.vertex_index_bytes*3;E=D.vertex_index_bytes*3+D.material_index_bytes;V=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;H=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;S=D.vertex_index_bytes;K=D.vertex_index_bytes*2;Q=D.vertex_index_bytes*3;n=D.vertex_index_bytes*4;T=D.vertex_index_bytes*
|
|
|
-4+D.material_index_bytes;X=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;M=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;W=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ha=D.uv_index_bytes;ca=D.uv_index_bytes*2;fa=D.uv_index_bytes;ga=D.uv_index_bytes*2;$=D.uv_index_bytes*3;c=D.vertex_index_bytes*3+D.material_index_bytes;ia=D.vertex_index_bytes*4+D.material_index_bytes;Y=D.ntri_flat*c;P=D.ntri_smooth*(c+D.normal_index_bytes*3);ea=D.ntri_flat_uv*
|
|
|
-(c+D.uv_index_bytes*3);Z=D.ntri_smooth_uv*(c+D.normal_index_bytes*3+D.uv_index_bytes*3);da=D.nquad_flat*ia;c=D.nquad_smooth*(ia+D.normal_index_bytes*4);ia=D.nquad_flat_uv*(ia+D.uv_index_bytes*4);G+=function(c){for(var f,g,j,k=D.vertex_coordinate_bytes*3,m=c+D.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+D.vertex_coordinate_bytes),j=e(b,c+D.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,f,g,j);return D.nvertices*k}(G);G+=function(c){for(var e,f,g,h=D.normal_coordinate_bytes*3,j=c+D.nnormals*
|
|
|
-h;c<j;c+=h)e=o(b,c),f=o(b,c+D.normal_coordinate_bytes),g=o(b,c+D.normal_coordinate_bytes*2),I.push(e/127,f/127,g/127);return D.nnormals*h}(G);G+=function(c){for(var f,g,j=D.uv_coordinate_bytes*2,k=c+D.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+D.uv_coordinate_bytes),J.push(f,g);return D.nuvs*j}(G);Y=G+Y;P=Y+P;ea=P+ea;Z=ea+Z;da=Z+da;c=da+c;ia=c+ia;(function(b){var c,e=D.vertex_index_bytes*3+D.material_index_bytes,f=e+D.uv_index_bytes*3,g=b+D.ntri_flat_uv*f;for(c=b;c<g;c+=f)u(c),w(c+e);return g-b})(P);(function(b){var c,
|
|
|
-e=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=e+D.uv_index_bytes*3,g=b+D.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),w(c+e);return g-b})(ea);(function(b){var c,e=D.vertex_index_bytes*4+D.material_index_bytes,f=e+D.uv_index_bytes*4,g=b+D.nquad_flat_uv*f;for(c=b;c<g;c+=f)t(c),A(c+e);return g-b})(c);(function(b){var c,e=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=e+D.uv_index_bytes*4,g=b+D.nquad_smooth_uv*f;for(c=b;c<g;c+=f)x(c),A(c+e);return g-b})(ia);
|
|
|
-(function(b){var c,e=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(G);(function(b){var c,e=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(Y);(function(b){var c,e=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(Z);(function(b){var c,e=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*
|
|
|
+c){return b.charCodeAt(c)&255}function u(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+B);c=m(b,c+L);THREE.BinaryLoader.prototype.f3(y,e,f,h,c)}function v(c){var e,f,h,j,n,o;e=g(b,c);f=g(b,c+C);h=g(b,c+B);j=m(b,c+L);n=g(b,c+D);o=g(b,c+V);c=g(b,c+H);THREE.BinaryLoader.prototype.f3n(y,I,e,f,h,j,n,o,c)}function t(c){var e,f,h,j;e=g(b,c);f=g(b,c+S);h=g(b,c+K);j=g(b,c+Q);c=m(b,c+n);THREE.BinaryLoader.prototype.f4(y,e,f,h,j,c)}function x(c){var e,f,h,j,o,p,t,u;e=g(b,c);f=g(b,c+S);h=g(b,c+K);j=g(b,c+Q);o=m(b,
|
|
|
+c+n);p=g(b,c+T);t=g(b,c+X);u=g(b,c+M);c=g(b,c+W);THREE.BinaryLoader.prototype.f4n(y,I,e,f,h,j,o,p,t,u,c)}function w(c){var e,f;e=g(b,c);f=g(b,c+ha);c=g(b,c+ca);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],J[e*2],J[e*2+1],J[f*2],J[f*2+1],J[c*2],J[c*2+1])}function A(c){var e,f,h;e=g(b,c);f=g(b,c+fa);h=g(b,c+ga);c=g(b,c+$);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],J[e*2],J[e*2+1],J[f*2],J[f*2+1],J[h*2],J[h*2+1],J[c*2],J[c*2+1])}var y=this,G=0,E,I=[],J=[],C,B,L,D,V,H,S,K,Q,n,T,X,M,W,
|
|
|
+ha,ca,fa,ga,$,Y,P,ea,Z,da,ia;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);E={signature:b.substr(G,8),header_bytes:p(b,G+8),vertex_coordinate_bytes:p(b,G+9),normal_coordinate_bytes:p(b,G+10),uv_coordinate_bytes:p(b,G+11),vertex_index_bytes:p(b,G+12),normal_index_bytes:p(b,G+13),uv_index_bytes:p(b,G+14),material_index_bytes:p(b,G+15),nvertices:g(b,G+16),nnormals:g(b,G+16+4),nuvs:g(b,G+16+8),ntri_flat:g(b,G+16+12),ntri_smooth:g(b,G+16+16),ntri_flat_uv:g(b,G+16+20),ntri_smooth_uv:g(b,
|
|
|
+G+16+24),nquad_flat:g(b,G+16+28),nquad_smooth:g(b,G+16+32),nquad_flat_uv:g(b,G+16+36),nquad_smooth_uv:g(b,G+16+40)};G+=E.header_bytes;C=E.vertex_index_bytes;B=E.vertex_index_bytes*2;L=E.vertex_index_bytes*3;D=E.vertex_index_bytes*3+E.material_index_bytes;V=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes;H=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*2;S=E.vertex_index_bytes;K=E.vertex_index_bytes*2;Q=E.vertex_index_bytes*3;n=E.vertex_index_bytes*4;T=E.vertex_index_bytes*
|
|
|
+4+E.material_index_bytes;X=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes;M=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*2;W=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*3;ha=E.uv_index_bytes;ca=E.uv_index_bytes*2;fa=E.uv_index_bytes;ga=E.uv_index_bytes*2;$=E.uv_index_bytes*3;c=E.vertex_index_bytes*3+E.material_index_bytes;ia=E.vertex_index_bytes*4+E.material_index_bytes;Y=E.ntri_flat*c;P=E.ntri_smooth*(c+E.normal_index_bytes*3);ea=E.ntri_flat_uv*
|
|
|
+(c+E.uv_index_bytes*3);Z=E.ntri_smooth_uv*(c+E.normal_index_bytes*3+E.uv_index_bytes*3);da=E.nquad_flat*ia;c=E.nquad_smooth*(ia+E.normal_index_bytes*4);ia=E.nquad_flat_uv*(ia+E.uv_index_bytes*4);G+=function(c){for(var f,g,j,k=E.vertex_coordinate_bytes*3,m=c+E.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+E.vertex_coordinate_bytes),j=e(b,c+E.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,f,g,j);return E.nvertices*k}(G);G+=function(c){for(var e,f,g,h=E.normal_coordinate_bytes*3,j=c+E.nnormals*
|
|
|
+h;c<j;c+=h)e=o(b,c),f=o(b,c+E.normal_coordinate_bytes),g=o(b,c+E.normal_coordinate_bytes*2),I.push(e/127,f/127,g/127);return E.nnormals*h}(G);G+=function(c){for(var f,g,j=E.uv_coordinate_bytes*2,k=c+E.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+E.uv_coordinate_bytes),J.push(f,g);return E.nuvs*j}(G);Y=G+Y;P=Y+P;ea=P+ea;Z=ea+Z;da=Z+da;c=da+c;ia=c+ia;(function(b){var c,e=E.vertex_index_bytes*3+E.material_index_bytes,f=e+E.uv_index_bytes*3,g=b+E.ntri_flat_uv*f;for(c=b;c<g;c+=f)u(c),w(c+e);return g-b})(P);(function(b){var c,
|
|
|
+e=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,f=e+E.uv_index_bytes*3,g=b+E.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),w(c+e);return g-b})(ea);(function(b){var c,e=E.vertex_index_bytes*4+E.material_index_bytes,f=e+E.uv_index_bytes*4,g=b+E.nquad_flat_uv*f;for(c=b;c<g;c+=f)t(c),A(c+e);return g-b})(c);(function(b){var c,e=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*4,f=e+E.uv_index_bytes*4,g=b+E.nquad_smooth_uv*f;for(c=b;c<g;c+=f)x(c),A(c+e);return g-b})(ia);
|
|
|
+(function(b){var c,e=E.vertex_index_bytes*3+E.material_index_bytes,f=b+E.ntri_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(G);(function(b){var c,e=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,f=b+E.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(Y);(function(b){var c,e=E.vertex_index_bytes*4+E.material_index_bytes,f=b+E.nquad_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(Z);(function(b){var c,e=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*4,f=b+E.nquad_smooth*
|
|
|
e;for(c=b;c<f;c+=e)x(c);return f-b})(da);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,j){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[j]))},f3n:function(b,c,e,
|
|
|
f,g,j,h,k,m){var j=b.materials[j],o=c[k*3],p=c[k*3+1],k=c[k*3+2],u=c[m*3],v=c[m*3+1],m=c[m*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(u,v,m)],null,j))},f4n:function(b,c,e,f,g,j,h,k,m,o,p){var h=b.materials[h],u=c[m*3],v=c[m*3+1],m=c[m*3+2],t=c[o*3],x=c[o*3+1],o=c[o*3+2],w=c[p*3],A=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face4(e,f,g,j,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(u,v,m),new THREE.Vector3(t,
|
|
|
x,o),new THREE.Vector3(w,A,p)],null,h))},uv3:function(b,c,e,f,g,j,h){var k=[];k.push(new THREE.UV(c,e));k.push(new THREE.UV(f,g));k.push(new THREE.UV(j,h));b.push(k)},uv4:function(b,c,e,f,g,j,h,k,m){var o=[];o.push(new THREE.UV(c,e));o.push(new THREE.UV(f,g));o.push(new THREE.UV(j,h));o.push(new THREE.UV(k,m));b.push(o)},constructor:THREE.BinaryLoader};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function k(){for(t in S.objects)if(!M.objects[t])if(G=S.objects[t],G.geometry!==void 0){if(C=M.geometries[G.geometry]){var b=!1;V=[];for(ha=0;ha<G.materials.length;ha++)V[ha]=M.materials[G.materials[ha]],b=V[ha]instanceof THREE.MeshShaderMaterial;b&&C.computeTangents();D=G.position;r=
|
|
|
-G.rotation;q=G.quaternion;s=G.scale;q=0;V.length==0&&(V[0]=new THREE.MeshFaceMaterial);V.length>1&&(V=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,V);object.name=t;object.position.set(D[0],D[1],D[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;M.scene.addObject(object);M.objects[t]=object;G.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),M.scene.collisions.colliders.push(b));
|
|
|
-if(G.castsShadow)b=new THREE.ShadowVolume(C),M.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},M.triggers[object.name]=b)}}else D=G.position,r=G.rotation,q=G.quaternion,s=G.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(D[0],D[1],D[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function k(){for(t in S.objects)if(!M.objects[t])if(G=S.objects[t],G.geometry!==void 0){if(C=M.geometries[G.geometry]){var b=!1;V=[];for(ha=0;ha<G.materials.length;ha++)V[ha]=M.materials[G.materials[ha]],b=V[ha]instanceof THREE.MeshShaderMaterial;b&&C.computeTangents();E=G.position;r=
|
|
|
+G.rotation;q=G.quaternion;s=G.scale;q=0;V.length==0&&(V[0]=new THREE.MeshFaceMaterial);V.length>1&&(V=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,V);object.name=t;object.position.set(E[0],E[1],E[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;M.scene.addObject(object);M.objects[t]=object;G.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),M.scene.collisions.colliders.push(b));
|
|
|
+if(G.castsShadow)b=new THREE.ShadowVolume(C),M.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},M.triggers[object.name]=b)}}else E=G.position,r=G.rotation,q=G.quaternion,s=G.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(E[0],E[1],E[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
s[1],s[2]),object.visible=G.visible!==void 0?G.visible:!1,M.scene.addObject(object),M.objects[t]=object,M.empties[t]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},M.triggers[object.name]=b)}function m(b){return function(c){M.geometries[b]=c;k();Q-=1;e.onLoadComplete();p()}}function o(b){return function(c){M.geometries[b]=c}}function p(){e.callbackProgress({totalModels:T,totalTextures:X,loadedModels:T-Q,loadedTextures:X-n},M);e.onLoadProgress();Q==0&&n==0&&c(M)}var u,
|
|
|
-v,t,x,w,A,y,G,D,I,J,C,B,L,E,V,H,S,K,Q,n,T,X,M;S=b.data;E=new THREE.BinaryLoader;K=new THREE.JSONLoader;n=Q=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(t in S.objects)if(G=S.objects[t],G.meshCollider){b=!0;break}if(b)M.scene.collisions=new THREE.CollisionSystem;if(S.transform){b=S.transform.position;I=S.transform.rotation;var W=S.transform.scale;b&&M.scene.position.set(b[0],b[1],b[2]);I&&M.scene.rotation.set(I[0],
|
|
|
-I[1],I[2]);W&&M.scene.scale.set(W[0],W[1],W[2]);(b||I||W)&&M.scene.updateMatrix()}b=function(){n-=1;p();e.onLoadComplete()};for(w in S.cameras){I=S.cameras[w];if(I.type=="perspective")B=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")B=new THREE.Camera,B.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);D=I.position;I=I.target;B.position.set(D[0],D[1],D[2]);B.target.position.set(I[0],I[1],I[2]);M.cameras[w]=B}for(x in S.lights)w=S.lights[x],
|
|
|
-B=w.color!==void 0?w.color:16777215,I=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(D=w.direction,H=new THREE.DirectionalLight(B,I),H.position.set(D[0],D[1],D[2]),H.position.normalize()):w.type=="point"?(D=w.position,d=w.distance,H=new THREE.PointLight(B,I,d),H.position.set(D[0],D[1],D[2])):w.type=="ambient"&&(H=new THREE.AmbientLight(B)),M.scene.addLight(H),M.lights[x]=H;for(A in S.fogs)x=S.fogs[A],x.type=="linear"?L=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(L=new THREE.FogExp2(0,
|
|
|
+v,t,x,w,A,y,G,E,I,J,C,B,L,D,V,H,S,K,Q,n,T,X,M;S=b.data;D=new THREE.BinaryLoader;K=new THREE.JSONLoader;n=Q=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(t in S.objects)if(G=S.objects[t],G.meshCollider){b=!0;break}if(b)M.scene.collisions=new THREE.CollisionSystem;if(S.transform){b=S.transform.position;I=S.transform.rotation;var W=S.transform.scale;b&&M.scene.position.set(b[0],b[1],b[2]);I&&M.scene.rotation.set(I[0],
|
|
|
+I[1],I[2]);W&&M.scene.scale.set(W[0],W[1],W[2]);(b||I||W)&&M.scene.updateMatrix()}b=function(){n-=1;p();e.onLoadComplete()};for(w in S.cameras){I=S.cameras[w];if(I.type=="perspective")B=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")B=new THREE.Camera,B.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);E=I.position;I=I.target;B.position.set(E[0],E[1],E[2]);B.target.position.set(I[0],I[1],I[2]);M.cameras[w]=B}for(x in S.lights)w=S.lights[x],
|
|
|
+B=w.color!==void 0?w.color:16777215,I=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(E=w.direction,H=new THREE.DirectionalLight(B,I),H.position.set(E[0],E[1],E[2]),H.position.normalize()):w.type=="point"?(E=w.position,d=w.distance,H=new THREE.PointLight(B,I,d),H.position.set(E[0],E[1],E[2])):w.type=="ambient"&&(H=new THREE.AmbientLight(B)),M.scene.addLight(H),M.lights[x]=H;for(A in S.fogs)x=S.fogs[A],x.type=="linear"?L=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(L=new THREE.FogExp2(0,
|
|
|
x.density)),I=x.color,L.color.setRGB(I[0],I[1],I[2]),M.fogs[A]=L;if(M.cameras&&S.defaults.camera)M.currentCamera=M.cameras[S.defaults.camera];if(M.fogs&&S.defaults.fog)M.scene.fog=M.fogs[S.defaults.fog];I=S.defaults.bgcolor;M.bgColor=new THREE.Color;M.bgColor.setRGB(I[0],I[1],I[2]);M.bgColorAlpha=S.defaults.bgalpha;for(u in S.geometries)if(A=S.geometries[u],A.type=="bin_mesh"||A.type=="ascii_mesh")Q+=1,e.onLoadStart();T=Q;for(u in S.geometries)A=S.geometries[u],A.type=="cube"?(C=new THREE.CubeGeometry(A.width,
|
|
|
A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),M.geometries[u]=C):A.type=="plane"?(C=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),M.geometries[u]=C):A.type=="sphere"?(C=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),M.geometries[u]=C):A.type=="cylinder"?(C=new THREE.CylinderGeometry(A.numSegs,A.topRad,A.botRad,A.height,A.topOffset,A.botOffset),M.geometries[u]=C):A.type=="torus"?(C=new THREE.TorusGeometry(A.radius,
|
|
|
-A.tube,A.segmentsR,A.segmentsT),M.geometries[u]=C):A.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(A.subdivisions),M.geometries[u]=C):A.type=="bin_mesh"?E.load({model:f(A.url,S.urlBaseType),callback:m(u)}):A.type=="ascii_mesh"?K.load({model:f(A.url,S.urlBaseType),callback:m(u)}):A.type=="embedded_mesh"&&(A=S.embeds[A.id])&&K.createModel(A,o(u),"");for(y in S.textures)if(u=S.textures[y],u.url instanceof Array){n+=u.url.length;for(E=0;E<u.url.length;E++)e.onLoadStart()}else n+=1,e.onLoadStart();
|
|
|
-X=n;for(y in S.textures){u=S.textures[y];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){E=[];for(var ha=0;ha<u.url.length;ha++)E[ha]=f(u.url[ha],S.urlBaseType);E=THREE.ImageUtils.loadTextureCube(E,u.mapping,b)}else{E=THREE.ImageUtils.loadTexture(f(u.url,S.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)E.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)E.magFilter=THREE[u.magFilter];if(u.repeat){E.repeat.set(u.repeat[0],u.repeat[1]);
|
|
|
-if(u.repeat[0]!=1)E.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)E.wrapT=THREE.RepeatWrapping}u.offset&&E.offset.set(u.offset[0],u.offset[1]);if(u.wrap){K={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(K[u.wrap[0]]!==void 0)E.wrapS=K[u.wrap[0]];if(K[u.wrap[1]]!==void 0)E.wrapT=K[u.wrap[1]]}}M.textures[y]=E}for(v in S.materials){y=S.materials[v];for(J in y.parameters)if(J=="envMap"||J=="map"||J=="lightMap")y.parameters[J]=M.textures[y.parameters[J]];else if(J=="shading")y.parameters[J]=
|
|
|
+A.tube,A.segmentsR,A.segmentsT),M.geometries[u]=C):A.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(A.subdivisions),M.geometries[u]=C):A.type=="bin_mesh"?D.load({model:f(A.url,S.urlBaseType),callback:m(u)}):A.type=="ascii_mesh"?K.load({model:f(A.url,S.urlBaseType),callback:m(u)}):A.type=="embedded_mesh"&&(A=S.embeds[A.id])&&K.createModel(A,o(u),"");for(y in S.textures)if(u=S.textures[y],u.url instanceof Array){n+=u.url.length;for(D=0;D<u.url.length;D++)e.onLoadStart()}else n+=1,e.onLoadStart();
|
|
|
+X=n;for(y in S.textures){u=S.textures[y];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){D=[];for(var ha=0;ha<u.url.length;ha++)D[ha]=f(u.url[ha],S.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,u.mapping,b)}else{D=THREE.ImageUtils.loadTexture(f(u.url,S.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)D.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)D.magFilter=THREE[u.magFilter];if(u.repeat){D.repeat.set(u.repeat[0],u.repeat[1]);
|
|
|
+if(u.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}u.offset&&D.offset.set(u.offset[0],u.offset[1]);if(u.wrap){K={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(K[u.wrap[0]]!==void 0)D.wrapS=K[u.wrap[0]];if(K[u.wrap[1]]!==void 0)D.wrapT=K[u.wrap[1]]}}M.textures[y]=D}for(v in S.materials){y=S.materials[v];for(J in y.parameters)if(J=="envMap"||J=="map"||J=="lightMap")y.parameters[J]=M.textures[y.parameters[J]];else if(J=="shading")y.parameters[J]=
|
|
|
y.parameters[J]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(J=="blending")y.parameters[J]=THREE[y.parameters[J]]?THREE[y.parameters[J]]:THREE.NormalBlending;else if(J=="combine")y.parameters[J]=y.parameters[J]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(J=="vertexColors")if(y.parameters[J]=="face")y.parameters[J]=THREE.FaceColors;else if(y.parameters[J])y.parameters[J]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
|
|
|
-!0;if(y.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);E=y.parameters.color;K=y.parameters.specular;A=y.parameters.ambient;L=y.parameters.shininess;b.tNormal.texture=M.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)b.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)b.tDiffuse.texture=y.parameters.map,b.enableDiffuse.value=!0;if(y.parameters.lightMap)b.tAO.texture=y.parameters.lightMap,b.enableAO.value=!0;if(y.parameters.specularMap)b.tSpecular.texture=
|
|
|
-M.textures[y.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(E);b.uSpecularColor.value.setHex(K);b.uAmbientColor.value.setHex(A);b.uShininess.value=L;if(y.parameters.opacity)b.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);M.materials[v]=y}k();e.callbackSync(M)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
+!0;if(y.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);D=y.parameters.color;K=y.parameters.specular;A=y.parameters.ambient;L=y.parameters.shininess;b.tNormal.texture=M.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)b.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)b.tDiffuse.texture=y.parameters.map,b.enableDiffuse.value=!0;if(y.parameters.lightMap)b.tAO.texture=y.parameters.lightMap,b.enableAO.value=!0;if(y.parameters.specularMap)b.tSpecular.texture=
|
|
|
+M.textures[y.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(D);b.uSpecularColor.value.setHex(K);b.uAmbientColor.value.setHex(A);b.uShininess.value=L;if(y.parameters.opacity)b.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);M.materials[v]=y}k();e.callbackSync(M)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype={load:function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,g=b.scale!==void 0?b.scale:1,j=b.offsetX!==void 0?b.offsetX:0,h=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,g,j,h,k):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)},
|
|
|
decompressMesh:function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,g=0;g<8;g++){for(var j=0,h=0;h<c;++h){var k=b.charCodeAt(h+f);j+=k>>1^-(k&1);e[8*h+g]=j}f+=c}c=b.length-f;j=new Uint16Array(c);for(g=h=0;g<c;g++)k=b.charCodeAt(g+f),j[g]=h-k,k==0&&h++;return[e,j]},createModel:function(b,c,e,f,g,j){var h=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var h=THREE.UTF8Loader.prototype.decompressMesh(b),o=[],p=[];(function(b,h,m){for(var o,p,A,
|
|
|
-y=b.length;m<y;m+=h)o=b[m],p=b[m+1],A=b[m+2],o=o/16383*e,p=p/16383*e,A=A/16383*e,o+=f,p+=g,A+=j,THREE.UTF8Loader.prototype.v(c,o,p,A)})(h[0],8,0);(function(b,c,e){for(var f,g,h=b.length;e<h;e+=c)f=b[e],g=b[e+1],f/=1023,g/=1023,p.push(f,g)})(h[0],8,3);(function(b,c,e){for(var f,g,h,j=b.length;e<j;e+=c)f=b[e],g=b[e+1],h=b[e+2],f=(f-512)/511,g=(g-512)/511,h=(h-512)/511,o.push(f,g,h)})(h[0],8,5);(function(b){var e,f,g,h,j,m,G,D=b.length;for(e=0;e<D;e+=3)f=b[e],g=b[e+1],h=b[e+2],THREE.UTF8Loader.prototype.f3n(c,
|
|
|
+y=b.length;m<y;m+=h)o=b[m],p=b[m+1],A=b[m+2],o=o/16383*e,p=p/16383*e,A=A/16383*e,o+=f,p+=g,A+=j,THREE.UTF8Loader.prototype.v(c,o,p,A)})(h[0],8,0);(function(b,c,e){for(var f,g,h=b.length;e<h;e+=c)f=b[e],g=b[e+1],f/=1023,g/=1023,p.push(f,g)})(h[0],8,3);(function(b,c,e){for(var f,g,h,j=b.length;e<j;e+=c)f=b[e],g=b[e+1],h=b[e+2],f=(f-512)/511,g=(g-512)/511,h=(h-512)/511,o.push(f,g,h)})(h[0],8,5);(function(b){var e,f,g,h,j,m,G,E=b.length;for(e=0;e<E;e+=3)f=b[e],g=b[e+1],h=b[e+2],THREE.UTF8Loader.prototype.f3n(c,
|
|
|
o,f,g,h,0,f,g,h),j=p[f*2],f=p[f*2+1],m=p[g*2],g=p[g*2+1],G=p[h*2],h=p[h*2+1],THREE.UTF8Loader.prototype.uv3(c.faceVertexUvs[0],j,f,m,g,G,h)})(h[1]);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h)},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3n:function(b,c,e,f,g,j,h,k,m){var j=b.materials[j],o=c[k*3],p=c[k*3+1],k=c[k*3+2],u=c[m*3],v=c[m*3+1],m=c[m*3+2],h=new THREE.Vector3(c[h*3],c[h*3+1],c[h*
|
|
|
3+2]),k=new THREE.Vector3(o,p,k),m=new THREE.Vector3(u,v,m);b.faces.push(new THREE.Face3(e,f,g,[h,k,m],null,j))},uv3:function(b,c,e,f,g,j,h){var k=[];k.push(new THREE.UV(c,e));k.push(new THREE.UV(f,g));k.push(new THREE.UV(j,h));b.push(k)},constructor:THREE.UTF8Loader};
|
|
|
THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
|
0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,j,h,k,m,o,p,u){h=(h-p)/(u-p);p=this.normal_cache;c[j]=k+h*this.delta;c[j+1]=m;c[j+2]=o;g[j]=this.lerp(p[b],p[b+3],h);g[j+1]=this.lerp(p[b+1],p[b+4],h);g[j+2]=this.lerp(p[b+2],p[b+5],h)};this.VIntY=function(b,c,g,j,h,k,m,o,p,u){h=(h-p)/(u-p);p=this.normal_cache;c[j]=k;c[j+1]=m+h*this.delta;c[j+
|
|
|
2]=o;c=b+this.yd*3;g[j]=this.lerp(p[b],p[c],h);g[j+1]=this.lerp(p[b+1],p[c+1],h);g[j+2]=this.lerp(p[b+2],p[c+2],h)};this.VIntZ=function(b,c,g,j,h,k,m,o,p,u){h=(h-p)/(u-p);p=this.normal_cache;c[j]=k;c[j+1]=m;c[j+2]=o+h*this.delta;c=b+this.zd*3;g[j]=this.lerp(p[b],p[c],h);g[j+1]=this.lerp(p[b+1],p[c+1],h);g[j+2]=this.lerp(p[b+2],p[c+2],h)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
|
|
|
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,j,h,k){var m=j+1,o=j+this.yd,p=j+this.zd,u=m+this.yd,v=m+this.zd,t=j+this.yd+this.zd,x=m+this.yd+this.zd,w=0,A=this.field[j],y=this.field[m],G=this.field[o],D=this.field[u],I=this.field[p],J=this.field[v],C=this.field[t],B=this.field[x];A<h&&(w|=1);y<h&&(w|=2);G<h&&(w|=8);D<h&&(w|=4);I<h&&(w|=16);J<h&&(w|=32);C<h&&(w|=128);B<h&&(w|=64);var L=THREE.edgeTable[w];if(L==0)return 0;var E=this.delta,
|
|
|
-V=b+E,H=c+E,E=g+E;L&1&&(this.compNorm(j),this.compNorm(m),this.VIntX(j*3,this.vlist,this.nlist,0,h,b,c,g,A,y));L&2&&(this.compNorm(m),this.compNorm(u),this.VIntY(m*3,this.vlist,this.nlist,3,h,V,c,g,y,D));L&4&&(this.compNorm(o),this.compNorm(u),this.VIntX(o*3,this.vlist,this.nlist,6,h,b,H,g,G,D));L&8&&(this.compNorm(j),this.compNorm(o),this.VIntY(j*3,this.vlist,this.nlist,9,h,b,c,g,A,G));L&16&&(this.compNorm(p),this.compNorm(v),this.VIntX(p*3,this.vlist,this.nlist,12,h,b,c,E,I,J));L&32&&(this.compNorm(v),
|
|
|
-this.compNorm(x),this.VIntY(v*3,this.vlist,this.nlist,15,h,V,c,E,J,B));L&64&&(this.compNorm(t),this.compNorm(x),this.VIntX(t*3,this.vlist,this.nlist,18,h,b,H,E,C,B));L&128&&(this.compNorm(p),this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,21,h,b,c,E,I,C));L&256&&(this.compNorm(j),this.compNorm(p),this.VIntZ(j*3,this.vlist,this.nlist,24,h,b,c,g,A,I));L&512&&(this.compNorm(m),this.compNorm(v),this.VIntZ(m*3,this.vlist,this.nlist,27,h,V,c,g,y,J));L&1024&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*
|
|
|
-3,this.vlist,this.nlist,30,h,V,H,g,D,B));L&2048&&(this.compNorm(o),this.compNorm(t),this.VIntZ(o*3,this.vlist,this.nlist,33,h,b,H,g,G,C));w<<=4;for(h=j=0;THREE.triTable[w+h]!=-1;)b=w+h,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],k),h+=3,j++;return j};this.posnormtriv=function(b,c,g,j,h,k){var m=this.count*3;this.positionArray[m]=b[g];this.positionArray[m+1]=b[g+1];this.positionArray[m+2]=b[g+2];this.positionArray[m+3]=b[j];this.positionArray[m+
|
|
|
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,j,h,k){var m=j+1,o=j+this.yd,p=j+this.zd,u=m+this.yd,v=m+this.zd,t=j+this.yd+this.zd,x=m+this.yd+this.zd,w=0,A=this.field[j],y=this.field[m],G=this.field[o],E=this.field[u],I=this.field[p],J=this.field[v],C=this.field[t],B=this.field[x];A<h&&(w|=1);y<h&&(w|=2);G<h&&(w|=8);E<h&&(w|=4);I<h&&(w|=16);J<h&&(w|=32);C<h&&(w|=128);B<h&&(w|=64);var L=THREE.edgeTable[w];if(L==0)return 0;var D=this.delta,
|
|
|
+V=b+D,H=c+D,D=g+D;L&1&&(this.compNorm(j),this.compNorm(m),this.VIntX(j*3,this.vlist,this.nlist,0,h,b,c,g,A,y));L&2&&(this.compNorm(m),this.compNorm(u),this.VIntY(m*3,this.vlist,this.nlist,3,h,V,c,g,y,E));L&4&&(this.compNorm(o),this.compNorm(u),this.VIntX(o*3,this.vlist,this.nlist,6,h,b,H,g,G,E));L&8&&(this.compNorm(j),this.compNorm(o),this.VIntY(j*3,this.vlist,this.nlist,9,h,b,c,g,A,G));L&16&&(this.compNorm(p),this.compNorm(v),this.VIntX(p*3,this.vlist,this.nlist,12,h,b,c,D,I,J));L&32&&(this.compNorm(v),
|
|
|
+this.compNorm(x),this.VIntY(v*3,this.vlist,this.nlist,15,h,V,c,D,J,B));L&64&&(this.compNorm(t),this.compNorm(x),this.VIntX(t*3,this.vlist,this.nlist,18,h,b,H,D,C,B));L&128&&(this.compNorm(p),this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,21,h,b,c,D,I,C));L&256&&(this.compNorm(j),this.compNorm(p),this.VIntZ(j*3,this.vlist,this.nlist,24,h,b,c,g,A,I));L&512&&(this.compNorm(m),this.compNorm(v),this.VIntZ(m*3,this.vlist,this.nlist,27,h,V,c,g,y,J));L&1024&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*
|
|
|
+3,this.vlist,this.nlist,30,h,V,H,g,E,B));L&2048&&(this.compNorm(o),this.compNorm(t),this.VIntZ(o*3,this.vlist,this.nlist,33,h,b,H,g,G,C));w<<=4;for(h=j=0;THREE.triTable[w+h]!=-1;)b=w+h,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],k),h+=3,j++;return j};this.posnormtriv=function(b,c,g,j,h,k){var m=this.count*3;this.positionArray[m]=b[g];this.positionArray[m+1]=b[g+1];this.positionArray[m+2]=b[g+2];this.positionArray[m+3]=b[j];this.positionArray[m+
|
|
|
4]=b[j+1];this.positionArray[m+5]=b[j+2];this.positionArray[m+6]=b[h];this.positionArray[m+7]=b[h+1];this.positionArray[m+8]=b[h+2];this.normalArray[m]=c[g];this.normalArray[m+1]=c[g+1];this.normalArray[m+2]=c[g+2];this.normalArray[m+3]=c[j];this.normalArray[m+4]=c[j+1];this.normalArray[m+5]=c[j+2];this.normalArray[m+6]=c[h];this.normalArray[m+7]=c[h+1];this.normalArray[m+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
|
|
|
this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,j,h){var k=this.size*Math.sqrt(j/h),m=g*this.size,o=c*this.size,p=b*this.size,u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var v=Math.floor(o-k);v<1&&(v=1);o=Math.floor(o+k);o>this.size-1&&(o=this.size-1);var t=Math.floor(p-k);t<1&&(t=1);k=Math.floor(p+k);k>this.size-1&&(k=this.size-
|
|
|
-1);for(var x,w,A,y,G,D;u<m;u++){p=this.size2*u;w=u/this.size-g;G=w*w;for(w=v;w<o;w++){A=p+this.size*w;x=w/this.size-c;D=x*x;for(x=t;x<k;x++)y=x/this.size-b,y=j/(1.0E-6+y*y+D+G)-h,y>0&&(this.field[A+x]+=y)}}};this.addPlaneX=function(b,c){var g,j,h,k,m,o=this.size,p=this.yd,u=this.zd,v=this.field,t=o*Math.sqrt(b/c);t>o&&(t=o);for(g=0;g<t;g++)if(j=g/o,j*=j,k=b/(1.0E-4+j)-c,k>0)for(j=0;j<o;j++){m=g+j*p;for(h=0;h<o;h++)v[u*h+m]+=k}};this.addPlaneY=function(b,c){var g,j,h,k,m,o,p=this.size,u=this.yd,v=
|
|
|
+1);for(var x,w,A,y,G,E;u<m;u++){p=this.size2*u;w=u/this.size-g;G=w*w;for(w=v;w<o;w++){A=p+this.size*w;x=w/this.size-c;E=x*x;for(x=t;x<k;x++)y=x/this.size-b,y=j/(1.0E-6+y*y+E+G)-h,y>0&&(this.field[A+x]+=y)}}};this.addPlaneX=function(b,c){var g,j,h,k,m,o=this.size,p=this.yd,u=this.zd,v=this.field,t=o*Math.sqrt(b/c);t>o&&(t=o);for(g=0;g<t;g++)if(j=g/o,j*=j,k=b/(1.0E-4+j)-c,k>0)for(j=0;j<o;j++){m=g+j*p;for(h=0;h<o;h++)v[u*h+m]+=k}};this.addPlaneY=function(b,c){var g,j,h,k,m,o,p=this.size,u=this.yd,v=
|
|
|
this.zd,t=this.field,x=p*Math.sqrt(b/c);x>p&&(x=p);for(j=0;j<x;j++)if(g=j/p,g*=g,k=b/(1.0E-4+g)-c,k>0){m=j*u;for(g=0;g<p;g++){o=m+g;for(h=0;h<p;h++)t[v*h+o]+=k}}};this.addPlaneZ=function(b,c){var g,j,h,k,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(g=h/size,g*=g,k=b/(1.0E-4+g)-c,k>0){m=zd*h;for(j=0;j<size;j++){o=m+j*yd;for(g=0;g<size;g++)field[o+g]+=k}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
|
|
|
3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,j,h,k,m,o,p,u,v=this.size-2;for(h=1;h<v;h++){u=this.size2*h;o=(h-this.halfsize)/this.halfsize;for(j=1;j<v;j++){p=u+this.size*j;m=(j-this.halfsize)/this.halfsize;for(g=1;g<v;g++)k=(g-this.halfsize)/this.halfsize,c=p+g,this.polygonize(k,m,o,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(j){var h,k,m,o,p,u,v,t;for(h=0;h<j.count;h++)v=h*3,p=v+1,t=v+2,k=j.positionArray[v],
|
|
|
m=j.positionArray[p],o=j.positionArray[t],u=new THREE.Vector3(k,m,o),k=j.normalArray[v],m=j.normalArray[p],o=j.normalArray[t],v=new THREE.Vector3(k,m,o),v.normalize(),p=new THREE.Vertex(u),c.vertices.push(p),g.push(v);nfaces=j.count/3;for(h=0;h<nfaces;h++)v=(b+h)*3,p=v+1,t=v+2,u=g[v],k=g[p],m=g[t],v=new THREE.Face3(v,p,t,[u,k,m]),c.faces.push(v);b+=nfaces;j.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
@@ -618,7 +618,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
|
|
|
THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
|
|
|
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,j=new THREE.Camera,h=new THREE.Matrix4,k=new THREE.Matrix4,m,o,p;g.useTarget=j.useTarget=!1;g.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),t=new THREE.Camera(53,1,1,1E4);t.position.z=
|
|
|
2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
|
-var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(m!==e.aspect||o!==e.near||p!==e.fov){m=e.aspect;o=e.near;p=e.fov;var y=e.projectionMatrix.clone(),G=125/30*0.5,D=G*o/125,I=o*Math.tan(p*Math.PI/360),J;h.n14=G;k.n14=-G;G=-I*m+D;J=I*m+D;y.n11=2*o/(J-G);y.n13=(J+G)/(J-G);g.projectionMatrix=y.clone();G=-I*m-D;J=I*m-D;y.n11=2*o/(J-G);
|
|
|
+var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(m!==e.aspect||o!==e.near||p!==e.fov){m=e.aspect;o=e.near;p=e.fov;var y=e.projectionMatrix.clone(),G=125/30*0.5,E=G*o/125,I=o*Math.tan(p*Math.PI/360),J;h.n14=G;k.n14=-G;G=-I*m+E;J=I*m+E;y.n11=2*o/(J-G);y.n13=(J+G)/(J-G);g.projectionMatrix=y.clone();G=-I*m-E;J=I*m-E;y.n11=2*o/(J-G);
|
|
|
y.n13=(J+G)/(J-G);j.projectionMatrix=y.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(e.position);g.near=o;g.far=e.far;f.call(c,b,g,u,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=o;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,x,t)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,j,h=new THREE.Camera,k=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;j=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far;
|
|
|
h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);k.projectionMatrix=h.projectionMatrix;k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(-c.separation);this.setViewport(0,0,g,j);f.call(c,b,h);this.setViewport(g,0,g,j);f.call(c,b,k,!1)}};
|