diff --git a/build/Three.js b/build/Three.js index 210269a8315dc01acc7ec85c5af29f749959a42c..ef1879e7100f0d083d987c21eee22d31793ceeb4 100644 --- a/build/Three.js +++ b/build/Three.js @@ -1,6 +1,6 @@ // Three.js r46dev - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime}; -THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.001*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; +THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.0010*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;return this},setHSV:function(a,c,b){var e,l,f;if(b===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),l=a*6-e,a=b*(1-c),f=b*(1- c*l),c=b*(1-c*(1-l)),e){case 1:this.r=f;this.g=b;this.b=a;break;case 2:this.r=a;this.g=b;this.b=c;break;case 3:this.r=a;this.g=f;this.b=b;break;case 4:this.r=c;this.g=a;this.b=b;break;case 5:this.r=b;this.g=a;this.b=f;break;case 6:case 0:this.r=b,this.g=c,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+ Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; @@ -16,64 +16,64 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,e){this.x= c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())}, normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,e=[];c=0;for(b=a.length;c=0&&u>=0&&x+u<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,f=new THREE.Vector3,h,k,n,t,p,v,x,u,y,w=[],A=0,B=a.children.length;Aa.scale.x)return[];y={distance:A,point:a.position, -face:null,object:a};w.push(y)}else if(a instanceof THREE.Mesh){A=c(this.origin,this.direction,a.matrixWorld.getPosition());if(A===null||A>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return w;var D,z,C,L,H,I,R,K,N=a.geometry,M=N.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);A=0;for(B=N.faces.length;A0:I<0)))if(I=H.dot((new THREE.Vector3).sub(D,R))/I,R=R.addSelf(K.multiplyScalar(I)),y instanceof THREE.Face3)b(R,D,z,C)&&(y={distance:this.origin.distanceTo(R),point:R,face:y,object:a}, -w.push(y));else if(y instanceof THREE.Face4&&(b(R,D,z,L)||b(R,z,C,L)))y={distance:this.origin.distanceTo(R),point:R,face:y,object:a},w.push(y)}return w}}; -THREE.Rectangle=function(){function a(){f=e-c;h=l-b}var c,b,e,l,f,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return l};this.set=function(h,f,p,v){k=!1;c=h;b=f;e=p;l=v;a()};this.addPoint=function(h,f){k?(k=!1,c=h,b=f,e=h,l=f):(c=ch?e:h,l=l>f?l:f);a()};this.add3Points= -function(h,f,p,v,x,u){k?(k=!1,c=hp?h>x?h:x:p>x?p:x,l=f>v?f>u?f:u:v>u?v:u):(c=hp?h>x?h>e?h:e:x>e?x:e:p>x?p>e?p:e:x>e?x:e,l=f>v?f>u?f>l?f:l:u>l?u:l:v>u?v>l?v:l:u>l?u:l);a()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),b=h.getTop(),e=h.getRight(),l=h.getBottom()):(c=ch.getRight()?e:h.getRight(),l=l> -h.getBottom()?l:h.getBottom());a()};this.inflate=function(h){c-=h;b-=h;e+=h;l+=h;a()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();b=b>h.getTop()?b:h.getTop();e=e=0&&Math.min(l,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){k=!0;l=e=b=c=0;a()};this.isEmpty=function(){return k}}; +l.copy(c).subSelf(b);f.copy(a).subSelf(b);h=e.dot(e);k=e.dot(l);n=e.dot(f);p=l.dot(l);t=l.dot(f);u=1/(h*p-k*k);y=(p*n-k*t)*u;v=(h*t-k*n)*u;return y>=0&&v>=0&&y+v<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,f=new THREE.Vector3,h,k,n,p,t,u,y,v,x,w=[],z=0,B=a.children.length;za.scale.x)return[];x={distance:z,point:a.position, +face:null,object:a};w.push(x)}else if(a instanceof THREE.Mesh){z=c(this.origin,this.direction,a.matrixWorld.getPosition());if(z===null||z>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return w;var C,A,D,K,P,F,Q,H,N=a.geometry,L=N.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);z=0;for(B=N.faces.length;z0:F<0)))if(F=P.dot((new THREE.Vector3).sub(C,Q))/F,Q=Q.addSelf(H.multiplyScalar(F)),x instanceof THREE.Face3)b(Q,C,A,D)&&(x={distance:this.origin.distanceTo(Q),point:Q,face:x,object:a}, +w.push(x));else if(x instanceof THREE.Face4&&(b(Q,C,A,K)||b(Q,A,D,K)))x={distance:this.origin.distanceTo(Q),point:Q,face:x,object:a},w.push(x)}return w}}; +THREE.Rectangle=function(){function a(){f=e-c;h=l-b}var c,b,e,l,f,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return l};this.set=function(f,h,t,u){k=!1;c=f;b=h;e=t;l=u;a()};this.addPoint=function(f,h){k?(k=!1,c=f,b=h,e=f,l=h):(c=cf?e:f,l=l>h?l:h);a()};this.add3Points= +function(f,h,t,u,y,v){k?(k=!1,c=ft?f>y?f:y:t>y?t:y,l=h>u?h>v?h:v:u>v?u:v):(c=ft?f>y?f>e?f:e:y>e?y:e:t>y?t>e?t:e:y>e?y:e,l=h>u?h>v?h>l?h:l:v>l?v:l:u>v?u>l?u:l:v>l?v:l);a()};this.addRectangle=function(f){k?(k=!1,c=f.getLeft(),b=f.getTop(),e=f.getRight(),l=f.getBottom()):(c=cf.getRight()?e:f.getRight(),l=l> +f.getBottom()?l:f.getBottom());a()};this.inflate=function(f){c-=f;b-=f;e+=f;l+=f;a()};this.minSelf=function(f){c=c>f.getLeft()?c:f.getLeft();b=b>f.getTop()?b:f.getTop();e=e=0&&Math.min(l,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){k=!0;l=e=b=c=0;a()};this.isEmpty=function(){return k}}; THREE.Math={clamp:function(a,c,b){return ab?b:a},clampBottom:function(a,c){return a=0&&l>=0&&f>=0&&k>=0?!0:h<0&&l<0||f<0&&k<0?!1:(h<0?c=Math.max(c,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),f<0?c=Math.max(c,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),ef&&k.positionScreen.z0&&I.z<1))f=C[z]=C[z]||new THREE.RenderableParticle,z++,D=f,D.x=I.x/I.w,D.y=I.y/I.w,D.z=I.z,D.rotation=ga.rotation.z,D.scale.x=ga.scale.x*Math.abs(D.x-(I.x+h.projectionMatrix.n11)/(I.w+h.projectionMatrix.n14)),D.scale.y= -ga.scale.y*Math.abs(D.y-(I.y+h.projectionMatrix.n22)/(I.w+h.projectionMatrix.n24)),D.material=ga.material,L.elements.push(D);l&&L.elements.sort(b);return L}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)}; +THREE.Projector=function(){function a(){var a=h[f]=h[f]||new THREE.RenderableObject;f++;return a}function c(){var a=p[n]=p[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,f=a.z+a.w,l=b.z+b.w,h=-a.z+a.w,k=-b.z+b.w;return f>=0&&l>=0&&h>=0&&k>=0?!0:f<0&&l<0||h<0&&k<0?!1:(f<0?c=Math.max(c,f/(f-l)):l<0&&(e=Math.min(e,f/(f-l))),h<0?c=Math.max(c,h/(h-k)):k<0&&(e=Math.min(e,h/(h-k))),eh&&k.positionScreen.z0&&F.z<1))h=D[A]=D[A]||new THREE.RenderableParticle,A++,C=h,C.x=F.x/F.w,C.y=F.y/F.w,C.z=F.z,C.rotation=na.rotation.z,C.scale.x=na.scale.x*Math.abs(C.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14)),C.scale.y=na.scale.y*Math.abs(C.y-(F.y+f.projectionMatrix.n22)/ +(F.w+f.projectionMatrix.n24)),C.material=na.material,K.elements.push(C);l&&K.elements.sort(b);return K}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;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 c=Math.PI/360,b=a.x*c,e=a.y*c,l=a.z*c,a=Math.cos(e),e=Math.sin(e),c=Math.cos(-l),l=Math.sin(-l),f=Math.cos(b),b=Math.sin(b),h=a*c,k=e*l;this.w=h*f-k*b;this.x=h*b+k*f;this.y=e*c*f+a*l*b;this.z=a*l*f-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b); this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-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 c= -this.x,b=this.y,e=this.z,l=this.w,f=a.x,h=a.y,k=a.z,a=a.w;this.x=c*a+l*f+b*k-e*h;this.y=b*a+l*h+e*f-c*k;this.z=e*a+l*k+c*h-b*f;this.w=l*a-c*f-b*h-e*k;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,l=a.z,f=this.x,h=this.y,k=this.z,n=this.w,t=n*b+h*l-k*e,p=n*e+k*b-f*l,v=n*l+f*e-h*b,b=-f* -b-h*e-k*l;c.x=t*n+b*-f+p*-k-v*-h;c.y=p*n+b*-h+v*-f-t*-k;c.z=v*n+b*-k+t*-h-p*-f;return c}}; -THREE.Quaternion.slerp=function(a,c,b,e){var l=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;l<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,l=-l):b.copy(c);if(Math.abs(l)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var f=Math.acos(l),l=Math.sqrt(1-l*l);if(Math.abs(l)<0.001)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-e)*f)/l;e=Math.sin(e*f)/l;b.w=a.w*c+b.w*e;b.x=a.x*c+b.x*e;b.y=a.y*c+b.y*e;b.z=a.z*c+b.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +this.x,b=this.y,e=this.z,l=this.w,f=a.x,h=a.y,k=a.z,a=a.w;this.x=c*a+l*f+b*k-e*h;this.y=b*a+l*h+e*f-c*k;this.z=e*a+l*k+c*h-b*f;this.w=l*a-c*f-b*h-e*k;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,l=a.z,f=this.x,h=this.y,k=this.z,n=this.w,p=n*b+h*l-k*e,t=n*e+k*b-f*l,u=n*l+f*e-h*b,b=-f* +b-h*e-k*l;c.x=p*n+b*-f+t*-k-u*-h;c.y=t*n+b*-h+u*-f-p*-k;c.z=u*n+b*-k+p*-h-t*-f;return c}}; +THREE.Quaternion.slerp=function(a,c,b,e){var l=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;l<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,l=-l):b.copy(c);if(Math.abs(l)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var f=Math.acos(l),l=Math.sqrt(1-l*l);if(Math.abs(l)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-e)*f)/l;e=Math.sin(e*f)/l;b.w=a.w*c+b.w*e;b.x=a.x*c+b.x*e;b.y=a.y*c+b.y*e;b.z=a.z*c+b.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,c,b,e,l,f){this.a=a;this.b=c;this.c=b;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=l instanceof THREE.Color?l:new THREE.Color;this.vertexColors=l instanceof Array?l:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,c,b,e,l,f,h){this.a=a;this.b=c;this.c=b;this.d=e;this.normal=l instanceof THREE.Vector3?l:new THREE.Vector3;this.vertexNormals=l instanceof Array?l:[];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.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,c){this.u=a;this.v=c;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)}}; @@ -83,15 +83,15 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid b,e,l,f,h,k=new THREE.Vector3,n=new THREE.Vector3;e=0;for(l=this.faces.length;e0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, +b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,f,l,T){k=a.vertices[b].position;n=a.vertices[c].position;p=a.vertices[e].position;t=h[f];u=h[l];y=h[T];v=n.x-k.x;x=p.x-k.x;w=n.y-k.y;z=p.y-k.y;B=n.z-k.z;C=p.z-k.z;A=u.u-t.u;D=y.u-t.u;K=u.v-t.v;P=y.v-t.v;F=1/(A*P-D*K);L.set((P*v-K*x)*F,(P*w-K*z)*F,(P*B-K*C)*F);G.set((A*x-D*v)*F,(A*z-D*w)*F,(A*C-D*B)*F);H[b].addSelf(L);H[c].addSelf(L);H[e].addSelf(L);N[b].addSelf(G); +N[c].addSelf(G);N[e].addSelf(G)}var c,b,e,l,f,h,k,n,p,t,u,y,v,x,w,z,B,C,A,D,K,P,F,Q,H=[],N=[],L=new THREE.Vector3,G=new THREE.Vector3,V=new THREE.Vector3,ca=new THREE.Vector3,W=new THREE.Vector3;c=0;for(b=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;cthis.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,c=0,b=this.vertices.length;cthis.points.length-2?f:f+1;b[3]=f>this.points.length-3?f:f+2;t=this.points[b[0]];p=this.points[b[1]]; -v=this.points[b[2]];x=this.points[b[3]];k=h*h;n=h*k;e.x=c(t.x,p.x,v.x,x.x,h,k,n);e.y=c(t.y,p.y,v.y,x.y,h,k,n);e.z=c(t.z,p.z,v.z,x.z,h,k,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;athis.points.length-2?f:f+1;b[3]=f>this.points.length-3?f:f+2;p=this.points[b[0]];t=this.points[b[1]]; +u=this.points[b[2]];y=this.points[b[3]];k=h*h;n=h*k;e.x=c(p.x,t.x,u.x,y.x,h,k,n);e.y=c(p.y,t.y,u.y,y.y,h,k,n);e.z=c(p.z,t.z,u.z,y.z,h,k,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a0&&(b(THREE.NormalBlending),c(1),l("rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b*255)+","+B+")"),w.fillRect(Math.floor(ia.getX()), -Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight()))),ia.empty())};this.render=function(a,p){function v(a){var b,c,e,h;ra.setRGB(0,0,0);wa.setRGB(0,0,0);sa.setRGB(0,0,0);b=0;for(c=a.length;b> -1,Q=t.height>>1,f=h.scale.x*u,n=h.scale.y*y,o=f*p,k=n*Q,X.set(a.x-o,a.y-k,a.x+o,a.y+k),V.intersects(X)&&(w.save(),w.translate(a.x,a.y),w.rotate(-h.rotation),w.scale(f,-n),w.translate(-p,-Q),w.drawImage(t,0,0),w.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(o=h.scale.x*u,k=h.scale.y*y,X.set(a.x-o,a.y-k,a.x+o,a.y+k),V.intersects(X)&&(e(f.color.getContextStyle()),l(f.color.getContextStyle()),w.save(),w.translate(a.x,a.y),w.rotate(-h.rotation),w.scale(o,k),f.program(w),w.restore()))}function B(a, -h,f,l){c(l.opacity);b(l.blending);w.beginPath();w.moveTo(a.positionScreen.x,a.positionScreen.y);w.lineTo(h.positionScreen.x,h.positionScreen.y);w.closePath();if(l instanceof THREE.LineBasicMaterial){a=l.linewidth;if(H!=a)w.lineWidth=H=a;a=l.linecap;if(I!=a)w.lineCap=I=a;a=l.linejoin;if(R!=a)w.lineJoin=R=a;e(l.color.getContextStyle());w.stroke();X.inflate(l.linewidth*2)}}function z(a,e,h,l,k,t,u,Q){f.info.render.vertices+=3;f.info.render.faces++;c(Q.opacity);b(Q.blending);U=a.positionScreen.x;o=a.positionScreen.y; -da=e.positionScreen.x;Y=e.positionScreen.y;pa=h.positionScreen.x;P=h.positionScreen.y;Ua(U,o,da,Y,pa,P);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.mapping instanceof THREE.UVMapping&&(ua=u.uvs[0],Xa(U,o,da,Y,pa,P,ua[l].u,ua[l].v,ua[k].u,ua[k].v,ua[t].u,ua[t].v,Q.map));else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=p.matrixWorldInverse,oa.copy(u.vertexNormalsWorld[l]),xa=(oa.x*a.n11+oa.y*a.n12+oa.z*a.n13)*0.5+0.5,Da=-(oa.x*a.n21+oa.y*a.n22+oa.z*a.n23)* -0.5+0.5,oa.copy(u.vertexNormalsWorld[k]),Ba=(oa.x*a.n11+oa.y*a.n12+oa.z*a.n13)*0.5+0.5,Ea=-(oa.x*a.n21+oa.y*a.n22+oa.z*a.n23)*0.5+0.5,oa.copy(u.vertexNormalsWorld[t]),Ca=(oa.x*a.n11+oa.y*a.n12+oa.z*a.n13)*0.5+0.5,E=-(oa.x*a.n21+oa.y*a.n22+oa.z*a.n23)*0.5+0.5,Xa(U,o,da,Y,pa,P,xa,Da,Ba,Ea,Ca,E,Q.envMap)}else Q.wireframe?L(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(Q.color);else if(Q instanceof THREE.MeshLambertMaterial)Q.map&&!Q.wireframe&&(Q.map.mapping instanceof THREE.UVMapping&& -(ua=u.uvs[0],Xa(U,o,da,Y,pa,P,ua[l].u,ua[l].v,ua[k].u,ua[k].v,ua[t].u,ua[t].v,Q.map)),b(THREE.SubtractiveBlending)),va?!Q.wireframe&&Q.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?(la.r=fa.r=ka.r=ra.r,la.g=fa.g=ka.g=ra.g,la.b=fa.b=ka.b=ra.b,x(n,u.v1.positionWorld,u.vertexNormalsWorld[0],la),x(n,u.v2.positionWorld,u.vertexNormalsWorld[1],fa),x(n,u.v3.positionWorld,u.vertexNormalsWorld[2],ka),la.r=Math.max(0,Math.min(Q.color.r*la.r,1)),la.g=Math.max(0,Math.min(Q.color.g*la.g,1)),la.b= -Math.max(0,Math.min(Q.color.b*la.b,1)),fa.r=Math.max(0,Math.min(Q.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(Q.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(Q.color.b*fa.b,1)),ka.r=Math.max(0,Math.min(Q.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(Q.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(Q.color.b*ka.b,1)),ha.r=(fa.r+ka.r)*0.5,ha.g=(fa.g+ka.g)*0.5,ha.b=(fa.b+ka.b)*0.5,ma=Va(la,fa,ka,ha),Sa(U,o,da,Y,pa,P,0,0,1,0,0,1,ma)):(ca.r=ra.r,ca.g=ra.g,ca.b=ra.b,x(n,u.centroidWorld,u.normalWorld,ca),ca.r=Math.max(0, -Math.min(Q.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(Q.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(Q.color.b*ca.b,1)),Q.wireframe?L(ca,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(ca)):Q.wireframe?L(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(Q.color);else if(Q instanceof THREE.MeshDepthMaterial)ta=p.near,qa=p.far,la.r=la.g=la.b=1-Na(a.positionScreen.z,ta,qa),fa.r=fa.g=fa.b=1-Na(e.positionScreen.z,ta,qa),ka.r=ka.g=ka.b=1-Na(h.positionScreen.z,ta,qa),ha.r= -(fa.r+ka.r)*0.5,ha.g=(fa.g+ka.g)*0.5,ha.b=(fa.b+ka.b)*0.5,ma=Va(la,fa,ka,ha),Sa(U,o,da,Y,pa,P,0,0,1,0,0,1,ma);else if(Q instanceof THREE.MeshNormalMaterial)ca.r=Ta(u.normalWorld.x),ca.g=Ta(u.normalWorld.y),ca.b=Ta(u.normalWorld.z),Q.wireframe?L(ca,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(ca)}function D(a,e,h,l,k,t,u,Q,v){f.info.render.vertices+=4;f.info.render.faces++;c(Q.opacity);b(Q.blending);if(Q.map||Q.envMap)z(a,e,l,0,1,3,u,Q,v),z(k,h,t,1,2,3,u,Q,v);else if(U=a.positionScreen.x, -o=a.positionScreen.y,da=e.positionScreen.x,Y=e.positionScreen.y,pa=h.positionScreen.x,P=h.positionScreen.y,T=l.positionScreen.x,ja=l.positionScreen.y,ea=k.positionScreen.x,aa=k.positionScreen.y,na=t.positionScreen.x,ga=t.positionScreen.y,Q instanceof THREE.MeshBasicMaterial)C(U,o,da,Y,pa,P,T,ja),Q.wireframe?L(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(Q.color);else if(Q instanceof THREE.MeshLambertMaterial)va?!Q.wireframe&&Q.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length== -4?(la.r=fa.r=ka.r=ha.r=ra.r,la.g=fa.g=ka.g=ha.g=ra.g,la.b=fa.b=ka.b=ha.b=ra.b,x(n,u.v1.positionWorld,u.vertexNormalsWorld[0],la),x(n,u.v2.positionWorld,u.vertexNormalsWorld[1],fa),x(n,u.v4.positionWorld,u.vertexNormalsWorld[3],ka),x(n,u.v3.positionWorld,u.vertexNormalsWorld[2],ha),la.r=Math.max(0,Math.min(Q.color.r*la.r,1)),la.g=Math.max(0,Math.min(Q.color.g*la.g,1)),la.b=Math.max(0,Math.min(Q.color.b*la.b,1)),fa.r=Math.max(0,Math.min(Q.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(Q.color.g*fa.g,1)), -fa.b=Math.max(0,Math.min(Q.color.b*fa.b,1)),ka.r=Math.max(0,Math.min(Q.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(Q.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(Q.color.b*ka.b,1)),ha.r=Math.max(0,Math.min(Q.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(Q.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(Q.color.b*ha.b,1)),ma=Va(la,fa,ka,ha),Ua(U,o,da,Y,T,ja),Sa(U,o,da,Y,T,ja,0,0,1,0,0,1,ma),Ua(ea,aa,pa,P,na,ga),Sa(ea,aa,pa,P,na,ga,1,0,1,1,0,1,ma)):(ca.r=ra.r,ca.g=ra.g,ca.b=ra.b,x(n,u.centroidWorld,u.normalWorld, -ca),ca.r=Math.max(0,Math.min(Q.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(Q.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(Q.color.b*ca.b,1)),C(U,o,da,Y,pa,P,T,ja),Q.wireframe?L(ca,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(ca)):(C(U,o,da,Y,pa,P,T,ja),Q.wireframe?L(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(Q.color));else if(Q instanceof THREE.MeshNormalMaterial)ca.r=Ta(u.normalWorld.x),ca.g=Ta(u.normalWorld.y),ca.b=Ta(u.normalWorld.z),C(U,o,da,Y,pa,P,T, -ja),Q.wireframe?L(ca,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(ca);else if(Q instanceof THREE.MeshDepthMaterial)ta=p.near,qa=p.far,la.r=la.g=la.b=1-Na(a.positionScreen.z,ta,qa),fa.r=fa.g=fa.b=1-Na(e.positionScreen.z,ta,qa),ka.r=ka.g=ka.b=1-Na(l.positionScreen.z,ta,qa),ha.r=ha.g=ha.b=1-Na(h.positionScreen.z,ta,qa),ma=Va(la,fa,ka,ha),Ua(U,o,da,Y,T,ja),Sa(U,o,da,Y,T,ja,0,0,1,0,0,1,ma),Ua(ea,aa,pa,P,na,ga),Sa(ea,aa,pa,P,na,ga,1,0,1,1,0,1,ma)}function Ua(a,b,c,e,h,l){w.beginPath(); -w.moveTo(a,b);w.lineTo(c,e);w.lineTo(h,l);w.lineTo(a,b);w.closePath()}function C(a,b,c,e,h,l,f,o){w.beginPath();w.moveTo(a,b);w.lineTo(c,e);w.lineTo(h,l);w.lineTo(f,o);w.lineTo(a,b);w.closePath()}function L(a,b,c,h){if(H!=b)w.lineWidth=H=b;if(I!=c)w.lineCap=I=c;if(R!=h)w.lineJoin=R=h;e(a.getContextStyle());w.stroke();X.inflate(b*2)}function La(a){l(a.getContextStyle());w.fill()}function Xa(a,b,c,e,h,f,o,k,n,Q,t,u,p){if(p.image.width!=0){if(p.needsUpdate==!0||O[p.id]==void 0){var v=p.wrapS==THREE.RepeatWrapping, -x=p.wrapT==THREE.RepeatWrapping;O[p.id]=w.createPattern(p.image,v&&x?"repeat":v&&!x?"repeat-x":!v&&x?"repeat-y":"no-repeat");p.needsUpdate=!1}l(O[p.id]);var v=p.offset.x/p.repeat.x,x=p.offset.y/p.repeat.y,E=(p.image.width-1)*p.repeat.x,p=(p.image.height-1)*p.repeat.y,o=(o+v)*E,k=(k+x)*p,n=(n+v)*E,Q=(Q+x)*p,t=(t+v)*E,u=(u+x)*p;c-=a;e-=b;h-=a;f-=b;n-=o;Q-=k;t-=o;u-=k;v=1/(n*u-t*Q);p=(u*c-Q*h)*v;Q=(u*e-Q*f)*v;c=(n*h-t*c)*v;e=(n*f-t*e)*v;a=a-p*o-c*k;b=b-Q*o-e*k;w.save();w.transform(p,Q,c,e,a,b);w.fill(); -w.restore()}}function Sa(a,b,c,e,h,l,f,o,k,n,Q,t,u){var p,v;p=u.width-1;v=u.height-1;f*=p;o*=v;k*=p;n*=v;Q*=p;t*=v;c-=a;e-=b;h-=a;l-=b;k-=f;n-=o;Q-=f;t-=o;v=1/(k*t-Q*n);p=(t*c-n*h)*v;n=(t*e-n*l)*v;c=(k*h-Q*c)*v;e=(k*l-Q*e)*v;a=a-p*f-c*o;b=b-n*f-e*o;w.save();w.transform(p,n,c,e,a,b);w.clip();w.drawImage(u,0,0);w.restore()}function Va(a,b,c,e){var h=~~(a.r*255),l=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),o=~~(b.g*255),b=~~(b.b*255),k=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),Q=~~(e.r*255),t=~~(e.g*255), -e=~~(e.b*255);Aa[0]=h<0?0:h>255?255:h;Aa[1]=l<0?0:l>255?255:l;Aa[2]=a<0?0:a>255?255:a;Aa[4]=f<0?0:f>255?255:f;Aa[5]=o<0?0:o>255?255:o;Aa[6]=b<0?0:b>255?255:b;Aa[8]=k<0?0:k>255?255:k;Aa[9]=n<0?0:n>255?255:n;Aa[10]=c<0?0:c>255?255:c;Aa[12]=Q<0?0:Q>255?255:Q;Aa[13]=t<0?0:t>255?255:t;Aa[14]=e<0?0:e>255?255:e;ya.putImageData(Ga,0,0);Ia.drawImage(Fa,0,0);return W}function Na(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ta(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ma(a,b){var c=b.x-a.x,e=b.y-a.y, -h=c*c+e*e;h!=0&&(h=1/Math.sqrt(h),c*=h,e*=h,b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Wa,Ya,za,Ha;this.autoClear?this.clear():w.setTransform(1,0,0,-1,u,y);f.info.render.vertices=0;f.info.render.faces=0;h=t.projectScene(a,p,this.sortElements);k=h.elements;n=h.lights;(va=n.length>0)&&v(n);Wa=0;for(Ya=k.length;Wa1?1:a}var e=this,l,f,h,k=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,p,v,x,u,y,w,A,B=new THREE.Rectangle,D=new THREE.Rectangle,z=!1,C=new THREE.Color,L=new THREE.Color,H=new THREE.Color,I=new THREE.Color,R,K=new THREE.Vector3,N=[],M=[],G,Z,$,U=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":U=1;break;case "low":U=0}};this.setSize=function(a,b){t=a;p=b;v=t/2;x=p/2;n.setAttribute("viewBox",-v+" "+-x+" "+t+" "+p);n.setAttribute("width",t);n.setAttribute("height",p);B.set(-v,-x,v,x)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(o,t){var p,K,P,T;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(o,t,this.sortElements);f=l.elements; -h=l.lights;$=Z=0;if(z=h.length>0){L.setRGB(0,0,0);H.setRGB(0,0,0);I.setRGB(0,0,0);p=0;for(K=h.length;p0&&(b(THREE.NormalBlending),c(1),l("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*255)+","+B+")"),w.fillRect(Math.floor(Y.getX()), +Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight()))),Y.empty())};this.render=function(a,t){function u(a){var b,c,e,f;ra.setRGB(0,0,0);xa.setRGB(0,0,0);oa.setRGB(0,0,0);b=0;for(c=a.length;b>1,wa= +p.height>>1,h=f.scale.x*v,n=f.scale.y*x,k=h*t,o=n*wa,J.set(a.x-k,a.y-o,a.x+k,a.y+o),ja.intersects(J)&&(w.save(),w.translate(a.x,a.y),w.rotate(-f.rotation),w.scale(h,-n),w.translate(-t,-wa),w.drawImage(p,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=f.scale.x*v,o=f.scale.y*x,J.set(a.x-k,a.y-o,a.x+k,a.y+o),ja.intersects(J)&&(e(h.color.getContextStyle()),l(h.color.getContextStyle()),w.save(),w.translate(a.x,a.y),w.rotate(-f.rotation),w.scale(k,o),h.program(w),w.restore()))}function B(a, +f,l,h){c(h.opacity);b(h.blending);w.beginPath();w.moveTo(a.positionScreen.x,a.positionScreen.y);w.lineTo(f.positionScreen.x,f.positionScreen.y);w.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(P!=a)w.lineWidth=P=a;a=h.linecap;if(F!=a)w.lineCap=F=a;a=h.linejoin;if(Q!=a)w.lineJoin=Q=a;e(h.color.getContextStyle());w.stroke();J.inflate(h.linewidth*2)}}function A(a,e,h,l,k,p,v,u){f.info.render.vertices+=3;f.info.render.faces++;c(u.opacity);b(u.blending);W=a.positionScreen.x;T=a.positionScreen.y; +o=e.positionScreen.x;Z=e.positionScreen.y;ha=h.positionScreen.x;M=h.positionScreen.y;Ua(W,T,o,Z,ha,M);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(sa=v.uvs[0],Ya(W,T,o,Z,ha,M,sa[l].u,sa[l].v,sa[k].u,sa[k].v,sa[p].u,sa[p].v,u.map));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=t.matrixWorldInverse,pa.copy(v.vertexNormalsWorld[l]),Da=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,va=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)* +0.5+0.5,pa.copy(v.vertexNormalsWorld[k]),Ea=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,Ca=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)*0.5+0.5,pa.copy(v.vertexNormalsWorld[p]),Ga=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,aa=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)*0.5+0.5,Ya(W,T,o,Z,ha,M,Da,va,Ea,Ca,Ga,aa,u.envMap)}else u.wireframe?D(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof THREE.UVMapping&& +(sa=v.uvs[0],Ya(W,T,o,Z,ha,M,sa[l].u,sa[l].v,sa[k].u,sa[k].v,sa[p].u,sa[p].v,u.map)),b(THREE.SubtractiveBlending)),O?!u.wireframe&&u.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3?(ka.r=fa.r=ia.r=ra.r,ka.g=fa.g=ia.g=ra.g,ka.b=fa.b=ia.b=ra.b,y(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ka),y(n,v.v2.positionWorld,v.vertexNormalsWorld[1],fa),y(n,v.v3.positionWorld,v.vertexNormalsWorld[2],ia),ka.r=Math.max(0,Math.min(u.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(u.color.g*ka.g,1)),ka.b= +Math.max(0,Math.min(u.color.b*ka.b,1)),fa.r=Math.max(0,Math.min(u.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(u.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(u.color.b*fa.b,1)),ia.r=Math.max(0,Math.min(u.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(u.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(u.color.b*ia.b,1)),ga.r=(fa.r+ia.r)*0.5,ga.g=(fa.g+ia.g)*0.5,ga.b=(fa.b+ia.b)*0.5,qa=Va(ka,fa,ia,ga),Sa(W,T,o,Z,ha,M,0,0,1,0,0,1,qa)):(ea.r=ra.r,ea.g=ra.g,ea.b=ra.b,y(n,v.centroidWorld,v.normalWorld,ea),ea.r=Math.max(0, +Math.min(u.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(u.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(u.color.b*ea.b,1)),u.wireframe?D(ea,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(ea)):u.wireframe?D(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(u.color);else if(u instanceof THREE.MeshDepthMaterial)ta=t.near,ua=t.far,ka.r=ka.g=ka.b=1-Ma(a.positionScreen.z,ta,ua),fa.r=fa.g=fa.b=1-Ma(e.positionScreen.z,ta,ua),ia.r=ia.g=ia.b=1-Ma(h.positionScreen.z,ta,ua),ga.r= +(fa.r+ia.r)*0.5,ga.g=(fa.g+ia.g)*0.5,ga.b=(fa.b+ia.b)*0.5,qa=Va(ka,fa,ia,ga),Sa(W,T,o,Z,ha,M,0,0,1,0,0,1,qa);else if(u instanceof THREE.MeshNormalMaterial)ea.r=Ta(v.normalWorld.x),ea.g=Ta(v.normalWorld.y),ea.b=Ta(v.normalWorld.z),u.wireframe?D(ea,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(ea)}function C(a,e,h,l,k,p,v,u,w){f.info.render.vertices+=4;f.info.render.faces++;c(u.opacity);b(u.blending);if(u.map||u.envMap)A(a,e,l,0,1,3,v,u,w),A(k,h,p,1,2,3,v,u,w);else if(W=a.positionScreen.x, +T=a.positionScreen.y,o=e.positionScreen.x,Z=e.positionScreen.y,ha=h.positionScreen.x,M=h.positionScreen.y,R=l.positionScreen.x,X=l.positionScreen.y,la=k.positionScreen.x,$=k.positionScreen.y,ma=p.positionScreen.x,na=p.positionScreen.y,u instanceof THREE.MeshBasicMaterial)Wa(W,T,o,Z,ha,M,R,X),u.wireframe?D(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(u.color);else if(u instanceof THREE.MeshLambertMaterial)O?!u.wireframe&&u.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length== +4?(ka.r=fa.r=ia.r=ga.r=ra.r,ka.g=fa.g=ia.g=ga.g=ra.g,ka.b=fa.b=ia.b=ga.b=ra.b,y(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ka),y(n,v.v2.positionWorld,v.vertexNormalsWorld[1],fa),y(n,v.v4.positionWorld,v.vertexNormalsWorld[3],ia),y(n,v.v3.positionWorld,v.vertexNormalsWorld[2],ga),ka.r=Math.max(0,Math.min(u.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(u.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(u.color.b*ka.b,1)),fa.r=Math.max(0,Math.min(u.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(u.color.g*fa.g,1)), +fa.b=Math.max(0,Math.min(u.color.b*fa.b,1)),ia.r=Math.max(0,Math.min(u.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(u.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(u.color.b*ia.b,1)),ga.r=Math.max(0,Math.min(u.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(u.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(u.color.b*ga.b,1)),qa=Va(ka,fa,ia,ga),Ua(W,T,o,Z,R,X),Sa(W,T,o,Z,R,X,0,0,1,0,0,1,qa),Ua(la,$,ha,M,ma,na),Sa(la,$,ha,M,ma,na,1,0,1,1,0,1,qa)):(ea.r=ra.r,ea.g=ra.g,ea.b=ra.b,y(n,v.centroidWorld,v.normalWorld,ea),ea.r= +Math.max(0,Math.min(u.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(u.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(u.color.b*ea.b,1)),Wa(W,T,o,Z,ha,M,R,X),u.wireframe?D(ea,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(ea)):(Wa(W,T,o,Z,ha,M,R,X),u.wireframe?D(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(u.color));else if(u instanceof THREE.MeshNormalMaterial)ea.r=Ta(v.normalWorld.x),ea.g=Ta(v.normalWorld.y),ea.b=Ta(v.normalWorld.z),Wa(W,T,o,Z,ha,M,R,X),u.wireframe? +D(ea,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(ea);else if(u instanceof THREE.MeshDepthMaterial)ta=t.near,ua=t.far,ka.r=ka.g=ka.b=1-Ma(a.positionScreen.z,ta,ua),fa.r=fa.g=fa.b=1-Ma(e.positionScreen.z,ta,ua),ia.r=ia.g=ia.b=1-Ma(l.positionScreen.z,ta,ua),ga.r=ga.g=ga.b=1-Ma(h.positionScreen.z,ta,ua),qa=Va(ka,fa,ia,ga),Ua(W,T,o,Z,R,X),Sa(W,T,o,Z,R,X,0,0,1,0,0,1,qa),Ua(la,$,ha,M,ma,na),Sa(la,$,ha,M,ma,na,1,0,1,1,0,1,qa)}function Ua(a,b,c,e,f,h){w.beginPath();w.moveTo(a,b);w.lineTo(c, +e);w.lineTo(f,h);w.lineTo(a,b);w.closePath()}function Wa(a,b,c,e,f,h,l,k){w.beginPath();w.moveTo(a,b);w.lineTo(c,e);w.lineTo(f,h);w.lineTo(l,k);w.lineTo(a,b);w.closePath()}function D(a,b,c,f){if(P!=b)w.lineWidth=P=b;if(F!=c)w.lineCap=F=c;if(Q!=f)w.lineJoin=Q=f;e(a.getContextStyle());w.stroke();J.inflate(b*2)}function K(a){l(a.getContextStyle());w.fill()}function Ya(a,b,c,e,f,h,k,o,n,u,p,v,t){if(t.image.width!=0){if(t.needsUpdate==!0||da[t.id]==void 0){var wa=t.wrapS==THREE.RepeatWrapping,y=t.wrapT== +THREE.RepeatWrapping;da[t.id]=w.createPattern(t.image,wa&&y?"repeat":wa&&!y?"repeat-x":!wa&&y?"repeat-y":"no-repeat");t.needsUpdate=!1}l(da[t.id]);var wa=t.offset.x/t.repeat.x,y=t.offset.y/t.repeat.y,aa=(t.image.width-1)*t.repeat.x,t=(t.image.height-1)*t.repeat.y,k=(k+wa)*aa,o=(o+y)*t,n=(n+wa)*aa,u=(u+y)*t,p=(p+wa)*aa,v=(v+y)*t;c-=a;e-=b;f-=a;h-=b;n-=k;u-=o;p-=k;v-=o;wa=1/(n*v-p*u);t=(v*c-u*f)*wa;u=(v*e-u*h)*wa;c=(n*f-p*c)*wa;e=(n*h-p*e)*wa;a=a-t*k-c*o;b=b-u*k-e*o;w.save();w.transform(t,u,c,e,a,b); +w.fill();w.restore()}}function Sa(a,b,c,e,f,h,l,k,o,n,u,p,v){var t,wa;t=v.width-1;wa=v.height-1;l*=t;k*=wa;o*=t;n*=wa;u*=t;p*=wa;c-=a;e-=b;f-=a;h-=b;o-=l;n-=k;u-=l;p-=k;wa=1/(o*p-u*n);t=(p*c-n*f)*wa;n=(p*e-n*h)*wa;c=(o*f-u*c)*wa;e=(o*h-u*e)*wa;a=a-t*l-c*k;b=b-n*l-e*k;w.save();w.transform(t,n,c,e,a,b);w.clip();w.drawImage(v,0,0);w.restore()}function Va(a,b,c,e){var f=~~(a.r*255),h=~~(a.g*255),a=~~(a.b*255),l=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),o=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),u=~~(e.r* +255),p=~~(e.g*255),e=~~(e.b*255);Ba[0]=f<0?0:f>255?255:f;Ba[1]=h<0?0:h>255?255:h;Ba[2]=a<0?0:a>255?255:a;Ba[4]=l<0?0:l>255?255:l;Ba[5]=k<0?0:k>255?255:k;Ba[6]=b<0?0:b>255?255:b;Ba[8]=o<0?0:o>255?255:o;Ba[9]=n<0?0:n>255?255:n;Ba[10]=c<0?0:c>255?255:c;Ba[12]=u<0?0:u>255?255:u;Ba[13]=p<0?0:p>255?255:p;Ba[14]=e<0?0:e>255?255:e;za.putImageData(Fa,0,0);U.drawImage(ya,0,0);return Ha}function Ma(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ta(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function La(a,b){var c= +b.x-a.x,e=b.y-a.y,f=c*c+e*e;f!=0&&(f=1/Math.sqrt(f),c*=f,e*=f,b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Xa,Za,Aa,Ia;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,x);f.info.render.vertices=0;f.info.render.faces=0;h=p.projectScene(a,t,this.sortElements);k=h.elements;n=h.lights;(O=n.length>0)&&u(n);Xa=0;for(Za=k.length;Xa1?1:a}var e=this,l,f,h,k=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,t,u,y,v,x,w,z,B=new THREE.Rectangle,C=new THREE.Rectangle,A=!1,D=new THREE.Color,K=new THREE.Color,P=new THREE.Color,F=new THREE.Color,Q,H=new THREE.Vector3,N=[],L=[],G,V,ca,W=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":W=1;break;case "low":W=0}};this.setSize=function(a,b){p=a;t=b;u=p/2;y=t/2;n.setAttribute("viewBox",-u+" "+-y+" "+p+" "+t);n.setAttribute("width",p);n.setAttribute("height",t);B.set(-u,-y,u,y)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(p,o){var t,H,M,R;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(p,o,this.sortElements);f=l.elements; +h=l.lights;ca=V=0;if(A=h.length>0){K.setRGB(0,0,0);P.setRGB(0,0,0);F.setRGB(0,0,0);t=0;for(H=h.length;t=0)return a.geometry.materials[b.materialIndex]}function b(a,b,c){var e,h,f,l=a.vertices,k=l.length,n=a.colors,t=n.length,u=a.__vertexArray,p=a.__colorArray,v=a.__sortArray,w=a.__dirtyVertices,x=a.__dirtyColors,E=a.__webglCustomAttributesList,y;if(E){f=0;for(e=E.length;f=0)b&&(o.bindBuffer(o.ARRAY_BUFFER,l.__webglVertexBuffer),o.vertexAttribPointer(a.position,3,o.FLOAT,!1,0,0));else if(f.morphTargetBase){c=h.program.attributes;f.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[f.morphTargetBase]),o.vertexAttribPointer(c.position, -3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,l.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){k=0;var t=f.morphTargetForcedOrder;for(n=f.morphTargetInfluences;ku&&(p=v,u=n[p]);o.bindBuffer(o.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[p]);o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[k]=u;t[p]=1;u=-1;k++}}h.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(h.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(l.__webglCustomAttributesList){k=0;for(n= -l.__webglCustomAttributesList.length;k=0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,o.FLOAT,!1,0,0))}a.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,l.__webglColorBuffer),o.vertexAttribPointer(a.color,3,o.FLOAT,!1,0,0));a.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,l.__webglNormalBuffer),o.vertexAttribPointer(a.normal,3,o.FLOAT,!1,0,0));a.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER, -l.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>=0&&(l.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,l.__webglUVBuffer),o.vertexAttribPointer(a.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv)):o.disableVertexAttribArray(a.uv));a.uv2>=0&&(l.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,l.__webglUV2Buffer),o.vertexAttribPointer(a.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv2)):o.disableVertexAttribArray(a.uv2));h.skinning&&a.skinVertexA>=0&&a.skinVertexB>= -0&&a.skinIndex>=0&&a.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,l.__webglSkinVertexABuffer),o.vertexAttribPointer(a.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),o.vertexAttribPointer(a.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),o.vertexAttribPointer(a.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),o.vertexAttribPointer(a.skinWeight,4,o.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(h.wireframe? -(o.lineWidth(h.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer),o.drawElements(o.LINES,l.__webglLineCount,o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer),o.drawElements(o.TRIANGLES,l.__webglFaceCount,o.UNSIGNED_SHORT,0)),U.info.render.calls++,U.info.render.vertices+=l.__webglFaceCount,U.info.render.faces+=l.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(h.linewidth),o.drawArrays(f, -0,l.__webglLineCount),U.info.render.calls++):f instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,l.__webglParticleCount),U.info.render.calls++):f instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,l.__webglVertexCount),U.info.render.calls++)}}function f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray, -o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,h,l,f,k,n,t,u,p,v,w=a.count*3;for(v=0;v=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function y(a,b){return b.z-a.z}function w(a){var b,c,n,t=0,u,w,x,E,y=a.lights;wa||(wa=new THREE.PerspectiveCamera(U.shadowCameraFov,U.shadowMapWidth/U.shadowMapHeight,U.shadowCameraNear,U.shadowCameraFar));b=0;for(c=y.length;b=0;c--)a[c].object===b&&a.splice(c,1)}function L(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})} -function H(a){if(a!==na){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}na=a}}function I(a,b,c){(c.width&c.width- -1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,$(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,$(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,$(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,$(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Z(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,Z(b.minFilter)))}function R(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit= -!0,a.__webglTexture=o.createTexture(),U.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,$(a.format),a.image.width,a.image.height,0,$(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);I(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function K(a,b){o.bindRenderbuffer(o.RENDERBUFFER, -a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function N(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=o.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);I(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,$(a.format),a.width,a.height,0,$(a.format),$(a.type), -null);var e=a,h=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,h,e.__webglTexture,0);K(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),I(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,$(a.format),a.width,a.height,0,$(a.format),$(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER, -a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),K(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,h=e=0):(b=null,c=ta,a=qa,e=ha,h=O);b!==pa&&(o.bindFramebuffer(o.FRAMEBUFFER, -b),o.viewport(e,h,c,a),pa=b)}function M(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function G(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c, -o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function Z(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function $(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST; -case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT; -case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var U=this,o,da=[],Y=null,pa=null,P=-1,T=null,ja=0,ea=null,aa=null,na=null,ga=null,ca=null,la=null,fa=null,ka=null,ha=0,O=0,ta=0,qa=0,ma=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,xa=new Float32Array(16), -Da=new Float32Array(16),Ba=new THREE.Vector4,Ea={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Ca=a.canvas!==void 0?a.canvas:document.createElement("canvas"),E=a.stencil!==void 0?a.stencil:!0,V=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ia=a.antialias!==void 0?a.antialias:!1,X=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),va=a.clearAlpha!==void 0?a.clearAlpha:0,ra=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=Ca;this.autoUpdateScene=this.autoUpdateObjects=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 wa,sa=[],a=THREE.ShaderLib.depthRGBA,oa=THREE.UniformsUtils.clone(a.uniforms),Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:oa}),ya=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:oa,morphTargets:!0});Fa._shadowPass=!0;ya._shadowPass=!0;try{if(!(o=Ca.getContext("experimental-webgl", -{antialias:ia,stencil:E,preserveDrawingBuffer:V})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD); -o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(X.r,X.g,X.b,va);this.context=o;var Aa=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);E=0;W.vertices[E++]=-1;W.vertices[E++]=-1;W.vertices[E++]=0;W.vertices[E++]=1;W.vertices[E++]=1;W.vertices[E++]=-1;W.vertices[E++]=1;W.vertices[E++]=1;W.vertices[E++]=1;W.vertices[E++]=1;W.vertices[E++]=1;W.vertices[E++]=0;W.vertices[E++]=-1;W.vertices[E++]=1;W.vertices[E++]=0;E=W.vertices[E++]= -0;W.faces[E++]=0;W.faces[E++]=1;W.faces[E++]=2;W.faces[E++]=0;W.faces[E++]=2;W.faces[E++]=3;W.vertexBuffer=o.createBuffer();W.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,W.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,W.faces,o.STATIC_DRAW);W.program=o.createProgram();o.attachShader(W.program,G("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(W.program,G("vertex", -THREE.ShaderLib.sprite.vertexShader));o.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=o.getAttribLocation(W.program,"position");W.attributes.uv=o.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=o.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=o.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=o.getUniformLocation(W.program,"rotation");W.uniforms.scale=o.getUniformLocation(W.program,"scale");W.uniforms.alignment=o.getUniformLocation(W.program, -"alignment");W.uniforms.color=o.getUniformLocation(W.program,"color");W.uniforms.map=o.getUniformLocation(W.program,"map");W.uniforms.opacity=o.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=o.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=o.getUniformLocation(W.program,"affectedByDistance");W.uniforms.screenPosition=o.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=o.getUniformLocation(W.program,"modelViewMatrix"); -W.uniforms.projectionMatrix=o.getUniformLocation(W.program,"projectionMatrix");var Ia=!1;this.setSize=function(a,b){Ca.width=a;Ca.height=b;this.setViewport(0,0,Ca.width,Ca.height)};this.setViewport=function(a,b,c,e){ha=a;O=b;ta=c;qa=e;o.viewport(ha,O,ta,qa)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){X.setHex(a);va=b;o.clearColor(X.r,X.g,X.b,va)};this.setClearColor= -function(a,b){X.copy(a);va=b;o.clearColor(X.r,X.g,X.b,va)};this.getClearColor=function(){return X};this.getClearAlpha=function(){return va};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};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];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer); -o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal); -w.tangent>=0&&o.enableVertexAttribArray(w.tangent);a.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(a.attributes)for(l in a.attributes)w[l]!==void 0&&w[l]>=0&&o.enableVertexAttribArray(w[l]);if(a.morphTargets)for(l=a.numSupportedMorphTargets=0;l=0&&(o.enableVertexAttribArray(w[x]), -a.numSupportedMorphTargets++);a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.clearTarget=function(a,b,c,e){N(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){w(a,b)};this.render=function(a,b,c,E){var ia,z,V,D,C,X,ha,L=a.lights,ra=a.fog;P=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&w(a,b);U.info.render.calls=0;U.info.render.vertices=0;U.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."), -a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Da);b.projectionMatrix.flattenToArray(xa);ua.multiply(b.projectionMatrix,b.matrixWorldInverse);p(ua);N(c);(this.autoClear||E)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);V=a.__webglObjects.length;for(E=0;E=0;E--)if(C=a.__webglObjects[E],C.render&&(X=C.object,ha=C.buffer,z=C.opaque))h(X),k(z.depthTest),n(z.depthWrite),t(z.polygonOffset,z.polygonOffsetFactor, -z.polygonOffsetUnits),l(b,L,ra,z,ha,X);for(E=0;E65535&&(E[v].counter+=1,w=E[v].hash+"_"+E[v].counter,k.geometryGroups[w]=== -void 0&&(k.geometryGroups[w]={faces:[],materialIndex:p,vertices:0,numMorphTargets:x})),k.geometryGroups[w].faces.push(n),k.geometryGroups[w].vertices+=t;k.geometryGroupsList=[];n=void 0;for(n in k.geometryGroups)k.geometryGroups[n].id=ja++,k.geometryGroupsList.push(k.geometryGroups[n])}for(l in f.geometryGroups)if(k=f.geometryGroups[l],!k.__webglVertexBuffer){n=k;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer= -o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){p=u=void 0;n.__webglMorphTargetsBuffers=[];u=0;for(p=n.numMorphTargets;u0||x.faceVertexUvs.length>0)k.__uvArray=new Float32Array(n*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(n*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(n*4),k.__skinVertexBArray=new Float32Array(n* -4),k.__skinIndexArray=new Float32Array(n*4),k.__skinWeightArray=new Float32Array(n*4);k.__faceArray=new Uint16Array(v*3);k.__lineArray=new Uint16Array(w*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];x=0;for(y=k.numMorphTargets;x=0;f--)h[f]===l&&h.splice(f,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&C(h.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(h=a.__webglObjects.length;e0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,fa,v));Ba&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ea,v));Ea&&xa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer), -o.bufferData(o.ARRAY_BUFFER,ma,v));Ga&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,ka,v));Ga&&ta>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,la,v));Aa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ua,v),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,v));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER, -da,v),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,$,v),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,aa,v),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,sa,v));w&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray, -delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}l.__dirtyVertices=!1;l.__dirtyMorphTargets=!1;l.__dirtyElements=!1;l.__dirtyUvs=!1;l.__dirtyNormals=!1;l.__dirtyColors=!1;l.__dirtyTangents=!1;k.attributes&&z(k)}else if(f instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){f=l;k=o.DYNAMIC_DRAW;n=E=w=w=void 0;x=f.vertices;u=f.colors;t=x.length;p=u.length;ia=f.__vertexArray;v=f.__colorArray;A=f.__dirtyColors;if(f.__dirtyVertices){for(w=0;w=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,f,h,l=a.vertices, +k=l.length,n=a.colors,u=n.length,p=a.__vertexArray,v=a.__colorArray,t=a.__sortArray,w=a.__dirtyVertices,y=a.__dirtyColors,aa=a.__webglCustomAttributesList,x;if(aa){h=0;for(e=aa.length;h=0)b&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(a.position,3,o.FLOAT,!1,0,0));else if(h.morphTargetBase){c=e.program.attributes;h.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){k= +0;var p=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;ku&&(v=t,u=n[v]);o.bindBuffer(o.ARRAY_BUFFER, +f.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[k]=u;p[v]=1;u=-1;k++}}e.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(e.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){k=0;for(n=f.__webglCustomAttributesList.length;k=0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(a[c.buffer.belongsToAttribute], +c.size,o.FLOAT,!1,0,0))}a.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglColorBuffer),o.vertexAttribPointer(a.color,3,o.FLOAT,!1,0,0));a.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglNormalBuffer),o.vertexAttribPointer(a.normal,3,o.FLOAT,!1,0,0));a.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUVBuffer),o.vertexAttribPointer(a.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv)): +o.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUV2Buffer),o.vertexAttribPointer(a.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv2)):o.disableVertexAttribArray(a.uv2));e.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexABuffer),o.vertexAttribPointer(a.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),o.vertexAttribPointer(a.skinVertexB, +4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),o.vertexAttribPointer(a.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),o.vertexAttribPointer(a.skinWeight,4,o.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(e.wireframe?(o.lineWidth(e.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),o.drawElements(o.LINES,f.__webglLineCount,o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),o.drawElements(o.TRIANGLES, +f.__webglFaceCount,o.UNSIGNED_SHORT,0)),T.info.render.calls++,T.info.render.vertices+=f.__webglFaceCount,T.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(e.linewidth),o.drawArrays(h,0,f.__webglLineCount),T.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,f.__webglParticleCount),T.info.render.calls++):h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,f.__webglVertexCount),T.info.render.calls++)}} +function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,l,k,n,p,u,v,t,w= +a.count*3;for(t=0;t=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function w(a,b){return b.z- +a.z}function z(a){var b,c,e,p=0,v,t,w,x,aa=a.lights;oa||(oa=new THREE.PerspectiveCamera(T.shadowCameraFov,T.shadowMapWidth/T.shadowMapHeight,T.shadowCameraNear,T.shadowCameraFar));b=0;for(c=aa.length;b=0;c--)a[c].object===b&&a.splice(c,1)}function P(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function F(a){if(a!==na){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO, +o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}na=a}}function Q(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,W(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,W(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,W(b.magFilter)),o.texParameteri(a, +o.TEXTURE_MIN_FILTER,W(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,ca(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,ca(b.minFilter)))}function H(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=o.createTexture(),T.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture? +o.texImage2D(o.TEXTURE_2D,0,W(a.format),a.image.width,a.image.height,0,W(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);Q(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function N(a,b){o.bindRenderbuffer(o.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER, +o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function L(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=o.createTexture(); +if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);Q(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,W(a.format),a.width,a.height,0,W(a.format),W(a.type),null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0, +f,e.__webglTexture,0);N(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),Q(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,W(a.format),a.width,a.height,0,W(a.format),W(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer), +N(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.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=qa,e=da,f=ta);b!==M&&(o.bindFramebuffer(o.FRAMEBUFFER,b),o.viewport(e,f,c,a),M=b)}function G(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP), +o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function V(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function ca(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST; +default:return o.LINEAR}}function W(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR; +case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0} +var T=this,o,Z=[],ha=null,M=null,R=-1,X=null,la=0,$=null,ma=null,na=null,ea=null,ka=null,fa=null,ia=null,ga=null,da=0,ta=0,ua=0,qa=0,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,va=new Float32Array(16),Ea=new Float32Array(16),Ca=new THREE.Vector4,Ga={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},aa=a.canvas!==void 0?a.canvas:document.createElement("canvas"), +ja=a.stencil!==void 0?a.stencil:!0,Y=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,J=a.antialias!==void 0?a.antialias:!1,O=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ra=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=aa;this.autoUpdateScene=this.autoUpdateObjects=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 oa,pa=[],a=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(a.uniforms),za=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader, +vertexShader:a.vertexShader,uniforms:ya}),Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya,morphTargets:!0});za._shadowPass=!0;Fa._shadowPass=!0;try{if(!(o=aa.getContext("experimental-webgl",{antialias:J,stencil:ja,preserveDrawingBuffer:Y})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}o.clearColor(0, +0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(O.r,O.g,O.b,ra);this.context=o;var Ha=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,U={};U.vertices=new Float32Array(16);U.faces=new Uint16Array(6);ja=0;U.vertices[ja++]=-1;U.vertices[ja++]=-1;U.vertices[ja++]=0;U.vertices[ja++]=1;U.vertices[ja++]= +1;U.vertices[ja++]=-1;U.vertices[ja++]=1;U.vertices[ja++]=1;U.vertices[ja++]=1;U.vertices[ja++]=1;U.vertices[ja++]=1;U.vertices[ja++]=0;U.vertices[ja++]=-1;U.vertices[ja++]=1;U.vertices[ja++]=0;ja=U.vertices[ja++]=0;U.faces[ja++]=0;U.faces[ja++]=1;U.faces[ja++]=2;U.faces[ja++]=0;U.faces[ja++]=2;U.faces[ja++]=3;U.vertexBuffer=o.createBuffer();U.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,U.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,U.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, +U.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,U.faces,o.STATIC_DRAW);U.program=o.createProgram();o.attachShader(U.program,V("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(U.program,V("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(U.program);U.attributes={};U.uniforms={};U.attributes.position=o.getAttribLocation(U.program,"position");U.attributes.uv=o.getAttribLocation(U.program,"uv");U.uniforms.uvOffset=o.getUniformLocation(U.program,"uvOffset");U.uniforms.uvScale= +o.getUniformLocation(U.program,"uvScale");U.uniforms.rotation=o.getUniformLocation(U.program,"rotation");U.uniforms.scale=o.getUniformLocation(U.program,"scale");U.uniforms.alignment=o.getUniformLocation(U.program,"alignment");U.uniforms.color=o.getUniformLocation(U.program,"color");U.uniforms.map=o.getUniformLocation(U.program,"map");U.uniforms.opacity=o.getUniformLocation(U.program,"opacity");U.uniforms.useScreenCoordinates=o.getUniformLocation(U.program,"useScreenCoordinates");U.uniforms.affectedByDistance= +o.getUniformLocation(U.program,"affectedByDistance");U.uniforms.screenPosition=o.getUniformLocation(U.program,"screenPosition");U.uniforms.modelViewMatrix=o.getUniformLocation(U.program,"modelViewMatrix");U.uniforms.projectionMatrix=o.getUniformLocation(U.program,"projectionMatrix");var Ra=!1;this.setSize=function(a,b){aa.width=a;aa.height=b;this.setViewport(0,0,aa.width,aa.height)};this.setViewport=function(a,b,c,e){da=a;ta=b;ua=c;qa=e;o.viewport(da,ta,ua,qa)};this.setScissor=function(a,b,c,e){o.scissor(a, +b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){O.setHex(a);ra=b;o.clearColor(O.r,O.g,O.b,ra)};this.setClearColor=function(a,b){O.copy(a);ra=b;o.clearColor(O.r,O.g,O.b,ra)};this.getClearColor=function(){return O};this.getClearAlpha=function(){return ra};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)}; +this.getContext=function(){return o};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];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer); +o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer);o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal); +w.tangent>=0&&o.enableVertexAttribArray(w.tangent);a.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(a.attributes)for(h in a.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h=0&&(o.enableVertexAttribArray(w[y]), +a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){L(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){z(a,b)};this.render=function(a,b,c,e){var aa,Y,ja,A,D,J,ga,K=a.lights,ra=a.fog;R=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&z(a,b);T.info.render.calls=0;T.info.render.vertices=0;T.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."), +a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ea);b.projectionMatrix.flattenToArray(va);Da.multiply(b.projectionMatrix,b.matrixWorldInverse);u(Da);L(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);ja=a.__webglObjects.length;for(e=0;e=0;e--)if(D=a.__webglObjects[e],D.render&&(J=D.object,ga=D.buffer,Y=D.opaque))k(J),n(Y.depthTest),p(Y.depthWrite),t(Y.polygonOffset,Y.polygonOffsetFactor, +Y.polygonOffsetUnits),f(b,K,ra,Y,ga,J);for(e=0;e65535&&(y[w].counter+=1,x=y[w].hash+"_"+y[w].counter,n.geometryGroups[x]=== +void 0&&(n.geometryGroups[x]={faces:[],materialIndex:t,vertices:0,numMorphTargets:aa})),n.geometryGroups[x].faces.push(p),n.geometryGroups[x].vertices+=u;n.geometryGroupsList=[];p=void 0;for(p in n.geometryGroups)n.geometryGroups[p].id=la++,n.geometryGroupsList.push(n.geometryGroups[p])}for(l in k.geometryGroups)if(n=k.geometryGroups[l],!n.__webglVertexBuffer){p=n;p.__webglVertexBuffer=o.createBuffer();p.__webglNormalBuffer=o.createBuffer();p.__webglTangentBuffer=o.createBuffer();p.__webglColorBuffer= +o.createBuffer();p.__webglUVBuffer=o.createBuffer();p.__webglUV2Buffer=o.createBuffer();p.__webglSkinVertexABuffer=o.createBuffer();p.__webglSkinVertexBBuffer=o.createBuffer();p.__webglSkinIndicesBuffer=o.createBuffer();p.__webglSkinWeightsBuffer=o.createBuffer();p.__webglFaceBuffer=o.createBuffer();p.__webglLineBuffer=o.createBuffer();if(p.numMorphTargets){t=v=void 0;p.__webglMorphTargetsBuffers=[];v=0;for(t=p.numMorphTargets;v0||aa.faceVertexUvs.length>0)n.__uvArray=new Float32Array(p*2);if(aa.faceUvs.length>1||aa.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(p*2)}if(t.geometry.skinWeights.length&&t.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(p*4),n.__skinVertexBArray= +new Float32Array(p*4),n.__skinIndexArray=new Float32Array(p*4),n.__skinWeightArray=new Float32Array(p*4);n.__faceArray=new Uint16Array(w*3);n.__lineArray=new Uint16Array(x*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];aa=0;for(Y=n.numMorphTargets;aa=0;k--)h[k]===l&&h.splice(k,1)}else(f instanceof THREE.MarchingCubes|| +f.immediateRenderCallback)&&K(h.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,fa,w));Ha&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ia,w));Ea&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,oa,w));Fa&&ta>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,na,w)); +Fa&&Z>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ka,w));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,za,w),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,w));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,$,w),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,qa,w),o.bindBuffer(o.ARRAY_BUFFER, +t.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ca,w),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ha,w));x&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}l.__dirtyVertices=!1;l.__dirtyMorphTargets= +!1;l.__dirtyElements=!1;l.__dirtyUvs=!1;l.__dirtyNormals=!1;l.__dirtyColors=!1;l.__dirtyTangents=!1;k.attributes&&D(k)}else if(n instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){k=l;n=o.DYNAMIC_DRAW;p=y=x=x=void 0;aa=k.vertices;v=k.colors;u=aa.length;t=v.length;z=k.__vertexArray;w=k.__colorArray;ja=k.__dirtyColors;if(k.__dirtyVertices){for(x=0;x1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=h;c.v=f;return c}}; THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -THREE.GeometryUtils={merge:function(a,c){for(var b,e,l=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,h=a.vertices,k=f.vertices,n=a.faces,t=f.faces,p=a.faceVertexUvs[0],v=f.faceVertexUvs[0],x={},u=0;u1&&(e=1-e,l=1-l);f=1-e-l;h.copy(a);h.multiplyScalar(e);k.copy(c);k.multiplyScalar(l);h.addSelf(k);k.copy(b);k.multiplyScalar(f);h.addSelf(k);return h},randomPointInFace:function(a,c,b){var e,l,f;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,l=c.vertices[a.b].position, f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,l,f);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;l=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,h;b?a._area1&&a._area2?(b=a._area1,h=a._area2):(b=THREE.GeometryUtils.triangleArea(e,l,c),h=THREE.GeometryUtils.triangleArea(l,f,c),a._area1=b,a._area2=h):(b=THREE.GeometryUtils.triangleArea(e,l,c),h=THREE.GeometryUtils.triangleArea(l,f,c));return THREE.GeometryUtils.random()*(b+ -h)a?b(c,h-1):t[h]a?b(c,f-1):p[f]0?(h=b[b.length-1],u=h.x,y=h.y):(h=this.actions[e-1].args,u=h[h.length-2],y=h[h.length-1]);for(h=1;h<=a;h++)w=h/a,f=THREE.Shape.Utils.b2(w,u,v,k),w=THREE.Shape.Utils.b2(w,y,x, -n),b.push(new THREE.Vector2(f,w));break;case THREE.PathActions.BEZIER_CURVE_TO:k=f[4];n=f[5];v=f[0];x=f[1];t=f[2];p=f[3];b.length>0?(h=b[b.length-1],u=h.x,y=h.y):(h=this.actions[e-1].args,u=h[h.length-2],y=h[h.length-1]);for(h=1;h<=a;h++)w=h/a,f=THREE.Shape.Utils.b3(w,u,v,t,k),w=THREE.Shape.Utils.b3(w,y,x,p,n),b.push(new THREE.Vector2(f,w));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];w=a*f[0].length;h=h.concat(f[0]);f=new THREE.SplineCurve(h); -for(h=1;h<=w;h++)b.push(f.getPointAt(h/w));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;k=f[0];n=f[1];t=f[2];v=f[3];w=f[4];x=!!f[5];p=h[h.length-2];u=h[h.length-1];h.length==0&&(p=u=0);y=w-v;var A=a*2;for(h=1;h<=A;h++)w=h/A,x||(w=1-w),w=v+w*y,f=p+k+t*Math.cos(w),w=u+n+t*Math.sin(w),b.push(new THREE.Vector2(f,w))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)}; -THREE.Path.prototype.nltransform=function(a,c,b,e,l,f){var h=this.getPoints(),k,n,t,p,v;k=0;for(n=h.length;k0?(h=b[b.length-1],v=h.x,x=h.y):(h=this.actions[e-1].args,v=h[h.length-2],x=h[h.length-1]);for(h=1;h<=a;h++)w=h/a,f=THREE.Shape.Utils.b2(w,v,u,k),w=THREE.Shape.Utils.b2(w,x,y, +n),b.push(new THREE.Vector2(f,w));break;case THREE.PathActions.BEZIER_CURVE_TO:k=f[4];n=f[5];u=f[0];y=f[1];p=f[2];t=f[3];b.length>0?(h=b[b.length-1],v=h.x,x=h.y):(h=this.actions[e-1].args,v=h[h.length-2],x=h[h.length-1]);for(h=1;h<=a;h++)w=h/a,f=THREE.Shape.Utils.b3(w,v,u,p,k),w=THREE.Shape.Utils.b3(w,x,y,t,n),b.push(new THREE.Vector2(f,w));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];w=a*f[0].length;h=h.concat(f[0]);f=new THREE.SplineCurve(h); +for(h=1;h<=w;h++)b.push(f.getPointAt(h/w));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;k=f[0];n=f[1];p=f[2];u=f[3];w=f[4];y=!!f[5];t=h[h.length-2];v=h[h.length-1];h.length==0&&(t=v=0);x=w-u;var z=a*2;for(h=1;h<=z;h++)w=h/z,y||(w=1-w),w=u+w*x,f=t+k+p*Math.cos(w),w=v+n+p*Math.sin(w),b.push(new THREE.Vector2(f,w))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)}; +THREE.Path.prototype.nltransform=function(a,c,b,e,l,f){var h=this.getPoints(),k,n,p,t,u;k=0;for(n=h.length;k=0?k-1:b.length-1;f=h-1>=0?h-1:t.length-1;var w=[t[h],b[k],b[l]];v=THREE.FontUtils.Triangulate.area(w);var A=[t[h],t[f],b[k]];x=THREE.FontUtils.Triangulate.area(A);u=k;p=h;k+=1;h+=-1;k< -0&&(k+=b.length);k%=b.length;h<0&&(h+=t.length);h%=t.length;l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:t.length-1;w=[t[h],b[k],b[l]];w=THREE.FontUtils.Triangulate.area(w);A=[t[h],t[f],b[k]];A=THREE.FontUtils.Triangulate.area(A);v+x>w+A&&(k=u,h=p,k<0&&(k+=b.length),k%=b.length,h<0&&(h+=t.length),h%=t.length,l=k-1>=0?k-1:b.length-1,f=h-1>=0?h-1:t.length-1);v=b.slice(0,k);x=b.slice(k);u=t.slice(h);p=t.slice(0,h);f=[t[h],t[f],b[k]];y.push([t[h],b[k],b[l]]);y.push(f);b=v.concat(u).concat(p).concat(x)}return{shape:b, -isolatedPts:y,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,l=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,h,k,n,t={};f=0;for(h=e.length;f=0?k-1:b.length-1;f=h-1>=0?h-1:p.length-1;var w=[p[h],b[k],b[l]];u=THREE.FontUtils.Triangulate.area(w);var z=[p[h],p[f],b[k]];y=THREE.FontUtils.Triangulate.area(z);v=k;t=h;k+=1;h+=-1;k< +0&&(k+=b.length);k%=b.length;h<0&&(h+=p.length);h%=p.length;l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:p.length-1;w=[p[h],b[k],b[l]];w=THREE.FontUtils.Triangulate.area(w);z=[p[h],p[f],b[k]];z=THREE.FontUtils.Triangulate.area(z);u+y>w+z&&(k=v,h=t,k<0&&(k+=b.length),k%=b.length,h<0&&(h+=p.length),h%=p.length,l=k-1>=0?k-1:b.length-1,f=h-1>=0?h-1:p.length-1);u=b.slice(0,k);y=b.slice(k);v=p.slice(h);t=p.slice(0,h);f=[p[h],p[f],b[k]];x.push([p[h],b[k],b[l]]);x.push(f);b=u.concat(v).concat(t).concat(y)}return{shape:b, +isolatedPts:x,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,l=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,h,k,n,p={};f=0;for(h=e.length;f1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+u),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=l[0]+(f[0]-l[0])*e,b.y=l[1]+(f[1]-l[1])*e,b.z=l[2]+(f[2]-l[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",u,h.index-1).pos,this.points[1]=l,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos,e=e*0.33+0.33,l=this.interpolateCatmullRom(this.points,e),b.x=l[0],b.y=l[1],b.z=l[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(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b=== -"rot")THREE.Quaternion.slerp(l,f,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=l[0]+(f[0]-l[0])*e,b.y=l[1]+(f[1]-l[1])*e,b.z=l[2]+(f[2]-l[2])*e}}if(this.JITCompile&&p[0][t]===void 0){this.hierarchy[0].update(null,!0);for(u=0;ua.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];k=a[b[1]];n=a[b[2]];t=a[b[3]];b=l*l;h=l*b;e[0]=this.interpolate(f[0],k[0],n[0],t[0],l,b,h);e[1]=this.interpolate(f[1],k[1],n[1],t[1],l,b,h);e[2]=this.interpolate(f[2],k[2],n[2],t[2],l,b,h);return e}; +THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,l,f,h,k,n,p,t=this.data.JIT.hierarchy,u,y;this.currentTime+=a*this.timeScale;y=this.currentTime;u=this.currentTime%=this.data.length;p=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,x=this.hierarchy.length;v1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+v),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=l[0]+(f[0]-l[0])*e,b.y=l[1]+(f[1]-l[1])*e,b.z=l[2]+(f[2]-l[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +this.getPrevKeyWith("pos",v,h.index-1).pos,this.points[1]=l,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",v,k.index+1).pos,e=e*0.33+0.33,l=this.interpolateCatmullRom(this.points,e),b.x=l[0],b.y=l[1],b.z=l[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(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b=== +"rot")THREE.Quaternion.slerp(l,f,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=l[0]+(f[0]-l[0])*e,b.y=l[1]+(f[1]-l[1])*e,b.z=l[2]+(f[2]-l[2])*e}}if(this.JITCompile&&t[0][p]===void 0){this.hierarchy[0].update(null,!0);for(v=0;va.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];k=a[b[1]];n=a[b[2]];p=a[b[3]];b=l*l;h=l*b;e[0]=this.interpolate(f[0],k[0],n[0],p[0],l,b,h);e[1]=this.interpolate(f[1],k[1],n[1],p[1],l,b,h);e[2]=this.interpolate(f[2],k[2],n[2],p[2],l,b,h);return e}; THREE.Animation.prototype.interpolate=function(a,c,b,e,l,f,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*f+a*l+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]}; THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position= @@ -445,7 +446,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()}; THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1}; THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1}; -THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor= +THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor= 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward= !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown= function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp= @@ -453,16 +454,16 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37: this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);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,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.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*b;this.lookVertical&&(this.lat-=this.mouseY*b*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;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.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",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)}; -THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function l(a,b,c,e){var h={name:c,fps:0.6,length:e,hierarchy:[]},f,l=b.getControlPointsArray(),k=b.getLength(),A=l.length,B=0;f=A-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:l[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:e,pos:l[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f=0?a:a+h;c=this.verticalAngleMap.srcRange; a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var e=a[1]-a[0];this.phi=b((c-a[0])/e)*e+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);e=a[1]-a[0];this.theta=b((c-a[0])/e)*e+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove= function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}), c=new THREE.CubeGeometry(10,10,20),h=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(h,b);a.position.set(0,10,0);this.animation=l(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=l(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a= this.debugPath,b=this.spline,c=f(b,10),h=f(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);h=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i0||this.autoForward&&!(n<0)?1:n));this.object.translateX(c*t);this.object.translateY(c*p);h&&(this.roll+=this.rollSpeed*a*k);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(c*p);this.object.translateY(c*t);h&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y1?e.normalize():e.z=Math.sqrt(1-f*f);h.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(e.y);f.addSelf(b.object.up.clone().crossSelf(h).setLength(e.x));f.addSelf(h.setLength(e.z));return f};this.rotateCamera=function(){var a=Math.acos(k.dot(n)/k.length()/n.length());if(a){var c=(new THREE.Vector3).cross(k,n).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(h); -e.multiplyVector3(b.object.up);e.multiplyVector3(n);b.staticMoving?k=n:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(p.y-t.y)*b.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),b.staticMoving?t=p:t.y+=(p.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=x.clone().subSelf(v);if(a.lengthSq()){a.multiplyScalar(h.length()*b.panSpeed);var c=h.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y)); -b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?v=x:v.addSelf(a.sub(x,v).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),h.lengthSq()0&&(h.multiplyScalar(a),b.staticMoving?p=t:p.y+=(t.y-p.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=y.clone().subSelf(u);if(a.lengthSq()){a.multiplyScalar(h.length()*b.panSpeed);var c=h.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y)); +b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?u=y:u.addSelf(a.sub(y,u).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),h.lengthSq()0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,h,0)));for(k=0;k0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-h,0)));for(k=0;k0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,h,0)));for(k=0;k0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-h,0)));for(k=0;ka&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(l).addSelf(k).subSelf(a).clone()}function l(a){for(M=a.length;--M>=0;){ea=M;aa=M-1;aa<0&&(aa=a.length- -1);for(var b=0,c=u+p*2,b=0;b=0;Z--){$=Z/p;U=n*(1-$);$=t*Math.sin($*Math.PI/2);M=0;for(G=D.length;Ma&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(k).addSelf(l).subSelf(a).clone()}function l(a){for(L=a.length;--L>=0;){la=L;$=L-1;$<0&&($=a.length- +1);for(var b=0,c=v+t*2,b=0;b=0;V--){ca=V/t;W=n*(1-ca);ca=p*Math.sin(ca*Math.PI/2);L=0;for(G=C.length;L0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,k,x)))-1);t.push(p)}c.push(t)}for(var u,y,w,l=c.length,b=0;b0)for(e=0;e1&&(u= -this.vertices[h].position.clone(),y=this.vertices[n].position.clone(),w=this.vertices[t].position.clone(),u.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,n,t,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([p,v,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry; +THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,l=Math.PI,f=Math.max(3,c||8),h=Math.max(2,b||6),c=[],b=0;b0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,k,y)))-1);p.push(t)}c.push(p)}for(var v,x,w,l=c.length,b=0;b0)for(e=0;e1&&(v= +this.vertices[h].position.clone(),x=this.vertices[n].position.clone(),w=this.vertices[p].position.clone(),v.normalize(),x.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([t,u,z]))}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,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};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,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c= -this.getFace(),b=this.size/c.resolution,e=0,l=String(a).split(""),f=l.length,h=[],a=0;a0)for(t=0;t2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return f}n=t;l<=n&&(n=0);t=n+1;l<=t&&(t=0);p=t+1;l<=p&&(p=0);var x;a:{x=a;var u=n,y=t,w=p,A=l,B=h,D=void 0,z=void 0,C=void 0, -L=void 0,H=void 0,I=void 0,R=void 0,K=void 0,N=void 0,z=x[B[u]].x,C=x[B[u]].y,L=x[B[y]].x,H=x[B[y]].y,I=x[B[w]].x,R=x[B[w]].y;if(1.0E-10>(L-z)*(R-C)-(H-C)*(I-z))x=!1;else{for(D=0;D=0&&Z>=0&&U>=0){x=!1;break a}}x= -!0}}if(x){f.push([a[h[n]],a[h[t]],a[h[p]]]);k.push([h[n],h[t],h[p]]);n=t;for(p=t+1;p0)for(p=0;p2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return f}n=p;l<=n&&(n=0);p=n+1;l<=p&&(p=0);t=p+1;l<=t&&(t=0);var y;a:{y=a;var v=n,x=p,w=t,z=l,B=h,C=void 0,A=void 0,D=void 0, +K=void 0,P=void 0,F=void 0,Q=void 0,H=void 0,N=void 0,A=y[B[v]].x,D=y[B[v]].y,K=y[B[x]].x,P=y[B[x]].y,F=y[B[w]].x,Q=y[B[w]].y;if(1.0E-10>(K-A)*(Q-D)-(P-D)*(F-A))y=!1;else{for(C=0;C=0&&V>=0&&W>=0){y=!1;break a}}y= +!0}}if(y){f.push([a[h[n]],a[h[p]],a[h[t]]]);k.push([h[n],h[p],h[t]]);n=p;for(t=p+1;t0;)this.smooth(a)}; -THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,n){var p=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(h.useOldVertexColors){p.vertexColors=[];for(var t,u,v,w=0;w<4;w++){v=n[w];t=new THREE.Color;t.setRGB(0,0,0);for(var y=0;y>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 k(a,b){var c=p(a,b),e=p(a,b+1),f=p(a,b+2);return(p(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=p(a,b);return(p(a,b+1)<<8)+c}function t(a,b){var c=p(a,b);return c>127?c-256:c}function p(a,b){return a.charCodeAt(b)&255}function v(b){var c, -e,f;c=k(a,b);e=k(a,b+H);f=k(a,b+I);b=l(a,b+R);B.faces.push(new THREE.Face3(c,e,f,null,null,b))}function x(b){var c,e,f,h,o,p,t;c=k(a,b);e=k(a,b+H);f=k(a,b+I);h=l(a,b+R);o=k(a,b+K);p=k(a,b+N);t=k(a,b+M);var b=C[p*3],u=C[p*3+1];p=C[p*3+2];var v=C[t*3],w=C[t*3+1];t=C[t*3+2];B.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(C[o*3],C[o*3+1],C[o*3+2]),new THREE.Vector3(b,u,p),new THREE.Vector3(v,w,t)],null,h))}function u(b){var c,e,f,h;c=k(a,b);e=k(a,b+G);f=k(a,b+Z);h=k(a,b+$);b=l(a,b+U);B.faces.push(new THREE.Face4(c, -e,f,h,null,null,b))}function y(b){var c,e,f,h,p,t,u,v,w;c=k(a,b);e=k(a,b+G);f=k(a,b+Z);h=k(a,b+$);p=l(a,b+U);t=k(a,b+o);u=k(a,b+da);v=k(a,b+Y);w=k(a,b+pa);var b=C[u*3],x=C[u*3+1];u=C[u*3+2];var E=C[v*3],y=C[v*3+1];v=C[v*3+2];var ia=C[w*3],z=C[w*3+1];w=C[w*3+2];B.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(C[t*3],C[t*3+1],C[t*3+2]),new THREE.Vector3(b,x,u),new THREE.Vector3(E,y,v),new THREE.Vector3(ia,z,w)],null,p))}function w(b){var c,e,f,h;c=k(a,b);e=k(a,b+P);f=k(a,b+T);b=L[c*2];h=L[c* -2+1];c=L[e*2];var l=B.faceVertexUvs[0];e=L[e*2+1];var n=L[f*2];f=L[f*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(n,f));l.push(o)}function A(b){var c,e,f,h,l,n;c=k(a,b);e=k(a,b+ja);f=k(a,b+ea);h=k(a,b+aa);b=L[c*2];l=L[c*2+1];c=L[e*2];n=L[e*2+1];e=L[f*2];var o=B.faceVertexUvs[0];f=L[f*2+1];var p=L[h*2];h=L[h*2+1];var t=[];t.push(new THREE.UV(b,l));t.push(new THREE.UV(c,n));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,h));o.push(t)}var B=this,D=0,z,C=[],L= -[],H,I,R,K,N,M,G,Z,$,U,o,da,Y,pa,P,T,ja,ea,aa,na,ga,ca,la,fa,ka;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(B,e,b);z={signature:a.substr(D,8),header_bytes:p(a,D+8),vertex_coordinate_bytes:p(a,D+9),normal_coordinate_bytes:p(a,D+10),uv_coordinate_bytes:p(a,D+11),vertex_index_bytes:p(a,D+12),normal_index_bytes:p(a,D+13),uv_index_bytes:p(a,D+14),material_index_bytes:p(a,D+15),nvertices:k(a,D+16),nnormals:k(a,D+16+4),nuvs:k(a,D+16+8),ntri_flat:k(a,D+16+12),ntri_smooth:k(a,D+16+16),ntri_flat_uv:k(a, -D+16+20),ntri_smooth_uv:k(a,D+16+24),nquad_flat:k(a,D+16+28),nquad_smooth:k(a,D+16+32),nquad_flat_uv:k(a,D+16+36),nquad_smooth_uv:k(a,D+16+40)};D+=z.header_bytes;H=z.vertex_index_bytes;I=z.vertex_index_bytes*2;R=z.vertex_index_bytes*3;K=z.vertex_index_bytes*3+z.material_index_bytes;N=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;M=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;G=z.vertex_index_bytes;Z=z.vertex_index_bytes*2;$=z.vertex_index_bytes*3;U=z.vertex_index_bytes* -4;o=z.vertex_index_bytes*4+z.material_index_bytes;da=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;Y=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;pa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;P=z.uv_index_bytes;T=z.uv_index_bytes*2;ja=z.uv_index_bytes;ea=z.uv_index_bytes*2;aa=z.uv_index_bytes*3;b=z.vertex_index_bytes*3+z.material_index_bytes;ka=z.vertex_index_bytes*4+z.material_index_bytes;na=z.ntri_flat*b;ga=z.ntri_smooth*(b+ -z.normal_index_bytes*3);ca=z.ntri_flat_uv*(b+z.uv_index_bytes*3);la=z.ntri_smooth_uv*(b+z.normal_index_bytes*3+z.uv_index_bytes*3);fa=z.nquad_flat*ka;b=z.nquad_smooth*(ka+z.normal_index_bytes*4);ka=z.nquad_flat_uv*(ka+z.uv_index_bytes*4);D+=function(b){for(var e,f,l,k=z.vertex_coordinate_bytes*3,n=b+z.nvertices*k;b=0){x=n.invBindMatrices[u];o.invBindMatrix=x;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,x);o.weights=[];for(x=0;x1){n=new THREE.MeshFaceMaterial;for(j=0;j1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation, -b.scale);for(h=0;h1?c[1].substr(0,b):"0";c[1].length=0,k=f.indexOf("(")>=0,l;if(h)e=f.split("."), -f=e.shift(),e.shift();else if(k){l=f.split("(");f=l.shift();for(e=0;eb){p=o.output[n];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);b=k;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};v.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};N.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof K)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=ha[this.effect.surface.init_from]))a.map= -THREE.ImageUtils.loadTexture(Da+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Ca;return this.material=new THREE.MeshLambertMaterial(a)};M.prototype.parse=function(a){for(var b=0;b=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b>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 k(a,b){var c=t(a,b),e=t(a,b+1),f=t(a,b+2);return(t(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=t(a,b);return(t(a,b+1)<<8)+c}function p(a,b){var c=t(a,b);return c>127?c-256:c}function t(a,b){return a.charCodeAt(b)&255}function u(b){var c, +e,f;c=k(a,b);e=k(a,b+P);f=k(a,b+F);b=l(a,b+Q);B.faces.push(new THREE.Face3(c,e,f,null,null,b))}function y(b){var c,e,f,h,o,p,t;c=k(a,b);e=k(a,b+P);f=k(a,b+F);h=l(a,b+Q);o=k(a,b+H);p=k(a,b+N);t=k(a,b+L);var b=D[p*3],u=D[p*3+1];p=D[p*3+2];var v=D[t*3],w=D[t*3+1];t=D[t*3+2];B.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(D[o*3],D[o*3+1],D[o*3+2]),new THREE.Vector3(b,u,p),new THREE.Vector3(v,w,t)],null,h))}function v(b){var c,e,f,h;c=k(a,b);e=k(a,b+G);f=k(a,b+V);h=k(a,b+ca);b=l(a,b+W);B.faces.push(new THREE.Face4(c, +e,f,h,null,null,b))}function x(b){var c,e,f,h,p,t,u,v,w;c=k(a,b);e=k(a,b+G);f=k(a,b+V);h=k(a,b+ca);p=l(a,b+W);t=k(a,b+T);u=k(a,b+o);v=k(a,b+Z);w=k(a,b+ha);var b=D[u*3],x=D[u*3+1];u=D[u*3+2];var y=D[v*3],ja=D[v*3+1];v=D[v*3+2];var Y=D[w*3],J=D[w*3+1];w=D[w*3+2];B.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(D[t*3],D[t*3+1],D[t*3+2]),new THREE.Vector3(b,x,u),new THREE.Vector3(y,ja,v),new THREE.Vector3(Y,J,w)],null,p))}function w(b){var c,e,f,h;c=k(a,b);e=k(a,b+M);f=k(a,b+R);b=K[c*2];h=K[c* +2+1];c=K[e*2];var l=B.faceVertexUvs[0];e=K[e*2+1];var n=K[f*2];f=K[f*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(n,f));l.push(o)}function z(b){var c,e,f,h,l,n;c=k(a,b);e=k(a,b+X);f=k(a,b+la);h=k(a,b+$);b=K[c*2];l=K[c*2+1];c=K[e*2];n=K[e*2+1];e=K[f*2];var o=B.faceVertexUvs[0];f=K[f*2+1];var p=K[h*2];h=K[h*2+1];var t=[];t.push(new THREE.UV(b,l));t.push(new THREE.UV(c,n));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,h));o.push(t)}var B=this,C=0,A,D=[],K=[], +P,F,Q,H,N,L,G,V,ca,W,T,o,Z,ha,M,R,X,la,$,ma,na,ea,ka,fa,ia;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(B,e,b);A={signature:a.substr(C,8),header_bytes:t(a,C+8),vertex_coordinate_bytes:t(a,C+9),normal_coordinate_bytes:t(a,C+10),uv_coordinate_bytes:t(a,C+11),vertex_index_bytes:t(a,C+12),normal_index_bytes:t(a,C+13),uv_index_bytes:t(a,C+14),material_index_bytes:t(a,C+15),nvertices:k(a,C+16),nnormals:k(a,C+16+4),nuvs:k(a,C+16+8),ntri_flat:k(a,C+16+12),ntri_smooth:k(a,C+16+16),ntri_flat_uv:k(a, +C+16+20),ntri_smooth_uv:k(a,C+16+24),nquad_flat:k(a,C+16+28),nquad_smooth:k(a,C+16+32),nquad_flat_uv:k(a,C+16+36),nquad_smooth_uv:k(a,C+16+40)};C+=A.header_bytes;P=A.vertex_index_bytes;F=A.vertex_index_bytes*2;Q=A.vertex_index_bytes*3;H=A.vertex_index_bytes*3+A.material_index_bytes;N=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;L=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;G=A.vertex_index_bytes;V=A.vertex_index_bytes*2;ca=A.vertex_index_bytes*3;W=A.vertex_index_bytes* +4;T=A.vertex_index_bytes*4+A.material_index_bytes;o=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;Z=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;ha=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;M=A.uv_index_bytes;R=A.uv_index_bytes*2;X=A.uv_index_bytes;la=A.uv_index_bytes*2;$=A.uv_index_bytes*3;b=A.vertex_index_bytes*3+A.material_index_bytes;ia=A.vertex_index_bytes*4+A.material_index_bytes;ma=A.ntri_flat*b;na=A.ntri_smooth*(b+A.normal_index_bytes* +3);ea=A.ntri_flat_uv*(b+A.uv_index_bytes*3);ka=A.ntri_smooth_uv*(b+A.normal_index_bytes*3+A.uv_index_bytes*3);fa=A.nquad_flat*ia;b=A.nquad_smooth*(ia+A.normal_index_bytes*4);ia=A.nquad_flat_uv*(ia+A.uv_index_bytes*4);C+=function(b){for(var e,f,k,l=A.vertex_coordinate_bytes*3,n=b+A.nvertices*l;b=0){x=n.invBindMatrices[u];o.invBindMatrix=x;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,x);o.weights=[];for(x=0;x1){n=new THREE.MeshFaceMaterial;for(j=0;j1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation, +b.scale);for(h=0;h1?c[1].substr(0,b):"0";c[1].length=0,k=f.indexOf("(")>=0,l;if(h)e=f.split("."),f=e.shift(),e.shift();else if(k){l=f.split("(");f=l.shift(); +for(e=0;eb){p=o.output[n];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);b=k;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};u.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};N.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof H)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=ga[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(va+e.init_from), +a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Ga;return this.material=new THREE.MeshLambertMaterial(a)};L.prototype.parse=function(a){for(var b=0;b=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b1&&(N=new THREE.MeshFaceMaterial);object=new THREE.Mesh(H,N);object.name=u;object.position.set(z[0],z[1],z[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;Y.scene.add(object);Y.objects[u]=object;D.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),Y.scene.collisions.colliders.push(a));if(D.castsShadow)a= -new THREE.ShadowVolume(H),Y.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(a={type:D.trigger,object:D},Y.triggers[object.name]=a)}}else z=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(z[0],z[1],z[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible= -D.visible!==void 0?D.visible:!1,Y.scene.add(object),Y.objects[u]=object,Y.empties[u]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(a={type:D.trigger,object:D},Y.triggers[object.name]=a)}function n(a){return function(c){Y.geometries[a]=c;k();$-=1;b.onLoadComplete();p()}}function t(a){return function(b){Y.geometries[a]=b}}function p(){b.callbackProgress({totalModels:o,totalTextures:da,loadedModels:o-$,loadedTextures:da-U},Y);b.onLoadProgress();$==0&&U==0&&c(Y)}var v,x,u,y,w,A,B,D,z,C,L,H,I,R, -K,N,M,G,Z,$,U,o,da,Y;G=a.data;K=new THREE.BinaryLoader;Z=new THREE.JSONLoader;U=$=0;Y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in G.objects)if(D=G.objects[u],D.meshCollider){a=!0;break}if(a)Y.scene.collisions=new THREE.CollisionSystem;if(G.transform){a=G.transform.position;C=G.transform.rotation;var pa=G.transform.scale;a&&Y.scene.position.set(a[0],a[1],a[2]);C&&Y.scene.rotation.set(C[0],C[1],C[2]);pa&& -Y.scene.scale.set(pa[0],pa[1],pa[2]);(a||C||pa)&&Y.scene.updateMatrix()}a=function(){U-=1;p();b.onLoadComplete()};for(w in G.cameras)C=G.cameras[w],C.type=="perspective"?I=new THREE.PerspectiveCamera(C.fov,C.aspect,C.near,C.far):C.type=="ortho"&&(I=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far)),z=C.position,C=C.target,I.position.set(z[0],z[1],z[2]),I.target=new THREE.Vector3(C[0],C[1],C[2]),Y.cameras[w]=I;for(y in G.lights)w=G.lights[y],I=w.color!==void 0?w.color:16777215, -C=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(z=w.direction,M=new THREE.DirectionalLight(I,C),M.position.set(z[0],z[1],z[2]),M.position.normalize()):w.type=="point"?(z=w.position,d=w.distance,M=new THREE.PointLight(I,C,d),M.position.set(z[0],z[1],z[2])):w.type=="ambient"&&(M=new THREE.AmbientLight(I)),Y.scene.add(M),Y.lights[y]=M;for(A in G.fogs)y=G.fogs[A],y.type=="linear"?R=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(R=new THREE.FogExp2(0,y.density)),C=y.color,R.color.setRGB(C[0], -C[1],C[2]),Y.fogs[A]=R;if(Y.cameras&&G.defaults.camera)Y.currentCamera=Y.cameras[G.defaults.camera];if(Y.fogs&&G.defaults.fog)Y.scene.fog=Y.fogs[G.defaults.fog];C=G.defaults.bgcolor;Y.bgColor=new THREE.Color;Y.bgColor.setRGB(C[0],C[1],C[2]);Y.bgColorAlpha=G.defaults.bgalpha;for(v in G.geometries)if(A=G.geometries[v],A.type=="bin_mesh"||A.type=="ascii_mesh")$+=1,b.onLoadStart();o=$;for(v in G.geometries)A=G.geometries[v],A.type=="cube"?(H=new THREE.CubeGeometry(A.width,A.height,A.depth,A.segmentsWidth, -A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),Y.geometries[v]=H):A.type=="plane"?(H=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),Y.geometries[v]=H):A.type=="sphere"?(H=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),Y.geometries[v]=H):A.type=="cylinder"?(H=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),Y.geometries[v]=H):A.type=="torus"?(H=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,A.segmentsT),Y.geometries[v]= -H):A.type=="icosahedron"?(H=new THREE.IcosahedronGeometry(A.subdivisions),Y.geometries[v]=H):A.type=="bin_mesh"?K.load(e(A.url,G.urlBaseType),n(v)):A.type=="ascii_mesh"?Z.load(e(A.url,G.urlBaseType),n(v)):A.type=="embedded_mesh"&&(A=G.embeds[A.id])&&Z.createModel(A,t(v),"");for(B in G.textures)if(v=G.textures[B],v.url instanceof Array){U+=v.url.length;for(K=0;K1&&(N=new THREE.MeshFaceMaterial);object=new THREE.Mesh(P,N);object.name=v;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=C.visible;Z.scene.add(object);Z.objects[v]=object;C.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),Z.scene.collisions.colliders.push(a));if(C.castsShadow)a= +new THREE.ShadowVolume(P),Z.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;C.trigger&&C.trigger.toLowerCase()!="none"&&(a={type:C.trigger,object:C},Z.triggers[object.name]=a)}}else A=C.position,r=C.rotation,q=C.quaternion,s=C.scale,q=0,object=new THREE.Object3D,object.name=v,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= +C.visible!==void 0?C.visible:!1,Z.scene.add(object),Z.objects[v]=object,Z.empties[v]=object,C.trigger&&C.trigger.toLowerCase()!="none"&&(a={type:C.trigger,object:C},Z.triggers[object.name]=a)}function n(a){return function(c){Z.geometries[a]=c;k();ca-=1;b.onLoadComplete();t()}}function p(a){return function(b){Z.geometries[a]=b}}function t(){b.callbackProgress({totalModels:T,totalTextures:o,loadedModels:T-ca,loadedTextures:o-W},Z);b.onLoadProgress();ca==0&&W==0&&c(Z)}var u,y,v,x,w,z,B,C,A,D,K,P,F,Q, +H,N,L,G,V,ca,W,T,o,Z;G=a.data;H=new THREE.BinaryLoader;V=new THREE.JSONLoader;W=ca=0;Z={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(v in G.objects)if(C=G.objects[v],C.meshCollider){a=!0;break}if(a)Z.scene.collisions=new THREE.CollisionSystem;if(G.transform){a=G.transform.position;D=G.transform.rotation;var ha=G.transform.scale;a&&Z.scene.position.set(a[0],a[1],a[2]);D&&Z.scene.rotation.set(D[0],D[1],D[2]);ha&& +Z.scene.scale.set(ha[0],ha[1],ha[2]);(a||D||ha)&&Z.scene.updateMatrix()}a=function(){W-=1;t();b.onLoadComplete()};for(w in G.cameras)D=G.cameras[w],D.type=="perspective"?F=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):D.type=="ortho"&&(F=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far)),A=D.position,D=D.target,F.position.set(A[0],A[1],A[2]),F.target=new THREE.Vector3(D[0],D[1],D[2]),Z.cameras[w]=F;for(x in G.lights)w=G.lights[x],F=w.color!==void 0?w.color:16777215, +D=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(A=w.direction,L=new THREE.DirectionalLight(F,D),L.position.set(A[0],A[1],A[2]),L.position.normalize()):w.type=="point"?(A=w.position,d=w.distance,L=new THREE.PointLight(F,D,d),L.position.set(A[0],A[1],A[2])):w.type=="ambient"&&(L=new THREE.AmbientLight(F)),Z.scene.add(L),Z.lights[x]=L;for(z in G.fogs)x=G.fogs[z],x.type=="linear"?Q=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(Q=new THREE.FogExp2(0,x.density)),D=x.color,Q.color.setRGB(D[0], +D[1],D[2]),Z.fogs[z]=Q;if(Z.cameras&&G.defaults.camera)Z.currentCamera=Z.cameras[G.defaults.camera];if(Z.fogs&&G.defaults.fog)Z.scene.fog=Z.fogs[G.defaults.fog];D=G.defaults.bgcolor;Z.bgColor=new THREE.Color;Z.bgColor.setRGB(D[0],D[1],D[2]);Z.bgColorAlpha=G.defaults.bgalpha;for(u in G.geometries)if(z=G.geometries[u],z.type=="bin_mesh"||z.type=="ascii_mesh")ca+=1,b.onLoadStart();T=ca;for(u in G.geometries)z=G.geometries[u],z.type=="cube"?(P=new THREE.CubeGeometry(z.width,z.height,z.depth,z.segmentsWidth, +z.segmentsHeight,z.segmentsDepth,null,z.flipped,z.sides),Z.geometries[u]=P):z.type=="plane"?(P=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),Z.geometries[u]=P):z.type=="sphere"?(P=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),Z.geometries[u]=P):z.type=="cylinder"?(P=new THREE.CylinderGeometry(z.topRad,z.botRad,z.height,z.radSegs,z.heightSegs),Z.geometries[u]=P):z.type=="torus"?(P=new THREE.TorusGeometry(z.radius,z.tube,z.segmentsR,z.segmentsT),Z.geometries[u]= +P):z.type=="icosahedron"?(P=new THREE.IcosahedronGeometry(z.subdivisions),Z.geometries[u]=P):z.type=="bin_mesh"?H.load(e(z.url,G.urlBaseType),n(u)):z.type=="ascii_mesh"?V.load(e(z.url,G.urlBaseType),n(u)):z.type=="embedded_mesh"&&(z=G.embeds[z.id])&&V.createModel(z,p(u),"");for(B in G.textures)if(u=G.textures[B],u.url instanceof Array){W+=u.url.length;for(H=0;H=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,l=0;l<8;l++){for(var f=0,h=0;h>1^-(k&1);b[8*h+l]=f}e+=c}c=a.length-e;f=new Uint16Array(c);for(l=h=0;l=this.maxCount-3&&k(this)};this.begin= -function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;cthis.size-1&&(n=this.size-1);var x=Math.floor(t-k);x<1&&(x=1);t=Math.floor(t+k);t>this.size-1&&(t=this.size-1);var u=Math.floor(p-k);u<1&&(u=1);k=Math.floor(p+k); -k>this.size-1&&(k=this.size-1);for(var y,w,A,B,D,z;v0&&(this.field[A+y]+=B)}}};this.addPlaneX=function(a,c){var l,f,h,k,n,t=this.size,p=this.yd,v=this.zd,x=this.field,u=t*Math.sqrt(a/c);u>t&&(u=t);for(l=0;l0)for(f=0;fp&&(y=p);for(f=0;f0){n=f*v;for(l=0;lsize&&(dist=size);for(h=0;h0){n=zd*h;for(f=0;fthis.size-1&&(n=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);p=Math.floor(p+k);p>this.size-1&&(p=this.size-1);var v=Math.floor(t-k);v<1&&(v=1);k=Math.floor(t+k); +k>this.size-1&&(k=this.size-1);for(var x,w,z,B,C,A;u0&&(this.field[z+x]+=B)}}};this.addPlaneX=function(a,c){var l,f,h,k,n,p=this.size,t=this.yd,u=this.zd,y=this.field,v=p*Math.sqrt(a/c);v>p&&(v=p);for(l=0;l0)for(f=0;ft&&(x=t);for(f=0;f0){n=f*u;for(l=0;lsize&&(dist=size);for(h=0;h0){n=zd*h;for(f=0;ff?this.hits.push(l):this.hits.unshift(l),f=e;return this.hits}; THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.distc.length)return null;return c[b]}; THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,l,f=0;f=k*l))return Number.MAX_VALUE;h/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(h);k.addSelf(a.origin);Math.abs(f.x)> Math.abs(f.y)?Math.abs(f.x)>Math.abs(f.z)?(a=k.y-c.y,f=b.y-c.y,l=e.y-c.y,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,f=b.x-c.x,l=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(f.y)>Math.abs(f.z)?(a=k.x-c.x,f=b.x-c.x,l=e.x-c.x,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,f=b.x-c.x,l=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y);c=f*e-b*l;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-k*l)*c;if(!(e>=0))return Number.MAX_VALUE;c*=f*k-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return h}; THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e}; -THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,l=0,f=0,h=0,k=0,n=0,t=!0;b.origin.xc.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,t=!1,h=1);b.origin.yc.max.y&&(l=c.max.y-b.origin.y,l/=b.direction.y, -t=!1,k=1);b.origin.zc.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,t=!1,n=1);if(t)return-1;t=0;l>e&&(t=1,e=l);f>e&&(t=2,e=f);switch(t){case 0:k=b.origin.y+b.direction.y*e;if(kc.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(bc.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=b.origin.x+b.direction.x*e;if(hc.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z* +THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,l=0,f=0,h=0,k=0,n=0,p=!0;b.origin.xc.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,p=!1,h=1);b.origin.yc.max.y&&(l=c.max.y-b.origin.y,l/=b.direction.y, +p=!1,k=1);b.origin.zc.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,p=!1,n=1);if(p)return-1;p=0;l>e&&(p=1,e=l);f>e&&(p=2,e=f);switch(p){case 0:k=b.origin.y+b.direction.y*e;if(kc.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(bc.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=b.origin.x+b.direction.x*e;if(hc.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z* e;if(bc.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:h=b.origin.x+b.direction.x*e;if(hc.max.x)return Number.MAX_VALUE;k=b.origin.y+b.direction.y*e;if(kc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE}; THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq=0)return Math.abs(e)-Math.sqrt(b);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 c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c}; 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);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,l=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,h=new THREE.Matrix4,k=new THREE.Matrix4,n,t,p,v;l.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},x=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.WebGLRenderTarget(512,512,a),y=new THREE.PerspectiveCamera(53, -1,1,1E4);y.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:x},mapRight:{type:"t",value:1,texture:u}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); -var w=new THREE.Scene;w.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));w.add(y);this.setSize=function(a,e){b.call(c,a,e);x.width=a;x.height=e;u.width=a;u.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||t!==b.near||p!==b.far||v!==b.fov){n=b.aspect;t=b.near;p=b.far;v=b.fov;var D=b.projectionMatrix.clone(),z=125/30*0.5,C=z*t/125,L=t*Math.tan(v*Math.PI/360),H;h.n14=z;k.n14=-z;z=-L*n+C;H=L*n+C;D.n11=2*t/(H-z);D.n13=(H+z)/(H-z);l.projectionMatrix.copy(D);z=-L*n-C; -H=L*n-C;D.n11=2*t/(H-z);D.n13=(H+z)/(H-z);f.projectionMatrix.copy(D)}l.matrixWorld.copy(b.matrixWorld).multiplySelf(k);l.position.copy(b.position);l.near=b.near;l.far=b.far;e.call(c,a,l,x,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(h);f.position.copy(b.position);f.near=b.near;f.far=b.far;e.call(c,a,f,u,!0);w.updateMatrixWorld();e.call(c,w,y)}}; +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,l=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,h=new THREE.Matrix4,k=new THREE.Matrix4,n,p,t,u;l.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},y=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.WebGLRenderTarget(512,512,a),x=new THREE.PerspectiveCamera(53, +1,1,1E4);x.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:y},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); +var w=new THREE.Scene;w.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));w.add(x);this.setSize=function(a,e){b.call(c,a,e);y.width=a;y.height=e;v.width=a;v.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||p!==b.near||t!==b.far||u!==b.fov){n=b.aspect;p=b.near;t=b.far;u=b.fov;var C=b.projectionMatrix.clone(),A=125/30*0.5,D=A*p/125,K=p*Math.tan(u*Math.PI/360),P;h.n14=A;k.n14=-A;A=-K*n+D;P=K*n+D;C.n11=2*p/(P-A);C.n13=(P+A)/(P-A);l.projectionMatrix.copy(C);A=-K*n-D; +P=K*n-D;C.n11=2*p/(P-A);C.n13=(P+A)/(P-A);f.projectionMatrix.copy(C)}l.matrixWorld.copy(b.matrixWorld).multiplySelf(k);l.position.copy(b.position);l.near=b.near;l.far=b.far;e.call(c,a,l,y,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(h);f.position.copy(b.position);f.near=b.near;f.far=b.far;e.call(c,a,f,v,!0);w.updateMatrixWorld();e.call(c,w,x)}}; if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,l,f,h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);l=a/2;f=e};this.render=function(a,b){this.clear();h.fov=b.fov;h.aspect=0.5*b.aspect;h.near=b.near;h.far= b.far;h.updateProjectionMatrix();h.position.copy(b.position);h.target.copy(b.target);h.translateX(c.separation);h.lookAt(h.target);k.projectionMatrix=h.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,l,f);e.call(c,a,h);this.setViewport(l,0,l,f);e.call(c,a,k,!1)}}; diff --git a/build/custom/ThreeCanvas.js b/build/custom/ThreeCanvas.js index be7aa37b75ce7d1341e436dc7ec0fb2eb2081cf1..f8ea26fab6bfc8932d72a555634274b7137761fc 100644 --- a/build/custom/ThreeCanvas.js +++ b/build/custom/ThreeCanvas.js @@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b= this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,n=l*c+g*f-h*d,j=l*d+h*c-e*f,i=l*f+e*d-g*c,c=-e* c-g*d-h*f;b.x=n*l+c*-e+j*-h-i*-g;b.y=j*l+c*-g+i*-e-n*-h;b.z=i*l+c*-h+n*-g-j*-e;return b}}; -THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;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)}}; @@ -115,7 +115,7 @@ THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};thi THREE.Texture=function(a,b,c,d,f,e){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=e!==void 0?e:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1}; THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){}; THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13; -THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())}; +THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())}; THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line; THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={}; for(var c=0;c=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<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;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; diff --git a/build/custom/ThreeExtras.js b/build/custom/ThreeExtras.js index eb766a4ba8a46639099c2ccab228f96b22a6ed7c..fced11675b33185bf4aa82368a5415921ed73be5 100644 --- a/build/custom/ThreeExtras.js +++ b/build/custom/ThreeExtras.js @@ -96,7 +96,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()}; THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1}; THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1}; -THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor= +THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor= 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward= !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown= function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp= @@ -106,14 +106,14 @@ this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b) this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)}; THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function g(a,b,e,c){var f={name:e,fps:0.6,length:c,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),x=g.length,v=0;h=x-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:c,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h=0?a:a+f;e=this.verticalAngleMap.srcRange; a=this.verticalAngleMap.dstRange;e=THREE.Math.mapLinear(this.phi,e[0],e[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((e-a[0])/c)*c+a[0];e=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;e=THREE.Math.mapLinear(this.theta,e[0],e[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((e-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove= function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}), c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a= this.debugPath,b=this.spline,c=h(b,10),f=h(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);f=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;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)}}; @@ -111,7 +111,7 @@ a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a. THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial; THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){}; THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial; -THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line; +THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line; THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={}; for(var c=0;c>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+ +THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var e,h,f;if(c===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),h=a*6-e,a=c*(1-b),f=c*(1- +b*h),b=c*(1-b*(1-h)),e){case 1:this.r=f;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=f;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=f;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+ Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this}, divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)}, @@ -14,88 +14,88 @@ Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12 THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z- b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())}, 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.children)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b=0&&z>=0&&t+z<1}for(var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,i,j,m,l,k,o,t,z,y,A=[],B=0,ja=a.children.length;Ba.scale.x)return[];y={distance:B,point:a.position, -face:null,object:a};A.push(y)}else if(a instanceof THREE.Mesh){B=b(this.origin,this.direction,a.matrixWorld.getPosition());if(B===null||B>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return A;var aa,na,sa,G,M,F,H,S,C=a.geometry,Y=C.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);B=0;for(ja=C.faces.length;B0:F<0)))if(F=M.dot((new THREE.Vector3).sub(aa,H))/F,H=H.addSelf(S.multiplyScalar(F)),y instanceof THREE.Face3)c(H,aa,na,sa)&&(y={distance:this.origin.distanceTo(H),point:H,face:y, -object:a},A.push(y));else if(y instanceof THREE.Face4&&(c(H,aa,na,G)||c(H,na,sa,G)))y={distance:this.origin.distanceTo(H),point:H,face:y,object:a},A.push(y)}return A}}; -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,k,o){j=!1;b=h;c=i;e=k;f=o;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,k,o,t,z){j?(j=!1,b=hk?h>t?h:t:k>t?k:t,f=i>o?i>z?i:z:o>z?o:z):(b=hk?h>t?h>e?h:e:t>e?t:e:k>t?k>e?k:e:t>e?t:e,f=i>o?i>z?i>f?i:f:z>f?z:f:o>z?o>f?o:f:z>f?z: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.Math={clamp:function(a,b,c){return ac?c:a},clampBottom:function(a,b){return a=0&&u>=0&&m+u<1}for(var e=new THREE.Vector3,h=new THREE.Vector3,f=new THREE.Vector3,i,j,o,l,k,s,m,u,z,A=[],C=0,na=a.children.length;Ca.scale.x)return[];z={distance:C,point:a.position, +face:null,object:a};A.push(z)}else if(a instanceof THREE.Mesh){C=b(this.origin,this.direction,a.matrixWorld.getPosition());if(C===null||C>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return A;var P,ka,ra,L,W,B,I,Y,M=a.geometry,J=M.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);C=0;for(na=M.faces.length;C0:B<0)))if(B=W.dot((new THREE.Vector3).sub(P,I))/B,I=I.addSelf(Y.multiplyScalar(B)),z instanceof THREE.Face3)c(I,P,ka,ra)&&(z={distance:this.origin.distanceTo(I),point:I,face:z,object:a}, +A.push(z));else if(z instanceof THREE.Face4&&(c(I,P,ka,L)||c(I,ka,ra,L)))z={distance:this.origin.distanceTo(I),point:I,face:z,object:a},A.push(z)}return A}}; +THREE.Rectangle=function(){function a(){f=e-b;i=h-c}var b,c,e,h,f,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(f,i,k,s){j=!1;b=f;c=i;e=k;h=s;a()};this.addPoint=function(f,i){j?(j=!1,b=f,c=i,e=f,h=i):(b=bf?e:f,h=h>i?h:i);a()};this.add3Points= +function(f,i,k,s,m,u){j?(j=!1,b=fk?f>m?f:m:k>m?k:m,h=i>s?i>u?i:u:s>u?s:u):(b=fk?f>m?f>e?f:e:m>e?m:e:k>m?k>e?k:e:m>e?m:e,h=i>s?i>u?i>h?i:h:u>h?u:h:s>u?s>h?s:h:u>h?u:h);a()};this.addRectangle=function(f){j?(j=!1,b=f.getLeft(),c=f.getTop(),e=f.getRight(),h=f.getBottom()):(b=bf.getRight()?e:f.getRight(),h=h> +f.getBottom()?h:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;e+=f;h+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();e=e=0&&Math.min(h,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){j=!0;h=e=c=b=0;a()};this.isEmpty=function(){return j}}; +THREE.Math={clamp:function(a,b,c){return ac?c:a},clampBottom:function(a,b){return a=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&&j.positionScreen.z0&&F.z<1))d=sa[na]=sa[na]||new THREE.RenderableParticle,na++,aa=d,aa.x=F.x/F.w,aa.y=F.y/F.w,aa.z=F.z,aa.rotation=V.rotation.z,aa.scale.x=V.scale.x*Math.abs(aa.x-(F.x+h.projectionMatrix.n11)/(F.w+h.projectionMatrix.n14)),aa.scale.y=V.scale.y*Math.abs(aa.y-(F.y+h.projectionMatrix.n22)/(F.w+h.projectionMatrix.n24)),aa.material=V.material, -G.elements.push(aa);f&&G.elements.sort(c);return G}};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); +THREE.Projector=function(){function a(){var a=i[f]=i[f]||new THREE.RenderableObject;f++;return a}function b(){var a=l[o]=l[o]||new THREE.RenderableVertex;o++;return a}function c(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,d=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,i=-b.z+b.w;return d>=0&&f>=0&&h>=0&&i>=0?!0:d<0&&f<0||h<0&&i<0?!1:(d<0?c=Math.max(c,d/(d-f)):f<0&&(e=Math.min(e,d/(d-f))),h<0?c=Math.max(c,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),ei&&j.positionScreen.z0&&B.z<1))i=ra[ka]=ra[ka]||new THREE.RenderableParticle,ka++,P=i,P.x=B.x/B.w,P.y=B.y/B.w,P.z=B.z,P.rotation=S.rotation.z,P.scale.x=S.scale.x*Math.abs(P.x-(B.x+f.projectionMatrix.n11)/(B.w+f.projectionMatrix.n14)),P.scale.y=S.scale.y*Math.abs(P.y-(B.y+f.projectionMatrix.n22)/(B.w+ +f.projectionMatrix.n24)),P.material=S.material,L.elements.push(P);h&&L.elements.sort(c);return L}};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,h=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-h),h=Math.sin(-h),f=Math.cos(c),c=Math.sin(c),i=a*b,j=e*h;this.w=i*f-j*c;this.x=i*c+j*f;this.y=e*b*f+a*h*c;this.z=a*h*f-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,m=this.w,l=m*c+i*f-j*e,k=m*e+j*c-h*f,o=m*f+h*e-i*c,c=-h* -c-i*e-j*f;b.x=l*m+c*-h+k*-j-o*-i;b.y=k*m+c*-i+o*-h-l*-j;b.z=o*m+c*-j+l*-i-k*-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;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);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),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-e)*h)/f;e=Math.sin(e*h)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.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}; +this.x,c=this.y,e=this.z,h=this.w,f=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+h*f+c*j-e*i;this.y=c*a+h*i+e*f-b*j;this.z=e*a+h*j+b*i-c*f;this.w=h*a-b*f-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,h=a.z,f=this.x,i=this.y,j=this.z,o=this.w,l=o*c+i*h-j*e,k=o*e+j*c-f*h,s=o*h+f*e-i*c,c=-f* +c-i*e-j*h;b.x=l*o+c*-f+k*-j-s*-i;b.y=k*o+c*-i+s*-f-l*-j;b.z=s*o+c*-j+l*-i-k*-f;return b}}; +THREE.Quaternion.slerp=function(a,b,c,e){var h=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;h<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,h=-h):c.copy(b);if(Math.abs(h)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(h),h=Math.sqrt(1-h*h);if(Math.abs(h)<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;b=Math.sin((1-e)*f)/h;e=Math.sin(e*f)/h;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Face3=function(a,b,c,e,h,f){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=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3}; +THREE.Face4=function(a,b,c,e,h,f,i){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];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,b,c,e,f,h,G){j=a.vertices[b].position;o=a.vertices[c].position;l=a.vertices[e].position;k=i[f];s=i[h];m=i[G];u=o.x-j.x;z=l.x-j.x;A=o.y-j.y;C=l.y-j.y;na=o.z-j.z;P=l.z-j.z;ka=s.u-k.u;ra=m.u-k.u;L=s.v-k.v;W=m.v-k.v;B=1/(ka*W-ra*L);J.set((W*u-L*z)*B,(W*A-L*C)*B,(W*na-L*P)*B);U.set((ka*z-ra*u)*B,(ka*C-ra*A)*B,(ka*P-ra*na)*B);Y[b].addSelf(J);Y[c].addSelf(J);Y[e].addSelf(J); +M[b].addSelf(U);M[c].addSelf(U);M[e].addSelf(U)}var b,c,e,h,f,i,j,o,l,k,s,m,u,z,A,C,na,P,ka,ra,L,W,B,I,Y=[],M=[],J=new THREE.Vector3,U=new THREE.Vector3,da=new THREE.Vector3,ya=new THREE.Vector3,T=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;l=this.points[c[0]];k=this.points[c[1]]; -o=this.points[c[2]];t=this.points[c[3]];j=i*i;m=i*j;e.x=b(l.x,k.x,o.x,t.x,i,j,m);e.y=b(l.y,k.y,o.y,t.y,i,j,m);e.z=b(l.z,k.z,o.z,t.z,i,j,m);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;athis.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?f:f+1;c[3]=f>this.points.length-3?f:f+2;l=this.points[c[0]];k=this.points[c[1]]; +s=this.points[c[2]];m=this.points[c[3]];j=i*i;o=i*j;e.x=b(l.x,k.x,s.x,m.x,i,j,o);e.y=b(l.y,k.y,s.y,m.y,i,j,o);e.z=b(l.z,k.z,s.z,m.z,i,j,o);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a1){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var b=1;b=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( shadowDarkness );\n#endif\n}\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif", shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"}; -THREE.UniformsUtils={merge:function(a){var b,c,e,f={};for(b=0;b=0)return a.geometry.materials[b.materialIndex]}function c(a,b,c){var e,h,f,i=a.vertices,u=i.length,q=a.colors,r=q.length,j=a.__vertexArray,Ba=a.__colorArray,k=a.__sortArray,P=a.__dirtyVertices,m=a.__dirtyColors,l=a.__webglCustomAttributesList,o;if(l){f=0;for(e=l.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 q=i.morphTargetForcedOrder;for(u=i.morphTargetInfluences;jr&&(k=o,r=u[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=r;q[k]=1;r=-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)),E.info.render.calls++,E.info.render.vertices+=f.__webglFaceCount,E.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),E.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),E.info.render.calls++): -i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),E.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,q,r,k,o,m,l=a.count*3;for(m=0;m=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 y(a,b){return b.z-a.z}function A(a){var b,c,m,wa=0,L,l,u,q,r=a.lights;W||(W=new THREE.PerspectiveCamera(E.shadowCameraFov,E.shadowMapWidth/E.shadowMapHeight,E.shadowCameraNear,E.shadowCameraFar));b=0;for(c=r.length;b=0;d--)a[d].object===b&&a.splice(d,1)}function G(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function M(a){if(a!==pa){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)}pa=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,ia(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,ia(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,ia(b.magFilter)), -d.texParameteri(a,d.TEXTURE_MIN_FILTER,ia(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 H(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),E.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,ia(a.format),a.image.width,a.image.height,0,ia(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 S(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 C(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,ia(a.format),a.width,a.height,0,ia(a.format),ia(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);S(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,ia(a.format),a.width,a.height,0,ia(a.format),ia(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), -S(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=Ca,f=Da);b!==Xa&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),Xa=b)}function Y(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 Q(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 ia(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 E=this,d,ya=[],Va=null,Xa=null,K=-1,T=null,U=0,R=null,Z=null,pa=null,V=null,va=null,Aa=null,Ka=null,Pa=null,Ca=0,Da=0,ua=0,Ia=0,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ea=new THREE.Matrix4,Sa=new Float32Array(16),Ta=new Float32Array(16),Ha=new THREE.Vector4,Ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},za=a.canvas!==void 0?a.canvas:document.createElement("canvas"), -J=a.stencil!==void 0?a.stencil:!0,cb=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,db=a.antialias!==void 0?a.antialias:!1,$=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Fa=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=za;this.autoUpdateScene=this.autoUpdateObjects=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 W,Ra=[],a=THREE.ShaderLib.depthRGBA,ab=THREE.UniformsUtils.clone(a.uniforms),Ua=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});Ua._shadowPass=!0;Za._shadowPass=!0;try{if(!(d=za.getContext("experimental-webgl",{antialias:db,stencil:J,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($.r,$.g,$.b,Fa);this.context=d;var bb=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,p={};p.vertices=new Float32Array(16);p.faces=new Uint16Array(6);J=0;p.vertices[J++]=-1;p.vertices[J++]=-1;p.vertices[J++]=0;p.vertices[J++]=1;p.vertices[J++]=1; -p.vertices[J++]=-1;p.vertices[J++]=1;p.vertices[J++]=1;p.vertices[J++]=1;p.vertices[J++]=1;p.vertices[J++]=1;p.vertices[J++]=0;p.vertices[J++]=-1;p.vertices[J++]=1;p.vertices[J++]=0;J=p.vertices[J++]=0;p.faces[J++]=0;p.faces[J++]=1;p.faces[J++]=2;p.faces[J++]=0;p.faces[J++]=2;p.faces[J++]=3;p.vertexBuffer=d.createBuffer();p.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,p.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,p.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.elementBuffer); -d.bufferData(d.ELEMENT_ARRAY_BUFFER,p.faces,d.STATIC_DRAW);p.program=d.createProgram();d.attachShader(p.program,Q("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(p.program,Q("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(p.program);p.attributes={};p.uniforms={};p.attributes.position=d.getAttribLocation(p.program,"position");p.attributes.uv=d.getAttribLocation(p.program,"uv");p.uniforms.uvOffset=d.getUniformLocation(p.program,"uvOffset");p.uniforms.uvScale=d.getUniformLocation(p.program, -"uvScale");p.uniforms.rotation=d.getUniformLocation(p.program,"rotation");p.uniforms.scale=d.getUniformLocation(p.program,"scale");p.uniforms.alignment=d.getUniformLocation(p.program,"alignment");p.uniforms.color=d.getUniformLocation(p.program,"color");p.uniforms.map=d.getUniformLocation(p.program,"map");p.uniforms.opacity=d.getUniformLocation(p.program,"opacity");p.uniforms.useScreenCoordinates=d.getUniformLocation(p.program,"useScreenCoordinates");p.uniforms.affectedByDistance=d.getUniformLocation(p.program, -"affectedByDistance");p.uniforms.screenPosition=d.getUniformLocation(p.program,"screenPosition");p.uniforms.modelViewMatrix=d.getUniformLocation(p.program,"modelViewMatrix");p.uniforms.projectionMatrix=d.getUniformLocation(p.program,"projectionMatrix");var $a=!1;this.setSize=function(a,b){za.width=a;za.height=b;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(a,b,c,e){Ca=a;Da=b;ua=c;Ia=e;d.viewport(Ca,Da,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){$.setHex(a);Fa=b;d.clearColor($.r,$.g,$.b,Fa)};this.setClearColor=function(a,b){$.copy(a);Fa=b;d.clearColor($.r,$.g,$.b,Fa)};this.getClearColor=function(){return $};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}; +THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in e.attributes){originalAttribute=e.attributes[f];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type=== +"v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(c*size),attribute.buffer=d.createBuffer(),attribute.buffer.belongsToAttribute=f,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;a.__webglCustomAttributesList.push(attribute)}}}function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,f,h,i=a.vertices, +p=i.length,v=a.colors,q=v.length,j=a.__vertexArray,k=a.__colorArray,o=a.__sortArray,R=a.__dirtyVertices,l=a.__dirtyColors,s=a.__webglCustomAttributesList,m;if(s){h=0;for(e=s.length;h=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer), +d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=e.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(p=i.morphTargetInfluences;jq&&(k=o,q=p[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++}}e.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(e.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(p=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));e.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?(e.wireframe?(d.lineWidth(e.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)),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(e.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 i(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,q,k,o,l,s=a.count*3;for(l=0;l=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,e,k=0,Q,l,p,v,q=a.lights;la||(la=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 W(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function B(a){if(a!==S){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)}S=a}}function I(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,T(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,T(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,T(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,T(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,ya(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,ya(b.minFilter)))}function Y(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,T(a.format),a.image.width,a.image.height,0,T(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE, +a.image);I(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 J(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);I(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,T(a.format),a.width,a.height,0,T(a.format),T(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),I(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,T(a.format),a.width,a.height,0,T(a.format),T(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=Ta,a=Pa,e=za,f=wa);b!==V&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),V=b)}function U(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 da(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 ya(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function T(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 G=this,d,Ea=[],Xa= +null,V=null,Z=-1,D=null,ta=0,$=null,sa=null,S=null,va=null,xa=null,Ia=null,Qa=null,Fa=null,za=0,wa=0,Ta=0,Pa=0,ja=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,Ua=new Float32Array(16),Va=new Float32Array(16),Ga=new THREE.Vector4,Za={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"), +N=a.stencil!==void 0?a.stencil:!0,db=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,eb=a.antialias!==void 0?a.antialias:!1,aa=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Ca=a.clearAlpha!==void 0?a.clearAlpha:0,Ya=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.autoUpdateScene=this.autoUpdateObjects=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 la,Sa=[],a=THREE.ShaderLib.depthRGBA,bb=THREE.UniformsUtils.clone(a.uniforms),Wa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader, +vertexShader:a.vertexShader,uniforms:bb}),$a=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:bb,morphTargets:!0});Wa._shadowPass=!0;$a._shadowPass=!0;try{if(!(d=Ba.getContext("experimental-webgl",{antialias:eb,stencil:N,preserveDrawingBuffer:db})))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(fb){console.error(fb)}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(aa.r,aa.g,aa.b,Ca);this.context=d;var cb=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,t={};t.vertices=new Float32Array(16);t.faces=new Uint16Array(6);N=0;t.vertices[N++]=-1;t.vertices[N++]=-1;t.vertices[N++]=0;t.vertices[N++]=1;t.vertices[N++]= +1;t.vertices[N++]=-1;t.vertices[N++]=1;t.vertices[N++]=1;t.vertices[N++]=1;t.vertices[N++]=1;t.vertices[N++]=1;t.vertices[N++]=0;t.vertices[N++]=-1;t.vertices[N++]=1;t.vertices[N++]=0;N=t.vertices[N++]=0;t.faces[N++]=0;t.faces[N++]=1;t.faces[N++]=2;t.faces[N++]=0;t.faces[N++]=2;t.faces[N++]=3;t.vertexBuffer=d.createBuffer();t.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,t.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,t.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,t.elementBuffer); +d.bufferData(d.ELEMENT_ARRAY_BUFFER,t.faces,d.STATIC_DRAW);t.program=d.createProgram();d.attachShader(t.program,da("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(t.program,da("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(t.program);t.attributes={};t.uniforms={};t.attributes.position=d.getAttribLocation(t.program,"position");t.attributes.uv=d.getAttribLocation(t.program,"uv");t.uniforms.uvOffset=d.getUniformLocation(t.program,"uvOffset");t.uniforms.uvScale=d.getUniformLocation(t.program, +"uvScale");t.uniforms.rotation=d.getUniformLocation(t.program,"rotation");t.uniforms.scale=d.getUniformLocation(t.program,"scale");t.uniforms.alignment=d.getUniformLocation(t.program,"alignment");t.uniforms.color=d.getUniformLocation(t.program,"color");t.uniforms.map=d.getUniformLocation(t.program,"map");t.uniforms.opacity=d.getUniformLocation(t.program,"opacity");t.uniforms.useScreenCoordinates=d.getUniformLocation(t.program,"useScreenCoordinates");t.uniforms.affectedByDistance=d.getUniformLocation(t.program, +"affectedByDistance");t.uniforms.screenPosition=d.getUniformLocation(t.program,"screenPosition");t.uniforms.modelViewMatrix=d.getUniformLocation(t.program,"modelViewMatrix");t.uniforms.projectionMatrix=d.getUniformLocation(t.program,"projectionMatrix");var ab=!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){za=a;wa=b;Ta=c;Pa=e;d.viewport(za,wa,Ta,Pa)};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){aa.setHex(a);Ca=b;d.clearColor(aa.r,aa.g,aa.b,Ca)};this.setClearColor=function(a,b){aa.copy(a);Ca=b;d.clearColor(aa.r,aa.g,aa.b,Ca)};this.getClearColor=function(){return aa};this.getClearAlpha=function(){return Ca};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(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[t]), -a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){C(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){A(a,b)};this.render=function(a,b,c,p){var wa,L,Qa,u,q,r,Oa,Ba=a.lights,G=a.fog;K=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&A(a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."), -a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ta);b.projectionMatrix.flattenToArray(Sa);Ea.multiply(b.projectionMatrix,b.matrixWorldInverse);k(Ea);C(c);(this.autoClear||p)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Qa=a.__webglObjects.length;for(p=0;p=0;p--)if(q=a.__webglObjects[p],q.render&&(r=q.object,Oa=q.buffer,L=q.opaque))i(r),j(L.depthTest),m(L.depthWrite),l(L.polygonOffset,L.polygonOffsetFactor, -L.polygonOffsetUnits),f(b,Ba,G,L,Oa,r);for(p=0;p65535&&(p[l].counter+=1,o=p[l].hash+"_"+p[l].counter,j.geometryGroups[o]=== -void 0&&(j.geometryGroups[o]={faces:[],materialIndex:r,vertices:0,numMorphTargets:t})),j.geometryGroups[o].faces.push(k),j.geometryGroups[o].vertices+=q;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=U++,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){r=m=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(r=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(r.geometry.skinWeights.length&&r.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(o*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)&&sa(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e0&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,ra,l));Aa&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,T,l));Ca&&ta.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,da,l));ua&&Y>0&&(d.bindBuffer(d.ARRAY_BUFFER, -r.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ia,l));ua&&Z>0&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ja,l));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,r.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ka,l),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,r.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,$,l));w>0&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,ea,l),d.bindBuffer(d.ARRAY_BUFFER,r.__webglSkinVertexBBuffer), -d.bufferData(d.ARRAY_BUFFER,fa,l),d.bindBuffer(d.ARRAY_BUFFER,r.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,ga,l),d.bindBuffer(d.ARRAY_BUFFER,r.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ha,l));o&&(delete r.__inittedArrays,delete r.__colorArray,delete r.__normalArray,delete r.__tangentArray,delete r.__uvArray,delete r.__uv2Array,delete r.__faceArray,delete r.__vertexArray,delete r.__lineArray,delete r.__skinVertexAArray,delete r.__skinVertexBArray,delete r.__skinIndexArray,delete r.__skinWeightArray)}h.__dirtyVertices= -!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyColors=!1;h.__dirtyTangents=!1;j.attributes&&na(j)}else if(i instanceof THREE.Ribbon){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=p=o=o=void 0;t=i.vertices;m=i.colors;q=t.length;r=m.length;y=i.__vertexArray;l=i.__colorArray;A=i.__dirtyColors;if(i.__dirtyVertices){for(o=0;o=0&&d.enableVertexAttribArray(m.position);m.color>=0&&d.enableVertexAttribArray(m.color);m.normal>=0&&d.enableVertexAttribArray(m.normal); +m.tangent>=0&&d.enableVertexAttribArray(m.tangent);a.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0&&(d.enableVertexAttribArray(m.skinVertexA),d.enableVertexAttribArray(m.skinVertexB),d.enableVertexAttribArray(m.skinIndex),d.enableVertexAttribArray(m.skinWeight));if(a.attributes)for(h in a.attributes)m[h]!==void 0&&m[h]>=0&&d.enableVertexAttribArray(m[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h=0&&(d.enableVertexAttribArray(m[u]), +a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){J(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){C(a,b)};this.render=function(a,b,c,e){var t,Q,Ra,p,v,q,Na,L=a.lights,Oa=a.fog;Z=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&C(a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."), +a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Va);b.projectionMatrix.flattenToArray(Ua);Aa.multiply(b.projectionMatrix,b.matrixWorldInverse);s(Aa);J(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Ra=a.__webglObjects.length;for(e=0;e=0;e--)if(v=a.__webglObjects[e],v.render&&(q=v.object,Na=v.buffer,Q=v.opaque))j(q),o(Q.depthTest),l(Q.depthWrite),k(Q.polygonOffset,Q.polygonOffsetFactor, +Q.polygonOffsetUnits),f(b,L,Oa,Q,Na,q);for(e=0;e65535&&(t[m].counter+=1,s=t[m].hash+"_"+t[m].counter,k.geometryGroups[s]=== +void 0&&(k.geometryGroups[s]={faces:[],materialIndex:q,vertices:0,numMorphTargets:u})),k.geometryGroups[s].faces.push(l),k.geometryGroups[s].vertices+=o;k.geometryGroupsList=[];l=void 0;for(l in k.geometryGroups)k.geometryGroups[l].id=ta++,k.geometryGroupsList.push(k.geometryGroups[l])}for(i in j.geometryGroups)if(k=j.geometryGroups[i],!k.__webglVertexBuffer){l=k;l.__webglVertexBuffer=d.createBuffer();l.__webglNormalBuffer=d.createBuffer();l.__webglTangentBuffer=d.createBuffer();l.__webglColorBuffer= +d.createBuffer();l.__webglUVBuffer=d.createBuffer();l.__webglUV2Buffer=d.createBuffer();l.__webglSkinVertexABuffer=d.createBuffer();l.__webglSkinVertexBBuffer=d.createBuffer();l.__webglSkinIndicesBuffer=d.createBuffer();l.__webglSkinWeightsBuffer=d.createBuffer();l.__webglFaceBuffer=d.createBuffer();l.__webglLineBuffer=d.createBuffer();if(l.numMorphTargets){q=p=void 0;l.__webglMorphTargetsBuffers=[];p=0;for(q=l.numMorphTargets;p0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(l*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(l*2)}if(q.geometry.skinWeights.length&&q.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(l*4),k.__skinVertexBArray=new Float32Array(l* +4),k.__skinIndexArray=new Float32Array(l*4),k.__skinWeightArray=new Float32Array(l*4);k.__faceArray=new Uint16Array(m*3);k.__lineArray=new Uint16Array(s*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(z=k.numMorphTargets;u=0;j--)h[j]===i&&h.splice(j,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&L(h.__webglObjectsImmediate,f); +f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,qa,m));za&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,Z,m));Aa&&ua.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,ea,m));wa&&Y>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,la,m));wa&&$>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,na,m));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER, +q.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ja,m),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,aa,m));x>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,fa,m),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,ga,m),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,ha,m),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER, +ia,m));s&&(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)}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyColors=!1;i.__dirtyTangents=!1;j.attributes&&ra(j)}else if(k instanceof +THREE.Ribbon){if(i.__dirtyVertices||i.__dirtyColors){j=i;k=d.DYNAMIC_DRAW;l=t=s=s=void 0;u=j.vertices;p=j.colors;o=u.length;q=p.length;A=j.__vertexArray;m=j.__colorArray;C=j.__dirtyColors;if(j.__dirtyVertices){for(s=0;s + + + three.js webgl - custom attributes [lines] + + + + + + +
three.js - custom attributes example
+
+ + + + + + + + + + + + + + + + + + + diff --git a/src/objects/Line.js b/src/objects/Line.js index 04270242713e43ce59e7b2a2e8acc9a2202b24e6..82bc88d61a745219202bda081513eaac4140e989 100644 --- a/src/objects/Line.js +++ b/src/objects/Line.js @@ -9,7 +9,7 @@ THREE.Line = function ( geometry, material, type ) { this.geometry = geometry; this.material = material; - this.type = ( type != undefined ) ? type : THREE.LineStrip; + this.type = ( type !== undefined ) ? type : THREE.LineStrip; if ( this.geometry ) { diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 89d6e846eb2506427736c7f0370de87c4ff7f8be..93dbdb011e0fd33e911c89ebbd19bd47af85ee2a 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -658,41 +658,10 @@ THREE.WebGLRenderer = function ( parameters ) { // - function initLineBuffers ( geometry ) { + function initCustomAttributes ( geometry, object ) { var nvertices = geometry.vertices.length; - geometry.__vertexArray = new Float32Array( nvertices * 3 ); - geometry.__colorArray = new Float32Array( nvertices * 3 ); - - geometry.__webglLineCount = nvertices; - - }; - - function initRibbonBuffers ( geometry ) { - - var nvertices = geometry.vertices.length; - - geometry.__vertexArray = new Float32Array( nvertices * 3 ); - geometry.__colorArray = new Float32Array( nvertices * 3 ); - - geometry.__webglVertexCount = nvertices; - - }; - - function initParticleBuffers ( geometry, object ) { - - var nvertices = geometry.vertices.length; - - geometry.__vertexArray = new Float32Array( nvertices * 3 ); - geometry.__colorArray = new Float32Array( nvertices * 3 ); - - geometry.__sortArray = []; - - geometry.__webglParticleCount = nvertices; - - // custom attributes - var material = object.material; if ( material.attributes ) { @@ -751,6 +720,49 @@ THREE.WebGLRenderer = function ( parameters ) { }; + // + + function initLineBuffers ( geometry, object ) { + + var nvertices = geometry.vertices.length; + + geometry.__vertexArray = new Float32Array( nvertices * 3 ); + geometry.__colorArray = new Float32Array( nvertices * 3 ); + + geometry.__webglLineCount = nvertices; + + initCustomAttributes ( geometry, object ); + + }; + + function initParticleBuffers ( geometry, object ) { + + var nvertices = geometry.vertices.length; + + geometry.__vertexArray = new Float32Array( nvertices * 3 ); + geometry.__colorArray = new Float32Array( nvertices * 3 ); + + geometry.__sortArray = []; + + geometry.__webglParticleCount = nvertices; + + initCustomAttributes ( geometry, object ); + + }; + + function initRibbonBuffers ( geometry ) { + + var nvertices = geometry.vertices.length; + + geometry.__vertexArray = new Float32Array( nvertices * 3 ); + geometry.__colorArray = new Float32Array( nvertices * 3 ); + + geometry.__webglVertexCount = nvertices; + + }; + + // + function getBufferMaterial( object, geometryGroup ) { if ( object.material && ! ( object.material instanceof THREE.MeshFaceMaterial ) ) { @@ -936,7 +948,6 @@ THREE.WebGLRenderer = function ( parameters ) { }; - function setMeshBuffers( geometryGroup, object, hint, dispose ) { if ( ! geometryGroup.__inittedArrays ) { @@ -2138,7 +2149,12 @@ THREE.WebGLRenderer = function ( parameters ) { colorArray = geometry.__colorArray, dirtyVertices = geometry.__dirtyVertices, - dirtyColors = geometry.__dirtyColors; + dirtyColors = geometry.__dirtyColors, + + customAttributes = geometry.__webglCustomAttributesList, + i, il, + a, ca, cal, value, + customAttribute; if ( dirtyVertices ) { @@ -2178,6 +2194,76 @@ THREE.WebGLRenderer = function ( parameters ) { } + if ( customAttributes ) { + + for ( i = 0, il = customAttributes.length; i < il; i ++ ) { + + customAttribute = customAttributes[ i ]; + + if ( customAttribute.__original.needsUpdate && + ( customAttribute.boundTo === undefined || + customAttribute.boundTo === "vertices" ) ) { + + offset = 0; + + cal = customAttribute.value.length; + + for ( ca = 0; ca < cal; ca ++ ) { + + if ( customAttribute.size === 1 ) { + + customAttribute.array[ offset ] = customAttribute.value[ ca ]; + + } else { + + value = customAttribute.value[ ca ]; + + if ( customAttribute.size === 2 ) { + + customAttribute.array[ offset ] = value.x; + customAttribute.array[ offset + 1 ] = value.y; + + } else if ( customAttribute.size === 3 ) { + + if ( customAttribute.type === "c" ) { + + customAttribute.array[ offset ] = value.r; + customAttribute.array[ offset + 1 ] = value.g; + customAttribute.array[ offset + 2 ] = value.b; + + + } else { + + customAttribute.array[ offset ] = value.x; + customAttribute.array[ offset + 1 ] = value.y; + customAttribute.array[ offset + 2 ] = value.z; + + } + + } else { + + customAttribute.array[ offset ] = value.x; + customAttribute.array[ offset + 1 ] = value.y; + customAttribute.array[ offset + 2 ] = value.z; + customAttribute.array[ offset + 3 ] = value.w; + + } + + } + + offset += customAttribute.size; + + } + + _gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer ); + _gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint ); + + } + + } + + } + }; function setRibbonBuffers ( geometry, hint ) { @@ -2319,7 +2405,7 @@ THREE.WebGLRenderer = function ( parameters ) { for ( ca = 0; ca < cal; ca ++ ) { - index = sortArray[ca][1]; + index = sortArray[ ca ][ 1 ]; offset_custom = customAttribute.offset; @@ -4367,7 +4453,7 @@ THREE.WebGLRenderer = function ( parameters ) { if( ! geometry.__webglVertexBuffer ) { createLineBuffers( geometry ); - initLineBuffers( geometry ); + initLineBuffers( geometry, object ); geometry.__dirtyVertices = true; geometry.__dirtyColors = true; @@ -4501,7 +4587,11 @@ THREE.WebGLRenderer = function ( parameters ) { } else if ( object instanceof THREE.Line ) { - if ( geometry.__dirtyVertices || geometry.__dirtyColors ) { + material = getBufferMaterial( object, geometryGroup ); + + customAttributesDirty = material.attributes && areCustomAttributesDirty( material ); + + if ( geometry.__dirtyVertices || geometry.__dirtyColors || customAttributesDirty ) { setLineBuffers( geometry, _gl.DYNAMIC_DRAW ); @@ -4510,6 +4600,8 @@ THREE.WebGLRenderer = function ( parameters ) { geometry.__dirtyVertices = false; geometry.__dirtyColors = false; + material.attributes && clearCustomAttributes( material ); + } else if ( object instanceof THREE.ParticleSystem ) { material = getBufferMaterial( object, geometryGroup );