diff --git a/build/Three.js b/build/Three.js index 7d722e9ac05e4f55b1764c5ac26bfdd28d23fb52..d34d3f71aebfa1ed56cb32f3fd809180db990451 100644 --- a/build/Three.js +++ b/build/Three.js @@ -27,8 +27,8 @@ 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,t=b.n23,u=b.n24,w=b.n31,v=b.n32,x=b.n33,p=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44,E=c.n11,G=c.n12, -H=c.n13,M=c.n14,R=c.n21,J=c.n22,I=c.n23,K=c.n24,W=c.n31,D=c.n32,S=c.n33,U=c.n34,da=c.n41,Q=c.n42,o=c.n43,pa=c.n44;this.n11=e*E+f*R+h*W+m*da;this.n12=e*G+f*J+h*D+m*Q;this.n13=e*H+f*I+h*S+m*o;this.n14=e*M+f*K+h*U+m*pa;this.n21=k*E+n*R+t*W+u*da;this.n22=k*G+n*J+t*D+u*Q;this.n23=k*H+n*I+t*S+u*o;this.n24=k*M+n*K+t*U+u*pa;this.n31=w*E+v*R+x*W+p*da;this.n32=w*G+v*J+x*D+p*Q;this.n33=w*H+v*I+x*S+p*o;this.n34=w*M+v*K+x*U+p*pa;this.n41=y*E+z*R+A*W+C*da;this.n42=y*G+z*J+A*D+C*Q;this.n43=y*H+z*I+A*S+C*o;this.n44= -y*M+z*K+A*U+C*pa;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*= +H=c.n13,M=c.n14,Q=c.n21,J=c.n22,I=c.n23,K=c.n24,W=c.n31,D=c.n32,R=c.n33,T=c.n34,V=c.n41,X=c.n42,o=c.n43,ha=c.n44;this.n11=e*E+f*Q+h*W+m*V;this.n12=e*G+f*J+h*D+m*X;this.n13=e*H+f*I+h*R+m*o;this.n14=e*M+f*K+h*T+m*ha;this.n21=k*E+n*Q+t*W+u*V;this.n22=k*G+n*J+t*D+u*X;this.n23=k*H+n*I+t*R+u*o;this.n24=k*M+n*K+t*T+u*ha;this.n31=w*E+v*Q+x*W+p*V;this.n32=w*G+v*J+x*D+p*X;this.n33=w*H+v*I+x*R+p*o;this.n34=w*M+v*K+x*T+p*ha;this.n41=y*E+z*Q+A*W+C*V;this.n42=y*G+z*J+A*D+C*X;this.n43=y*H+z*I+A*R+C*o;this.n44=y* +M+z*K+A*T+C*ha;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,t=this.n31,u=this.n32,w=this.n33,v=this.n34,x=this.n41,p=this.n42,y=this.n43,z=this.n44;return f*k*u*x-e*n*u*x-f*m*w*x+c*n*w*x+e*m*v*x-c*k*v*x-f*k*t*p+e*n*t*p+f*h*w*p-b*n*w*p-e*h*v*p+b*k*v*p+f*m*t*y-c*n*t*y-f*h*u*y+b*n*u*y+c*h*v*y-b*m*v*y-e*m*t*z+c*k*t*z+e*h*u*z-b*k*u*z-c*h* w*z+b*m*w*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34= this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]= @@ -54,17 +54,17 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&& 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))ea=G[E]=G[E]||new THREE.RenderableParticle,E++,C=ea,C.x=J.x/J.w,C.y=J.y/J.w,C.z=J.z,C.rotation= -$.rotation.z,C.scale.x=$.scale.x*Math.abs(C.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),C.scale.y=$.scale.y*Math.abs(C.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),C.materials=$.materials,M.push(C);m&&M.sort(c);return M}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)}; +THREE.Projector=function(){function b(){var b=t[n]=t[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=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))da=G[E]=G[E]||new THREE.RenderableParticle,E++,C=da,C.x=J.x/J.w,C.y=J.y/J.w,C.z= +J.z,C.rotation=$.rotation.z,C.scale.x=$.scale.x*Math.abs(C.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),C.scale.y=$.scale.y*Math.abs(C.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),C.materials=$.materials,M.push(C);m&&M.sort(c);return M}};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= @@ -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,t=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;t=b.vertices[c].position;u=b.vertices[f].position;w=k[h];v=k[m];x=k[o];p=t.x-n.x;y=u.x-n.x;z=t.y-n.y;A=u.y-n.y;C=t.z-n.z;E=u.z-n.z;G=v.u-w.u;H=x.u-w.u;M=v.v-w.v;Q=x.v-w.v;J=1/(G*Q-H*M);D.set((Q*p-M*y)*J,(Q*z-M*A)*J,(Q*C-M*E)*J);R.set((G*y-H*p)*J,(G*A-H*z)*J,(G*E-H*C)*J);K[e].addSelf(D);K[c].addSelf(D);K[f].addSelf(D);W[e].addSelf(R); +W[c].addSelf(R);W[f].addSelf(R)}var c,e,f,h,m,k,n,t,u,w,v,x,p,y,z,A,C,E,G,H,M,Q,J,I,K=[],W=[],D=new THREE.Vector3,R=new THREE.Vector3,T=new THREE.Vector3,V=new THREE.Vector3,X=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(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b* -255)+","+z+")"),p.fillRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight()))),O.empty())};this.render=function(b,u){function t(b){var e,c,f,k=b.lights;qa.setRGB(0,0,0);ya.setRGB(0,0,0);va.setRGB(0,0,0);b=0;for(e=k.length;b>1,w=X.height>>1,m=k.scale.x*v,u=k.scale.y*x,o=m*t,n=u*w,ha.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ha)&&(p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(m,-u),p.translate(-t,-w),p.drawImage(X,0,0),p.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*v,n=k.scale.y*x,ha.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ha)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(o,n),m.program(p), -p.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);p.beginPath();p.moveTo(b.positionScreen.x,b.positionScreen.y);p.lineTo(k.positionScreen.x,k.positionScreen.y);p.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)p.lineWidth=H=b;b=m.linecap;if(M!=b)p.lineCap=M=b;b=m.linejoin;if(R!=b)p.lineJoin=R=b;f(m.color.getContextStyle());p.stroke();ha.inflate(m.linewidth*2)}}function A(b,f,k,h,n,v,X,p,t){m.data.vertices+=3;m.data.faces++;c(p.opacity);e(p.blending);U=b.positionScreen.x; -da=b.positionScreen.y;Q=f.positionScreen.x;o=f.positionScreen.y;pa=k.positionScreen.x;T=k.positionScreen.y;E(U,da,Q,o,pa,T);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=X.uvs[0],$a(U,da,Q,o,pa,T,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,oa.copy(X.vertexNormalsWorld[0]),sa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,xa=-(oa.x*b.n21+ -oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(X.vertexNormalsWorld[1]),Ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,za=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(X.vertexNormalsWorld[2]),Aa=(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(U,da,Q,o,pa,T,sa,xa,Ca,za,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=X.uvs[0],$a(U,da,Q,o,pa,T,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map)),e(THREE.SubtractiveBlending)),aa?!p.wireframe&&p.shading==THREE.SmoothShading&&X.vertexNormalsWorld.length==3?(V.r=$.r=ea.r=qa.r,V.g=$.g=ea.g=qa.g,V.b=$.b=ea.b=qa.b,w(t,X.v1.positionWorld,X.vertexNormalsWorld[0],V),w(t,X.v2.positionWorld,X.vertexNormalsWorld[1],$),w(t,X.v3.positionWorld,X.vertexNormalsWorld[2],ea),V.r=Math.max(0,Math.min(p.color.r*V.r,1)),V.g=Math.max(0,Math.min(p.color.g*V.g,1)), -V.b=Math.max(0,Math.min(p.color.b*V.b,1)),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),ea.r=Math.max(0,Math.min(p.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(p.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(p.color.b*ea.b,1)),ka.r=($.r+ea.r)*0.5,ka.g=($.g+ea.g)*0.5,ka.b=($.b+ea.b)*0.5,ra=Xa(V,$,ea,ka),Sa(U,da,Q,o,pa,T,0,0,1,0,0,1,ra)):(ia.r=qa.r,ia.g=qa.g,ia.b=qa.b,w(t,X.centroidWorld,X.normalWorld,ia),Z.r=Math.max(0,Math.min(p.color.r* -ia.r,1)),Z.g=Math.max(0,Math.min(p.color.g*ia.g,1)),Z.b=Math.max(0,Math.min(p.color.b*ia.b,1)),p.wireframe?Ia(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(Z)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)N=u.near,fa=u.far,V.r=V.g=V.b=1-Na(b.positionScreen.z,N,fa),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,fa),ea.r=ea.g=ea.b=1-Na(k.positionScreen.z,N,fa),ka.r=($.r+ea.r)*0.5,ka.g=($.g+ea.g)* -0.5,ka.b=($.b+ea.b)*0.5,ra=Xa(V,$,ea,ka),Sa(U,da,Q,o,pa,T,0,0,1,0,0,1,ra);else if(p instanceof THREE.MeshNormalMaterial)Z.r=Ta(X.normalWorld.x),Z.g=Ta(X.normalWorld.y),Z.b=Ta(X.normalWorld.z),p.wireframe?Ia(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(Z)}function C(b,f,k,h,n,p,v,X,t){m.data.vertices+=4;m.data.faces++;c(X.opacity);e(X.blending);if(X.map||X.envMap)A(b,f,h,0,1,3,v,X,t),A(n,k,p,1,2,3,v,X,t);else if(U=b.positionScreen.x,da=b.positionScreen.y,Q=f.positionScreen.x,o= -f.positionScreen.y,pa=k.positionScreen.x,T=k.positionScreen.y,ma=h.positionScreen.x,ca=h.positionScreen.y,na=n.positionScreen.x,ja=n.positionScreen.y,la=p.positionScreen.x,ga=p.positionScreen.y,X instanceof THREE.MeshBasicMaterial)G(U,da,Q,o,pa,T,ma,ca),X.wireframe?Ia(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Ja(X.color);else if(X instanceof THREE.MeshLambertMaterial)aa?!X.wireframe&&X.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==4?(V.r=$.r=ea.r=ka.r=qa.r, -V.g=$.g=ea.g=ka.g=qa.g,V.b=$.b=ea.b=ka.b=qa.b,w(t,v.v1.positionWorld,v.vertexNormalsWorld[0],V),w(t,v.v2.positionWorld,v.vertexNormalsWorld[1],$),w(t,v.v4.positionWorld,v.vertexNormalsWorld[3],ea),w(t,v.v3.positionWorld,v.vertexNormalsWorld[2],ka),V.r=Math.max(0,Math.min(X.color.r*V.r,1)),V.g=Math.max(0,Math.min(X.color.g*V.g,1)),V.b=Math.max(0,Math.min(X.color.b*V.b,1)),$.r=Math.max(0,Math.min(X.color.r*$.r,1)),$.g=Math.max(0,Math.min(X.color.g*$.g,1)),$.b=Math.max(0,Math.min(X.color.b*$.b,1)),ea.r= -Math.max(0,Math.min(X.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(X.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(X.color.b*ea.b,1)),ka.r=Math.max(0,Math.min(X.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(X.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(X.color.b*ka.b,1)),ra=Xa(V,$,ea,ka),E(U,da,Q,o,ma,ca),Sa(U,da,Q,o,ma,ca,0,0,1,0,0,1,ra),E(na,ja,pa,T,la,ga),Sa(na,ja,pa,T,la,ga,1,0,1,1,0,1,ra)):(ia.r=qa.r,ia.g=qa.g,ia.b=qa.b,w(t,v.centroidWorld,v.normalWorld,ia),Z.r=Math.max(0,Math.min(X.color.r*ia.r,1)),Z.g= -Math.max(0,Math.min(X.color.g*ia.g,1)),Z.b=Math.max(0,Math.min(X.color.b*ia.b,1)),G(U,da,Q,o,pa,T,ma,ca),X.wireframe?Ia(Z,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Ja(Z)):(G(U,da,Q,o,pa,T,ma,ca),X.wireframe?Ia(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Ja(X.color));else if(X instanceof THREE.MeshNormalMaterial)Z.r=Ta(v.normalWorld.x),Z.g=Ta(v.normalWorld.y),Z.b=Ta(v.normalWorld.z),G(U,da,Q,o,pa,T,ma,ca),X.wireframe?Ia(Z,X.wireframeLinewidth,X.wireframeLinecap, -X.wireframeLinejoin):Ja(Z);else if(X instanceof THREE.MeshDepthMaterial)N=u.near,fa=u.far,V.r=V.g=V.b=1-Na(b.positionScreen.z,N,fa),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,fa),ea.r=ea.g=ea.b=1-Na(h.positionScreen.z,N,fa),ka.r=ka.g=ka.b=1-Na(k.positionScreen.z,N,fa),ra=Xa(V,$,ea,ka),E(U,da,Q,o,ma,ca),Sa(U,da,Q,o,ma,ca,0,0,1,0,0,1,ra),E(na,ja,pa,T,la,ga),Sa(na,ja,pa,T,la,ga,1,0,1,1,0,1,ra)}function E(b,e,c,f,k,h){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(b,e);p.closePath()}function G(b, -e,c,f,k,h,m,o){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(m,o);p.lineTo(b,e);p.closePath()}function Ia(b,e,c,k){if(H!=e)p.lineWidth=H=e;if(M!=c)p.lineCap=M=c;if(R!=k)p.lineJoin=R=k;f(b.getContextStyle());p.stroke();ha.inflate(e*2)}function Ja(b){h(b.getContextStyle());p.fill()}function $a(b,e,c,f,k,m,o,n,X,v,u,t,w){if(w.image.width!=0){if(w.needsUpdate==!0||ta[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping,Ma=w.wrapT==THREE.RepeatWrapping;ta[w.id]=p.createPattern(w.image, -x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ta[w.id]);var x=w.offset.x/w.repeat.x,Ma=w.offset.y/w.repeat.y,L=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+x)*L,n=(n+Ma)*w,X=(X+x)*L,v=(v+Ma)*w,u=(u+x)*L,t=(t+Ma)*w;c-=b;f-=e;k-=b;m-=e;X-=o;v-=n;u-=o;t-=n;x=1/(X*t-u*v);w=(t*c-v*k)*x;v=(t*f-v*m)*x;c=(X*k-u*c)*x;f=(X*m-u*f)*x;b=b-w*o-c*n;e=e-v*o-f*n;p.save();p.transform(w,v,c,f,b,e);p.fill();p.restore()}}function Sa(b,e,c,f,k,h,m,o,n,X,v,u,t){var w, -x;w=t.width-1;x=t.height-1;m*=w;o*=x;n*=w;X*=x;v*=w;u*=x;c-=b;f-=e;k-=b;h-=e;n-=m;X-=o;v-=m;u-=o;x=1/(n*u-v*X);w=(u*c-X*k)*x;X=(u*f-X*h)*x;c=(n*k-v*c)*x;f=(n*h-v*f)*x;b=b-w*m-c*o;e=e-X*m-f*o;p.save();p.transform(w,X,c,f,b,e);p.clip();p.drawImage(t,0,0);p.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),v=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);X[0]=k<0?0:k>255?255:k;X[1]=h<0?0:h>255?255: -h;X[2]=b<0?0:b>255?255:b;X[4]=m<0?0:m>255?255:m;X[5]=o<0?0:o>255?255:o;X[6]=e<0?0:e>255?255:e;X[8]=n<0?0:n>255?255:n;X[9]=v<0?0:v>255?255:v;X[10]=c<0?0:c>255?255:c;X[12]=p<0?0:p>255?255:p;X[13]=u<0?0:u>255?255:u;X[14]=f<0?0:f>255?255:f;Y.putImageData(Ba,0,0);Wa.drawImage(Fa,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,cb,wa,Da,La,Ua,Za,F;this.autoClear?this.clear():p.setTransform(1,0,0,-1,v,x);m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,u,this.sortElements);(aa=b.lights.length>0)&&t(b);Ya=0;for(cb=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&&(W.sub(h.position,e.centroidWorld),W.normalize(),m=e.normalWorld.dot(W)*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,v){m.data.vertices+=3;m.data.faces++;U=f(da++);U.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?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(M.r=R.r,M.g=R.g,M.b=R.b,b(v,o,M),H.r=Math.max(0,Math.min(n.color.r*M.r,1)),H.g=Math.max(0,Math.min(n.color.g*M.g,1)),H.b=Math.max(0,Math.min(n.color.b*M.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-o.z*n.__farMinusNear), -H.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?U.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):U.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(U)}function e(e,c,k,o,n,v,p){m.data.vertices+=4;m.data.faces++; -U=f(da++);U.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");v instanceof THREE.MeshBasicMaterial?H.copy(v.color):v instanceof THREE.MeshLambertMaterial?G?(M.r=R.r,M.g=R.g,M.b=R.b,b(p,n,M),H.r=Math.max(0,Math.min(v.color.r*M.r,1)),H.g=Math.max(0,Math.min(v.color.g*M.g,1)),H.b=Math.max(0,Math.min(v.color.b*M.b,1))):H.copy(v.color):v instanceof -THREE.MeshDepthMaterial?(K=1-v.__2near/(v.__farPlusNear-n.z*v.__farMinusNear),H.setRGB(K,K,K)):v instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));v.wireframe?U.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+v.wireframeLinewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.wireframeLinecap+"; stroke-linejoin: "+v.wireframeLinejoin):U.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+ -v.opacity);t.appendChild(U)}function f(b){D[b]==null&&(D[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&D[b].setAttribute("shape-rendering","crispEdges"));return D[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,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,w,v,x,p,y,z,A,C=new THREE.Rectangle,E=new THREE.Rectangle,G=!1,H=new THREE.Color(16777215),M=new THREE.Color(16777215),R=new THREE.Color(0),J=new THREE.Color(0), -I=new THREE.Color(0),K,W=new THREE.Vector3,D=[],S=[],U,da,Q,o=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){u=b;w=e;v=u/2;x=w/2;t.setAttribute("viewBox",-v+" "+-x+" "+u+" "+w);t.setAttribute("width",u);t.setAttribute("height",w);C.set(-v,-x,v,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};this.render= -function(b,f){var h,u,w,H,M,D,K,V;this.autoClear&&this.clear();m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,f,this.sortElements);Q=da=0;if(G=b.lights.length>0){K=b.lights;R.setRGB(0,0,0);J.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(u=K.length;h0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b* +255)+","+z+")"),p.fillRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight()))),O.empty())};this.render=function(b,u){function t(b){var e,c,f,k=b.lights;oa.setRGB(0,0,0);za.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b>1,w=Y.height>>1,m=k.scale.x*v,u=k.scale.y*x,o=m*t,n=u*w,ga.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ga)&&(p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(m,-u),p.translate(-t,-w),p.drawImage(Y,0,0),p.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*v,n=k.scale.y*x,ga.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ga)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(o,n),m.program(p), +p.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);p.beginPath();p.moveTo(b.positionScreen.x,b.positionScreen.y);p.lineTo(k.positionScreen.x,k.positionScreen.y);p.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)p.lineWidth=H=b;b=m.linecap;if(M!=b)p.lineCap=M=b;b=m.linejoin;if(Q!=b)p.lineJoin=Q=b;f(m.color.getContextStyle());p.stroke();ga.inflate(m.linewidth*2)}}function A(b,f,k,h,n,v,Y,p,t){m.info.render.vertices+=3;m.info.render.faces++;c(p.opacity);e(p.blending); +T=b.positionScreen.x;V=b.positionScreen.y;X=f.positionScreen.x;o=f.positionScreen.y;ha=k.positionScreen.x;S=k.positionScreen.y;E(T,V,X,o,ha,S);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=Y.uvs[0],$a(T,V,X,o,ha,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,na.copy(Y.vertexNormalsWorld[0]),ta=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5, +Ba=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(Y.vertexNormalsWorld[1]),Ca=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,va=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(Y.vertexNormalsWorld[2]),Aa=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,Ea=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,$a(T,V,X,o,ha,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=Y.uvs[0],$a(T,V,X,o,ha,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map)),e(THREE.SubtractiveBlending)),aa?!p.wireframe&&p.shading==THREE.SmoothShading&&Y.vertexNormalsWorld.length==3?(U.r=$.r=da.r=oa.r,U.g=$.g=da.g=oa.g,U.b=$.b=da.b=oa.b,w(t,Y.v1.positionWorld,Y.vertexNormalsWorld[0],U),w(t,Y.v2.positionWorld,Y.vertexNormalsWorld[1],$),w(t,Y.v3.positionWorld,Y.vertexNormalsWorld[2],da),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)),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),ja.r=($.r+da.r)*0.5,ja.g=($.g+da.g)*0.5,ja.b=($.b+da.b)*0.5,qa=Xa(U,$,da,ja),Sa(T,V,X,o,ha,S,0,0,1,0,0,1,qa)):(ka.r=oa.r,ka.g=oa.g,ka.b=oa.b,w(t,Y.centroidWorld,Y.normalWorld, +ka),ia.r=Math.max(0,Math.min(p.color.r*ka.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ka.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ka.b,1)),p.wireframe?Ia(ia,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ia)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)N=u.near,ea=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,N,ea),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,ea),da.r=da.g=da.b=1-Na(k.positionScreen.z, +N,ea),ja.r=($.r+da.r)*0.5,ja.g=($.g+da.g)*0.5,ja.b=($.b+da.b)*0.5,qa=Xa(U,$,da,ja),Sa(T,V,X,o,ha,S,0,0,1,0,0,1,qa);else if(p instanceof THREE.MeshNormalMaterial)ia.r=Ta(Y.normalWorld.x),ia.g=Ta(Y.normalWorld.y),ia.b=Ta(Y.normalWorld.z),p.wireframe?Ia(ia,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ia)}function C(b,f,k,h,n,p,v,Y,t){m.info.render.vertices+=4;m.info.render.faces++;c(Y.opacity);e(Y.blending);if(Y.map||Y.envMap)A(b,f,h,0,1,3,v,Y,t),A(n,k,p,1,2,3,v,Y,t);else if(T=b.positionScreen.x, +V=b.positionScreen.y,X=f.positionScreen.x,o=f.positionScreen.y,ha=k.positionScreen.x,S=k.positionScreen.y,ma=h.positionScreen.x,ca=h.positionScreen.y,ra=n.positionScreen.x,la=n.positionScreen.y,pa=p.positionScreen.x,fa=p.positionScreen.y,Y instanceof THREE.MeshBasicMaterial)G(T,V,X,o,ha,S,ma,ca),Y.wireframe?Ia(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(Y.color);else if(Y instanceof THREE.MeshLambertMaterial)aa?!Y.wireframe&&Y.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length== +4?(U.r=$.r=da.r=ja.r=oa.r,U.g=$.g=da.g=ja.g=oa.g,U.b=$.b=da.b=ja.b=oa.b,w(t,v.v1.positionWorld,v.vertexNormalsWorld[0],U),w(t,v.v2.positionWorld,v.vertexNormalsWorld[1],$),w(t,v.v4.positionWorld,v.vertexNormalsWorld[3],da),w(t,v.v3.positionWorld,v.vertexNormalsWorld[2],ja),U.r=Math.max(0,Math.min(Y.color.r*U.r,1)),U.g=Math.max(0,Math.min(Y.color.g*U.g,1)),U.b=Math.max(0,Math.min(Y.color.b*U.b,1)),$.r=Math.max(0,Math.min(Y.color.r*$.r,1)),$.g=Math.max(0,Math.min(Y.color.g*$.g,1)),$.b=Math.max(0,Math.min(Y.color.b* +$.b,1)),da.r=Math.max(0,Math.min(Y.color.r*da.r,1)),da.g=Math.max(0,Math.min(Y.color.g*da.g,1)),da.b=Math.max(0,Math.min(Y.color.b*da.b,1)),ja.r=Math.max(0,Math.min(Y.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(Y.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(Y.color.b*ja.b,1)),qa=Xa(U,$,da,ja),E(T,V,X,o,ma,ca),Sa(T,V,X,o,ma,ca,0,0,1,0,0,1,qa),E(ra,la,ha,S,pa,fa),Sa(ra,la,ha,S,pa,fa,1,0,1,1,0,1,qa)):(ka.r=oa.r,ka.g=oa.g,ka.b=oa.b,w(t,v.centroidWorld,v.normalWorld,ka),ia.r=Math.max(0,Math.min(Y.color.r*ka.r, +1)),ia.g=Math.max(0,Math.min(Y.color.g*ka.g,1)),ia.b=Math.max(0,Math.min(Y.color.b*ka.b,1)),G(T,V,X,o,ha,S,ma,ca),Y.wireframe?Ia(ia,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(ia)):(G(T,V,X,o,ha,S,ma,ca),Y.wireframe?Ia(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(Y.color));else if(Y instanceof THREE.MeshNormalMaterial)ia.r=Ta(v.normalWorld.x),ia.g=Ta(v.normalWorld.y),ia.b=Ta(v.normalWorld.z),G(T,V,X,o,ha,S,ma,ca),Y.wireframe?Ia(ia,Y.wireframeLinewidth, +Y.wireframeLinecap,Y.wireframeLinejoin):Ja(ia);else if(Y instanceof THREE.MeshDepthMaterial)N=u.near,ea=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,N,ea),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,ea),da.r=da.g=da.b=1-Na(h.positionScreen.z,N,ea),ja.r=ja.g=ja.b=1-Na(k.positionScreen.z,N,ea),qa=Xa(U,$,da,ja),E(T,V,X,o,ma,ca),Sa(T,V,X,o,ma,ca,0,0,1,0,0,1,qa),E(ra,la,ha,S,pa,fa),Sa(ra,la,ha,S,pa,fa,1,0,1,1,0,1,qa)}function E(b,e,c,f,k,h){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(b,e); +p.closePath()}function G(b,e,c,f,k,h,m,o){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(m,o);p.lineTo(b,e);p.closePath()}function Ia(b,e,c,k){if(H!=e)p.lineWidth=H=e;if(M!=c)p.lineCap=M=c;if(Q!=k)p.lineJoin=Q=k;f(b.getContextStyle());p.stroke();ga.inflate(e*2)}function Ja(b){h(b.getContextStyle());p.fill()}function $a(b,e,c,f,k,m,o,n,Y,v,u,t,w){if(w.image.width!=0){if(w.needsUpdate==!0||sa[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping,Ma=w.wrapT==THREE.RepeatWrapping;sa[w.id]= +p.createPattern(w.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");w.needsUpdate=!1}h(sa[w.id]);var x=w.offset.x/w.repeat.x,Ma=w.offset.y/w.repeat.y,L=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+x)*L,n=(n+Ma)*w,Y=(Y+x)*L,v=(v+Ma)*w,u=(u+x)*L,t=(t+Ma)*w;c-=b;f-=e;k-=b;m-=e;Y-=o;v-=n;u-=o;t-=n;x=1/(Y*t-u*v);w=(t*c-v*k)*x;v=(t*f-v*m)*x;c=(Y*k-u*c)*x;f=(Y*m-u*f)*x;b=b-w*o-c*n;e=e-v*o-f*n;p.save();p.transform(w,v,c,f,b,e);p.fill();p.restore()}}function Sa(b,e, +c,f,k,h,m,o,n,Y,v,u,t){var w,x;w=t.width-1;x=t.height-1;m*=w;o*=x;n*=w;Y*=x;v*=w;u*=x;c-=b;f-=e;k-=b;h-=e;n-=m;Y-=o;v-=m;u-=o;x=1/(n*u-v*Y);w=(u*c-Y*k)*x;Y=(u*f-Y*h)*x;c=(n*k-v*c)*x;f=(n*h-v*f)*x;b=b-w*m-c*o;e=e-Y*m-f*o;p.save();p.transform(w,Y,c,f,b,e);p.clip();p.drawImage(t,0,0);p.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),v=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Y[0]=k<0?0:k>255? +255:k;Y[1]=h<0?0:h>255?255:h;Y[2]=b<0?0:b>255?255:b;Y[4]=m<0?0:m>255?255:m;Y[5]=o<0?0:o>255?255:o;Y[6]=e<0?0:e>255?255:e;Y[8]=n<0?0:n>255?255:n;Y[9]=v<0?0:v>255?255:v;Y[10]=c<0?0:c>255?255:c;Y[12]=p<0?0:p>255?255:p;Y[13]=u<0?0:u>255?255:u;Y[14]=f<0?0:f>255?255:f;Z.putImageData(Fa,0,0);Wa.drawImage(ya,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():p.setTransform(1,0,0,-1,v,x);m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,u,this.sortElements);(aa=b.lights.length>0)&&t(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&&(W.sub(h.position,e.centroidWorld),W.normalize(),m=e.normalWorld.dot(W)*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,v){m.info.render.vertices+=3;m.info.render.faces++;T=f(V++); +T.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?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(M.r=Q.r,M.g=Q.g,M.b=Q.b,b(v,o,M),H.r=Math.max(0,Math.min(n.color.r*M.r,1)),H.g=Math.max(0,Math.min(n.color.g*M.g,1)),H.b=Math.max(0,Math.min(n.color.b*M.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear- +o.z*n.__farMinusNear),H.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?T.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):T.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(T)}function e(e,c,k,o,n,v,p){m.info.render.vertices+= +4;m.info.render.faces++;T=f(V++);T.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");v instanceof THREE.MeshBasicMaterial?H.copy(v.color):v instanceof THREE.MeshLambertMaterial?G?(M.r=Q.r,M.g=Q.g,M.b=Q.b,b(p,n,M),H.r=Math.max(0,Math.min(v.color.r*M.r,1)),H.g=Math.max(0,Math.min(v.color.g*M.g,1)),H.b=Math.max(0,Math.min(v.color.b*M.b,1))): +H.copy(v.color):v instanceof THREE.MeshDepthMaterial?(K=1-v.__2near/(v.__farPlusNear-n.z*v.__farMinusNear),H.setRGB(K,K,K)):v instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));v.wireframe?T.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+v.wireframeLinewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.wireframeLinecap+"; stroke-linejoin: "+v.wireframeLinejoin):T.setAttribute("style","fill: "+H.getContextStyle()+ +"; fill-opacity: "+v.opacity);t.appendChild(T)}function f(b){D[b]==null&&(D[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&D[b].setAttribute("shape-rendering","crispEdges"));return D[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,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,w,v,x,p,y,z,A,C=new THREE.Rectangle,E=new THREE.Rectangle,G=!1,H=new THREE.Color(16777215),M=new THREE.Color(16777215),Q=new THREE.Color(0), +J=new THREE.Color(0),I=new THREE.Color(0),K,W=new THREE.Vector3,D=[],R=[],T,V,X,o=1;this.domElement=t;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){u=b;w=e;v=u/2;x=w/2;t.setAttribute("viewBox",-v+" "+-x+" "+u+" "+w);t.setAttribute("width",u);t.setAttribute("height",w);C.set(-v,-x,v,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])}; +this.render=function(b,f){var h,u,w,H,M,D,K,U;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);X=V=0;if(G=b.lights.length>0){K=b.lights;Q.setRGB(0,0,0);J.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(u=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&& +f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,ta);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix, +!1,ta),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,k.boneMatrices));return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,b=e(b,c,f,k,m).attributes;if(!k.morphTargets&&b.position>=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,p=m.morphTargetForcedOrder,v=m.morphTargetInfluences;ft&&(u=w,t=v[u]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=t;p[u]=1;t=-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)),Q.data.vertices+=h.__webglFaceCount,Q.data.faces+=h.__webglFaceCount/3,Q.data.drawCalls++):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),Q.data.drawCalls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),Q.data.drawCalls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount), -Q.data.drawCalls++)}}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,p,v,t,u,w,x=b.count*3;for(w=0;w=0;c--)b[c].object==e&&b.splice(c,1)}function M(b){function e(b){var h=[];c=0;for(f=b.length;c65535&&(v[o].counter+=1,p=v[o].hash+"_"+v[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:t})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[u])} -function R(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 I(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,da(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,da(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,da(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,da(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,U(e.magFilter)), -o.texParameteri(b,o.TEXTURE_MIN_FILTER,U(e.minFilter)))}function K(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture();o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,da(b.format),b.image.width,b.image.height,0,da(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);I(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+ -e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function W(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);I(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,da(b.format),b.width,b.height,0,da(b.format),da(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),I(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,da(b.format),b.width,b.height,0,da(b.format),da(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=ta,b=N,f=ea,h=ka);e!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ma=e)}function D(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 S(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 U(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function da(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; +function Q(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=la){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)}la=b}}function I(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,T(e.magFilter)), +o.texParameteri(b,o.TEXTURE_MIN_FILTER,T(e.minFilter)))}function K(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),X.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);I(o.TEXTURE_2D,b,b.image);b.needsUpdate= +!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function W(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);I(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),I(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=N,f=da,h=ja);e!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ma=e)}function D(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 T(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 Q=this,o,pa=[],T=null,ma=null,ca=null,na=null,ja=null,la=null,ga=null,Z=null,V=null,$=null,ea=0,ka=0,ta=0,N=0,fa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ra=new THREE.Matrix4,ua=new Float32Array(16),sa=new Float32Array(16),xa=new THREE.Vector4,Ca= -{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},za=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,O=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ha=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0, -faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=za;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var aa,ia=[],b=THREE.ShaderLib.depthRGBA,qa=THREE.UniformsUtils.clone(b.uniforms),ya=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader, -uniforms:qa}),va=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:qa,morphTargets:!0});ya._shadowPass=!0;va._shadowPass=!0;try{if(!(o=za.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(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(O.r,O.g,O.b,ha);this.context=o;var Fa=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,S("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(Y.program,S("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.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 Ba=!1;this.setSize=function(b,e){za.width=b;za.height=e;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(b,e,c,f){ea=b;ka=e;ta=c;N=f;o.viewport(ea,ka,ta,N)};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){O.setHex(b);ha=e;o.clearColor(O.r,O.g,O.b,ha)};this.setClearColor=function(b,e){O.copy(b);ha=e;o.clearColor(O.r,O.g,O.b,ha)};this.getClearColor=function(){return O};this.getClearAlpha=function(){return ha};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, +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 X=this,o,ha=[],S=null,ma=null,ca=null,ra=null,la=null,pa=null,fa=null,ia=null,U=null,$=null,da=0,ja=0,sa=0,N=0,ea=[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),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,O=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ga=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 aa,ka=[],b=THREE.ShaderLib.depthRGBA,oa=THREE.UniformsUtils.clone(b.uniforms),za=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader, +vertexShader:b.vertexShader,uniforms:oa}),xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:oa,morphTargets:!0});za._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(na){console.error(na)}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(O.r,O.g,O.b,ga);this.context=o;var ya=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,Z={};Z.vertices=new Float32Array(16);Z.faces=new Uint16Array(6);i=0;Z.vertices[i++]=-1;Z.vertices[i++]=-1;Z.vertices[i++]=0;Z.vertices[i++]=1;Z.vertices[i++]=1; +Z.vertices[i++]=-1;Z.vertices[i++]=1;Z.vertices[i++]=1;Z.vertices[i++]=1;Z.vertices[i++]=1;Z.vertices[i++]=1;Z.vertices[i++]=0;Z.vertices[i++]=-1;Z.vertices[i++]=1;Z.vertices[i++]=0;i=Z.vertices[i++]=0;Z.faces[i++]=0;Z.faces[i++]=1;Z.faces[i++]=2;Z.faces[i++]=0;Z.faces[i++]=2;Z.faces[i++]=3;Z.vertexBuffer=o.createBuffer();Z.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,Z.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,Z.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Z.elementBuffer); +o.bufferData(o.ELEMENT_ARRAY_BUFFER,Z.faces,o.STATIC_DRAW);Z.program=o.createProgram();o.attachShader(Z.program,R("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(Z.program,R("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(Z.program);Z.attributes={};Z.uniforms={};Z.attributes.position=o.getAttribLocation(Z.program,"position");Z.attributes.uv=o.getAttribLocation(Z.program,"uv");Z.uniforms.uvOffset=o.getUniformLocation(Z.program,"uvOffset");Z.uniforms.uvScale=o.getUniformLocation(Z.program, +"uvScale");Z.uniforms.rotation=o.getUniformLocation(Z.program,"rotation");Z.uniforms.scale=o.getUniformLocation(Z.program,"scale");Z.uniforms.alignment=o.getUniformLocation(Z.program,"alignment");Z.uniforms.map=o.getUniformLocation(Z.program,"map");Z.uniforms.opacity=o.getUniformLocation(Z.program,"opacity");Z.uniforms.useScreenCoordinates=o.getUniformLocation(Z.program,"useScreenCoordinates");Z.uniforms.affectedByDistance=o.getUniformLocation(Z.program,"affectedByDistance");Z.uniforms.screenPosition= +o.getUniformLocation(Z.program,"screenPosition");Z.uniforms.modelViewMatrix=o.getUniformLocation(Z.program,"modelViewMatrix");Z.uniforms.projectionMatrix=o.getUniformLocation(Z.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){da=b;ja=e;sa=c;N=f;o.viewport(da,ja,sa,N)};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){O.setHex(b);ga=e;o.clearColor(O.r,O.g,O.b,ga)};this.setClearColor=function(b,e){O.copy(b);ga=e;o.clearColor(O.r,O.g,O.b,ga)};this.getClearColor=function(){return O};this.getClearAlpha=function(){return ga};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(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);w.tangent>=0&&o.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),o.enableVertexAttribArray(w.skinVertexB), -o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(h in b.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(o.enableVertexAttribArray(w[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){W(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,v){var L,ha,O,E,G,H,aa,N,I=b.lights,qa=b.fog;this.shadowMapEnabled&&z(b,c);Q.data.vertices=0;Q.data.faces=0;Q.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(sa);c.projectionMatrix.flattenToArray(ua);ra.multiply(c.projectionMatrix,c.matrixWorldInverse);u(ra);this.initWebGLObjects(b);W(o);(this.autoClear||v)&&this.clear();G=b.__webglObjects.length;for(v=0;v=0;v--)if(L=b.__webglObjects[v],L.render){aa=L.object;N=L.buffer;O=L.opaque; -m(aa);for(L=0;L=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);w.tangent>=0&&o.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA), +o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(h in b.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(o.enableVertexAttribArray(w[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){W(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,v){var L,ga,O,E,G,H,aa,N,I=b.lights,oa=b.fog;this.shadowMapEnabled&&z(b,c);X.info.render.calls=0;X.info.render.vertices=0;X.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);qa.multiply(c.projectionMatrix,c.matrixWorldInverse);u(qa);this.initWebGLObjects(b);W(o);(this.autoClear||v)&&this.clear();G=b.__webglObjects.length;for(v=0;v=0;v--)if(L=b.__webglObjects[v],L.render){aa=L.object;N=L.buffer;O=L.opaque; +m(aa);for(L=0;L0||x.faceVertexUvs.length>0)n.__uvArray=new Float32Array(p* -2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(p*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(p*4),n.__skinVertexBArray=new Float32Array(p*4),n.__skinIndexArray=new Float32Array(p*4),n.__skinWeightArray=new Float32Array(p*4);n.__faceArray=new Uint16Array(y*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*6:0));n.__lineArray=new Uint16Array(ha*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];x=0;for(L= -n.numMorphTargets;x=0;k--)e[k]==f&&e.splice(k,1)}else f instanceof THREE.MarchingCubes&&H(e.__webglObjectsImmediate,f);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,ka,z));Aa&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,na,z));Ea&&xa.hasTangents&& -(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,Z,z));Ba&&S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,da,z));Ba&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Ca&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ta,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,z));P>0&&(o.bindBuffer(o.ARRAY_BUFFER, -p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,va,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ca,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,sa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ga,z));y&&(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)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;G(m)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=ha=y=y=void 0;x=h.vertices;v=h.colors;t=x.length;p=v.length;u=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors; -if(h.__dirtyVertices){for(y=0;y0||x.faceVertexUvs.length> +0)n.__uvArray=new Float32Array(p*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(p*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(p*4),n.__skinVertexBArray=new Float32Array(p*4),n.__skinIndexArray=new Float32Array(p*4),n.__skinWeightArray=new Float32Array(p*4);n.__faceArray=new Uint16Array(y*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*6:0));n.__lineArray=new Uint16Array(ga*2);if(n.numMorphTargets){n.__morphTargetsArrays= +[];x=0;for(L=n.numMorphTargets;x=0;k--)e[k]==f&&e.splice(k,1)}else f instanceof THREE.MarchingCubes&&H(e.__webglObjectsImmediate,f);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,ia,z));ab&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Aa&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,la,z));Aa&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ra,z));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, +p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,z));P>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ca,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,fa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER, +ha,z));y&&(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)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;G(m)}else if(h instanceof THREE.Ribbon){k= +h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=ga=y=y=void 0;x=h.vertices;v=h.colors;t=x.length;p=v.length;u=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors;if(h.__dirtyVertices){for(y=0;yb&&(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(D=b.length;--D>=0;){la=D;ga=D-1;ga<0&&(ga=b.length- -1);for(var c=0,e=p+w*2,c=0;cb&&(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(D=b.length;--D>=0;){pa=D;fa=D-1;fa<0&&(fa=b.length- +1);for(var c=0,e=p+w*2,c=0;c=0;U--){da=U/w;Q=t*(1-da);da=u*Math.sin(da*Math.PI/2);D=0;for(S=E.length;D=0;T--){V=T/w;X=t*(1-V);V=u*Math.sin(V*Math.PI/2);D=0;for(R=E.length;D0)for(u=0;u2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}t=u;h<=t&&(t=0);u=t+1;h<=u&&(u=0);w=u+1;h<=w&&(w=0);var x;a:{x=b;var p=t,y=u,z=w,A=h,C=k,E=void 0,G=void 0,H=void 0, -M=void 0,R=void 0,J=void 0,I=void 0,K=void 0,W=void 0,G=x[C[p]].x,H=x[C[p]].y,M=x[C[y]].x,R=x[C[y]].y,J=x[C[z]].x,I=x[C[z]].y;if(1.0E-10>(M-G)*(I-H)-(R-H)*(J-G))x=!1;else{for(E=0;E=0&&U>=0&&Q>=0){x= -!1;break a}}x=!0}}if(x){m.push([b[k[t]],b[k[u]],b[k[w]]]);n.push([k[t],k[u],k[w]]);t=u;for(w=u+1;w(M-G)*(I-H)-(Q-H)*(J-G))x=!1;else{for(E=0;E=0&&T>=0&&X>=0){x=!1; +break a}}x=!0}}if(x){m.push([b[k[t]],b[k[u]],b[k[w]]]);n.push([k[t],k[u],k[w]]);t=u;for(w=u+1;w>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=w(b,c),f=w(b,c+1),k=w(b,c+2);return(w(b,c+3)<<24)+(k<<16)+(f<<8)+e}function t(b,c){var e=w(b,c);return(w(b,c+1)<<8)+e}function u(b,c){var e=w(b,c);return e>127?e-256:e}function w(b,c){return b.charCodeAt(c)&255}function v(c){var e, -f,k;e=h(b,c);f=h(b,c+R);k=h(b,c+J);c=t(b,c+I);C.faces.push(new THREE.Face3(e,f,k,null,null,C.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+R);k=h(b,c+J);m=t(b,c+I);o=h(b,c+K);p=h(b,c+W);c=h(b,c+D);m=C.materials[m];var v=H[p*3],u=H[p*3+1];p=H[p*3+2];var w=H[c*3],L=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(v,u,p),new THREE.Vector3(w,L,c)],null,m))}function p(c){var e,f,k,m;e=h(b,c);f=h(b,c+S);k=h(b,c+U);m=h(b, -c+da);c=t(b,c+Q);C.faces.push(new THREE.Face4(e,f,k,m,null,null,C.materials[c]))}function y(c){var e,f,k,m,p,v,u,w;e=h(b,c);f=h(b,c+S);k=h(b,c+U);m=h(b,c+da);p=t(b,c+Q);v=h(b,c+o);u=h(b,c+pa);w=h(b,c+T);c=h(b,c+ma);p=C.materials[p];var x=H[u*3],L=H[u*3+1];u=H[u*3+2];var O=H[w*3],ha=H[w*3+1];w=H[w*3+2];var y=H[c*3],z=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(H[v*3],H[v*3+1],H[v*3+2]),new THREE.Vector3(x,L,u),new THREE.Vector3(O,ha,w),new THREE.Vector3(y,z,c)],null, -p))}function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+ca);k=h(b,c+na);c=M[e*2];m=M[e*2+1];e=M[f*2];var o=C.faceVertexUvs[0];f=M[f*2+1];var p=M[k*2];k=M[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+ja);k=h(b,c+la);m=h(b,c+ga);c=M[e*2];o=M[e*2+1];e=M[f*2];p=M[f*2+1];f=M[k*2];var t=C.faceVertexUvs[0];k=M[k*2+1];var v=M[m*2];m=M[m*2+1];var u=[];u.push(new THREE.UV(c,o));u.push(new THREE.UV(e,p));u.push(new THREE.UV(f, -k));u.push(new THREE.UV(v,m));t.push(u)}var C=this,E=0,G,H=[],M=[],R,J,I,K,W,D,S,U,da,Q,o,pa,T,ma,ca,na,ja,la,ga,Z,V,$,ea,ka,ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,c);G={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b, -E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=G.header_bytes;R=G.vertex_index_bytes;J=G.vertex_index_bytes*2;I=G.vertex_index_bytes*3;K=G.vertex_index_bytes*3+G.material_index_bytes;W=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;D=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*2;S=G.vertex_index_bytes; -U=G.vertex_index_bytes*2;da=G.vertex_index_bytes*3;Q=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;pa=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;T=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;ma=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;ca=G.uv_index_bytes;na=G.uv_index_bytes*2;ja=G.uv_index_bytes;la=G.uv_index_bytes*2;ga=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes;ta=G.vertex_index_bytes* -4+G.material_index_bytes;Z=G.ntri_flat*c;V=G.ntri_smooth*(c+G.normal_index_bytes*3);$=G.ntri_flat_uv*(c+G.uv_index_bytes*3);ea=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);ka=G.nquad_flat*ta;c=G.nquad_smooth*(ta+G.normal_index_bytes*4);ta=G.nquad_flat_uv*(ta+G.uv_index_bytes*4);E+=function(c){for(var f,h,m,n=G.vertex_coordinate_bytes*3,o=c+G.nvertices*n;c=0){y=o.invBindMatrices[u];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?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){t=p.output[o];break}m=t!==void 0?t instanceof THREE.Matrix4?m.multiply(m,t):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};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b3)for(h=2;h0&&(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 I)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ka[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()); +1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=(new I).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=ia.evaluate(".//dae:float",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(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 I)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ja[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)};W.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&&(W=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(R,W);object.name=p;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=E.visible;T.scene.addObject(object);T.objects[p]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b)); -if(E.castsShadow)b=new THREE.ShadowVolume(R),T.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}}else G=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=p,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=E.visible!==void 0?E.visible:!1,T.scene.addObject(object),T.objects[p]=object,T.empties[p]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}function t(b){return function(c){T.geometries[b]=c;n();da-=1;e.onLoadComplete();w()}}function u(b){return function(c){T.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:pa,loadedModels:o-da,loadedTextures:pa-Q},T);e.onLoadProgress();da==0&&Q==0&&c(T)} -var v,x,p,y,z,A,C,E,G,H,M,R,J,I,K,W,D,S,U,da,Q,o,pa,T;S=b.data;K=new THREE.BinaryLoader;U=new THREE.JSONLoader;Q=da=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in S.objects)if(E=S.objects[p],E.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(S.transform){b=S.transform.position;H=S.transform.rotation;var ma=S.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);H&&T.scene.rotation.set(H[0], -H[1],H[2]);ma&&T.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&T.scene.updateMatrix()}b=function(){Q-=1;w();e.onLoadComplete()};for(z in S.cameras){H=S.cameras[z];if(H.type=="perspective")J=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);G=H.position;H=H.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(H[0],H[1],H[2]);T.cameras[z]=J}for(y in S.lights)z=S.lights[y], -J=z.color!==void 0?z.color:16777215,H=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(G=z.direction,D=new THREE.DirectionalLight(J,H),D.position.set(G[0],G[1],G[2]),D.position.normalize()):z.type=="point"?(G=z.position,d=z.distance,D=new THREE.PointLight(J,H,d),D.position.set(G[0],G[1],G[2])):z.type=="ambient"&&(D=new THREE.AmbientLight(J)),T.scene.addLight(D),T.lights[y]=D;for(A in S.fogs)y=S.fogs[A],y.type=="linear"?I=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(I=new THREE.FogExp2(0, -y.density)),H=y.color,I.color.setRGB(H[0],H[1],H[2]),T.fogs[A]=I;if(T.cameras&&S.defaults.camera)T.currentCamera=T.cameras[S.defaults.camera];if(T.fogs&&S.defaults.fog)T.scene.fog=T.fogs[S.defaults.fog];H=S.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(H[0],H[1],H[2]);T.bgColorAlpha=S.defaults.bgalpha;for(v in S.geometries)if(A=S.geometries[v],A.type=="bin_mesh"||A.type=="ascii_mesh")da+=1,e.onLoadStart();o=da;for(v in S.geometries)A=S.geometries[v],A.type=="cube"?(R=new THREE.CubeGeometry(A.width, -A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),T.geometries[v]=R):A.type=="plane"?(R=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),T.geometries[v]=R):A.type=="sphere"?(R=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),T.geometries[v]=R):A.type=="cylinder"?(R=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),T.geometries[v]=R):A.type=="torus"?(R=new THREE.TorusGeometry(A.radius,A.tube, -A.segmentsR,A.segmentsT),T.geometries[v]=R):A.type=="icosahedron"?(R=new THREE.IcosahedronGeometry(A.subdivisions),T.geometries[v]=R):A.type=="bin_mesh"?K.load({model:f(A.url,S.urlBaseType),callback:t(v)}):A.type=="ascii_mesh"?U.load({model:f(A.url,S.urlBaseType),callback:t(v)}):A.type=="embedded_mesh"&&(A=S.embeds[A.id])&&U.createModel(A,u(v),"");for(C in S.textures)if(v=S.textures[C],v.url instanceof Array){Q+=v.url.length;for(K=0;K1&&(W=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(Q,W);object.name=p;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=E.visible;S.scene.addObject(object);S.objects[p]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),S.scene.collisions.colliders.push(b)); +if(E.castsShadow)b=new THREE.ShadowVolume(Q),S.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},S.triggers[object.name]=b)}}else G=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=p,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=E.visible!==void 0?E.visible:!1,S.scene.addObject(object),S.objects[p]=object,S.empties[p]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},S.triggers[object.name]=b)}function t(b){return function(c){S.geometries[b]=c;n();V-=1;e.onLoadComplete();w()}}function u(b){return function(c){S.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:ha,loadedModels:o-V,loadedTextures:ha-X},S);e.onLoadProgress();V==0&&X==0&&c(S)} +var v,x,p,y,z,A,C,E,G,H,M,Q,J,I,K,W,D,R,T,V,X,o,ha,S;R=b.data;K=new THREE.BinaryLoader;T=new THREE.JSONLoader;X=V=0;S={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in R.objects)if(E=R.objects[p],E.meshCollider){b=!0;break}if(b)S.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;H=R.transform.rotation;var ma=R.transform.scale;b&&S.scene.position.set(b[0],b[1],b[2]);H&&S.scene.rotation.set(H[0], +H[1],H[2]);ma&&S.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&S.scene.updateMatrix()}b=function(){X-=1;w();e.onLoadComplete()};for(z in R.cameras){H=R.cameras[z];if(H.type=="perspective")J=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);G=H.position;H=H.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(H[0],H[1],H[2]);S.cameras[z]=J}for(y in R.lights)z=R.lights[y], +J=z.color!==void 0?z.color:16777215,H=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(G=z.direction,D=new THREE.DirectionalLight(J,H),D.position.set(G[0],G[1],G[2]),D.position.normalize()):z.type=="point"?(G=z.position,d=z.distance,D=new THREE.PointLight(J,H,d),D.position.set(G[0],G[1],G[2])):z.type=="ambient"&&(D=new THREE.AmbientLight(J)),S.scene.addLight(D),S.lights[y]=D;for(A in R.fogs)y=R.fogs[A],y.type=="linear"?I=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(I=new THREE.FogExp2(0, +y.density)),H=y.color,I.color.setRGB(H[0],H[1],H[2]),S.fogs[A]=I;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];H=R.defaults.bgcolor;S.bgColor=new THREE.Color;S.bgColor.setRGB(H[0],H[1],H[2]);S.bgColorAlpha=R.defaults.bgalpha;for(v in R.geometries)if(A=R.geometries[v],A.type=="bin_mesh"||A.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(v in R.geometries)A=R.geometries[v],A.type=="cube"?(Q=new THREE.CubeGeometry(A.width, +A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),S.geometries[v]=Q):A.type=="plane"?(Q=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),S.geometries[v]=Q):A.type=="sphere"?(Q=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),S.geometries[v]=Q):A.type=="cylinder"?(Q=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),S.geometries[v]=Q):A.type=="torus"?(Q=new THREE.TorusGeometry(A.radius,A.tube, +A.segmentsR,A.segmentsT),S.geometries[v]=Q):A.type=="icosahedron"?(Q=new THREE.IcosahedronGeometry(A.subdivisions),S.geometries[v]=Q):A.type=="bin_mesh"?K.load({model:f(A.url,R.urlBaseType),callback:t(v)}):A.type=="ascii_mesh"?T.load({model:f(A.url,R.urlBaseType),callback:t(v)}):A.type=="embedded_mesh"&&(A=R.embeds[A.id])&&T.createModel(A,u(v),"");for(C in R.textures)if(v=R.textures[C],v.url instanceof Array){X+=v.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&&(t=this.size-1);var x=Math.floor(u-n);x<1&&(x=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var p=Math.floor(w-n);p<1&&(p=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size- 1);for(var y,z,A,C,E,G;v0&&(this.field[A+y]+=C)}}};this.addPlaneX=function(b,c){var h,m,k,n,t,u=this.size,w=this.yd,v=this.zd,x=this.field,p=u*Math.sqrt(b/c);p>u&&(p=u);for(h=0;h0)for(m=0;m0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b* +Ba,da,sa,va,a=16;qa=document.createElement("canvas");qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);Ba=ra.getImageData(0,0,2,2);da=Ba.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){j=a;n=b;i=Math.floor(j/2);o=Math.floor(n/2);l.width=j;l.height= +n;ka.set(-i,-o,i,o);$.set(-i,-o,i,o);w=1;u=0;O=N=B=R=M=null};this.setClearColor=function(a,b){r.copy(a);s=b;$.set(-i,-o,i,o)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;$.set(-i,-o,i,o)};this.clear=function(){k.setTransform(1,0,0,-1,i,o);$.isEmpty()||($.minSelf(ka),$.inflate(2),s<1&&k.clearRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight())),s>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b* 255)+","+s+")"),k.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))),$.empty())};this.render=function(a,j){function l(a){var b,c,d,e=a.lights;aa.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);a=0;for(b=e.length;a>1,m=l.height>>1,g=f.scale.x*i,n=f.scale.y*o,h=g*p,j=n*m,Y.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(Y)&&(k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(g,-n),k.translate(-p,-m),k.drawImage(l,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*i,j=f.scale.y*o,Y.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(Y)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(h,j),g.program(k), -k.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)k.lineWidth=B=a;a=g.linecap;if(N!=a)k.lineCap=N=a;a=g.linejoin;if(O!=a)k.lineJoin=O=a;d(g.color.getContextStyle());k.stroke();Y.inflate(g.linewidth*2)}}function u(a,d,e,f,h,k,i,p,l){g.data.vertices+=3;g.data.faces++;b(p.opacity);c(p.blending);F=a.positionScreen.x; -K=a.positionScreen.y;I=d.positionScreen.x;J=d.positionScreen.y;P=e.positionScreen.x;Q=e.positionScreen.y;M(F,K,I,J,P,Q);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[f].u,W[f].v,W[h].u,W[h].v,W[k].u,W[k].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,S.copy(i.vertexNormalsWorld[0]),Da=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ea=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)* -0.5+0.5,S.copy(i.vertexNormalsWorld[1]),Fa=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ga=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[2]),Ha=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ia=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,Ca(F,K,I,J,P,Q,Da,Ea,Fa,Ga,Ha,Ia,p.envMap)}else p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&& -(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[f].u,W[f].v,W[h].u,W[h].v,W[k].u,W[k].v,p.map)),c(THREE.SubtractiveBlending)),Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(x.r=q.r=v.r=aa.r,x.g=q.g=v.g=aa.g,x.b=q.b=v.b=aa.b,n(l,i.v1.positionWorld,i.vertexNormalsWorld[0],x),n(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),n(l,i.v3.positionWorld,i.vertexNormalsWorld[2],v),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b* -x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*v.g,1)),v.b=Math.max(0,Math.min(p.color.b*v.b,1)),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,ba=wa(x,q,v,G),ma(F,K,I,J,P,Q,0,0,1,0,0,1,ba)):(ca.r=aa.r,ca.g=aa.g,ca.b=aa.b,n(l,i.centroidWorld,i.normalWorld,ca),z.r=Math.max(0,Math.min(p.color.r*ca.r,1)),z.g=Math.max(0,Math.min(p.color.g* -ca.g,1)),z.b=Math.max(0,Math.min(p.color.b*ca.b,1)),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)):p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshDepthMaterial)ea=j.near,Z=j.far,x.r=x.g=x.b=1-la(a.positionScreen.z,ea,Z),q.r=q.g=q.b=1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(e.positionScreen.z,ea,Z),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,ba=wa(x,q,v,G),ma(F,K,I,J, -P,Q,0,0,1,0,0,1,ba);else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)}function w(a,d,e,f,h,k,i,p,l){g.data.vertices+=4;g.data.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)u(a,d,f,0,1,3,i,p,l),u(h,e,k,1,2,3,i,p,l);else if(F=a.positionScreen.x,K=a.positionScreen.y,I=d.positionScreen.x,J=d.positionScreen.y,P=e.positionScreen.x,Q=e.positionScreen.y, -V=f.positionScreen.x,E=f.positionScreen.y,pa=h.positionScreen.x,y=h.positionScreen.y,L=k.positionScreen.x,H=k.positionScreen.y,p instanceof THREE.MeshBasicMaterial)R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(x.r=q.r=v.r=G.r=aa.r,x.g=q.g=v.g=G.g=aa.g,x.b=q.b=v.b=G.b=aa.b,n(l,i.v1.positionWorld,i.vertexNormalsWorld[0], -x),n(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),n(l,i.v4.positionWorld,i.vertexNormalsWorld[3],v),n(l,i.v3.positionWorld,i.vertexNormalsWorld[2],G),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*v.g,1)),v.b=Math.max(0, -Math.min(p.color.b*v.b,1)),G.r=Math.max(0,Math.min(p.color.r*G.r,1)),G.g=Math.max(0,Math.min(p.color.g*G.g,1)),G.b=Math.max(0,Math.min(p.color.b*G.b,1)),ba=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,ba),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,ba)):(ca.r=aa.r,ca.g=aa.g,ca.b=aa.b,n(l,i.centroidWorld,i.normalWorld,ca),z.r=Math.max(0,Math.min(p.color.r*ca.r,1)),z.g=Math.max(0,Math.min(p.color.g*ca.g,1)),z.b=Math.max(0,Math.min(p.color.b*ca.b,1)),R(F,K,I,J,P,Q,V,E),p.wireframe?ga(z,p.wireframeLinewidth, -p.wireframeLinecap,p.wireframeLinejoin):ha(z)):(R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color));else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),R(F,K,I,J,P,Q,V,E),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z);else if(p instanceof THREE.MeshDepthMaterial)ea=j.near,Z=j.far,x.r=x.g=x.b=1-la(a.positionScreen.z,ea,Z),q.r=q.g=q.b= -1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(f.positionScreen.z,ea,Z),G.r=G.g=G.b=1-la(e.positionScreen.z,ea,Z),ba=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,ba),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,ba)}function M(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function R(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ga(a,b,c,e){if(B!=b)k.lineWidth=B=b; -if(N!=c)k.lineCap=N=c;if(O!=e)k.lineJoin=O=e;d(a.getContextStyle());k.stroke();Y.inflate(b*2)}function ha(a){e(a.getContextStyle());k.fill()}function Ca(a,b,c,d,f,g,h,i,j,l,n,o,m){if(m.image.width!=0){if(m.needsUpdate==!0||za[m.id]==void 0){var q=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;za[m.id]=k.createPattern(m.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}e(za[m.id]);var q=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=(m.image.width- -1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+q)*s,i=(i+r)*m,j=(j+q)*s,l=(l+r)*m,n=(n+q)*s,o=(o+r)*m;c-=a;d-=b;f-=a;g-=b;j-=h;l-=i;n-=h;o-=i;q=1/(j*o-n*l);m=(o*c-l*f)*q;l=(o*d-l*g)*q;c=(j*f-n*c)*q;d=(j*g-n*d)*q;a=a-m*h-c*i;b=b-l*h-d*i;k.save();k.transform(m,l,c,d,a,b);k.fill();k.restore()}}function ma(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,q;o=n.width-1;q=n.height-1;g*=o;h*=q;i*=o;j*=q;l*=o;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;q=1/(i*m-l*j);o=(m*c-j*e)*q;j=(m*d-j*f)*q;c=(i*e-l*c)*q;d=(i*f- -l*d)*q;a=a-o*g-c*h;b=b-j*g-d*h;k.save();k.transform(o,j,c,d,a,b);k.clip();k.drawImage(n,0,0);k.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);da[0]=e<0?0:e>255?255:e;da[1]=f<0?0:f>255?255:f;da[2]=a<0?0:a>255?255:a;da[4]=g<0?0:g>255?255:g;da[5]=h<0?0:h>255?255:h;da[6]=b<0?0:b>255?255:b;da[8]=i<0?0:i>255?255:i;da[9]=j<0?0:j>255?255:j;da[10]=c<0? -0:c>255?255:c;da[12]=k<0?0:k>255?255:k;da[13]=l<0?0:l>255?255:l;da[14]=d<0?0:d>255?255:d;ra.putImageData(Ba,0,0);va.drawImage(qa,0,0);return sa}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ja,A,fa,ja,oa,ya,X;this.autoClear?this.clear():k.setTransform(1,0,0,-1,i,o);g.data.vertices=0;g.data.faces=0;f=h.projectScene(a,j,this.sortElements); -(Aa=a.lights.length>0)&&l(a);xa=0;for(Ja=f.length;xa255?255:e;da[1]=f<0?0:f>255?255:f;da[2]=a<0?0:a>255?255:a;da[4]=g<0?0:g>255?255:g;da[5]=h<0?0:h>255?255:h;da[6]=b<0?0:b>255?255:b;da[8]=i<0?0:i>255?255:i;da[9]=j<0?0:j>255?255: +j;da[10]=c<0?0:c>255?255:c;da[12]=k<0?0:k>255?255:k;da[13]=l<0?0:l>255?255:l;da[14]=d<0?0:d>255?255:d;ra.putImageData(Ba,0,0);va.drawImage(qa,0,0);return sa}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ja,A,fa,ja,oa,ya,X;this.autoClear?this.clear():k.setTransform(1,0,0,-1,i,o);g.info.render.vertices=0;g.info.render.faces=0; +f=h.projectScene(a,j,this.sortElements);(Aa=a.lights.length>0)&&l(a);xa=0;for(Ja=f.length;xa0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(D.sub(f.position,b.centroidWorld),D.normalize(),g=b.normalWorld.dot(D)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function b(b,c,f,h,i,j){g.data.vertices+=3;g.data.faces++;A=d(M++);A.setAttribute("d", -"M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+"z");i instanceof THREE.MeshBasicMaterial?t.copy(i.color):i instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(j,h,w),t.r=Math.max(0,Math.min(i.color.r*w.r,1)),t.g=Math.max(0,Math.min(i.color.g*w.g,1)),t.b=Math.max(0,Math.min(i.color.b*w.b,1))):t.copy(i.color):i instanceof THREE.MeshDepthMaterial?(E=1-i.__2near/(i.__farPlusNear-h.z*i.__farMinusNear), -t.setRGB(E,E,E)):i instanceof THREE.MeshNormalMaterial&&t.setRGB(e(h.normalWorld.x),e(h.normalWorld.y),e(h.normalWorld.z));i.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+i.opacity);k.appendChild(A)}function c(b,c,f,h,i,j,m){g.data.vertices+=4;g.data.faces++; -A=d(M++);A.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");j instanceof THREE.MeshBasicMaterial?t.copy(j.color):j instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(m,i,w),t.r=Math.max(0,Math.min(j.color.r*w.r,1)),t.g=Math.max(0,Math.min(j.color.g*w.g,1)),t.b=Math.max(0,Math.min(j.color.b*w.b,1))):t.copy(j.color):j instanceof -THREE.MeshDepthMaterial?(E=1-j.__2near/(j.__farPlusNear-i.z*j.__farMinusNear),t.setRGB(E,E,E)):j instanceof THREE.MeshNormalMaterial&&t.setRGB(e(i.normalWorld.x),e(i.normalWorld.y),e(i.normalWorld.z));j.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+j.wireframeLinewidth+"; stroke-opacity: "+j.opacity+"; stroke-linecap: "+j.wireframeLinecap+"; stroke-linejoin: "+j.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+ -j.opacity);k.appendChild(A)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),O==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function e(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var g=this,f=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,l,j,m,n,p,q,v,u=new THREE.Rectangle,C=new THREE.Rectangle,K=!1,t=new THREE.Color(16777215),w=new THREE.Color(16777215),z=new THREE.Color(0),y=new THREE.Color(0), -o=new THREE.Color(0),E,D=new THREE.Vector3,F=[],G=[],A,M,N,O=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,b){i=a;l=b;j=i/2;m=l/2;k.setAttribute("viewBox",-j+" "+-m+" "+i+" "+l);k.setAttribute("width",i);k.setAttribute("height",l);u.set(-j,-m,j,m)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render= -function(a,d){var e,i,l,r,t,w,s,x;this.autoClear&&this.clear();g.data.vertices=0;g.data.faces=0;f=h.projectScene(a,d,this.sortElements);N=M=0;if(K=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);y.setRGB(0,0,0);o.setRGB(0,0,0);e=0;for(i=s.length;e0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(D.sub(f.position,b.centroidWorld),D.normalize(),g=b.normalWorld.dot(D)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function b(b,c,f,h,i,j){g.info.render.vertices+=3;g.info.render.faces++;A=d(M++); +A.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+"z");i instanceof THREE.MeshBasicMaterial?t.copy(i.color):i instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(j,h,w),t.r=Math.max(0,Math.min(i.color.r*w.r,1)),t.g=Math.max(0,Math.min(i.color.g*w.g,1)),t.b=Math.max(0,Math.min(i.color.b*w.b,1))):t.copy(i.color):i instanceof THREE.MeshDepthMaterial?(E=1-i.__2near/(i.__farPlusNear- +h.z*i.__farMinusNear),t.setRGB(E,E,E)):i instanceof THREE.MeshNormalMaterial&&t.setRGB(e(h.normalWorld.x),e(h.normalWorld.y),e(h.normalWorld.z));i.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+i.opacity);k.appendChild(A)}function c(b,c,f,h,i,j,m){g.info.render.vertices+= +4;g.info.render.faces++;A=d(M++);A.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");j instanceof THREE.MeshBasicMaterial?t.copy(j.color):j instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(m,i,w),t.r=Math.max(0,Math.min(j.color.r*w.r,1)),t.g=Math.max(0,Math.min(j.color.g*w.g,1)),t.b=Math.max(0,Math.min(j.color.b*w.b,1))): +t.copy(j.color):j instanceof THREE.MeshDepthMaterial?(E=1-j.__2near/(j.__farPlusNear-i.z*j.__farMinusNear),t.setRGB(E,E,E)):j instanceof THREE.MeshNormalMaterial&&t.setRGB(e(i.normalWorld.x),e(i.normalWorld.y),e(i.normalWorld.z));j.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+j.wireframeLinewidth+"; stroke-opacity: "+j.opacity+"; stroke-linecap: "+j.wireframeLinecap+"; stroke-linejoin: "+j.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+ +"; fill-opacity: "+j.opacity);k.appendChild(A)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),O==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function e(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var g=this,f=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,l,j,m,n,p,q,v,u=new THREE.Rectangle,C=new THREE.Rectangle,K=!1,t=new THREE.Color(16777215),w=new THREE.Color(16777215),z=new THREE.Color(0), +y=new THREE.Color(0),o=new THREE.Color(0),E,D=new THREE.Vector3,F=[],G=[],A,M,N,O=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,b){i=a;l=b;j=i/2;m=l/2;k.setAttribute("viewBox",-j+" "+-m+" "+i+" "+l);k.setAttribute("width",i);k.setAttribute("height",l);u.set(-j,-m,j,m)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])}; +this.render=function(a,d){var e,i,l,r,t,w,s,x;this.autoClear&&this.clear();g.info.render.vertices=0;g.info.render.faces=0;f=h.projectScene(a,d,this.sortElements);N=M=0;if(K=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);y.setRGB(0,0,0);o.setRGB(0,0,0);e=0;for(i=s.length;e=0&&j>=0&&h>=0&&k>=0?!0:f<0&&j<0||h<0&&k<0?!1:(f<0?d=Math.max(d,f/(f-j)):j<0&&(e=Math.min(e,f/(f-j))),h<0?d=Math.max(d,h/(h-k)):k<0&&(e=Math.min(e,h/(h-k))),ee&&k.positionScreen.z0&&F.z<1))ta=za[ya]=za[ya]||new THREE.RenderableParticle,ya++,C=ta,C.x=F.x/F.w,C.y=F.y/F.w,C.z=F.z,C.rotation=P.rotation.z,C.scale.x=P.scale.x*Math.abs(C.x- -(F.x+j.projectionMatrix.n11)/(F.w+j.projectionMatrix.n14)),C.scale.y=P.scale.y*Math.abs(C.y-(F.y+j.projectionMatrix.n22)/(F.w+j.projectionMatrix.n24)),C.materials=P.materials,sa.push(C);h&&sa.sort(c);return sa}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)}; +THREE.Projector=function(){function b(){var b=p[m]=p[m]||new THREE.RenderableVertex;m++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,j=c.z+c.w,h=-b.z+b.w,k=-c.z+c.w;return f>=0&&j>=0&&h>=0&&k>=0?!0:f<0&&j<0||h<0&&k<0?!1:(f<0?d=Math.max(d,f/(f-j)):j<0&&(e=Math.min(e,f/(f-j))),h<0?d=Math.max(d,h/(h-k)):k<0&&(e=Math.min(e,h/(h-k))),ee&&k.positionScreen.z0&&F.z<1))Aa=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,C=Aa,C.x=F.x/F.w,C.y=F.y/F.w,C.z=F.z,C.rotation=L.rotation.z,C.scale.x=L.scale.x*Math.abs(C.x- +(F.x+j.projectionMatrix.n11)/(F.w+j.projectionMatrix.n14)),C.scale.y=L.scale.y*Math.abs(C.y-(F.y+j.projectionMatrix.n22)/(F.w+j.projectionMatrix.n24)),C.materials=L.materials,sa.push(C);h&&sa.sort(c);return sa}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;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,d=b.x*c,f=b.y*c,j=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-j),j=Math.sin(-j),h=Math.cos(d),d=Math.sin(d),k=b*c,m=f*j;this.w=k*h-m*d;this.x=k*d+m*h;this.y=f*c*h+b*j*d;this.z=b*j*h-f*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,f=Math.sin(d); 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= @@ -79,9 +79,9 @@ c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid d,f,j,h,k,m=new THREE.Vector3,p=new THREE.Vector3;f=0;for(j=this.faces.length;f0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x], +d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,e,c,d,f,j,h){m=b.vertices[e].position;p=b.vertices[c].position;q=b.vertices[d].position;s=k[f];r=k[j];u=k[h];v=p.x-m.x;B=q.x-m.x;y=p.y-m.y;E=q.y-m.y;C=p.z-m.z;xa=q.z-m.z;ya=r.u-s.u;ra=u.u-s.u;sa=r.v-s.v;ha=u.v-s.v;F=1/(ya*ha-ra*sa);ka.set((ha*v-sa*B)*F,(ha*y-sa*E)*F,(ha*C-sa*xa)*F);Y.set((ya*B-ra*v)*F,(ya*E-ra*y)*F,(ya*xa-ra*C)*F);S[e].addSelf(ka);S[c].addSelf(ka); +S[d].addSelf(ka);P[e].addSelf(Y);P[c].addSelf(Y);P[d].addSelf(Y)}var c,d,f,j,h,k,m,p,q,s,r,u,v,B,y,E,C,xa,ya,ra,sa,ha,F,w,S=[],P=[],ka=new THREE.Vector3,Y=new THREE.Vector3,za=new THREE.Vector3,T=new THREE.Vector3,O=new THREE.Vector3;c=0;for(d=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,d=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.z< this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c=0)e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0);else if(k.morphTargetBase){c=j.program.attributes;k.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):c.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer), e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,p=k.morphTargetForcedOrder,H=k.morphTargetInfluences;f=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)): e.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB, 4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(e.lineWidth(j.wireframeLinewidth),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),e.drawElements(e.LINES,h.__webglLineCount,e.UNSIGNED_SHORT,0)):(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),e.drawElements(e.TRIANGLES, -h.__webglFaceCount,e.UNSIGNED_SHORT,0)),M.data.vertices+=h.__webglFaceCount,M.data.faces+=h.__webglFaceCount/3,M.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?e.LINE_STRIP:e.LINES,e.lineWidth(j.linewidth),e.drawArrays(k,0,h.__webglLineCount),M.data.drawCalls++):k instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),M.data.drawCalls++):k instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),M.data.drawCalls++)}}function j(b, -c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=e.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=e.createBuffer();b.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,b.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(c.attributes.position),e.vertexAttribPointer(c.attributes.position,3,e.FLOAT,!1,0,0));if(b.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,j,k,m,H,p,q,r,s,n=b.count*3;for(s= -0;s=0;d--)b[d].object==c&&b.splice(d,1)}function sa(b){function c(b){var f=[];d=0;for(e=b.length;d65535&&(q[m].counter+=1,p=q[m].hash+"_"+q[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:k,vertices:0,numMorphTargets:r})),b.geometryGroups[p].faces.push(f),b.geometryGroups[p].vertices+=j;b.geometryGroupsList=[];for(var s in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[s])} -function ga(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(b){if(b!=J){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA, -e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}J=b}}function w(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,Q(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,Q(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,Q(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,Q(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,va(c.magFilter)), -e.texParameteri(b,e.TEXTURE_MIN_FILTER,va(c.minFilter)))}function ja(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture();e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,Q(b.format),b.image.width,b.image.height,0,Q(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);w(e.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+ -c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function L(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);w(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ -d,0,Q(b.format),b.width,b.height,0,Q(b.format),Q(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),w(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,Q(b.format),b.width,b.height,0,Q(b.format),Q(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture, -0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER, -e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Aa,b=Fa,f=ta,h=Ga);c!=wa&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),wa=c)}function ka(b){b instanceof -THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null))}function Y(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)), -console.error(c),null;return d}function va(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function Q(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR; -case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA; -case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=this,e,Ea=[],Va=null,wa=null,T=null,Z=null,J=null,W=null,S=null,V=null,xa=null,P=null,ta=0,Ga=0,Aa=0,Fa=0,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ba=new THREE.Matrix4,Da=new Float32Array(16),Ta=new Float32Array(16),Ja=new THREE.Vector4,Wa={ambient:[0, -0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ka=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ab=b.stencil!==void 0?b.stencil:!0,bb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,cb=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ha=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0, -drawCalls:0};this.maxMorphTargets=8;this.domElement=Ka;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 ra,Sa=[],b=THREE.ShaderLib.depthRGBA,Za=THREE.UniformsUtils.clone(b.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Za}), -Xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Za,morphTargets:!0});Ua._shadowPass=!0;Xa._shadowPass=!0;try{if(!(e=Ka.getContext("experimental-webgl",{antialias:cb,stencil:ab,preserveDrawingBuffer:bb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(db){console.error(db)}e.clearColor(0, -0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(ha.r,ha.g,ha.b,Ha);this.context=e;var $a=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,n={};n.vertices=new Float32Array(16);n.faces=new Uint16Array(6);i=0;n.vertices[i++]=-1;n.vertices[i++]=-1;n.vertices[i++]=0;n.vertices[i++]=1;n.vertices[i++]= -1;n.vertices[i++]=-1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=0;n.vertices[i++]=-1;n.vertices[i++]=1;n.vertices[i++]=0;i=n.vertices[i++]=0;n.faces[i++]=0;n.faces[i++]=1;n.faces[i++]=2;n.faces[i++]=0;n.faces[i++]=2;n.faces[i++]=3;n.vertexBuffer=e.createBuffer();n.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.elementBuffer); -e.bufferData(e.ELEMENT_ARRAY_BUFFER,n.faces,e.STATIC_DRAW);n.program=e.createProgram();e.attachShader(n.program,Y("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(n.program,Y("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(n.program);n.attributes={};n.uniforms={};n.attributes.position=e.getAttribLocation(n.program,"position");n.attributes.uv=e.getAttribLocation(n.program,"uv");n.uniforms.uvOffset=e.getUniformLocation(n.program,"uvOffset");n.uniforms.uvScale=e.getUniformLocation(n.program, -"uvScale");n.uniforms.rotation=e.getUniformLocation(n.program,"rotation");n.uniforms.scale=e.getUniformLocation(n.program,"scale");n.uniforms.alignment=e.getUniformLocation(n.program,"alignment");n.uniforms.map=e.getUniformLocation(n.program,"map");n.uniforms.opacity=e.getUniformLocation(n.program,"opacity");n.uniforms.useScreenCoordinates=e.getUniformLocation(n.program,"useScreenCoordinates");n.uniforms.affectedByDistance=e.getUniformLocation(n.program,"affectedByDistance");n.uniforms.screenPosition= -e.getUniformLocation(n.program,"screenPosition");n.uniforms.modelViewMatrix=e.getUniformLocation(n.program,"modelViewMatrix");n.uniforms.projectionMatrix=e.getUniformLocation(n.program,"projectionMatrix");var Ya=!1;this.setSize=function(b,c){Ka.width=b;Ka.height=c;this.setViewport(0,0,Ka.width,Ka.height)};this.setViewport=function(b,c,d,f){ta=b;Ga=c;Aa=d;Fa=f;e.viewport(ta,Ga,Aa,Fa)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=function(b){b?e.enable(e.SCISSOR_TEST): -e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(b,c){ha.setHex(b);Ha=c;e.clearColor(ha.r,ha.g,ha.b,Ha)};this.setClearColor=function(b,c){ha.copy(b);Ha=c;e.clearColor(ha.r,ha.g,ha.b,Ha)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return Ha};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.getContext=function(){return e};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 c=b.geometry.geometryGroups[g];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer); -e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d=0;d--)b[d].object==c&&b.splice(d,1)}function sa(b){function c(b){var f=[];d=0;for(e=b.length;d65535&&(q[m].counter+=1,p=q[m].hash+"_"+q[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:k,vertices:0,numMorphTargets:r})),b.geometryGroups[p].faces.push(f),b.geometryGroups[p].vertices+=j;b.geometryGroupsList=[];for(var s in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[s])}function ha(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[], +count:0}})}function F(b){if(b!=J){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}J=b}}function w(b,c,d){(d.width& +d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,T(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,T(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,T(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,T(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,za(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,za(c.minFilter)))}function S(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit= +!0,b.__webglTexture=e.createTexture(),O.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,T(b.format),b.image.width,b.image.height,0,T(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);w(e.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function P(b){var c=b instanceof +THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);w(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,T(b.format),b.width,b.height,0,T(b.format),T(b.type),null)}else b.__webglFramebuffer= +e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),w(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,T(b.format),b.width,b.height,0,T(b.format),T(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER, +e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER, +e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Ga,b=Fa,f=Aa,h=Ba);c!=wa&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),wa=c)}function ka(b){b instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP), +e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null))}function Y(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)),console.error(c),null;return d}function za(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST; +default:return e.LINEAR}}function T(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR; +case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0} +var O=this,e,Da=[],Va=null,wa=null,Z=null,ta=null,J=null,U=null,Q=null,ma=null,ia=null,L=null,Aa=0,Ba=0,Ga=0,Fa=0,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],va=new THREE.Matrix4,Ea=new Float32Array(16),Ta=new Float32Array(16),Ja=new THREE.Vector4,Wa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ha=b.canvas!==void 0?b.canvas:document.createElement("canvas"), +ab=b.stencil!==void 0?b.stencil:!0,bb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,cb=b.antialias!==void 0?b.antialias:!1,$=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ka=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=Ha;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 W,Ma=[],b=THREE.ShaderLib.depthRGBA,Za=THREE.UniformsUtils.clone(b.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Za}),Xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Za,morphTargets:!0});Ua._shadowPass= +!0;Xa._shadowPass=!0;try{if(!(e=Ha.getContext("experimental-webgl",{antialias:cb,stencil:ab,preserveDrawingBuffer:bb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(db){console.error(db)}e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK); +e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor($.r,$.g,$.b,Ka);this.context=e;var $a=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,n={};n.vertices=new Float32Array(16);n.faces=new Uint16Array(6);i=0;n.vertices[i++]=-1;n.vertices[i++]=-1;n.vertices[i++]=0;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=-1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]= +0;n.vertices[i++]=-1;n.vertices[i++]=1;n.vertices[i++]=0;i=n.vertices[i++]=0;n.faces[i++]=0;n.faces[i++]=1;n.faces[i++]=2;n.faces[i++]=0;n.faces[i++]=2;n.faces[i++]=3;n.vertexBuffer=e.createBuffer();n.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,n.faces,e.STATIC_DRAW);n.program=e.createProgram();e.attachShader(n.program,Y("fragment", +THREE.ShaderLib.sprite.fragmentShader));e.attachShader(n.program,Y("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(n.program);n.attributes={};n.uniforms={};n.attributes.position=e.getAttribLocation(n.program,"position");n.attributes.uv=e.getAttribLocation(n.program,"uv");n.uniforms.uvOffset=e.getUniformLocation(n.program,"uvOffset");n.uniforms.uvScale=e.getUniformLocation(n.program,"uvScale");n.uniforms.rotation=e.getUniformLocation(n.program,"rotation");n.uniforms.scale=e.getUniformLocation(n.program, +"scale");n.uniforms.alignment=e.getUniformLocation(n.program,"alignment");n.uniforms.map=e.getUniformLocation(n.program,"map");n.uniforms.opacity=e.getUniformLocation(n.program,"opacity");n.uniforms.useScreenCoordinates=e.getUniformLocation(n.program,"useScreenCoordinates");n.uniforms.affectedByDistance=e.getUniformLocation(n.program,"affectedByDistance");n.uniforms.screenPosition=e.getUniformLocation(n.program,"screenPosition");n.uniforms.modelViewMatrix=e.getUniformLocation(n.program,"modelViewMatrix"); +n.uniforms.projectionMatrix=e.getUniformLocation(n.program,"projectionMatrix");var Ya=!1;this.setSize=function(b,c){Ha.width=b;Ha.height=c;this.setViewport(0,0,Ha.width,Ha.height)};this.setViewport=function(b,c,d,f){Aa=b;Ba=c;Ga=d;Fa=f;e.viewport(Aa,Ba,Ga,Fa)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(b,c){$.setHex(b);Ka=c;e.clearColor($.r,$.g,$.b,Ka)};this.setClearColor= +function(b,c){$.copy(b);Ka=c;e.clearColor($.r,$.g,$.b,Ka)};this.getClearColor=function(){return $};this.getClearAlpha=function(){return Ka};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.getContext=function(){return e};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 c= +b.geometry.geometryGroups[g];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d= +0,f=c.numMorphTargets;d=0&&e.enableVertexAttribArray(n.position);n.color>=0&&e.enableVertexAttribArray(n.color);n.normal>=0&&e.enableVertexAttribArray(n.normal);n.tangent>=0&&e.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(e.enableVertexAttribArray(n.skinVertexA),e.enableVertexAttribArray(n.skinVertexB), -e.enableVertexAttribArray(n.skinIndex),e.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(h in b.attributes)n[h]!==void 0&&n[h]>=0&&e.enableVertexAttribArray(n[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(e.enableVertexAttribArray(n[v]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,f){L(b);b=0;c&&(b|=e.COLOR_BUFFER_BIT);d&&(b|=e.DEPTH_BUFFER_BIT);f&&(b|=e.STENCIL_BUFFER_BIT);e.clear(b)};this.render=function(b, -c,e,r){var n,w,fa,U,H,I,D,Qa,J=b.lights,Ra=b.fog;this.shadowMapEnabled&&y(b,c);M.data.vertices=0;M.data.faces=0;M.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ta);c.projectionMatrix.flattenToArray(Da);Ba.multiply(c.projectionMatrix,c.matrixWorldInverse);q(Ba);this.initWebGLObjects(b);L(e);(this.autoClear||r)&&this.clear();H=b.__webglObjects.length;for(r=0;r=0;r--)if(n=b.__webglObjects[r],n.render){D=n.object;Qa=n.buffer;fa=n.opaque;h(D);for(n=0;n0||u.faceVertexUvs.length>0)m.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length> -1)m.__uv2Array=new Float32Array(n*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(n*4),m.__skinVertexBArray=new Float32Array(n*4),m.__skinIndexArray=new Float32Array(n*4),m.__skinWeightArray=new Float32Array(n*4);m.__faceArray=new Uint16Array(w*3+(p.geometry.edgeFaces?p.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];u=0;for(v=m.numMorphTargets;u=0;j--)d[j]==f&&d.splice(j,1)}else f instanceof THREE.MarchingCubes&&qa(d.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,C));Ba&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,V,C));Da&&ua.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,$,C));ta&&W>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER, -ja,C));ta&&Y>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ka,C));wa&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha,C),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ca,C));x>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,aa,C),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ca,C),e.bindBuffer(e.ARRAY_BUFFER, -n.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,da,C),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ea,C));w&&(delete n.__inittedArrays,delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray,delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray,delete n.__lineArray,delete n.__skinVertexAArray,delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets= -!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1;za(k)}else if(h instanceof THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=e.DYNAMIC_DRAW;m=B=w=w=void 0;u=h.vertices;p=h.colors;r=u.length;n=p.length;q=h.__vertexArray;C=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w=0&&e.enableVertexAttribArray(n.position);n.color>=0&&e.enableVertexAttribArray(n.color);n.normal>=0&&e.enableVertexAttribArray(n.normal);n.tangent>=0&&e.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(e.enableVertexAttribArray(n.skinVertexA), +e.enableVertexAttribArray(n.skinVertexB),e.enableVertexAttribArray(n.skinIndex),e.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(h in b.attributes)n[h]!==void 0&&n[h]>=0&&e.enableVertexAttribArray(n[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(e.enableVertexAttribArray(n[v]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,f){P(b);b=0;c&&(b|=e.COLOR_BUFFER_BIT);d&&(b|=e.DEPTH_BUFFER_BIT);f&&(b|=e.STENCIL_BUFFER_BIT); +e.clear(b)};this.render=function(b,c,e,r){var n,w,ga,V,H,I,D,Ra,J=b.lights,Sa=b.fog;this.shadowMapEnabled&&y(b,c);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ta);c.projectionMatrix.flattenToArray(Ea);va.multiply(c.projectionMatrix,c.matrixWorldInverse);q(va);this.initWebGLObjects(b);P(e);(this.autoClear||r)&&this.clear();H=b.__webglObjects.length;for(r=0;r=0;r--)if(n=b.__webglObjects[r],n.render){D=n.object;Ra=n.buffer;ga=n.opaque;h(D); +for(n=0;n0||u.faceVertexUvs.length> +0)m.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(n*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(n*4),m.__skinVertexBArray=new Float32Array(n*4),m.__skinIndexArray=new Float32Array(n*4),m.__skinWeightArray=new Float32Array(n*4);m.__faceArray=new Uint16Array(w*3+(p.geometry.edgeFaces?p.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays= +[];u=0;for(v=m.numMorphTargets;u=0;j--)d[j]==f&&d.splice(j,1)}else f instanceof THREE.MarchingCubes&&ra(d.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d< +f;d++)if(h=b.__webglObjects[d].object,n=k=j=void 0,h instanceof THREE.Mesh){j=h.geometry;m=0;for(p=j.geometryGroupsList.length;m0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,qa,C));Da&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,W,C));Ea&&ua.hasTangents&& +(e.bindBuffer(e.ARRAY_BUFFER,n.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,aa,C));va&&Y>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,C));va&&Z>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ma,C));Aa&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,C),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ca,C));x>0&&(e.bindBuffer(e.ARRAY_BUFFER, +n.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,ca,C),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,da,C),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,ea,C),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,fa,C));w&&(delete n.__inittedArrays,delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray,delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray, +delete n.__lineArray,delete n.__skinVertexAArray,delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1;ya(k)}else if(h instanceof THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=e.DYNAMIC_DRAW;m=B=w=w=void 0;u=h.vertices;p=h.colors;r=u.length;n=p.length;q=h.__vertexArray;C=h.__colorArray;v=h.__dirtyColors; +if(h.__dirtyVertices){for(w=0;w