|
@@ -25,7 +25,7 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,g,j,h,m,
|
|
|
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,m=b.n22,n=b.n23,t=b.n24,o=b.n31,p=b.n32,v=b.n33,u=b.n34,w=b.n41,z=b.n42,x=b.n43,y=b.n44,G=c.n11,B=c.n12,
|
|
|
-L=c.n13,E=c.n14,D=c.n21,X=c.n22,H=c.n23,I=c.n24,M=c.n31,P=c.n32,Q=c.n33,O=c.n34,R=c.n41,S=c.n42,$=c.n43,k=c.n44;this.n11=e*G+f*D+g*M+j*R;this.n12=e*B+f*X+g*P+j*S;this.n13=e*L+f*H+g*Q+j*$;this.n14=e*E+f*I+g*O+j*k;this.n21=h*G+m*D+n*M+t*R;this.n22=h*B+m*X+n*P+t*S;this.n23=h*L+m*H+n*Q+t*$;this.n24=h*E+m*I+n*O+t*k;this.n31=o*G+p*D+v*M+u*R;this.n32=o*B+p*X+v*P+u*S;this.n33=o*L+p*H+v*Q+u*$;this.n34=o*E+p*I+v*O+u*k;this.n41=w*G+z*D+x*M+y*R;this.n42=w*B+z*X+x*P+y*S;this.n43=w*L+z*H+x*Q+y*$;this.n44=w*E+z*
|
|
|
+L=c.n13,F=c.n14,D=c.n21,X=c.n22,H=c.n23,I=c.n24,M=c.n31,P=c.n32,Q=c.n33,O=c.n34,R=c.n41,S=c.n42,$=c.n43,k=c.n44;this.n11=e*G+f*D+g*M+j*R;this.n12=e*B+f*X+g*P+j*S;this.n13=e*L+f*H+g*Q+j*$;this.n14=e*F+f*I+g*O+j*k;this.n21=h*G+m*D+n*M+t*R;this.n22=h*B+m*X+n*P+t*S;this.n23=h*L+m*H+n*Q+t*$;this.n24=h*F+m*I+n*O+t*k;this.n31=o*G+p*D+v*M+u*R;this.n32=o*B+p*X+v*P+u*S;this.n33=o*L+p*H+v*Q+u*$;this.n34=o*F+p*I+v*O+u*k;this.n41=w*G+z*D+x*M+y*R;this.n42=w*B+z*X+x*P+y*S;this.n43=w*L+z*H+x*Q+y*$;this.n44=w*F+z*
|
|
|
I+x*O+y*k;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,m=this.n24,n=this.n31,t=this.n32,o=this.n33,p=this.n34,v=this.n41,u=this.n42,w=this.n43,z=this.n44;return f*h*t*v-e*m*t*v-f*j*o*v+c*m*o*v+e*j*p*v-c*h*p*v-f*h*n*u+e*m*n*u+f*g*o*u-b*m*o*u-e*g*p*u+b*h*p*u+f*j*n*w-c*m*n*w-f*g*t*w+b*m*t*w+c*g*p*w-b*j*p*w-e*j*n*z+c*h*n*z+e*g*t*z-b*h*t*z-c*g*o*z+b*j*o*z},
|
|
|
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;
|
|
@@ -61,8 +61,8 @@ 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,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(b&&j.vertexNormals.length){m.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)m.addSelf(j.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],h=this.vertices[j.c],m.sub(h.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
|
|
|
m.normalize();j.normal.copy(m)}},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,e,c,f,g,j,H){m=b.vertices[e].position;n=b.vertices[c].position;t=b.vertices[f].position;o=h[g];p=h[j];v=h[H];u=n.x-m.x;w=t.x-m.x;z=n.y-m.y;x=t.y-m.y;y=n.z-m.z;G=t.z-m.z;B=p.u-o.u;L=v.u-o.u;E=p.v-o.v;D=v.v-o.v;X=1/(B*D-L*E);P.set((D*u-E*w)*
|
|
|
-X,(D*z-E*x)*X,(D*y-E*G)*X);Q.set((B*w-L*u)*X,(B*x-L*z)*X,(B*G-L*y)*X);I[e].addSelf(P);I[c].addSelf(P);I[f].addSelf(P);M[e].addSelf(Q);M[c].addSelf(Q);M[f].addSelf(Q)}var c,e,f,g,j,h,m,n,t,o,p,v,u,w,z,x,y,G,B,L,E,D,X,H,I=[],M=[],P=new THREE.Vector3,Q=new THREE.Vector3,O=new THREE.Vector3,R=new THREE.Vector3,S=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)I[c]=new THREE.Vector3,M[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
|
|
|
+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,e,c,f,g,j,H){m=b.vertices[e].position;n=b.vertices[c].position;t=b.vertices[f].position;o=h[g];p=h[j];v=h[H];u=n.x-m.x;w=t.x-m.x;z=n.y-m.y;x=t.y-m.y;y=n.z-m.z;G=t.z-m.z;B=p.u-o.u;L=v.u-o.u;F=p.v-o.v;D=v.v-o.v;X=1/(B*D-L*F);P.set((D*u-F*w)*
|
|
|
+X,(D*z-F*x)*X,(D*y-F*G)*X);Q.set((B*w-L*u)*X,(B*x-L*z)*X,(B*G-L*y)*X);I[e].addSelf(P);I[c].addSelf(P);I[f].addSelf(P);M[e].addSelf(Q);M[c].addSelf(Q);M[f].addSelf(Q)}var c,e,f,g,j,h,m,n,t,o,p,v,u,w,z,x,y,G,B,L,F,D,X,H,I=[],M=[],P=new THREE.Vector3,Q=new THREE.Vector3,O=new THREE.Vector3,R=new THREE.Vector3,S=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)I[c]=new THREE.Vector3,M[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 $=["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++)S.copy(j.vertexNormals[f]),g=j[$[f]],H=I[g],O.copy(H),O.subSelf(S.multiplyScalar(S.dot(H))).normalize(),R.cross(j.vertexNormals[f],H),g=R.dot(M[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(O.x,O.y,O.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,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
|
|
@@ -140,36 +140,36 @@ 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=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,h=b.z+b.w,g=e.z+e.w,k=-b.z+b.w,j=-e.z+e.w;return h>=0&&g>=0&&k>=0&&j>=0?!0:h<0&&g<0||k<0&&j<0?!1:(h<0?c=Math.max(c,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),k<0?c=Math.max(c,k/(k-j)):j<0&&(f=Math.min(f,k/(k-j))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,j=[],h,m,n=[],t,o,p=[],v,u=[],w,z,x=[],y,G,B=[],L=new THREE.Vector4,E=new THREE.Vector4,
|
|
|
+THREE.Projector=function(){function b(){var b=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,h=b.z+b.w,g=e.z+e.w,k=-b.z+b.w,j=-e.z+e.w;return h>=0&&g>=0&&k>=0&&j>=0?!0:h<0&&g<0||k<0&&j<0?!1:(h<0?c=Math.max(c,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),k<0?c=Math.max(c,k/(k-j)):j<0&&(f=Math.min(f,k/(k-j))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,j=[],h,m,n=[],t,o,p=[],v,u=[],w,z,x=[],y,G,B=[],L=new THREE.Vector4,F=new THREE.Vector4,
|
|
|
D=new THREE.Matrix4,X=new THREE.Matrix4,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(b,e){D.multiply(e.projectionMatrix,e.matrixWorldInverse);D.multiplyVector3(b);return b};this.unprojectVector=function(b,e){D.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));D.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],m,n,t;g=0;n=
|
|
|
b.objects;b=0;for(m=n.length;b<m;b++){t=n[b];var k;if(!(k=!t.visible))if(k=t instanceof THREE.Mesh){a:{k=void 0;for(var o=t.matrixWorld,p=-t.geometry.boundingSphere.radius*Math.max(t.scale.x,Math.max(t.scale.y,t.scale.z)),u=0;u<6;u++)if(k=H[u].x*o.n14+H[u].y*o.n24+H[u].z*o.n34+H[u].w,k<=p){k=!1;break a}k=!0}k=!k}if(!k)k=j[g]=j[g]||new THREE.RenderableObject,g++,f=k,L.copy(t.position),D.multiplyVector3(L),f.object=t,f.z=L.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,j){var L=[],
|
|
|
-S=g.near,$=g.far,k,K,da,Z,aa,ha,la,ea,fa,F,ia,na,ca,oa,J,V,ga;G=z=v=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);D.multiply(g.projectionMatrix,g.matrixWorldInverse);H[0].set(D.n41-D.n11,D.n42-D.n12,D.n43-D.n13,D.n44-D.n14);H[1].set(D.n41+D.n11,D.n42+D.n12,D.n43+D.n13,D.n44+D.n14);H[2].set(D.n41+D.n21,D.n42+D.n22,D.n43+D.n23,D.n44+D.n24);H[3].set(D.n41-D.n21,D.n42-D.n22,D.n43-D.n23,D.n44-D.n24);H[4].set(D.n41-D.n31,D.n42-D.n32,D.n43-D.n33,D.n44-D.n34);H[5].set(D.n41+D.n31,D.n42+
|
|
|
-D.n32,D.n43+D.n33,D.n44+D.n34);for(k=0;k<6;k++)fa=H[k],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(f,g,!0);f=0;for(k=fa.length;f<k;f++)if(F=fa[f].object,F.visible)if(ia=F.matrixWorld,na=F.matrixRotationWorld,ca=F.materials,oa=F.overdraw,m=0,F instanceof THREE.Mesh){J=F.geometry;Z=J.vertices;V=J.faces;J=J.faceVertexUvs;K=0;for(da=Z.length;K<da;K++)h=b(),h.positionWorld.copy(Z[K].position),ia.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
|
|
|
-D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>S&&h.positionScreen.z<$;Z=0;for(K=V.length;Z<K;Z++){da=V[Z];if(da instanceof THREE.Face3)if(aa=n[da.a],ha=n[da.b],la=n[da.c],aa.visible&&ha.visible&&la.visible&&(F.doubleSided||F.flipSided!=(la.positionScreen.x-aa.positionScreen.x)*(ha.positionScreen.y-aa.positionScreen.y)-(la.positionScreen.y-aa.positionScreen.y)*(ha.positionScreen.x-aa.positionScreen.x)<
|
|
|
-0))ea=p[o]=p[o]||new THREE.RenderableFace3,o++,t=ea,t.v1.copy(aa),t.v2.copy(ha),t.v3.copy(la);else continue;else if(da instanceof THREE.Face4)if(aa=n[da.a],ha=n[da.b],la=n[da.c],ea=n[da.d],aa.visible&&ha.visible&&la.visible&&ea.visible&&(F.doubleSided||F.flipSided!=((ea.positionScreen.x-aa.positionScreen.x)*(ha.positionScreen.y-aa.positionScreen.y)-(ea.positionScreen.y-aa.positionScreen.y)*(ha.positionScreen.x-aa.positionScreen.x)<0||(ha.positionScreen.x-la.positionScreen.x)*(ea.positionScreen.y-
|
|
|
+S=g.near,$=g.far,k,K,da,Z,aa,ha,la,ea,fa,E,ia,na,ca,oa,J,V,ga;G=z=v=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);D.multiply(g.projectionMatrix,g.matrixWorldInverse);H[0].set(D.n41-D.n11,D.n42-D.n12,D.n43-D.n13,D.n44-D.n14);H[1].set(D.n41+D.n11,D.n42+D.n12,D.n43+D.n13,D.n44+D.n14);H[2].set(D.n41+D.n21,D.n42+D.n22,D.n43+D.n23,D.n44+D.n24);H[3].set(D.n41-D.n21,D.n42-D.n22,D.n43-D.n23,D.n44-D.n24);H[4].set(D.n41-D.n31,D.n42-D.n32,D.n43-D.n33,D.n44-D.n34);H[5].set(D.n41+D.n31,D.n42+
|
|
|
+D.n32,D.n43+D.n33,D.n44+D.n34);for(k=0;k<6;k++)fa=H[k],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(f,g,!0);f=0;for(k=fa.length;f<k;f++)if(E=fa[f].object,E.visible)if(ia=E.matrixWorld,na=E.matrixRotationWorld,ca=E.materials,oa=E.overdraw,m=0,E instanceof THREE.Mesh){J=E.geometry;Z=J.vertices;V=J.faces;J=J.faceVertexUvs;K=0;for(da=Z.length;K<da;K++)h=b(),h.positionWorld.copy(Z[K].position),ia.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
|
|
|
+D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>S&&h.positionScreen.z<$;Z=0;for(K=V.length;Z<K;Z++){da=V[Z];if(da instanceof THREE.Face3)if(aa=n[da.a],ha=n[da.b],la=n[da.c],aa.visible&&ha.visible&&la.visible&&(E.doubleSided||E.flipSided!=(la.positionScreen.x-aa.positionScreen.x)*(ha.positionScreen.y-aa.positionScreen.y)-(la.positionScreen.y-aa.positionScreen.y)*(ha.positionScreen.x-aa.positionScreen.x)<
|
|
|
+0))ea=p[o]=p[o]||new THREE.RenderableFace3,o++,t=ea,t.v1.copy(aa),t.v2.copy(ha),t.v3.copy(la);else continue;else if(da instanceof THREE.Face4)if(aa=n[da.a],ha=n[da.b],la=n[da.c],ea=n[da.d],aa.visible&&ha.visible&&la.visible&&ea.visible&&(E.doubleSided||E.flipSided!=((ea.positionScreen.x-aa.positionScreen.x)*(ha.positionScreen.y-aa.positionScreen.y)-(ea.positionScreen.y-aa.positionScreen.y)*(ha.positionScreen.x-aa.positionScreen.x)<0||(ha.positionScreen.x-la.positionScreen.x)*(ea.positionScreen.y-
|
|
|
la.positionScreen.y)-(ha.positionScreen.y-la.positionScreen.y)*(ea.positionScreen.x-la.positionScreen.x)<0)))ga=u[v]=u[v]||new THREE.RenderableFace4,v++,t=ga,t.v1.copy(aa),t.v2.copy(ha),t.v3.copy(la),t.v4.copy(ea);else continue;t.normalWorld.copy(da.normal);na.multiplyVector3(t.normalWorld);t.centroidWorld.copy(da.centroid);ia.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);D.multiplyVector3(t.centroidScreen);la=da.vertexNormals;aa=0;for(ha=la.length;aa<ha;aa++)ea=t.vertexNormalsWorld[aa],
|
|
|
-ea.copy(la[aa]),na.multiplyVector3(ea);aa=0;for(ha=J.length;aa<ha;aa++)if(ga=J[aa][Z]){la=0;for(ea=ga.length;la<ea;la++)t.uvs[aa][la]=ga[la]}t.meshMaterials=ca;t.faceMaterials=da.materials;t.overdraw=oa;t.z=t.centroidScreen.z;L.push(t)}}else if(F instanceof THREE.Line){X.multiply(D,ia);Z=F.geometry.vertices;aa=b();aa.positionScreen.copy(Z[0].position);X.multiplyVector4(aa.positionScreen);K=1;for(da=Z.length;K<da;K++)if(aa=b(),aa.positionScreen.copy(Z[K].position),X.multiplyVector4(aa.positionScreen),
|
|
|
-ha=n[m-2],I.copy(aa.positionScreen),M.copy(ha.positionScreen),e(I,M))I.multiplyScalar(1/I.w),M.multiplyScalar(1/M.w),ia=x[z]=x[z]||new THREE.RenderableLine,z++,w=ia,w.v1.positionScreen.copy(I),w.v2.positionScreen.copy(M),w.z=Math.max(I.z,M.z),w.materials=F.materials,L.push(w)}else if(F instanceof THREE.Particle&&(E.set(F.matrixWorld.n14,F.matrixWorld.n24,F.matrixWorld.n34,1),D.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))ia=B[G]=B[G]||new THREE.RenderableParticle,G++,y=ia,y.x=E.x/E.w,y.y=E.y/E.w,y.z=
|
|
|
-E.z,y.rotation=F.rotation.z,y.scale.x=F.scale.x*Math.abs(y.x-(E.x+g.projectionMatrix.n11)/(E.w+g.projectionMatrix.n14)),y.scale.y=F.scale.y*Math.abs(y.y-(E.y+g.projectionMatrix.n22)/(E.w+g.projectionMatrix.n24)),y.materials=F.materials,L.push(y);j&&L.sort(c);return L}};
|
|
|
+ea.copy(la[aa]),na.multiplyVector3(ea);aa=0;for(ha=J.length;aa<ha;aa++)if(ga=J[aa][Z]){la=0;for(ea=ga.length;la<ea;la++)t.uvs[aa][la]=ga[la]}t.meshMaterials=ca;t.faceMaterials=da.materials;t.overdraw=oa;t.z=t.centroidScreen.z;L.push(t)}}else if(E instanceof THREE.Line){X.multiply(D,ia);Z=E.geometry.vertices;aa=b();aa.positionScreen.copy(Z[0].position);X.multiplyVector4(aa.positionScreen);K=1;for(da=Z.length;K<da;K++)if(aa=b(),aa.positionScreen.copy(Z[K].position),X.multiplyVector4(aa.positionScreen),
|
|
|
+ha=n[m-2],I.copy(aa.positionScreen),M.copy(ha.positionScreen),e(I,M))I.multiplyScalar(1/I.w),M.multiplyScalar(1/M.w),ia=x[z]=x[z]||new THREE.RenderableLine,z++,w=ia,w.v1.positionScreen.copy(I),w.v2.positionScreen.copy(M),w.z=Math.max(I.z,M.z),w.materials=E.materials,L.push(w)}else if(E instanceof THREE.Particle&&(F.set(E.matrixWorld.n14,E.matrixWorld.n24,E.matrixWorld.n34,1),D.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))ia=B[G]=B[G]||new THREE.RenderableParticle,G++,y=ia,y.x=F.x/F.w,y.y=F.y/F.w,y.z=
|
|
|
+F.z,y.rotation=E.rotation.z,y.scale.x=E.scale.x*Math.abs(y.x-(F.x+g.projectionMatrix.n11)/(F.w+g.projectionMatrix.n14)),y.scale.y=E.scale.y*Math.abs(y.y-(F.y+g.projectionMatrix.n22)/(F.w+g.projectionMatrix.n24)),y.materials=E.materials,L.push(y);j&&L.sort(c);return L}};
|
|
|
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 n,t,o,p,v,u,w,z;b=c.projectScene(e,f);n=0;for(t=b.length;n<t;n++)if(v=b[n],v instanceof THREE.RenderableParticle){w=v.x*g+g;z=v.y*j+j;o=0;for(p=v.material.length;o<p;o++)if(u=v.material[o],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=w+"px",u.style.top=z+"px"}}};
|
|
|
THREE.CanvasRenderer=function(b){function c(b){if(y!=b)w.globalAlpha=y=b}function e(b){if(G!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}G=b}}function f(b){if(B!=b.hex)B=b.hex,w.strokeStyle="#"+j(B.toString(16))}function g(b){if(L!=b.hex)L=b.hex,w.fillStyle="#"+j(L.toString(16))}function j(b){for(;b.length<6;)b="0"+b;return b}
|
|
|
-var h=this,m=null,n=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,p,v,u,w=t.getContext("2d"),z=new THREE.Color(0),x=0,y=1,G=0,B=null,L=null,E=null,D=null,X=null,H,I,M,P,Q=new THREE.RenderableVertex,O=new THREE.RenderableVertex,R,S,$,k,K,da,Z,aa,ha,la,ea,fa,F=new THREE.Color(0),ia=new THREE.Color(0),na=new THREE.Color(0),ca=new THREE.Color(0),oa=new THREE.Color(0),J,V,ga,ka,sa,xa,Aa,Ia,Ba,Pa,W=new THREE.Rectangle,ja=new THREE.Rectangle,qa=new THREE.Rectangle,
|
|
|
+var h=this,m=null,n=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,p,v,u,w=t.getContext("2d"),z=new THREE.Color(0),x=0,y=1,G=0,B=null,L=null,F=null,D=null,X=null,H,I,M,P,Q=new THREE.RenderableVertex,O=new THREE.RenderableVertex,R,S,$,k,K,da,Z,aa,ha,la,ea,fa,E=new THREE.Color(0),ia=new THREE.Color(0),na=new THREE.Color(0),ca=new THREE.Color(0),oa=new THREE.Color(0),J,V,ga,ka,sa,xa,Aa,Ia,Ba,Pa,W=new THREE.Rectangle,ja=new THREE.Rectangle,qa=new THREE.Rectangle,
|
|
|
ta=!1,ua=new THREE.Color,wa=new THREE.Color,Da=new THREE.Color,ya=new THREE.Color,ra=new THREE.Vector3,Ea,Y,T,va,U,za,b=16;Ea=document.createElement("canvas");Ea.width=Ea.height=2;Y=Ea.getContext("2d");Y.fillStyle="rgba(0,0,0,1)";Y.fillRect(0,0,2,2);T=Y.getImageData(0,0,2,2);va=T.data;U=document.createElement("canvas");U.width=U.height=b;za=U.getContext("2d");za.translate(-b/2,-b/2);za.scale(b,b);b--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};
|
|
|
-this.setSize=function(b,e){o=b;p=e;v=o/2;u=p/2;t.width=o;t.height=p;W.set(-v,-u,v,u);ja.set(-v,-u,v,u);y=1;G=0;X=D=E=L=B=null};this.setClearColor=function(b,e){z=b;x=e;ja.set(-v,-u,v,u)};this.setClearColorHex=function(b,e){z.setHex(b);x=e;ja.set(-v,-u,v,u)};this.clear=function(){w.setTransform(1,0,0,-1,v,u);if(!ja.isEmpty())ja.inflate(1),ja.minSelf(W),x==0?w.clearRect(ja.getX(),ja.getY(),ja.getWidth(),ja.getHeight()):(e(THREE.NormalBlending),c(1),L="rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+
|
|
|
+this.setSize=function(b,e){o=b;p=e;v=o/2;u=p/2;t.width=o;t.height=p;W.set(-v,-u,v,u);ja.set(-v,-u,v,u);y=1;G=0;X=D=F=L=B=null};this.setClearColor=function(b,e){z=b;x=e;ja.set(-v,-u,v,u)};this.setClearColorHex=function(b,e){z.setHex(b);x=e;ja.set(-v,-u,v,u)};this.clear=function(){w.setTransform(1,0,0,-1,v,u);if(!ja.isEmpty())ja.inflate(1),ja.minSelf(W),x==0?w.clearRect(ja.getX(),ja.getY(),ja.getWidth(),ja.getHeight()):(e(THREE.NormalBlending),c(1),L="rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+
|
|
|
","+Math.floor(z.b*255)+","+x+")",w.fillStyle=L,w.fillRect(ja.getX(),ja.getY(),ja.getWidth(),ja.getHeight())),ja.empty()};this.render=function(b,j){function t(b){var e,c,f,h=b.lights;wa.setRGB(0,0,0);Da.setRGB(0,0,0);ya.setRGB(0,0,0);b=0;for(e=h.length;b<e;b++)c=h[b],f=c.color,c instanceof THREE.AmbientLight?(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b):c instanceof THREE.DirectionalLight?(Da.r+=f.r,Da.g+=f.g,Da.b+=f.b):c instanceof THREE.PointLight&&(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b)}function o(b,e,c,f){var h,g,
|
|
|
j,k,m=b.lights,b=0;for(h=m.length;b<h;b++)g=m[b],j=g.color,g instanceof THREE.DirectionalLight?(k=c.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=c.dot(ra.sub(g.position,e).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(e.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 p(b,h,j){c(j.opacity);e(j.blending);var k,m,n,t,ma,o;if(j instanceof THREE.ParticleBasicMaterial){if(j.map)t=j.map.image,
|
|
|
ma=t.width>>1,o=t.height>>1,j=h.scale.x*v,n=h.scale.y*u,k=j*ma,m=n*o,qa.set(b.x-k,b.y-m,b.x+k,b.y+m),W.instersects(qa)&&(w.save(),w.translate(b.x,b.y),w.rotate(-h.rotation),w.scale(j,-n),w.translate(-ma,-o),w.drawImage(t,0,0),w.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*v,m=h.scale.y*u,qa.set(b.x-k,b.y-m,b.x+k,b.y+m),W.instersects(qa)&&(f(j.color),g(j.color),w.save(),w.translate(b.x,b.y),w.rotate(-h.rotation),w.scale(k,m),j.program(w),w.restore()))}function y(b,h,j,g){c(g.opacity);
|
|
|
-e(g.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(h.positionScreen.x,h.positionScreen.y);w.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(E!=b)w.lineWidth=E=b;b=g.linecap;if(D!=b)w.lineCap=D=b;b=g.linejoin;if(X!=b)w.lineJoin=X=b;f(g.color);w.stroke();qa.inflate(g.linewidth*2)}}function z(b,f,g,m,n,t,ma,p,u){h.data.vertices+=3;h.data.faces++;c(p.opacity);e(p.blending);R=b.positionScreen.x;S=b.positionScreen.y;$=f.positionScreen.x;k=f.positionScreen.y;
|
|
|
+e(g.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(h.positionScreen.x,h.positionScreen.y);w.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(F!=b)w.lineWidth=F=b;b=g.linecap;if(D!=b)w.lineCap=D=b;b=g.linejoin;if(X!=b)w.lineJoin=X=b;f(g.color);w.stroke();qa.inflate(g.linewidth*2)}}function z(b,f,g,m,n,t,ma,p,u){h.data.vertices+=3;h.data.faces++;c(p.opacity);e(p.blending);R=b.positionScreen.x;S=b.positionScreen.y;$=f.positionScreen.x;k=f.positionScreen.y;
|
|
|
K=g.positionScreen.x;da=g.positionScreen.y;B(R,S,$,k,K,da);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ka=ma.uvs[0],Ga(R,S,$,k,K,da,p.map.image,ka[m].u,ka[m].v,ka[n].u,ka[n].v,ka[t].u,ka[t].v));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=j.matrixWorldInverse,ra.copy(ma.vertexNormalsWorld[0]),sa=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,xa=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,ra.copy(ma.vertexNormalsWorld[1]),
|
|
|
Aa=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,Ia=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,ra.copy(ma.vertexNormalsWorld[2]),Ba=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,Pa=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,Ga(R,S,$,k,K,da,p.envMap.image,sa,xa,Aa,Ia,Ba,Pa)}else p.wireframe?Ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ka=ma.uvs[0],Ga(R,S,
|
|
|
$,k,K,da,p.map.image,ka[m].u,ka[m].v,ka[n].u,ka[n].v,ka[t].u,ka[t].v)),e(THREE.SubtractiveBlending)),ta?!p.wireframe&&p.shading==THREE.SmoothShading&&ma.vertexNormalsWorld.length==3?(ia.r=na.r=ca.r=wa.r,ia.g=na.g=ca.g=wa.g,ia.b=na.b=ca.b=wa.b,o(u,ma.v1.positionWorld,ma.vertexNormalsWorld[0],ia),o(u,ma.v2.positionWorld,ma.vertexNormalsWorld[1],na),o(u,ma.v3.positionWorld,ma.vertexNormalsWorld[2],ca),oa.r=(na.r+ca.r)*0.5,oa.g=(na.g+ca.g)*0.5,oa.b=(na.b+ca.b)*0.5,ga=Sa(ia,na,ca,oa),Ga(R,S,$,k,K,da,ga,
|
|
|
-0,0,1,0,0,1)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,o(u,ma.centroidWorld,ma.normalWorld,ua),F.r=Math.max(0,Math.min(p.color.r*ua.r,1)),F.g=Math.max(0,Math.min(p.color.g*ua.g,1)),F.b=Math.max(0,Math.min(p.color.b*ua.b,1)),F.updateHex(),p.wireframe?Ja(F,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(F)):p.wireframe?Ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(p.color);else if(p instanceof THREE.MeshDepthMaterial)J=j.near,V=j.far,ia.r=ia.g=ia.b=1-Na(b.positionScreen.z,
|
|
|
-J,V),na.r=na.g=na.b=1-Na(f.positionScreen.z,J,V),ca.r=ca.g=ca.b=1-Na(g.positionScreen.z,J,V),oa.r=(na.r+ca.r)*0.5,oa.g=(na.g+ca.g)*0.5,oa.b=(na.b+ca.b)*0.5,ga=Sa(ia,na,ca,oa),Ga(R,S,$,k,K,da,ga,0,0,1,0,0,1);else if(p instanceof THREE.MeshNormalMaterial)F.r=Qa(ma.normalWorld.x),F.g=Qa(ma.normalWorld.y),F.b=Qa(ma.normalWorld.z),F.updateHex(),p.wireframe?Ja(F,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(F)}function x(b,f,g,m,n,t,ma,p,u){h.data.vertices+=4;h.data.faces++;c(p.opacity);
|
|
|
+0,0,1,0,0,1)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,o(u,ma.centroidWorld,ma.normalWorld,ua),E.r=Math.max(0,Math.min(p.color.r*ua.r,1)),E.g=Math.max(0,Math.min(p.color.g*ua.g,1)),E.b=Math.max(0,Math.min(p.color.b*ua.b,1)),E.updateHex(),p.wireframe?Ja(E,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(E)):p.wireframe?Ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(p.color);else if(p instanceof THREE.MeshDepthMaterial)J=j.near,V=j.far,ia.r=ia.g=ia.b=1-Na(b.positionScreen.z,
|
|
|
+J,V),na.r=na.g=na.b=1-Na(f.positionScreen.z,J,V),ca.r=ca.g=ca.b=1-Na(g.positionScreen.z,J,V),oa.r=(na.r+ca.r)*0.5,oa.g=(na.g+ca.g)*0.5,oa.b=(na.b+ca.b)*0.5,ga=Sa(ia,na,ca,oa),Ga(R,S,$,k,K,da,ga,0,0,1,0,0,1);else if(p instanceof THREE.MeshNormalMaterial)E.r=Qa(ma.normalWorld.x),E.g=Qa(ma.normalWorld.y),E.b=Qa(ma.normalWorld.z),E.updateHex(),p.wireframe?Ja(E,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(E)}function x(b,f,g,m,n,t,ma,p,u){h.data.vertices+=4;h.data.faces++;c(p.opacity);
|
|
|
e(p.blending);if(p.map||p.envMap)z(b,f,m,0,1,3,ma,p,u),z(n,g,t,1,2,3,ma,p,u);else if(R=b.positionScreen.x,S=b.positionScreen.y,$=f.positionScreen.x,k=f.positionScreen.y,K=g.positionScreen.x,da=g.positionScreen.y,Z=m.positionScreen.x,aa=m.positionScreen.y,ha=n.positionScreen.x,la=n.positionScreen.y,ea=t.positionScreen.x,fa=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)G(R,S,$,k,K,da,Z,aa),p.wireframe?Ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(p.color);else if(p instanceof
|
|
|
THREE.MeshLambertMaterial)ta?!p.wireframe&&p.shading==THREE.SmoothShading&&ma.vertexNormalsWorld.length==4?(ia.r=na.r=ca.r=oa.r=wa.r,ia.g=na.g=ca.g=oa.g=wa.g,ia.b=na.b=ca.b=oa.b=wa.b,o(u,ma.v1.positionWorld,ma.vertexNormalsWorld[0],ia),o(u,ma.v2.positionWorld,ma.vertexNormalsWorld[1],na),o(u,ma.v4.positionWorld,ma.vertexNormalsWorld[3],ca),o(u,ma.v3.positionWorld,ma.vertexNormalsWorld[2],oa),ga=Sa(ia,na,ca,oa),B(R,S,$,k,Z,aa),Ga(R,S,$,k,Z,aa,ga,0,0,1,0,0,1),B(ha,la,K,da,ea,fa),Ga(ha,la,K,da,ea,fa,
|
|
|
-ga,1,0,1,1,0,1)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,o(u,ma.centroidWorld,ma.normalWorld,ua),F.r=Math.max(0,Math.min(p.color.r*ua.r,1)),F.g=Math.max(0,Math.min(p.color.g*ua.g,1)),F.b=Math.max(0,Math.min(p.color.b*ua.b,1)),F.updateHex(),G(R,S,$,k,K,da,Z,aa),p.wireframe?Ja(F,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(F)):(G(R,S,$,k,K,da,Z,aa),p.wireframe?Ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(p.color));else if(p instanceof THREE.MeshNormalMaterial)F.r=
|
|
|
-Qa(ma.normalWorld.x),F.g=Qa(ma.normalWorld.y),F.b=Qa(ma.normalWorld.z),F.updateHex(),G(R,S,$,k,K,da,Z,aa),p.wireframe?Ja(F,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(F);else if(p instanceof THREE.MeshDepthMaterial)J=j.near,V=j.far,ia.r=ia.g=ia.b=1-Na(b.positionScreen.z,J,V),na.r=na.g=na.b=1-Na(f.positionScreen.z,J,V),ca.r=ca.g=ca.b=1-Na(m.positionScreen.z,J,V),oa.r=oa.g=oa.b=1-Na(g.positionScreen.z,J,V),ga=Sa(ia,na,ca,oa),B(R,S,$,k,Z,aa),Ga(R,S,$,k,Z,aa,ga,0,0,1,0,0,1),B(ha,la,
|
|
|
-K,da,ea,fa),Ga(ha,la,K,da,ea,fa,ga,1,0,1,1,0,1)}function B(b,e,c,f,h,g){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(h,g);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,h,g,j,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(h,g);w.lineTo(j,k);w.lineTo(b,e);w.closePath()}function Ja(b,e,c,h){if(E!=e)w.lineWidth=E=e;if(D!=c)w.lineCap=D=c;if(X!=h)w.lineJoin=X=h;f(b);w.stroke();qa.inflate(e*2)}function L(b){g(b);w.fill()}function Ga(b,e,c,f,h,g,j,k,m,n,t,p,ma){var o,u;o=j.width-1;u=j.height-
|
|
|
+ga,1,0,1,1,0,1)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,o(u,ma.centroidWorld,ma.normalWorld,ua),E.r=Math.max(0,Math.min(p.color.r*ua.r,1)),E.g=Math.max(0,Math.min(p.color.g*ua.g,1)),E.b=Math.max(0,Math.min(p.color.b*ua.b,1)),E.updateHex(),G(R,S,$,k,K,da,Z,aa),p.wireframe?Ja(E,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(E)):(G(R,S,$,k,K,da,Z,aa),p.wireframe?Ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(p.color));else if(p instanceof THREE.MeshNormalMaterial)E.r=
|
|
|
+Qa(ma.normalWorld.x),E.g=Qa(ma.normalWorld.y),E.b=Qa(ma.normalWorld.z),E.updateHex(),G(R,S,$,k,K,da,Z,aa),p.wireframe?Ja(E,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):L(E);else if(p instanceof THREE.MeshDepthMaterial)J=j.near,V=j.far,ia.r=ia.g=ia.b=1-Na(b.positionScreen.z,J,V),na.r=na.g=na.b=1-Na(f.positionScreen.z,J,V),ca.r=ca.g=ca.b=1-Na(m.positionScreen.z,J,V),oa.r=oa.g=oa.b=1-Na(g.positionScreen.z,J,V),ga=Sa(ia,na,ca,oa),B(R,S,$,k,Z,aa),Ga(R,S,$,k,Z,aa,ga,0,0,1,0,0,1),B(ha,la,
|
|
|
+K,da,ea,fa),Ga(ha,la,K,da,ea,fa,ga,1,0,1,1,0,1)}function B(b,e,c,f,h,g){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(h,g);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,h,g,j,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(h,g);w.lineTo(j,k);w.lineTo(b,e);w.closePath()}function Ja(b,e,c,h){if(F!=e)w.lineWidth=F=e;if(D!=c)w.lineCap=D=c;if(X!=h)w.lineJoin=X=h;f(b);w.stroke();qa.inflate(e*2)}function L(b){g(b);w.fill()}function Ga(b,e,c,f,h,g,j,k,m,n,t,p,ma){var o,u;o=j.width-1;u=j.height-
|
|
|
1;k*=o;m*=u;n*=o;t*=u;p*=o;ma*=u;c-=b;f-=e;h-=b;g-=e;n-=k;t-=m;p-=k;ma-=m;o=n*ma-p*t;if(!((o<0?-o:o)<1))u=1/o,o=(ma*c-t*h)*u,t=(ma*f-t*g)*u,c=(n*h-p*c)*u,f=(n*g-p*f)*u,b=b-o*k-c*m,e=e-t*k-f*m,w.save(),w.transform(o,t,c,f,b,e),w.clip(),w.drawImage(j,0,0),w.restore()}function Sa(b,e,c,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),j=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),t=~~(f.r*255),p=~~(f.g*255),f=~~(f.b*255);va[0]=h<0?0:h>255?255:h;va[1]=g<0?0:g>255?
|
|
|
255:g;va[2]=b<0?0:b>255?255:b;va[4]=j<0?0:j>255?255:j;va[5]=k<0?0:k>255?255:k;va[6]=e<0?0:e>255?255:e;va[8]=m<0?0:m>255?255:m;va[9]=n<0?0:n>255?255:n;va[10]=c<0?0:c>255?255:c;va[12]=t<0?0:t>255?255:t;va[13]=p<0?0:p>255?255:p;va[14]=f<0?0:f>255?255:f;Y.putImageData(T,0,0);za.drawImage(Ea,0,0);return U}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Qa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,h=c*c+f*f;h!=0&&(h=1/Math.sqrt(h),c*=h,f*=h,e.x+=c,e.y+=f,
|
|
|
b.x-=c,b.y-=f)}var Ta,Va,pa,Ca,La,Ra,Ua,C;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,u);h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,j,this.sortElements);(ta=b.lights.length>0)&&t(b);Ta=0;for(Va=m.length;Ta<Va;Ta++){pa=m[Ta];qa.empty();if(pa instanceof THREE.RenderableParticle){H=pa;H.x*=v;H.y*=u;Ca=0;for(La=pa.materials.length;Ca<La;)C=pa.materials[Ca++],C.opacity!=0&&p(H,pa,C,b)}else if(pa instanceof THREE.RenderableLine){if(H=pa.v1,I=pa.v2,H.positionScreen.x*=v,H.positionScreen.y*=
|
|
@@ -179,18 +179,18 @@ THREE.RenderableFace4&&(H=pa.v1,I=pa.v2,M=pa.v3,P=pa.v4,H.positionScreen.x*=v,H.
|
|
|
qa.addPoint(H.positionScreen.x,H.positionScreen.y),qa.addPoint(I.positionScreen.x,I.positionScreen.y),qa.addPoint(M.positionScreen.x,M.positionScreen.y),qa.addPoint(P.positionScreen.x,P.positionScreen.y),W.instersects(qa))){Ca=0;for(La=pa.meshMaterials.length;Ca<La;)if(C=pa.meshMaterials[Ca++],C instanceof THREE.MeshFaceMaterial){Ra=0;for(Ua=pa.faceMaterials.length;Ra<Ua;)(C=pa.faceMaterials[Ra++])&&C.opacity!=0&&x(H,I,M,P,Q,O,pa,C,b)}else C.opacity!=0&&x(H,I,M,P,Q,O,pa,C,b)}ja.addRectangle(qa)}w.setTransform(1,
|
|
|
0,0,1,0,0)}};
|
|
|
THREE.SVGRenderer=function(){function b(b,e,c){var f,h,g,j;f=0;for(h=b.lights.length;f<h;f++)g=b.lights[f],g instanceof THREE.DirectionalLight?(j=e.normalWorld.dot(g.position)*g.intensity,j>0&&(c.r+=g.color.r*j,c.g+=g.color.g*j,c.b+=g.color.b*j)):g instanceof THREE.PointLight&&(P.sub(g.position,e.centroidWorld),P.normalize(),j=e.normalWorld.dot(P)*g.intensity,j>0&&(c.r+=g.color.r*j,c.g+=g.color.g*j,c.b+=g.color.b*j))}function c(e,c,k,m,n,p){h.data.vertices+=3;h.data.faces++;R=f(S++);R.setAttribute("d",
|
|
|
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?E.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?L?(D.r=X.r,D.g=X.g,D.b=X.b,b(p,m,D),E.r=Math.max(0,Math.min(n.color.r*D.r,1)),E.g=Math.max(0,Math.min(n.color.g*D.g,1)),E.b=Math.max(0,Math.min(n.color.b*D.b,1)),E.updateHex()):E.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(M=1-n.__2near/(n.__farPlusNear-
|
|
|
-m.z*n.__farMinusNear),E.setRGB(M,M,M)):n instanceof THREE.MeshNormalMaterial&&E.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: #"+j(E.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style","fill: #"+j(E.hex.toString(16))+"; fill-opacity: "+n.opacity);t.appendChild(R)}function e(e,c,k,m,
|
|
|
-n,p,o){h.data.vertices+=4;h.data.faces++;R=f(S++);R.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?E.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?L?(D.r=X.r,D.g=X.g,D.b=X.b,b(o,n,D),E.r=Math.max(0,Math.min(p.color.r*D.r,1)),E.g=Math.max(0,Math.min(p.color.g*D.g,1)),E.b=Math.max(0,Math.min(p.color.b*
|
|
|
-D.b,1)),E.updateHex()):E.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(M=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),E.setRGB(M,M,M)):p instanceof THREE.MeshNormalMaterial&&E.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));p.wireframe?R.setAttribute("style","fill: none; stroke: #"+j(E.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):R.setAttribute("style",
|
|
|
-"fill: #"+j(E.hex.toString(16))+"; fill-opacity: "+p.opacity);t.appendChild(R)}function f(b){Q[b]==null&&(Q[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),k==0&&Q[b].setAttribute("shape-rendering","crispEdges"));return Q[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function j(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,v,u,w,z,x,y,G=new THREE.Rectangle,B=new THREE.Rectangle,L=
|
|
|
-!1,E=new THREE.Color(16777215),D=new THREE.Color(16777215),X=new THREE.Color(0),H=new THREE.Color(0),I=new THREE.Color(0),M,P=new THREE.Vector3,Q=[],O=[],R,S,$,k=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":k=1;break;case "low":k=0}};this.setSize=function(b,e){o=b;p=e;v=o/2;u=p/2;t.setAttribute("viewBox",-v+" "+-u+" "+o+" "+p);t.setAttribute("width",o);t.setAttribute("height",p);G.set(-v,-u,
|
|
|
-v,u)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};this.render=function(b,f){var g,p,o,E,D,M,F,P;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,f,this.sortElements);$=S=0;if(L=b.lights.length>0){F=b.lights;X.setRGB(0,0,0);H.setRGB(0,0,0);I.setRGB(0,0,0);g=0;for(p=F.length;g<p;g++)o=F[g],E=o.color,o instanceof THREE.AmbientLight?(X.r+=E.r,X.g+=E.g,X.b+=E.b):o instanceof THREE.DirectionalLight?(H.r+=E.r,H.g+=E.g,H.b+=E.b):o instanceof
|
|
|
-THREE.PointLight&&(I.r+=E.r,I.g+=E.g,I.b+=E.b)}g=0;for(p=m.length;g<p;g++)if(F=m[g],B.empty(),F instanceof THREE.RenderableParticle){w=F;w.x*=v;w.y*=-u;o=0;for(E=F.materials.length;o<E;)o++}else if(F instanceof THREE.RenderableLine){if(w=F.v1,z=F.v2,w.positionScreen.x*=v,w.positionScreen.y*=-u,z.positionScreen.x*=v,z.positionScreen.y*=-u,B.addPoint(w.positionScreen.x,w.positionScreen.y),B.addPoint(z.positionScreen.x,z.positionScreen.y),G.instersects(B)){o=0;for(E=F.materials.length;o<E;)if((P=F.materials[o++])&&
|
|
|
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?F.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?L?(D.r=X.r,D.g=X.g,D.b=X.b,b(p,m,D),F.r=Math.max(0,Math.min(n.color.r*D.r,1)),F.g=Math.max(0,Math.min(n.color.g*D.g,1)),F.b=Math.max(0,Math.min(n.color.b*D.b,1)),F.updateHex()):F.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(M=1-n.__2near/(n.__farPlusNear-
|
|
|
+m.z*n.__farMinusNear),F.setRGB(M,M,M)):n instanceof THREE.MeshNormalMaterial&&F.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: #"+j(F.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style","fill: #"+j(F.hex.toString(16))+"; fill-opacity: "+n.opacity);t.appendChild(R)}function e(e,c,k,m,
|
|
|
+n,p,o){h.data.vertices+=4;h.data.faces++;R=f(S++);R.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?F.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?L?(D.r=X.r,D.g=X.g,D.b=X.b,b(o,n,D),F.r=Math.max(0,Math.min(p.color.r*D.r,1)),F.g=Math.max(0,Math.min(p.color.g*D.g,1)),F.b=Math.max(0,Math.min(p.color.b*
|
|
|
+D.b,1)),F.updateHex()):F.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(M=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),F.setRGB(M,M,M)):p instanceof THREE.MeshNormalMaterial&&F.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));p.wireframe?R.setAttribute("style","fill: none; stroke: #"+j(F.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):R.setAttribute("style",
|
|
|
+"fill: #"+j(F.hex.toString(16))+"; fill-opacity: "+p.opacity);t.appendChild(R)}function f(b){Q[b]==null&&(Q[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),k==0&&Q[b].setAttribute("shape-rendering","crispEdges"));return Q[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function j(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,v,u,w,z,x,y,G=new THREE.Rectangle,B=new THREE.Rectangle,L=
|
|
|
+!1,F=new THREE.Color(16777215),D=new THREE.Color(16777215),X=new THREE.Color(0),H=new THREE.Color(0),I=new THREE.Color(0),M,P=new THREE.Vector3,Q=[],O=[],R,S,$,k=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":k=1;break;case "low":k=0}};this.setSize=function(b,e){o=b;p=e;v=o/2;u=p/2;t.setAttribute("viewBox",-v+" "+-u+" "+o+" "+p);t.setAttribute("width",o);t.setAttribute("height",p);G.set(-v,-u,
|
|
|
+v,u)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};this.render=function(b,f){var g,p,o,F,D,M,E,P;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,f,this.sortElements);$=S=0;if(L=b.lights.length>0){E=b.lights;X.setRGB(0,0,0);H.setRGB(0,0,0);I.setRGB(0,0,0);g=0;for(p=E.length;g<p;g++)o=E[g],F=o.color,o instanceof THREE.AmbientLight?(X.r+=F.r,X.g+=F.g,X.b+=F.b):o instanceof THREE.DirectionalLight?(H.r+=F.r,H.g+=F.g,H.b+=F.b):o instanceof
|
|
|
+THREE.PointLight&&(I.r+=F.r,I.g+=F.g,I.b+=F.b)}g=0;for(p=m.length;g<p;g++)if(E=m[g],B.empty(),E instanceof THREE.RenderableParticle){w=E;w.x*=v;w.y*=-u;o=0;for(F=E.materials.length;o<F;)o++}else if(E instanceof THREE.RenderableLine){if(w=E.v1,z=E.v2,w.positionScreen.x*=v,w.positionScreen.y*=-u,z.positionScreen.x*=v,z.positionScreen.y*=-u,B.addPoint(w.positionScreen.x,w.positionScreen.y),B.addPoint(z.positionScreen.x,z.positionScreen.y),G.instersects(B)){o=0;for(F=E.materials.length;o<F;)if((P=E.materials[o++])&&
|
|
|
P.opacity!=0){D=w;M=z;var Q=$++;O[Q]==null&&(O[Q]=document.createElementNS("http://www.w3.org/2000/svg","line"),k==0&&O[Q].setAttribute("shape-rendering","crispEdges"));R=O[Q];R.setAttribute("x1",D.positionScreen.x);R.setAttribute("y1",D.positionScreen.y);R.setAttribute("x2",M.positionScreen.x);R.setAttribute("y2",M.positionScreen.y);P instanceof THREE.LineBasicMaterial&&(R.setAttribute("style","fill: none; stroke: ##"+j(P.color.hex.toString(16))+"; stroke-width: "+P.linewidth+"; stroke-opacity: "+
|
|
|
-P.opacity+"; stroke-linecap: "+P.linecap+"; stroke-linejoin: "+P.linejoin),t.appendChild(R))}}}else if(F instanceof THREE.RenderableFace3){if(w=F.v1,z=F.v2,x=F.v3,w.positionScreen.x*=v,w.positionScreen.y*=-u,z.positionScreen.x*=v,z.positionScreen.y*=-u,x.positionScreen.x*=v,x.positionScreen.y*=-u,B.addPoint(w.positionScreen.x,w.positionScreen.y),B.addPoint(z.positionScreen.x,z.positionScreen.y),B.addPoint(x.positionScreen.x,x.positionScreen.y),G.instersects(B)){o=0;for(E=F.meshMaterials.length;o<
|
|
|
-E;)if(P=F.meshMaterials[o++],P instanceof THREE.MeshFaceMaterial){D=0;for(M=F.faceMaterials.length;D<M;)(P=F.faceMaterials[D++])&&P.opacity!=0&&c(w,z,x,F,P,b)}else P&&P.opacity!=0&&c(w,z,x,F,P,b)}}else if(F instanceof THREE.RenderableFace4&&(w=F.v1,z=F.v2,x=F.v3,y=F.v4,w.positionScreen.x*=v,w.positionScreen.y*=-u,z.positionScreen.x*=v,z.positionScreen.y*=-u,x.positionScreen.x*=v,x.positionScreen.y*=-u,y.positionScreen.x*=v,y.positionScreen.y*=-u,B.addPoint(w.positionScreen.x,w.positionScreen.y),B.addPoint(z.positionScreen.x,
|
|
|
-z.positionScreen.y),B.addPoint(x.positionScreen.x,x.positionScreen.y),B.addPoint(y.positionScreen.x,y.positionScreen.y),G.instersects(B))){o=0;for(E=F.meshMaterials.length;o<E;)if(P=F.meshMaterials[o++],P instanceof THREE.MeshFaceMaterial){D=0;for(M=F.faceMaterials.length;D<M;)(P=F.faceMaterials[D++])&&P.opacity!=0&&e(w,z,x,y,F,P,b)}else P&&P.opacity!=0&&e(w,z,x,y,F,P,b)}}};
|
|
|
+P.opacity+"; stroke-linecap: "+P.linecap+"; stroke-linejoin: "+P.linejoin),t.appendChild(R))}}}else if(E instanceof THREE.RenderableFace3){if(w=E.v1,z=E.v2,x=E.v3,w.positionScreen.x*=v,w.positionScreen.y*=-u,z.positionScreen.x*=v,z.positionScreen.y*=-u,x.positionScreen.x*=v,x.positionScreen.y*=-u,B.addPoint(w.positionScreen.x,w.positionScreen.y),B.addPoint(z.positionScreen.x,z.positionScreen.y),B.addPoint(x.positionScreen.x,x.positionScreen.y),G.instersects(B)){o=0;for(F=E.meshMaterials.length;o<
|
|
|
+F;)if(P=E.meshMaterials[o++],P instanceof THREE.MeshFaceMaterial){D=0;for(M=E.faceMaterials.length;D<M;)(P=E.faceMaterials[D++])&&P.opacity!=0&&c(w,z,x,E,P,b)}else P&&P.opacity!=0&&c(w,z,x,E,P,b)}}else if(E instanceof THREE.RenderableFace4&&(w=E.v1,z=E.v2,x=E.v3,y=E.v4,w.positionScreen.x*=v,w.positionScreen.y*=-u,z.positionScreen.x*=v,z.positionScreen.y*=-u,x.positionScreen.x*=v,x.positionScreen.y*=-u,y.positionScreen.x*=v,y.positionScreen.y*=-u,B.addPoint(w.positionScreen.x,w.positionScreen.y),B.addPoint(z.positionScreen.x,
|
|
|
+z.positionScreen.y),B.addPoint(x.positionScreen.x,x.positionScreen.y),B.addPoint(y.positionScreen.x,y.positionScreen.y),G.instersects(B))){o=0;for(F=E.meshMaterials.length;o<F;)if(P=E.meshMaterials[o++],P instanceof THREE.MeshFaceMaterial){D=0;for(M=E.faceMaterials.length;D<M;)(P=E.faceMaterials[D++])&&P.opacity!=0&&e(w,z,x,y,E,P,b)}else P&&P.opacity!=0&&e(w,z,x,y,E,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",
|
|
@@ -232,12 +232,12 @@ for(f=0;f<p;f++)g=f*3,color=n[u[f][1]],o[g]=color.r,o[g+1]=color.g,o[g+2]=color.
|
|
|
x.x,f.array[p+1]=x.y,f.array[p+2]=x.z,f.array[p+3]=x.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)h=j[f].position,g=f*3,t[g]=h.x,t[g+1]=h.y,t[g+2]=h.z;if(w)for(f=0;f<p;f++)color=n[f],g=f*3,o[g]=color.r,o[g+1]=color.g,o[g+2]=color.b;if(y)for(z in y)if(f=y[z],f.__original.needsUpdate){n=f.value.length;for(g=0;g<n;g++){p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")x=f.value[g];f.size===2?(f.array[p]=
|
|
|
x.x,f.array[p+1]=x.y):f.size===3?f.type==="c"?(f.array[p]=x.r,f.array[p+1]=x.g,f.array[p+2]=x.b):(f.array[p]=x.x,f.array[p+1]=x.y,f.array[p+2]=x.z):(f.array[p]=x.x,f.array[p+1]=x.y,f.array[p+2]=x.z,f.array[p+3]=x.w)}f.offset+=f.size}}}if(v||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,t,e);if(w||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,o,e);if(y)for(z in y)if(f=y[z],f.__original.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
f.buffer),k.bufferData(k.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||$.initMaterial(f,e,c,g);if(f.morphTargets&&!g.__webglMorphTargetInfluences){g.__webglMorphTargetInfluences=new Float32Array($.maxMorphTargets);for(var h=0,j=this.maxMorphTargets;h<j;h++)g.__webglMorphTargetInfluences[h]=0}var h=f.program,j=h.uniforms,m=f.uniforms;h!=da&&(k.useProgram(h),da=h);k.uniformMatrix4fv(j.projectionMatrix,!1,sa);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
|
|
|
-f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var p,n,t,o=0,u=0,v=0,w,y,x,z=Ia,B=z.directional.colors,G=z.directional.positions,E=z.point.colors,H=z.point.positions,D=z.point.distances,
|
|
|
-J=0,C=0,c=n=x=0;for(p=e.length;c<p;c++)if(n=e[c],t=n.color,w=n.position,y=n.intensity,x=n.distance,n instanceof THREE.AmbientLight)o+=t.r,u+=t.g,v+=t.b;else if(n instanceof THREE.DirectionalLight)x=J*3,B[x]=t.r*y,B[x+1]=t.g*y,B[x+2]=t.b*y,G[x]=w.x,G[x+1]=w.y,G[x+2]=w.z,J+=1;else if(n instanceof THREE.SpotLight)x=J*3,B[x]=t.r*y,B[x+1]=t.g*y,B[x+2]=t.b*y,t=1/w.length(),G[x]=w.x*t,G[x+1]=w.y*t,G[x+2]=w.z*t,J+=1;else if(n instanceof THREE.PointLight)n=C*3,E[n]=t.r*y,E[n+1]=t.g*y,E[n+2]=t.b*y,H[n]=w.x,
|
|
|
-H[n+1]=w.y,H[n+2]=w.z,D[C]=x,C+=1;for(c=J*3;c<B.length;c++)B[c]=0;for(c=C*3;c<E.length;c++)E[c]=0;z.point.length=C;z.directional.length=J;z.ambient[0]=o;z.ambient[1]=u;z.ambient[2]=v;c=Ia;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=
|
|
|
+f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var p,n,t,o=0,u=0,v=0,w,y,x,z=Ia,B=z.directional.colors,G=z.directional.positions,F=z.point.colors,H=z.point.positions,D=z.point.distances,
|
|
|
+J=0,C=0,c=n=x=0;for(p=e.length;c<p;c++)if(n=e[c],t=n.color,w=n.position,y=n.intensity,x=n.distance,n instanceof THREE.AmbientLight)o+=t.r,u+=t.g,v+=t.b;else if(n instanceof THREE.DirectionalLight)x=J*3,B[x]=t.r*y,B[x+1]=t.g*y,B[x+2]=t.b*y,G[x]=w.x,G[x+1]=w.y,G[x+2]=w.z,J+=1;else if(n instanceof THREE.SpotLight)x=J*3,B[x]=t.r*y,B[x+1]=t.g*y,B[x+2]=t.b*y,t=1/w.length(),G[x]=w.x*t,G[x+1]=w.y*t,G[x+2]=w.z*t,J+=1;else if(n instanceof THREE.PointLight)n=C*3,F[n]=t.r*y,F[n+1]=t.g*y,F[n+2]=t.b*y,H[n]=w.x,
|
|
|
+H[n+1]=w.y,H[n+2]=w.z,D[C]=x,C+=1;for(c=J*3;c<B.length;c++)B[c]=0;for(c=C*3;c<F.length;c++)F[c]=0;z.point.length=C;z.directional.length=J;z.ambient[0]=o;z.ambient[1]=u;z.ambient[2]=v;c=Ia;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=
|
|
|
c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof
|
|
|
THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=Ba.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=
|
|
|
-f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(g.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(c=0;c<ua.length;c++)m.shadowMatrix.value[c]=ua[c],m.shadowMap.texture[c]=$.shadowMap[c];m.shadowDarkness.value=$.shadowMapDarkness;m.shadowBias.value=$.shadowMapBias}for(var L in m)if(o=h.uniforms[L])if(p=m[L],u=p.type,c=p.value,u=="i")k.uniform1i(o,c);else if(u=="f")k.uniform1f(o,c);else if(u=="fv1")k.uniform1fv(o,c);else if(u=="fv")k.uniform3fv(o,c);else if(u==
|
|
|
+f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(g.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(c=0;c<ua.length;c++)m.shadowMatrix.value[c]=ua[c],m.shadowMap.texture[c]=$.shadowMap[c];m.shadowDarkness.value=$.shadowMapDarkness;m.shadowBias.value=$.shadowMapBias}for(var A in m)if(o=h.uniforms[A])if(p=m[A],u=p.type,c=p.value,u=="i")k.uniform1i(o,c);else if(u=="f")k.uniform1f(o,c);else if(u=="fv1")k.uniform1fv(o,c);else if(u=="fv")k.uniform3fv(o,c);else if(u==
|
|
|
"v2")k.uniform2f(o,c.x,c.y);else if(u=="v3")k.uniform3f(o,c.x,c.y,c.z);else if(u=="v4")k.uniform4f(o,c.x,c.y,c.z,c.w);else if(u=="m4"){if(!p._array)p._array=new Float32Array(16);c.flattenToArray(p._array);k.uniformMatrix4fv(o,!1,p._array)}else if(u=="m4v"){if(!p._array)p._array=new Float32Array(16*c.length);u=0;for(v=c.length;u<v;u++)c[u].flattenToArrayOffset(p._array,u*16);k.uniformMatrix4fv(o,!1,p._array)}else if(u=="c")k.uniform3f(o,c.r,c.g,c.b);else if(u=="t"){if(k.uniform1i(o,c),o=p.texture)if(o.image instanceof
|
|
|
Array&&o.image.length==6){if(p=o,p.image.length==6){if(p.needsUpdate){if(p.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,p.image.__webglTextureCube);for(o=0;o<6;++o)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,0,0,k.RGBA,k.UNSIGNED_BYTE,p.image[o])}else{p.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,p.image.__webglTextureCube);for(o=0;o<6;++o)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,p.image[o]);p.__webglInit=!0}M(k.TEXTURE_CUBE_MAP,
|
|
|
p,p.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,p.image.__webglTextureCube)}}else P(o,c)}else if(u=="tv"){if(!p._array){p._array=[];u=0;for(v=p.texture.length;u<v;u++)p._array[u]=c+u}k.uniform1iv(o,p._array);u=0;for(v=p.texture.length;u<v;u++)(o=p.texture[u])&&P(o,p._array[u])}k.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray);k.uniformMatrix3fv(j.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
|
|
@@ -252,7 +252,7 @@ k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):
|
|
|
3,$.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(g.linewidth),k.drawArrays(j,0,h.__webglLineCount),$.data.drawCalls++):j instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,h.__webglParticleCount),$.data.drawCalls++):j instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,h.__webglVertexCount),$.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=k.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=
|
|
|
k.createBuffer();b.hasPos&&(k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,b.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(e.attributes.position),k.vertexAttribPointer(e.attributes.position,3,k.FLOAT,!1,0,0));if(b.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,j,m,p,n,t,o,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],h=c[u+1],g=c[u+2],j=c[u+3],p=c[u+4],t=c[u+5],m=c[u+6],n=c[u+7],o=c[u+8],f=(f+j+m)/
|
|
|
3,h=(h+p+n)/3,g=(g+t+o)/3,c[u]=f,c[u+1]=h,c[u+2]=g,c[u+3]=f,c[u+4]=h,c[u+5]=g,c[u+6]=f,c[u+7]=h,c[u+8]=g}k.bufferData(k.ARRAY_BUFFER,b.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(e.attributes.normal);k.vertexAttribPointer(e.attributes.normal,3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,b.count);b.count=0}function j(b){if(ha!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),ha=b.doubleSided;if(la!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),la=b.flipSided}
|
|
|
-function h(b){fa!=b&&(b?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),fa=b)}function m(b,e,c){F!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),F=b);if(b&&(ia!=e||na!=c))k.polygonOffset(e,c),ia=e,na=c}function n(b){ga[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ga[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ga[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ga[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ga[4].set(b.n41-b.n31,b.n42-
|
|
|
+function h(b){fa!=b&&(b?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),fa=b)}function m(b,e,c){E!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),E=b);if(b&&(ia!=e||na!=c))k.polygonOffset(e,c),ia=e,na=c}function n(b){ga[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ga[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ga[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ga[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ga[4].set(b.n41-b.n31,b.n42-
|
|
|
b.n32,b.n43-b.n33,b.n44-b.n34);ga[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=ga[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function t(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ga[f].x*e.n14+ga[f].y*e.n24+ga[f].z*e.n34+ga[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function p(b){var e,c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=
|
|
|
h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?o(g,c):o(h,c)}function v(b){var e,c,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(h=j.materials[e])&&(h.transparent?o(m,h):o(k,h))}else(h=e)&&(h.transparent?o(m,h):o(k,h))}function u(b,e){return e.z-b.z}function w(b,c){var m,p,o,u=0,v,w,y,x,z=b.lights;ta||(ta=new THREE.Camera($.shadowCameraFov,
|
|
|
c.aspect,$.shadowCameraNear,$.shadowCameraFar));m=0;for(p=z.length;m<p;m++)if(o=z[m],o instanceof THREE.SpotLight&&o.castShadow){$.shadowMap[u]||($.shadowMap[u]=new THREE.WebGLRenderTarget($.shadowMapWidth,$.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ua[u]||(ua[u]=new THREE.Matrix4);v=$.shadowMap[u];w=ua[u];ta.position.copy(o.position);ta.target.position.copy(o.target.position);ta.update(void 0,!0);b.update(void 0,!1,ta);w.set(0.5,0,0,0.5,
|
|
@@ -270,74 +270,74 @@ c=T.attributes;k.useProgram(T.program);da=T.program;fa=ea=-1;va||(k.enableVertex
|
|
|
T.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f=0;f<h;f++)if(c=b.__webglLensFlares[f].object,p.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(p),e.projectionMatrix.multiplyVector3(p),w[0]=p.x,w[1]=p.y,w[2]=p.z,y[0]=w[0]*t+t,y[1]=w[1]*o+o,T.hasVertexTexture||y[0]>0&&y[0]<J&&y[1]>0&&y[1]<V){k.bindTexture(k.TEXTURE_2D,T.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,y[0]-8,y[1]-8,16,16,0);k.uniform1i(x.renderType,0);k.uniform2fv(x.scale,v);k.uniform3fv(x.screenPosition,
|
|
|
w);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,T.occlusionTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,y[0]-8,y[1]-8,16,16,0);k.uniform1i(x.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,T.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=w[0];c.positionScreen.y=w[1];c.positionScreen.z=w[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();k.uniform1i(x.renderType,
|
|
|
2);k.enable(k.BLEND);g=0;for(j=c.lensFlares.length;g<j;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)w[0]=m.x,w[1]=m.y,w[2]=m.z,u=m.size*m.scale/V,v[0]=u*n,v[1]=u,k.uniform3fv(x.screenPosition,w),k.uniform2fv(x.scale,v),k.uniform1f(x.rotation,m.rotation),k.uniform1f(x.opacity,m.opacity),I(m.blending),P(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(aa)}function G(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
|
|
|
-b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function B(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function L(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function E(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;
|
|
|
-for(e in f.geometryGroups)if(h=f.geometryGroups[e],g=B(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var j=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var p=void 0,n=void 0,t=void 0,o=void 0,u=t=void 0,v=void 0,w=void 0,y=void 0,x=void 0,z=void 0,G=void 0,E=void 0,H=void 0,J=void 0,D=void 0,I=void 0,V=void 0,C=o=y=o=w=v=void 0,F=void 0,A=F=C=v=void 0,M=void 0,P=A=F=C=t=t=u=y=o=A=F=C=M=A=F=C=M=A=F=C=void 0,K=
|
|
|
-0,ga=0,aa=0,X=0,Q=0,T=0,O=0,U=0,ka=0,N=0,R=0,F=C=0,S=g.__vertexArray,$=g.__uvArray,da=g.__uv2Array,la=g.__normalArray,W=g.__tangentArray,Z=g.__colorArray,Y=g.__skinVertexAArray,ea=g.__skinVertexBArray,ca=g.__skinIndexArray,fa=g.__skinWeightArray,na=g.__morphTargetsArrays,ha=g.__webglCustomAttributes,A=void 0,ia=g.__faceArray,sa=g.__lineArray,oa=g.__needsSmoothNormals,z=g.__vertexColorType,x=g.__uvType,G=g.__normalType,ja=j.geometry,qa=ja.__dirtyVertices,ra=ja.__dirtyElements,xa=ja.__dirtyUvs,ta=ja.__dirtyNormals,
|
|
|
-ua=ja.__dirtyTangents,wa=ja.__dirtyColors,Aa=ja.__dirtyMorphTargets,va=ja.vertices,Ba=g.faces,Da=ja.faces,Ia=ja.faceVertexUvs[0],Ea=ja.faceVertexUvs[1],ya=ja.skinVerticesA,za=ja.skinVerticesB,Oa=ja.skinIndices,Ha=ja.skinWeights,Ma=j instanceof THREE.ShadowVolume?ja.edgeFaces:void 0,Fa=ja.morphTargets;if(ha)for(P in ha)ha[P].offset=0,ha[P].offsetSrc=0;p=0;for(n=Ba.length;p<n;p++)if(t=Ba[p],o=Da[t],Ia&&(E=Ia[t]),Ea&&(H=Ea[t]),t=o.vertexNormals,u=o.normal,v=o.vertexColors,w=o.color,y=o.vertexTangents,
|
|
|
-o instanceof THREE.Face3){if(qa)J=va[o.a].position,D=va[o.b].position,I=va[o.c].position,S[ga]=J.x,S[ga+1]=J.y,S[ga+2]=J.z,S[ga+3]=D.x,S[ga+4]=D.y,S[ga+5]=D.z,S[ga+6]=I.x,S[ga+7]=I.y,S[ga+8]=I.z,ga+=9;if(ha)for(P in ha)if(A=ha[P],A.__original.needsUpdate)C=A.offset,F=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[C+0]=A.value[o.a],A.array[C+1]=A.value[o.b],A.array[C+2]=A.value[o.c]):A.boundTo==="faces"?(A.array[C+0]=A.value[F],A.array[C+1]=A.value[F],A.array[C+2]=A.value[F],
|
|
|
-A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[C+0]=A.value[F+0],A.array[C+1]=A.value[F+1],A.array[C+2]=A.value[F+2],A.offsetSrc+=3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(J=A.value[o.a],D=A.value[o.b],I=A.value[o.c]):A.boundTo==="faces"?(J=A.value[F],D=A.value[F],I=A.value[F],A.offsetSrc++):A.boundTo==="faceVertices"&&(J=A.value[F+0],D=A.value[F+1],I=A.value[F+2],A.offsetSrc+=3),A.size===2?(A.array[C+0]=J.x,A.array[C+1]=J.y,A.array[C+2]=D.x,A.array[C+3]=D.y,A.array[C+4]=I.x,
|
|
|
-A.array[C+5]=I.y,A.offset+=6):A.size===3?(A.type==="c"?(A.array[C+0]=J.r,A.array[C+1]=J.g,A.array[C+2]=J.b,A.array[C+3]=D.r,A.array[C+4]=D.g,A.array[C+5]=D.b,A.array[C+6]=I.r,A.array[C+7]=I.g,A.array[C+8]=I.b):(A.array[C+0]=J.x,A.array[C+1]=J.y,A.array[C+2]=J.z,A.array[C+3]=D.x,A.array[C+4]=D.y,A.array[C+5]=D.z,A.array[C+6]=I.x,A.array[C+7]=I.y,A.array[C+8]=I.z),A.offset+=9):(A.array[C+0]=J.x,A.array[C+1]=J.y,A.array[C+2]=J.z,A.array[C+3]=J.w,A.array[C+4]=D.x,A.array[C+5]=D.y,A.array[C+6]=D.z,A.array[C+
|
|
|
-7]=D.w,A.array[C+8]=I.x,A.array[C+9]=I.y,A.array[C+10]=I.z,A.array[C+11]=I.w,A.offset+=12));if(Aa){C=0;for(F=Fa.length;C<F;C++)J=Fa[C].vertices[o.a].position,D=Fa[C].vertices[o.b].position,I=Fa[C].vertices[o.c].position,A=na[C],A[R+0]=J.x,A[R+1]=J.y,A[R+2]=J.z,A[R+3]=D.x,A[R+4]=D.y,A[R+5]=D.z,A[R+6]=I.x,A[R+7]=I.y,A[R+8]=I.z;R+=9}if(Ha.length)C=Ha[o.a],F=Ha[o.b],A=Ha[o.c],fa[N]=C.x,fa[N+1]=C.y,fa[N+2]=C.z,fa[N+3]=C.w,fa[N+4]=F.x,fa[N+5]=F.y,fa[N+6]=F.z,fa[N+7]=F.w,fa[N+8]=A.x,fa[N+9]=A.y,fa[N+10]=
|
|
|
-A.z,fa[N+11]=A.w,C=Oa[o.a],F=Oa[o.b],A=Oa[o.c],ca[N]=C.x,ca[N+1]=C.y,ca[N+2]=C.z,ca[N+3]=C.w,ca[N+4]=F.x,ca[N+5]=F.y,ca[N+6]=F.z,ca[N+7]=F.w,ca[N+8]=A.x,ca[N+9]=A.y,ca[N+10]=A.z,ca[N+11]=A.w,C=ya[o.a],F=ya[o.b],A=ya[o.c],Y[N]=C.x,Y[N+1]=C.y,Y[N+2]=C.z,Y[N+3]=1,Y[N+4]=F.x,Y[N+5]=F.y,Y[N+6]=F.z,Y[N+7]=1,Y[N+8]=A.x,Y[N+9]=A.y,Y[N+10]=A.z,Y[N+11]=1,C=za[o.a],F=za[o.b],A=za[o.c],ea[N]=C.x,ea[N+1]=C.y,ea[N+2]=C.z,ea[N+3]=1,ea[N+4]=F.x,ea[N+5]=F.y,ea[N+6]=F.z,ea[N+7]=1,ea[N+8]=A.x,ea[N+9]=A.y,ea[N+10]=A.z,
|
|
|
-ea[N+11]=1,N+=12;if(wa&&z)v.length==3&&z==THREE.VertexColors?(o=v[0],C=v[1],F=v[2]):F=C=o=w,Z[ka]=o.r,Z[ka+1]=o.g,Z[ka+2]=o.b,Z[ka+3]=C.r,Z[ka+4]=C.g,Z[ka+5]=C.b,Z[ka+6]=F.r,Z[ka+7]=F.g,Z[ka+8]=F.b,ka+=9;if(ua&&ja.hasTangents)v=y[0],w=y[1],o=y[2],W[O]=v.x,W[O+1]=v.y,W[O+2]=v.z,W[O+3]=v.w,W[O+4]=w.x,W[O+5]=w.y,W[O+6]=w.z,W[O+7]=w.w,W[O+8]=o.x,W[O+9]=o.y,W[O+10]=o.z,W[O+11]=o.w,O+=12;if(ta&&G)if(t.length==3&&oa)for(y=0;y<3;y++)u=t[y],la[T]=u.x,la[T+1]=u.y,la[T+2]=u.z,T+=3;else for(y=0;y<3;y++)la[T]=
|
|
|
-u.x,la[T+1]=u.y,la[T+2]=u.z,T+=3;if(xa&&E!==void 0&&x)for(y=0;y<3;y++)t=E[y],$[aa]=t.u,$[aa+1]=t.v,aa+=2;if(xa&&H!==void 0&&x)for(y=0;y<3;y++)t=H[y],da[X]=t.u,da[X+1]=t.v,X+=2;ra&&(ia[Q]=K,ia[Q+1]=K+1,ia[Q+2]=K+2,Q+=3,sa[U]=K,sa[U+1]=K+1,sa[U+2]=K,sa[U+3]=K+2,sa[U+4]=K+1,sa[U+5]=K+2,U+=6,K+=3)}else if(o instanceof THREE.Face4){if(qa)J=va[o.a].position,D=va[o.b].position,I=va[o.c].position,V=va[o.d].position,S[ga]=J.x,S[ga+1]=J.y,S[ga+2]=J.z,S[ga+3]=D.x,S[ga+4]=D.y,S[ga+5]=D.z,S[ga+6]=I.x,S[ga+7]=
|
|
|
-I.y,S[ga+8]=I.z,S[ga+9]=V.x,S[ga+10]=V.y,S[ga+11]=V.z,ga+=12;if(ha)for(P in ha)if(A=ha[P],A.__original.needsUpdate)C=A.offset,F=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[C+0]=A.value[o.a],A.array[C+1]=A.value[o.b],A.array[C+2]=A.value[o.c],A.array[C+3]=A.value[o.d]):A.boundTo==="faces"?(A.array[C+0]=A.value[F],A.array[C+1]=A.value[F],A.array[C+2]=A.value[F],A.array[C+3]=A.value[F],A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[C+0]=A.value[F+0],A.array[C+1]=
|
|
|
-A.value[F+1],A.array[C+2]=A.value[F+2],A.array[C+3]=A.value[F+3],A.offsetSrc+=4),A.offset+=4):(A.boundTo===void 0||A.boundTo==="vertices"?(J=A.value[o.a],D=A.value[o.b],I=A.value[o.c],V=A.value[o.d]):A.boundTo==="faces"?(J=A.value[F],D=A.value[F],I=A.value[F],V=A.value[F],A.offsetSrc++):A.boundTo==="faceVertices"&&(J=A.value[F+0],D=A.value[F+1],I=A.value[F+2],V=A.value[F+3],A.offsetSrc+=4),A.size===2?(A.array[C+0]=J.x,A.array[C+1]=J.y,A.array[C+2]=D.x,A.array[C+3]=D.y,A.array[C+4]=I.x,A.array[C+5]=
|
|
|
-I.y,A.array[C+6]=V.x,A.array[C+7]=V.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[C+0]=J.r,A.array[C+1]=J.g,A.array[C+2]=J.b,A.array[C+3]=D.r,A.array[C+4]=D.g,A.array[C+5]=D.b,A.array[C+6]=I.r,A.array[C+7]=I.g,A.array[C+8]=I.b,A.array[C+9]=V.r,A.array[C+10]=V.g,A.array[C+11]=V.b):(A.array[C+0]=J.x,A.array[C+1]=J.y,A.array[C+2]=J.z,A.array[C+3]=D.x,A.array[C+4]=D.y,A.array[C+5]=D.z,A.array[C+6]=I.x,A.array[C+7]=I.y,A.array[C+8]=I.z,A.array[C+9]=V.x,A.array[C+10]=V.y,A.array[C+11]=V.z),A.offset+=
|
|
|
-12):(A.array[C+0]=J.x,A.array[C+1]=J.y,A.array[C+2]=J.z,A.array[C+3]=J.w,A.array[C+4]=D.x,A.array[C+5]=D.y,A.array[C+6]=D.z,A.array[C+7]=D.w,A.array[C+8]=I.x,A.array[C+9]=I.y,A.array[C+10]=I.z,A.array[C+11]=I.w,A.array[C+12]=V.x,A.array[C+13]=V.y,A.array[C+14]=V.z,A.array[C+15]=V.w,A.offset+=16));if(Aa){C=0;for(F=Fa.length;C<F;C++)J=Fa[C].vertices[o.a].position,D=Fa[C].vertices[o.b].position,I=Fa[C].vertices[o.c].position,V=Fa[C].vertices[o.d].position,A=na[C],A[R+0]=J.x,A[R+1]=J.y,A[R+2]=J.z,A[R+
|
|
|
-3]=D.x,A[R+4]=D.y,A[R+5]=D.z,A[R+6]=I.x,A[R+7]=I.y,A[R+8]=I.z,A[R+9]=V.x,A[R+10]=V.y,A[R+11]=V.z;R+=12}if(Ha.length)C=Ha[o.a],F=Ha[o.b],A=Ha[o.c],M=Ha[o.d],fa[N]=C.x,fa[N+1]=C.y,fa[N+2]=C.z,fa[N+3]=C.w,fa[N+4]=F.x,fa[N+5]=F.y,fa[N+6]=F.z,fa[N+7]=F.w,fa[N+8]=A.x,fa[N+9]=A.y,fa[N+10]=A.z,fa[N+11]=A.w,fa[N+12]=M.x,fa[N+13]=M.y,fa[N+14]=M.z,fa[N+15]=M.w,C=Oa[o.a],F=Oa[o.b],A=Oa[o.c],M=Oa[o.d],ca[N]=C.x,ca[N+1]=C.y,ca[N+2]=C.z,ca[N+3]=C.w,ca[N+4]=F.x,ca[N+5]=F.y,ca[N+6]=F.z,ca[N+7]=F.w,ca[N+8]=A.x,ca[N+
|
|
|
-9]=A.y,ca[N+10]=A.z,ca[N+11]=A.w,ca[N+12]=M.x,ca[N+13]=M.y,ca[N+14]=M.z,ca[N+15]=M.w,C=ya[o.a],F=ya[o.b],A=ya[o.c],M=ya[o.d],Y[N]=C.x,Y[N+1]=C.y,Y[N+2]=C.z,Y[N+3]=1,Y[N+4]=F.x,Y[N+5]=F.y,Y[N+6]=F.z,Y[N+7]=1,Y[N+8]=A.x,Y[N+9]=A.y,Y[N+10]=A.z,Y[N+11]=1,Y[N+12]=M.x,Y[N+13]=M.y,Y[N+14]=M.z,Y[N+15]=1,C=za[o.a],F=za[o.b],A=za[o.c],o=za[o.d],ea[N]=C.x,ea[N+1]=C.y,ea[N+2]=C.z,ea[N+3]=1,ea[N+4]=F.x,ea[N+5]=F.y,ea[N+6]=F.z,ea[N+7]=1,ea[N+8]=A.x,ea[N+9]=A.y,ea[N+10]=A.z,ea[N+11]=1,ea[N+12]=o.x,ea[N+13]=o.y,
|
|
|
-ea[N+14]=o.z,ea[N+15]=1,N+=16;if(wa&&z)v.length==4&&z==THREE.VertexColors?(o=v[0],C=v[1],F=v[2],v=v[3]):v=F=C=o=w,Z[ka]=o.r,Z[ka+1]=o.g,Z[ka+2]=o.b,Z[ka+3]=C.r,Z[ka+4]=C.g,Z[ka+5]=C.b,Z[ka+6]=F.r,Z[ka+7]=F.g,Z[ka+8]=F.b,Z[ka+9]=v.r,Z[ka+10]=v.g,Z[ka+11]=v.b,ka+=12;if(ua&&ja.hasTangents)v=y[0],w=y[1],o=y[2],y=y[3],W[O]=v.x,W[O+1]=v.y,W[O+2]=v.z,W[O+3]=v.w,W[O+4]=w.x,W[O+5]=w.y,W[O+6]=w.z,W[O+7]=w.w,W[O+8]=o.x,W[O+9]=o.y,W[O+10]=o.z,W[O+11]=o.w,W[O+12]=y.x,W[O+13]=y.y,W[O+14]=y.z,W[O+15]=y.w,O+=16;
|
|
|
-if(ta&&G)if(t.length==4&&oa)for(y=0;y<4;y++)u=t[y],la[T]=u.x,la[T+1]=u.y,la[T+2]=u.z,T+=3;else for(y=0;y<4;y++)la[T]=u.x,la[T+1]=u.y,la[T+2]=u.z,T+=3;if(xa&&E!==void 0&&x)for(y=0;y<4;y++)t=E[y],$[aa]=t.u,$[aa+1]=t.v,aa+=2;if(xa&&H!==void 0&&x)for(y=0;y<4;y++)t=H[y],da[X]=t.u,da[X+1]=t.v,X+=2;ra&&(ia[Q]=K,ia[Q+1]=K+1,ia[Q+2]=K+3,ia[Q+3]=K+1,ia[Q+4]=K+2,ia[Q+5]=K+3,Q+=6,sa[U]=K,sa[U+1]=K+1,sa[U+2]=K,sa[U+3]=K+3,sa[U+4]=K+1,sa[U+5]=K+2,sa[U+6]=K+2,sa[U+7]=K+3,U+=8,K+=4)}if(Ma){p=0;for(n=Ma.length;p<
|
|
|
-n;p++)ia[Q]=Ma[p].a,ia[Q+1]=Ma[p].b,ia[Q+2]=Ma[p].c,ia[Q+3]=Ma[p].a,ia[Q+4]=Ma[p].c,ia[Q+5]=Ma[p].d,Q+=6}qa&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,S,m));if(ha)for(P in ha)A=ha[P],A.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,m));if(Aa){C=0;for(F=Fa.length;C<F;C++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[C]),k.bufferData(k.ARRAY_BUFFER,na[C],m)}wa&&ka>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),
|
|
|
-k.bufferData(k.ARRAY_BUFFER,Z,m));ta&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,la,m));ua&&ja.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,W,m));xa&&aa>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,$,m));xa&&X>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,da,m));ra&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,
|
|
|
-ia,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,sa,m));N>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,Y,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,ea,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m));j.dynamic||(delete g.__inittedArrays,
|
|
|
-delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;L(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||
|
|
|
-f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;x=b.vertices;g=b.colors;z=x.length;j=g.length;G=b.__vertexArray;m=b.__colorArray;E=b.__dirtyColors;if(b.__dirtyVertices){for(p=0;p<z;p++)n=x[p].position,h=p*3,G[h]=n.x,G[h+1]=n.y,G[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,G,e)}if(E){for(p=0;p<j;p++)color=g[p],h=p*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=
|
|
|
-!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;x=b.vertices;g=b.colors;z=x.length;j=g.length;G=b.__vertexArray;m=b.__colorArray;E=b.__dirtyColors;if(b.__dirtyVertices){for(p=0;p<z;p++)n=x[p].position,h=p*3,G[h]=n.x,G[h+1]=n.y,G[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,G,e)}if(E){for(p=0;p<j;p++)color=g[p],h=p*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);
|
|
|
-k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,g=B(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||g)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,L(f)}function D(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function X(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,p,o={},n=b.morphTargets!==
|
|
|
-void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,m=e(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),p=o[m].hash+"_"+o[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:k,vertices:0,numMorphTargets:n}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+j>65535&&(o[m].counter+=1,p=o[m].hash+"_"+o[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:k,vertices:0,numMorphTargets:n})),
|
|
|
-b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=j}function H(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(b){if(b!=ea){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,
|
|
|
-k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}ea=b}}function M(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,S(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,S(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,S(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,S(e.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,
|
|
|
-k.TEXTURE_MAG_FILTER,R(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,R(e.minFilter)))}function P(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=k.createTexture(),b.__webglInit=!0;k.bindTexture(k.TEXTURE_2D,b.__webglTexture);b.image.data?k.texImage2D(k.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),k.UNSIGNED_BYTE,b.image.data):k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image);M(k.TEXTURE_2D,b,b.image);k.bindTexture(k.TEXTURE_2D,null);b.needsUpdate=
|
|
|
-!1}k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function Q(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,S(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,S(b.wrapT));k.texParameteri(k.TEXTURE_2D,
|
|
|
-k.TEXTURE_MAG_FILTER,S(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,S(b.minFilter));k.texImage2D(k.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,
|
|
|
-k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,
|
|
|
-c=J,b=V);e!=Z&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ca,oa,c,b),Z=e)}function O(b,e){var c;b=="fragment"?c=k.createShader(k.FRAGMENT_SHADER):b=="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,e);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(e),null;return c}function R(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}
|
|
|
-function S(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;
|
|
|
-case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}
|
|
|
-var $=this,k,K=[],da=null,Z=null,aa=!0,ha=null,la=null,ea=null,fa=null,F=null,ia=null,na=null,ca=0,oa=0,J=0,V=0,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Matrix4,sa=new Float32Array(16),xa=new Float32Array(16),Aa=new THREE.Vector4,Ia={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ba=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
-Pa=b.stencil!==void 0?b.stencil:!0,W=b.antialias!==void 0?b.antialias:!1,ja=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),qa=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ba;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 ta,ua=[],b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa}),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa,morphTargets:!0});Da._shadowPass=!0;ya._shadowPass=!0;try{if(!(k=Ba.getContext("experimental-webgl",{antialias:W,stencil:Pa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+
|
|
|
-" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(ra){console.error(ra)}k.clearColor(0,0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(ja.r,ja.g,ja.b,qa);this.context=k;var Ea=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
-0;if(Pa){var Y={};Y.vertices=new Float32Array(12);Y.faces=new Uint16Array(6);Y.darkness=0.5;Y.vertices[0]=-20;Y.vertices[1]=-20;Y.vertices[2]=-1;Y.vertices[3]=20;Y.vertices[4]=-20;Y.vertices[5]=-1;Y.vertices[6]=20;Y.vertices[7]=20;Y.vertices[8]=-1;Y.vertices[9]=-20;Y.vertices[10]=20;Y.vertices[11]=-1;Y.faces[0]=0;Y.faces[1]=1;Y.faces[2]=2;Y.faces[3]=0;Y.faces[4]=2;Y.faces[5]=3;Y.vertexBuffer=k.createBuffer();Y.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,Y.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
|
|
|
-Y.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Y.faces,k.STATIC_DRAW);Y.program=k.createProgram();k.attachShader(Y.program,O("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(Y.program,O("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(Y.program);Y.vertexLocation=k.getAttribLocation(Y.program,"position");Y.projectionLocation=k.getUniformLocation(Y.program,"projectionMatrix");Y.darknessLocation=
|
|
|
-k.getUniformLocation(Y.program,"darkness")}var T={};T.vertices=new Float32Array(16);T.faces=new Uint16Array(6);W=0;T.vertices[W++]=-1;T.vertices[W++]=-1;T.vertices[W++]=0;T.vertices[W++]=0;T.vertices[W++]=1;T.vertices[W++]=-1;T.vertices[W++]=1;T.vertices[W++]=0;T.vertices[W++]=1;T.vertices[W++]=1;T.vertices[W++]=1;T.vertices[W++]=1;T.vertices[W++]=-1;T.vertices[W++]=1;T.vertices[W++]=0;T.vertices[W++]=1;W=0;T.faces[W++]=0;T.faces[W++]=1;T.faces[W++]=2;T.faces[W++]=0;T.faces[W++]=2;T.faces[W++]=3;
|
|
|
-T.vertexBuffer=k.createBuffer();T.elementBuffer=k.createBuffer();T.tempTexture=k.createTexture();T.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,T.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,T.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,T.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,T.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,T.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,
|
|
|
-k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.bindTexture(k.TEXTURE_2D,T.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);
|
|
|
-k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(T.hasVertexTexture=!1,T.program=k.createProgram(),k.attachShader(T.program,O("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(T.program,O("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(T.hasVertexTexture=!0,T.program=k.createProgram(),k.attachShader(T.program,O("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(T.program,O("vertex",
|
|
|
-THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(T.program);T.attributes={};T.uniforms={};T.attributes.vertex=k.getAttribLocation(T.program,"position");T.attributes.uv=k.getAttribLocation(T.program,"UV");T.uniforms.renderType=k.getUniformLocation(T.program,"renderType");T.uniforms.map=k.getUniformLocation(T.program,"map");T.uniforms.occlusionMap=k.getUniformLocation(T.program,"occlusionMap");T.uniforms.opacity=k.getUniformLocation(T.program,"opacity");T.uniforms.scale=k.getUniformLocation(T.program,
|
|
|
-"scale");T.uniforms.rotation=k.getUniformLocation(T.program,"rotation");T.uniforms.screenPosition=k.getUniformLocation(T.program,"screenPosition");var va=!1,U={};U.vertices=new Float32Array(16);U.faces=new Uint16Array(6);W=0;U.vertices[W++]=-1;U.vertices[W++]=-1;U.vertices[W++]=0;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=-1;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=0;U.vertices[W++]=-1;U.vertices[W++]=1;U.vertices[W++]=0;W=
|
|
|
-U.vertices[W++]=0;U.faces[W++]=0;U.faces[W++]=1;U.faces[W++]=2;U.faces[W++]=0;U.faces[W++]=2;U.faces[W++]=3;U.vertexBuffer=k.createBuffer();U.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,U.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,U.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,U.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,U.faces,k.STATIC_DRAW);U.program=k.createProgram();k.attachShader(U.program,O("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(U.program,
|
|
|
-O("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(U.program);U.attributes={};U.uniforms={};U.attributes.position=k.getAttribLocation(U.program,"position");U.attributes.uv=k.getAttribLocation(U.program,"uv");U.uniforms.uvOffset=k.getUniformLocation(U.program,"uvOffset");U.uniforms.uvScale=k.getUniformLocation(U.program,"uvScale");U.uniforms.rotation=k.getUniformLocation(U.program,"rotation");U.uniforms.scale=k.getUniformLocation(U.program,"scale");U.uniforms.alignment=k.getUniformLocation(U.program,
|
|
|
-"alignment");U.uniforms.map=k.getUniformLocation(U.program,"map");U.uniforms.opacity=k.getUniformLocation(U.program,"opacity");U.uniforms.useScreenCoordinates=k.getUniformLocation(U.program,"useScreenCoordinates");U.uniforms.affectedByDistance=k.getUniformLocation(U.program,"affectedByDistance");U.uniforms.screenPosition=k.getUniformLocation(U.program,"screenPosition");U.uniforms.modelViewMatrix=k.getUniformLocation(U.program,"modelViewMatrix");U.uniforms.projectionMatrix=k.getUniformLocation(U.program,
|
|
|
-"projectionMatrix");var za=!1;this.setSize=function(b,e){Ba.width=b;Ba.height=e;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(b,e,c,f){ca=b;oa=e;J=c;V=f;k.viewport(ca,oa,J,V)};this.setScissor=function(b,e,c,f){k.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){aa=b;k.depthMask(b)};this.setClearColorHex=function(b,e){ja.setHex(b);qa=e;k.clearColor(ja.r,ja.g,ja.b,qa)};this.setClearColor=
|
|
|
-function(b,e){ja.copy(b);qa=e;k.clearColor(ja.r,ja.g,ja.b,qa)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){Y.darkness=b};this.getContext=function(){return k};this.initMaterial=function(b,e,c,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":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 m=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var p,o,n;p=n=m=0;for(o=e.length;p<o;p++)g=e[p],g instanceof THREE.SpotLight&&n++,g instanceof THREE.DirectionalLight&&n++,g instanceof THREE.PointLight&&
|
|
|
-m++;m+n<=4?p=n:(p=Math.ceil(4*n/(m+n)),m=4-p);g={directional:p,point:m};m=n=0;for(p=e.length;m<p;m++)o=e[m],o instanceof THREE.SpotLight&&o.castShadow&&n++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var u;a:{p=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
|
-maxDirLights:g.directional,maxPointLights:g.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:n,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(p),f.push(o));for(v in c)f.push(v),f.push(c[v]);j=f.join();v=0;for(f=K.length;v<f;v++)if(K[v].code==j){u=K[v].program;break a}v=k.createProgram();f=[Ea?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,
|
|
|
-"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.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");
|
|
|
+b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function B(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function L(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function F(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;
|
|
|
+for(e in f.geometryGroups)if(h=f.geometryGroups[e],g=B(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var j=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var p=void 0,n=void 0,t=void 0,o=void 0,u=t=void 0,v=void 0,w=void 0,y=void 0,x=void 0,z=void 0,G=void 0,F=void 0,H=void 0,J=void 0,D=void 0,I=void 0,V=void 0,C=o=y=o=w=v=void 0,A=void 0,E=A=C=v=void 0,M=void 0,P=E=A=C=t=t=u=y=o=E=A=C=M=E=A=C=M=E=A=C=void 0,K=
|
|
|
+0,ga=0,aa=0,X=0,Q=0,T=0,O=0,U=0,ka=0,N=0,R=0,E=C=0,E=void 0,S=g.__vertexArray,$=g.__uvArray,da=g.__uv2Array,la=g.__normalArray,W=g.__tangentArray,Z=g.__colorArray,Y=g.__skinVertexAArray,ea=g.__skinVertexBArray,ca=g.__skinIndexArray,fa=g.__skinWeightArray,na=g.__morphTargetsArrays,ha=g.__webglCustomAttributes,A=void 0,ia=g.__faceArray,sa=g.__lineArray,oa=g.__needsSmoothNormals,z=g.__vertexColorType,x=g.__uvType,G=g.__normalType,ja=j.geometry,qa=ja.__dirtyVertices,ra=ja.__dirtyElements,xa=ja.__dirtyUvs,
|
|
|
+ta=ja.__dirtyNormals,ua=ja.__dirtyTangents,wa=ja.__dirtyColors,Aa=ja.__dirtyMorphTargets,va=ja.vertices,Ba=g.faces,Da=ja.faces,Ia=ja.faceVertexUvs[0],Ea=ja.faceVertexUvs[1],ya=ja.skinVerticesA,za=ja.skinVerticesB,Oa=ja.skinIndices,Ha=ja.skinWeights,Ma=j instanceof THREE.ShadowVolume?ja.edgeFaces:void 0,Fa=ja.morphTargets;if(ha)for(P in ha)ha[P].offset=0,ha[P].offsetSrc=0;p=0;for(n=Ba.length;p<n;p++)if(t=Ba[p],o=Da[t],Ia&&(F=Ia[t]),Ea&&(H=Ea[t]),t=o.vertexNormals,u=o.normal,v=o.vertexColors,w=o.color,
|
|
|
+y=o.vertexTangents,o instanceof THREE.Face3){if(qa)J=va[o.a].position,D=va[o.b].position,I=va[o.c].position,S[ga]=J.x,S[ga+1]=J.y,S[ga+2]=J.z,S[ga+3]=D.x,S[ga+4]=D.y,S[ga+5]=D.z,S[ga+6]=I.x,S[ga+7]=I.y,S[ga+8]=I.z,ga+=9;if(ha)for(P in ha)if(A=ha[P],A.__original.needsUpdate)C=A.offset,E=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[C]=A.value[o.a],A.array[C+1]=A.value[o.b],A.array[C+2]=A.value[o.c]):A.boundTo==="faces"?(E=A.value[E],A.array[C]=E,A.array[C+1]=E,A.array[C+
|
|
|
+2]=E,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[C]=A.value[E],A.array[C+1]=A.value[E+1],A.array[C+2]=A.value[E+2],A.offsetSrc+=3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(J=A.value[o.a],D=A.value[o.b],I=A.value[o.c]):A.boundTo==="faces"?(I=D=J=E=A.value[E],A.offsetSrc++):A.boundTo==="faceVertices"&&(J=A.value[E],D=A.value[E+1],I=A.value[E+2],A.offsetSrc+=3),A.size===2?(A.array[C]=J.x,A.array[C+1]=J.y,A.array[C+2]=D.x,A.array[C+3]=D.y,A.array[C+4]=I.x,A.array[C+5]=I.y,A.offset+=
|
|
|
+6):A.size===3?(A.type==="c"?(A.array[C]=J.r,A.array[C+1]=J.g,A.array[C+2]=J.b,A.array[C+3]=D.r,A.array[C+4]=D.g,A.array[C+5]=D.b,A.array[C+6]=I.r,A.array[C+7]=I.g,A.array[C+8]=I.b):(A.array[C]=J.x,A.array[C+1]=J.y,A.array[C+2]=J.z,A.array[C+3]=D.x,A.array[C+4]=D.y,A.array[C+5]=D.z,A.array[C+6]=I.x,A.array[C+7]=I.y,A.array[C+8]=I.z),A.offset+=9):(A.array[C]=J.x,A.array[C+1]=J.y,A.array[C+2]=J.z,A.array[C+3]=J.w,A.array[C+4]=D.x,A.array[C+5]=D.y,A.array[C+6]=D.z,A.array[C+7]=D.w,A.array[C+8]=I.x,A.array[C+
|
|
|
+9]=I.y,A.array[C+10]=I.z,A.array[C+11]=I.w,A.offset+=12));if(Aa){C=0;for(A=Fa.length;C<A;C++)J=Fa[C].vertices[o.a].position,D=Fa[C].vertices[o.b].position,I=Fa[C].vertices[o.c].position,E=na[C],E[R]=J.x,E[R+1]=J.y,E[R+2]=J.z,E[R+3]=D.x,E[R+4]=D.y,E[R+5]=D.z,E[R+6]=I.x,E[R+7]=I.y,E[R+8]=I.z;R+=9}if(Ha.length)C=Ha[o.a],A=Ha[o.b],E=Ha[o.c],fa[N]=C.x,fa[N+1]=C.y,fa[N+2]=C.z,fa[N+3]=C.w,fa[N+4]=A.x,fa[N+5]=A.y,fa[N+6]=A.z,fa[N+7]=A.w,fa[N+8]=E.x,fa[N+9]=E.y,fa[N+10]=E.z,fa[N+11]=E.w,C=Oa[o.a],A=Oa[o.b],
|
|
|
+E=Oa[o.c],ca[N]=C.x,ca[N+1]=C.y,ca[N+2]=C.z,ca[N+3]=C.w,ca[N+4]=A.x,ca[N+5]=A.y,ca[N+6]=A.z,ca[N+7]=A.w,ca[N+8]=E.x,ca[N+9]=E.y,ca[N+10]=E.z,ca[N+11]=E.w,C=ya[o.a],A=ya[o.b],E=ya[o.c],Y[N]=C.x,Y[N+1]=C.y,Y[N+2]=C.z,Y[N+3]=1,Y[N+4]=A.x,Y[N+5]=A.y,Y[N+6]=A.z,Y[N+7]=1,Y[N+8]=E.x,Y[N+9]=E.y,Y[N+10]=E.z,Y[N+11]=1,C=za[o.a],A=za[o.b],E=za[o.c],ea[N]=C.x,ea[N+1]=C.y,ea[N+2]=C.z,ea[N+3]=1,ea[N+4]=A.x,ea[N+5]=A.y,ea[N+6]=A.z,ea[N+7]=1,ea[N+8]=E.x,ea[N+9]=E.y,ea[N+10]=E.z,ea[N+11]=1,N+=12;if(wa&&z)v.length==
|
|
|
+3&&z==THREE.VertexColors?(o=v[0],C=v[1],A=v[2]):A=C=o=w,Z[ka]=o.r,Z[ka+1]=o.g,Z[ka+2]=o.b,Z[ka+3]=C.r,Z[ka+4]=C.g,Z[ka+5]=C.b,Z[ka+6]=A.r,Z[ka+7]=A.g,Z[ka+8]=A.b,ka+=9;if(ua&&ja.hasTangents)v=y[0],w=y[1],o=y[2],W[O]=v.x,W[O+1]=v.y,W[O+2]=v.z,W[O+3]=v.w,W[O+4]=w.x,W[O+5]=w.y,W[O+6]=w.z,W[O+7]=w.w,W[O+8]=o.x,W[O+9]=o.y,W[O+10]=o.z,W[O+11]=o.w,O+=12;if(ta&&G)if(t.length==3&&oa)for(y=0;y<3;y++)u=t[y],la[T]=u.x,la[T+1]=u.y,la[T+2]=u.z,T+=3;else for(y=0;y<3;y++)la[T]=u.x,la[T+1]=u.y,la[T+2]=u.z,T+=3;if(xa&&
|
|
|
+F!==void 0&&x)for(y=0;y<3;y++)t=F[y],$[aa]=t.u,$[aa+1]=t.v,aa+=2;if(xa&&H!==void 0&&x)for(y=0;y<3;y++)t=H[y],da[X]=t.u,da[X+1]=t.v,X+=2;ra&&(ia[Q]=K,ia[Q+1]=K+1,ia[Q+2]=K+2,Q+=3,sa[U]=K,sa[U+1]=K+1,sa[U+2]=K,sa[U+3]=K+2,sa[U+4]=K+1,sa[U+5]=K+2,U+=6,K+=3)}else if(o instanceof THREE.Face4){if(qa)J=va[o.a].position,D=va[o.b].position,I=va[o.c].position,V=va[o.d].position,S[ga]=J.x,S[ga+1]=J.y,S[ga+2]=J.z,S[ga+3]=D.x,S[ga+4]=D.y,S[ga+5]=D.z,S[ga+6]=I.x,S[ga+7]=I.y,S[ga+8]=I.z,S[ga+9]=V.x,S[ga+10]=V.y,
|
|
|
+S[ga+11]=V.z,ga+=12;if(ha)for(P in ha)if(A=ha[P],A.__original.needsUpdate)C=A.offset,E=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[C]=A.value[o.a],A.array[C+1]=A.value[o.b],A.array[C+2]=A.value[o.c],A.array[C+3]=A.value[o.d]):A.boundTo==="faces"?(E=A.value[E],A.array[C]=E,A.array[C+1]=E,A.array[C+2]=E,A.array[C+3]=E,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[C]=A.value[E],A.array[C+1]=A.value[E+1],A.array[C+2]=A.value[E+2],A.array[C+3]=A.value[E+3],A.offsetSrc+=
|
|
|
+4),A.offset+=4):(A.boundTo===void 0||A.boundTo==="vertices"?(J=A.value[o.a],D=A.value[o.b],I=A.value[o.c],V=A.value[o.d]):A.boundTo==="faces"?(V=I=D=J=E=A.value[E],A.offsetSrc++):A.boundTo==="faceVertices"&&(J=A.value[E],D=A.value[E+1],I=A.value[E+2],V=A.value[E+3],A.offsetSrc+=4),A.size===2?(A.array[C]=J.x,A.array[C+1]=J.y,A.array[C+2]=D.x,A.array[C+3]=D.y,A.array[C+4]=I.x,A.array[C+5]=I.y,A.array[C+6]=V.x,A.array[C+7]=V.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[C]=J.r,A.array[C+1]=J.g,A.array[C+
|
|
|
+2]=J.b,A.array[C+3]=D.r,A.array[C+4]=D.g,A.array[C+5]=D.b,A.array[C+6]=I.r,A.array[C+7]=I.g,A.array[C+8]=I.b,A.array[C+9]=V.r,A.array[C+10]=V.g,A.array[C+11]=V.b):(A.array[C]=J.x,A.array[C+1]=J.y,A.array[C+2]=J.z,A.array[C+3]=D.x,A.array[C+4]=D.y,A.array[C+5]=D.z,A.array[C+6]=I.x,A.array[C+7]=I.y,A.array[C+8]=I.z,A.array[C+9]=V.x,A.array[C+10]=V.y,A.array[C+11]=V.z),A.offset+=12):(A.array[C]=J.x,A.array[C+1]=J.y,A.array[C+2]=J.z,A.array[C+3]=J.w,A.array[C+4]=D.x,A.array[C+5]=D.y,A.array[C+6]=D.z,
|
|
|
+A.array[C+7]=D.w,A.array[C+8]=I.x,A.array[C+9]=I.y,A.array[C+10]=I.z,A.array[C+11]=I.w,A.array[C+12]=V.x,A.array[C+13]=V.y,A.array[C+14]=V.z,A.array[C+15]=V.w,A.offset+=16));if(Aa){C=0;for(A=Fa.length;C<A;C++)J=Fa[C].vertices[o.a].position,D=Fa[C].vertices[o.b].position,I=Fa[C].vertices[o.c].position,V=Fa[C].vertices[o.d].position,E=na[C],E[R]=J.x,E[R+1]=J.y,E[R+2]=J.z,E[R+3]=D.x,E[R+4]=D.y,E[R+5]=D.z,E[R+6]=I.x,E[R+7]=I.y,E[R+8]=I.z,E[R+9]=V.x,E[R+10]=V.y,E[R+11]=V.z;R+=12}if(Ha.length)C=Ha[o.a],
|
|
|
+A=Ha[o.b],E=Ha[o.c],M=Ha[o.d],fa[N]=C.x,fa[N+1]=C.y,fa[N+2]=C.z,fa[N+3]=C.w,fa[N+4]=A.x,fa[N+5]=A.y,fa[N+6]=A.z,fa[N+7]=A.w,fa[N+8]=E.x,fa[N+9]=E.y,fa[N+10]=E.z,fa[N+11]=E.w,fa[N+12]=M.x,fa[N+13]=M.y,fa[N+14]=M.z,fa[N+15]=M.w,C=Oa[o.a],A=Oa[o.b],E=Oa[o.c],M=Oa[o.d],ca[N]=C.x,ca[N+1]=C.y,ca[N+2]=C.z,ca[N+3]=C.w,ca[N+4]=A.x,ca[N+5]=A.y,ca[N+6]=A.z,ca[N+7]=A.w,ca[N+8]=E.x,ca[N+9]=E.y,ca[N+10]=E.z,ca[N+11]=E.w,ca[N+12]=M.x,ca[N+13]=M.y,ca[N+14]=M.z,ca[N+15]=M.w,C=ya[o.a],A=ya[o.b],E=ya[o.c],M=ya[o.d],
|
|
|
+Y[N]=C.x,Y[N+1]=C.y,Y[N+2]=C.z,Y[N+3]=1,Y[N+4]=A.x,Y[N+5]=A.y,Y[N+6]=A.z,Y[N+7]=1,Y[N+8]=E.x,Y[N+9]=E.y,Y[N+10]=E.z,Y[N+11]=1,Y[N+12]=M.x,Y[N+13]=M.y,Y[N+14]=M.z,Y[N+15]=1,C=za[o.a],A=za[o.b],E=za[o.c],o=za[o.d],ea[N]=C.x,ea[N+1]=C.y,ea[N+2]=C.z,ea[N+3]=1,ea[N+4]=A.x,ea[N+5]=A.y,ea[N+6]=A.z,ea[N+7]=1,ea[N+8]=E.x,ea[N+9]=E.y,ea[N+10]=E.z,ea[N+11]=1,ea[N+12]=o.x,ea[N+13]=o.y,ea[N+14]=o.z,ea[N+15]=1,N+=16;if(wa&&z)v.length==4&&z==THREE.VertexColors?(o=v[0],C=v[1],A=v[2],v=v[3]):v=A=C=o=w,Z[ka]=o.r,Z[ka+
|
|
|
+1]=o.g,Z[ka+2]=o.b,Z[ka+3]=C.r,Z[ka+4]=C.g,Z[ka+5]=C.b,Z[ka+6]=A.r,Z[ka+7]=A.g,Z[ka+8]=A.b,Z[ka+9]=v.r,Z[ka+10]=v.g,Z[ka+11]=v.b,ka+=12;if(ua&&ja.hasTangents)v=y[0],w=y[1],o=y[2],y=y[3],W[O]=v.x,W[O+1]=v.y,W[O+2]=v.z,W[O+3]=v.w,W[O+4]=w.x,W[O+5]=w.y,W[O+6]=w.z,W[O+7]=w.w,W[O+8]=o.x,W[O+9]=o.y,W[O+10]=o.z,W[O+11]=o.w,W[O+12]=y.x,W[O+13]=y.y,W[O+14]=y.z,W[O+15]=y.w,O+=16;if(ta&&G)if(t.length==4&&oa)for(y=0;y<4;y++)u=t[y],la[T]=u.x,la[T+1]=u.y,la[T+2]=u.z,T+=3;else for(y=0;y<4;y++)la[T]=u.x,la[T+1]=
|
|
|
+u.y,la[T+2]=u.z,T+=3;if(xa&&F!==void 0&&x)for(y=0;y<4;y++)t=F[y],$[aa]=t.u,$[aa+1]=t.v,aa+=2;if(xa&&H!==void 0&&x)for(y=0;y<4;y++)t=H[y],da[X]=t.u,da[X+1]=t.v,X+=2;ra&&(ia[Q]=K,ia[Q+1]=K+1,ia[Q+2]=K+3,ia[Q+3]=K+1,ia[Q+4]=K+2,ia[Q+5]=K+3,Q+=6,sa[U]=K,sa[U+1]=K+1,sa[U+2]=K,sa[U+3]=K+3,sa[U+4]=K+1,sa[U+5]=K+2,sa[U+6]=K+2,sa[U+7]=K+3,U+=8,K+=4)}if(Ma){p=0;for(n=Ma.length;p<n;p++)ia[Q]=Ma[p].a,ia[Q+1]=Ma[p].b,ia[Q+2]=Ma[p].c,ia[Q+3]=Ma[p].a,ia[Q+4]=Ma[p].c,ia[Q+5]=Ma[p].d,Q+=6}qa&&(k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
+g.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,S,m));if(ha)for(P in ha)A=ha[P],A.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,m));if(Aa){C=0;for(A=Fa.length;C<A;C++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[C]),k.bufferData(k.ARRAY_BUFFER,na[C],m)}wa&&ka>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,Z,m));ta&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,la,
|
|
|
+m));ua&&ja.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,W,m));xa&&aa>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,$,m));xa&&X>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,da,m));ra&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ia,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,sa,m));N>
|
|
|
+0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,Y,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,ea,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m));j.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,
|
|
|
+delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;L(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;x=b.vertices;g=b.colors;z=x.length;j=g.length;G=b.__vertexArray;m=b.__colorArray;
|
|
|
+F=b.__dirtyColors;if(b.__dirtyVertices){for(p=0;p<z;p++)n=x[p].position,h=p*3,G[h]=n.x,G[h+1]=n.y,G[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,G,e)}if(F){for(p=0;p<j;p++)color=g[p],h=p*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;
|
|
|
+x=b.vertices;g=b.colors;z=x.length;j=g.length;G=b.__vertexArray;m=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(p=0;p<z;p++)n=x[p].position,h=p*3,G[h]=n.x,G[h+1]=n.y,G[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,G,e)}if(F){for(p=0;p<j;p++)color=g[p],h=p*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=
|
|
|
+b.geometry,g=B(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||g)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,L(f)}function D(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function X(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,p,o={},n=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,
|
|
|
+m=e(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),p=o[m].hash+"_"+o[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:k,vertices:0,numMorphTargets:n}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+j>65535&&(o[m].counter+=1,p=o[m].hash+"_"+o[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:k,vertices:0,numMorphTargets:n})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=j}function H(b,e,c){b.push({buffer:e,object:c,
|
|
|
+opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(b){if(b!=ea){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}ea=
|
|
|
+b}}function M(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,S(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,S(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,S(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,S(e.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_MAG_FILTER,R(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,R(e.minFilter)))}
|
|
|
+function P(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=k.createTexture(),b.__webglInit=!0;k.bindTexture(k.TEXTURE_2D,b.__webglTexture);b.image.data?k.texImage2D(k.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),k.UNSIGNED_BYTE,b.image.data):k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image);M(k.TEXTURE_2D,b,b.image);k.bindTexture(k.TEXTURE_2D,null);b.needsUpdate=!1}k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function Q(b){if(b&&
|
|
|
+!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,S(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,S(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,S(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,
|
|
|
+S(b.minFilter));k.texImage2D(k.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):
|
|
|
+b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=J,b=V);e!=Z&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ca,
|
|
|
+oa,c,b),Z=e)}function O(b,e){var c;b=="fragment"?c=k.createShader(k.FRAGMENT_SHADER):b=="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,e);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(e),null;return c}function R(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;
|
|
|
+case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return k.BYTE;
|
|
|
+case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}var $=this,k,K=[],da=null,
|
|
|
+Z=null,aa=!0,ha=null,la=null,ea=null,fa=null,E=null,ia=null,na=null,ca=0,oa=0,J=0,V=0,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Matrix4,sa=new Float32Array(16),xa=new Float32Array(16),Aa=new THREE.Vector4,Ia={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ba=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Pa=b.stencil!==void 0?
|
|
|
+b.stencil:!0,W=b.antialias!==void 0?b.antialias:!1,ja=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),qa=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ba;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 ta,ua=[],b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa}),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa,morphTargets:!0});Da._shadowPass=!0;ya._shadowPass=!0;try{if(!(k=Ba.getContext("experimental-webgl",{antialias:W,stencil:Pa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+k.getParameter(k.VERSION)+
|
|
|
+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(ra){console.error(ra)}k.clearColor(0,0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(ja.r,ja.g,ja.b,qa);this.context=k;var Ea=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Pa){var Y={};Y.vertices=
|
|
|
+new Float32Array(12);Y.faces=new Uint16Array(6);Y.darkness=0.5;Y.vertices[0]=-20;Y.vertices[1]=-20;Y.vertices[2]=-1;Y.vertices[3]=20;Y.vertices[4]=-20;Y.vertices[5]=-1;Y.vertices[6]=20;Y.vertices[7]=20;Y.vertices[8]=-1;Y.vertices[9]=-20;Y.vertices[10]=20;Y.vertices[11]=-1;Y.faces[0]=0;Y.faces[1]=1;Y.faces[2]=2;Y.faces[3]=0;Y.faces[4]=2;Y.faces[5]=3;Y.vertexBuffer=k.createBuffer();Y.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,Y.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,Y.vertices,k.STATIC_DRAW);
|
|
|
+k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Y.faces,k.STATIC_DRAW);Y.program=k.createProgram();k.attachShader(Y.program,O("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(Y.program,O("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(Y.program);Y.vertexLocation=k.getAttribLocation(Y.program,"position");Y.projectionLocation=k.getUniformLocation(Y.program,"projectionMatrix");Y.darknessLocation=k.getUniformLocation(Y.program,
|
|
|
+"darkness")}var T={};T.vertices=new Float32Array(16);T.faces=new Uint16Array(6);W=0;T.vertices[W++]=-1;T.vertices[W++]=-1;T.vertices[W++]=0;T.vertices[W++]=0;T.vertices[W++]=1;T.vertices[W++]=-1;T.vertices[W++]=1;T.vertices[W++]=0;T.vertices[W++]=1;T.vertices[W++]=1;T.vertices[W++]=1;T.vertices[W++]=1;T.vertices[W++]=-1;T.vertices[W++]=1;T.vertices[W++]=0;T.vertices[W++]=1;W=0;T.faces[W++]=0;T.faces[W++]=1;T.faces[W++]=2;T.faces[W++]=0;T.faces[W++]=2;T.faces[W++]=3;T.vertexBuffer=k.createBuffer();
|
|
|
+T.elementBuffer=k.createBuffer();T.tempTexture=k.createTexture();T.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,T.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,T.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,T.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,T.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,T.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,
|
|
|
+k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.bindTexture(k.TEXTURE_2D,T.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,
|
|
|
+k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(T.hasVertexTexture=!1,T.program=k.createProgram(),k.attachShader(T.program,O("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(T.program,O("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(T.hasVertexTexture=!0,T.program=k.createProgram(),k.attachShader(T.program,O("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(T.program,O("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));
|
|
|
+k.linkProgram(T.program);T.attributes={};T.uniforms={};T.attributes.vertex=k.getAttribLocation(T.program,"position");T.attributes.uv=k.getAttribLocation(T.program,"UV");T.uniforms.renderType=k.getUniformLocation(T.program,"renderType");T.uniforms.map=k.getUniformLocation(T.program,"map");T.uniforms.occlusionMap=k.getUniformLocation(T.program,"occlusionMap");T.uniforms.opacity=k.getUniformLocation(T.program,"opacity");T.uniforms.scale=k.getUniformLocation(T.program,"scale");T.uniforms.rotation=k.getUniformLocation(T.program,
|
|
|
+"rotation");T.uniforms.screenPosition=k.getUniformLocation(T.program,"screenPosition");var va=!1,U={};U.vertices=new Float32Array(16);U.faces=new Uint16Array(6);W=0;U.vertices[W++]=-1;U.vertices[W++]=-1;U.vertices[W++]=0;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=-1;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=0;U.vertices[W++]=-1;U.vertices[W++]=1;U.vertices[W++]=0;W=U.vertices[W++]=0;U.faces[W++]=0;U.faces[W++]=1;U.faces[W++]=
|
|
|
+2;U.faces[W++]=0;U.faces[W++]=2;U.faces[W++]=3;U.vertexBuffer=k.createBuffer();U.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,U.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,U.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,U.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,U.faces,k.STATIC_DRAW);U.program=k.createProgram();k.attachShader(U.program,O("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(U.program,O("vertex",THREE.ShaderLib.sprite.vertexShader));
|
|
|
+k.linkProgram(U.program);U.attributes={};U.uniforms={};U.attributes.position=k.getAttribLocation(U.program,"position");U.attributes.uv=k.getAttribLocation(U.program,"uv");U.uniforms.uvOffset=k.getUniformLocation(U.program,"uvOffset");U.uniforms.uvScale=k.getUniformLocation(U.program,"uvScale");U.uniforms.rotation=k.getUniformLocation(U.program,"rotation");U.uniforms.scale=k.getUniformLocation(U.program,"scale");U.uniforms.alignment=k.getUniformLocation(U.program,"alignment");U.uniforms.map=k.getUniformLocation(U.program,
|
|
|
+"map");U.uniforms.opacity=k.getUniformLocation(U.program,"opacity");U.uniforms.useScreenCoordinates=k.getUniformLocation(U.program,"useScreenCoordinates");U.uniforms.affectedByDistance=k.getUniformLocation(U.program,"affectedByDistance");U.uniforms.screenPosition=k.getUniformLocation(U.program,"screenPosition");U.uniforms.modelViewMatrix=k.getUniformLocation(U.program,"modelViewMatrix");U.uniforms.projectionMatrix=k.getUniformLocation(U.program,"projectionMatrix");var za=!1;this.setSize=function(b,
|
|
|
+e){Ba.width=b;Ba.height=e;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(b,e,c,f){ca=b;oa=e;J=c;V=f;k.viewport(ca,oa,J,V)};this.setScissor=function(b,e,c,f){k.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){aa=b;k.depthMask(b)};this.setClearColorHex=function(b,e){ja.setHex(b);qa=e;k.clearColor(ja.r,ja.g,ja.b,qa)};this.setClearColor=function(b,e){ja.copy(b);qa=e;k.clearColor(ja.r,
|
|
|
+ja.g,ja.b,qa)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){Y.darkness=b};this.getContext=function(){return k};this.initMaterial=function(b,e,c,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":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 m=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var p,o,n;p=n=m=0;for(o=e.length;p<o;p++)g=e[p],g instanceof THREE.SpotLight&&n++,g instanceof THREE.DirectionalLight&&n++,g instanceof THREE.PointLight&&m++;m+n<=4?p=n:(p=Math.ceil(4*n/(m+n)),m=4-p);
|
|
|
+g={directional:p,point:m};m=n=0;for(p=e.length;m<p;m++)o=e[m],o instanceof THREE.SpotLight&&o.castShadow&&n++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var u;a:{p=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,
|
|
|
+maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:n,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(p),f.push(o));for(v in c)f.push(v),f.push(c[v]);j=f.join();v=0;for(f=K.length;v<f;v++)if(K[v].code==j){u=K[v].program;break a}v=k.createProgram();f=[Ea?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,
|
|
|
+"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.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");
|
|
|
g=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":
|
|
|
"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(v,O("fragment",g+p));k.attachShader(v,O("vertex",f+o));k.linkProgram(v);k.getProgramParameter(v,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(v,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");v.uniforms=
|
|
|
{};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m)f.push(w);w=f;f=0;for(m=w.length;f<m;f++)p=w[f],v.uniforms[p]=k.getUniformLocation(v,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)f.push("morphTarget"+w);for(u in e)f.push(u);u=f;w=0;for(e=u.length;w<e;w++)c=
|
|
|
u[w],v.attributes[c]=k.getAttribLocation(v,c);K.push({program:v,code:j});u=v}b.program=u;u=b.program.attributes;u.position>=0&&k.enableVertexAttribArray(u.position);u.color>=0&&k.enableVertexAttribArray(u.color);u.normal>=0&&k.enableVertexAttribArray(u.normal);u.tangent>=0&&k.enableVertexAttribArray(u.tangent);b.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(k.enableVertexAttribArray(u.skinVertexA),k.enableVertexAttribArray(u.skinVertexB),k.enableVertexAttribArray(u.skinIndex),
|
|
|
k.enableVertexAttribArray(u.skinWeight));if(b.attributes)for(h in b.attributes)u[h]!==void 0&&u[h]>=0&&k.enableVertexAttribArray(u[h]);if(b.morphTargets)b.numSupportedMorphTargets=0,u.morphTarget0>=0&&(k.enableVertexAttribArray(u.morphTarget0),b.numSupportedMorphTargets++),u.morphTarget1>=0&&(k.enableVertexAttribArray(u.morphTarget1),b.numSupportedMorphTargets++),u.morphTarget2>=0&&(k.enableVertexAttribArray(u.morphTarget2),b.numSupportedMorphTargets++),u.morphTarget3>=0&&(k.enableVertexAttribArray(u.morphTarget3),
|
|
|
-b.numSupportedMorphTargets++),u.morphTarget4>=0&&(k.enableVertexAttribArray(u.morphTarget4),b.numSupportedMorphTargets++),u.morphTarget5>=0&&(k.enableVertexAttribArray(u.morphTarget5),b.numSupportedMorphTargets++),u.morphTarget6>=0&&(k.enableVertexAttribArray(u.morphTarget6),b.numSupportedMorphTargets++),u.morphTarget7>=0&&(k.enableVertexAttribArray(u.morphTarget7),b.numSupportedMorphTargets++)};this.render=function(b,c,o,B){var J,D,F,E,H,L,V,K,M=b.lights,ga=b.fog;this.shadowMapEnabled&&w(b,c);$.data.vertices=
|
|
|
+b.numSupportedMorphTargets++),u.morphTarget4>=0&&(k.enableVertexAttribArray(u.morphTarget4),b.numSupportedMorphTargets++),u.morphTarget5>=0&&(k.enableVertexAttribArray(u.morphTarget5),b.numSupportedMorphTargets++),u.morphTarget6>=0&&(k.enableVertexAttribArray(u.morphTarget6),b.numSupportedMorphTargets++),u.morphTarget7>=0&&(k.enableVertexAttribArray(u.morphTarget7),b.numSupportedMorphTargets++)};this.render=function(b,c,o,B){var J,D,E,F,H,L,V,K,M=b.lights,ga=b.fog;this.shadowMapEnabled&&w(b,c);$.data.vertices=
|
|
|
0;$.data.faces=0;$.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(xa);c.projectionMatrix.flattenToArray(sa);ka.multiply(c.projectionMatrix,c.matrixWorldInverse);n(ka);this.initWebGLObjects(b);Q(o);(this.autoClear||B)&&this.clear();H=b.__webglObjects.length;for(B=0;B<H;B++)if(J=b.__webglObjects[B],V=J.object,V.visible)if(!(V instanceof THREE.Mesh)||t(V)){if(V.matrixWorld.flattenToArray(V._objectMatrixArray),G(V,c,!0),v(J),J.render=
|
|
|
!0,this.sortObjects)J.object.renderDepth?J.z=J.object.renderDepth:(Aa.copy(V.position),ka.multiplyVector3(Aa),J.z=Aa.z)}else J.render=!1;else J.render=!1;this.sortObjects&&b.__webglObjects.sort(u);L=b.__webglObjectsImmediate.length;for(B=0;B<L;B++)J=b.__webglObjectsImmediate[B],V=J.object,V.visible&&(V.matrixAutoUpdate&&V.matrixWorld.flattenToArray(V._objectMatrixArray),G(V,c,!0),p(J));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);I(b.overrideMaterial.blending);for(B=0;B<H;B++)if(J=b.__webglObjects[B],
|
|
|
-J.render)V=J.object,K=J.buffer,j(V),f(c,M,ga,b.overrideMaterial,K,V);for(B=0;B<L;B++)J=b.__webglObjectsImmediate[B],V=J.object,V.visible&&(j(V),D=e(c,M,ga,b.overrideMaterial,V),V.render(function(c){g(c,D,b.overrideMaterial.shading)}))}else{I(THREE.NormalBlending);for(B=0;B<H;B++)if(J=b.__webglObjects[B],J.render){V=J.object;K=J.buffer;F=J.opaque;j(V);for(J=0;J<F.count;J++)E=F.list[J],h(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,M,ga,E,K,V)}for(B=0;B<L;B++)if(J=
|
|
|
-b.__webglObjectsImmediate[B],V=J.object,V.visible){F=J.opaque;j(V);for(J=0;J<F.count;J++)E=F.list[J],h(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),D=e(c,M,ga,E,V),V.render(function(b){g(b,D,E.shading)})}for(B=0;B<H;B++)if(J=b.__webglObjects[B],J.render){V=J.object;K=J.buffer;F=J.transparent;j(V);for(J=0;J<F.count;J++)E=F.list[J],I(E.blending),h(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,M,ga,E,K,V)}for(B=0;B<L;B++)if(J=b.__webglObjectsImmediate[B],
|
|
|
-V=J.object,V.visible){F=J.transparent;j(V);for(J=0;J<F.count;J++)E=F.list[J],I(E.blending),h(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),D=e(c,M,ga,E,V),V.render(function(b){g(b,D,E.shading)})}}b.__webglSprites.length&&x(b,c);Pa&&b.__webglShadowVolumes.length&&b.lights.length&&z(b);b.__webglLensFlares.length&&y(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,o.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,
|
|
|
+J.render)V=J.object,K=J.buffer,j(V),f(c,M,ga,b.overrideMaterial,K,V);for(B=0;B<L;B++)J=b.__webglObjectsImmediate[B],V=J.object,V.visible&&(j(V),D=e(c,M,ga,b.overrideMaterial,V),V.render(function(c){g(c,D,b.overrideMaterial.shading)}))}else{I(THREE.NormalBlending);for(B=0;B<H;B++)if(J=b.__webglObjects[B],J.render){V=J.object;K=J.buffer;E=J.opaque;j(V);for(J=0;J<E.count;J++)F=E.list[J],h(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),f(c,M,ga,F,K,V)}for(B=0;B<L;B++)if(J=
|
|
|
+b.__webglObjectsImmediate[B],V=J.object,V.visible){E=J.opaque;j(V);for(J=0;J<E.count;J++)F=E.list[J],h(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),D=e(c,M,ga,F,V),V.render(function(b){g(b,D,F.shading)})}for(B=0;B<H;B++)if(J=b.__webglObjects[B],J.render){V=J.object;K=J.buffer;E=J.transparent;j(V);for(J=0;J<E.count;J++)F=E.list[J],I(F.blending),h(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),f(c,M,ga,F,K,V)}for(B=0;B<L;B++)if(J=b.__webglObjectsImmediate[B],
|
|
|
+V=J.object,V.visible){E=J.transparent;j(V);for(J=0;J<E.count;J++)F=E.list[J],I(F.blending),h(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),D=e(c,M,ga,F,V),V.render(function(b){g(b,D,F.shading)})}}b.__webglSprites.length&&x(b,c);Pa&&b.__webglShadowVolumes.length&&b.lights.length&&z(b);b.__webglLensFlares.length&&y(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,o.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,
|
|
|
null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=b.__objectsAdded[0],e=b,f=void 0,h=void 0,g=void 0;if(c._modelViewMatrix==void 0)c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=new Float32Array(16),c._objectMatrixArray=new Float32Array(16),c.matrixWorld.flattenToArray(c._objectMatrixArray);
|
|
|
if(c instanceof THREE.Mesh)for(f in h=c.geometry,h.geometryGroups==void 0&&X(h),h.geometryGroups){g=h.geometryGroups[f];if(!g.__webglVertexBuffer){var j=g;j.__webglVertexBuffer=k.createBuffer();j.__webglNormalBuffer=k.createBuffer();j.__webglTangentBuffer=k.createBuffer();j.__webglColorBuffer=k.createBuffer();j.__webglUVBuffer=k.createBuffer();j.__webglUV2Buffer=k.createBuffer();j.__webglSkinVertexABuffer=k.createBuffer();j.__webglSkinVertexBBuffer=k.createBuffer();j.__webglSkinIndicesBuffer=k.createBuffer();
|
|
|
j.__webglSkinWeightsBuffer=k.createBuffer();j.__webglFaceBuffer=k.createBuffer();j.__webglLineBuffer=k.createBuffer();if(j.numMorphTargets){var m=void 0,p=void 0;j.__webglMorphTargetsBuffers=[];m=0;for(p=j.numMorphTargets;m<p;m++)j.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var j=g,m=c,o=void 0,n=void 0,t=void 0,u=t=void 0,v=void 0,w=void 0,y=w=p=0,x=t=n=void 0,z=x=n=o=void 0,t=void 0,u=m.geometry,v=u.faces,x=j.faces,o=0,n=x.length;o<n;o++)t=x[o],t=v[t],t instanceof THREE.Face3?(p+=3,w+=
|
|
@@ -351,7 +351,7 @@ f.__webglColorBuffer=k.createBuffer(),f=h,g=f.vertices.length,f.__vertexArray=ne
|
|
|
[];f.__webglParticleCount=j;f.__materials=g.materials;z=p=m=void 0;m=0;for(p=g.materials.length;m<p;m++)if(z=g.materials[m],z.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes={};for(a in z.attributes){originalAttribute=z.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(j*size),attribute.buffer=k.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=!0;h.__dirtyColors=!0}H(e.__webglObjects,h,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:c,opaque:{list:[],
|
|
|
count:0},transparent:{list:[],count:0}}):c instanceof THREE.Sprite&&e.__webglSprites.push(c);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];c=b;if(e instanceof THREE.ShadowVolume)D(c.__webglShadowVolumes,e);else if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)D(c.__webglObjects,e);else if(e instanceof THREE.Sprite){c=c.__webglSprites;h=void 0;for(h=c.length-1;h>=0;h--)c[h]==e&&c.splice(h,1)}else e instanceof
|
|
|
-THREE.LensFlare?D(c.__webglLensFlares,e):e instanceof THREE.MarchingCubes&&D(c.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}c=0;for(e=b.__webglObjects.length;c<e;c++)E(b.__webglObjects[c].object,b);c=0;for(e=b.__webglShadowVolumes.length;c<e;c++)E(b.__webglShadowVolumes[c].object,b);c=0;for(e=b.__webglLensFlares.length;c<e;c++)E(b.__webglLensFlares[c].object,b)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),b=="back"?k.cullFace(k.BACK):b=="front"?
|
|
|
+THREE.LensFlare?D(c.__webglLensFlares,e):e instanceof THREE.MarchingCubes&&D(c.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}c=0;for(e=b.__webglObjects.length;c<e;c++)F(b.__webglObjects[c].object,b);c=0;for(e=b.__webglShadowVolumes.length;c<e;c++)F(b.__webglShadowVolumes[c].object,b);c=0;for(e=b.__webglLensFlares.length;c<e;c++)F(b.__webglLensFlares[c].object,b)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),b=="back"?k.cullFace(k.BACK):b=="front"?
|
|
|
k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.supportsVertexTextures=function(){return Ea}};
|
|
|
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.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
|
|
@@ -489,8 +489,8 @@ f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.
|
|
|
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,h=THREE.ExtrudeGeometry.__v2,g=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);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();g.set(-f.y,f.x);j.set(h.y,-h.x);k.copy(b).addSelf(g);m.copy(b).addSelf(j);if(k.equals(m))return j.clone();
|
|
|
k.copy(c).addSelf(g);m.copy(e).addSelf(j);g=f.dot(j);j=m.subSelf(k).dot(j);g==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=g;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;){Z=H;aa=H-1;aa<0&&(aa=b.length-
|
|
|
-1);for(var c=0,c=0;c<u+o*2;c++){var e=R*c,f=R*(c+1),h=ha+Z+e,e=ha+aa+e,g=ha+aa+f,f=ha+Z+f;h+=E;e+=E;g+=E;f+=E;L.faces.push(new THREE.Face4(h,e,g,f))}}}function j(b,c,e){L.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=E;c+=E;e+=E;L.faces.push(new THREE.Face3(b,c,e))}var m=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:n-2,o=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
-!0,v=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,w=c.path!==void 0?c.path:null,z,x=!1;if(w)z=w.getPoints(v),u=z.length,x=!0,p=!1;p||(t=n=o=0);var y,G,B,L=this,E=this.vertices.length,v=b.extractAllPoints(v),w=v.shape,v=v.holes,D=!THREE.Shape.Utils.isClockWise(w);if(D){w=w.reverse();G=0;for(B=v.length;G<B;G++)y=v[G],THREE.Shape.Utils.isClockWise(y)&&(v[G]=y.reverse());D=!1}var D=THREE.Shape.Utils.triangulateShape(w,v),X=w;G=0;for(B=v.length;G<B;G++)y=v[G],w=w.concat(y);
|
|
|
+1);for(var c=0,c=0;c<u+o*2;c++){var e=R*c,f=R*(c+1),h=ha+Z+e,e=ha+aa+e,g=ha+aa+f,f=ha+Z+f;h+=F;e+=F;g+=F;f+=F;L.faces.push(new THREE.Face4(h,e,g,f))}}}function j(b,c,e){L.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=F;c+=F;e+=F;L.faces.push(new THREE.Face3(b,c,e))}var m=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:n-2,o=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
+!0,v=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,w=c.path!==void 0?c.path:null,z,x=!1;if(w)z=w.getPoints(v),u=z.length,x=!0,p=!1;p||(t=n=o=0);var y,G,B,L=this,F=this.vertices.length,v=b.extractAllPoints(v),w=v.shape,v=v.holes,D=!THREE.Shape.Utils.isClockWise(w);if(D){w=w.reverse();G=0;for(B=v.length;G<B;G++)y=v[G],THREE.Shape.Utils.isClockWise(y)&&(v[G]=y.reverse());D=!1}var D=THREE.Shape.Utils.triangulateShape(w,v),X=w;G=0;for(B=v.length;G<B;G++)y=v[G],w=w.concat(y);
|
|
|
var H,I,M,P,Q,O,R=w.length,S=D.length,$=[];H=0;I=X.length;Z=I-1;for(aa=H+1;H<I;H++,Z++,aa++)Z==I&&(Z=0),aa==I&&(aa=0),$[H]=f(X[H],X[Z],X[aa]);var k=[],K,da=$.concat();G=0;for(B=v.length;G<B;G++){y=v[G];K=[];H=0;I=y.length;Z=I-1;for(aa=H+1;H<I;H++,Z++,aa++)Z==I&&(Z=0),aa==I&&(aa=0),K[H]=f(y[H],y[Z],y[aa]);k.push(K);da=da.concat(K)}for(M=0;M<o;M++){P=M/o;Q=n*(1-P);P=t*Math.sin(P*Math.PI/2);H=0;for(I=X.length;H<I;H++)O=e(X[H],$[H],P),j(O.x,O.y,-Q);G=0;for(B=v.length;G<B;G++){y=v[G];K=k[G];H=0;for(I=
|
|
|
y.length;H<I;H++)O=e(y[H],K[H],P),j(O.x,O.y,-Q)}}P=t;for(H=0;H<R;H++)O=p?e(w[H],da[H],P):w[H],x?j(O.x,O.y+z[0].y,z[0].x):j(O.x,O.y,0);for(M=1;M<=u;M++)for(H=0;H<R;H++)O=p?e(w[H],da[H],P):w[H],x?j(O.x,O.y+z[M-1].y,z[M-1].x):j(O.x,O.y,m/u*M);for(M=o-1;M>=0;M--){P=M/o;Q=n*(1-P);P=t*Math.sin(P*Math.PI/2);H=0;for(I=X.length;H<I;H++)O=e(X[H],$[H],P),j(O.x,O.y,m+Q);G=0;for(B=v.length;G<B;G++){y=v[G];K=k[G];H=0;for(I=y.length;H<I;H++)O=e(y[H],K[H],P),x?j(O.x,O.y+z[u-1].y,z[u-1].x+Q):j(O.x,O.y,m+Q)}}if(p){n=
|
|
|
R*0;for(H=0;H<S;H++)m=D[H],h(m[2]+n,m[1]+n,m[0]+n);n=R*(u+o*2);for(H=0;H<S;H++)m=D[H],h(m[0]+n,m[1]+n,m[2]+n)}else{for(H=0;H<S;H++)m=D[H],h(m[2],m[1],m[0]);for(H=0;H<S;H++)m=D[H],h(m[0]+R*u,m[1]+R*u,m[2]+R*u)}var Z,aa,ha=0;g(X);ha+=X.length;G=0;for(B=v.length;G<B;G++)y=v[G],g(y),ha+=y.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;
|
|
@@ -511,7 +511,7 @@ this.getFace(),e=this.size/c.resolution,f=0,g=String(b).split(""),j=g.length,h=[
|
|
|
t));g.moveTo(m,t);break;case "l":m=c[b++]*e+f;t=c[b++]*e;j.push(new THREE.Vector2(m,t));g.lineTo(m,t);break;case "q":m=c[b++]*e+f;t=c[b++]*e;v=c[b++]*e+f;u=c[b++]*e;g.quadraticCurveTo(v,u,m,t);if(h=j[j.length-1]){o=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var y=h/divisions,G=THREE.Shape.Utils.b2(y,o,v,m),y=THREE.Shape.Utils.b2(y,p,u,t);j.push(new THREE.Vector2(G,y))}}break;case "b":if(m=c[b++]*e+f,t=c[b++]*e,v=c[b++]*e+f,u=c[b++]*-e,w=c[b++]*e+f,z=c[b++]*-e,g.bezierCurveTo(m,t,
|
|
|
v,u,w,z),h=j[j.length-1]){o=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)y=h/divisions,G=THREE.Shape.Utils.b3(y,o,v,w,m),y=THREE.Shape.Utils.b3(y,p,u,z,t),j.push(new THREE.Vector2(G,y))}}}return{offset:x.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=[],m=[],n,t,o;if(c(b)>0)for(t=0;t<g;t++)h[t]=t;else for(t=0;t<g;t++)h[t]=g-1-t;var p=2*g;for(t=g-1;g>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return j}n=t;g<=n&&(n=0);t=n+1;g<=t&&(t=0);o=t+1;g<=o&&(o=0);var v;a:{v=b;var u=n,w=t,z=o,x=g,y=h,G=void 0,B=void 0,L=void 0,
|
|
|
-E=void 0,D=void 0,X=void 0,H=void 0,I=void 0,M=void 0,B=v[y[u]].x,L=v[y[u]].y,E=v[y[w]].x,D=v[y[w]].y,X=v[y[z]].x,H=v[y[z]].y;if(1.0E-10>(E-B)*(H-L)-(D-L)*(X-B))v=!1;else{for(G=0;G<x;G++)if(!(G==u||G==w||G==z)){var I=v[y[G]].x,M=v[y[G]].y,P=void 0,Q=void 0,O=void 0,R=void 0,S=void 0,$=void 0,k=void 0,K=void 0,da=void 0,Z=void 0,aa=void 0,ha=void 0,P=O=S=void 0,P=X-E,Q=H-D,O=B-X,R=L-H,S=E-B,$=D-L,k=I-B,K=M-L,da=I-E,Z=M-D,aa=I-X,ha=M-H,P=P*Z-Q*da,S=S*K-$*k,O=O*ha-R*aa;if(P>=0&&O>=0&&S>=0){v=!1;break a}}v=
|
|
|
+F=void 0,D=void 0,X=void 0,H=void 0,I=void 0,M=void 0,B=v[y[u]].x,L=v[y[u]].y,F=v[y[w]].x,D=v[y[w]].y,X=v[y[z]].x,H=v[y[z]].y;if(1.0E-10>(F-B)*(H-L)-(D-L)*(X-B))v=!1;else{for(G=0;G<x;G++)if(!(G==u||G==w||G==z)){var I=v[y[G]].x,M=v[y[G]].y,P=void 0,Q=void 0,O=void 0,R=void 0,S=void 0,$=void 0,k=void 0,K=void 0,da=void 0,Z=void 0,aa=void 0,ha=void 0,P=O=S=void 0,P=X-F,Q=H-D,O=B-X,R=L-H,S=F-B,$=D-L,k=I-B,K=M-L,da=I-F,Z=M-D,aa=I-X,ha=M-H,P=P*Z-Q*da,S=S*K-$*k,O=O*ha-R*aa;if(P>=0&&O>=0&&S>=0){v=!1;break a}}v=
|
|
|
!0}}if(v){j.push([b[h[n]],b[h[t]],b[h[o]]]);m.push([h[n],h[t],h[o]]);n=t;for(o=t+1;o<g;n++,o++)h[n]=h[o];g--;p=2*g}}if(f)return m;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){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
|
|
|
1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[h][0],b[h][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
@@ -529,9 +529,9 @@ 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 t=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(t.uniforms),p=h.color;m=h.specular;n=h.ambient;var v=h.shininess;o.tNormal.texture=h.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(h.map)o.tDiffuse.texture=h.map,o.enableDiffuse.value=!0;if(h.specularMap)o.tSpecular.texture=h.specularMap,o.enableSpecular.value=!0;if(h.lightMap)o.tAO.texture=
|
|
|
h.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(p);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(n);o.uShininess.value=v;if(h.opacity)o.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:o,lights:!0,fog:!0})}else h=new THREE[m](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,n,t,o,p,v,u,w,z,x,y,G,B,L=b.faces;p=b.vertices;var E=b.normals,D=b.colors,X=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&X++;for(e=0;e<X;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];t=0;for(o=p.length;t<o;)v=new THREE.Vertex,v.position.x=p[t++]*c,v.position.y=
|
|
|
+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,n,t,o,p,v,u,w,z,x,y,G,B,L=b.faces;p=b.vertices;var F=b.normals,D=b.colors,X=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&X++;for(e=0;e<X;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];t=0;for(o=p.length;t<o;)v=new THREE.Vertex,v.position.x=p[t++]*c,v.position.y=
|
|
|
p[t++]*c,v.position.z=p[t++]*c,f.vertices.push(v);t=0;for(o=L.length;t<o;){c=L[t++];p=c&1;n=c&2;e=c&4;g=c&8;u=c&16;v=c&32;z=c&64;c&=128;p?(x=new THREE.Face4,x.a=L[t++],x.b=L[t++],x.c=L[t++],x.d=L[t++],p=4):(x=new THREE.Face3,x.a=L[t++],x.b=L[t++],x.c=L[t++],p=3);if(n)n=L[t++],x.materials=f.materials[n];n=f.faces.length;if(e)for(e=0;e<X;e++)y=b.uvs[e],w=L[t++],B=y[w*2],w=y[w*2+1],f.faceUvs[e][n]=new THREE.UV(B,w);if(g)for(e=0;e<X;e++){y=b.uvs[e];G=[];for(g=0;g<p;g++)w=L[t++],B=y[w*2],w=y[w*2+1],G[g]=
|
|
|
-new THREE.UV(B,w);f.faceVertexUvs[e][n]=G}if(u)u=L[t++]*3,g=new THREE.Vector3,g.x=E[u++],g.y=E[u++],g.z=E[u],x.normal=g;if(v)for(e=0;e<p;e++)u=L[t++]*3,g=new THREE.Vector3,g.x=E[u++],g.y=E[u++],g.z=E[u],x.vertexNormals.push(g);if(z)v=L[t++],v=new THREE.Color(D[v]),x.color=v;if(c)for(e=0;e<p;e++)v=L[t++],v=new THREE.Color(D[v]),x.vertexColors.push(v);f.faces.push(x)}}})(g);(function(){var c,e,g,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
+new THREE.UV(B,w);f.faceVertexUvs[e][n]=G}if(u)u=L[t++]*3,g=new THREE.Vector3,g.x=F[u++],g.y=F[u++],g.z=F[u],x.normal=g;if(v)for(e=0;e<p;e++)u=L[t++]*3,g=new THREE.Vector3,g.x=F[u++],g.y=F[u++],g.z=F[u],x.vertexNormals.push(g);if(z)v=L[t++],v=new THREE.Color(D[v]),x.color=v;if(c)for(e=0;e<p;e++)v=L[t++],v=new THREE.Color(D[v]),x.vertexColors.push(v);f.faces.push(x)}}})(g);(function(){var c,e,g,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,t,o,p,v,u,w;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=[];u=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;n=0;for(t=w.length;n<t;n+=3)o=w[n]*c,p=w[n+1]*
|
|
|
c,v=w[n+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(o,p,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=[];t=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(n=o.length;c<n;c+=3)p=new THREE.Color(16755200),p.setRGB(o[c],o[c+1],o[c+2]),t.push(p)}}})(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;
|
|
@@ -539,13 +539,13 @@ THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.te
|
|
|
c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,j){var h=new XMLHttpRequest,m=f+"/"+b,n=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 ["+m+"] ["+h.status+"]"):h.readyState==3?j&&(n==0&&(n=h.getResponseHeader("Content-Length")),j({total:n,loaded:h.responseText.length})):h.readyState==2&&(n=h.getResponseHeader("Content-Length"))};h.open("GET",m,!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=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(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=o(b,c),f=o(b,c+1),h=o(b,c+2);return(o(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function t(b,c){var e=o(b,c);return e>127?e-256:e}function o(b,
|
|
|
c){return b.charCodeAt(c)&255}function p(c){var e,f,h;e=g(b,c);f=g(b,c+D);h=g(b,c+X);c=n(b,c+H);THREE.BinaryLoader.prototype.f3(y,e,f,h,c)}function v(c){var e,f,h,j,k,o;e=g(b,c);f=g(b,c+D);h=g(b,c+X);j=n(b,c+H);k=g(b,c+I);o=g(b,c+M);c=g(b,c+P);THREE.BinaryLoader.prototype.f3n(y,L,e,f,h,j,k,o,c)}function u(c){var e,f,h,j;e=g(b,c);f=g(b,c+Q);h=g(b,c+O);j=g(b,c+R);c=n(b,c+S);THREE.BinaryLoader.prototype.f4(y,e,f,h,j,c)}function w(c){var e,f,h,j,o,p,t,u;e=g(b,c);f=g(b,c+Q);h=g(b,c+O);j=g(b,c+R);o=n(b,
|
|
|
-c+S);p=g(b,c+$);t=g(b,c+k);u=g(b,c+K);c=g(b,c+da);THREE.BinaryLoader.prototype.f4n(y,L,e,f,h,j,o,p,t,u,c)}function z(c){var e,f;e=g(b,c);f=g(b,c+Z);c=g(b,c+aa);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],E[e*2],E[e*2+1],E[f*2],E[f*2+1],E[c*2],E[c*2+1])}function x(c){var e,f,h;e=g(b,c);f=g(b,c+ha);h=g(b,c+la);c=g(b,c+ea);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],E[e*2],E[e*2+1],E[f*2],E[f*2+1],E[h*2],E[h*2+1],E[c*2],E[c*2+1])}var y=this,G=0,B,L=[],E=[],D,X,H,I,M,P,Q,O,R,S,$,k,K,da,
|
|
|
-Z,aa,ha,la,ea,fa,F,ia,na,ca,oa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);B={signature:b.substr(G,8),header_bytes:o(b,G+8),vertex_coordinate_bytes:o(b,G+9),normal_coordinate_bytes:o(b,G+10),uv_coordinate_bytes:o(b,G+11),vertex_index_bytes:o(b,G+12),normal_index_bytes:o(b,G+13),uv_index_bytes:o(b,G+14),material_index_bytes:o(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,
|
|
|
+c+S);p=g(b,c+$);t=g(b,c+k);u=g(b,c+K);c=g(b,c+da);THREE.BinaryLoader.prototype.f4n(y,L,e,f,h,j,o,p,t,u,c)}function z(c){var e,f;e=g(b,c);f=g(b,c+Z);c=g(b,c+aa);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],F[e*2],F[e*2+1],F[f*2],F[f*2+1],F[c*2],F[c*2+1])}function x(c){var e,f,h;e=g(b,c);f=g(b,c+ha);h=g(b,c+la);c=g(b,c+ea);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],F[e*2],F[e*2+1],F[f*2],F[f*2+1],F[h*2],F[h*2+1],F[c*2],F[c*2+1])}var y=this,G=0,B,L=[],F=[],D,X,H,I,M,P,Q,O,R,S,$,k,K,da,
|
|
|
+Z,aa,ha,la,ea,fa,E,ia,na,ca,oa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);B={signature:b.substr(G,8),header_bytes:o(b,G+8),vertex_coordinate_bytes:o(b,G+9),normal_coordinate_bytes:o(b,G+10),uv_coordinate_bytes:o(b,G+11),vertex_index_bytes:o(b,G+12),normal_index_bytes:o(b,G+13),uv_index_bytes:o(b,G+14),material_index_bytes:o(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+=B.header_bytes;D=B.vertex_index_bytes;X=B.vertex_index_bytes*2;H=B.vertex_index_bytes*3;I=B.vertex_index_bytes*3+B.material_index_bytes;M=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;P=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;Q=B.vertex_index_bytes;O=B.vertex_index_bytes*2;R=B.vertex_index_bytes*3;S=B.vertex_index_bytes*4;$=B.vertex_index_bytes*
|
|
|
-4+B.material_index_bytes;k=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;K=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;da=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;Z=B.uv_index_bytes;aa=B.uv_index_bytes*2;ha=B.uv_index_bytes;la=B.uv_index_bytes*2;ea=B.uv_index_bytes*3;c=B.vertex_index_bytes*3+B.material_index_bytes;oa=B.vertex_index_bytes*4+B.material_index_bytes;fa=B.ntri_flat*c;F=B.ntri_smooth*(c+B.normal_index_bytes*3);ia=
|
|
|
+4+B.material_index_bytes;k=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;K=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;da=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;Z=B.uv_index_bytes;aa=B.uv_index_bytes*2;ha=B.uv_index_bytes;la=B.uv_index_bytes*2;ea=B.uv_index_bytes*3;c=B.vertex_index_bytes*3+B.material_index_bytes;oa=B.vertex_index_bytes*4+B.material_index_bytes;fa=B.ntri_flat*c;E=B.ntri_smooth*(c+B.normal_index_bytes*3);ia=
|
|
|
B.ntri_flat_uv*(c+B.uv_index_bytes*3);na=B.ntri_smooth_uv*(c+B.normal_index_bytes*3+B.uv_index_bytes*3);ca=B.nquad_flat*oa;c=B.nquad_smooth*(oa+B.normal_index_bytes*4);oa=B.nquad_flat_uv*(oa+B.uv_index_bytes*4);G+=function(c){for(var f,g,j,k=B.vertex_coordinate_bytes*3,m=c+B.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+B.vertex_coordinate_bytes),j=e(b,c+B.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,f,g,j);return B.nvertices*k}(G);G+=function(c){for(var e,f,g,h=B.normal_coordinate_bytes*3,
|
|
|
-j=c+B.nnormals*h;c<j;c+=h)e=t(b,c),f=t(b,c+B.normal_coordinate_bytes),g=t(b,c+B.normal_coordinate_bytes*2),L.push(e/127,f/127,g/127);return B.nnormals*h}(G);G+=function(c){for(var f,g,j=B.uv_coordinate_bytes*2,k=c+B.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+B.uv_coordinate_bytes),E.push(f,g);return B.nuvs*j}(G);fa=G+fa;F=fa+F;ia=F+ia;na=ia+na;ca=na+ca;c=ca+c;oa=c+oa;(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=e+B.uv_index_bytes*3,g=b+B.ntri_flat_uv*f;for(c=b;c<g;c+=f)p(c),z(c+e);return g-
|
|
|
-b})(F);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=e+B.uv_index_bytes*3,g=b+B.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),z(c+e);return g-b})(ia);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=e+B.uv_index_bytes*4,g=b+B.nquad_flat_uv*f;for(c=b;c<g;c+=f)u(c),x(c+e);return g-b})(c);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=e+B.uv_index_bytes*4,g=b+B.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),
|
|
|
+j=c+B.nnormals*h;c<j;c+=h)e=t(b,c),f=t(b,c+B.normal_coordinate_bytes),g=t(b,c+B.normal_coordinate_bytes*2),L.push(e/127,f/127,g/127);return B.nnormals*h}(G);G+=function(c){for(var f,g,j=B.uv_coordinate_bytes*2,k=c+B.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+B.uv_coordinate_bytes),F.push(f,g);return B.nuvs*j}(G);fa=G+fa;E=fa+E;ia=E+ia;na=ia+na;ca=na+ca;c=ca+c;oa=c+oa;(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=e+B.uv_index_bytes*3,g=b+B.ntri_flat_uv*f;for(c=b;c<g;c+=f)p(c),z(c+e);return g-
|
|
|
+b})(E);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=e+B.uv_index_bytes*3,g=b+B.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),z(c+e);return g-b})(ia);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=e+B.uv_index_bytes*4,g=b+B.nquad_flat_uv*f;for(c=b;c<g;c+=f)u(c),x(c+e);return g-b})(c);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=e+B.uv_index_bytes*4,g=b+B.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),
|
|
|
x(c+e);return g-b})(oa);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=b+B.ntri_flat*e;for(c=b;c<f;c+=e)p(c);return f-b})(G);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=b+B.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(fa);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=b+B.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(na);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*
|
|
|
4,f=b+B.nquad_smooth*e;for(c=b;c<f;c+=e)w(c);return f-b})(ca);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,m,n){var j=b.materials[j],t=c[m*3],o=c[m*3+1],m=c[m*3+2],p=c[n*3],v=c[n*3+1],n=c[n*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(t,o,m),new THREE.Vector3(p,v,n)],null,j))},f4n:function(b,c,e,f,g,j,h,m,n,t,o){var h=b.materials[h],p=c[n*3],v=c[n*3+1],n=c[n*3+2],u=c[t*3],w=c[t*3+1],t=c[t*3+2],z=c[o*3],x=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,j,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(p,
|
|
@@ -555,23 +555,23 @@ THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.pos
|
|
|
q=G.quaternion;s=G.scale;q=0;M.length==0&&(M[0]=new THREE.MeshFaceMaterial);M.length>1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(D,M);object.name=u;object.position.set(B[0],B[1],B[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;K.scene.addObject(object);K.objects[u]=object;G.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),K.scene.collisions.colliders.push(b));
|
|
|
if(G.castsShadow)b=new THREE.ShadowVolume(D),K.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},K.triggers[object.name]=b)}}else B=G.position,r=G.rotation,q=G.quaternion,s=G.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(B[0],B[1],B[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,K.scene.addObject(object),K.objects[u]=object,K.empties[u]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},K.triggers[object.name]=b)}function n(b){return function(c){K.geometries[b]=c;m();R-=1;e.onLoadComplete();o()}}function t(b){return function(c){K.geometries[b]=c}}function o(){e.callbackProgress({totalModels:$,totalTextures:k,loadedModels:$-R,loadedTextures:k-S},K);e.onLoadProgress();R==0&&S==0&&c(K)}var p,
|
|
|
-v,u,w,z,x,y,G,B,L,E,D,X,H,I,M,P,Q,O,R,S,$,k,K;Q=b.data;I=new THREE.BinaryLoader;O=new THREE.JSONLoader;S=R=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in Q.objects)if(G=Q.objects[u],G.meshCollider){b=!0;break}if(b)K.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;L=Q.transform.rotation;var da=Q.transform.scale;b&&K.scene.position.set(b[0],b[1],b[2]);L&&K.scene.rotation.set(L[0],
|
|
|
+v,u,w,z,x,y,G,B,L,F,D,X,H,I,M,P,Q,O,R,S,$,k,K;Q=b.data;I=new THREE.BinaryLoader;O=new THREE.JSONLoader;S=R=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in Q.objects)if(G=Q.objects[u],G.meshCollider){b=!0;break}if(b)K.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;L=Q.transform.rotation;var da=Q.transform.scale;b&&K.scene.position.set(b[0],b[1],b[2]);L&&K.scene.rotation.set(L[0],
|
|
|
L[1],L[2]);da&&K.scene.scale.set(da[0],da[1],da[2]);(b||L||da)&&K.scene.updateMatrix()}b=function(){S-=1;o();e.onLoadComplete()};for(z in Q.cameras){L=Q.cameras[z];if(L.type=="perspective")X=new THREE.Camera(L.fov,L.aspect,L.near,L.far);else if(L.type=="ortho")X=new THREE.Camera,X.projectionMatrix=THREE.Matrix4.makeOrtho(L.left,L.right,L.top,L.bottom,L.near,L.far);B=L.position;L=L.target;X.position.set(B[0],B[1],B[2]);X.target.position.set(L[0],L[1],L[2]);K.cameras[z]=X}for(w in Q.lights)z=Q.lights[w],
|
|
|
X=z.color!==void 0?z.color:16777215,L=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(B=z.direction,P=new THREE.DirectionalLight(X,L),P.position.set(B[0],B[1],B[2]),P.position.normalize()):z.type=="point"?(B=z.position,d=z.distance,P=new THREE.PointLight(X,L,d),P.position.set(B[0],B[1],B[2])):z.type=="ambient"&&(P=new THREE.AmbientLight(X)),K.scene.addLight(P),K.lights[w]=P;for(x in Q.fogs)w=Q.fogs[x],w.type=="linear"?H=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(H=new THREE.FogExp2(0,
|
|
|
w.density)),L=w.color,H.color.setRGB(L[0],L[1],L[2]),K.fogs[x]=H;if(K.cameras&&Q.defaults.camera)K.currentCamera=K.cameras[Q.defaults.camera];if(K.fogs&&Q.defaults.fog)K.scene.fog=K.fogs[Q.defaults.fog];L=Q.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(L[0],L[1],L[2]);K.bgColorAlpha=Q.defaults.bgalpha;for(p in Q.geometries)if(x=Q.geometries[p],x.type=="bin_mesh"||x.type=="ascii_mesh")R+=1,e.onLoadStart();$=R;for(p in Q.geometries)x=Q.geometries[p],x.type=="cube"?(D=new THREE.CubeGeometry(x.width,
|
|
|
x.height,x.depth,x.segmentsWidth,x.segmentsHeight,x.segmentsDepth,null,x.flipped,x.sides),K.geometries[p]=D):x.type=="plane"?(D=new THREE.PlaneGeometry(x.width,x.height,x.segmentsWidth,x.segmentsHeight),K.geometries[p]=D):x.type=="sphere"?(D=new THREE.SphereGeometry(x.radius,x.segmentsWidth,x.segmentsHeight),K.geometries[p]=D):x.type=="cylinder"?(D=new THREE.CylinderGeometry(x.numSegs,x.topRad,x.botRad,x.height,x.topOffset,x.botOffset),K.geometries[p]=D):x.type=="torus"?(D=new THREE.TorusGeometry(x.radius,
|
|
|
x.tube,x.segmentsR,x.segmentsT),K.geometries[p]=D):x.type=="icosahedron"?(D=new THREE.IcosahedronGeometry(x.subdivisions),K.geometries[p]=D):x.type=="bin_mesh"?I.load({model:f(x.url,Q.urlBaseType),callback:n(p)}):x.type=="ascii_mesh"?O.load({model:f(x.url,Q.urlBaseType),callback:n(p)}):x.type=="embedded_mesh"&&(x=Q.embeds[x.id])&&O.createModel(x,t(p),"");for(y in Q.textures)if(p=Q.textures[y],p.url instanceof Array){S+=p.url.length;for(I=0;I<p.url.length;I++)e.onLoadStart()}else S+=1,e.onLoadStart();
|
|
|
k=S;for(y in Q.textures){p=Q.textures[y];if(p.mapping!=void 0&&THREE[p.mapping]!=void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){I=[];for(var Z=0;Z<p.url.length;Z++)I[Z]=f(p.url[Z],Q.urlBaseType);I=THREE.ImageUtils.loadTextureCube(I,p.mapping,b)}else{I=THREE.ImageUtils.loadTexture(f(p.url,Q.urlBaseType),p.mapping,b);if(THREE[p.minFilter]!=void 0)I.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)I.magFilter=THREE[p.magFilter];if(p.repeat){I.repeat.set(p.repeat[0],p.repeat[1]);
|
|
|
-if(p.repeat[0]!=1)I.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)I.wrapT=THREE.RepeatWrapping}p.offset&&I.offset.set(p.offset[0],p.offset[1]);if(p.wrap){O={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(O[p.wrap[0]]!==void 0)I.wrapS=O[p.wrap[0]];if(O[p.wrap[1]]!==void 0)I.wrapT=O[p.wrap[1]]}}K.textures[y]=I}for(v in Q.materials){y=Q.materials[v];for(E in y.parameters)if(E=="envMap"||E=="map"||E=="lightMap")y.parameters[E]=K.textures[y.parameters[E]];else if(E=="shading")y.parameters[E]=
|
|
|
-y.parameters[E]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(E=="blending")y.parameters[E]=THREE[y.parameters[E]]?THREE[y.parameters[E]]:THREE.NormalBlending;else if(E=="combine")y.parameters[E]=y.parameters[E]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(E=="vertexColors")if(y.parameters[E]=="face")y.parameters[E]=THREE.FaceColors;else if(y.parameters[E])y.parameters[E]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
|
|
|
+if(p.repeat[0]!=1)I.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)I.wrapT=THREE.RepeatWrapping}p.offset&&I.offset.set(p.offset[0],p.offset[1]);if(p.wrap){O={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(O[p.wrap[0]]!==void 0)I.wrapS=O[p.wrap[0]];if(O[p.wrap[1]]!==void 0)I.wrapT=O[p.wrap[1]]}}K.textures[y]=I}for(v in Q.materials){y=Q.materials[v];for(F in y.parameters)if(F=="envMap"||F=="map"||F=="lightMap")y.parameters[F]=K.textures[y.parameters[F]];else if(F=="shading")y.parameters[F]=
|
|
|
+y.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")y.parameters[F]=THREE[y.parameters[F]]?THREE[y.parameters[F]]:THREE.NormalBlending;else if(F=="combine")y.parameters[F]=y.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(y.parameters[F]=="face")y.parameters[F]=THREE.FaceColors;else if(y.parameters[F])y.parameters[F]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
|
|
|
!0;if(y.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(p.uniforms);I=y.parameters.color;O=y.parameters.specular;x=y.parameters.ambient;H=y.parameters.shininess;b.tNormal.texture=K.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=
|
|
|
K.textures[y.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(I);b.uSpecularColor.value.setHex(O);b.uAmbientColor.value.setHex(x);b.uShininess.value=H;if(y.parameters.opacity)b.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:b,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);K.materials[v]=y}m();e.callbackSync(K)}},constructor:THREE.SceneLoader};
|
|
|
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,m,n,t,o,p){h=(h-o)/(p-o);o=this.normal_cache;c[j]=m+h*this.delta;c[j+1]=n;c[j+2]=t;g[j]=this.lerp(o[b],o[b+3],h);g[j+1]=this.lerp(o[b+1],o[b+4],h);g[j+2]=this.lerp(o[b+2],o[b+5],h)};this.VIntY=function(b,c,g,j,h,m,n,t,o,p){h=(h-o)/(p-o);o=this.normal_cache;c[j]=m;c[j+1]=n+h*this.delta;c[j+
|
|
|
2]=t;c=b+this.yd*3;g[j]=this.lerp(o[b],o[c],h);g[j+1]=this.lerp(o[b+1],o[c+1],h);g[j+2]=this.lerp(o[b+2],o[c+2],h)};this.VIntZ=function(b,c,g,j,h,m,n,t,o,p){h=(h-o)/(p-o);o=this.normal_cache;c[j]=m;c[j+1]=n;c[j+2]=t+h*this.delta;c=b+this.zd*3;g[j]=this.lerp(o[b],o[c],h);g[j+1]=this.lerp(o[b+1],o[c+1],h);g[j+2]=this.lerp(o[b+2],o[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,m){var n=j+1,t=j+this.yd,o=j+this.zd,p=n+this.yd,v=n+this.zd,u=j+this.yd+this.zd,w=n+this.yd+this.zd,z=0,x=this.field[j],y=this.field[n],G=this.field[t],B=this.field[p],L=this.field[o],E=this.field[v],D=this.field[u],X=this.field[w];x<h&&(z|=1);y<h&&(z|=2);G<h&&(z|=8);B<h&&(z|=4);L<h&&(z|=16);E<h&&(z|=32);D<h&&(z|=128);X<h&&(z|=64);var H=THREE.edgeTable[z];if(H==0)return 0;var I=this.delta,
|
|
|
-M=b+I,P=c+I,I=g+I;H&1&&(this.compNorm(j),this.compNorm(n),this.VIntX(j*3,this.vlist,this.nlist,0,h,b,c,g,x,y));H&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,h,M,c,g,y,B));H&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,h,b,P,g,G,B));H&8&&(this.compNorm(j),this.compNorm(t),this.VIntY(j*3,this.vlist,this.nlist,9,h,b,c,g,x,G));H&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,h,b,c,I,L,E));H&32&&(this.compNorm(v),
|
|
|
-this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,15,h,M,c,I,E,X));H&64&&(this.compNorm(u),this.compNorm(w),this.VIntX(u*3,this.vlist,this.nlist,18,h,b,P,I,D,X));H&128&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,21,h,b,c,I,L,D));H&256&&(this.compNorm(j),this.compNorm(o),this.VIntZ(j*3,this.vlist,this.nlist,24,h,b,c,g,x,L));H&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,h,M,c,g,y,E));H&1024&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*
|
|
|
+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,m){var n=j+1,t=j+this.yd,o=j+this.zd,p=n+this.yd,v=n+this.zd,u=j+this.yd+this.zd,w=n+this.yd+this.zd,z=0,x=this.field[j],y=this.field[n],G=this.field[t],B=this.field[p],L=this.field[o],F=this.field[v],D=this.field[u],X=this.field[w];x<h&&(z|=1);y<h&&(z|=2);G<h&&(z|=8);B<h&&(z|=4);L<h&&(z|=16);F<h&&(z|=32);D<h&&(z|=128);X<h&&(z|=64);var H=THREE.edgeTable[z];if(H==0)return 0;var I=this.delta,
|
|
|
+M=b+I,P=c+I,I=g+I;H&1&&(this.compNorm(j),this.compNorm(n),this.VIntX(j*3,this.vlist,this.nlist,0,h,b,c,g,x,y));H&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,h,M,c,g,y,B));H&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,h,b,P,g,G,B));H&8&&(this.compNorm(j),this.compNorm(t),this.VIntY(j*3,this.vlist,this.nlist,9,h,b,c,g,x,G));H&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,h,b,c,I,L,F));H&32&&(this.compNorm(v),
|
|
|
+this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,15,h,M,c,I,F,X));H&64&&(this.compNorm(u),this.compNorm(w),this.VIntX(u*3,this.vlist,this.nlist,18,h,b,P,I,D,X));H&128&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,21,h,b,c,I,L,D));H&256&&(this.compNorm(j),this.compNorm(o),this.VIntZ(j*3,this.vlist,this.nlist,24,h,b,c,g,x,L));H&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,h,M,c,g,y,F));H&1024&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*
|
|
|
3,this.vlist,this.nlist,30,h,M,P,g,B,X));H&2048&&(this.compNorm(t),this.compNorm(u),this.VIntZ(t*3,this.vlist,this.nlist,33,h,b,P,g,G,D));z<<=4;for(h=j=0;THREE.triTable[z+h]!=-1;)b=z+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],m),h+=3,j++;return j};this.posnormtriv=function(b,c,g,j,h,m){var n=this.count*3;this.positionArray[n]=b[g];this.positionArray[n+1]=b[g+1];this.positionArray[n+2]=b[g+2];this.positionArray[n+3]=b[j];this.positionArray[n+
|
|
|
4]=b[j+1];this.positionArray[n+5]=b[j+2];this.positionArray[n+6]=b[h];this.positionArray[n+7]=b[h+1];this.positionArray[n+8]=b[h+2];this.normalArray[n]=c[g];this.normalArray[n+1]=c[g+1];this.normalArray[n+2]=c[g+2];this.normalArray[n+3]=c[j];this.normalArray[n+4]=c[j+1];this.normalArray[n+5]=c[j+2];this.normalArray[n+6]=c[h];this.normalArray[n+7]=c[h+1];this.normalArray[n+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(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 m=this.size*Math.sqrt(j/h),n=g*this.size,t=c*this.size,o=b*this.size,p=Math.floor(n-m);p<1&&(p=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var v=Math.floor(t-m);v<1&&(v=1);t=Math.floor(t+m);t>this.size-1&&(t=this.size-1);var u=Math.floor(o-m);u<1&&(u=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
|
|
@@ -623,7 +623,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,m=new THREE.Matrix4,n,t,o;g.useTarget=j.useTarget=!1;g.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z=
|
|
|
2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},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 w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);p.width=b;p.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||t!==e.near||o!==e.fov){n=e.aspect;t=e.near;o=e.fov;var y=e.projectionMatrix.clone(),G=125/30*0.5,B=G*t/125,L=t*Math.tan(o*Math.PI/360),E;h.n14=G;m.n14=-G;G=-L*n+B;E=L*n+B;y.n11=2*t/(E-G);y.n13=(E+G)/(E-G);g.projectionMatrix=y.clone();G=-L*n-B;E=L*n-B;y.n11=2*t/(E-G);
|
|
|
-y.n13=(E+G)/(E-G);j.projectionMatrix=y.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=t;g.far=e.far;f.call(c,b,g,p,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=t;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,w,u)}};
|
|
|
+var w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);p.width=b;p.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||t!==e.near||o!==e.fov){n=e.aspect;t=e.near;o=e.fov;var y=e.projectionMatrix.clone(),G=125/30*0.5,B=G*t/125,L=t*Math.tan(o*Math.PI/360),F;h.n14=G;m.n14=-G;G=-L*n+B;F=L*n+B;y.n11=2*t/(F-G);y.n13=(F+G)/(F-G);g.projectionMatrix=y.clone();G=-L*n-B;F=L*n-B;y.n11=2*t/(F-G);
|
|
|
+y.n13=(F+G)/(F-G);j.projectionMatrix=y.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=t;g.far=e.far;f.call(c,b,g,p,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=t;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,w,u)}};
|
|
|
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,m=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);m.projectionMatrix=h.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,j);f.call(c,b,h);this.setViewport(g,0,g,j);f.call(c,b,m,!1)}};
|