diff --git a/build/Three.js b/build/Three.js index cf1e8cae47c842a1801e433b3b48f0aaea5c4460..cb2bbeb8154d2a917b77f7ed7146cab5f37cf50d 100644 --- a/build/Three.js +++ b/build/Three.js @@ -27,7 +27,7 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n, c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=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)*h; b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;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,h=b.n13,m=b.n14,k=b.n21,n=b.n22,u=b.n23,p=b.n24,v=b.n31,t=b.n32,x=b.n33,w=b.n34,z=b.n41,y=b.n42,A=b.n43,E=b.n44,D=c.n11,G=c.n12, -I=c.n13,N=c.n14,P=c.n21,J=c.n22,H=c.n23,K=c.n24,Y=c.n31,C=c.n32,R=c.n33,O=c.n34,U=c.n41,V=c.n42,o=c.n43,ea=c.n44;this.n11=e*D+f*P+h*Y+m*U;this.n12=e*G+f*J+h*C+m*V;this.n13=e*I+f*H+h*R+m*o;this.n14=e*N+f*K+h*O+m*ea;this.n21=k*D+n*P+u*Y+p*U;this.n22=k*G+n*J+u*C+p*V;this.n23=k*I+n*H+u*R+p*o;this.n24=k*N+n*K+u*O+p*ea;this.n31=v*D+t*P+x*Y+w*U;this.n32=v*G+t*J+x*C+w*V;this.n33=v*I+t*H+x*R+w*o;this.n34=v*N+t*K+x*O+w*ea;this.n41=z*D+y*P+A*Y+E*U;this.n42=z*G+y*J+A*C+E*V;this.n43=z*I+y*H+A*R+E*o;this.n44=z* +I=c.n13,N=c.n14,P=c.n21,J=c.n22,H=c.n23,K=c.n24,Z=c.n31,C=c.n32,R=c.n33,O=c.n34,V=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*D+f*P+h*Z+m*V;this.n12=e*G+f*J+h*C+m*W;this.n13=e*I+f*H+h*R+m*o;this.n14=e*N+f*K+h*O+m*ea;this.n21=k*D+n*P+u*Z+p*V;this.n22=k*G+n*J+u*C+p*W;this.n23=k*I+n*H+u*R+p*o;this.n24=k*N+n*K+u*O+p*ea;this.n31=v*D+t*P+x*Z+w*V;this.n32=v*G+t*J+x*C+w*W;this.n33=v*I+t*H+x*R+w*o;this.n34=v*N+t*K+x*O+w*ea;this.n41=z*D+y*P+A*Z+E*V;this.n42=z*G+y*J+A*C+E*W;this.n43=z*I+y*H+A*R+E*o;this.n44=z* N+y*K+A*O+E*ea;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,h=this.n21,m=this.n22,k=this.n23,n=this.n24,u=this.n31,p=this.n32,v=this.n33,t=this.n34,x=this.n41,w=this.n42,z=this.n43,y=this.n44;return f*k*p*x-e*n*p*x-f*m*v*x+c*n*v*x+e*m*t*x-c*k*t*x-f*k*u*w+e*n*u*w+f*h*v*w-b*n*v*w-e*h*t*w+b*k*t*w+f*m*u*z-c*n*u*z-f*h*p*z+b*n*p*z+c*h*t*z-b*m*t*z-e*m*u*y+c*k*u*y+e*h*p*y-b*k*p*y-c*h* v*y+b*m*v*y},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= @@ -55,21 +55,21 @@ b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:fu this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),fo&&k.positionScreen.z0&&J.z<1))aa=G[D]=G[D]||new THREE.RenderableParticle,D++,E=aa,E.x=J.x/J.w,E.y=J.y/J.w,E.z=J.z,E.rotation= -Z.rotation.z,E.scale.x=Z.scale.x*Math.abs(E.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),E.scale.y=Z.scale.y*Math.abs(E.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),E.materials=Z.materials,N.push(E);m&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)}; +H=new THREE.Matrix4,K=new THREE.Matrix4,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){H.multiply(e.projectionMatrix,e.matrixWorldInverse);H.multiplyVector3(b);return b};this.unprojectVector=function(b,e){H.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));H.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var o,n;h=I.length=0; +o=b.objects;b=0;for(e=o.length;bo&&k.positionScreen.z0&&J.z<1))fa=G[D]=G[D]||new THREE.RenderableParticle,D++,E=fa,E.x=J.x/J.w,E.y=J.y/J.w,E.z=J.z,E.rotation= +T.rotation.z,E.scale.x=T.scale.x*Math.abs(E.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),E.scale.y=T.scale.y*Math.abs(E.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),E.materials=T.materials,N.push(E);m&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),m=Math.cos(e),e=Math.sin(e),k=b*c,n=f*h;this.w=k*m-n*e;this.x=k*e+n*m;this.y=f*c*m+b*h*e;this.z=b*h*m-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e); this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c= this.x,e=this.y,f=this.z,h=this.w,m=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+h*m+e*n-f*k;this.y=e*b+h*k+f*m-c*n;this.z=f*b+h*n+c*k-e*m;this.w=h*b-c*m-e*k-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,m=this.x,k=this.y,n=this.z,u=this.w,p=u*e+k*h-n*f,v=u*f+n*e-m*h,t=u*h+m*f-k*e,e=-m* -e-k*f-n*h;c.x=p*u+e*-m+v*-n-t*-k;c.y=v*u+e*-k+t*-m-p*-n;c.z=t*u+e*-n+p*-k-v*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.001)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e}; +e-k*f-n*h;c.x=p*u+e*-m+v*-n-t*-k;c.y=v*u+e*-k+t*-m-p*-n;c.z=t*u+e*-n+p*-k-v*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e}; THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,m){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,c,e,f,h,m,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; @@ -79,9 +79,9 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid e,f,h,m,k,n=new THREE.Vector3,u=new THREE.Vector3;f=0;for(h=this.faces.length;f0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, +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,h,m,o){n=b.vertices[e].position;u=b.vertices[c].position;p=b.vertices[f].position;v=k[h];t=k[m];x=k[o];w=u.x-n.x;z=p.x-n.x;y=u.y-n.y;A=p.y-n.y;E=u.z-n.z;D=p.z-n.z;G=t.u-v.u;I=x.u-v.u;N=t.v-v.v;P=x.v-v.v;J=1/(G*P-I*N);C.set((P*w-N*z)*J,(P*y-N*A)*J,(P*E-N*D)*J);R.set((G*z-I*w)*J,(G*A-I*y)*J,(G*D-I*E)*J);K[e].addSelf(C);K[c].addSelf(C);K[f].addSelf(C);Z[e].addSelf(R); +Z[c].addSelf(R);Z[f].addSelf(R)}var c,e,f,h,m,k,n,u,p,v,t,x,w,z,y,A,E,D,G,I,N,P,J,H,K=[],Z=[],C=new THREE.Vector3,R=new THREE.Vector3,O=new THREE.Vector3,V=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c0){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;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+ -","+Math.floor(z.b*255)+","+y+")"),w.fillRect(Math.floor(ha.getX()),Math.floor(ha.getY()),Math.floor(ha.getWidth()),Math.floor(ha.getHeight()))),ha.empty())};this.render=function(b,u){function p(b){var e,c,f,k=b.lights;ia.setRGB(0,0,0);ya.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b>1,v=ja.height>>1,m=k.scale.x*t,u=k.scale.y*x,o=m*p,n=u*v,W.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(W)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-u),w.translate(-p,-v),w.drawImage(ja,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,W.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(W)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(o,n),m.program(w), -w.restore()))}function y(b,k,h,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(I!=b)w.lineWidth=I=b;b=m.linecap;if(N!=b)w.lineCap=N=b;b=m.linejoin;if(P!=b)w.lineJoin=P=b;f(m.color.getContextStyle());w.stroke();W.inflate(m.linewidth*2)}}function A(b,f,k,h,n,t,ja,p,w){m.info.render.vertices+=3;m.info.render.faces++;c(p.opacity);e(p.blending); -O=b.positionScreen.x;U=b.positionScreen.y;V=f.positionScreen.x;o=f.positionScreen.y;ea=k.positionScreen.x;S=k.positionScreen.y;D(O,U,V,o,ea,S);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=ja.uvs[0],$a(O,U,V,o,ea,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[t].u,ua[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,pa.copy(ja.vertexNormalsWorld[0]),ta=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+ -0.5,Ba=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(ja.vertexNormalsWorld[1]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,va=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(ja.vertexNormalsWorld[2]),Aa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Ea=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,$a(O,U,V,o,ea,S,ta,Ba,Ca,va,Aa,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&& -!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ua=ja.uvs[0],$a(O,U,V,o,ea,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[t].u,ua[t].v,p.map)),e(THREE.SubtractiveBlending)),M?!p.wireframe&&p.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==3?(T.r=Z.r=aa.r=ia.r,T.g=Z.g=aa.g=ia.g,T.b=Z.b=aa.b=ia.b,v(w,ja.v1.positionWorld,ja.vertexNormalsWorld[0],T),v(w,ja.v2.positionWorld,ja.vertexNormalsWorld[1],Z),v(w,ja.v3.positionWorld,ja.vertexNormalsWorld[2],aa),T.r=Math.max(0,Math.min(p.color.r*T.r, -1)),T.g=Math.max(0,Math.min(p.color.g*T.g,1)),T.b=Math.max(0,Math.min(p.color.b*T.b,1)),Z.r=Math.max(0,Math.min(p.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(p.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(p.color.b*Z.b,1)),aa.r=Math.max(0,Math.min(p.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(p.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(p.color.b*aa.b,1)),ga.r=(Z.r+aa.r)*0.5,ga.g=(Z.g+aa.g)*0.5,ga.b=(Z.b+aa.b)*0.5,oa=Xa(T,Z,aa,ga),Sa(O,U,V,o,ea,S,0,0,1,0,0,1,oa)):(ra.r=ia.r,ra.g=ia.g,ra.b=ia.b,v(w,ja.centroidWorld, -ja.normalWorld,ra),fa.r=Math.max(0,Math.min(p.color.r*ra.r,1)),fa.g=Math.max(0,Math.min(p.color.g*ra.g,1)),fa.b=Math.max(0,Math.min(p.color.b*ra.b,1)),p.wireframe?Ia(fa,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(fa)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,T.r=T.g=T.b=1-Na(b.positionScreen.z,la,ca),Z.r=Z.g=Z.b=1-Na(f.positionScreen.z,la,ca),aa.r=aa.g=aa.b=1- -Na(k.positionScreen.z,la,ca),ga.r=(Z.r+aa.r)*0.5,ga.g=(Z.g+aa.g)*0.5,ga.b=(Z.b+aa.b)*0.5,oa=Xa(T,Z,aa,ga),Sa(O,U,V,o,ea,S,0,0,1,0,0,1,oa);else if(p instanceof THREE.MeshNormalMaterial)fa.r=Ta(ja.normalWorld.x),fa.g=Ta(ja.normalWorld.y),fa.b=Ta(ja.normalWorld.z),p.wireframe?Ia(fa,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(fa)}function E(b,f,k,h,n,p,ja,t,w){m.info.render.vertices+=4;m.info.render.faces++;c(t.opacity);e(t.blending);if(t.map||t.envMap)A(b,f,h,0,1,3,ja,t,w),A(n,k, -p,1,2,3,ja,t,w);else if(O=b.positionScreen.x,U=b.positionScreen.y,V=f.positionScreen.x,o=f.positionScreen.y,ea=k.positionScreen.x,S=k.positionScreen.y,na=h.positionScreen.x,$=h.positionScreen.y,qa=n.positionScreen.x,ka=n.positionScreen.y,ma=p.positionScreen.x,da=p.positionScreen.y,t instanceof THREE.MeshBasicMaterial)G(O,U,V,o,ea,S,na,$),t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color);else if(t instanceof THREE.MeshLambertMaterial)M?!t.wireframe&&t.shading== -THREE.SmoothShading&&ja.vertexNormalsWorld.length==4?(T.r=Z.r=aa.r=ga.r=ia.r,T.g=Z.g=aa.g=ga.g=ia.g,T.b=Z.b=aa.b=ga.b=ia.b,v(w,ja.v1.positionWorld,ja.vertexNormalsWorld[0],T),v(w,ja.v2.positionWorld,ja.vertexNormalsWorld[1],Z),v(w,ja.v4.positionWorld,ja.vertexNormalsWorld[3],aa),v(w,ja.v3.positionWorld,ja.vertexNormalsWorld[2],ga),T.r=Math.max(0,Math.min(t.color.r*T.r,1)),T.g=Math.max(0,Math.min(t.color.g*T.g,1)),T.b=Math.max(0,Math.min(t.color.b*T.b,1)),Z.r=Math.max(0,Math.min(t.color.r*Z.r,1)), -Z.g=Math.max(0,Math.min(t.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(t.color.b*Z.b,1)),aa.r=Math.max(0,Math.min(t.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(t.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(t.color.b*aa.b,1)),ga.r=Math.max(0,Math.min(t.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(t.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(t.color.b*ga.b,1)),oa=Xa(T,Z,aa,ga),D(O,U,V,o,na,$),Sa(O,U,V,o,na,$,0,0,1,0,0,1,oa),D(qa,ka,ea,S,ma,da),Sa(qa,ka,ea,S,ma,da,1,0,1,1,0,1,oa)):(ra.r=ia.r,ra.g=ia.g,ra.b=ia.b, -v(w,ja.centroidWorld,ja.normalWorld,ra),fa.r=Math.max(0,Math.min(t.color.r*ra.r,1)),fa.g=Math.max(0,Math.min(t.color.g*ra.g,1)),fa.b=Math.max(0,Math.min(t.color.b*ra.b,1)),G(O,U,V,o,ea,S,na,$),t.wireframe?Ia(fa,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(fa)):(G(O,U,V,o,ea,S,na,$),t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color));else if(t instanceof THREE.MeshNormalMaterial)fa.r=Ta(ja.normalWorld.x),fa.g=Ta(ja.normalWorld.y),fa.b= -Ta(ja.normalWorld.z),G(O,U,V,o,ea,S,na,$),t.wireframe?Ia(fa,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(fa);else if(t instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,T.r=T.g=T.b=1-Na(b.positionScreen.z,la,ca),Z.r=Z.g=Z.b=1-Na(f.positionScreen.z,la,ca),aa.r=aa.g=aa.b=1-Na(h.positionScreen.z,la,ca),ga.r=ga.g=ga.b=1-Na(k.positionScreen.z,la,ca),oa=Xa(T,Z,aa,ga),D(O,U,V,o,na,$),Sa(O,U,V,o,na,$,0,0,1,0,0,1,oa),D(qa,ka,ea,S,ma,da),Sa(qa,ka,ea,S,ma,da,1,0,1,1,0,1,oa)}function D(b, -e,c,f,k,h){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,k,h,m,o){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(m,o);w.lineTo(b,e);w.closePath()}function Ia(b,e,c,k){if(I!=e)w.lineWidth=I=e;if(N!=c)w.lineCap=N=c;if(P!=k)w.lineJoin=P=k;f(b.getContextStyle());w.stroke();W.inflate(e*2)}function Ja(b){h(b.getContextStyle());w.fill()}function $a(b,e,c,f,k,m,o,n,t,p,ja,u,v){if(v.image.width!=0){if(v.needsUpdate==!0||sa[v.id]==void 0){var x= -v.wrapS==THREE.RepeatWrapping,Ma=v.wrapT==THREE.RepeatWrapping;sa[v.id]=w.createPattern(v.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");v.needsUpdate=!1}h(sa[v.id]);var x=v.offset.x/v.repeat.x,Ma=v.offset.y/v.repeat.y,L=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,o=(o+x)*L,n=(n+Ma)*v,t=(t+x)*L,p=(p+Ma)*v,ja=(ja+x)*L,u=(u+Ma)*v;c-=b;f-=e;k-=b;m-=e;t-=o;p-=n;ja-=o;u-=n;x=1/(t*u-ja*p);v=(u*c-p*k)*x;p=(u*f-p*m)*x;c=(t*k-ja*c)*x;f=(t*m-ja*f)*x;b=b-v*o-c*n;e=e-p* -o-f*n;w.save();w.transform(v,p,c,f,b,e);w.fill();w.restore()}}function Sa(b,e,c,f,k,h,m,o,n,t,p,ja,u){var v,x;v=u.width-1;x=u.height-1;m*=v;o*=x;n*=v;t*=x;p*=v;ja*=x;c-=b;f-=e;k-=b;h-=e;n-=m;t-=o;p-=m;ja-=o;x=1/(n*ja-p*t);v=(ja*c-t*k)*x;t=(ja*f-t*h)*x;c=(n*k-p*c)*x;f=(n*h-p*f)*x;b=b-v*m-c*o;e=e-t*m-f*o;w.save();w.transform(v,t,c,f,b,e);w.clip();w.drawImage(u,0,0);w.restore()}function Xa(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255), -t=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);ja[0]=k<0?0:k>255?255:k;ja[1]=h<0?0:h>255?255:h;ja[2]=b<0?0:b>255?255:b;ja[4]=m<0?0:m>255?255:m;ja[5]=o<0?0:o>255?255:o;ja[6]=e<0?0:e>255?255:e;ja[8]=n<0?0:n>255?255:n;ja[9]=t<0?0:t>255?255:t;ja[10]=c<0?0:c>255?255:c;ja[12]=p<0?0:p>255?255:p;ja[13]=u<0?0:u>255?255:u;ja[14]=f<0?0:f>255?255:f;X.putImageData(Fa,0,0);Wa.drawImage(za,0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ta(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,k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ya,db,wa,Da,La,Ua,Za,F;this.autoClear?this.clear():w.setTransform(1,0,0,-1,t,x);m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,u,this.sortElements);(M=b.lights.length>0)&&p(b);Ya=0;for(db=k.length;Ya0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(Y.sub(h.position,e.centroidWorld),Y.normalize(),m=e.normalWorld.dot(Y)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,t){m.info.render.vertices+=3;m.info.render.faces++;O=f(U++); +p,v,t,x,w=u.getContext("2d"),z=new THREE.Color(0),y=0,A=1,E=0,D=null,G=null,I=null,N=null,P=null,J,H,K,Z,C=new THREE.RenderableVertex,R=new THREE.RenderableVertex,O,V,W,o,ea,S,ta,aa,ka,ja,ma,da,$=new THREE.Color(0),U=new THREE.Color(0),T=new THREE.Color(0),fa=new THREE.Color(0),na=new THREE.Color(0),sa=[],la,ca,qa,ua,ra,ya,Ca,va,Ba,Ea,L=new THREE.Rectangle,ga=new THREE.Rectangle,X=new THREE.Rectangle,M=!1,pa=new THREE.Color,ha=new THREE.Color,za=new THREE.Color,xa=new THREE.Color,oa=new THREE.Vector3, +Aa,Y,Fa,ia,Va,Wa,b=16;Aa=document.createElement("canvas");Aa.width=Aa.height=2;Y=Aa.getContext("2d");Y.fillStyle="rgba(0,0,0,1)";Y.fillRect(0,0,2,2);Fa=Y.getImageData(0,0,2,2);ia=Fa.data;Va=document.createElement("canvas");Va.width=Va.height=b;Wa=Va.getContext("2d");Wa.translate(-b/2,-b/2);Wa.scale(b,b);b--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,e){p=b;v=e;t=Math.floor(p/2);x=Math.floor(v/2);u.width=p; +u.height=v;L.set(-t,-x,t,x);ga.set(-t,-x,t,x);A=1;E=0;P=N=I=G=D=null};this.setClearColor=function(b,e){z.copy(b);y=e;ga.set(-t,-x,t,x)};this.setClearColorHex=function(b,e){z.setHex(b);y=e;ga.set(-t,-x,t,x)};this.clear=function(){w.setTransform(1,0,0,-1,t,x);ga.isEmpty()||(ga.minSelf(L),ga.inflate(2),y<1&&w.clearRect(Math.floor(ga.getX()),Math.floor(ga.getY()),Math.floor(ga.getWidth()),Math.floor(ga.getHeight())),y>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+ +","+Math.floor(z.b*255)+","+y+")"),w.fillRect(Math.floor(ga.getX()),Math.floor(ga.getY()),Math.floor(ga.getWidth()),Math.floor(ga.getHeight()))),ga.empty())};this.render=function(b,u){function p(b){var e,c,f,k=b.lights;ha.setRGB(0,0,0);za.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b>1,v=ia.height>>1,m=k.scale.x*t,u=k.scale.y*x,o=m*p,n=u*v,X.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(X)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-u),w.translate(-p,-v),w.drawImage(ia,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,X.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(X)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(o,n),m.program(w), +w.restore()))}function y(b,k,h,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(I!=b)w.lineWidth=I=b;b=m.linecap;if(N!=b)w.lineCap=N=b;b=m.linejoin;if(P!=b)w.lineJoin=P=b;f(m.color.getContextStyle());w.stroke();X.inflate(m.linewidth*2)}}function A(b,f,k,h,n,t,ia,p,w){m.info.render.vertices+=3;m.info.render.faces++;c(p.opacity);e(p.blending); +O=b.positionScreen.x;V=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ea=k.positionScreen.x;S=k.positionScreen.y;D(O,V,W,o,ea,S);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=ia.uvs[0],$a(O,V,W,o,ea,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[t].u,ua[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,oa.copy(ia.vertexNormalsWorld[0]),ra=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+ +0.5,ya=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ia.vertexNormalsWorld[1]),Ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,va=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ia.vertexNormalsWorld[2]),Ba=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ea=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,$a(O,V,W,o,ea,S,ra,ya,Ca,va,Ba,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&& +!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ua=ia.uvs[0],$a(O,V,W,o,ea,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[t].u,ua[t].v,p.map)),e(THREE.SubtractiveBlending)),M?!p.wireframe&&p.shading==THREE.SmoothShading&&ia.vertexNormalsWorld.length==3?(U.r=T.r=fa.r=ha.r,U.g=T.g=fa.g=ha.g,U.b=T.b=fa.b=ha.b,v(w,ia.v1.positionWorld,ia.vertexNormalsWorld[0],U),v(w,ia.v2.positionWorld,ia.vertexNormalsWorld[1],T),v(w,ia.v3.positionWorld,ia.vertexNormalsWorld[2],fa),U.r=Math.max(0,Math.min(p.color.r*U.r, +1)),U.g=Math.max(0,Math.min(p.color.g*U.g,1)),U.b=Math.max(0,Math.min(p.color.b*U.b,1)),T.r=Math.max(0,Math.min(p.color.r*T.r,1)),T.g=Math.max(0,Math.min(p.color.g*T.g,1)),T.b=Math.max(0,Math.min(p.color.b*T.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),na.r=(T.r+fa.r)*0.5,na.g=(T.g+fa.g)*0.5,na.b=(T.b+fa.b)*0.5,qa=Xa(U,T,fa,na),Sa(O,V,W,o,ea,S,0,0,1,0,0,1,qa)):(pa.r=ha.r,pa.g=ha.g,pa.b=ha.b,v(w,ia.centroidWorld, +ia.normalWorld,pa),$.r=Math.max(0,Math.min(p.color.r*pa.r,1)),$.g=Math.max(0,Math.min(p.color.g*pa.g,1)),$.b=Math.max(0,Math.min(p.color.b*pa.b,1)),p.wireframe?Ia($,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja($)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,la,ca),T.r=T.g=T.b=1-Na(f.positionScreen.z,la,ca),fa.r=fa.g=fa.b=1-Na(k.positionScreen.z, +la,ca),na.r=(T.r+fa.r)*0.5,na.g=(T.g+fa.g)*0.5,na.b=(T.b+fa.b)*0.5,qa=Xa(U,T,fa,na),Sa(O,V,W,o,ea,S,0,0,1,0,0,1,qa);else if(p instanceof THREE.MeshNormalMaterial)$.r=Ta(ia.normalWorld.x),$.g=Ta(ia.normalWorld.y),$.b=Ta(ia.normalWorld.z),p.wireframe?Ia($,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja($)}function E(b,f,k,h,n,p,ia,t,w){m.info.render.vertices+=4;m.info.render.faces++;c(t.opacity);e(t.blending);if(t.map||t.envMap)A(b,f,h,0,1,3,ia,t,w),A(n,k,p,1,2,3,ia,t,w);else if(O=b.positionScreen.x, +V=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ea=k.positionScreen.x,S=k.positionScreen.y,ta=h.positionScreen.x,aa=h.positionScreen.y,ka=n.positionScreen.x,ja=n.positionScreen.y,ma=p.positionScreen.x,da=p.positionScreen.y,t instanceof THREE.MeshBasicMaterial)G(O,V,W,o,ea,S,ta,aa),t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color);else if(t instanceof THREE.MeshLambertMaterial)M?!t.wireframe&&t.shading==THREE.SmoothShading&&ia.vertexNormalsWorld.length== +4?(U.r=T.r=fa.r=na.r=ha.r,U.g=T.g=fa.g=na.g=ha.g,U.b=T.b=fa.b=na.b=ha.b,v(w,ia.v1.positionWorld,ia.vertexNormalsWorld[0],U),v(w,ia.v2.positionWorld,ia.vertexNormalsWorld[1],T),v(w,ia.v4.positionWorld,ia.vertexNormalsWorld[3],fa),v(w,ia.v3.positionWorld,ia.vertexNormalsWorld[2],na),U.r=Math.max(0,Math.min(t.color.r*U.r,1)),U.g=Math.max(0,Math.min(t.color.g*U.g,1)),U.b=Math.max(0,Math.min(t.color.b*U.b,1)),T.r=Math.max(0,Math.min(t.color.r*T.r,1)),T.g=Math.max(0,Math.min(t.color.g*T.g,1)),T.b=Math.max(0, +Math.min(t.color.b*T.b,1)),fa.r=Math.max(0,Math.min(t.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(t.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(t.color.b*fa.b,1)),na.r=Math.max(0,Math.min(t.color.r*na.r,1)),na.g=Math.max(0,Math.min(t.color.g*na.g,1)),na.b=Math.max(0,Math.min(t.color.b*na.b,1)),qa=Xa(U,T,fa,na),D(O,V,W,o,ta,aa),Sa(O,V,W,o,ta,aa,0,0,1,0,0,1,qa),D(ka,ja,ea,S,ma,da),Sa(ka,ja,ea,S,ma,da,1,0,1,1,0,1,qa)):(pa.r=ha.r,pa.g=ha.g,pa.b=ha.b,v(w,ia.centroidWorld,ia.normalWorld,pa),$.r=Math.max(0, +Math.min(t.color.r*pa.r,1)),$.g=Math.max(0,Math.min(t.color.g*pa.g,1)),$.b=Math.max(0,Math.min(t.color.b*pa.b,1)),G(O,V,W,o,ea,S,ta,aa),t.wireframe?Ia($,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja($)):(G(O,V,W,o,ea,S,ta,aa),t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color));else if(t instanceof THREE.MeshNormalMaterial)$.r=Ta(ia.normalWorld.x),$.g=Ta(ia.normalWorld.y),$.b=Ta(ia.normalWorld.z),G(O,V,W,o,ea,S,ta,aa),t.wireframe?Ia($, +t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja($);else if(t instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,la,ca),T.r=T.g=T.b=1-Na(f.positionScreen.z,la,ca),fa.r=fa.g=fa.b=1-Na(h.positionScreen.z,la,ca),na.r=na.g=na.b=1-Na(k.positionScreen.z,la,ca),qa=Xa(U,T,fa,na),D(O,V,W,o,ta,aa),Sa(O,V,W,o,ta,aa,0,0,1,0,0,1,qa),D(ka,ja,ea,S,ma,da),Sa(ka,ja,ea,S,ma,da,1,0,1,1,0,1,qa)}function D(b,e,c,f,k,h){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k, +h);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,k,h,m,o){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(m,o);w.lineTo(b,e);w.closePath()}function Ia(b,e,c,k){if(I!=e)w.lineWidth=I=e;if(N!=c)w.lineCap=N=c;if(P!=k)w.lineJoin=P=k;f(b.getContextStyle());w.stroke();X.inflate(e*2)}function Ja(b){h(b.getContextStyle());w.fill()}function $a(b,e,c,f,k,m,o,n,t,p,ia,u,v){if(v.image.width!=0){if(v.needsUpdate==!0||sa[v.id]==void 0){var x=v.wrapS==THREE.RepeatWrapping,Ma=v.wrapT==THREE.RepeatWrapping; +sa[v.id]=w.createPattern(v.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");v.needsUpdate=!1}h(sa[v.id]);var x=v.offset.x/v.repeat.x,Ma=v.offset.y/v.repeat.y,L=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,o=(o+x)*L,n=(n+Ma)*v,t=(t+x)*L,p=(p+Ma)*v,ia=(ia+x)*L,u=(u+Ma)*v;c-=b;f-=e;k-=b;m-=e;t-=o;p-=n;ia-=o;u-=n;x=1/(t*u-ia*p);v=(u*c-p*k)*x;p=(u*f-p*m)*x;c=(t*k-ia*c)*x;f=(t*m-ia*f)*x;b=b-v*o-c*n;e=e-p*o-f*n;w.save();w.transform(v,p,c,f,b,e);w.fill();w.restore()}} +function Sa(b,e,c,f,k,h,m,o,n,t,p,ia,u){var v,x;v=u.width-1;x=u.height-1;m*=v;o*=x;n*=v;t*=x;p*=v;ia*=x;c-=b;f-=e;k-=b;h-=e;n-=m;t-=o;p-=m;ia-=o;x=1/(n*ia-p*t);v=(ia*c-t*k)*x;t=(ia*f-t*h)*x;c=(n*k-p*c)*x;f=(n*h-p*f)*x;b=b-v*m-c*o;e=e-t*m-f*o;w.save();w.transform(v,t,c,f,b,e);w.clip();w.drawImage(u,0,0);w.restore()}function Xa(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),t=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b* +255);ia[0]=k<0?0:k>255?255:k;ia[1]=h<0?0:h>255?255:h;ia[2]=b<0?0:b>255?255:b;ia[4]=m<0?0:m>255?255:m;ia[5]=o<0?0:o>255?255:o;ia[6]=e<0?0:e>255?255:e;ia[8]=n<0?0:n>255?255:n;ia[9]=t<0?0:t>255?255:t;ia[10]=c<0?0:c>255?255:c;ia[12]=p<0?0:p>255?255:p;ia[13]=u<0?0:u>255?255:u;ia[14]=f<0?0:f>255?255:f;Y.putImageData(Fa,0,0);Wa.drawImage(Aa,0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ta(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,k=c*c+f*f; +k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ya,db,wa,Da,La,Ua,Za,F;this.autoClear?this.clear():w.setTransform(1,0,0,-1,t,x);m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,u,this.sortElements);(M=b.lights.length>0)&&p(b);Ya=0;for(db=k.length;Ya0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(Z.sub(h.position,e.centroidWorld),Z.normalize(),m=e.normalWorld.dot(Z)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,t){m.info.render.vertices+=3;m.info.render.faces++;O=f(V++); O.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?I.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(N.r=P.r,N.g=P.g,N.b=P.b,b(t,o,N),I.r=Math.max(0,Math.min(n.color.r*N.r,1)),I.g=Math.max(0,Math.min(n.color.g*N.g,1)),I.b=Math.max(0,Math.min(n.color.b*N.b,1))):I.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear- o.z*n.__farMinusNear),I.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?O.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):O.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+n.opacity);u.appendChild(O)}function e(e,c,k,o,n,t,p){m.info.render.vertices+= -4;m.info.render.faces++;O=f(U++);O.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?I.copy(t.color):t instanceof THREE.MeshLambertMaterial?G?(N.r=P.r,N.g=P.g,N.b=P.b,b(p,n,N),I.r=Math.max(0,Math.min(t.color.r*N.r,1)),I.g=Math.max(0,Math.min(t.color.g*N.g,1)),I.b=Math.max(0,Math.min(t.color.b*N.b,1))): +4;m.info.render.faces++;O=f(V++);O.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?I.copy(t.color):t instanceof THREE.MeshLambertMaterial?G?(N.r=P.r,N.g=P.g,N.b=P.b,b(p,n,N),I.r=Math.max(0,Math.min(t.color.r*N.r,1)),I.g=Math.max(0,Math.min(t.color.g*N.g,1)),I.b=Math.max(0,Math.min(t.color.b*N.b,1))): I.copy(t.color):t instanceof THREE.MeshDepthMaterial?(K=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),I.setRGB(K,K,K)):t instanceof THREE.MeshNormalMaterial&&I.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?O.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):O.setAttribute("style","fill: "+I.getContextStyle()+ "; fill-opacity: "+t.opacity);u.appendChild(O)}function f(b){C[b]==null&&(C[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&C[b].setAttribute("shape-rendering","crispEdges"));return C[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,v,t,x,w,z,y,A,E=new THREE.Rectangle,D=new THREE.Rectangle,G=!1,I=new THREE.Color(16777215),N=new THREE.Color(16777215),P=new THREE.Color(0), -J=new THREE.Color(0),H=new THREE.Color(0),K,Y=new THREE.Vector3,C=[],R=[],O,U,V,o=1;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){p=b;v=e;t=p/2;x=v/2;u.setAttribute("viewBox",-t+" "+-x+" "+p+" "+v);u.setAttribute("width",p);u.setAttribute("height",v);E.set(-t,-x,t,x)};this.clear=function(){for(;u.childNodes.length>0;)u.removeChild(u.childNodes[0])}; -this.render=function(b,f){var h,p,v,I,N,C,K,T;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);V=U=0;if(G=b.lights.length>0){K=b.lights;P.setRGB(0,0,0);J.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(p=K.length;h0;)u.removeChild(u.childNodes[0])}; +this.render=function(b,f){var h,p,v,I,N,C,K,U;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);W=V=0;if(G=b.lights.length>0){K=b.lights;P.setRGB(0,0,0);J.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(p=K.length;h=0)o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer), o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,t=m.morphTargetForcedOrder,p=m.morphTargetInfluences;fw&&(u=v,w=p[u]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=w;t[u]=1;w=-1;f++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=0&&(c=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n], c.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)): o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB, 4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0));m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,o.UNSIGNED_SHORT,0)):(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES, -h.__webglFaceCount,o.UNSIGNED_SHORT,0)),V.info.render.calls++,V.info.render.vertices+=h.__webglFaceCount,V.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),V.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),V.info.render.calls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),V.info.render.calls++)}} +h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}} function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,t,p,w,u,v,x=b.count* -3;for(v=0;v=0;c--)b[c].object==e&&b.splice(c,1)}function N(b){function e(b){var h=[];c=0;for(f=b.length;c65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:w})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[u])} -function P(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=ka){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA, -o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ka=b}}function H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,U(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,U(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,U(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,U(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,O(e.magFilter)), -o.texParameteri(b,o.TEXTURE_MIN_FILTER,O(e.minFilter)))}function K(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),V.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,U(b.format),b.image.width,b.image.height,0,U(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);H(o.TEXTURE_2D,b,b.image);b.needsUpdate= -!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function Y(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);H(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(), -o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),H(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+ +function P(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=ja){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA, +o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ja=b}}function H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,V(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,V(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,V(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,V(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,O(e.magFilter)), +o.texParameteri(b,o.TEXTURE_MIN_FILTER,O(e.minFilter)))}function K(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.image.width,b.image.height,0,V(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);H(o.TEXTURE_2D,b,b.image);b.needsUpdate= +!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function Z(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);H(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(), +o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),H(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+ c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER, -o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=sa,b=la,f=aa,h=ga);e!=na&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),na=e)}function C(b){b instanceof +o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=sa,b=la,f=fa,h=na);e!=ta&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ta=e)}function C(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function R(b,e){var c;b=="fragment"?c=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,e);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)), -console.error(e),null;return c}function O(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function U(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR; +console.error(e),null;return c}function O(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR; case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA; -case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var V=this,o,ea=[],S=null,na=null,$=null,qa=null,ka=null,ma=null,da=null,fa=null,T=null,Z=null,aa=0,ga=0,sa=0,la=0,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],oa=new THREE.Matrix4,ua=new Float32Array(16),ta=new Float32Array(16),Ba=new THREE.Vector4,Ca= -{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0?b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),W=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0, -geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=va;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 M,ra=[],b=THREE.ShaderLib.depthRGBA,ia=THREE.UniformsUtils.clone(b.uniforms),ya=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader, -vertexShader:b.vertexShader,uniforms:ia}),xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ia,morphTargets:!0});ya._shadowPass=!0;xa._shadowPass=!0;try{if(!(o=va.getContext("experimental-webgl",{antialias:L,stencil:Aa,preserveDrawingBuffer:Ea})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(pa){console.error(pa)}o.clearColor(0, -0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ha.r,ha.g,ha.b,W);this.context=o;var za=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);i=0;X.vertices[i++]=-1;X.vertices[i++]=-1;X.vertices[i++]=0;X.vertices[i++]=1;X.vertices[i++]= -1;X.vertices[i++]=-1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=0;X.vertices[i++]=-1;X.vertices[i++]=1;X.vertices[i++]=0;i=X.vertices[i++]=0;X.faces[i++]=0;X.faces[i++]=1;X.faces[i++]=2;X.faces[i++]=0;X.faces[i++]=2;X.faces[i++]=3;X.vertexBuffer=o.createBuffer();X.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,X.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer); -o.bufferData(o.ELEMENT_ARRAY_BUFFER,X.faces,o.STATIC_DRAW);X.program=o.createProgram();o.attachShader(X.program,R("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(X.program,R("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(X.program);X.attributes={};X.uniforms={};X.attributes.position=o.getAttribLocation(X.program,"position");X.attributes.uv=o.getAttribLocation(X.program,"uv");X.uniforms.uvOffset=o.getUniformLocation(X.program,"uvOffset");X.uniforms.uvScale=o.getUniformLocation(X.program, -"uvScale");X.uniforms.rotation=o.getUniformLocation(X.program,"rotation");X.uniforms.scale=o.getUniformLocation(X.program,"scale");X.uniforms.alignment=o.getUniformLocation(X.program,"alignment");X.uniforms.color=o.getUniformLocation(X.program,"color");X.uniforms.map=o.getUniformLocation(X.program,"map");X.uniforms.opacity=o.getUniformLocation(X.program,"opacity");X.uniforms.useScreenCoordinates=o.getUniformLocation(X.program,"useScreenCoordinates");X.uniforms.affectedByDistance=o.getUniformLocation(X.program, -"affectedByDistance");X.uniforms.screenPosition=o.getUniformLocation(X.program,"screenPosition");X.uniforms.modelViewMatrix=o.getUniformLocation(X.program,"modelViewMatrix");X.uniforms.projectionMatrix=o.getUniformLocation(X.program,"projectionMatrix");var Fa=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){aa=b;ga=e;sa=c;la=f;o.viewport(aa,ga,sa,la)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest= -function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){ha.setHex(b);W=e;o.clearColor(ha.r,ha.g,ha.b,W)};this.setClearColor=function(b,e){ha.copy(b);W=e;o.clearColor(ha.r,ha.g,ha.b,W)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return W};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit= +case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var W=this,o,ea=[],S=null,ta=null,aa=null,ka=null,ja=null,ma=null,da=null,$=null,U=null,T=null,fa=0,na=0,sa=0,la=0,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Matrix4,ua=new Float32Array(16),ra=new Float32Array(16),ya=new THREE.Vector4,Ca= +{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ba=b.stencil!==void 0?b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,ga=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),X=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0, +geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=va;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 M,pa=[],b=THREE.ShaderLib.depthRGBA,ha=THREE.UniformsUtils.clone(b.uniforms),za=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader, +vertexShader:b.vertexShader,uniforms:ha}),xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ha,morphTargets:!0});za._shadowPass=!0;xa._shadowPass=!0;try{if(!(o=va.getContext("experimental-webgl",{antialias:L,stencil:Ba,preserveDrawingBuffer:Ea})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(oa){console.error(oa)}o.clearColor(0, +0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ga.r,ga.g,ga.b,X);this.context=o;var Aa=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,Y={};Y.vertices=new Float32Array(16);Y.faces=new Uint16Array(6);i=0;Y.vertices[i++]=-1;Y.vertices[i++]=-1;Y.vertices[i++]=0;Y.vertices[i++]=1;Y.vertices[i++]= +1;Y.vertices[i++]=-1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=0;Y.vertices[i++]=-1;Y.vertices[i++]=1;Y.vertices[i++]=0;i=Y.vertices[i++]=0;Y.faces[i++]=0;Y.faces[i++]=1;Y.faces[i++]=2;Y.faces[i++]=0;Y.faces[i++]=2;Y.faces[i++]=3;Y.vertexBuffer=o.createBuffer();Y.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,Y.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,Y.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Y.elementBuffer); +o.bufferData(o.ELEMENT_ARRAY_BUFFER,Y.faces,o.STATIC_DRAW);Y.program=o.createProgram();o.attachShader(Y.program,R("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(Y.program,R("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(Y.program);Y.attributes={};Y.uniforms={};Y.attributes.position=o.getAttribLocation(Y.program,"position");Y.attributes.uv=o.getAttribLocation(Y.program,"uv");Y.uniforms.uvOffset=o.getUniformLocation(Y.program,"uvOffset");Y.uniforms.uvScale=o.getUniformLocation(Y.program, +"uvScale");Y.uniforms.rotation=o.getUniformLocation(Y.program,"rotation");Y.uniforms.scale=o.getUniformLocation(Y.program,"scale");Y.uniforms.alignment=o.getUniformLocation(Y.program,"alignment");Y.uniforms.color=o.getUniformLocation(Y.program,"color");Y.uniforms.map=o.getUniformLocation(Y.program,"map");Y.uniforms.opacity=o.getUniformLocation(Y.program,"opacity");Y.uniforms.useScreenCoordinates=o.getUniformLocation(Y.program,"useScreenCoordinates");Y.uniforms.affectedByDistance=o.getUniformLocation(Y.program, +"affectedByDistance");Y.uniforms.screenPosition=o.getUniformLocation(Y.program,"screenPosition");Y.uniforms.modelViewMatrix=o.getUniformLocation(Y.program,"modelViewMatrix");Y.uniforms.projectionMatrix=o.getUniformLocation(Y.program,"projectionMatrix");var Fa=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){fa=b;na=e;sa=c;la=f;o.viewport(fa,na,sa,la)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest= +function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){ga.setHex(b);X=e;o.clearColor(ga.r,ga.g,ga.b,X)};this.setClearColor=function(b,e){ga.copy(b);X=e;o.clearColor(ga.r,ga.g,ga.b,X)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return X};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit= !1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);o.deleteBuffer(e.__webglTangentBuffer);o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer);o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);o.deleteBuffer(e.__webglSkinVertexBBuffer); -o.deleteBuffer(e.__webglSkinIndicesBuffer);o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c=0&&o.enableVertexAttribArray(v.position);v.color>=0&&o.enableVertexAttribArray(v.color);v.normal>=0&&o.enableVertexAttribArray(v.normal);v.tangent>=0&&o.enableVertexAttribArray(v.tangent);b.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(o.enableVertexAttribArray(v.skinVertexA), -o.enableVertexAttribArray(v.skinVertexB),o.enableVertexAttribArray(v.skinIndex),o.enableVertexAttribArray(v.skinWeight));if(b.attributes)for(h in b.attributes)v[h]!==void 0&&v[h]>=0&&o.enableVertexAttribArray(v[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(o.enableVertexAttribArray(v[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){Y(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT); -o.clear(b)};this.render=function(b,c,o,t){var L,W,ha,D,G,I,M,la,H=b.lights,K=b.fog;this.shadowMapEnabled&&y(b,c);V.info.render.calls=0;V.info.render.vertices=0;V.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ta);c.projectionMatrix.flattenToArray(ua);oa.multiply(c.projectionMatrix,c.matrixWorldInverse);p(oa);this.initWebGLObjects(b);Y(o);(this.autoClear||t)&&this.clear();G=b.__webglObjects.length;for(t=0;t=0;t--)if(L=b.__webglObjects[t],L.render){M=L.object;la=L.buffer;ha=L.opaque;m(M); -for(L=0;L=0&&o.enableVertexAttribArray(v.position);v.color>=0&&o.enableVertexAttribArray(v.color);v.normal>=0&&o.enableVertexAttribArray(v.normal);v.tangent>=0&&o.enableVertexAttribArray(v.tangent);b.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(o.enableVertexAttribArray(v.skinVertexA), +o.enableVertexAttribArray(v.skinVertexB),o.enableVertexAttribArray(v.skinIndex),o.enableVertexAttribArray(v.skinWeight));if(b.attributes)for(h in b.attributes)v[h]!==void 0&&v[h]>=0&&o.enableVertexAttribArray(v[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(o.enableVertexAttribArray(v[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){Z(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT); +o.clear(b)};this.render=function(b,c,o,t){var L,X,ga,D,G,I,M,la,H=b.lights,K=b.fog;this.shadowMapEnabled&&y(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ra);c.projectionMatrix.flattenToArray(ua);qa.multiply(c.projectionMatrix,c.matrixWorldInverse);p(qa);this.initWebGLObjects(b);Z(o);(this.autoClear||t)&&this.clear();G=b.__webglObjects.length;for(t=0;t=0;t--)if(L=b.__webglObjects[t],L.render){M=L.object;la=L.buffer;ga=L.opaque;m(M); +for(L=0;L0||x.faceVertexUvs.length> -0)m.__uvArray=new Float32Array(t*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(W*2);if(m.numMorphTargets){m.__morphTargetsArrays= -[];x=0;for(L=m.numMorphTargets;x0||x.faceVertexUvs.length> +0)m.__uvArray=new Float32Array(t*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(X*2);if(m.numMorphTargets){m.__morphTargetsArrays= +[];x=0;for(L=m.numMorphTargets;x=0;k--)f[k]==h&&f.splice(k,1)}else e instanceof THREE.MarchingCubes&&I(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,xa,z));Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,fa,z));ab&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ga,z));Aa&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER, -ka,z));Aa&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,qa,z));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,za,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,na,z));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,$,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ta,z),o.bindBuffer(o.ARRAY_BUFFER, -p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ea,z));W&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets= -!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;G(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=W=W=void 0;w=k.vertices;t=k.colors;u=w.length;p=t.length;L=k.__vertexArray;z=k.__colorArray;y=k.__dirtyColors;if(k.__dirtyVertices){for(W=0;W0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,xa,z));Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ka,z));ab&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,$,z));Ba&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER, +na,z));Ba&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Aa,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,z));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ra,z),o.bindBuffer(o.ARRAY_BUFFER, +p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ea,z));X&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets= +!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;G(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=X=X=void 0;w=k.vertices;t=k.colors;u=w.length;p=t.length;L=k.__vertexArray;z=k.__colorArray;y=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;Xb.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];n=b[e[1]];u=b[e[2]];p=b[e[3]];e=h*h;k=h*e;f[0]=this.interpolate(m[0],n[0],u[0],p[0],h,e,k);f[1]=this.interpolate(m[1],n[1],u[1],p[1],h,e,k);f[2]=this.interpolate(m[2],n[2],u[2],p[2],h,e,k);return f}; THREE.Animation.prototype.interpolate=function(b,c,e,f,h,m,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*m+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]}; -THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed= +THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed= b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!== void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX= this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward= @@ -441,7 +441,7 @@ c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))}; THREE.PathCamera=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),u=m.length,D=0;k=u-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;kb&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(C=b.length;--C>=0;){ma=C;da=C-1;da<0&&(da=b.length- -1);for(var c=0,e=w+v*2,c=0;c=0;O--){U=O/v;V=u*(1-U);U=p*Math.sin(U*Math.PI/2);C=0;for(R=D.length;C=0;O--){V=O/v;W=u*(1-V);V=p*Math.sin(V*Math.PI/2);C=0;for(R=D.length;C0)for(p=0;p2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}u=p;h<=u&&(u=0);p=u+1;h<=p&&(p=0);v=p+1;h<=v&&(v=0);var x;a:{x=b;var w=u,z=p,y=v,A=h,E=k,D=void 0,G=void 0,I=void 0, -N=void 0,P=void 0,J=void 0,H=void 0,K=void 0,Y=void 0,G=x[E[w]].x,I=x[E[w]].y,N=x[E[z]].x,P=x[E[z]].y,J=x[E[y]].x,H=x[E[y]].y;if(1.0E-10>(N-G)*(H-I)-(P-I)*(J-G))x=!1;else{for(D=0;D=0&&O>=0&&V>=0){x=!1;break a}}x= -!0}}if(x){m.push([b[k[u]],b[k[p]],b[k[v]]]);n.push([k[u],k[p],k[v]]);u=p;for(v=p+1;v(N-G)*(H-I)-(P-I)*(J-G))x=!1;else{for(D=0;D=0&&O>=0&&W>=0){x=!1; +break a}}x=!0}}if(x){m.push([b[k[u]],b[k[p]],b[k[v]]]);n.push([k[u],k[p],k[v]]);u=p;for(v=p+1;v>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=v(b,c),f=v(b,c+1),k=v(b,c+2);return(v(b,c+3)<<24)+(k<<16)+(f<<8)+e}function u(b,c){var e=v(b,c);return(v(b,c+1)<<8)+e}function p(b,c){var e=v(b,c);return e>127?e-256:e}function v(b,c){return b.charCodeAt(c)&255}function t(c){var e, -f,k;e=h(b,c);f=h(b,c+P);k=h(b,c+J);c=u(b,c+H);E.faces.push(new THREE.Face3(e,f,k,null,null,E.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+P);k=h(b,c+J);m=u(b,c+H);o=h(b,c+K);p=h(b,c+Y);c=h(b,c+C);m=E.materials[m];var t=I[p*3],v=I[p*3+1];p=I[p*3+2];var w=I[c*3],L=I[c*3+1],c=I[c*3+2];E.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(I[o*3],I[o*3+1],I[o*3+2]),new THREE.Vector3(t,v,p),new THREE.Vector3(w,L,c)],null,m))}function w(c){var e,f,k,m;e=h(b,c);f=h(b,c+R);k=h(b,c+O);m=h(b, -c+U);c=u(b,c+V);E.faces.push(new THREE.Face4(e,f,k,m,null,null,E.materials[c]))}function z(c){var e,f,k,m,p,t,v,w;e=h(b,c);f=h(b,c+R);k=h(b,c+O);m=h(b,c+U);p=u(b,c+V);t=h(b,c+o);v=h(b,c+ea);w=h(b,c+S);c=h(b,c+na);p=E.materials[p];var x=I[v*3],L=I[v*3+1];v=I[v*3+2];var y=I[w*3],W=I[w*3+1];w=I[w*3+2];var z=I[c*3],A=I[c*3+1],c=I[c*3+2];E.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(I[t*3],I[t*3+1],I[t*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(y,W,w),new THREE.Vector3(z,A,c)],null,p))} -function y(c){var e,f,k,m;e=h(b,c);f=h(b,c+$);k=h(b,c+qa);c=N[e*2];m=N[e*2+1];e=N[f*2];var o=E.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function A(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ka);k=h(b,c+ma);m=h(b,c+da);c=N[e*2];o=N[e*2+1];e=N[f*2];p=N[f*2+1];f=N[k*2];var t=E.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f, -k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,D=0,G,I=[],N=[],P,J,H,K,Y,C,R,O,U,V,o,ea,S,na,$,qa,ka,ma,da,fa,T,Z,aa,ga,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,c);G={signature:b.substr(D,8),header_bytes:v(b,D+8),vertex_coordinate_bytes:v(b,D+9),normal_coordinate_bytes:v(b,D+10),uv_coordinate_bytes:v(b,D+11),vertex_index_bytes:v(b,D+12),normal_index_bytes:v(b,D+13),uv_index_bytes:v(b,D+14),material_index_bytes:v(b,D+15),nvertices:h(b,D+16),nnormals:h(b,D+16+4),nuvs:h(b, -D+16+8),ntri_flat:h(b,D+16+12),ntri_smooth:h(b,D+16+16),ntri_flat_uv:h(b,D+16+20),ntri_smooth_uv:h(b,D+16+24),nquad_flat:h(b,D+16+28),nquad_smooth:h(b,D+16+32),nquad_flat_uv:h(b,D+16+36),nquad_smooth_uv:h(b,D+16+40)};D+=G.header_bytes;P=G.vertex_index_bytes;J=G.vertex_index_bytes*2;H=G.vertex_index_bytes*3;K=G.vertex_index_bytes*3+G.material_index_bytes;Y=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;C=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*2;R=G.vertex_index_bytes; -O=G.vertex_index_bytes*2;U=G.vertex_index_bytes*3;V=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;ea=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;S=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;na=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;$=G.uv_index_bytes;qa=G.uv_index_bytes*2;ka=G.uv_index_bytes;ma=G.uv_index_bytes*2;da=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes;sa=G.vertex_index_bytes* -4+G.material_index_bytes;fa=G.ntri_flat*c;T=G.ntri_smooth*(c+G.normal_index_bytes*3);Z=G.ntri_flat_uv*(c+G.uv_index_bytes*3);aa=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);ga=G.nquad_flat*sa;c=G.nquad_smooth*(sa+G.normal_index_bytes*4);sa=G.nquad_flat_uv*(sa+G.uv_index_bytes*4);D+=function(c){for(var f,h,m,n=G.vertex_coordinate_bytes*3,o=c+G.nvertices*n;c=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[]; for(y=0;y1){o=new THREE.MeshFaceMaterial;for(j=0;j1){o=new THREE.MeshFaceMaterial;for(j=0;j1?e[1].substr(0,c):"0";e[1].length1?e[1].substr(0,c):"0";e[1].length=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;fc){u=p.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14, -c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};v.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b={},c=this.transparency!==void 0&&this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f= -this[e];if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ga[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ca+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=f.color.getHex());break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent= -!0,b.opacity=this[e],c=!0}b.shading=Ea;return this.material=new THREE.MeshLambertMaterial(b)};Y.prototype.parse=function(b){for(var c=0;c0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b={},c=this.transparency!==void 0&&this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e]; +if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=sa[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ca+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=f.color.getHex());break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity= +this[e],c=!0}b.shading=Ea;return this.material=new THREE.MeshLambertMaterial(b)};Z.prototype.parse=function(b){for(var c=0;c=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c1&&(Y=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(P,Y);object.name=w;object.position.set(G[0],G[1],G[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=D.visible;S.scene.addObject(object);S.objects[w]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),S.scene.collisions.colliders.push(b)); +THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(w in R.objects)if(!S.objects[w])if(D=R.objects[w],D.geometry!==void 0){if(P=S.geometries[D.geometry]){var b=!1;Z=[];for(aa=0;aa1&&(Z=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(P,Z);object.name=w;object.position.set(G[0],G[1],G[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=D.visible;S.scene.addObject(object);S.objects[w]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),S.scene.collisions.colliders.push(b)); if(D.castsShadow)b=new THREE.ShadowVolume(P),S.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}}else G=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(G[0],G[1],G[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=D.visible!==void 0?D.visible:!1,S.scene.addObject(object),S.objects[w]=object,S.empties[w]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}function u(b){return function(c){S.geometries[b]=c;n();U-=1;e.onLoadComplete();v()}}function p(b){return function(c){S.geometries[b]=c}}function v(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-U,loadedTextures:ea-V},S);e.onLoadProgress();U==0&&V==0&&c(S)} -var t,x,w,z,y,A,E,D,G,I,N,P,J,H,K,Y,C,R,O,U,V,o,ea,S;R=b.data;K=new THREE.BinaryLoader;O=new THREE.JSONLoader;V=U=0;S={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in R.objects)if(D=R.objects[w],D.meshCollider){b=!0;break}if(b)S.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;I=R.transform.rotation;var na=R.transform.scale;b&&S.scene.position.set(b[0],b[1],b[2]);I&&S.scene.rotation.set(I[0], -I[1],I[2]);na&&S.scene.scale.set(na[0],na[1],na[2]);(b||I||na)&&S.scene.updateMatrix()}b=function(){V-=1;v();e.onLoadComplete()};for(y in R.cameras){I=R.cameras[y];if(I.type=="perspective")J=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);G=I.position;I=I.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(I[0],I[1],I[2]);S.cameras[y]=J}for(z in R.lights)y=R.lights[z], +s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,S.scene.addObject(object),S.objects[w]=object,S.empties[w]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}function u(b){return function(c){S.geometries[b]=c;n();V-=1;e.onLoadComplete();v()}}function p(b){return function(c){S.geometries[b]=c}}function v(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-V,loadedTextures:ea-W},S);e.onLoadProgress();V==0&&W==0&&c(S)} +var t,x,w,z,y,A,E,D,G,I,N,P,J,H,K,Z,C,R,O,V,W,o,ea,S;R=b.data;K=new THREE.BinaryLoader;O=new THREE.JSONLoader;W=V=0;S={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in R.objects)if(D=R.objects[w],D.meshCollider){b=!0;break}if(b)S.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;I=R.transform.rotation;var ta=R.transform.scale;b&&S.scene.position.set(b[0],b[1],b[2]);I&&S.scene.rotation.set(I[0], +I[1],I[2]);ta&&S.scene.scale.set(ta[0],ta[1],ta[2]);(b||I||ta)&&S.scene.updateMatrix()}b=function(){W-=1;v();e.onLoadComplete()};for(y in R.cameras){I=R.cameras[y];if(I.type=="perspective")J=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);G=I.position;I=I.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(I[0],I[1],I[2]);S.cameras[y]=J}for(z in R.lights)y=R.lights[z], J=y.color!==void 0?y.color:16777215,I=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(G=y.direction,C=new THREE.DirectionalLight(J,I),C.position.set(G[0],G[1],G[2]),C.position.normalize()):y.type=="point"?(G=y.position,d=y.distance,C=new THREE.PointLight(J,I,d),C.position.set(G[0],G[1],G[2])):y.type=="ambient"&&(C=new THREE.AmbientLight(J)),S.scene.addLight(C),S.lights[z]=C;for(A in R.fogs)z=R.fogs[A],z.type=="linear"?H=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(H=new THREE.FogExp2(0, -z.density)),I=z.color,H.color.setRGB(I[0],I[1],I[2]),S.fogs[A]=H;if(S.cameras&&R.defaults.camera)S.currentCamera=S.cameras[R.defaults.camera];if(S.fogs&&R.defaults.fog)S.scene.fog=S.fogs[R.defaults.fog];I=R.defaults.bgcolor;S.bgColor=new THREE.Color;S.bgColor.setRGB(I[0],I[1],I[2]);S.bgColorAlpha=R.defaults.bgalpha;for(t in R.geometries)if(A=R.geometries[t],A.type=="bin_mesh"||A.type=="ascii_mesh")U+=1,e.onLoadStart();o=U;for(t in R.geometries)A=R.geometries[t],A.type=="cube"?(P=new THREE.CubeGeometry(A.width, +z.density)),I=z.color,H.color.setRGB(I[0],I[1],I[2]),S.fogs[A]=H;if(S.cameras&&R.defaults.camera)S.currentCamera=S.cameras[R.defaults.camera];if(S.fogs&&R.defaults.fog)S.scene.fog=S.fogs[R.defaults.fog];I=R.defaults.bgcolor;S.bgColor=new THREE.Color;S.bgColor.setRGB(I[0],I[1],I[2]);S.bgColorAlpha=R.defaults.bgalpha;for(t in R.geometries)if(A=R.geometries[t],A.type=="bin_mesh"||A.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(t in R.geometries)A=R.geometries[t],A.type=="cube"?(P=new THREE.CubeGeometry(A.width, A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),S.geometries[t]=P):A.type=="plane"?(P=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),S.geometries[t]=P):A.type=="sphere"?(P=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),S.geometries[t]=P):A.type=="cylinder"?(P=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),S.geometries[t]=P):A.type=="torus"?(P=new THREE.TorusGeometry(A.radius,A.tube, -A.segmentsR,A.segmentsT),S.geometries[t]=P):A.type=="icosahedron"?(P=new THREE.IcosahedronGeometry(A.subdivisions),S.geometries[t]=P):A.type=="bin_mesh"?K.load({model:f(A.url,R.urlBaseType),callback:u(t)}):A.type=="ascii_mesh"?O.load({model:f(A.url,R.urlBaseType),callback:u(t)}):A.type=="embedded_mesh"&&(A=R.embeds[A.id])&&O.createModel(A,p(t),"");for(E in R.textures)if(t=R.textures[E],t.url instanceof Array){V+=t.url.length;for(K=0;K=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var m=0,k=0;k>1^-(n&1);e[8*k+h]=m}f+=c}c=b.length-f;m=new Uint16Array(c);for(h=k=0;h=this.maxCount-3&&n(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;cthis.size-1&&(u=this.size-1);var x=Math.floor(p-n);x<1&&(x=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var w=Math.floor(v-n);w<1&&(w=1);n=Math.floor(v+n);n>this.size-1&&(n=this.size- 1);for(var z,y,A,E,D,G;t0&&(this.field[A+z]+=E)}}};this.addPlaneX=function(b,c){var h,m,k,n,u,p=this.size,v=this.yd,t=this.zd,x=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(h=0;h0)for(m=0;m=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; +c-f*d-h*e;b.x=j*l+c*-g+n*-h-i*-f;b.y=n*l+c*-f+i*-g-j*-h;b.z=i*l+c*-h+j*-f-n*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; diff --git a/build/custom/ThreeDOM.js b/build/custom/ThreeDOM.js index 385e6a7aff551018e9d5df98cbd86b1fbea1f0c1..17d48729ac832afbfb078cfd622e6d42d6e85abc 100644 --- a/build/custom/ThreeDOM.js +++ b/build/custom/ThreeDOM.js @@ -69,7 +69,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b= this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,j=this.w,i=j*c+f*e-h*d,k=j*d+h*c-g*e,l=j*e+g*d-f*c,c=-g* -c-f*d-h*e;b.x=i*j+c*-g+k*-h-l*-f;b.y=k*j+c*-f+l*-g-i*-h;b.z=l*j+c*-h+i*-f-k*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; +c-f*d-h*e;b.x=i*j+c*-g+k*-h-l*-f;b.y=k*j+c*-f+l*-g-i*-h;b.z=l*j+c*-h+i*-f-k*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()}; diff --git a/build/custom/ThreeExtras.js b/build/custom/ThreeExtras.js index d3b67c7d82d2e36b3fbb58fab1943d809f251a31..f18472e59481256cbcaf78a05564b8ed604a1431 100644 --- a/build/custom/ThreeExtras.js +++ b/build/custom/ThreeExtras.js @@ -81,7 +81,7 @@ this.getPrevKeyWith("pos",p,f.index-1).pos,this.points[1]=g,this.points[2]=h,thi THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],g,h,f,k,l,m;g=(a.length-1)*b;h=Math.floor(g);g-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];k=a[c[1]];l=a[c[2]];m=a[c[3]];c=g*g;f=g*c;e[0]=this.interpolate(h[0],k[0],l[0],m[0],g,c,f);e[1]=this.interpolate(h[1],k[1],l[1],m[1],g,c,f);e[2]=this.interpolate(h[2],k[2],l[2],m[2],g,c,f);return e}; THREE.Animation.prototype.interpolate=function(a,b,c,e,g,h,f){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*f+(-3*(b-c)-2*a-e)*h+a*g+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]}; -THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed= +THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed= a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!== void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX= this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward= @@ -94,7 +94,7 @@ b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))}; THREE.PathCamera=function(a){function b(a,c,b,e){var f={name:b,fps:0.6,length:e,hierarchy:[]},h,g=c.getControlPointsArray(),k=c.getLength(),l=g.length,y=0;h=l-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h=0;J--){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);B=0;for(D=y.length;B=0;J--){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);B=0;for(D=y.length;B0)for(m=0;m2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var t;a:{t=a;var p=l,x=m,v=n,u=g,z=f,y=void 0,w=void 0,A=void 0, -C=void 0,F=void 0,G=void 0,I=void 0,H=void 0,M=void 0,w=t[z[p]].x,A=t[z[p]].y,C=t[z[x]].x,F=t[z[x]].y,G=t[z[v]].x,I=t[z[v]].y;if(1.0E-10>(C-w)*(I-A)-(F-A)*(G-w))t=!1;else{for(y=0;y=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[f[l]], +C=void 0,F=void 0,G=void 0,I=void 0,H=void 0,M=void 0,w=t[z[p]].x,A=t[z[p]].y,C=t[z[x]].x,F=t[z[x]].y,G=t[z[v]].x,I=t[z[v]].y;if(1.0E-10>(C-w)*(I-A)-(F-A)*(G-w))t=!1;else{for(y=0;y=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[f[l]], a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,c){var b=n(a,c),e=n(a,c+1),f=n(a,c+2);return(n(a,c+3)<<24)+(f<<16)+(e<<8)+b}function l(a,c){var b=n(a,c);return(n(a,c+1)<<8)+b}function m(a,c){var b=n(a,c);return b>127?b-256:b}function n(a,c){return a.charCodeAt(c)&255}function o(c){var b, -e,f;b=g(a,c);e=g(a,c+F);f=g(a,c+G);c=l(a,c+I);z.faces.push(new THREE.Face3(b,e,f,null,null,z.materials[c]))}function t(c){var b,e,f,h,m,n;b=g(a,c);e=g(a,c+F);f=g(a,c+G);h=l(a,c+I);m=g(a,c+H);n=g(a,c+M);c=g(a,c+B);h=z.materials[h];var o=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[c*3],ha=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(o,p,n),new THREE.Vector3(t,ha,c)],null,h))}function p(c){var b,e,f,h;b=g(a,c);e=g(a,c+D);f=g(a,c+J);h= -g(a,c+L);c=l(a,c+N);z.faces.push(new THREE.Face4(b,e,f,h,null,null,z.materials[c]))}function x(c){var b,e,f,h,m,n,o,p;b=g(a,c);e=g(a,c+D);f=g(a,c+J);h=g(a,c+L);m=l(a,c+N);n=g(a,c+K);o=g(a,c+P);p=g(a,c+E);c=g(a,c+S);m=z.materials[m];var t=A[o*3],ha=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var v=A[c*3],u=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face4(b,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(t,ha,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(v,u,c)], -null,m))}function v(c){var b,e,f,h;b=g(a,c);e=g(a,c+O);f=g(a,c+U);c=C[b*2];h=C[b*2+1];b=C[e*2];var l=z.faceVertexUvs[0];e=C[e*2+1];var m=C[f*2];f=C[f*2+1];var n=[];n.push(new THREE.UV(c,h));n.push(new THREE.UV(b,e));n.push(new THREE.UV(m,f));l.push(n)}function u(c){var b,e,f,h,l,m;b=g(a,c);e=g(a,c+W);f=g(a,c+T);h=g(a,c+R);c=C[b*2];l=C[b*2+1];b=C[e*2];m=C[e*2+1];e=C[f*2];var n=z.faceVertexUvs[0];f=C[f*2+1];var o=C[h*2];h=C[h*2+1];var p=[];p.push(new THREE.UV(c,l));p.push(new THREE.UV(b,m));p.push(new THREE.UV(e, -f));p.push(new THREE.UV(o,h));n.push(p)}var z=this,y=0,w,A=[],C=[],F,G,I,H,M,B,D,J,L,N,K,P,E,S,O,U,W,T,R,Q,Z,X,Y,$,V;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,c);w={signature:a.substr(y,8),header_bytes:n(a,y+8),vertex_coordinate_bytes:n(a,y+9),normal_coordinate_bytes:n(a,y+10),uv_coordinate_bytes:n(a,y+11),vertex_index_bytes:n(a,y+12),normal_index_bytes:n(a,y+13),uv_index_bytes:n(a,y+14),material_index_bytes:n(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+ +e,f;b=g(a,c);e=g(a,c+F);f=g(a,c+G);c=l(a,c+I);z.faces.push(new THREE.Face3(b,e,f,null,null,z.materials[c]))}function t(c){var b,e,f,h,m,n;b=g(a,c);e=g(a,c+F);f=g(a,c+G);h=l(a,c+I);m=g(a,c+H);n=g(a,c+M);c=g(a,c+B);h=z.materials[h];var o=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[c*3],ia=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(o,p,n),new THREE.Vector3(t,ia,c)],null,h))}function p(c){var b,e,f,h;b=g(a,c);e=g(a,c+D);f=g(a,c+J);h= +g(a,c+L);c=l(a,c+N);z.faces.push(new THREE.Face4(b,e,f,h,null,null,z.materials[c]))}function x(c){var b,e,f,h,m,n,o,p;b=g(a,c);e=g(a,c+D);f=g(a,c+J);h=g(a,c+L);m=l(a,c+N);n=g(a,c+K);o=g(a,c+P);p=g(a,c+E);c=g(a,c+S);m=z.materials[m];var t=A[o*3],ia=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var v=A[c*3],u=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face4(b,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(t,ia,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(v,u,c)], +null,m))}function v(c){var b,e,f,h;b=g(a,c);e=g(a,c+O);f=g(a,c+U);c=C[b*2];h=C[b*2+1];b=C[e*2];var l=z.faceVertexUvs[0];e=C[e*2+1];var m=C[f*2];f=C[f*2+1];var n=[];n.push(new THREE.UV(c,h));n.push(new THREE.UV(b,e));n.push(new THREE.UV(m,f));l.push(n)}function u(c){var b,e,f,h,l,m;b=g(a,c);e=g(a,c+V);f=g(a,c+T);h=g(a,c+R);c=C[b*2];l=C[b*2+1];b=C[e*2];m=C[e*2+1];e=C[f*2];var n=z.faceVertexUvs[0];f=C[f*2+1];var o=C[h*2];h=C[h*2+1];var p=[];p.push(new THREE.UV(c,l));p.push(new THREE.UV(b,m));p.push(new THREE.UV(e, +f));p.push(new THREE.UV(o,h));n.push(p)}var z=this,y=0,w,A=[],C=[],F,G,I,H,M,B,D,J,L,N,K,P,E,S,O,U,V,T,R,Q,Z,W,$,X,Y;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,c);w={signature:a.substr(y,8),header_bytes:n(a,y+8),vertex_coordinate_bytes:n(a,y+9),normal_coordinate_bytes:n(a,y+10),uv_coordinate_bytes:n(a,y+11),vertex_index_bytes:n(a,y+12),normal_index_bytes:n(a,y+13),uv_index_bytes:n(a,y+14),material_index_bytes:n(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+ 8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,y+16+20),ntri_smooth_uv:g(a,y+16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=w.header_bytes;F=w.vertex_index_bytes;G=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;H=w.vertex_index_bytes*3+w.material_index_bytes;M=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;B=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;D=w.vertex_index_bytes; -J=w.vertex_index_bytes*2;L=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;K=w.vertex_index_bytes*4+w.material_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;E=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;S=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;O=w.uv_index_bytes;U=w.uv_index_bytes*2;W=w.uv_index_bytes;T=w.uv_index_bytes*2;R=w.uv_index_bytes*3;c=w.vertex_index_bytes*3+w.material_index_bytes;V=w.vertex_index_bytes* -4+w.material_index_bytes;Q=w.ntri_flat*c;Z=w.ntri_smooth*(c+w.normal_index_bytes*3);X=w.ntri_flat_uv*(c+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(c+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*V;c=w.nquad_smooth*(V+w.normal_index_bytes*4);V=w.nquad_flat_uv*(V+w.uv_index_bytes*4);y+=function(c){for(var e,h,g,k=w.vertex_coordinate_bytes*3,l=c+w.nvertices*k;c=0){u=l.invBindMatrices[p];m.invBindMatrix=u;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,u);m.weights=[]; for(u=0;u1){l=new THREE.MeshFaceMaterial;for(j=0;j1){l=new THREE.MeshFaceMaterial;for(j=0;j1?b[1].substr(0,c):"0";b[1].length1?b[1].substr(0,c):"0";b[1].lengthc){p=m.output[l];break}g=p!==void 0?p instanceof THREE.Matrix4?g.multiply(g,p):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);c=g;b.push({time:a,pos:[c.n14, +break;case "extra":break;default:console.log(c.nodeName)}a=[];b=1E6;c=-1E6;for(var e in ca)for(var f=ca[e],h=0;hc){p=m.output[l];break}g=p!==void 0?p instanceof THREE.Matrix4?g.multiply(g,p):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);c=g;b.push({time:a,pos:[c.n14, c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};H.prototype.create=function(){var a={},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b]; -if(e instanceof I)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=$[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity= +if(e instanceof I)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=Y[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity= this[b],c=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};M.prototype.parse=function(a){for(var c=0;c=0,e=a.indexOf("(")>=0,f,h;if(b)c=a.split("."),a=c.shift(),h=c.shift();else if(e){f=a.split("(");a=f.shift();for(c=0;c=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; +c-f*d-h*e;b.x=i*k+c*-g+l*-h-j*-f;b.y=l*k+c*-f+j*-g-i*-h;b.z=j*k+c*-h+i*-f-l*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; diff --git a/build/custom/ThreeWebGL.js b/build/custom/ThreeWebGL.js index c3c11de9a9d40a90c2a2c994c36e482e6a73cb73..a3111542b74c1db365dbc67dc8666fdd78321305 100644 --- a/build/custom/ThreeWebGL.js +++ b/build/custom/ThreeWebGL.js @@ -69,7 +69,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,f){t this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c= this.x,d=this.y,f=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-f*k;this.y=d*b+j*k+f*h-c*m;this.z=f*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,j=b.z,h=this.x,k=this.y,m=this.z,q=this.w,o=q*d+k*j-m*f,u=q*f+m*d-h*j,r=q*j+h*f-k*d,d=-h* -d-k*f-m*j;c.x=o*q+d*-h+u*-m-r*-k;c.y=u*q+d*-k+r*-h-o*-m;c.z=r*q+d*-m+o*-k-u*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.001)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;d.w=b.w*j+c.w*f;d.x=b.x*j+c.x*f;d.y=b.y*j+c.y*f;d.z=b.z*j+c.z*f;return d}; +d-k*f-m*j;c.x=o*q+d*-h+u*-m-r*-k;c.y=u*q+d*-k+r*-h-o*-m;c.z=r*q+d*-m+o*-k-u*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;d.w=b.w*j+c.w*f;d.x=b.x*j+c.x*f;d.y=b.y*j+c.y*f;d.z=b.z*j+c.z*f;return d}; THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,j,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,c,d,f,j,h,k){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; diff --git a/src/extras/loaders/ColladaLoader.js b/src/extras/loaders/ColladaLoader.js index dd3233f6e4cc211afb1cfbf170576ee3e33ae390..29709c5c9ebb925539960c6deb2bf39c2bbb69ec 100644 --- a/src/extras/loaders/ColladaLoader.js +++ b/src/extras/loaders/ColladaLoader.js @@ -7,6 +7,9 @@ THREE.ColladaLoader = function () { var COLLADA = null; var scene = null; var daeScene; + + var readyCallbackFunc = null; + var sources = {}; var images = {}; var animations = {}; @@ -14,12 +17,13 @@ THREE.ColladaLoader = function () { var geometries = {}; var materials = {}; var effects = {}; + var visualScenes; - var flip_uv = true; - var readyCallbackFunc = null; var baseUrl; var morphs; var skins; + + var flip_uv = true; var preferredShading = THREE.SmoothShading; function load ( url, readyCallback ) { @@ -29,8 +33,12 @@ THREE.ColladaLoader = function () { var namespaceURL = "http://www.collada.org/2005/11/COLLADASchema"; var rootTagName = "COLLADA"; - var xmldoc = document.implementation.createDocument(namespaceURL, rootTagName, null); + var xmldoc = document.implementation.createDocument( namespaceURL, rootTagName, null ); var me = this; + + // force reloading + // (should be configurable? sometimes caching is desirable) + url += "?rnd=" + Math.random(); var req = new XMLHttpRequest(); @@ -38,7 +46,8 @@ THREE.ColladaLoader = function () { if( req.overrideMimeType ) { // need this? yes... if extension is other then *.xml :-S - req.overrideMimeType("text/xml"); + + req.overrideMimeType( "text/xml" ); } @@ -62,7 +71,7 @@ THREE.ColladaLoader = function () { } else { - alert("Don't know how to parse XML!"); + alert( "Don't know how to parse XML!" ); } @@ -75,9 +84,9 @@ THREE.ColladaLoader = function () { if ( url !== undefined ) { - var parts = url.split('/'); + var parts = url.split( '/' ); parts.pop(); - baseUrl = parts.join('/') + '/'; + baseUrl = parts.join( '/' ) + '/'; } @@ -95,7 +104,7 @@ THREE.ColladaLoader = function () { daeScene = parseScene(); scene = new THREE.Object3D(); - for ( var i = 0; i < daeScene.nodes.length; i++ ) { + for ( var i = 0; i < daeScene.nodes.length; i ++ ) { scene.addChild( createSceneGraph( daeScene.nodes[ i ] ) ); @@ -246,7 +255,7 @@ THREE.ColladaLoader = function () { if ( !daeGeometry.mesh || !daeGeometry.mesh.primitives || - !daeGeometry.mesh.primitives.length) { + !daeGeometry.mesh.primitives.length ) { continue; } @@ -257,6 +266,7 @@ THREE.ColladaLoader = function () { geometry.morphTargets.push( { name: "target_1", vertices: target.vertices } ); } + } geometry.morphTargets.push( { name: "target_Z", vertices: geometry.vertices } ); @@ -269,14 +279,14 @@ THREE.ColladaLoader = function () { if ( !skinCtrl || !skinCtrl.skin ) { - console.log("could not find skin controller!"); + console.log( "could not find skin controller!" ); return; } if ( !ctrl.skeleton || !ctrl.skeleton.length ) { - console.log("could not find the skeleton for the skin!"); + console.log( "could not find the skeleton for the skin!" ); return; } @@ -328,7 +338,7 @@ THREE.ColladaLoader = function () { if ( m instanceof THREE.Matrix4 ) { - node.world.copy(m); + node.world.copy( m ); } @@ -370,7 +380,7 @@ THREE.ColladaLoader = function () { } - if ( found >= 0 ){ + if ( found >= 0 ) { var inv = skin.invBindMatrices[ found ]; @@ -509,49 +519,60 @@ THREE.ColladaLoader = function () { // FIXME: controllers - for ( i =0; i < node.controllers.length; i ++ ) { + for ( i = 0; i < node.controllers.length; i ++ ) { - var controller = controllers[node.controllers[i].url]; + var controller = controllers[ node.controllers[ i ].url ]; switch ( controller.type ) { case 'skin': - if ( geometries[controller.skin.source] ) { + if ( geometries[ controller.skin.source ] ) { var inst_geom = new InstanceGeometry(); + inst_geom.url = controller.skin.source; - inst_geom.instance_material = node.controllers[i].instance_material; - node.geometries.push(inst_geom); + inst_geom.instance_material = node.controllers[ i ].instance_material; + + node.geometries.push( inst_geom ); skinned = true; - skinController = node.controllers[i]; + skinController = node.controllers[ i ]; - } else if (controllers[controller.skin.source]) { + } else if ( controllers[ controller.skin.source ] ) { // urgh: controller can be chained // handle the most basic case... - var second = controllers[controller.skin.source]; + + var second = controllers[ controller.skin.source ]; morphController = second; // skinController = node.controllers[i]; - if (second.morph && geometries[second.morph.source]) { + + if ( second.morph && geometries[ second.morph.source ] ) { + var inst_geom = new InstanceGeometry(); + inst_geom.url = second.morph.source; - inst_geom.instance_material = node.controllers[i].instance_material; - node.geometries.push(inst_geom); + inst_geom.instance_material = node.controllers[ i ].instance_material; + + node.geometries.push( inst_geom ); + } + } break; case 'morph': - if ( geometries[controller.morph.source] ) { + if ( geometries[ controller.morph.source ] ) { var inst_geom = new InstanceGeometry(); + inst_geom.url = controller.morph.source; - inst_geom.instance_material = node.controllers[i].instance_material; - node.geometries.push(inst_geom); - morphController = node.controllers[i]; + inst_geom.instance_material = node.controllers[ i ].instance_material; + + node.geometries.push( inst_geom ); + morphController = node.controllers[ i ]; } @@ -559,7 +580,9 @@ THREE.ColladaLoader = function () { default: break; + } + } // FIXME: multi-material mesh? @@ -576,10 +599,10 @@ THREE.ColladaLoader = function () { if ( geometry ) { - if (!geometry.mesh || !geometry.mesh.primitives) + if ( !geometry.mesh || !geometry.mesh.primitives ) continue; - if (obj.name.length == 0) { + if ( obj.name.length == 0 ) { obj.name = geometry.id; @@ -902,11 +925,13 @@ THREE.ColladaLoader = function () { switch ( child.nodeName ) { case 'skin': + this.skin = (new Skin()).parse(child); this.type = child.nodeName; break; case 'morph': + this.morph = (new Morph()).parse(child); this.type = child.nodeName; break; @@ -1135,17 +1160,17 @@ THREE.ColladaLoader = function () { case 'input': - inputs.push((new Input()).parse(child)); + inputs.push( ( new Input() ).parse( child ) ); break; case 'v': - v = _ints(child.textContent); + v = _ints( child.textContent ); break; case 'vcount': - vcount = _ints(child.textContent); + vcount = _ints( child.textContent ); break; default: @@ -1326,9 +1351,9 @@ THREE.ColladaLoader = function () { } - if (sid == transformSid) { + if ( sid == transformSid ) { - channel.info = {sid:sid, dotSyntax:dotSyntax, arrSyntax:arrSyntax, arrIndices:arrIndices}; + channel.info = { sid: sid, dotSyntax: dotSyntax, arrSyntax: arrSyntax, arrIndices: arrIndices }; return channel; } @@ -1356,6 +1381,7 @@ THREE.ColladaLoader = function () { if ( n ) { return n; + } } @@ -1383,6 +1409,7 @@ THREE.ColladaLoader = function () { if ( n ) { return n; + } } @@ -1424,7 +1451,7 @@ THREE.ColladaLoader = function () { for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; - if (child.nodeType != 1) continue; + if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { @@ -1615,6 +1642,7 @@ THREE.ColladaLoader = function () { instance = instances.iterateNext(); } + } break; @@ -1654,7 +1682,7 @@ THREE.ColladaLoader = function () { }; - InstanceGeometry.prototype.parse = function( element ) { + InstanceGeometry.prototype.parse = function ( element ) { this.url = element.getAttribute('url').replace(/^#/, ''); this.instance_material = []; @@ -1662,7 +1690,7 @@ THREE.ColladaLoader = function () { for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[i]; - if (child.nodeType != 1) continue; + if ( child.nodeType != 1 ) continue; if ( child.nodeName == 'bind_material' ) { @@ -1672,7 +1700,7 @@ THREE.ColladaLoader = function () { XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); - if (instances) { + if ( instances ) { var instance = instances.iterateNext(); @@ -1718,7 +1746,7 @@ THREE.ColladaLoader = function () { break; case 'extra': - + // console.log( child ); break; @@ -1748,32 +1776,32 @@ THREE.ColladaLoader = function () { for ( i = 0; i < element.childNodes.length; i ++ ) { - var child = element.childNodes[i]; + var child = element.childNodes[ i ]; - switch (child.nodeName) { + switch ( child.nodeName ) { case 'source': - _source(child); + _source( child ); break; case 'vertices': - this.vertices = (new Vertices()).parse(child); + this.vertices = ( new Vertices() ).parse( child ); break; case 'triangles': - this.primitives.push((new Triangles().parse(child))); + this.primitives.push( ( new Triangles().parse( child ) ) ); break; case 'polygons': - console.warn('polygon holes not yet supported!'); + console.warn( 'polygon holes not yet supported!' ); case 'polylist': - this.primitives.push((new Polylist().parse(child))); + this.primitives.push( ( new Polylist().parse( child ) ) ); break; default: @@ -1791,7 +1819,7 @@ THREE.ColladaLoader = function () { if ( vertex_store[ hash ] === undefined ) { - vertex_store[ hash ] = { v:v, index:index }; + vertex_store[ hash ] = { v: v, index: index }; } @@ -1805,16 +1833,16 @@ THREE.ColladaLoader = function () { for ( i = 0, j = 0; i < vertexData.length; i += 3, j ++ ) { - var v = new THREE.Vertex( new THREE.Vector3( vertexData[i], vertexData[i+1], vertexData[i+2] ) ); - get_vertex(v, j); - this.geometry3js.vertices.push(v); + var v = new THREE.Vertex( new THREE.Vector3( vertexData[ i ], vertexData[ i + 1 ], vertexData[ i + 2 ] ) ); + get_vertex( v, j ); + this.geometry3js.vertices.push( v ); } for ( i = 0; i < this.primitives.length; i ++ ) { - primitive = this.primitives[i]; - primitive.setVertices(this.vertices); + primitive = this.primitives[ i ]; + primitive.setVertices( this.vertices ); this.handlePrimitive( primitive, this.geometry3js, vertex_store ); } @@ -1837,7 +1865,7 @@ THREE.ColladaLoader = function () { for ( j = 0; j < inputs.length; j ++ ) { - input = inputs[j]; + input = inputs[ j ]; switch ( input.semantic ) { @@ -1866,9 +1894,10 @@ THREE.ColladaLoader = function () { for ( k = 0; k < inputs.length; k ++ ) { - input = inputs[k]; - source = sources[input.source]; - index = p[i + (j*inputs.length) + input.offset]; + input = inputs[ k ]; + source = sources[ input.source ]; + + index = p[ i + ( j * inputs.length ) + input.offset ]; numParams = source.accessor.params.length; idx32 = index * numParams; @@ -1876,24 +1905,27 @@ THREE.ColladaLoader = function () { case 'VERTEX': - var hash = _hash_vector3( geom.vertices[index].position ); - vs.push(vertex_store[hash].index); + var hash = _hash_vector3( geom.vertices[ index ].position ); + vs.push( vertex_store[ hash ].index ); + break; case 'NORMAL': - ns.push( new THREE.Vector3( source.data[idx32+0], source.data[idx32+1], source.data[idx32+2] ) ); + ns.push( new THREE.Vector3( source.data[ idx32 ], source.data[ idx32 + 1 ], source.data[ idx32 + 2 ] ) ); + break; case 'TEXCOORD': - if (ts[input.set] === undefined) ts[input.set] = []; - ts[input.set].push( new THREE.UV( source.data[idx32+0], source.data[idx32+1] ) ); + if ( ts[ input.set ] === undefined ) ts[ input.set ] = []; + ts[ input.set ].push( new THREE.UV( source.data[ idx32 ], source.data[ idx32 + 1 ] ) ); + break; case 'COLOR': - - cs.push( new THREE.Color().setRGB( source.data[idx32+0], source.data[idx32+1], source.data[idx32+2] ) ); + + cs.push( new THREE.Color().setRGB( source.data[ idx32 ], source.data[ idx32 + 1 ], source.data[ idx32 + 2 ] ) ); break; @@ -1914,7 +1946,7 @@ THREE.ColladaLoader = function () { face = new THREE.Face3( vs[0], vs[1], vs[2], [ ns[0], ns[1], ns[2] ] ); } else if ( vcount == 4 ) { - + face = new THREE.Face4( vs[0], vs[1], vs[2], vs[3], [ ns[0], ns[1], ns[2], ns[3] ] ); } @@ -1990,11 +2022,11 @@ THREE.ColladaLoader = function () { }; - Triangles.prototype.parse = function(element) { + Triangles.prototype.parse = function ( element ) { this.inputs = []; - this.material = element.getAttribute('material'); - this.count = _attr_as_int(element, 'count', 0); + this.material = element.getAttribute( 'material' ); + this.count = _attr_as_int( element, 'count', 0 ); for ( var i = 0; i < element.childNodes.length; i ++ ) { @@ -2004,17 +2036,17 @@ THREE.ColladaLoader = function () { case 'input': - this.inputs.push((new Input()).parse(element.childNodes[i])); + this.inputs.push( ( new Input() ).parse( element.childNodes[ i ] ) ); break; case 'vcount': - this.vcount = _ints(child.textContent); + this.vcount = _ints( child.textContent ); break; case 'p': - this.p = _ints(child.textContent); + this.p = _ints( child.textContent ); break; default: @@ -2037,23 +2069,23 @@ THREE.ColladaLoader = function () { }; - Accessor.prototype.parse = function( element ) { + Accessor.prototype.parse = function ( element ) { this.params = []; - this.source = element.getAttribute('source'); - this.count = _attr_as_int(element, 'count', 0); - this.stride = _attr_as_int(element, 'stride', 0); + this.source = element.getAttribute( 'source' ); + this.count = _attr_as_int( element, 'count', 0 ); + this.stride = _attr_as_int( element, 'stride', 0 ); for ( var i = 0; i < element.childNodes.length; i ++ ) { - var child = element.childNodes[i]; + var child = element.childNodes[ i ]; if ( child.nodeName == 'param' ) { var param = {}; - param['name'] = child.getAttribute('name'); - param['type'] = child.getAttribute('type'); - this.params.push(param); + param[ 'name' ] = child.getAttribute( 'name' ); + param[ 'type' ] = child.getAttribute( 'type' ); + this.params.push( param ); } @@ -2133,26 +2165,26 @@ THREE.ColladaLoader = function () { case 'bool_array': - this.data = _bools(child.textContent); + this.data = _bools( child.textContent ); this.type = child.nodeName; break; case 'float_array': - this.data = _floats(child.textContent); + this.data = _floats( child.textContent ); this.type = child.nodeName; break; case 'int_array': - this.data = _ints(child.textContent); + this.data = _ints( child.textContent ); this.type = child.nodeName; break; case 'IDREF_array': case 'Name_array': - this.data = _strings(child.textContent); + this.data = _strings( child.textContent ); this.type = child.nodeName; break; @@ -2160,9 +2192,9 @@ THREE.ColladaLoader = function () { for ( var j = 0; j < child.childNodes.length; j ++ ) { - if ( child.childNodes[j].nodeName == 'accessor' ) { + if ( child.childNodes[ j ].nodeName == 'accessor' ) { - this.accessor = (new Accessor()).parse(child.childNodes[j]); + this.accessor = ( new Accessor() ).parse( child.childNodes[ j ] ); break; } @@ -2187,11 +2219,11 @@ THREE.ColladaLoader = function () { //for (var i = 0; i < this.accessor.params.length; i++) { - var param = this.accessor.params[0]; + var param = this.accessor.params[ 0 ]; //console.log(param.name + " " + param.type); - switch (param.type) { + switch ( param.type ) { case 'IDREF': case 'Name': @@ -2203,7 +2235,7 @@ THREE.ColladaLoader = function () { for ( var j = 0; j < this.data.length; j += 16 ) { - var s = this.data.slice(j, j+16); + var s = this.data.slice( j, j + 16 ); var m = new THREE.Matrix4(); m.set( s[0], s[1], s[2], s[3], @@ -2211,7 +2243,7 @@ THREE.ColladaLoader = function () { s[8], s[9], s[10], s[11], s[12], s[13], s[14], s[15] ); - result.push(m); + result.push( m ); } break; @@ -2239,14 +2271,16 @@ THREE.ColladaLoader = function () { Material.prototype.parse = function ( element ) { - this.id = element.getAttribute('id'); - this.name = element.getAttribute('name'); + this.id = element.getAttribute( 'id' ); + this.name = element.getAttribute( 'name' ); for ( var i = 0; i < element.childNodes.length; i ++ ) { - if (element.childNodes[i].nodeName == 'instance_effect') { - this.instance_effect = (new InstanceEffect()).parse(element.childNodes[i]); + if ( element.childNodes[ i ].nodeName == 'instance_effect' ) { + + this.instance_effect = ( new InstanceEffect() ).parse( element.childNodes[ i ] ); break; + } } @@ -2257,8 +2291,8 @@ THREE.ColladaLoader = function () { function ColorOrTexture () { - this.color = new THREE.Color(0); - this.color.setRGB(Math.random(), Math.random(), Math.random()); + this.color = new THREE.Color( 0 ); + this.color.setRGB( Math.random(), Math.random(), Math.random() ); this.color.a = 1.0; this.texture = null; @@ -2268,13 +2302,13 @@ THREE.ColladaLoader = function () { ColorOrTexture.prototype.isColor = function () { - return (this.texture == null); + return ( this.texture == null ); }; ColorOrTexture.prototype.isTexture = function () { - return (this.texture != null); + return ( this.texture != null ); }; @@ -2282,16 +2316,16 @@ THREE.ColladaLoader = function () { for ( var i = 0; i < element.childNodes.length; i ++ ) { - var child = element.childNodes[i]; - if (child.nodeType != 1) continue; + var child = element.childNodes[ i ]; + if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'color': - var rgba = _floats(child.textContent); + var rgba = _floats( child.textContent ); this.color = new THREE.Color(0); - this.color.setRGB(rgba[0], rgba[1], rgba[2]); + this.color.setRGB( rgba[0], rgba[1], rgba[2] ); this.color.a = rgba[3]; break; @@ -2324,10 +2358,10 @@ THREE.ColladaLoader = function () { for ( var i = 0; i < element.childNodes.length; i ++ ) { - var child = element.childNodes[i]; - if (child.nodeType != 1) continue; + var child = element.childNodes[ i ]; + if ( child.nodeType != 1 ) continue; - switch (child.nodeName) { + switch ( child.nodeName ) { case 'ambient': case 'emission': @@ -2335,16 +2369,18 @@ THREE.ColladaLoader = function () { case 'specular': case 'transparent': - this[child.nodeName] = (new ColorOrTexture()).parse(child); + this[ child.nodeName ] = ( new ColorOrTexture() ).parse( child ); break; case 'shininess': case 'reflectivity': case 'transparency': - var f = evaluateXPath(child, ".//dae:float"); - if (f.length > 0) - this[child.nodeName] = parseFloat(f[0].textContent); + var f = evaluateXPath( child, ".//dae:float" ); + + if ( f.length > 0 ) + this[ child.nodeName ] = parseFloat( f[ 0 ].textContent ); + break; default: @@ -2381,7 +2417,7 @@ THREE.ColladaLoader = function () { if ( this.effect.sampler && this.effect.surface ) { - if (this.effect.sampler.source == this.effect.surface.sid) { + if ( this.effect.sampler.source == this.effect.surface.sid ) { var image = images[this.effect.surface.init_from]; @@ -2394,19 +2430,20 @@ THREE.ColladaLoader = function () { props['map'].repeat.y = -1; } + } } } else { - if (prop == 'diffuse') { + if ( prop == 'diffuse' ) { - props['color'] = cot.color.getHex(); + props[ 'color' ] = cot.color.getHex(); - } else if (!transparent) { + } else if ( !transparent ) { - props[prop] = cot.color.getHex(); + props[ prop ] = cot.color.getHex(); } @@ -2419,18 +2456,19 @@ THREE.ColladaLoader = function () { case 'shininess': case 'reflectivity': - props[prop] = this[prop]; + props[ prop ] = this[ prop ]; break; case 'transparency': if ( transparent ) { - props['transparent'] = true; - props['opacity'] = this[prop]; + props[ 'transparent' ] = true; + props[ 'opacity' ] = this[ prop ]; transparent = true; } + break; default: @@ -2482,8 +2520,8 @@ THREE.ColladaLoader = function () { for ( var i = 0; i < element.childNodes.length; i ++ ) { - var child = element.childNodes[i]; - if (child.nodeType != 1) continue; + var child = element.childNodes[ i ]; + if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { @@ -2499,7 +2537,7 @@ THREE.ColladaLoader = function () { default: - console.log("unhandled Surface prop: " + child.nodeName); + console.log( "unhandled Surface prop: " + child.nodeName ); break; } @@ -2529,7 +2567,7 @@ THREE.ColladaLoader = function () { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; - switch ( child.nodeName) { + switch ( child.nodeName ) { case 'source': @@ -2563,7 +2601,7 @@ THREE.ColladaLoader = function () { default: - console.log("unhandled Sampler2D prop: " + child.nodeName); + console.log( "unhandled Sampler2D prop: " + child.nodeName ); break; } @@ -2709,7 +2747,7 @@ THREE.ColladaLoader = function () { for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[i]; - if (child.nodeType != 1) continue; + if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { @@ -2976,6 +3014,7 @@ THREE.ColladaLoader = function () { if ( nsPrefix == "dae" ) { return "http://www.collada.org/2005/11/COLLADASchema"; + } return null; @@ -2987,9 +3026,10 @@ THREE.ColladaLoader = function () { var raw = _strings( str ); var data = []; - for (var i = 0; i < raw.length; i ++ ) { + for ( var i = 0; i < raw.length; i ++ ) { data.push( (raw[i] == 'true' || raw[i] == '1') ? true : false ); + } return data;