diff --git a/build/Three.js b/build/Three.js index d3a5d12d..77cd17fe 100644 --- a/build/Three.js +++ b/build/Three.js @@ -17,38 +17,38 @@ b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b0&&a>0&&k+a<1}for(var e,f=[],h=0,k=a.children.length;ha.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=b(this.origin, -this.direction,a.matrixWorld.getPosition());if(h==null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var l,m,t,u,p,v,o,z,x=a.geometry,w=x.vertices,h=0,k=x.faces.length;h0:v<0)))if(v=p.dot((new THREE.Vector3).sub(l,o))/v,o=o.addSelf(z.multiplyScalar(v)),e instanceof THREE.Face3)c(o,l,m,t)&&(e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(o,l,m,u)||c(o,m,t,u)))e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e)}return f}}; -THREE.Rectangle=function(){function a(){h=e-b;k=f-c}var b,c,e,f,h,k,l=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(k,h,u,p){l=!1;b=k;c=h;e=u;f=p;a()};this.addPoint=function(k,h){l?(l=!1,b=k,c=h,e=k,f=h):(b=bk?e:k,f=f>h?f:h);a()};this.add3Points= -function(k,h,u,p,v,o){l?(l=!1,b=ku?k>v?k:v:u>v?u:v,f=h>p?h>o?h:o:p>o?p:o):(b=ku?k>v?k>e?k:e:v>e?v:e:u>v?u>e?u:e:v>e?v:e,f=h>p?h>o?h>f?h:f:o>f?o:f:p>o?p>f?p:f:o>f?o:f);a()};this.addRectangle=function(k){l?(l=!1,b=k.getLeft(),c=k.getTop(),e=k.getRight(),f=k.getBottom()):(b=bk.getRight()?e:k.getRight(),f=f> +this.direction,a.matrixWorld.getPosition());if(h==null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var l,n,p,u,t,v,o,y,x=a.geometry,w=x.vertices,h=0,k=x.faces.length;h0:v<0)))if(v=t.dot((new THREE.Vector3).sub(l,o))/v,o=o.addSelf(y.multiplyScalar(v)),e instanceof THREE.Face3)c(o,l,n,p)&&(e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(o,l,n,u)||c(o,n,p,u)))e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e)}return f}}; +THREE.Rectangle=function(){function a(){h=e-b;k=f-c}var b,c,e,f,h,k,l=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(k,h,u,t){l=!1;b=k;c=h;e=u;f=t;a()};this.addPoint=function(k,h){l?(l=!1,b=k,c=h,e=k,f=h):(b=bk?e:k,f=f>h?f:h);a()};this.add3Points= +function(k,h,u,t,v,o){l?(l=!1,b=ku?k>v?k:v:u>v?u:v,f=h>t?h>o?h:o:t>o?t:o):(b=ku?k>v?k>e?k:e:v>e?v:e:u>v?u>e?u:e:v>e?v:e,f=h>t?h>o?h>f?h:f:o>f?o:f:t>o?t>f?t:f:o>f?o:f);a()};this.addRectangle=function(k){l?(l=!1,b=k.getLeft(),c=k.getTop(),e=k.getRight(),f=k.getBottom()):(b=bk.getRight()?e:k.getRight(),f=f> k.getBottom()?f:k.getBottom());a()};this.inflate=function(k){b-=k;c-=k;e+=k;f+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();e=e=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){l=!0;f=e=c=b=0;a()};this.isEmpty=function(){return l}}; THREE.Math={clamp:function(a,b,c){return ac?c:a},clampBottom:function(a,b){return a=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?b=Math.max(b,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?b=Math.max(b,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),eE&&k.positionScreen.z0&&F.z<1))fa=A[y]=A[y]||new THREE.RenderableParticle,y++,B=fa,B.x=F.x/F.w,B.y=F.y/F.w,B.z=F.z,B.rotation=T.rotation.z,B.scale.x=T.scale.x*Math.abs(B.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14)),B.scale.y=T.scale.y*Math.abs(B.y-(F.y+f.projectionMatrix.n22)/(F.w+f.projectionMatrix.n24)),B.materials=T.materials,C.push(B);h&&C.sort(b);return C}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)}; +THREE.Projector=function(){function a(){var a=n[l]=n[l]||new THREE.RenderableVertex;l++;return a}function b(a,c){return c.z-a.z}function c(a,c){var b=0,e=1,f=a.z+a.w,k=c.z+c.w,h=-a.z+a.w,l=-c.z+c.w;return f>=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?b=Math.max(b,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?b=Math.max(b,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),em&&k.positionScreen.z0&&M.z<1))X=C[z]=C[z]||new THREE.RenderableParticle,z++,A=X,A.x=M.x/M.w,A.y=M.y/M.w,A.z=M.z,A.rotation=Y.rotation.z,A.scale.x=Y.scale.x*Math.abs(A.x-(M.x+f.projectionMatrix.n11)/(M.w+f.projectionMatrix.n14)),A.scale.y=Y.scale.y*Math.abs(A.y-(M.y+f.projectionMatrix.n22)/(M.w+f.projectionMatrix.n24)),A.materials=Y.materials,K.push(A);h&&K.sort(b);return K}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),k=a*b,l=e*f;this.w=k*h-l*c;this.x=k*c+l*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c); this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b= -this.x,c=this.y,e=this.z,f=this.w,h=a.x,k=a.y,l=a.z,a=a.w;this.x=b*a+f*h+c*l-e*k;this.y=c*a+f*k+e*h-b*l;this.z=e*a+f*l+b*k-c*h;this.w=f*a-b*h-c*k-e*l;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,k=this.y,l=this.z,m=this.w,t=m*c+k*f-l*e,u=m*e+l*c-h*f,p=m*f+h*e-k*c,c=-h* -c-k*e-l*f;b.x=t*m+c*-h+u*-l-p*-k;b.y=u*m+c*-k+p*-h-t*-l;b.z=p*m+c*-l+t*-k-u*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),k=Math.sqrt(1-f*f);if(Math.abs(k)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c}; +this.x,c=this.y,e=this.z,f=this.w,h=a.x,k=a.y,l=a.z,a=a.w;this.x=b*a+f*h+c*l-e*k;this.y=c*a+f*k+e*h-b*l;this.z=e*a+f*l+b*k-c*h;this.w=f*a-b*h-c*k-e*l;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,k=this.y,l=this.z,n=this.w,p=n*c+k*f-l*e,u=n*e+l*c-h*f,t=n*f+h*e-k*c,c=-h* +c-k*e-l*f;b.x=p*n+c*-h+u*-l-t*-k;b.y=u*n+c*-k+t*-h-p*-l;b.z=t*n+c*-l+p*-k-u*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),k=Math.sqrt(1-f*f);if(Math.abs(k)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c}; THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,e,f,h,k){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=k;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, +c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,c,b,e,f,h,m){l=a.vertices[c].position;n=a.vertices[b].position;p=a.vertices[e].position;u=k[f];t=k[h];v=k[m];o=n.x-l.x;y=p.x-l.x;x=n.y-l.y;w=p.y-l.y;A=n.z-l.z;z=p.z-l.z;C=t.u-u.u;B=v.u-u.u;K=t.v-u.v;F=v.v-u.v;M=1/(C*F-B*K);H.set((F*o-K*y)*M,(F*x-K*w)*M,(F*A-K*z)*M);P.set((C*y-B*o)*M,(C*w-B*x)*M,(C*z-B*A)*M);O[c].addSelf(H);O[b].addSelf(H);O[e].addSelf(H);V[c].addSelf(P); +V[b].addSelf(P);V[e].addSelf(P)}var b,c,e,f,h,k,l,n,p,u,t,v,o,y,x,w,A,z,C,B,K,F,M,E,O=[],V=[],H=new THREE.Vector3,P=new THREE.Vector3,L=new THREE.Vector3,T=new THREE.Vector3,S=new THREE.Vector3;b=0;for(c=this.vertices.length;b0){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 b=1,c=this.vertices.length;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;bthis.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;t=this.points[c[0]];u=this.points[c[1]]; -p=this.points[c[2]];v=this.points[c[3]];l=k*k;m=k*l;e.x=b(t.x,u.x,p.x,v.x,k,l,m);e.y=b(t.y,u.y,p.y,v.y,k,l,m);e.z=b(t.z,u.z,p.z,v.z,k,l,m);return e};this.getControlPointsArray=function(){var a,c,b=this.points.length,e=[];for(a=0;athis.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];u=this.points[c[1]]; +t=this.points[c[2]];v=this.points[c[3]];l=k*k;n=k*l;e.x=b(p.x,u.x,t.x,v.x,k,l,n);e.y=b(p.y,u.y,t.y,v.y,k,l,n);e.z=b(p.z,u.z,t.z,v.z,k,l,n);return e};this.getControlPointsArray=function(){var a,c,b=this.points.length,e=[];for(a=0;a0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+ -Math.floor(z.b*255)+","+x+")"),o.fillRect(Math.floor(M.getX()),Math.floor(M.getY()),Math.floor(M.getWidth()),Math.floor(M.getHeight()))),M.empty())};this.render=function(a,m){function t(a){var c,b,e,f=a.lights;K.setRGB(0,0,0);ra.setRGB(0,0,0);wa.setRGB(0,0,0);a=0;for(c=f.length;a>1,va=t.height>>1,h=k.scale.x*p,m=k.scale.y*v,n=h*u,l=m*va,Y.set(a.x-n,a.y-l,a.x+n,a.y+l),Da.intersects(Y)&&(o.save(),o.translate(a.x,a.y),o.rotate(-k.rotation),o.scale(h,-m),o.translate(-u,-va),o.drawImage(t,0,0),o.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(n=k.scale.x*p,l=k.scale.y*v,Y.set(a.x-n,a.y-l,a.x+n,a.y+l),Da.intersects(Y)&&(e(h.color.getContextStyle()),f(h.color.getContextStyle()),o.save(),o.translate(a.x,a.y),o.rotate(-k.rotation),o.scale(n,l),h.program(o), -o.restore()))}function x(a,f,k,h){b(h.opacity);c(h.blending);o.beginPath();o.moveTo(a.positionScreen.x,a.positionScreen.y);o.lineTo(f.positionScreen.x,f.positionScreen.y);o.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(E!=a)o.lineWidth=E=a;a=h.linecap;if(C!=a)o.lineCap=C=a;a=h.linejoin;if(L!=a)o.lineJoin=L=a;e(h.color.getContextStyle());o.stroke();Y.inflate(h.linewidth*2)}}function z(a,e,f,k,l,t,p,o,v){h.info.render.vertices+=3;h.info.render.faces++;b(o.opacity);c(o.blending); -J=a.positionScreen.x;V=a.positionScreen.y;X=e.positionScreen.x;O=e.positionScreen.y;n=f.positionScreen.x;U=f.positionScreen.y;B(J,V,X,O,n,U);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(ma=p.uvs[0],$a(J,V,X,O,n,U,ma[k].u,ma[k].v,ma[l].u,ma[l].v,ma[t].u,ma[t].v,o.map));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=m.matrixWorldInverse,ha.copy(p.vertexNormalsWorld[0]),na=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,pa= --(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+0.5,ha.copy(p.vertexNormalsWorld[1]),Ca=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,Fa=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+0.5,ha.copy(p.vertexNormalsWorld[2]),Ea=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,za=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+0.5,$a(J,V,X,O,n,U,na,pa,Ca,Fa,Ea,za,o.envMap)}else o.wireframe?Ma(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Na(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&& -(o.map.mapping instanceof THREE.UVMapping&&(ma=p.uvs[0],$a(J,V,X,O,n,U,ma[k].u,ma[k].v,ma[l].u,ma[l].v,ma[t].u,ma[t].v,o.map)),c(THREE.SubtractiveBlending)),ia?!o.wireframe&&o.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3?(Q.r=T.r=fa.r=K.r,Q.g=T.g=fa.g=K.g,Q.b=T.b=fa.b=K.b,u(v,p.v1.positionWorld,p.vertexNormalsWorld[0],Q),u(v,p.v2.positionWorld,p.vertexNormalsWorld[1],T),u(v,p.v3.positionWorld,p.vertexNormalsWorld[2],fa),Q.r=Math.max(0,Math.min(o.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(o.color.g* -Q.g,1)),Q.b=Math.max(0,Math.min(o.color.b*Q.b,1)),T.r=Math.max(0,Math.min(o.color.r*T.r,1)),T.g=Math.max(0,Math.min(o.color.g*T.g,1)),T.b=Math.max(0,Math.min(o.color.b*T.b,1)),fa.r=Math.max(0,Math.min(o.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(o.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(o.color.b*fa.b,1)),ga.r=(T.r+fa.r)*0.5,ga.g=(T.g+fa.g)*0.5,ga.b=(T.b+fa.b)*0.5,sa=Xa(Q,T,fa,ga),Ua(J,V,X,O,n,U,0,0,1,0,0,1,sa)):(ja.r=K.r,ja.g=K.g,ja.b=K.b,u(v,p.centroidWorld,p.normalWorld,ja),Z.r=Math.max(0,Math.min(o.color.r* -ja.r,1)),Z.g=Math.max(0,Math.min(o.color.g*ja.g,1)),Z.b=Math.max(0,Math.min(o.color.b*ja.b,1)),o.wireframe?Ma(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Na(Z)):o.wireframe?Ma(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Na(o.color);else if(o instanceof THREE.MeshDepthMaterial)oa=m.near,da=m.far,Q.r=Q.g=Q.b=1-Qa(a.positionScreen.z,oa,da),T.r=T.g=T.b=1-Qa(e.positionScreen.z,oa,da),fa.r=fa.g=fa.b=1-Qa(f.positionScreen.z,oa,da),ga.r=(T.r+fa.r)*0.5,ga.g=(T.g+ -fa.g)*0.5,ga.b=(T.b+fa.b)*0.5,sa=Xa(Q,T,fa,ga),Ua(J,V,X,O,n,U,0,0,1,0,0,1,sa);else if(o instanceof THREE.MeshNormalMaterial)Z.r=Va(p.normalWorld.x),Z.g=Va(p.normalWorld.y),Z.b=Va(p.normalWorld.z),o.wireframe?Ma(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Na(Z)}function y(a,e,f,k,l,t,o,p,v){h.info.render.vertices+=4;h.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)z(a,e,k,0,1,3,o,p,v),z(l,f,t,1,2,3,o,p,v);else if(J=a.positionScreen.x,V=a.positionScreen.y,X=e.positionScreen.x, -O=e.positionScreen.y,n=f.positionScreen.x,U=f.positionScreen.y,$=k.positionScreen.x,aa=k.positionScreen.y,ca=l.positionScreen.x,ea=l.positionScreen.y,la=t.positionScreen.x,ka=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)A(J,V,X,O,n,U,$,aa),p.wireframe?Ma(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Na(p.color);else if(p instanceof THREE.MeshLambertMaterial)ia?!p.wireframe&&p.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==4?(Q.r=T.r=fa.r=ga.r=K.r,Q.g= -T.g=fa.g=ga.g=K.g,Q.b=T.b=fa.b=ga.b=K.b,u(v,o.v1.positionWorld,o.vertexNormalsWorld[0],Q),u(v,o.v2.positionWorld,o.vertexNormalsWorld[1],T),u(v,o.v4.positionWorld,o.vertexNormalsWorld[3],fa),u(v,o.v3.positionWorld,o.vertexNormalsWorld[2],ga),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)),T.r=Math.max(0,Math.min(p.color.r*T.r,1)),T.g=Math.max(0,Math.min(p.color.g*T.g,1)),T.b=Math.max(0,Math.min(p.color.b*T.b,1)),fa.r=Math.max(0, -Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),sa=Xa(Q,T,fa,ga),B(J,V,X,O,$,aa),Ua(J,V,X,O,$,aa,0,0,1,0,0,1,sa),B(ca,ea,n,U,la,ka),Ua(ca,ea,n,U,la,ka,1,0,1,1,0,1,sa)):(ja.r=K.r,ja.g=K.g,ja.b=K.b,u(v,o.centroidWorld,o.normalWorld,ja),Z.r=Math.max(0,Math.min(p.color.r*ja.r,1)),Z.g=Math.max(0,Math.min(p.color.g* -ja.g,1)),Z.b=Math.max(0,Math.min(p.color.b*ja.b,1)),A(J,V,X,O,n,U,$,aa),p.wireframe?Ma(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Na(Z)):(A(J,V,X,O,n,U,$,aa),p.wireframe?Ma(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Na(p.color));else if(p instanceof THREE.MeshNormalMaterial)Z.r=Va(o.normalWorld.x),Z.g=Va(o.normalWorld.y),Z.b=Va(o.normalWorld.z),A(J,V,X,O,n,U,$,aa),p.wireframe?Ma(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Na(Z);else if(p instanceof -THREE.MeshDepthMaterial)oa=m.near,da=m.far,Q.r=Q.g=Q.b=1-Qa(a.positionScreen.z,oa,da),T.r=T.g=T.b=1-Qa(e.positionScreen.z,oa,da),fa.r=fa.g=fa.b=1-Qa(k.positionScreen.z,oa,da),ga.r=ga.g=ga.b=1-Qa(f.positionScreen.z,oa,da),sa=Xa(Q,T,fa,ga),B(J,V,X,O,$,aa),Ua(J,V,X,O,$,aa,0,0,1,0,0,1,sa),B(ca,ea,n,U,la,ka),Ua(ca,ea,n,U,la,ka,1,0,1,1,0,1,sa)}function B(a,c,b,e,f,k){o.beginPath();o.moveTo(a,c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(a,c);o.closePath()}function A(a,c,b,e,f,k,h,n){o.beginPath();o.moveTo(a, -c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(h,n);o.lineTo(a,c);o.closePath()}function Ma(a,c,b,f){if(E!=c)o.lineWidth=E=c;if(C!=b)o.lineCap=C=b;if(L!=f)o.lineJoin=L=f;e(a.getContextStyle());o.stroke();Y.inflate(c*2)}function Na(a){f(a.getContextStyle());o.fill()}function $a(a,c,b,e,k,h,n,l,m,t,p,v,u){if(u.image.width!=0){if(u.needsUpdate==!0||qa[u.id]==void 0){var va=u.wrapS==THREE.RepeatWrapping,M=u.wrapT==THREE.RepeatWrapping;qa[u.id]=o.createPattern(u.image,va&&M?"repeat":va&&!M?"repeat-x":!va&&M? -"repeat-y":"no-repeat");u.needsUpdate=!1}f(qa[u.id]);var va=u.offset.x/u.repeat.x,M=u.offset.y/u.repeat.y,w=(u.image.width-1)*u.repeat.x,u=(u.image.height-1)*u.repeat.y,n=(n+va)*w,l=(l+M)*u,m=(m+va)*w,t=(t+M)*u,p=(p+va)*w,v=(v+M)*u;b-=a;e-=c;k-=a;h-=c;m-=n;t-=l;p-=n;v-=l;va=1/(m*v-p*t);u=(v*b-t*k)*va;t=(v*e-t*h)*va;b=(m*k-p*b)*va;e=(m*h-p*e)*va;a=a-u*n-b*l;c=c-t*n-e*l;o.save();o.transform(u,t,b,e,a,c);o.fill();o.restore()}}function Ua(a,c,b,e,f,k,h,n,l,m,t,p,u){var v,va;v=u.width-1;va=u.height-1; -h*=v;n*=va;l*=v;m*=va;t*=v;p*=va;b-=a;e-=c;f-=a;k-=c;l-=h;m-=n;t-=h;p-=n;va=1/(l*p-t*m);v=(p*b-m*f)*va;m=(p*e-m*k)*va;b=(l*f-t*b)*va;e=(l*k-t*e)*va;a=a-v*h-b*n;c=c-m*h-e*n;o.save();o.transform(v,m,b,e,a,c);o.clip();o.drawImage(u,0,0);o.restore()}function Xa(a,c,b,e){var f=~~(a.r*255),k=~~(a.g*255),a=~~(a.b*255),h=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),l=~~(b.r*255),m=~~(b.g*255),b=~~(b.b*255),t=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255);Ba[0]=f<0?0:f>255?255:f;Ba[1]=k<0?0:k>255?255:k;Ba[2]=a<0?0:a> -255?255:a;Ba[4]=h<0?0:h>255?255:h;Ba[5]=n<0?0:n>255?255:n;Ba[6]=c<0?0:c>255?255:c;Ba[8]=l<0?0:l>255?255:l;Ba[9]=m<0?0:m>255?255:m;Ba[10]=b<0?0:b>255?255:b;Ba[12]=t<0?0:t>255?255:t;Ba[13]=p<0?0:p>255?255:p;Ba[14]=e<0?0:e>255?255:e;ua.putImageData(ya,0,0);Ia.drawImage(xa,0,0);return Ha}function Qa(a,c,b){a=(a-c)/(b-c);return a*a*(3-2*a)}function Va(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Oa(a,c){var b=c.x-a.x,e=c.y-a.y,f=b*b+e*e;f!=0&&(f=1/Math.sqrt(f),b*=f,e*=f,c.x+=b,c.y+=e,a.x-=b,a.y-=e)}var Ya, -ab,ta,Ga,Pa,Wa,Za,Aa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,p,v);h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,m,this.sortElements);(ia=a.lights.length>0)&&t(a);Ya=0;for(ab=k.length;Ya0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+ +Math.floor(y.b*255)+","+x+")"),o.fillRect(Math.floor(G.getX()),Math.floor(G.getY()),Math.floor(G.getWidth()),Math.floor(G.getHeight()))),G.empty())};this.render=function(a,n){function p(a){var c,b,e,f=a.lights;N.setRGB(0,0,0);ta.setRGB(0,0,0);pa.setRGB(0,0,0);a=0;for(c=f.length;a>1,wa=p.height>>1,h=k.scale.x*t,n=k.scale.y*v,m=h*u,l=n*wa,$.set(a.x-m,a.y-l,a.x+m,a.y+l),xa.intersects($)&&(o.save(),o.translate(a.x,a.y),o.rotate(-k.rotation),o.scale(h,-n),o.translate(-u,-wa),o.drawImage(p,0,0),o.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(m=k.scale.x*t,l=k.scale.y*v,$.set(a.x-m,a.y-l,a.x+m,a.y+l),xa.intersects($)&&(e(h.color.getContextStyle()),f(h.color.getContextStyle()),o.save(),o.translate(a.x,a.y),o.rotate(-k.rotation),o.scale(m,l),h.program(o), +o.restore()))}function w(a,f,k,h){b(h.opacity);c(h.blending);o.beginPath();o.moveTo(a.positionScreen.x,a.positionScreen.y);o.lineTo(f.positionScreen.x,f.positionScreen.y);o.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(B!=a)o.lineWidth=B=a;a=h.linecap;if(K!=a)o.lineCap=K=a;a=h.linejoin;if(F!=a)o.lineJoin=F=a;e(h.color.getContextStyle());o.stroke();$.inflate(h.linewidth*2)}}function y(a,e,f,k,l,p,t,o,v){h.info.render.vertices+=3;h.info.render.faces++;b(o.opacity);c(o.blending); +L=a.positionScreen.x;T=a.positionScreen.y;S=e.positionScreen.x;m=e.positionScreen.y;aa=f.positionScreen.x;U=f.positionScreen.y;A(L,T,S,m,aa,U);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(la=t.uvs[0],$a(L,T,S,m,aa,U,la[k].u,la[k].v,la[l].u,la[l].v,la[p].u,la[p].v,o.map));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=n.matrixWorldInverse,ka.copy(t.vertexNormalsWorld[0]),ua=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5, +sa=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,ka.copy(t.vertexNormalsWorld[1]),Da=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,Ea=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,ka.copy(t.vertexNormalsWorld[2]),za=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,Fa=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,$a(L,T,S,m,aa,U,ua,sa,Da,Ea,za,Fa,o.envMap)}else o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&& +(o.map.mapping instanceof THREE.UVMapping&&(la=t.uvs[0],$a(L,T,S,m,aa,U,la[k].u,la[k].v,la[l].u,la[l].v,la[p].u,la[p].v,o.map)),c(THREE.SubtractiveBlending)),ma?!o.wireframe&&o.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?(R.r=Y.r=X.r=N.r,R.g=Y.g=X.g=N.g,R.b=Y.b=X.b=N.b,u(v,t.v1.positionWorld,t.vertexNormalsWorld[0],R),u(v,t.v2.positionWorld,t.vertexNormalsWorld[1],Y),u(v,t.v3.positionWorld,t.vertexNormalsWorld[2],X),R.r=Math.max(0,Math.min(o.color.r*R.r,1)),R.g=Math.max(0,Math.min(o.color.g* +R.g,1)),R.b=Math.max(0,Math.min(o.color.b*R.b,1)),Y.r=Math.max(0,Math.min(o.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(o.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(o.color.b*Y.b,1)),X.r=Math.max(0,Math.min(o.color.r*X.r,1)),X.g=Math.max(0,Math.min(o.color.g*X.g,1)),X.b=Math.max(0,Math.min(o.color.b*X.b,1)),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,ga.b=(Y.b+X.b)*0.5,qa=Xa(R,Y,X,ga),Ua(L,T,S,m,aa,U,0,0,1,0,0,1,qa)):(I.r=N.r,I.g=N.g,I.b=N.b,u(v,t.centroidWorld,t.normalWorld,I),Z.r=Math.max(0,Math.min(o.color.r* +I.r,1)),Z.g=Math.max(0,Math.min(o.color.g*I.g,1)),Z.b=Math.max(0,Math.min(o.color.b*I.b,1)),o.wireframe?Ka(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(Z)):o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color);else if(o instanceof THREE.MeshDepthMaterial)na=n.near,fa=n.far,R.r=R.g=R.b=1-Oa(a.positionScreen.z,na,fa),Y.r=Y.g=Y.b=1-Oa(e.positionScreen.z,na,fa),X.r=X.g=X.b=1-Oa(f.positionScreen.z,na,fa),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5, +ga.b=(Y.b+X.b)*0.5,qa=Xa(R,Y,X,ga),Ua(L,T,S,m,aa,U,0,0,1,0,0,1,qa);else if(o instanceof THREE.MeshNormalMaterial)Z.r=Va(t.normalWorld.x),Z.g=Va(t.normalWorld.y),Z.b=Va(t.normalWorld.z),o.wireframe?Ka(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(Z)}function z(a,e,f,k,l,p,o,t,v){h.info.render.vertices+=4;h.info.render.faces++;b(t.opacity);c(t.blending);if(t.map||t.envMap)y(a,e,k,0,1,3,o,t,v),y(l,f,p,1,2,3,o,t,v);else if(L=a.positionScreen.x,T=a.positionScreen.y,S=e.positionScreen.x, +m=e.positionScreen.y,aa=f.positionScreen.x,U=f.positionScreen.y,ea=k.positionScreen.x,da=k.positionScreen.y,ia=l.positionScreen.x,ha=l.positionScreen.y,ja=p.positionScreen.x,ca=p.positionScreen.y,t instanceof THREE.MeshBasicMaterial)C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color);else if(t instanceof THREE.MeshLambertMaterial)ma?!t.wireframe&&t.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==4?(R.r=Y.r=X.r=ga.r=N.r,R.g= +Y.g=X.g=ga.g=N.g,R.b=Y.b=X.b=ga.b=N.b,u(v,o.v1.positionWorld,o.vertexNormalsWorld[0],R),u(v,o.v2.positionWorld,o.vertexNormalsWorld[1],Y),u(v,o.v4.positionWorld,o.vertexNormalsWorld[3],X),u(v,o.v3.positionWorld,o.vertexNormalsWorld[2],ga),R.r=Math.max(0,Math.min(t.color.r*R.r,1)),R.g=Math.max(0,Math.min(t.color.g*R.g,1)),R.b=Math.max(0,Math.min(t.color.b*R.b,1)),Y.r=Math.max(0,Math.min(t.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(t.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(t.color.b*Y.b,1)),X.r=Math.max(0, +Math.min(t.color.r*X.r,1)),X.g=Math.max(0,Math.min(t.color.g*X.g,1)),X.b=Math.max(0,Math.min(t.color.b*X.b,1)),ga.r=Math.max(0,Math.min(t.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(t.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(t.color.b*ga.b,1)),qa=Xa(R,Y,X,ga),A(L,T,S,m,ea,da),Ua(L,T,S,m,ea,da,0,0,1,0,0,1,qa),A(ia,ha,aa,U,ja,ca),Ua(ia,ha,aa,U,ja,ca,1,0,1,1,0,1,qa)):(I.r=N.r,I.g=N.g,I.b=N.b,u(v,o.centroidWorld,o.normalWorld,I),Z.r=Math.max(0,Math.min(t.color.r*I.r,1)),Z.g=Math.max(0,Math.min(t.color.g* +I.g,1)),Z.b=Math.max(0,Math.min(t.color.b*I.b,1)),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z)):(C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color));else if(t instanceof THREE.MeshNormalMaterial)Z.r=Va(o.normalWorld.x),Z.g=Va(o.normalWorld.y),Z.b=Va(o.normalWorld.z),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z); +else if(t instanceof THREE.MeshDepthMaterial)na=n.near,fa=n.far,R.r=R.g=R.b=1-Oa(a.positionScreen.z,na,fa),Y.r=Y.g=Y.b=1-Oa(e.positionScreen.z,na,fa),X.r=X.g=X.b=1-Oa(k.positionScreen.z,na,fa),ga.r=ga.g=ga.b=1-Oa(f.positionScreen.z,na,fa),qa=Xa(R,Y,X,ga),A(L,T,S,m,ea,da),Ua(L,T,S,m,ea,da,0,0,1,0,0,1,qa),A(ia,ha,aa,U,ja,ca),Ua(ia,ha,aa,U,ja,ca,1,0,1,1,0,1,qa)}function A(a,c,b,e,f,k){o.beginPath();o.moveTo(a,c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(a,c);o.closePath()}function C(a,c,b,e,f,k,h,m){o.beginPath(); +o.moveTo(a,c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(h,m);o.lineTo(a,c);o.closePath()}function Ka(a,c,b,f){if(B!=c)o.lineWidth=B=c;if(K!=b)o.lineCap=K=b;if(F!=f)o.lineJoin=F=f;e(a.getContextStyle());o.stroke();$.inflate(c*2)}function La(a){f(a.getContextStyle());o.fill()}function $a(a,c,b,e,k,h,m,l,n,p,t,u,v){if(v.image.width!=0){if(v.needsUpdate==!0||oa[v.id]==void 0){var wa=v.wrapS==THREE.RepeatWrapping,G=v.wrapT==THREE.RepeatWrapping;oa[v.id]=o.createPattern(v.image,wa&&G?"repeat":wa&&!G?"repeat-x": +!wa&&G?"repeat-y":"no-repeat");v.needsUpdate=!1}f(oa[v.id]);var wa=v.offset.x/v.repeat.x,G=v.offset.y/v.repeat.y,x=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,m=(m+wa)*x,l=(l+G)*v,n=(n+wa)*x,p=(p+G)*v,t=(t+wa)*x,u=(u+G)*v;b-=a;e-=c;k-=a;h-=c;n-=m;p-=l;t-=m;u-=l;wa=1/(n*u-t*p);v=(u*b-p*k)*wa;p=(u*e-p*h)*wa;b=(n*k-t*b)*wa;e=(n*h-t*e)*wa;a=a-v*m-b*l;c=c-p*m-e*l;o.save();o.transform(v,p,b,e,a,c);o.fill();o.restore()}}function Ua(a,c,b,e,f,k,h,m,l,n,p,t,v){var u,wa;u=v.width-1;wa=v.height- +1;h*=u;m*=wa;l*=u;n*=wa;p*=u;t*=wa;b-=a;e-=c;f-=a;k-=c;l-=h;n-=m;p-=h;t-=m;wa=1/(l*t-p*n);u=(t*b-n*f)*wa;n=(t*e-n*k)*wa;b=(l*f-p*b)*wa;e=(l*k-p*e)*wa;a=a-u*h-b*m;c=c-n*h-e*m;o.save();o.transform(u,n,b,e,a,c);o.clip();o.drawImage(v,0,0);o.restore()}function Xa(a,c,b,e){var f=~~(a.r*255),k=~~(a.g*255),a=~~(a.b*255),h=~~(c.r*255),m=~~(c.g*255),c=~~(c.b*255),l=~~(b.r*255),n=~~(b.g*255),b=~~(b.b*255),p=~~(e.r*255),t=~~(e.g*255),e=~~(e.b*255);Ba[0]=f<0?0:f>255?255:f;Ba[1]=k<0?0:k>255?255:k;Ba[2]=a<0?0: +a>255?255:a;Ba[4]=h<0?0:h>255?255:h;Ba[5]=m<0?0:m>255?255:m;Ba[6]=c<0?0:c>255?255:c;Ba[8]=l<0?0:l>255?255:l;Ba[9]=n<0?0:n>255?255:n;Ba[10]=b<0?0:b>255?255:b;Ba[12]=p<0?0:p>255?255:p;Ba[13]=t<0?0:t>255?255:t;Ba[14]=e<0?0:e>255?255:e;va.putImageData(Ca,0,0);W.drawImage(ya,0,0);return Ga}function Oa(a,c,b){a=(a-c)/(b-c);return a*a*(3-2*a)}function Va(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ma(a,c){var b=c.x-a.x,e=c.y-a.y,f=b*b+e*e;f!=0&&(f=1/Math.sqrt(f),b*=f,e*=f,c.x+=b,c.y+=e,a.x-=b,a.y-=e)}var Ya, +ab,ra,Ha,Na,Wa,Za,Aa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,t,v);h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,n,this.sortElements);(ma=a.lights.length>0)&&p(a);Ya=0;for(ab=k.length;Ya0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h)):k instanceof THREE.PointLight&&(R.sub(k.position,c.centroidWorld),R.normalize(),h=c.normalWorld.dot(R)*k.intensity,h>0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h))}function b(c,b,k,l,t,p){h.info.render.vertices+=3;h.info.render.faces++;J=e(V++); -J.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?E.copy(t.color):t instanceof THREE.MeshLambertMaterial?A?(C.r=L.r,C.g=L.g,C.b=L.b,a(p,l,C),E.r=Math.max(0,Math.min(t.color.r*C.r,1)),E.g=Math.max(0,Math.min(t.color.g*C.g,1)),E.b=Math.max(0,Math.min(t.color.b*C.b,1))):E.copy(t.color):t instanceof THREE.MeshDepthMaterial?(N=1-t.__2near/(t.__farPlusNear- -l.z*t.__farMinusNear),E.setRGB(N,N,N)):t instanceof THREE.MeshNormalMaterial&&E.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));t.wireframe?J.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):J.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+t.opacity);m.appendChild(J)}function c(c,b,k,l,t,p,o){h.info.render.vertices+= -4;h.info.render.faces++;J=e(V++);J.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+l.positionScreen.x+","+l.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?E.copy(p.color):p instanceof THREE.MeshLambertMaterial?A?(C.r=L.r,C.g=L.g,C.b=L.b,a(o,t,C),E.r=Math.max(0,Math.min(p.color.r*C.r,1)),E.g=Math.max(0,Math.min(p.color.g*C.g,1)),E.b=Math.max(0,Math.min(p.color.b*C.b,1))): -E.copy(p.color):p instanceof THREE.MeshDepthMaterial?(N=1-p.__2near/(p.__farPlusNear-t.z*p.__farMinusNear),E.setRGB(N,N,N)):p instanceof THREE.MeshNormalMaterial&&E.setRGB(f(t.normalWorld.x),f(t.normalWorld.y),f(t.normalWorld.z));p.wireframe?J.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):J.setAttribute("style","fill: "+E.getContextStyle()+ -"; fill-opacity: "+p.opacity);m.appendChild(J)}function e(a){H[a]==null&&(H[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),O==0&&H[a].setAttribute("shape-rendering","crispEdges"));return H[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var h=this,k=null,l=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,u,p,v,o,z,x,w,B=new THREE.Rectangle,y=new THREE.Rectangle,A=!1,E=new THREE.Color(16777215),C=new THREE.Color(16777215),L=new THREE.Color(0), -F=new THREE.Color(0),G=new THREE.Color(0),N,R=new THREE.Vector3,H=[],S=[],J,V,X,O=1;this.domElement=m;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,c){t=a;u=c;p=t/2;v=u/2;m.setAttribute("viewBox",-p+" "+-v+" "+t+" "+u);m.setAttribute("width",t);m.setAttribute("height",u);B.set(-p,-v,p,v)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])}; -this.render=function(a,e){var f,t,u,E,N,H,C,Q;this.autoClear&&this.clear();h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,e,this.sortElements);X=V=0;if(A=a.lights.length>0){C=a.lights;L.setRGB(0,0,0);F.setRGB(0,0,0);G.setRGB(0,0,0);f=0;for(t=C.length;f0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h)):k instanceof THREE.PointLight&&(V.sub(k.position,c.centroidWorld),V.normalize(),h=c.normalWorld.dot(V)*k.intensity,h>0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h))}function b(c,b,k,m,l,p){h.info.render.vertices+=3;h.info.render.faces++;L=e(T++); +L.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");l instanceof THREE.MeshBasicMaterial?B.copy(l.color):l instanceof THREE.MeshLambertMaterial?C?(K.r=F.r,K.g=F.g,K.b=F.b,a(p,m,K),B.r=Math.max(0,Math.min(l.color.r*K.r,1)),B.g=Math.max(0,Math.min(l.color.g*K.g,1)),B.b=Math.max(0,Math.min(l.color.b*K.b,1))):B.copy(l.color):l instanceof THREE.MeshDepthMaterial?(O=1-l.__2near/(l.__farPlusNear- +m.z*l.__farMinusNear),B.setRGB(O,O,O)):l instanceof THREE.MeshNormalMaterial&&B.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));l.wireframe?L.setAttribute("style","fill: none; stroke: "+B.getContextStyle()+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):L.setAttribute("style","fill: "+B.getContextStyle()+"; fill-opacity: "+l.opacity);n.appendChild(L)}function c(c,b,k,m,l,p,t){h.info.render.vertices+= +4;h.info.render.faces++;L=e(T++);L.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?B.copy(p.color):p instanceof THREE.MeshLambertMaterial?C?(K.r=F.r,K.g=F.g,K.b=F.b,a(t,l,K),B.r=Math.max(0,Math.min(p.color.r*K.r,1)),B.g=Math.max(0,Math.min(p.color.g*K.g,1)),B.b=Math.max(0,Math.min(p.color.b*K.b,1))): +B.copy(p.color):p instanceof THREE.MeshDepthMaterial?(O=1-p.__2near/(p.__farPlusNear-l.z*p.__farMinusNear),B.setRGB(O,O,O)):p instanceof THREE.MeshNormalMaterial&&B.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));p.wireframe?L.setAttribute("style","fill: none; stroke: "+B.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):L.setAttribute("style","fill: "+B.getContextStyle()+ +"; fill-opacity: "+p.opacity);n.appendChild(L)}function e(a){H[a]==null&&(H[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),m==0&&H[a].setAttribute("shape-rendering","crispEdges"));return H[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var h=this,k=null,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,u,t,v,o,y,x,w,A=new THREE.Rectangle,z=new THREE.Rectangle,C=!1,B=new THREE.Color(16777215),K=new THREE.Color(16777215),F=new THREE.Color(0), +M=new THREE.Color(0),E=new THREE.Color(0),O,V=new THREE.Vector3,H=[],P=[],L,T,S,m=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":m=1;break;case "low":m=0}};this.setSize=function(a,c){p=a;u=c;t=p/2;v=u/2;n.setAttribute("viewBox",-t+" "+-v+" "+p+" "+u);n.setAttribute("width",p);n.setAttribute("height",u);A.set(-t,-v,t,v)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])}; +this.render=function(a,e){var f,p,u,B,O,H,K,R;this.autoClear&&this.clear();h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,e,this.sortElements);S=T=0;if(C=a.lights.length>0){K=a.lights;F.setRGB(0,0,0);M.setRGB(0,0,0);E.setRGB(0,0,0);f=0;for(p=K.length;f=0&&(b=a.geometry.materials[c.materialIndex]);return b}function c(a,c,b){var e,f,k,h=a.vertices,l=h.length,m=a.colors,t=m.length,p=a.__vertexArray,o=a.__colorArray,u=a.__sortArray,v=a.__dirtyVertices,M=a.__dirtyColors,w=a.__webglCustomAttributesList,x;if(w){k=0;for(e=w.length;k=0)c&&(n.bindBuffer(n.ARRAY_BUFFER,f.__webglVertexBuffer),n.vertexAttribPointer(a.position,3,n.FLOAT,!1,0,0));else if(h.morphTargetBase){b=k.program.attributes;h.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),n.vertexAttribPointer(b.position,3,n.FLOAT,!1,0,0)):b.position>=0&&(n.bindBuffer(n.ARRAY_BUFFER,f.__webglVertexBuffer), -n.vertexAttribPointer(b.position,3,n.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){l=0;var p=h.morphTargetForcedOrder;for(m=h.morphTargetInfluences;lt&&(o=u,t=m[o]);n.bindBuffer(n.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[o]);n.vertexAttribPointer(b["morphTarget"+l],3,n.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[l]=t;p[o]=1;t=-1;l++}}k.program.uniforms.morphTargetInfluences!==null&&n.uniform1fv(k.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(c){if(f.__webglCustomAttributesList){l=0;for(m=f.__webglCustomAttributesList.length;l= -0&&(n.bindBuffer(n.ARRAY_BUFFER,b.buffer),n.vertexAttribPointer(a[b.buffer.belongsToAttribute],b.size,n.FLOAT,!1,0,0))}a.color>=0&&(n.bindBuffer(n.ARRAY_BUFFER,f.__webglColorBuffer),n.vertexAttribPointer(a.color,3,n.FLOAT,!1,0,0));a.normal>=0&&(n.bindBuffer(n.ARRAY_BUFFER,f.__webglNormalBuffer),n.vertexAttribPointer(a.normal,3,n.FLOAT,!1,0,0));a.tangent>=0&&(n.bindBuffer(n.ARRAY_BUFFER,f.__webglTangentBuffer),n.vertexAttribPointer(a.tangent,4,n.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(n.bindBuffer(n.ARRAY_BUFFER, -f.__webglUVBuffer),n.vertexAttribPointer(a.uv,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(a.uv)):n.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(n.bindBuffer(n.ARRAY_BUFFER,f.__webglUV2Buffer),n.vertexAttribPointer(a.uv2,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(a.uv2)):n.disableVertexAttribArray(a.uv2));k.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(n.bindBuffer(n.ARRAY_BUFFER,f.__webglSkinVertexABuffer),n.vertexAttribPointer(a.skinVertexA,4, -n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),n.vertexAttribPointer(a.skinVertexB,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),n.vertexAttribPointer(a.skinIndex,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),n.vertexAttribPointer(a.skinWeight,4,n.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(k.wireframe?(n.lineWidth(k.wireframeLinewidth),c&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),n.drawElements(n.LINES,f.__webglLineCount, -n.UNSIGNED_SHORT,0)):(c&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),n.drawElements(n.TRIANGLES,f.__webglFaceCount,n.UNSIGNED_SHORT,0)),O.info.render.calls++,O.info.render.vertices+=f.__webglFaceCount,O.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type==THREE.LineStrip?n.LINE_STRIP:n.LINES,n.lineWidth(k.linewidth),n.drawArrays(h,0,f.__webglLineCount),O.info.render.calls++):h instanceof THREE.ParticleSystem?(n.drawArrays(n.POINTS,0,f.__webglParticleCount),O.info.render.calls++): -h instanceof THREE.Ribbon&&(n.drawArrays(n.TRIANGLE_STRIP,0,f.__webglVertexCount),O.info.render.calls++)}}function h(a,c,b){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=n.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=n.createBuffer();a.hasPos&&(n.bindBuffer(n.ARRAY_BUFFER,a.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,a.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttribArray(c.attributes.position),n.vertexAttribPointer(c.attributes.position,3,n.FLOAT,!1,0,0));if(a.hasNormal){n.bindBuffer(n.ARRAY_BUFFER, -a.__webglNormalBuffer);if(b==THREE.FlatShading){var e,f,k,h,l,m,p,t,o,u,v=a.count*3;for(u=0;u=0&&(c=c.geometry.materials[materialIndex], -c.transparent?v(a,c):v(f,c))):(c=b)&&(c.transparent?v(a,c):v(f,c))}function x(a,c){return c.z-a.z}function w(a){var c,b,m,t=0,o,v,x,w,M=a.lights;ha||(ha=new THREE.PerspectiveCamera(O.shadowCameraFov,O.shadowMapWidth/O.shadowMapHeight,O.shadowCameraNear,O.shadowCameraFar));c=0;for(b=M.length;c=0;b--)a[b].object==c&&a.splice(b,1)}function L(a,c,b){a.push({buffer:c,object:b,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(a){if(a!=Q){switch(a){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.ONE_MINUS_SRC_COLOR); -break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}Q=a}}function G(a,c,b){(b.width&b.width-1)==0&&(b.height&b.height-1)==0?(n.texParameteri(a,n.TEXTURE_WRAP_S,X(c.wrapS)),n.texParameteri(a,n.TEXTURE_WRAP_T,X(c.wrapT)),n.texParameteri(a,n.TEXTURE_MAG_FILTER,X(c.magFilter)),n.texParameteri(a,n.TEXTURE_MIN_FILTER,X(c.minFilter)), -n.generateMipmap(a)):(n.texParameteri(a,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(a,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(a,n.TEXTURE_MAG_FILTER,V(c.magFilter)),n.texParameteri(a,n.TEXTURE_MIN_FILTER,V(c.minFilter)))}function N(a,c){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=n.createTexture(),O.info.memory.textures++;n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?n.texImage2D(n.TEXTURE_2D,0,X(a.format), -a.image.width,a.image.height,0,X(a.format),n.UNSIGNED_BYTE,a.image.data):n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,a.image);G(n.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+c),n.bindTexture(n.TEXTURE_2D,a.__webglTexture)}function R(a,c){n.bindRenderbuffer(n.RENDERBUFFER,a);c.depthBuffer&&!c.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,c.width,c.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,a)): -c.depthBuffer&&c.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,c.width,c.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,a)):n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,c.width,c.height)}function H(a){var c=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=n.createTexture();if(c){a.__webglFramebuffer=[];a.__webglRenderbuffer= -[];n.bindTexture(n.TEXTURE_CUBE_MAP,a.__webglTexture);G(n.TEXTURE_CUBE_MAP,a,a);for(var b=0;b<6;b++){a.__webglFramebuffer[b]=n.createFramebuffer();a.__webglRenderbuffer[b]=n.createRenderbuffer();n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+b,0,X(a.format),a.width,a.height,0,X(a.format),X(a.type),null);var e=a,f=n.TEXTURE_CUBE_MAP_POSITIVE_X+b;n.bindFramebuffer(n.FRAMEBUFFER,a.__webglFramebuffer[b]);n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,f,e.__webglTexture,0);R(a.__webglRenderbuffer[b], -a)}}else a.__webglFramebuffer=n.createFramebuffer(),a.__webglRenderbuffer=n.createRenderbuffer(),n.bindTexture(n.TEXTURE_2D,a.__webglTexture),G(n.TEXTURE_2D,a,a),n.texImage2D(n.TEXTURE_2D,0,X(a.format),a.width,a.height,0,X(a.format),X(a.type),null),b=n.TEXTURE_2D,n.bindFramebuffer(n.FRAMEBUFFER,a.__webglFramebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,b,a.__webglTexture,0),n.bindRenderbuffer(n.RENDERBUFFER,a.__webglRenderbuffer),R(a.__webglRenderbuffer,a);c?n.bindTexture(n.TEXTURE_CUBE_MAP, -null):n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null)}a?(c=c?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,b=a.width,a=a.height,f=e=0):(c=null,b=ma,a=na,e=da,f=sa);c!=aa&&(n.bindFramebuffer(n.FRAMEBUFFER,c),n.viewport(e,f,b,a),aa=c)}function S(a){a instanceof THREE.WebGLRenderTargetCube?(n.bindTexture(n.TEXTURE_CUBE_MAP,a.__webglTexture),n.generateMipmap(n.TEXTURE_CUBE_MAP),n.bindTexture(n.TEXTURE_CUBE_MAP,null)):(n.bindTexture(n.TEXTURE_2D, -a.__webglTexture),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null))}function J(a,c){var b;a=="fragment"?b=n.createShader(n.FRAGMENT_SHADER):a=="vertex"&&(b=n.createShader(n.VERTEX_SHADER));n.shaderSource(b,c);n.compileShader(b);if(!n.getShaderParameter(b,n.COMPILE_STATUS))return console.error(n.getShaderInfoLog(b)),console.error(c),null;return b}function V(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return n.NEAREST; -default:return n.LINEAR}}function X(a){switch(a){case THREE.RepeatWrapping:return n.REPEAT;case THREE.ClampToEdgeWrapping:return n.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return n.MIRRORED_REPEAT;case THREE.NearestFilter:return n.NEAREST;case THREE.NearestMipMapNearestFilter:return n.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return n.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return n.LINEAR;case THREE.LinearMipMapNearestFilter:return n.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return n.LINEAR_MIPMAP_LINEAR; -case THREE.ByteType:return n.BYTE;case THREE.UnsignedByteType:return n.UNSIGNED_BYTE;case THREE.ShortType:return n.SHORT;case THREE.UnsignedShortType:return n.UNSIGNED_SHORT;case THREE.IntType:return n.INT;case THREE.UnsignedShortType:return n.UNSIGNED_INT;case THREE.FloatType:return n.FLOAT;case THREE.AlphaFormat:return n.ALPHA;case THREE.RGBFormat:return n.RGB;case THREE.RGBAFormat:return n.RGBA;case THREE.LuminanceFormat:return n.LUMINANCE;case THREE.LuminanceAlphaFormat:return n.LUMINANCE_ALPHA}return 0} -var O=this,n,U=[],$=null,aa=null,ca=-1,ea=null,la=0,ka=null,Z=null,Q=null,T=null,fa=null,ga=null,qa=null,oa=null,da=0,sa=0,ma=0,na=0,pa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Fa=new Float32Array(16),Ea=new Float32Array(16),za=new THREE.Vector4,Da={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},M=a.canvas!==void 0?a.canvas:document.createElement("canvas"), -Y=a.stencil!==void 0?a.stencil:!0,ia=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ja=a.antialias!==void 0?a.antialias:!1,K=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ra=a.clearAlpha!==void 0?a.clearAlpha:0,wa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=M;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear= -!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;var ha,xa=[],a=THREE.ShaderLib.depthRGBA,ua=THREE.UniformsUtils.clone(a.uniforms),ya=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ua}), -Ba=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ua,morphTargets:!0});ya._shadowPass=!0;Ba._shadowPass=!0;try{if(!(n=M.getContext("experimental-webgl",{antialias:ja,stencil:Y,preserveDrawingBuffer:ia})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Ha){console.error(Ha)}n.clearColor(0, -0,0,1);n.clearDepth(1);n.clearStencil(0);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(K.r,K.g,K.b,ra);this.context=n;var Ia=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);Y=0;W.vertices[Y++]=-1;W.vertices[Y++]=-1;W.vertices[Y++]=0;W.vertices[Y++]=1;W.vertices[Y++]=1; -W.vertices[Y++]=-1;W.vertices[Y++]=1;W.vertices[Y++]=1;W.vertices[Y++]=1;W.vertices[Y++]=1;W.vertices[Y++]=1;W.vertices[Y++]=0;W.vertices[Y++]=-1;W.vertices[Y++]=1;W.vertices[Y++]=0;Y=W.vertices[Y++]=0;W.faces[Y++]=0;W.faces[Y++]=1;W.faces[Y++]=2;W.faces[Y++]=0;W.faces[Y++]=2;W.faces[Y++]=3;W.vertexBuffer=n.createBuffer();W.elementBuffer=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,W.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,W.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,W.elementBuffer); -n.bufferData(n.ELEMENT_ARRAY_BUFFER,W.faces,n.STATIC_DRAW);W.program=n.createProgram();n.attachShader(W.program,J("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(W.program,J("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=n.getAttribLocation(W.program,"position");W.attributes.uv=n.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=n.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=n.getUniformLocation(W.program, -"uvScale");W.uniforms.rotation=n.getUniformLocation(W.program,"rotation");W.uniforms.scale=n.getUniformLocation(W.program,"scale");W.uniforms.alignment=n.getUniformLocation(W.program,"alignment");W.uniforms.color=n.getUniformLocation(W.program,"color");W.uniforms.map=n.getUniformLocation(W.program,"map");W.uniforms.opacity=n.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=n.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=n.getUniformLocation(W.program, -"affectedByDistance");W.uniforms.screenPosition=n.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=n.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=n.getUniformLocation(W.program,"projectionMatrix");var Ja=!1;this.setSize=function(a,c){M.width=a;M.height=c;this.setViewport(0,0,M.width,M.height)};this.setViewport=function(a,c,b,e){da=a;sa=c;ma=b;na=e;n.viewport(da,sa,ma,na)};this.setScissor=function(a,c,b,e){n.scissor(a,c,b,e)};this.enableScissorTest= -function(a){a?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.setClearColorHex=function(a,c){K.setHex(a);ra=c;n.clearColor(K.r,K.g,K.b,ra)};this.setClearColor=function(a,c){K.copy(a);ra=c;n.clearColor(K.r,K.g,K.b,ra)};this.getClearColor=function(){return K};this.getClearAlpha=function(){return ra};this.clear=function(a,c,b){var e=0;if(a==void 0||a)e|=n.COLOR_BUFFER_BIT;if(c==void 0||c)e|=n.DEPTH_BUFFER_BIT;if(b==void 0||b)e|=n.STENCIL_BUFFER_BIT;n.clear(e)};this.getContext=function(){return n}; -this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[g];n.deleteBuffer(c.__webglVertexBuffer);n.deleteBuffer(c.__webglNormalBuffer);n.deleteBuffer(c.__webglTangentBuffer);n.deleteBuffer(c.__webglColorBuffer);n.deleteBuffer(c.__webglUVBuffer);n.deleteBuffer(c.__webglUV2Buffer);n.deleteBuffer(c.__webglSkinVertexABuffer); -n.deleteBuffer(c.__webglSkinVertexBBuffer);n.deleteBuffer(c.__webglSkinIndicesBuffer);n.deleteBuffer(c.__webglSkinWeightsBuffer);n.deleteBuffer(c.__webglFaceBuffer);n.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var b=0,e=c.numMorphTargets;b=0&&(b=a.geometry.materials[c.materialIndex]);return b}function c(a,c,b){var e,f,k,h=a.vertices,l=h.length,n=a.colors,p=n.length,t=a.__vertexArray,o=a.__colorArray,u=a.__sortArray,v=a.__dirtyVertices,G=a.__dirtyColors,x=a.__webglCustomAttributesList,w;if(x){k=0;for(e=x.length;k=0)c&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglVertexBuffer),m.vertexAttribPointer(a.position,3,m.FLOAT,!1,0,0));else if(h.morphTargetBase){b=k.program.attributes;h.morphTargetBase!==-1?(m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0)):b.position>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglVertexBuffer), +m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){l=0;var p=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;lt&&(o=v,t=n[o]);m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[o]);m.vertexAttribPointer(b["morphTarget"+l],3,m.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[l]=t;p[o]=1;t=-1;l++}}k.program.uniforms.morphTargetInfluences!==null&&m.uniform1fv(k.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(c){if(f.__webglCustomAttributesList){l=0;for(n=f.__webglCustomAttributesList.length;l= +0&&(m.bindBuffer(m.ARRAY_BUFFER,b.buffer),m.vertexAttribPointer(a[b.buffer.belongsToAttribute],b.size,m.FLOAT,!1,0,0))}a.color>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglColorBuffer),m.vertexAttribPointer(a.color,3,m.FLOAT,!1,0,0));a.normal>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglNormalBuffer),m.vertexAttribPointer(a.normal,3,m.FLOAT,!1,0,0));a.tangent>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglTangentBuffer),m.vertexAttribPointer(a.tangent,4,m.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(m.bindBuffer(m.ARRAY_BUFFER, +f.__webglUVBuffer),m.vertexAttribPointer(a.uv,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(a.uv)):m.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(m.bindBuffer(m.ARRAY_BUFFER,f.__webglUV2Buffer),m.vertexAttribPointer(a.uv2,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(a.uv2)):m.disableVertexAttribArray(a.uv2));k.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinVertexABuffer),m.vertexAttribPointer(a.skinVertexA,4, +m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),m.vertexAttribPointer(a.skinVertexB,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),m.vertexAttribPointer(a.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),m.vertexAttribPointer(a.skinWeight,4,m.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(k.wireframe?(m.lineWidth(k.wireframeLinewidth),c&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),m.drawElements(m.LINES,f.__webglLineCount, +m.UNSIGNED_SHORT,0)):(c&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),m.drawElements(m.TRIANGLES,f.__webglFaceCount,m.UNSIGNED_SHORT,0)),S.info.render.calls++,S.info.render.vertices+=f.__webglFaceCount,S.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type==THREE.LineStrip?m.LINE_STRIP:m.LINES,m.lineWidth(k.linewidth),m.drawArrays(h,0,f.__webglLineCount),S.info.render.calls++):h instanceof THREE.ParticleSystem?(m.drawArrays(m.POINTS,0,f.__webglParticleCount),S.info.render.calls++): +h instanceof THREE.Ribbon&&(m.drawArrays(m.TRIANGLE_STRIP,0,f.__webglVertexCount),S.info.render.calls++)}}function h(a,c,b){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=m.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=m.createBuffer();a.hasPos&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,a.positionArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(c.attributes.position),m.vertexAttribPointer(c.attributes.position,3,m.FLOAT,!1,0,0));if(a.hasNormal){m.bindBuffer(m.ARRAY_BUFFER, +a.__webglNormalBuffer);if(b==THREE.FlatShading){var e,f,k,h,l,n,p,t,o,v,u=a.count*3;for(v=0;v=0)c=c.geometry.materials[b],c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}else if(c=e)c.transparent?(a.transparent= +c,a.opaque=null):(a.opaque=c,a.transparent=null)}function y(a,c){return c.z-a.z}function x(a){var c,b,n,p=0,o,v,G,w,x=a.lights;pa||(pa=new THREE.PerspectiveCamera(S.shadowCameraFov,S.shadowMapWidth/S.shadowMapHeight,S.shadowCameraNear,S.shadowCameraFar));c=0;for(b=x.length;c=0;b--)a[b].object==c&&a.splice(b,1)}function K(a,c,b){a.push({buffer:c,object:b,opaque:null,transparent:null})}function F(a){if(a!=Z){switch(a){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD); +m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}Z=a}}function M(a,c,b){(b.width&b.width-1)==0&&(b.height&b.height-1)==0?(m.texParameteri(a,m.TEXTURE_WRAP_S,T(c.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,T(c.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,T(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,T(c.minFilter)),m.generateMipmap(a)):(m.texParameteri(a,m.TEXTURE_WRAP_S, +m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,L(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,L(c.minFilter)))}function E(a,c){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=m.createTexture(),S.info.memory.textures++;m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.image.width,a.image.height,0,T(a.format),m.UNSIGNED_BYTE, +a.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,a.image);M(m.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+c),m.bindTexture(m.TEXTURE_2D,a.__webglTexture)}function O(a,c){m.bindRenderbuffer(m.RENDERBUFFER,a);c.depthBuffer&&!c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):c.depthBuffer&&c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER, +m.DEPTH_STENCIL,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,c.width,c.height)}function V(a){var c=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=m.createTexture();if(c){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture); +M(m.TEXTURE_CUBE_MAP,a,a);for(var b=0;b<6;b++){a.__webglFramebuffer[b]=m.createFramebuffer();a.__webglRenderbuffer[b]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+b,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null);var e=a,f=m.TEXTURE_CUBE_MAP_POSITIVE_X+b;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[b]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,f,e.__webglTexture,0);O(a.__webglRenderbuffer[b],a)}}else a.__webglFramebuffer=m.createFramebuffer(), +a.__webglRenderbuffer=m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),M(m.TEXTURE_2D,a,a),m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null),b=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,b,a.__webglTexture,0),m.bindRenderbuffer(m.RENDERBUFFER,a.__webglRenderbuffer),O(a.__webglRenderbuffer,a);c?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null); +m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(c=c?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,b=a.width,a=a.height,f=e=0):(c=null,b=qa,a=la,e=na,f=fa);c!=ea&&(m.bindFramebuffer(m.FRAMEBUFFER,c),m.viewport(e,f,b,a),ea=c)}function H(a){a instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture), +m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function P(a,c){var b;a=="fragment"?b=m.createShader(m.FRAGMENT_SHADER):a=="vertex"&&(b=m.createShader(m.VERTEX_SHADER));m.shaderSource(b,c);m.compileShader(b);if(!m.getShaderParameter(b,m.COMPILE_STATUS))return console.error(m.getShaderInfoLog(b)),console.error(c),null;return b}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return m.NEAREST;default:return m.LINEAR}} +function T(a){switch(a){case THREE.RepeatWrapping:return m.REPEAT;case THREE.ClampToEdgeWrapping:return m.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return m.MIRRORED_REPEAT;case THREE.NearestFilter:return m.NEAREST;case THREE.NearestMipMapNearestFilter:return m.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return m.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return m.LINEAR;case THREE.LinearMipMapNearestFilter:return m.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return m.LINEAR_MIPMAP_LINEAR; +case THREE.ByteType:return m.BYTE;case THREE.UnsignedByteType:return m.UNSIGNED_BYTE;case THREE.ShortType:return m.SHORT;case THREE.UnsignedShortType:return m.UNSIGNED_SHORT;case THREE.IntType:return m.INT;case THREE.UnsignedShortType:return m.UNSIGNED_INT;case THREE.FloatType:return m.FLOAT;case THREE.AlphaFormat:return m.ALPHA;case THREE.RGBFormat:return m.RGB;case THREE.RGBAFormat:return m.RGBA;case THREE.LuminanceFormat:return m.LUMINANCE;case THREE.LuminanceAlphaFormat:return m.LUMINANCE_ALPHA}return 0} +var S=this,m,aa=[],U=null,ea=null,da=-1,ia=null,ha=0,ja=null,ca=null,Z=null,R=null,Y=null,X=null,ga=null,oa=null,na=0,fa=0,qa=0,la=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),Ea=new Float32Array(16),za=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},xa=a.canvas!==void 0?a.canvas:document.createElement("canvas"), +G=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ma=a.antialias!==void 0?a.antialias:!1,I=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),N=a.clearAlpha!==void 0?a.clearAlpha:0,ta=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear= +!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;var pa,ka=[],a=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(a.uniforms),va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya}), +Ca=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya,morphTargets:!0});va._shadowPass=!0;Ca._shadowPass=!0;try{if(!(m=xa.getContext("experimental-webgl",{antialias:ma,stencil:G,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+m.getParameter(m.VERSION)+" | "+m.getParameter(m.VENDOR)+" | "+m.getParameter(m.RENDERER)+" | "+m.getParameter(m.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}m.clearColor(0, +0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.clearColor(I.r,I.g,I.b,N);this.context=m;var Ga=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);G=0;W.vertices[G++]=-1;W.vertices[G++]=-1;W.vertices[G++]=0;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]= +-1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=0;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=0;G=W.vertices[G++]=0;W.faces[G++]=0;W.faces[G++]=1;W.faces[G++]=2;W.faces[G++]=0;W.faces[G++]=2;W.faces[G++]=3;W.vertexBuffer=m.createBuffer();W.elementBuffer=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.bufferData(m.ARRAY_BUFFER,W.vertices,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER, +W.faces,m.STATIC_DRAW);W.program=m.createProgram();m.attachShader(W.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));m.attachShader(W.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));m.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=m.getAttribLocation(W.program,"position");W.attributes.uv=m.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=m.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=m.getUniformLocation(W.program,"uvScale");W.uniforms.rotation= +m.getUniformLocation(W.program,"rotation");W.uniforms.scale=m.getUniformLocation(W.program,"scale");W.uniforms.alignment=m.getUniformLocation(W.program,"alignment");W.uniforms.color=m.getUniformLocation(W.program,"color");W.uniforms.map=m.getUniformLocation(W.program,"map");W.uniforms.opacity=m.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=m.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=m.getUniformLocation(W.program,"affectedByDistance"); +W.uniforms.screenPosition=m.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=m.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=m.getUniformLocation(W.program,"projectionMatrix");var Ta=!1;this.setSize=function(a,c){xa.width=a;xa.height=c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(a,c,b,e){na=a;fa=c;qa=b;la=e;m.viewport(na,fa,qa,la)};this.setScissor=function(a,c,b,e){m.scissor(a,c,b,e)};this.enableScissorTest=function(a){a? +m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColorHex=function(a,c){I.setHex(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.setClearColor=function(a,c){I.copy(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.getClearColor=function(){return I};this.getClearAlpha=function(){return N};this.clear=function(a,c,b){var e=0;if(a==void 0||a)e|=m.COLOR_BUFFER_BIT;if(c==void 0||c)e|=m.DEPTH_BUFFER_BIT;if(b==void 0||b)e|=m.STENCIL_BUFFER_BIT;m.clear(e)};this.getContext=function(){return m};this.deallocateObject= +function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[g];m.deleteBuffer(c.__webglVertexBuffer);m.deleteBuffer(c.__webglNormalBuffer);m.deleteBuffer(c.__webglTangentBuffer);m.deleteBuffer(c.__webglColorBuffer);m.deleteBuffer(c.__webglUVBuffer);m.deleteBuffer(c.__webglUV2Buffer);m.deleteBuffer(c.__webglSkinVertexABuffer); +m.deleteBuffer(c.__webglSkinVertexBBuffer);m.deleteBuffer(c.__webglSkinIndicesBuffer);m.deleteBuffer(c.__webglSkinWeightsBuffer);m.deleteBuffer(c.__webglFaceBuffer);m.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var b=0,e=c.numMorphTargets;b=0&&n.enableVertexAttribArray(v.position);v.color>=0&&n.enableVertexAttribArray(v.color);v.normal>=0&&n.enableVertexAttribArray(v.normal); -v.tangent>=0&&n.enableVertexAttribArray(v.tangent);a.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(n.enableVertexAttribArray(v.skinVertexA),n.enableVertexAttribArray(v.skinVertexB),n.enableVertexAttribArray(v.skinIndex),n.enableVertexAttribArray(v.skinWeight));if(a.attributes)for(k in a.attributes)v[k]!==void 0&&v[k]>=0&&n.enableVertexAttribArray(v[k]);if(a.morphTargets)for(k=a.numSupportedMorphTargets=0;k=0&&(n.enableVertexAttribArray(v[x]), -a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,c,b,e){H(a);this.clear(c,b,e)};this.updateShadowMap=function(a,c){w(a,c)};this.render=function(a,c,b,v){var M,Y,ia,A,E,ja,C,G,oa=a.lights,N=a.fog;ca=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&w(a,c);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;if(c.matrixAutoUpdate){for(E=c;E.parent;)E=E.parent;E.update(void 0,!0)}a.update(void 0, -!1,c);c.matrixWorldInverse.flattenToArray(Ea);c.projectionMatrix.flattenToArray(Fa);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);u(Ca);this.initWebGLObjects(a);H(b);(this.autoClear||v)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);E=a.__webglObjects.length;for(v=0;v=0;v--)if(M=a.__webglObjects[v],M.render){C=M.object;G=M.buffer;ia=M.opaque;k(C);for(M=0;M65535&&(w[v].counter+=1,u=w[v].hash+"_"+w[v].counter,l.geometryGroups[u]==void 0&&(l.geometryGroups[u]={faces:[],materialIndex:o,vertices:0,numMorphTargets:M})),l.geometryGroups[u].faces.push(m),l.geometryGroups[u].vertices+=t;l.geometryGroupsList=[];m=void 0;for(m in l.geometryGroups)l.geometryGroups[m].id=la++,l.geometryGroupsList.push(l.geometryGroups[m])}for(k in h.geometryGroups)if(l=h.geometryGroups[k],!l.__webglVertexBuffer){m=l;m.__webglVertexBuffer=n.createBuffer();m.__webglNormalBuffer= -n.createBuffer();m.__webglTangentBuffer=n.createBuffer();m.__webglColorBuffer=n.createBuffer();m.__webglUVBuffer=n.createBuffer();m.__webglUV2Buffer=n.createBuffer();m.__webglSkinVertexABuffer=n.createBuffer();m.__webglSkinVertexBBuffer=n.createBuffer();m.__webglSkinIndicesBuffer=n.createBuffer();m.__webglSkinWeightsBuffer=n.createBuffer();m.__webglFaceBuffer=n.createBuffer();m.__webglLineBuffer=n.createBuffer();if(m.numMorphTargets){o=p=void 0;m.__webglMorphTargetsBuffers=[];p=0;for(o=m.numMorphTargets;p< -o;p++)m.__webglMorphTargetsBuffers.push(n.createBuffer())}O.info.memory.geometries++;for(var o=e,x=t=w=void 0,v=x=M=x=void 0,u=v=m=0,z=t=void 0,Y=void 0,t=p=M=w=void 0,M=o.geometry,z=M.faces,Y=l.faces,w=0,t=Y.length;w0||M.faceVertexUvs.length>0)l.__uvArray=new Float32Array(m*2);if(M.faceUvs.length>1||M.faceVertexUvs.length>1)l.__uv2Array=new Float32Array(m*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)l.__skinVertexAArray= -new Float32Array(m*4),l.__skinVertexBArray=new Float32Array(m*4),l.__skinIndexArray=new Float32Array(m*4),l.__skinWeightArray=new Float32Array(m*4);l.__faceArray=new Uint16Array(v*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0));l.__lineArray=new Uint16Array(u*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];M=0;for(x=l.numMorphTargets;M=0;h--)f[h]==k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&C(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglColorBuffer), -n.bufferData(n.ARRAY_BUFFER,aa,v));Ia&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,xa,v));Ea&&ua.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,ca,v));za&&sa>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,fa,v));za&&S>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglUV2Buffer),n.bufferData(n.ARRAY_BUFFER,ea,v));Fa&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER, -qa,v),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,pa,v));P>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,ga,v),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,$,v),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,na,v),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,Z,v));u&&(delete o.__inittedArrays,delete o.__colorArray, -delete o.__normalArray,delete o.__tangentArray,delete o.__uvArray,delete o.__uv2Array,delete o.__faceArray,delete o.__vertexArray,delete o.__lineArray,delete o.__skinVertexAArray,delete o.__skinVertexBArray,delete o.__skinIndexArray,delete o.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;E(l,h)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k; -l=n.DYNAMIC_DRAW;m=w=u=u=void 0;M=h.vertices;p=h.colors;t=M.length;o=p.length;z=h.__vertexArray;v=h.__colorArray;Y=h.__dirtyColors;if(h.__dirtyVertices){for(u=0;u=0&&m.enableVertexAttribArray(u.position);u.color>=0&&m.enableVertexAttribArray(u.color);u.normal>=0&&m.enableVertexAttribArray(u.normal); +u.tangent>=0&&m.enableVertexAttribArray(u.tangent);a.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(m.enableVertexAttribArray(u.skinVertexA),m.enableVertexAttribArray(u.skinVertexB),m.enableVertexAttribArray(u.skinIndex),m.enableVertexAttribArray(u.skinWeight));if(a.attributes)for(k in a.attributes)u[k]!==void 0&&u[k]>=0&&m.enableVertexAttribArray(u[k]);if(a.morphTargets)for(k=a.numSupportedMorphTargets=0;k=0&&(m.enableVertexAttribArray(u[G]), +a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,c,b,e){V(a);this.clear(c,b,e)};this.updateShadowMap=function(a,c){x(a,c)};this.render=function(a,c,b,G){var ma,$,z,C,B,I,K,E=a.lights,na=a.fog;da=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,c);S.info.render.calls=0;S.info.render.vertices=0;S.info.render.faces=0;if(c.matrixAutoUpdate){for(z=c;z.parent;)z=z.parent;z.update(void 0,!0)}a.update(void 0,!1, +c);c.matrixWorldInverse.flattenToArray(Ea);c.projectionMatrix.flattenToArray(Da);sa.multiply(c.projectionMatrix,c.matrixWorldInverse);u(sa);this.initWebGLObjects(a);V(b);(this.autoClear||G)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);z=a.__webglObjects.length;for(G=0;G=0;G--)if(B=a.__webglObjects[G],B.render&&(I=B.object,K=B.buffer,$=B.opaque))k(I),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),f(c,E,na,$,K, +I);for(G=0;G65535&&(G[v].counter+=1,u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]==void 0&&(l.geometryGroups[u]= +{faces:[],materialIndex:o,vertices:0,numMorphTargets:w})),l.geometryGroups[u].faces.push(n),l.geometryGroups[u].vertices+=t;l.geometryGroupsList=[];n=void 0;for(n in l.geometryGroups)l.geometryGroups[n].id=ha++,l.geometryGroupsList.push(l.geometryGroups[n])}for(k in h.geometryGroups)if(l=h.geometryGroups[k],!l.__webglVertexBuffer){n=l;n.__webglVertexBuffer=m.createBuffer();n.__webglNormalBuffer=m.createBuffer();n.__webglTangentBuffer=m.createBuffer();n.__webglColorBuffer=m.createBuffer();n.__webglUVBuffer= +m.createBuffer();n.__webglUV2Buffer=m.createBuffer();n.__webglSkinVertexABuffer=m.createBuffer();n.__webglSkinVertexBBuffer=m.createBuffer();n.__webglSkinIndicesBuffer=m.createBuffer();n.__webglSkinWeightsBuffer=m.createBuffer();n.__webglFaceBuffer=m.createBuffer();n.__webglLineBuffer=m.createBuffer();if(n.numMorphTargets){o=p=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(o=n.numMorphTargets;p0||w.faceVertexUvs.length>0)l.__uvArray=new Float32Array(n*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)l.__uv2Array=new Float32Array(n*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)l.__skinVertexAArray=new Float32Array(n*4),l.__skinVertexBArray=new Float32Array(n* +4),l.__skinIndexArray=new Float32Array(n*4),l.__skinWeightArray=new Float32Array(n*4);l.__faceArray=new Uint16Array(v*3);l.__lineArray=new Uint16Array(u*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];w=0;for(x=l.numMorphTargets;w=0;h--)f[h]==k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&B(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,da,v));Fa&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglNormalBuffer),m.bufferData(m.ARRAY_BUFFER,ya,v));xa&&sa.hasTangents&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglTangentBuffer),m.bufferData(m.ARRAY_BUFFER,aa,v));za&&qa>0&&(m.bindBuffer(m.ARRAY_BUFFER, +o.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,ia,v));za&&Y>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,ua,v));Ea&&(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,Ca,v),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,va,v));Q>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinVertexABuffer),m.bufferData(m.ARRAY_BUFFER,ga,v),m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinVertexBBuffer), +m.bufferData(m.ARRAY_BUFFER,ea,v),m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,Z,v),m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,ca,v));u&&(delete o.__inittedArrays,delete o.__colorArray,delete o.__normalArray,delete o.__tangentArray,delete o.__uvArray,delete o.__uv2Array,delete o.__faceArray,delete o.__vertexArray,delete o.__lineArray,delete o.__skinVertexAArray,delete o.__skinVertexBArray,delete o.__skinIndexArray,delete o.__skinWeightArray)}k.__dirtyVertices= +!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;C(l,h)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;l=m.DYNAMIC_DRAW;n=G=u=u=void 0;w=h.vertices;p=h.colors;t=w.length;o=p.length;y=h.__vertexArray;v=h.__colorArray;ma=h.__dirtyColors;if(h.__dirtyVertices){for(u=0;u1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=k;b.v=h;return b}}; THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -THREE.GeometryUtils={merge:function(a,b){for(var c,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,k=a.vertices,l=h.vertices,m=a.faces,t=h.faces,u=a.faceVertexUvs[0],p=h.faceVertexUvs[0],v={},o=0;o1&&(e=1-e,f=1-f);h=1-e-f;k.copy(a);k.multiplyScalar(e);l.copy(b);l.multiplyScalar(f);k.addSelf(l);l.copy(c);l.multiplyScalar(h);k.addSelf(l);return k},randomPointInFace:function(a,b,c){var e,f,h;if(a instanceof THREE.Face3)return e=b.vertices[a.a].position,f=b.vertices[a.b].position, +THREE.GeometryUtils={merge:function(a,b){for(var c,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,k=a.vertices,l=h.vertices,n=a.faces,p=h.faces,u=a.faceVertexUvs[0],t=h.faceVertexUvs[0],v={},o=0;o1&&(e=1-e,f=1-f);h=1-e-f;k.copy(a);k.multiplyScalar(e);l.copy(b);l.multiplyScalar(f);k.addSelf(l);l.copy(c);l.multiplyScalar(h);k.addSelf(l);return k},randomPointInFace:function(a,b,c){var e,f,h;if(a instanceof THREE.Face3)return e=b.vertices[a.a].position,f=b.vertices[a.b].position, h=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else if(a instanceof THREE.Face4){e=b.vertices[a.a].position;f=b.vertices[a.b].position;h=b.vertices[a.c].position;var b=b.vertices[a.d].position,k;c?a._area1&&a._area2?(c=a._area1,k=a._area2):(c=THREE.GeometryUtils.triangleArea(e,f,b),k=THREE.GeometryUtils.triangleArea(f,h,b),a._area1=c,a._area2=k):(c=THREE.GeometryUtils.triangleArea(e,f,b),k=THREE.GeometryUtils.triangleArea(f,h,b));return THREE.GeometryUtils.random()*(c+ -k)a?c(b,f-1):t[f]a?c(b,f-1):p[f]0)l=e-1;else{l=e;break}e=l;if(c[e]==h)return e/(f-1);k=c[e];return c=(e+(h-k)/(c[e+1]-k))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)}; +THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),e=0,f=c.length,h;h=b?b:a*c[f-1];time=Date.now();for(var k=0,l=f-1,n;k<=l;)if(e=Math.floor(k+(l-k)/2),n=c[e]-h,n<0)k=e+1;else if(n>0)l=e-1;else{l=e;break}e=l;if(c[e]==h)return e/(f-1);k=c[e];return c=(e+(h-k)/(c[e+1]-k))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)}; THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4;a+=1.0E-4;b<0&&(b=0);a>1&&(a=1);var b=this.getPoint(b),a=this.getPoint(a),c=new THREE.Vector2;c.sub(a,b);return c.unit()};THREE.LineCurve=function(a,b){a instanceof THREE.Vector2?(this.v1=a,this.v2=b):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,b,c,e){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,e))};THREE.LineCurve.prototype=new THREE.Curve; THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a}; THREE.QuadraticBezierCurve=function(a,b,c){if(!(b instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),b=new THREE.Vector2(e[2],e[3]),c=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; @@ -394,47 +393,47 @@ THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){}; THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]}; THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,e=this.curves.length;for(c=0;cb)b=h.x;else if(h.xc)c=h.y;else if(h.yb)b=h.x;else if(h.xc)c=h.y;else if(h.y0?(k=c[c.length-1],o=k.x,z=k.y):(k=this.actions[e-1].args,o=k[k.length-2],z=k[k.length-1]);for(k=1;k<=a;k++)x=k/a,h=THREE.Shape.Utils.b2(x,o,p,l),x=THREE.Shape.Utils.b2(x,z,v, -m),c.push(new THREE.Vector2(h,x));break;case THREE.PathActions.BEZIER_CURVE_TO:l=h[4];m=h[5];p=h[0];v=h[1];t=h[2];u=h[3];c.length>0?(k=c[c.length-1],o=k.x,z=k.y):(k=this.actions[e-1].args,o=k[k.length-2],z=k[k.length-1]);for(k=1;k<=a;k++)x=k/a,h=THREE.Shape.Utils.b3(x,o,p,t,l),x=THREE.Shape.Utils.b3(x,z,v,u,m),c.push(new THREE.Vector2(h,x));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[e-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];x=a*h[0].length;k=k.concat(h[0]);h=new THREE.SplineCurve(k); -for(k=1;k<=x;k++)c.push(h.getPointAt(k/x));break;case THREE.PathActions.ARC:k=this.actions[e-1].args;l=h[0];m=h[1];t=h[2];p=h[3];x=h[4];v=!!h[5];u=k[k.length-2];o=k[k.length-1];k.length==0&&(u=o=0);z=x-p;var w=a*2;for(k=1;k<=w;k++)x=k/w,v||(x=1-x),x=p+x*z,h=u+l+t*Math.cos(x),x=o+m+t*Math.sin(x),c.push(new THREE.Vector2(h,x))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)}; -THREE.Path.prototype.nltransform=function(a,b,c,e,f,h){var k=this.getPoints(),l,m,t,u,p;l=0;for(m=k.length;l0?(k=c[c.length-1],o=k.x,y=k.y):(k=this.actions[e-1].args,o=k[k.length-2],y=k[k.length-1]);for(k=1;k<=a;k++)x=k/a,h=THREE.Shape.Utils.b2(x,o,t,l),x=THREE.Shape.Utils.b2(x,y,v, +n),c.push(new THREE.Vector2(h,x));break;case THREE.PathActions.BEZIER_CURVE_TO:l=h[4];n=h[5];t=h[0];v=h[1];p=h[2];u=h[3];c.length>0?(k=c[c.length-1],o=k.x,y=k.y):(k=this.actions[e-1].args,o=k[k.length-2],y=k[k.length-1]);for(k=1;k<=a;k++)x=k/a,h=THREE.Shape.Utils.b3(x,o,t,p,l),x=THREE.Shape.Utils.b3(x,y,v,u,n),c.push(new THREE.Vector2(h,x));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[e-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];x=a*h[0].length;k=k.concat(h[0]);h=new THREE.SplineCurve(k); +for(k=1;k<=x;k++)c.push(h.getPointAt(k/x));break;case THREE.PathActions.ARC:k=this.actions[e-1].args;l=h[0];n=h[1];p=h[2];t=h[3];x=h[4];v=!!h[5];u=k[k.length-2];o=k[k.length-1];k.length==0&&(u=o=0);y=x-t;var w=a*2;for(k=1;k<=w;k++)x=k/w,v||(x=1-x),x=t+x*y,h=u+l+p*Math.cos(x),x=o+n+p*Math.sin(x),c.push(new THREE.Vector2(h,x))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)}; +THREE.Path.prototype.nltransform=function(a,b,c,e,f,h){var k=this.getPoints(),l,n,p,u,t;l=0;for(n=k.length;l=0?l-1:c.length-1;h=k-1>=0?k-1:t.length-1;var x=[t[k],c[l],c[f]];p=THREE.FontUtils.Triangulate.area(x);var w=[t[k],t[h],c[l]];v=THREE.FontUtils.Triangulate.area(w);o=l;u=k;l+=1;k+=-1;l< -0&&(l+=c.length);l%=c.length;k<0&&(k+=t.length);k%=t.length;f=l-1>=0?l-1:c.length-1;h=k-1>=0?k-1:t.length-1;x=[t[k],c[l],c[f]];x=THREE.FontUtils.Triangulate.area(x);w=[t[k],t[h],c[l]];w=THREE.FontUtils.Triangulate.area(w);p+v>x+w&&(l=o,k=u,l<0&&(l+=c.length),l%=c.length,k<0&&(k+=t.length),k%=t.length,f=l-1>=0?l-1:c.length-1,h=k-1>=0?k-1:t.length-1);p=c.slice(0,l);v=c.slice(l);o=t.slice(k);u=t.slice(0,k);h=[t[k],t[h],c[l]];z.push([t[k],c[l],c[f]]);z.push(h);c=p.concat(o).concat(u).concat(v)}return{shape:c, -isolatedPts:z,allpoints:e}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),e=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,k,l,m,t={};h=0;for(k=e.length;h=0?l-1:c.length-1;h=k-1>=0?k-1:p.length-1;var x=[p[k],c[l],c[f]];t=THREE.FontUtils.Triangulate.area(x);var w=[p[k],p[h],c[l]];v=THREE.FontUtils.Triangulate.area(w);o=l;u=k;l+=1;k+=-1;l< +0&&(l+=c.length);l%=c.length;k<0&&(k+=p.length);k%=p.length;f=l-1>=0?l-1:c.length-1;h=k-1>=0?k-1:p.length-1;x=[p[k],c[l],c[f]];x=THREE.FontUtils.Triangulate.area(x);w=[p[k],p[h],c[l]];w=THREE.FontUtils.Triangulate.area(w);t+v>x+w&&(l=o,k=u,l<0&&(l+=c.length),l%=c.length,k<0&&(k+=p.length),k%=p.length,f=l-1>=0?l-1:c.length-1,h=k-1>=0?k-1:p.length-1);t=c.slice(0,l);v=c.slice(l);o=p.slice(k);u=p.slice(0,k);h=[p[k],p[h],c[l]];y.push([p[k],c[l],c[f]]);y.push(h);c=t.concat(o).concat(u).concat(v)}return{shape:c, +isolatedPts:y,allpoints:e}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),e=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,k,l,n,p={};h=0;for(k=e.length;h1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,f,h,k,l,n,p,u=this.data.JIT.hierarchy,t,v;this.currentTime+=a*this.timeScale;v=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,y=this.hierarchy.length;o1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= this.getPrevKeyWith("pos",o,k.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",o,l.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(c=== -"rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&u[0][t]===void 0){this.hierarchy[0].update(void 0,!0);for(o=0;oa.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];l=a[c[1]];m=a[c[2]];t=a[c[3]];c=f*f;k=f*c;e[0]=this.interpolate(h[0],l[0],m[0],t[0],f,c,k);e[1]=this.interpolate(h[1],l[1],m[1],t[1],f,c,k);e[2]=this.interpolate(h[2],l[2],m[2],t[2],f,c,k);return e}; +"rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&u[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(o=0;oa.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];l=a[c[1]];n=a[c[2]];p=a[c[3]];c=f*f;k=f*c;e[0]=this.interpolate(h[0],l[0],n[0],p[0],f,c,k);e[1]=this.interpolate(h[1],l[1],n[1],p[1],f,c,k);e[2]=this.interpolate(h[2],l[2],n[2],p[2],f,c,k);return e}; THREE.Animation.prototype.interpolate=function(a,b,c,e,f,h,k){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*k+(-3*(b-c)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]}; THREE.CubeCamera=function(a,b,c,e){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position= @@ -453,7 +452,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37: this.moveUp&&this.object.translateY(c);this.moveDown&&this.object.translateY(-c);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&& (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta); this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)}; -THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,c){return function(){c.apply(a,arguments)}}function f(a,c,b,e){var k={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),l=c.getLength(),w=f.length,B=0;h=w-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h=0?a:a+k;b=this.verticalAngleMap.srcRange; @@ -471,199 +470,200 @@ THREE.FlyControls=function(a,b){function c(a,c){return function(){c.apply(a,argu this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z= -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this, this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()}; -THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Matrix4,k=!1,l=1,m=0,t=0,u=0,p=0,v=0,o=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed; -this.rotateHorizontally(b*p);this.rotateVertically(b*v)}b=a*this.movementSpeed;this.object.translateZ(-b*(m>0||this.autoForward&&!(m<0)?1:m));this.object.translateX(b*t);this.object.translateY(b*u);k&&(this.roll+=this.rollSpeed*a*l);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y0||this.autoForward&&!(n<0)?1:n));this.object.translateX(b*p);this.object.translateY(b*u);k&&(this.roll+=this.rollSpeed*a*l);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y1?b.normalize():b.z=Math.sqrt(1-e*e);h.copy(this.object.position).subSelf(this.target);e=this.object.up.clone().setLength(b.y);e.addSelf(this.object.up.clone().crossSelf(h).setLength(b.x));e.addSelf(h.setLength(b.z));return e};this.rotateCamera=function(){var a=Math.acos(k.dot(l)/k.length()/l.length());if(a){var c=(new THREE.Vector3).cross(k,l).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c, --a);b.multiplyVector3(h);b.multiplyVector3(this.object.up);b.multiplyVector3(l);this.staticMoving?k=l:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(t.y-m.y)*this.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),this.staticMoving?m=t:m.y+=(t.y-m.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(u);if(a.lengthSq()){a.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.object.up).setLength(a.x); -c.addSelf(this.object.up.clone().setLength(a.y));this.object.position.addSelf(c);this.target.addSelf(c);this.staticMoving?u=p:u.addSelf(a.sub(p,u).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),h.lengthSq()0&&(h.multiplyScalar(a),this.staticMoving?n=p:n.y+=(p.y-n.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=t.clone().subSelf(u);if(a.lengthSq()){a.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.object.up).setLength(a.x); +c.addSelf(this.object.up.clone().setLength(a.y));this.object.position.addSelf(c);this.target.addSelf(c);this.staticMoving?u=t:u.addSelf(a.sub(t,u).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),h.lengthSq()0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(l=0;l0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(l=0;l0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(l=0;l0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(l=0;la&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(l).subSelf(a).clone()}function f(a){for(H=a.length;--H>=0;){la=H;ka=H-1;ka<0&&(ka=a.length- -1);for(var c=0,b=o+u*2,c=0;c=0;J--){V=J/u;X=m*(1-V);V=t*Math.sin(V*Math.PI/2);H=0;for(S=y.length;Ha&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(l).subSelf(a).clone()}function f(a){for(H=a.length;--H>=0;){ja=H;ca=H-1;ca<0&&(ca=a.length- +1);for(var c=0,b=o+u*2,c=0;c=0;L--){T=L/u;S=n*(1-T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,l,v)))-1);t.push(u)}b.push(t)}for(var o,z,x,f=b.length,c=0;c0)for(e=0;e1&&(o= -this.vertices[k].position.clone(),z=this.vertices[m].position.clone(),x=this.vertices[t].position.clone(),o.normalize(),z.normalize(),x.normalize(),this.faces.push(new THREE.Face3(k,m,t,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([u,p,w]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry; +THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,b||8),k=Math.max(2,c||6),b=[],c=0;c0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,l,v)))-1);p.push(u)}b.push(p)}for(var o,y,x,f=b.length,c=0;c0)for(e=0;e1&&(o= +this.vertices[k].position.clone(),y=this.vertices[n].position.clone(),x=this.vertices[p].position.clone(),o.normalize(),y.normalize(),x.normalize(),this.faces.push(new THREE.Face3(k,n,p,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([u,t,w]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry; THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry; THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var e=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry; THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,b){return(new TextPath(a,b)).toShapes()},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b= -this.getFace(),c=this.size/b.resolution,e=0,f=String(a).split(""),h=f.length,k=[],a=0;a0)for(t=0;t2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return h}m=t;f<=m&&(m=0);t=m+1;f<=t&&(t=0);u=t+1;f<=u&&(u=0);var v;a:{v=a;var o=m,z=t,x=u,w=f,B=k,y=void 0,A=void 0,E=void 0, -C=void 0,L=void 0,F=void 0,G=void 0,N=void 0,R=void 0,A=v[B[o]].x,E=v[B[o]].y,C=v[B[z]].x,L=v[B[z]].y,F=v[B[x]].x,G=v[B[x]].y;if(1.0E-10>(C-A)*(G-E)-(L-E)*(F-A))v=!1;else{for(y=0;y=0&&J>=0&&X>=0){v=!1;break a}}v= -!0}}if(v){h.push([a[k[m]],a[k[t]],a[k[u]]]);l.push([k[m],k[t],k[u]]);m=t;for(u=t+1;u0)for(p=0;p2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return h}n=p;f<=n&&(n=0);p=n+1;f<=p&&(p=0);u=p+1;f<=u&&(u=0);var v;a:{v=a;var o=n,y=p,x=u,w=f,A=k,z=void 0,C=void 0,B=void 0, +K=void 0,F=void 0,M=void 0,E=void 0,O=void 0,V=void 0,C=v[A[o]].x,B=v[A[o]].y,K=v[A[y]].x,F=v[A[y]].y,M=v[A[x]].x,E=v[A[x]].y;if(1.0E-10>(K-C)*(E-B)-(F-B)*(M-C))v=!1;else{for(z=0;z=0&&L>=0&&S>=0){v=!1; +break a}}v=!0}}if(v){h.push([a[k[n]],a[k[p]],a[k[u]]]);l.push([k[n],k[p],k[u]]);n=p;for(u=p+1;u0;)this.smooth(a)}; -THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,c,b,e,l,m){var o=new THREE.Face4(a,c,b,e,null,l.color,l.material);if(k.useOldVertexColors){o.vertexColors=[];for(var t,n,u,v=0;v<4;v++){u=m[v];t=new THREE.Color;t.setRGB(0,0,0);for(var w=0;w>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function f(a,c){var b=u(a,c),e=u(a,c+1),h=u(a,c+2);return(u(a,c+3)<<24)+(h<<16)+(e<<8)+b}function m(a,c){var b=u(a,c);return(u(a,c+1)<<8)+b}function t(a,c){var b=u(a,c);return b>127?b-256:b}function u(a,c){return a.charCodeAt(c)&255}function p(c){var b, -e,h;b=f(a,c);e=f(a,c+L);h=f(a,c+F);c=m(a,c+G);B.faces.push(new THREE.Face3(b,e,h,null,null,c))}function v(c){var b,e,h,k,n,o,p;b=f(a,c);e=f(a,c+L);h=f(a,c+F);k=m(a,c+G);n=f(a,c+N);o=f(a,c+R);p=f(a,c+H);var c=E[o*3],t=E[o*3+1];o=E[o*3+2];var u=E[p*3],v=E[p*3+1];p=E[p*3+2];B.faces.push(new THREE.Face3(b,e,h,[new THREE.Vector3(E[n*3],E[n*3+1],E[n*3+2]),new THREE.Vector3(c,t,o),new THREE.Vector3(u,v,p)],null,k))}function o(c){var b,e,h,k;b=f(a,c);e=f(a,c+S);h=f(a,c+J);k=f(a,c+V);c=m(a,c+X);B.faces.push(new THREE.Face4(b, -e,h,k,null,null,c))}function z(c){var b,e,h,k,o,p,t,u,v;b=f(a,c);e=f(a,c+S);h=f(a,c+J);k=f(a,c+V);o=m(a,c+X);p=f(a,c+O);t=f(a,c+n);u=f(a,c+U);v=f(a,c+$);var c=E[t*3],w=E[t*3+1];t=E[t*3+2];var M=E[u*3],x=E[u*3+1];u=E[u*3+2];var ia=E[v*3],y=E[v*3+1];v=E[v*3+2];B.faces.push(new THREE.Face4(b,e,h,k,[new THREE.Vector3(E[p*3],E[p*3+1],E[p*3+2]),new THREE.Vector3(c,w,t),new THREE.Vector3(M,x,u),new THREE.Vector3(ia,y,v)],null,o))}function x(c){var b,e,h,k;b=f(a,c);e=f(a,c+aa);h=f(a,c+ca);c=C[b*2];k=C[b* -2+1];b=C[e*2];var m=B.faceVertexUvs[0];e=C[e*2+1];var n=C[h*2];h=C[h*2+1];var o=[];o.push(new THREE.UV(c,k));o.push(new THREE.UV(b,e));o.push(new THREE.UV(n,h));m.push(o)}function w(c){var b,e,h,k,m,n;b=f(a,c);e=f(a,c+ea);h=f(a,c+la);k=f(a,c+ka);c=C[b*2];m=C[b*2+1];b=C[e*2];n=C[e*2+1];e=C[h*2];var o=B.faceVertexUvs[0];h=C[h*2+1];var p=C[k*2];k=C[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(b,n));t.push(new THREE.UV(e,h));t.push(new THREE.UV(p,k));o.push(t)}var B=this,y=0,A,E=[],C= -[],L,F,G,N,R,H,S,J,V,X,O,n,U,$,aa,ca,ea,la,ka,Z,Q,T,fa,ga,qa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(B,e,c);A={signature:a.substr(y,8),header_bytes:u(a,y+8),vertex_coordinate_bytes:u(a,y+9),normal_coordinate_bytes:u(a,y+10),uv_coordinate_bytes:u(a,y+11),vertex_index_bytes:u(a,y+12),normal_index_bytes:u(a,y+13),uv_index_bytes:u(a,y+14),material_index_bytes:u(a,y+15),nvertices:f(a,y+16),nnormals:f(a,y+16+4),nuvs:f(a,y+16+8),ntri_flat:f(a,y+16+12),ntri_smooth:f(a,y+16+16),ntri_flat_uv:f(a, -y+16+20),ntri_smooth_uv:f(a,y+16+24),nquad_flat:f(a,y+16+28),nquad_smooth:f(a,y+16+32),nquad_flat_uv:f(a,y+16+36),nquad_smooth_uv:f(a,y+16+40)};y+=A.header_bytes;L=A.vertex_index_bytes;F=A.vertex_index_bytes*2;G=A.vertex_index_bytes*3;N=A.vertex_index_bytes*3+A.material_index_bytes;R=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;H=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;S=A.vertex_index_bytes;J=A.vertex_index_bytes*2;V=A.vertex_index_bytes*3;X=A.vertex_index_bytes* -4;O=A.vertex_index_bytes*4+A.material_index_bytes;n=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;U=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;$=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;aa=A.uv_index_bytes;ca=A.uv_index_bytes*2;ea=A.uv_index_bytes;la=A.uv_index_bytes*2;ka=A.uv_index_bytes*3;c=A.vertex_index_bytes*3+A.material_index_bytes;qa=A.vertex_index_bytes*4+A.material_index_bytes;Z=A.ntri_flat*c;Q=A.ntri_smooth*(c+A.normal_index_bytes* -3);T=A.ntri_flat_uv*(c+A.uv_index_bytes*3);fa=A.ntri_smooth_uv*(c+A.normal_index_bytes*3+A.uv_index_bytes*3);ga=A.nquad_flat*qa;c=A.nquad_smooth*(qa+A.normal_index_bytes*4);qa=A.nquad_flat_uv*(qa+A.uv_index_bytes*4);y+=function(c){for(var e,h,f,l=A.vertex_coordinate_bytes*3,m=c+A.nvertices*l;c>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function f(a,c){var b=u(a,c),e=u(a,c+1),h=u(a,c+2);return(u(a,c+3)<<24)+(h<<16)+(e<<8)+b}function n(a,c){var b=u(a,c);return(u(a,c+1)<<8)+b}function p(a,c){var b=u(a,c);return b>127?b-256:b}function u(a,c){return a.charCodeAt(c)&255}function t(c){var b, +e,h;b=f(a,c);e=f(a,c+F);h=f(a,c+M);c=n(a,c+E);A.faces.push(new THREE.Face3(b,e,h,null,null,c))}function v(c){var b,e,h,k,m,o,p;b=f(a,c);e=f(a,c+F);h=f(a,c+M);k=n(a,c+E);m=f(a,c+O);o=f(a,c+V);p=f(a,c+H);var c=B[o*3],t=B[o*3+1];o=B[o*3+2];var u=B[p*3],v=B[p*3+1];p=B[p*3+2];A.faces.push(new THREE.Face3(b,e,h,[new THREE.Vector3(B[m*3],B[m*3+1],B[m*3+2]),new THREE.Vector3(c,t,o),new THREE.Vector3(u,v,p)],null,k))}function o(c){var b,e,h,k;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);c=n(a,c+S);A.faces.push(new THREE.Face4(b, +e,h,k,null,null,c))}function y(c){var b,e,h,k,o,p,t,u,v;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);o=n(a,c+S);p=f(a,c+m);t=f(a,c+aa);u=f(a,c+U);v=f(a,c+ea);var c=B[t*3],w=B[t*3+1];t=B[t*3+2];var G=B[u*3],x=B[u*3+1];u=B[u*3+2];var ma=B[v*3],I=B[v*3+1];v=B[v*3+2];A.faces.push(new THREE.Face4(b,e,h,k,[new THREE.Vector3(B[p*3],B[p*3+1],B[p*3+2]),new THREE.Vector3(c,w,t),new THREE.Vector3(G,x,u),new THREE.Vector3(ma,I,v)],null,o))}function x(c){var b,e,h,k;b=f(a,c);e=f(a,c+da);h=f(a,c+ia);c=K[b*2];k=K[b* +2+1];b=K[e*2];var m=A.faceVertexUvs[0];e=K[e*2+1];var n=K[h*2];h=K[h*2+1];var o=[];o.push(new THREE.UV(c,k));o.push(new THREE.UV(b,e));o.push(new THREE.UV(n,h));m.push(o)}function w(c){var b,e,h,k,m,n;b=f(a,c);e=f(a,c+ha);h=f(a,c+ja);k=f(a,c+ca);c=K[b*2];m=K[b*2+1];b=K[e*2];n=K[e*2+1];e=K[h*2];var o=A.faceVertexUvs[0];h=K[h*2+1];var p=K[k*2];k=K[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(b,n));t.push(new THREE.UV(e,h));t.push(new THREE.UV(p,k));o.push(t)}var A=this,z=0,C,B=[],K= +[],F,M,E,O,V,H,P,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z,R,Y,X,ga,oa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(A,e,c);C={signature:a.substr(z,8),header_bytes:u(a,z+8),vertex_coordinate_bytes:u(a,z+9),normal_coordinate_bytes:u(a,z+10),uv_coordinate_bytes:u(a,z+11),vertex_index_bytes:u(a,z+12),normal_index_bytes:u(a,z+13),uv_index_bytes:u(a,z+14),material_index_bytes:u(a,z+15),nvertices:f(a,z+16),nnormals:f(a,z+16+4),nuvs:f(a,z+16+8),ntri_flat:f(a,z+16+12),ntri_smooth:f(a,z+16+16),ntri_flat_uv:f(a, +z+16+20),ntri_smooth_uv:f(a,z+16+24),nquad_flat:f(a,z+16+28),nquad_smooth:f(a,z+16+32),nquad_flat_uv:f(a,z+16+36),nquad_smooth_uv:f(a,z+16+40)};z+=C.header_bytes;F=C.vertex_index_bytes;M=C.vertex_index_bytes*2;E=C.vertex_index_bytes*3;O=C.vertex_index_bytes*3+C.material_index_bytes;V=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;H=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;P=C.vertex_index_bytes;L=C.vertex_index_bytes*2;T=C.vertex_index_bytes*3;S=C.vertex_index_bytes* +4;m=C.vertex_index_bytes*4+C.material_index_bytes;aa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;U=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ea=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;da=C.uv_index_bytes;ia=C.uv_index_bytes*2;ha=C.uv_index_bytes;ja=C.uv_index_bytes*2;ca=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;oa=C.vertex_index_bytes*4+C.material_index_bytes;Z=C.ntri_flat*c;R=C.ntri_smooth*(c+ +C.normal_index_bytes*3);Y=C.ntri_flat_uv*(c+C.uv_index_bytes*3);X=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ga=C.nquad_flat*oa;c=C.nquad_smooth*(oa+C.normal_index_bytes*4);oa=C.nquad_flat_uv*(oa+C.uv_index_bytes*4);z+=function(c){for(var e,h,f,l=C.vertex_coordinate_bytes*3,m=c+C.nvertices*l;c=0){w=m.invBindMatrices[t];n.invBindMatrix=w;n.skinningMatrix=new THREE.Matrix4;n.skinningMatrix.multiply(n.world,w);n.weights=[];for(w=0;w1){m=new THREE.MeshFaceMaterial;for(j=0;j1?b[1].substr(0,c):"0";b[1].length1){m=new THREE.MeshFaceMaterial;for(j=0;j1?b[1].substr(0,c):"0";b[1].length=0,k=h.indexOf("(")>=0,l;if(f)e=h.split("."),h=e.shift(),e.shift();else if(k){l=h.split("(");h=l.shift(); -for(e=0;ec){t=n.output[m];break}k=t!==void 0?t instanceof THREE.Matrix4?k.multiply(k,t):k.multiply(k,l.matrix):k.multiply(k,l.matrix)}else k=k.multiply(k,l.matrix);c=k;b.push({time:a,pos:[c.n14, -c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};R.prototype.create=function(){var a= -{},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof N)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=oa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Fa+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color= -e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=Da;return this.material=new THREE.MeshLambertMaterial(a)};H.prototype.parse=function(a){for(var c=0;c=0,e=a.indexOf("(")>=0,h,f;if(b)c=a.split("."),a=c.shift(),f=c.shift();else if(e){h=a.split("(");a=h.shift();for(c=0;c=0,k=h.indexOf("(")>=0,l;if(f)e=h.split("."),h=e.shift(),e.shift();else if(k){l=h.split("(");h=l.shift(); +for(e=0;ec){p=n.output[m];break}k=p!==void 0?p instanceof THREE.Matrix4? +k.multiply(k,p):k.multiply(k,l.matrix):k.multiply(k,l.matrix)}else k=k.multiply(k,l.matrix);c=k;b.push({time:a,pos:[c.n14,c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};t.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};V.prototype.create=function(){var a={},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof O)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=na[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Ea+e.init_from), +a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=xa;return this.material=new THREE.MeshLambertMaterial(a)};H.prototype.parse=function(a){for(var c=0;c=0,e=a.indexOf("(")>=0,h,f;if(b)c=a.split("."),a=c.shift(),f=c.shift();else if(e){h=a.split("(");a=h.shift();for(c=0;c1&&(R=new THREE.MeshFaceMaterial);object=new THREE.Mesh(L,R);object.name=o;object.position.set(A[0],A[1],A[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=y.visible;U.scene.add(object);U.objects[o]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),U.scene.collisions.colliders.push(a));if(y.castsShadow)a= -new THREE.ShadowVolume(L),U.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},U.triggers[object.name]=a)}}else A=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=o,object.position.set(A[0],A[1],A[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= -y.visible!==void 0?y.visible:!1,U.scene.add(object),U.objects[o]=object,U.empties[o]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},U.triggers[object.name]=a)}function m(a){return function(b){U.geometries[a]=b;l();V-=1;c.onLoadComplete();u()}}function t(a){return function(c){U.geometries[a]=c}}function u(){c.callbackProgress({totalModels:O,totalTextures:n,loadedModels:O-V,loadedTextures:n-X},U);c.onLoadProgress();V==0&&X==0&&b(U)}var p,v,o,z,x,w,B,y,A,E,C,L,F,G,N, -R,H,S,J,V,X,O,n,U;S=a.data;N=new THREE.BinaryLoader;J=new THREE.JSONLoader;X=V=0;U={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(o in S.objects)if(y=S.objects[o],y.meshCollider){a=!0;break}if(a)U.scene.collisions=new THREE.CollisionSystem;if(S.transform){a=S.transform.position;E=S.transform.rotation;var $=S.transform.scale;a&&U.scene.position.set(a[0],a[1],a[2]);E&&U.scene.rotation.set(E[0],E[1],E[2]);$&&U.scene.scale.set($[0], -$[1],$[2]);(a||E||$)&&U.scene.updateMatrix()}a=function(){X-=1;u();c.onLoadComplete()};for(x in S.cameras)E=S.cameras[x],E.type=="perspective"?F=new THREE.PerspectiveCamera(E.fov,E.aspect,E.near,E.far):E.type=="ortho"&&(F=new THREE.OrthographicCamera(E.left,E.right,E.top,E.bottom,E.near,E.far)),A=E.position,E=E.target,F.position.set(A[0],A[1],A[2]),F.target=new THREE.Vector3(E[0],E[1],E[2]),U.cameras[x]=F;for(z in S.lights)x=S.lights[z],F=x.color!==void 0?x.color:16777215,E=x.intensity!==void 0?x.intensity: -1,x.type=="directional"?(A=x.direction,H=new THREE.DirectionalLight(F,E),H.position.set(A[0],A[1],A[2]),H.position.normalize()):x.type=="point"?(A=x.position,d=x.distance,H=new THREE.PointLight(F,E,d),H.position.set(A[0],A[1],A[2])):x.type=="ambient"&&(H=new THREE.AmbientLight(F)),U.scene.add(H),U.lights[z]=H;for(w in S.fogs)z=S.fogs[w],z.type=="linear"?G=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(G=new THREE.FogExp2(0,z.density)),E=z.color,G.color.setRGB(E[0],E[1],E[2]),U.fogs[w]=G;if(U.cameras&& -S.defaults.camera)U.currentCamera=U.cameras[S.defaults.camera];if(U.fogs&&S.defaults.fog)U.scene.fog=U.fogs[S.defaults.fog];E=S.defaults.bgcolor;U.bgColor=new THREE.Color;U.bgColor.setRGB(E[0],E[1],E[2]);U.bgColorAlpha=S.defaults.bgalpha;for(p in S.geometries)if(w=S.geometries[p],w.type=="bin_mesh"||w.type=="ascii_mesh")V+=1,c.onLoadStart();O=V;for(p in S.geometries)w=S.geometries[p],w.type=="cube"?(L=new THREE.CubeGeometry(w.width,w.height,w.depth,w.segmentsWidth,w.segmentsHeight,w.segmentsDepth, -null,w.flipped,w.sides),U.geometries[p]=L):w.type=="plane"?(L=new THREE.PlaneGeometry(w.width,w.height,w.segmentsWidth,w.segmentsHeight),U.geometries[p]=L):w.type=="sphere"?(L=new THREE.SphereGeometry(w.radius,w.segmentsWidth,w.segmentsHeight),U.geometries[p]=L):w.type=="cylinder"?(L=new THREE.CylinderGeometry(w.topRad,w.botRad,w.height,w.radSegs,w.heightSegs),U.geometries[p]=L):w.type=="torus"?(L=new THREE.TorusGeometry(w.radius,w.tube,w.segmentsR,w.segmentsT),U.geometries[p]=L):w.type=="icosahedron"? -(L=new THREE.IcosahedronGeometry(w.subdivisions),U.geometries[p]=L):w.type=="bin_mesh"?N.load(e(w.url,S.urlBaseType),m(p)):w.type=="ascii_mesh"?J.load(e(w.url,S.urlBaseType),m(p)):w.type=="embedded_mesh"&&(w=S.embeds[w.id])&&J.createModel(w,t(p),"");for(B in S.textures)if(p=S.textures[B],p.url instanceof Array){X+=p.url.length;for(N=0;N1&&(V=new THREE.MeshFaceMaterial);object=new THREE.Mesh(F,V);object.name=o;object.position.set(C[0],C[1],C[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=z.visible;U.scene.add(object);U.objects[o]=object;z.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),U.scene.collisions.colliders.push(a));if(z.castsShadow)a= +new THREE.ShadowVolume(F),U.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},U.triggers[object.name]=a)}}else C=z.position,r=z.rotation,q=z.quaternion,s=z.scale,q=0,object=new THREE.Object3D,object.name=o,object.position.set(C[0],C[1],C[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= +z.visible!==void 0?z.visible:!1,U.scene.add(object),U.objects[o]=object,U.empties[o]=object,z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},U.triggers[object.name]=a)}function n(a){return function(b){U.geometries[a]=b;l();T-=1;c.onLoadComplete();u()}}function p(a){return function(c){U.geometries[a]=c}}function u(){c.callbackProgress({totalModels:m,totalTextures:aa,loadedModels:m-T,loadedTextures:aa-S},U);c.onLoadProgress();T==0&&S==0&&b(U)}var t,v,o,y,x,w,A,z,C,B,K,F,M,E, +O,V,H,P,L,T,S,m,aa,U;P=a.data;O=new THREE.BinaryLoader;L=new THREE.JSONLoader;S=T=0;U={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(o in P.objects)if(z=P.objects[o],z.meshCollider){a=!0;break}if(a)U.scene.collisions=new THREE.CollisionSystem;if(P.transform){a=P.transform.position;B=P.transform.rotation;var ea=P.transform.scale;a&&U.scene.position.set(a[0],a[1],a[2]);B&&U.scene.rotation.set(B[0],B[1],B[2]);ea&& +U.scene.scale.set(ea[0],ea[1],ea[2]);(a||B||ea)&&U.scene.updateMatrix()}a=function(){S-=1;u();c.onLoadComplete()};for(x in P.cameras)B=P.cameras[x],B.type=="perspective"?M=new THREE.PerspectiveCamera(B.fov,B.aspect,B.near,B.far):B.type=="ortho"&&(M=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far)),C=B.position,B=B.target,M.position.set(C[0],C[1],C[2]),M.target=new THREE.Vector3(B[0],B[1],B[2]),U.cameras[x]=M;for(y in P.lights)x=P.lights[y],M=x.color!==void 0?x.color:16777215, +B=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(C=x.direction,H=new THREE.DirectionalLight(M,B),H.position.set(C[0],C[1],C[2]),H.position.normalize()):x.type=="point"?(C=x.position,d=x.distance,H=new THREE.PointLight(M,B,d),H.position.set(C[0],C[1],C[2])):x.type=="ambient"&&(H=new THREE.AmbientLight(M)),U.scene.add(H),U.lights[y]=H;for(w in P.fogs)y=P.fogs[w],y.type=="linear"?E=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(E=new THREE.FogExp2(0,y.density)),B=y.color,E.color.setRGB(B[0], +B[1],B[2]),U.fogs[w]=E;if(U.cameras&&P.defaults.camera)U.currentCamera=U.cameras[P.defaults.camera];if(U.fogs&&P.defaults.fog)U.scene.fog=U.fogs[P.defaults.fog];B=P.defaults.bgcolor;U.bgColor=new THREE.Color;U.bgColor.setRGB(B[0],B[1],B[2]);U.bgColorAlpha=P.defaults.bgalpha;for(t in P.geometries)if(w=P.geometries[t],w.type=="bin_mesh"||w.type=="ascii_mesh")T+=1,c.onLoadStart();m=T;for(t in P.geometries)w=P.geometries[t],w.type=="cube"?(F=new THREE.CubeGeometry(w.width,w.height,w.depth,w.segmentsWidth, +w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides),U.geometries[t]=F):w.type=="plane"?(F=new THREE.PlaneGeometry(w.width,w.height,w.segmentsWidth,w.segmentsHeight),U.geometries[t]=F):w.type=="sphere"?(F=new THREE.SphereGeometry(w.radius,w.segmentsWidth,w.segmentsHeight),U.geometries[t]=F):w.type=="cylinder"?(F=new THREE.CylinderGeometry(w.topRad,w.botRad,w.height,w.radSegs,w.heightSegs),U.geometries[t]=F):w.type=="torus"?(F=new THREE.TorusGeometry(w.radius,w.tube,w.segmentsR,w.segmentsT),U.geometries[t]= +F):w.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(w.subdivisions),U.geometries[t]=F):w.type=="bin_mesh"?O.load(e(w.url,P.urlBaseType),n(t)):w.type=="ascii_mesh"?L.load(e(w.url,P.urlBaseType),n(t)):w.type=="embedded_mesh"&&(w=P.embeds[w.id])&&L.createModel(w,p(t),"");for(A in P.textures)if(t=P.textures[A],t.url instanceof Array){S+=t.url.length;for(O=0;O=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,f=0;f<8;f++){for(var h=0,k=0;k>1^-(l&1);c[8*k+f]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(f=k=0;f=this.maxCount-3&&l(this)};this.begin=function(){this.count=0; -this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;bthis.size-1&&(m=this.size-1);var v=Math.floor(t-l);v<1&&(v=1);t=Math.floor(t+l);t>this.size-1&&(t=this.size-1);var o=Math.floor(u-l);o<1&&(o=1);l=Math.floor(u+l);l>this.size-1&&(l=this.size- -1);for(var z,x,w,B,y,A;p0&&(this.field[w+z]+=B)}}};this.addPlaneX=function(a,b){var f,h,k,l,m,t=this.size,u=this.yd,p=this.zd,v=this.field,o=t*Math.sqrt(a/b);o>t&&(o=t);for(f=0;f0)for(h=0;hu&&(z=u);for(h=0;h0){m=h*p;for(f=0;fsize&&(dist=size);for(k=0;k0){m=zd*k;for(h=0;h=this.maxCount-3&&l(this)};this.begin=function(){this.count=0; +this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;bthis.size-1&&(n=this.size-1);var v=Math.floor(p-l);v<1&&(v=1);p=Math.floor(p+l);p>this.size-1&&(p=this.size-1);var o=Math.floor(u-l);o<1&&(o=1);l=Math.floor(u+l);l>this.size-1&&(l=this.size- +1);for(var y,x,w,A,z,C;t0&&(this.field[w+y]+=A)}}};this.addPlaneX=function(a,b){var f,h,k,l,n,p=this.size,u=this.yd,t=this.zd,v=this.field,o=p*Math.sqrt(a/b);o>p&&(o=p);for(f=0;f0)for(h=0;hu&&(y=u);for(h=0;h0){n=h*t;for(f=0;fsize&&(dist=size);for(k=0;k0){n=zd*k;for(h=0;hh?this.hits.push(f):this.hits.unshift(f),h=e;return this.hits}; THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,b[c]);if(e.distb.length)return null;return b[c]}; THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),e=Number.MAX_VALUE,f,h=0;h=l*f))return Number.MAX_VALUE;k/=l;l=THREE.CollisionSystem.__v3;l.copy(a.direction);l.multiplyScalar(k);l.addSelf(a.origin);Math.abs(h.x)> +THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),e=Number.MAX_VALUE,f,h=0;h=l*f))return Number.MAX_VALUE;k/=l;l=THREE.CollisionSystem.__v3;l.copy(a.direction);l.multiplyScalar(k);l.addSelf(a.origin);Math.abs(h.x)> Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=l.y-b.y,h=c.y-b.y,f=e.y-b.y,l=l.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=l.x-b.x,h=c.x-b.x,f=e.x-b.x,l=l.y-b.y,c=c.y-b.y,e=e.y-b.y):Math.abs(h.y)>Math.abs(h.z)?(a=l.x-b.x,h=c.x-b.x,f=e.x-b.x,l=l.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=l.x-b.x,h=c.x-b.x,f=e.x-b.x,l=l.y-b.y,c=c.y-b.y,e=e.y-b.y);b=h*e-c*f;if(b==0)return Number.MAX_VALUE;b=1/b;e=(a*e-l*f)*b;if(!(e>=0))return Number.MAX_VALUE;b*=h*l-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-e-b>=0))return Number.MAX_VALUE;return k}; THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);c.multiplyVector3(e.origin);c.rotateAxis(e.direction);e.direction.normalize();return e}; -THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var e=0,f=0,h=0,k=0,l=0,m=0,t=!0;c.origin.xb.max.x&&(e=b.max.x-c.origin.x,e/=c.direction.x,t=!1,k=1);c.origin.yb.max.y&&(f=b.max.y-c.origin.y,f/=c.direction.y, -t=!1,l=1);c.origin.zb.max.z&&(h=b.max.z-c.origin.z,h/=c.direction.z,t=!1,m=1);if(t)return-1;t=0;f>e&&(t=1,e=f);h>e&&(t=2,e=h);switch(t){case 0:l=c.origin.y+c.direction.y*e;if(lb.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*e;if(cb.max.z)return Number.MAX_VALUE;b.normal.set(k,0,0);break;case 1:k=c.origin.x+c.direction.x*e;if(kb.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z* -e;if(cb.max.z)return Number.MAX_VALUE;b.normal.set(0,l,0);break;case 2:k=c.origin.x+c.direction.x*e;if(kb.max.x)return Number.MAX_VALUE;l=c.origin.y+c.direction.y*e;if(lb.max.y)return Number.MAX_VALUE;b.normal.set(0,0,m)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),e=b.point.dot(b.normal);if(c<0)c=(e-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE}; +THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var e=0,f=0,h=0,k=0,l=0,n=0,p=!0;c.origin.xb.max.x&&(e=b.max.x-c.origin.x,e/=c.direction.x,p=!1,k=1);c.origin.yb.max.y&&(f=b.max.y-c.origin.y,f/=c.direction.y, +p=!1,l=1);c.origin.zb.max.z&&(h=b.max.z-c.origin.z,h/=c.direction.z,p=!1,n=1);if(p)return-1;p=0;f>e&&(p=1,e=f);h>e&&(p=2,e=h);switch(p){case 0:l=c.origin.y+c.direction.y*e;if(lb.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*e;if(cb.max.z)return Number.MAX_VALUE;b.normal.set(k,0,0);break;case 1:k=c.origin.x+c.direction.x*e;if(kb.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z* +e;if(cb.max.z)return Number.MAX_VALUE;b.normal.set(0,l,0);break;case 2:k=c.origin.x+c.direction.x*e;if(kb.max.x)return Number.MAX_VALUE;l=c.origin.y+c.direction.y*e;if(lb.max.y)return Number.MAX_VALUE;b.normal.set(0,0,n)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),e=b.point.dot(b.normal);if(c<0)c=(e-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE}; THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq=0)return Math.abs(e)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4; THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b}; THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))}; -if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,f=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,k=new THREE.Matrix4,l=new THREE.Matrix4,m,t,u;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.PerspectiveCamera(53,1,1,1E4);o.position.z= -2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); -var z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);p.width=a;p.height=e;v.width=a;v.height=e};this.render=function(a,c){c.update(null,!0);if(m!==c.aspect||t!==c.near||u!==c.fov){m=c.aspect;t=c.near;u=c.fov;var B=c.projectionMatrix.clone(),y=125/30*0.5,A=y*t/125,E=t*Math.tan(u*Math.PI/360),C;k.n14=y;l.n14=-y;y=-E*m+A;C=E*m+A;B.n11=2*t/(C-y);B.n13=(C+y)/(C-y);f.projectionMatrix=B.clone();y=-E*m-A;C=E*m-A;B.n11=2*t/(C-y);B.n13= -(C+y)/(C-y);h.projectionMatrix=B.clone()}f.matrix=c.matrixWorld.clone().multiplySelf(l);f.update(null,!0);f.position.copy(c.position);f.near=t;f.far=c.far;e.call(b,a,f,p,!0);h.matrix=c.matrixWorld.clone().multiplySelf(k);h.update(null,!0);h.position.copy(c.position);h.near=t;h.far=c.far;e.call(b,a,h,v,!0);e.call(b,z,o)}}; +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,f=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,k=new THREE.Matrix4,l=new THREE.Matrix4,n,p,u;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.PerspectiveCamera(53,1,1,1E4);o.position.z= +2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); +var y=new THREE.Scene;y.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);t.width=a;t.height=e;v.width=a;v.height=e};this.render=function(a,c){c.update(null,!0);if(n!==c.aspect||p!==c.near||u!==c.fov){n=c.aspect;p=c.near;u=c.fov;var A=c.projectionMatrix.clone(),z=125/30*0.5,C=z*p/125,B=p*Math.tan(u*Math.PI/360),K;k.n14=z;l.n14=-z;z=-B*n+C;K=B*n+C;A.n11=2*p/(K-z);A.n13=(K+z)/(K-z);f.projectionMatrix=A.clone();z=-B*n-C;K=B*n-C;A.n11=2*p/(K-z);A.n13= +(K+z)/(K-z);h.projectionMatrix=A.clone()}f.matrix=c.matrixWorld.clone().multiplySelf(l);f.update(null,!0);f.position.copy(c.position);f.near=p;f.far=c.far;e.call(b,a,f,t,!0);h.matrix=c.matrixWorld.clone().multiplySelf(k);h.update(null,!0);h.position.copy(c.position);h.near=p;h.far=c.far;e.call(b,a,h,v,!0);e.call(b,y,o)}}; if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,f,h,k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);var l=new THREE.PerspectiveCamera;l.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,e){c.call(b,a,e);f=a/2;h=e};this.render=function(a,c){this.clear();k.fov=c.fov;k.aspect=0.5*c.aspect;k.near=c.near;k.far= c.far;k.updateProjectionMatrix();k.position.copy(c.position);k.target.copy(c.target);k.translateX(b.separation);k.lookAt(k.target);l.projectionMatrix=k.projectionMatrix;l.position.copy(c.position);l.target.copy(c.target);l.translateX(-b.separation);l.lookAt(l.target);this.setViewport(0,0,f,h);e.call(b,a,k);this.setViewport(f,0,f,h);e.call(b,a,l,!1)}}; diff --git a/build/custom/ThreeWebGL.js b/build/custom/ThreeWebGL.js index 104f39c8..9de8ac31 100644 --- a/build/custom/ThreeWebGL.js +++ b/build/custom/ThreeWebGL.js @@ -16,37 +16,37 @@ b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b0&&a>0&&h+a<1}for(var e,f=[],h=0,i=a.children.length;ha.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=b(this.origin, -this.direction,a.matrixWorld.getPosition());if(h==null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var j,n,k,l,p,m,s,B,A=a.geometry,H=A.vertices,h=0,i=A.faces.length;h0:m<0)))if(m=p.dot((new THREE.Vector3).sub(j,s))/m,s=s.addSelf(B.multiplyScalar(m)),e instanceof THREE.Face3)c(s,j,n,k)&&(e={distance:this.origin.distanceTo(s),point:s,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(s,j,n,l)||c(s,n,k,l)))e={distance:this.origin.distanceTo(s),point:s,face:e,object:a},f.push(e)}return f}}; -THREE.Rectangle=function(){function a(){h=e-b;i=f-c}var b,c,e,f,h,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(h,i,l,p){j=!1;b=h;c=i;e=l;f=p;a()};this.addPoint=function(h,i){j?(j=!1,b=h,c=i,e=h,f=i):(b=bh?e:h,f=f>i?f:i);a()};this.add3Points= -function(h,i,l,p,m,s){j?(j=!1,b=hl?h>m?h:m:l>m?l:m,f=i>p?i>s?i:s:p>s?p:s):(b=hl?h>m?h>e?h:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e,f=i>p?i>s?i>f?i:f:s>f?s:f:p>s?p>f?p:f:s>f?s:f);a()};this.addRectangle=function(h){j?(j=!1,b=h.getLeft(),c=h.getTop(),e=h.getRight(),f=h.getBottom()):(b=bh.getRight()?e:h.getRight(),f=f> +this.direction,a.matrixWorld.getPosition());if(h==null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var j,m,k,o,p,l,t,A,C=a.geometry,E=C.vertices,h=0,i=C.faces.length;h0:l<0)))if(l=p.dot((new THREE.Vector3).sub(j,t))/l,t=t.addSelf(A.multiplyScalar(l)),e instanceof THREE.Face3)c(t,j,m,k)&&(e={distance:this.origin.distanceTo(t),point:t,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(t,j,m,o)||c(t,m,k,o)))e={distance:this.origin.distanceTo(t),point:t,face:e,object:a},f.push(e)}return f}}; +THREE.Rectangle=function(){function a(){h=e-b;i=f-c}var b,c,e,f,h,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(h,i,o,p){j=!1;b=h;c=i;e=o;f=p;a()};this.addPoint=function(h,i){j?(j=!1,b=h,c=i,e=h,f=i):(b=bh?e:h,f=f>i?f:i);a()};this.add3Points= +function(h,i,o,p,l,t){j?(j=!1,b=ho?h>l?h:l:o>l?o:l,f=i>p?i>t?i:t:p>t?p:t):(b=ho?h>l?h>e?h:e:l>e?l:e:o>l?o>e?o:e:l>e?l:e,f=i>p?i>t?i>f?i:f:t>f?t:f:p>t?p>f?p:f:t>f?t:f);a()};this.addRectangle=function(h){j?(j=!1,b=h.getLeft(),c=h.getTop(),e=h.getRight(),f=h.getBottom()):(b=bh.getRight()?e:h.getRight(),f=f> h.getBottom()?f:h.getBottom());a()};this.inflate=function(h){b-=h;c-=h;e+=h;f+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){j=!0;f=e=c=b=0;a()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]}; THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}}; -THREE.Matrix4=function(a,b,c,e,f,h,i,j,n,k,l,p,m,s,B,A){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,h!==void 0?h:1,i||0,j||0,n||0,k||0,l!==void 0?l:1,p||0,m||0,s||0,B||0,A!==void 0?A:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,i,j,n,k,l,p,m,s,B,A){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=h;this.n23=i;this.n24=j;this.n31=n;this.n32=k;this.n33=l;this.n34=p;this.n41=m;this.n42=s;this.n43=B;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a, +THREE.Matrix4=function(a,b,c,e,f,h,i,j,m,k,o,p,l,t,A,C){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,h!==void 0?h:1,i||0,j||0,m||0,k||0,o!==void 0?o:1,p||0,l||0,t||0,A||0,C!==void 0?C:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,i,j,m,k,o,p,l,t,A,C){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=h;this.n23=i;this.n24=j;this.n31=m;this.n32=k;this.n33=o;this.n34=p;this.n41=l;this.n42=t;this.n43=A;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a, b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(c,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f; a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+ -c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,n=a.n23,k=a.n24,l=a.n31,p=a.n32,m=a.n33,s=a.n34,B=a.n41,A=a.n42,H=a.n43,C=a.n44,Q=b.n11,wa=b.n12, -ja=b.n13,qa=b.n14,ha=b.n21,L=b.n22,z=b.n23,R=b.n24,M=b.n31,T=b.n32,ka=b.n33,Z=b.n34,Aa=b.n41,$=b.n42,F=b.n43,d=b.n44;this.n11=c*Q+e*ha+f*M+h*Aa;this.n12=c*wa+e*L+f*T+h*$;this.n13=c*ja+e*z+f*ka+h*F;this.n14=c*qa+e*R+f*Z+h*d;this.n21=i*Q+j*ha+n*M+k*Aa;this.n22=i*wa+j*L+n*T+k*$;this.n23=i*ja+j*z+n*ka+k*F;this.n24=i*qa+j*R+n*Z+k*d;this.n31=l*Q+p*ha+m*M+s*Aa;this.n32=l*wa+p*L+m*T+s*$;this.n33=l*ja+p*z+m*ka+s*F;this.n34=l*qa+p*R+m*Z+s*d;this.n41=B*Q+A*ha+H*M+C*Aa;this.n42=B*wa+A*L+H*T+C*$;this.n43=B*ja+ -A*z+H*ka+C*F;this.n44=B*qa+A*R+H*Z+C*d;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*= -a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,j=this.n24,n=this.n31,k=this.n32,l=this.n33,p=this.n34,m=this.n41,s=this.n42,B=this.n43,A=this.n44;return e*i*k*m-c*j*k*m-e*h*l*m+b*j*l*m+c*h*p*m-b*i*p*m-e*i*n*s+c*j*n*s+e*f*l*s-a*j*l*s-c*f*p*s+a*i*p*s+e*h*n*B-b*j*n*B-e*f*k*B+a*j*k*B+b*f*p*B-a*h*p*B-c*h*n*A+b*i* -n*A+c*f*k*A-a*i*k*A-b*f*l*A+a*h*l*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32; +c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,m=a.n23,k=a.n24,o=a.n31,p=a.n32,l=a.n33,t=a.n34,A=a.n41,C=a.n42,E=a.n43,B=a.n44,va=b.n11,wa= +b.n12,pa=b.n13,qa=b.n14,N=b.n21,F=b.n22,z=b.n23,W=b.n24,U=b.n31,ja=b.n32,$=b.n33,xa=b.n34,Q=b.n41,G=b.n42,d=b.n43,ta=b.n44;this.n11=c*va+e*N+f*U+h*Q;this.n12=c*wa+e*F+f*ja+h*G;this.n13=c*pa+e*z+f*$+h*d;this.n14=c*qa+e*W+f*xa+h*ta;this.n21=i*va+j*N+m*U+k*Q;this.n22=i*wa+j*F+m*ja+k*G;this.n23=i*pa+j*z+m*$+k*d;this.n24=i*qa+j*W+m*xa+k*ta;this.n31=o*va+p*N+l*U+t*Q;this.n32=o*wa+p*F+l*ja+t*G;this.n33=o*pa+p*z+l*$+t*d;this.n34=o*qa+p*W+l*xa+t*ta;this.n41=A*va+C*N+E*U+B*Q;this.n42=A*wa+C*F+E*ja+B*G;this.n43= +A*pa+C*z+E*$+B*d;this.n44=A*qa+C*W+E*xa+B*ta;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*= +a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,j=this.n24,m=this.n31,k=this.n32,o=this.n33,p=this.n34,l=this.n41,t=this.n42,A=this.n43,C=this.n44;return e*i*k*l-c*j*k*l-e*h*o*l+b*j*o*l+c*h*p*l-b*i*p*l-e*i*m*t+c*j*m*t+e*f*o*t-a*j*o*t-c*f*p*t+a*i*p*t+e*h*m*A-b*j*m*A-e*f*k*A+a*j*k*A+b*f*p*A-a*h*p*A-c*h*m*C+b*i* +m*C+c*f*k*C-a*i*k*C-b*f*o*C+a*h*o*C},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32; a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},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(a){a[0]= this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]= this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0, -0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,h=a.x,i=a.y,j=a.z,n=f*h,k=f*i;this.set(n*h+c,n*i-e*j,n*j+e*i,0,n*i+e*j,k*i+c,k*j-e*h,0,n*j-e*i,k*j+e*h,f*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= -new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,h=Math.cos(c),c=Math.sin(c),i=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var n= -i*j,k=i*f,l=e*j,p=e*f;this.n11=n+p*c;this.n12=l*c-k;this.n13=h*e;this.n21=h*f;this.n22=h*j;this.n23=-c;this.n31=k*c-l;this.n32=p+n*c;this.n33=h*i;break;case "ZXY":n=i*j;k=i*f;l=e*j;p=e*f;this.n11=n-p*c;this.n12=-h*f;this.n13=l+k*c;this.n21=k+l*c;this.n22=h*j;this.n23=p-n*c;this.n31=-h*e;this.n32=c;this.n33=h*i;break;case "ZYX":n=h*j;k=h*f;l=c*j;p=c*f;this.n11=i*j;this.n12=l*e-k;this.n13=n*e+p;this.n21=i*f;this.n22=p*e+n;this.n23=k*e-l;this.n31=-e;this.n32=c*i;this.n33=h*i;break;case "YZX":n=h*i;k= -h*e;l=c*i;p=c*e;this.n11=i*j;this.n12=p-n*f;this.n13=l*f+k;this.n21=f;this.n22=h*j;this.n23=-c*j;this.n31=-e*j;this.n32=k*f+l;this.n33=n-p*f;break;case "XZY":n=h*i;k=h*e;l=c*i;p=c*e;this.n11=i*j;this.n12=-f;this.n13=e*j;this.n21=n*f+p;this.n22=h*j;this.n23=k*f-l;this.n31=l*f-k;this.n32=c*j;this.n33=p*f+n;break;default:n=h*j,k=h*f,l=c*j,p=c*f,this.n11=i*j,this.n12=-i*f,this.n13=e,this.n21=k+l*e,this.n22=n-p*e,this.n23=-c*i,this.n31=p-n*e,this.n32=l+k*e,this.n33=h*i}return this},setRotationFromQuaternion:function(a){var b= -a.x,c=a.y,e=a.z,f=a.w,h=b+b,i=c+c,j=e+e,a=b*h,n=b*i;b*=j;var k=c*i;c*=j;e*=j;h*=f;i*=f;f*=j;this.n11=1-(k+e);this.n12=n-f;this.n13=b+i;this.n21=n+f;this.n22=1-(a+e);this.n23=c-h;this.n31=b-i;this.n32=c+h;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2; +0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,h=a.x,i=a.y,j=a.z,m=f*h,k=f*i;this.set(m*h+c,m*i-e*j,m*j+e*i,0,m*i+e*j,k*i+c,k*j-e*h,0,m*j-e*i,k*j+e*h,f*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= +new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,h=Math.cos(c),c=Math.sin(c),i=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var m= +i*j,k=i*f,o=e*j,p=e*f;this.n11=m+p*c;this.n12=o*c-k;this.n13=h*e;this.n21=h*f;this.n22=h*j;this.n23=-c;this.n31=k*c-o;this.n32=p+m*c;this.n33=h*i;break;case "ZXY":m=i*j;k=i*f;o=e*j;p=e*f;this.n11=m-p*c;this.n12=-h*f;this.n13=o+k*c;this.n21=k+o*c;this.n22=h*j;this.n23=p-m*c;this.n31=-h*e;this.n32=c;this.n33=h*i;break;case "ZYX":m=h*j;k=h*f;o=c*j;p=c*f;this.n11=i*j;this.n12=o*e-k;this.n13=m*e+p;this.n21=i*f;this.n22=p*e+m;this.n23=k*e-o;this.n31=-e;this.n32=c*i;this.n33=h*i;break;case "YZX":m=h*i;k= +h*e;o=c*i;p=c*e;this.n11=i*j;this.n12=p-m*f;this.n13=o*f+k;this.n21=f;this.n22=h*j;this.n23=-c*j;this.n31=-e*j;this.n32=k*f+o;this.n33=m-p*f;break;case "XZY":m=h*i;k=h*e;o=c*i;p=c*e;this.n11=i*j;this.n12=-f;this.n13=e*j;this.n21=m*f+p;this.n22=h*j;this.n23=k*f-o;this.n31=o*f-k;this.n32=c*j;this.n33=p*f+m;break;default:m=h*j,k=h*f,o=c*j,p=c*f,this.n11=i*j,this.n12=-i*f,this.n13=e,this.n21=k+o*e,this.n22=m-p*e,this.n23=-c*i,this.n31=p-m*e,this.n32=o+k*e,this.n33=h*i}return this},setRotationFromQuaternion:function(a){var b= +a.x,c=a.y,e=a.z,f=a.w,h=b+b,i=c+c,j=e+e,a=b*h,m=b*i;b*=j;var k=c*i;c*=j;e*=j;h*=f;i*=f;f*=j;this.n11=1-(k+e);this.n12=m-f;this.n13=b+i;this.n21=m+f;this.n22=1-(a+e);this.n23=c-h;this.n31=b-i;this.n32=c+h;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2; e.identity();e.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(e,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length(); c.y=f.length();c.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=c.x;e.n21/=c.x;e.n31/=c.x;e.n12/=c.y;e.n22/=c.y;e.n32/=c.y;e.n13/=c.z;e.n23/=c.z;e.n33/=c.z;b.setFromRotationMatrix(e);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23= a.n23*f;this.n33=a.n33*f}}; -THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,n=a.n23,k=a.n24,l=a.n31,p=a.n32,m=a.n33,s=a.n34,B=a.n41,A=a.n42,H=a.n43,C=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=n*s*A-k*m*A+k*p*H-j*s*H-n*p*C+j*m*C;b.n12=h*m*A-f*s*A-h*p*H+e*s*H+f*p*C-e*m*C;b.n13=f*k*A-h*n*A+h*j*H-e*k*H-f*j*C+e*n*C;b.n14=h*n*p-f*k*p-h*j*m+e*k*m+f*j*s-e*n*s;b.n21=k*m*B-n*s*B-k*l*H+i*s*H+n*l*C-i*m*C;b.n22=f*s*B-h*m*B+h*l*H-c*s*H-f*l*C+c*m*C;b.n23=h*n*B-f*k*B-h*i*H+c*k*H+f*i*C-c*n*C;b.n24= -f*k*l-h*n*l+h*i*m-c*k*m-f*i*s+c*n*s;b.n31=j*s*B-k*p*B+k*l*A-i*s*A-j*l*C+i*p*C;b.n32=h*p*B-e*s*B-h*l*A+c*s*A+e*l*C-c*p*C;b.n33=f*k*B-h*j*B+h*i*A-c*k*A-e*i*C+c*j*C;b.n34=h*j*l-e*k*l-h*i*p+c*k*p+e*i*s-c*j*s;b.n41=n*p*B-j*m*B-n*l*A+i*m*A+j*l*H-i*p*H;b.n42=e*m*B-f*p*B+f*l*A-c*m*A-e*l*H+c*p*H;b.n43=f*j*B-e*n*B-f*i*A+c*n*A+e*i*H-c*j*H;b.n44=e*n*l-f*j*l+f*i*p-c*n*p-e*i*m+c*j*m;b.multiplyScalar(1/a.determinant());return b}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*k;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*i;c[4]=a*j;c[5]=a*n;c[6]=a*k;c[7]=a*l;c[8]=a*p;return b}; +THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,m=a.n23,k=a.n24,o=a.n31,p=a.n32,l=a.n33,t=a.n34,A=a.n41,C=a.n42,E=a.n43,B=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=m*t*C-k*l*C+k*p*E-j*t*E-m*p*B+j*l*B;b.n12=h*l*C-f*t*C-h*p*E+e*t*E+f*p*B-e*l*B;b.n13=f*k*C-h*m*C+h*j*E-e*k*E-f*j*B+e*m*B;b.n14=h*m*p-f*k*p-h*j*l+e*k*l+f*j*t-e*m*t;b.n21=k*l*A-m*t*A-k*o*E+i*t*E+m*o*B-i*l*B;b.n22=f*t*A-h*l*A+h*o*E-c*t*E-f*o*B+c*l*B;b.n23=h*m*A-f*k*A-h*i*E+c*k*E+f*i*B-c*m*B;b.n24= +f*k*o-h*m*o+h*i*l-c*k*l-f*i*t+c*m*t;b.n31=j*t*A-k*p*A+k*o*C-i*t*C-j*o*B+i*p*B;b.n32=h*p*A-e*t*A-h*o*C+c*t*C+e*o*B-c*p*B;b.n33=f*k*A-h*j*A+h*i*C-c*k*C-e*i*B+c*j*B;b.n34=h*j*o-e*k*o-h*i*p+c*k*p+e*i*t-c*j*t;b.n41=m*p*A-j*l*A-m*o*C+i*l*C+j*o*E-i*p*E;b.n42=e*l*A-f*p*A+f*o*C-c*l*C-e*o*E+c*p*E;b.n43=f*j*A-e*m*A-f*i*C+c*m*C+e*i*E-c*j*E;b.n44=e*m*o-f*j*o+f*i*p-c*m*p-e*i*l+c*j*l;b.multiplyScalar(1/a.determinant());return b}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*k;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*i;c[4]=a*j;c[5]=a*m;c[6]=a*k;c[7]=a*o;c[8]=a*p;return b}; THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*f/(e-c);i.n23=(e+c)/(e-c);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)}; -THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var i,j,n,k;i=new THREE.Matrix4;j=b-a;n=c-e;k=h-f;i.n11=2/j;i.n12=0;i.n13=0;i.n14=-((b+a)/j);i.n21=0;i.n22=2/n;i.n23=0;i.n24=-((c+e)/n);i.n31=0;i.n32=0;i.n33=-2/k;i.n34=-((h+f)/k);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; +THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var i,j,m,k;i=new THREE.Matrix4;j=b-a;m=c-e;k=h-f;i.n11=2/j;i.n12=0;i.n13=0;i.n14=-((b+a)/j);i.n21=0;i.n22=2/m;i.n23=0;i.n24=-((c+e)/m);i.n31=0;i.n32=0;i.n33=-2/k;i.n34=-((h+f)/k);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3}; THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)=== @@ -54,41 +54,40 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},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(a,b,c){this.matrixAutoUpdate&& this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,e=this.children.length;a=0&&h>=0&&f>=0&&i>=0?!0:d<0&&h<0||f<0&&i<0?!1:(d<0?c=Math.max(c,d/(d-h)):h<0&&(e=Math.min(e,d/(d-h))),f<0?c=Math.max(c,f/(f-i)):i<0&&(e=Math.min(e,f/(f-i))),eF&&i.positionScreen.z0&&L.z<1))xa=wa[Q]=wa[Q]||new THREE.RenderableParticle,Q++,C=xa,C.x=L.x/L.w,C.y=L.y/L.w,C.z=L.z,C.rotation=S.rotation.z,C.scale.x=S.scale.x*Math.abs(C.x-(L.x+h.projectionMatrix.n11)/(L.w+h.projectionMatrix.n14)),C.scale.y=S.scale.y*Math.abs(C.y-(L.y+h.projectionMatrix.n22)/(L.w+h.projectionMatrix.n24)),C.materials=S.materials,qa.push(C);f&&qa.sort(b);return qa}}; -THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)}; +THREE.Projector=function(){function a(){var a=m[j]=m[j]||new THREE.RenderableVertex;j++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,h=b.z+b.w,f=-a.z+a.w,i=-b.z+b.w;return e>=0&&h>=0&&f>=0&&i>=0?!0:e<0&&h<0||f<0&&i<0?!1:(e<0?c=Math.max(c,e/(e-h)):h<0&&(d=Math.min(d,e/(e-h))),f<0?c=Math.max(c,f/(f-i)):i<0&&(d=Math.min(d,f/(f-i))),dd&&i.positionScreen.z0&&F.z<1))za=wa[va]=wa[va]||new THREE.RenderableParticle,va++,B=za,B.x=F.x/F.w,B.y=F.y/F.w,B.z=F.z,B.rotation=O.rotation.z,B.scale.x=O.scale.x*Math.abs(B.x-(F.x+h.projectionMatrix.n11)/(F.w+h.projectionMatrix.n14)),B.scale.y=O.scale.y*Math.abs(B.y-(F.y+h.projectionMatrix.n22)/(F.w+h.projectionMatrix.n24)),B.materials=O.materials,qa.push(B);f&&qa.sort(b);return qa}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),i=a*b,j=e*f;this.w=i*h-j*c;this.x=i*c+j*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c); this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b= -this.x,c=this.y,e=this.z,f=this.w,h=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+f*h+c*j-e*i;this.y=c*a+f*i+e*h-b*j;this.z=e*a+f*j+b*i-c*h;this.w=f*a-b*h-c*i-e*j;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,i=this.y,j=this.z,n=this.w,k=n*c+i*f-j*e,l=n*e+j*c-h*f,p=n*f+h*e-i*c,c=-h* -c-i*e-j*f;b.x=k*n+c*-h+l*-j-p*-i;b.y=l*n+c*-i+p*-h-k*-j;b.z=p*n+c*-j+k*-i-l*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-e)*h)/i;e=Math.sin(e*h)/i;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c}; +this.x,c=this.y,e=this.z,f=this.w,h=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+f*h+c*j-e*i;this.y=c*a+f*i+e*h-b*j;this.z=e*a+f*j+b*i-c*h;this.w=f*a-b*h-c*i-e*j;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,i=this.y,j=this.z,m=this.w,k=m*c+i*f-j*e,o=m*e+j*c-h*f,p=m*f+h*e-i*c,c=-h* +c-i*e-j*f;b.x=k*m+c*-h+o*-j-p*-i;b.y=o*m+c*-i+p*-h-k*-j;b.z=p*m+c*-j+k*-i-o*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-e)*h)/i;e=Math.sin(e*h)/i;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c}; THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,e,f,h,i){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=i;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x], +c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,d,b,c,e,h,f){j=a.vertices[d].position;m=a.vertices[b].position;k=a.vertices[c].position;o=i[e];p=i[h];l=i[f];t=m.x-j.x;A=k.x-j.x;C=m.y-j.y;E=k.y-j.y;B=m.z-j.z;va=k.z-j.z;wa=p.u-o.u;pa=l.u-o.u;qa=p.v-o.v;N=l.v-o.v;F=1/(wa*N-pa*qa);ja.set((N*t-qa*A)*F,(N*C-qa*E)*F,(N*B-qa*va)*F);$.set((wa*A-pa*t)*F,(wa*E-pa*C)*F,(wa*va-pa*B)*F);W[d].addSelf(ja);W[b].addSelf(ja);W[c].addSelf(ja); +U[d].addSelf($);U[b].addSelf($);U[c].addSelf($)}var b,c,e,f,h,i,j,m,k,o,p,l,t,A,C,E,B,va,wa,pa,qa,N,F,z,W=[],U=[],ja=new THREE.Vector3,$=new THREE.Vector3,xa=new THREE.Vector3,Q=new THREE.Vector3,G=new THREE.Vector3;b=0;for(c=this.vertices.length;b0){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 b=1,c=this.vertices.length;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z< this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;bthis.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;k=this.points[c[0]];l=this.points[c[1]]; -p=this.points[c[2]];m=this.points[c[3]];j=i*i;n=i*j;e.x=b(k.x,l.x,p.x,m.x,i,j,n);e.y=b(k.y,l.y,p.y,m.y,i,j,n);e.z=b(k.z,l.z,p.z,m.z,i,j,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;athis.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;k=this.points[c[0]];o=this.points[c[1]]; +p=this.points[c[2]];l=this.points[c[3]];j=i*i;m=i*j;e.x=b(k.x,o.x,p.x,l.x,i,j,m);e.y=b(k.y,o.y,p.y,l.y,i,j,m);e.z=b(k.z,o.z,p.z,l.z,i,j,m);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a=0&&(b=a.geometry.materials[d.materialIndex]);return b}function c(a,b,c){var e,h,f,i=a.vertices,r=i.length,J=a.colors,j=J.length,t=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,v=a.__dirtyVertices,l=a.__dirtyColors,p=a.__webglCustomAttributesList,m;if(p){f=0;for(e=p.length;f=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=h.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer), -d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length){j=0;var k=i.morphTargetForcedOrder;for(r=i.morphTargetInfluences;jn&&(t=m,n=r[t]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[t]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=n;k[t]=1;n=-1;j++}}h.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(r=f.__webglCustomAttributesList.length;j= +THREE.WebGLRenderer=function(a){function b(a,d){var b;a.material&&!(a.material instanceof THREE.MeshFaceMaterial)?b=a.material:d.materialIndex>=0&&(b=a.geometry.materials[d.materialIndex]);return b}function c(a,b,c){var e,h,f,i=a.vertices,u=i.length,v=a.colors,q=v.length,j=a.__vertexArray,k=a.__colorArray,m=a.__sortArray,P=a.__dirtyVertices,o=a.__dirtyColors,p=a.__webglCustomAttributesList,l;if(p){f=0;for(e=p.length;f=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=h.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer), +d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length){j=0;var v=i.morphTargetForcedOrder;for(u=i.morphTargetInfluences;jq&&(k=m,q=u[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=q;v[k]=1;q=-1;j++}}h.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(u=f.__webglCustomAttributesList.length;j= 0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}a.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(a.color,3,d.FLOAT,!1,0,0));a.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(a.normal,3,d.FLOAT,!1,0,0));a.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(a.tangent,4,d.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER, f.__webglUVBuffer),d.vertexAttribPointer(a.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv)):d.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer),d.vertexAttribPointer(a.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv2)):d.disableVertexAttribArray(a.uv2));h.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(a.skinVertexA,4, d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(a.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(a.skinIndex,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(a.skinWeight,4,d.FLOAT,!1,0,0))}i instanceof THREE.Mesh?(h.wireframe?(d.lineWidth(h.wireframeLinewidth),b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount, -d.UNSIGNED_SHORT,0)):(b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),F.info.render.calls++,F.info.render.vertices+=f.__webglFaceCount,F.info.render.faces+=f.__webglFaceCount/3):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?d.LINE_STRIP:d.LINES,d.lineWidth(h.linewidth),d.drawArrays(i,0,f.__webglLineCount),F.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),F.info.render.calls++): -i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),F.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER, -a.__webglNormalBuffer);if(c==THREE.FlatShading){var e,f,h,i,j,k,n,t,m,l,p=a.count*3;for(l=0;l=0&&(b=b.geometry.materials[materialIndex], -b.transparent?m(a,b):m(e,b))):(b=d)&&(b.transparent?m(a,b):m(e,b))}function A(a,b){return b.z-a.z}function H(a){var b,c,k,G=0,n,m,r,J,W=a.lights;sa||(sa=new THREE.PerspectiveCamera(F.shadowCameraFov,F.shadowMapWidth/F.shadowMapHeight,F.shadowCameraNear,F.shadowCameraFar));b=0;for(c=W.length;b=0;d--)a[d].object==b&&a.splice(d,1)}function ha(a,b,d){a.push({buffer:b,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(a){if(a!=ia){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR); -break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}ia=a}}function z(a,b,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(d.texParameteri(a,d.TEXTURE_WRAP_S,$(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,$(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,$(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,$(b.minFilter)), -d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,Aa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,Aa(b.minFilter)))}function R(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),F.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0, -$(a.format),a.image.width,a.image.height,0,$(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);z(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function M(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER, -a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function T(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();if(b){a.__webglFramebuffer=[]; -a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);z(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,$(a.format),a.width,a.height,0,$(a.format),$(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0); -M(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),z(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,$(a.format),a.width,a.height,0,$(a.format),$(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),M(a.__webglRenderbuffer, -a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=ua,a=Ia,e=ya,f=Ba);b!=aa&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),aa=b)}function ka(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP, -null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function Z(a,b){var c;a=="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a=="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function Aa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST; -default:return d.LINEAR}}function $(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR; +d.UNSIGNED_SHORT,0)):(b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),G.info.render.calls++,G.info.render.vertices+=f.__webglFaceCount,G.info.render.faces+=f.__webglFaceCount/3):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?d.LINE_STRIP:d.LINES,d.lineWidth(h.linewidth),d.drawArrays(i,0,f.__webglLineCount),G.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),G.info.render.calls++): +i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),G.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER, +a.__webglNormalBuffer);if(c==THREE.FlatShading){var e,f,h,i,j,v,k,m,p,o,l=a.count*3;for(o=0;o=0)b=b.geometry.materials[d],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=c)b.transparent?(a.transparent= +b,a.opaque=null):(a.opaque=b,a.transparent=null)}function A(a,b){return b.z-a.z}function C(a){var b,c,k,m=0,K,l,u,v,q=a.lights;ra||(ra=new THREE.PerspectiveCamera(G.shadowCameraFov,G.shadowMapWidth/G.shadowMapHeight,G.shadowCameraNear,G.shadowCameraFar));b=0;for(c=q.length;b=0;d--)a[d].object==b&&a.splice(d,1)}function qa(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function N(a){if(a!=ka){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break; +case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}ka=a}}function F(a,b,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(d.texParameteri(a,d.TEXTURE_WRAP_S,Q(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,Q(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,Q(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,Q(b.minFilter)), +d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,xa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,xa(b.minFilter)))}function z(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),G.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0, +Q(a.format),a.image.width,a.image.height,0,Q(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);F(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function W(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER, +a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function U(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();if(b){a.__webglFramebuffer=[]; +a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);F(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Q(a.format),a.width,a.height,0,Q(a.format),Q(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0); +W(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),F(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,Q(a.format),a.width,a.height,0,Q(a.format),Q(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),W(a.__webglRenderbuffer, +a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Ca,a=ya,e=Ha,f=Aa);b!=ua&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),ua=b)}function ja(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP, +null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function $(a,b){var c;a=="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a=="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function xa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST; +default:return d.LINEAR}}function Q(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR; case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0} -var F=this,d,Fa=[],Va=null,aa=null,ma=-1,E=null,ra=0,N=null,V=null,ia=null,S=null,xa=null,Ka=null,Pa=null,Qa=null,ya=0,Ba=0,ua=0,Ia=0,X=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Sa=new Float32Array(16),Ta=new Float32Array(16),Ha=new THREE.Vector4,Xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Da=a.canvas!==void 0?a.canvas:document.createElement("canvas"), -K=a.stencil!==void 0?a.stencil:!0,bb=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,cb=a.antialias!==void 0?a.antialias:!1,va=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),za=a.clearAlpha!==void 0?a.clearAlpha:0,Wa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Da;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor= -this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;var sa,Ra=[],a=THREE.ShaderLib.depthRGBA,$a=THREE.UniformsUtils.clone(a.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader, -uniforms:$a}),Ya=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:$a,morphTargets:!0});Ua._shadowPass=!0;Ya._shadowPass=!0;try{if(!(d=Da.getContext("experimental-webgl",{antialias:cb,stencil:K,preserveDrawingBuffer:bb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+d.getParameter(d.VERSION)+" | "+d.getParameter(d.VENDOR)+" | "+d.getParameter(d.RENDERER)+" | "+d.getParameter(d.SHADING_LANGUAGE_VERSION))}catch(db){console.error(db)}d.clearColor(0, -0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(va.r,va.g,va.b,za);this.context=d;var ab=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,u={};u.vertices=new Float32Array(16);u.faces=new Uint16Array(6);K=0;u.vertices[K++]=-1;u.vertices[K++]=-1;u.vertices[K++]=0;u.vertices[K++]=1;u.vertices[K++]= -1;u.vertices[K++]=-1;u.vertices[K++]=1;u.vertices[K++]=1;u.vertices[K++]=1;u.vertices[K++]=1;u.vertices[K++]=1;u.vertices[K++]=0;u.vertices[K++]=-1;u.vertices[K++]=1;u.vertices[K++]=0;K=u.vertices[K++]=0;u.faces[K++]=0;u.faces[K++]=1;u.faces[K++]=2;u.faces[K++]=0;u.faces[K++]=2;u.faces[K++]=3;u.vertexBuffer=d.createBuffer();u.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,u.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,u.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,u.elementBuffer); -d.bufferData(d.ELEMENT_ARRAY_BUFFER,u.faces,d.STATIC_DRAW);u.program=d.createProgram();d.attachShader(u.program,Z("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(u.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.position=d.getAttribLocation(u.program,"position");u.attributes.uv=d.getAttribLocation(u.program,"uv");u.uniforms.uvOffset=d.getUniformLocation(u.program,"uvOffset");u.uniforms.uvScale=d.getUniformLocation(u.program, -"uvScale");u.uniforms.rotation=d.getUniformLocation(u.program,"rotation");u.uniforms.scale=d.getUniformLocation(u.program,"scale");u.uniforms.alignment=d.getUniformLocation(u.program,"alignment");u.uniforms.color=d.getUniformLocation(u.program,"color");u.uniforms.map=d.getUniformLocation(u.program,"map");u.uniforms.opacity=d.getUniformLocation(u.program,"opacity");u.uniforms.useScreenCoordinates=d.getUniformLocation(u.program,"useScreenCoordinates");u.uniforms.affectedByDistance=d.getUniformLocation(u.program, -"affectedByDistance");u.uniforms.screenPosition=d.getUniformLocation(u.program,"screenPosition");u.uniforms.modelViewMatrix=d.getUniformLocation(u.program,"modelViewMatrix");u.uniforms.projectionMatrix=d.getUniformLocation(u.program,"projectionMatrix");var Za=!1;this.setSize=function(a,b){Da.width=a;Da.height=b;this.setViewport(0,0,Da.width,Da.height)};this.setViewport=function(a,b,c,e){ya=a;Ba=b;ua=c;Ia=e;d.viewport(ya,Ba,ua,Ia)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest= -function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){va.setHex(a);za=b;d.clearColor(va.r,va.g,va.b,za)};this.setClearColor=function(a,b){va.copy(a);za=b;d.clearColor(va.r,va.g,va.b,za)};this.getClearColor=function(){return va};this.getClearAlpha=function(){return za};this.clear=function(a,b,c){var e=0;if(a==void 0||a)e|=d.COLOR_BUFFER_BIT;if(b==void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c==void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.getContext=function(){return d}; +var G=this,d,ta=[],Wa=null,ua=null,J=-1,R=null,S=0,T=null,X=null,ka=null,aa=null,O=null,za=null,La=null,Ra=null,Ha=0,Aa=0,Ca=0,ya=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,Ta=new Float32Array(16),Ua=new Float32Array(16),Ja=new THREE.Vector4,Ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Ba=a.canvas!==void 0?a.canvas:document.createElement("canvas"), +I=a.stencil!==void 0?a.stencil:!0,cb=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,db=a.antialias!==void 0?a.antialias:!1,Y=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Fa=a.clearAlpha!==void 0?a.clearAlpha:0,Xa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ba;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear= +!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;var ra,Sa=[],a=THREE.ShaderLib.depthRGBA,ab=THREE.UniformsUtils.clone(a.uniforms),Va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ab}), +Za=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ab,morphTargets:!0});Va._shadowPass=!0;Za._shadowPass=!0;try{if(!(d=Ba.getContext("experimental-webgl",{antialias:db,stencil:I,preserveDrawingBuffer:cb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+d.getParameter(d.VERSION)+" | "+d.getParameter(d.VENDOR)+" | "+d.getParameter(d.RENDERER)+" | "+d.getParameter(d.SHADING_LANGUAGE_VERSION))}catch(eb){console.error(eb)}d.clearColor(0, +0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(Y.r,Y.g,Y.b,Fa);this.context=d;var bb=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);I=0;r.vertices[I++]=-1;r.vertices[I++]=-1;r.vertices[I++]=0;r.vertices[I++]=1;r.vertices[I++]=1; +r.vertices[I++]=-1;r.vertices[I++]=1;r.vertices[I++]=1;r.vertices[I++]=1;r.vertices[I++]=1;r.vertices[I++]=1;r.vertices[I++]=0;r.vertices[I++]=-1;r.vertices[I++]=1;r.vertices[I++]=0;I=r.vertices[I++]=0;r.faces[I++]=0;r.faces[I++]=1;r.faces[I++]=2;r.faces[I++]=0;r.faces[I++]=2;r.faces[I++]=3;r.vertexBuffer=d.createBuffer();r.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,r.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,r.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,r.elementBuffer); +d.bufferData(d.ELEMENT_ARRAY_BUFFER,r.faces,d.STATIC_DRAW);r.program=d.createProgram();d.attachShader(r.program,$("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(r.program,$("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.position=d.getAttribLocation(r.program,"position");r.attributes.uv=d.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=d.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=d.getUniformLocation(r.program, +"uvScale");r.uniforms.rotation=d.getUniformLocation(r.program,"rotation");r.uniforms.scale=d.getUniformLocation(r.program,"scale");r.uniforms.alignment=d.getUniformLocation(r.program,"alignment");r.uniforms.color=d.getUniformLocation(r.program,"color");r.uniforms.map=d.getUniformLocation(r.program,"map");r.uniforms.opacity=d.getUniformLocation(r.program,"opacity");r.uniforms.useScreenCoordinates=d.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=d.getUniformLocation(r.program, +"affectedByDistance");r.uniforms.screenPosition=d.getUniformLocation(r.program,"screenPosition");r.uniforms.modelViewMatrix=d.getUniformLocation(r.program,"modelViewMatrix");r.uniforms.projectionMatrix=d.getUniformLocation(r.program,"projectionMatrix");var $a=!1;this.setSize=function(a,b){Ba.width=a;Ba.height=b;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(a,b,c,e){Ha=a;Aa=b;Ca=c;ya=e;d.viewport(Ha,Aa,Ca,ya)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest= +function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Y.setHex(a);Fa=b;d.clearColor(Y.r,Y.g,Y.b,Fa)};this.setClearColor=function(a,b){Y.copy(a);Fa=b;d.clearColor(Y.r,Y.g,Y.b,Fa)};this.getClearColor=function(){return Y};this.getClearAlpha=function(){return Fa};this.clear=function(a,b,c){var e=0;if(a==void 0||a)e|=d.COLOR_BUFFER_BIT;if(b==void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c==void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.getContext=function(){return d}; this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];d.deleteBuffer(b.__webglVertexBuffer);d.deleteBuffer(b.__webglNormalBuffer);d.deleteBuffer(b.__webglTangentBuffer);d.deleteBuffer(b.__webglColorBuffer);d.deleteBuffer(b.__webglUVBuffer);d.deleteBuffer(b.__webglUV2Buffer);d.deleteBuffer(b.__webglSkinVertexABuffer); -d.deleteBuffer(b.__webglSkinVertexBBuffer);d.deleteBuffer(b.__webglSkinIndicesBuffer);d.deleteBuffer(b.__webglSkinWeightsBuffer);d.deleteBuffer(b.__webglFaceBuffer);d.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c=0&&d.enableVertexAttribArray(v.position);v.color>=0&&d.enableVertexAttribArray(v.color);v.normal>=0&&d.enableVertexAttribArray(v.normal); -v.tangent>=0&&d.enableVertexAttribArray(v.tangent);a.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(d.enableVertexAttribArray(v.skinVertexA),d.enableVertexAttribArray(v.skinVertexB),d.enableVertexAttribArray(v.skinIndex),d.enableVertexAttribArray(v.skinWeight));if(a.attributes)for(h in a.attributes)v[h]!==void 0&&v[h]>=0&&d.enableVertexAttribArray(v[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h=0&&(d.enableVertexAttribArray(v[u]), -a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){T(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){H(a,b)};this.render=function(a,b,c,m){var G,Ga,u,r,J,W,t,z,Oa=a.lights,v=a.fog;ma=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&H(a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;if(b.matrixAutoUpdate){for(J=b;J.parent;)J=J.parent;J.update(void 0,!0)}a.update(void 0,!1, -b);b.matrixWorldInverse.flattenToArray(Ta);b.projectionMatrix.flattenToArray(Sa);Ca.multiply(b.projectionMatrix,b.matrixWorldInverse);l(Ca);this.initWebGLObjects(a);T(c);(this.autoClear||m)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);J=a.__webglObjects.length;for(m=0;m=0;m--)if(G=a.__webglObjects[m],G.render){t=G.object;z=G.buffer;u=G.opaque;i(t);for(G=0;G65535&&(s[t].counter+=1,p=s[t].hash+"_"+s[t].counter,j.geometryGroups[p]==void 0&&(j.geometryGroups[p]={faces:[],materialIndex:l,vertices:0,numMorphTargets:v})),j.geometryGroups[p].faces.push(k),j.geometryGroups[p].vertices+=n;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=ra++,j.geometryGroupsList.push(j.geometryGroups[k])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){k=j;k.__webglVertexBuffer=d.createBuffer();k.__webglNormalBuffer= -d.createBuffer();k.__webglTangentBuffer=d.createBuffer();k.__webglColorBuffer=d.createBuffer();k.__webglUVBuffer=d.createBuffer();k.__webglUV2Buffer=d.createBuffer();k.__webglSkinVertexABuffer=d.createBuffer();k.__webglSkinVertexBBuffer=d.createBuffer();k.__webglSkinIndicesBuffer=d.createBuffer();k.__webglSkinWeightsBuffer=d.createBuffer();k.__webglFaceBuffer=d.createBuffer();k.__webglLineBuffer=d.createBuffer();if(k.numMorphTargets){l=m=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(l=k.numMorphTargets;m< -l;m++)k.__webglMorphTargetsBuffers.push(d.createBuffer())}F.info.memory.geometries++;for(var l=e,u=n=s=void 0,t=u=v=u=void 0,p=t=k=0,z=n=void 0,B=void 0,n=m=v=s=void 0,v=l.geometry,z=v.faces,B=j.faces,s=0,n=B.length;s0||v.faceVertexUvs.length>0)j.__uvArray=new Float32Array(k*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(k*2)}if(l.geometry.skinWeights.length&&l.geometry.skinIndices.length)j.__skinVertexAArray= -new Float32Array(k*4),j.__skinVertexBArray=new Float32Array(k*4),j.__skinIndexArray=new Float32Array(k*4),j.__skinWeightArray=new Float32Array(k*4);j.__faceArray=new Uint16Array(t*3+(l.geometry.edgeFaces?l.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(p*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];v=0;for(u=j.numMorphTargets;v=0;i--)f[i]==h&&f.splice(i,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&qa(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e< -f;e++)if(i=a.__webglObjects[e].object,l=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(m=h.geometryGroupsList.length;k0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,pa,t));Aa&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER, -V,t));Ba&&ta.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,ca,t));ua&&$>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ka,t));ua&&aa>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ma,t));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ia,t),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,X,t)); -x>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,da,t),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,ea,t),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,fa,t),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,t));p&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array, -delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;ja(j,i)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=s=p=p=void 0;v=i.vertices;m=i.colors;n=v.length;l=m.length;z=i.__vertexArray; -t=i.__colorArray;B=i.__dirtyColors;if(i.__dirtyVertices){for(p=0;p=0&&d.enableVertexAttribArray(l.position);l.color>=0&&d.enableVertexAttribArray(l.color);l.normal>=0&&d.enableVertexAttribArray(l.normal); +l.tangent>=0&&d.enableVertexAttribArray(l.tangent);a.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0&&(d.enableVertexAttribArray(l.skinVertexA),d.enableVertexAttribArray(l.skinVertexB),d.enableVertexAttribArray(l.skinIndex),d.enableVertexAttribArray(l.skinWeight));if(a.attributes)for(h in a.attributes)l[h]!==void 0&&l[h]>=0&&d.enableVertexAttribArray(l[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h=0&&(d.enableVertexAttribArray(l[r]), +a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){U(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){C(a,b)};this.render=function(a,b,c,r){var Ia,K,Ea,u,v,q,z,Pa=a.lights,Qa=a.fog;J=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&C(a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;if(b.matrixAutoUpdate){for(Ea=b;Ea.parent;)Ea=Ea.parent;Ea.update(void 0,!0)}a.update(void 0, +!1,b);b.matrixWorldInverse.flattenToArray(Ua);b.projectionMatrix.flattenToArray(Ta);Da.multiply(b.projectionMatrix,b.matrixWorldInverse);o(Da);this.initWebGLObjects(a);U(c);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Ea=a.__webglObjects.length;for(r=0;r=0;r--)if(v=a.__webglObjects[r],v.render&&(q=v.object,z=v.buffer,K=v.opaque))i(q),j(K.depthTest),m(K.depthWrite),k(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),f(b,Pa,Qa, +K,z,q);for(r=0;r65535&&(r[l].counter+=1,p=r[l].hash+"_"+r[l].counter,j.geometryGroups[p]==void 0&&(j.geometryGroups[p]= +{faces:[],materialIndex:q,vertices:0,numMorphTargets:t})),j.geometryGroups[p].faces.push(k),j.geometryGroups[p].vertices+=o;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=S++,j.geometryGroupsList.push(j.geometryGroups[k])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){k=j;k.__webglVertexBuffer=d.createBuffer();k.__webglNormalBuffer=d.createBuffer();k.__webglTangentBuffer=d.createBuffer();k.__webglColorBuffer=d.createBuffer();k.__webglUVBuffer= +d.createBuffer();k.__webglUV2Buffer=d.createBuffer();k.__webglSkinVertexABuffer=d.createBuffer();k.__webglSkinVertexBBuffer=d.createBuffer();k.__webglSkinIndicesBuffer=d.createBuffer();k.__webglSkinWeightsBuffer=d.createBuffer();k.__webglFaceBuffer=d.createBuffer();k.__webglLineBuffer=d.createBuffer();if(k.numMorphTargets){q=m=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(q=k.numMorphTargets;m0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(k*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(k*2)}if(q.geometry.skinWeights.length&&q.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(k*4),j.__skinVertexBArray=new Float32Array(k*4), +j.__skinIndexArray=new Float32Array(k*4),j.__skinWeightArray=new Float32Array(k*4);j.__faceArray=new Uint16Array(l*3);j.__lineArray=new Uint16Array(p*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(z=j.numMorphTargets;t=0;i--)f[i]==h&&f.splice(i,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&pa(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,oa,l));za&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,W,l));Aa&&sa.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,ca,l));ta&&X>0&&(d.bindBuffer(d.ARRAY_BUFFER, +q.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ja,l));ta&&$>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ka,l));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ha,l),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,Y,l));x>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,da,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexBBuffer), +d.bufferData(d.ARRAY_BUFFER,ea,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,fa,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,l));p&&(delete q.__inittedArrays,delete q.__colorArray,delete q.__normalArray,delete q.__tangentArray,delete q.__uvArray,delete q.__uv2Array,delete q.__faceArray,delete q.__vertexArray,delete q.__lineArray,delete q.__skinVertexAArray,delete q.__skinVertexBArray,delete q.__skinIndexArray,delete q.__skinWeightArray)}h.__dirtyVertices= +!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;wa(j,i)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=r=p=p=void 0;t=i.vertices;m=i.colors;o=t.length;q=m.length;A=i.__vertexArray;l=i.__colorArray;C=i.__dirtyColors;if(i.__dirtyVertices){for(p=0;p= 0 ) { material = object.geometry.materials[ materialIndex ]; - material.transparent ? addToFixedArray( transparent, material ) : addToFixedArray( opaque, material ); + + if ( material.transparent ) { + + globject.transparent = material; + globject.opaque = null; + + } else { + + globject.opaque = material; + globject.transparent = null; + + } } } else { material = meshMaterial; - if ( material ) material.transparent ? addToFixedArray( transparent, material ) : addToFixedArray( opaque, material ); + + if ( material ) { + + if ( material.transparent ) { + + globject.transparent = material; + globject.opaque = null; + + } else { + + globject.opaque = material; + globject.transparent = null; + + } + + } } @@ -3754,7 +3779,7 @@ THREE.WebGLRenderer = function ( parameters ) { this.render = function( scene, camera, renderTarget, forceClear ) { - var i, program, opaque, transparent, material, + var i, program, material, o, ol, oil, webglObject, object, buffer, lights = scene.lights, fog = scene.fog; @@ -3946,20 +3971,16 @@ THREE.WebGLRenderer = function ( parameters ) { object = webglObject.object; buffer = webglObject.buffer; - opaque = webglObject.opaque; + material = webglObject.opaque; + + if ( ! material ) continue; setObjectFaces( object ); - for ( i = 0; i < opaque.count; i ++ ) { - - material = opaque.list[ i ]; - - setDepthTest( material.depthTest ); - setDepthWrite( material.depthWrite ); - setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); - renderBuffer( camera, lights, fog, material, buffer, object ); - - } + setDepthTest( material.depthTest ); + setDepthWrite( material.depthWrite ); + setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); + renderBuffer( camera, lights, fog, material, buffer, object ); } @@ -3967,7 +3988,7 @@ THREE.WebGLRenderer = function ( parameters ) { // opaque pass (immediate simulator) - for ( o = 0; o < oil; o++ ) { + for ( o = 0; o < oil; o ++ ) { webglObject = scene.__webglObjectsImmediate[ o ]; object = webglObject.object; @@ -3976,29 +3997,25 @@ THREE.WebGLRenderer = function ( parameters ) { _currentGeometryGroupHash = -1; - opaque = webglObject.opaque; + material = webglObject.opaque; + + if ( ! material ) continue; setObjectFaces( object ); - for( i = 0; i < opaque.count; i++ ) { + setDepthTest( material.depthTest ); + setDepthWrite( material.depthWrite ); + setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); - material = opaque.list[ i ]; + program = setProgram( camera, lights, fog, material, object ); - setDepthTest( material.depthTest ); - setDepthWrite( material.depthWrite ); - setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); + if ( object.immediateRenderCallback ) { - program = setProgram( camera, lights, fog, material, object ); + object.immediateRenderCallback( program, _gl, _frustum ); - if ( object.immediateRenderCallback ) { + } else { - object.immediateRenderCallback( program, _gl, _frustum ); - - } else { - - object.render( function( object ) { renderBufferImmediate( object, program, material.shading ); } ); - - } + object.render( function( object ) { renderBufferImmediate( object, program, material.shading ); } ); } @@ -4017,22 +4034,18 @@ THREE.WebGLRenderer = function ( parameters ) { object = webglObject.object; buffer = webglObject.buffer; - transparent = webglObject.transparent; + material = webglObject.transparent; + + if ( ! material ) continue; setObjectFaces( object ); - for ( i = 0; i < transparent.count; i ++ ) { + setBlending( material.blending ); + setDepthTest( material.depthTest ); + setDepthWrite( material.depthWrite ); + setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); - material = transparent.list[ i ]; - - setBlending( material.blending ); - setDepthTest( material.depthTest ); - setDepthWrite( material.depthWrite ); - setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); - - renderBuffer( camera, lights, fog, material, buffer, object ); - - } + renderBuffer( camera, lights, fog, material, buffer, object ); } @@ -4040,7 +4053,7 @@ THREE.WebGLRenderer = function ( parameters ) { // transparent pass (immediate simulator) - for ( o = 0; o < oil; o++ ) { + for ( o = 0; o < oil; o ++ ) { webglObject = scene.__webglObjectsImmediate[ o ]; object = webglObject.object; @@ -4049,30 +4062,26 @@ THREE.WebGLRenderer = function ( parameters ) { _currentGeometryGroupHash = -1; - transparent = webglObject.transparent; + material = webglObject.transparent; + + if ( ! material ) continue; setObjectFaces( object ); - for ( i = 0; i < transparent.count; i ++ ) { + setBlending( material.blending ); + setDepthTest( material.depthTest ); + setDepthWrite( material.depthWrite ); + setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); - material = transparent.list[ i ]; + program = setProgram( camera, lights, fog, material, object ); - setBlending( material.blending ); - setDepthTest( material.depthTest ); - setDepthWrite( material.depthWrite ); - setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits ); + if ( object.immediateRenderCallback ) { - program = setProgram( camera, lights, fog, material, object ); + object.immediateRenderCallback( program, _gl, _frustum ); - if ( object.immediateRenderCallback ) { + } else { - object.immediateRenderCallback( program, _gl, _frustum ); - - } else { - - object.render( function( object ) { renderBufferImmediate( object, program, material.shading ); } ); - - } + object.render( function( object ) { renderBufferImmediate( object, program, material.shading ); } ); } @@ -4671,9 +4680,10 @@ THREE.WebGLRenderer = function ( parameters ) { objlist.push( { - buffer: buffer, object: object, - opaque: { list: [], count: 0 }, - transparent: { list: [], count: 0 } + buffer: buffer, + object: object, + opaque: null, + transparent: null } ); @@ -4684,8 +4694,8 @@ THREE.WebGLRenderer = function ( parameters ) { objlist.push( { object: object, - opaque: { list: [], count: 0 }, - transparent: { list: [], count: 0 } + opaque: null, + transparent: null } ); @@ -5754,4 +5764,3 @@ THREE.WebGLRenderer = function ( parameters ) { } */ }; -