From d1ae3fb45b46bb68742536cc6a474bd9233671b3 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Sat, 9 Apr 2011 08:37:28 +0100 Subject: [PATCH] Updated builds. All seems to be good again. --- build/Three.js | 709 ++++++++++++++++++------------------ build/custom/ThreeCanvas.js | 2 +- build/custom/ThreeDOM.js | 2 +- build/custom/ThreeExtras.js | 200 +++++----- build/custom/ThreeSVG.js | 2 +- build/custom/ThreeWebGL.js | 442 +++++++++++----------- 6 files changed, 689 insertions(+), 668 deletions(-) diff --git a/build/Three.js b/build/Three.js index 827faf9a91..6fd6431f3f 100755 --- a/build/Three.js +++ b/build/Three.js @@ -1,97 +1,97 @@ // Three.js r38 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(b){this.setHex(b)}; -THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,c,d){var f,g,h,j,k,m;if(d==0)f=g=h=0;else{j=Math.floor(b*6);k=b*6-j;b=d*(1-c);m=d*(1-c*k);c=d*(1-c*(1-k));switch(j){case 1:f=m;g=d;h=b;break;case 2:f=b;g=d;h=c;break;case 3:f=b;g=m;h=d;break;case 4:f=c;g=b;h=d;break;case 5:f=d;g=b; -h=m;break;case 6:case 0:f=d;g=c;h=b}}this.r=f;this.g=g;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g* -255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)}; -THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,c){this.set(b.x-c.x,b.y-c.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ -this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,c,d){this.set(b||0,c||0,d||0)}; -THREE.Vector3.prototype={set:function(b,c,d){this.x=b;this.y=c;this.z=d;return this},copy:function(b){this.set(b.x,b.y,b.z);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y,b.z+c.z);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z);return this},addScalar:function(b){this.set(this.x+b,this.y+b,this.z+b);return this},sub:function(b,c){this.set(b.x-c.x,b.y-c.y,b.z-c.z);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z);return this},cross:function(b, -c){this.set(b.y*c.z-b.z*c.y,b.z*c.x-b.x*c.z,b.x*c.y-b.y*c.x);return this},crossSelf:function(b){var c=this.x,d=this.y,f=this.z;this.set(d*b.z-f*b.y,f*b.x-c*b.z,c*b.y-d*b.x);return this},multiply:function(b,c){this.set(b.x*c.x,b.y*c.y,b.z*c.z);return this},multiplySelf:function(b){this.set(this.x*b.x,this.y*b.y,this.z*b.z);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b,this.z*b);return this},divideSelf:function(b){this.set(this.x/b.x,this.y/b.y,this.z/b.z);return this},divideScalar:function(b){this.set(this.x/ -b,this.y/b,this.z/b);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,d=this.y-b.y;b=this.z-b.z;return c*c+d*d+b*b},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var b= -this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){this.y=Math.asin(b.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-b.n23/c,b.n33/c);this.z=Math.atan2(-b.n13/c,b.n11/c)}else{this.x=0;this.z=Math.atan2(b.n21,b.n22)}},setLength:function(b){return this.normalize().multiplyScalar(b)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)< -1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,c,d,f){this.set(b||0,c||0,d||0,f||1)}; -THREE.Vector4.prototype={set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y,b.z+c.z,b.w+c.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,c){this.set(b.x-c.x,b.y-c.y,b.z-c.z,b.w-c.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x* -b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,c){this.set(this.x+(b.x-this.x)*c,this.y+(b.y-this.y)*c,this.z+(b.z-this.z)*c,this.w+(b.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(b){var c,d,f=b.objects,g=[];b=0;for(c=f.length;b0&&I>0&&O+I<1}var d,f,g,h,j,k,m,p,o,w, -y,v=b.geometry,B=v.vertices,F=[];d=0;for(f=v.faces.length;d0:o<0)){p=p.dot((new THREE.Vector3).sub(h,w))/ -o;w=w.addSelf(y.multiplyScalar(p));if(g instanceof THREE.Face3){if(c(w,h,j,k)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:b};F.push(g)}}else if(g instanceof THREE.Face4&&(c(w,h,j,m)||c(w,j,k,m))){g={distance:this.origin.distanceTo(w),point:w,face:g,object:b};F.push(g)}}}return F}}; -THREE.Rectangle=function(){function b(){h=f-c;j=g-d}var c,d,f,g,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(m,p,o,w){k=!1;c=m;d=p;f=o;g=w;b()};this.addPoint=function(m,p){if(k){k=!1;c=m;d=p;f=m;g=p}else{c=cm?f:m;g=g>p?g:p}b()}; -this.add3Points=function(m,p,o,w,y,v){if(k){k=!1;c=mo?m>y?m:y:o>y?o:y;g=p>w?p>v?p:v:w>v?w:v}else{c=mo?m>y?m>f?m:f:y>f?y:f:o>y?o>f?o:f:y>f?y:f;g=p>w?p>v?p>g?p:g:v>g?v:g:w>v?w>g?w:g:v>g?v:g}b()};this.addRectangle=function(m){if(k){k=!1;c=m.getLeft();d=m.getTop();f=m.getRight();g=m.getBottom()}else{c=cm.getRight()? -f:m.getRight();g=g>m.getBottom()?g:m.getBottom()}b()};this.inflate=function(m){c-=m;d-=m;f+=m;g+=m;b()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();d=d>m.getTop()?d:m.getTop();f=f=0&&Math.min(g,m.getBottom())-Math.max(d,m.getTop())>=0};this.empty=function(){k=!0;g=f=d=c=0;b()};this.isEmpty=function(){return k}}; -THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}}; -THREE.Matrix4=function(b,c,d,f,g,h,j,k,m,p,o,w,y,v,B,F){this.set(b||1,c||0,d||0,f||0,g||0,h||1,j||0,k||0,m||0,p||0,o||1,w||0,y||0,v||0,B||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(b,c,d,f,g,h,j,k,m,p,o,w,y,v,B,F){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=p;this.n33=o;this.n34=w;this.n41=y;this.n42=v;this.n43=B;this.n44=F;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var f=THREE.Matrix4.__v1, -g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(d,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,g=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*d+this.n23* -f+this.n24)*g;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+d*this.n32+f*this.n33;b.normalize(); -return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,p=b.n24,o=b.n31,w=b.n32,y=b.n33,v=b.n34,B=b.n41,F=b.n42,I=b.n43,N=b.n44,W=c.n11,A=c.n12,K=c.n13,O=c.n14,R=c.n21,Ca=c.n22, -ka=c.n23,va=c.n24,aa=c.n31,e=c.n32,da=c.n33,ya=c.n34;this.n11=d*W+f*R+g*aa;this.n12=d*A+f*Ca+g*e;this.n13=d*K+f*ka+g*da;this.n14=d*O+f*va+g*ya+h;this.n21=j*W+k*R+m*aa;this.n22=j*A+k*Ca+m*e;this.n23=j*K+k*ka+m*da;this.n24=j*O+k*va+m*ya+p;this.n31=o*W+w*R+y*aa;this.n32=o*A+w*Ca+y*e;this.n33=o*K+w*ka+y*da;this.n34=o*O+w*va+y*ya+v;this.n41=B*W+F*R+I*aa;this.n42=B*A+F*Ca+I*e;this.n43=B*K+F*ka+I*da;this.n44=B*O+F*va+I*ya+N;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]= -this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*= -b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,p=this.n32,o=this.n33,w=this.n34,y=this.n41,v=this.n42,B=this.n43,F=this.n44;return f*j*p*y-d*k*p*y-f*h*o*y+c*k*o*y+d*h*w*y-c*j*w*y-f*j*m*v+d*k*m*v+f*g*o*v-b*k*o*v-d*g*w*v+b*j*w*v+f*h*m*B-c*k*m*B-f*g*p*B+b*k*p*B+c*g*w*B-b*h*w*B-d*h*m*F+c*j*m*F+d*g*p*F-b*j*p*F-c*g*o*F+b*h*o*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31= +THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,d,c){this.r=b;this.g=d;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,d,c){var f,g,h,j,k,m;if(c==0)f=g=h=0;else{j=Math.floor(b*6);k=b*6-j;b=c*(1-d);m=c*(1-d*k);d=c*(1-d*(1-k));switch(j){case 1:f=m;g=c;h=b;break;case 2:f=b;g=c;h=d;break;case 3:f=b;g=m;h=c;break;case 4:f=d;g=b;h=c;break;case 5:f=c;g=b; +h=m;break;case 6:case 0:f=c;g=d;h=b}}this.r=f;this.g=g;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g* +255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)}; +THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ +this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,d,c){this.set(b||0,d||0,c||0)}; +THREE.Vector3.prototype={set:function(b,d,c){this.x=b;this.y=d;this.z=c;return this},copy:function(b){this.set(b.x,b.y,b.z);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z);return this},addScalar:function(b){this.set(this.x+b,this.y+b,this.z+b);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z);return this},cross:function(b, +d){this.set(b.y*d.z-b.z*d.y,b.z*d.x-b.x*d.z,b.x*d.y-b.y*d.x);return this},crossSelf:function(b){var d=this.x,c=this.y,f=this.z;this.set(c*b.z-f*b.y,f*b.x-d*b.z,d*b.y-c*b.x);return this},multiply:function(b,d){this.set(b.x*d.x,b.y*d.y,b.z*d.z);return this},multiplySelf:function(b){this.set(this.x*b.x,this.y*b.y,this.z*b.z);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b,this.z*b);return this},divideSelf:function(b){this.set(this.x/b.x,this.y/b.y,this.z/b.z);return this},divideScalar:function(b){this.set(this.x/ +b,this.y/b,this.z/b);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var d=this.x-b.x,c=this.y-b.y;b=this.z-b.z;return d*d+c*c+b*b},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var b= +this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){this.y=Math.asin(b.n13);var d=Math.cos(this.y);if(Math.abs(d)>1.0E-5){this.x=Math.atan2(-b.n23/d,b.n33/d);this.z=Math.atan2(-b.n13/d,b.n11/d)}else{this.x=0;this.z=Math.atan2(b.n21,b.n22)}},setLength:function(b){return this.normalize().multiplyScalar(b)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)< +1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,c,f){this.set(b||0,d||0,c||0,f||1)}; +THREE.Vector4.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x* +b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3}; +THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b0&&J>0&&O+J<1}var c,f,g,h,j,k,m,p,o,v, +y,u=b.geometry,B=u.vertices,F=[];c=0;for(f=u.faces.length;c0:o<0)){p=p.dot((new THREE.Vector3).sub(h,v))/ +o;v=v.addSelf(y.multiplyScalar(p));if(g instanceof THREE.Face3){if(d(v,h,j,k)){g={distance:this.origin.distanceTo(v),point:v,face:g,object:b};F.push(g)}}else if(g instanceof THREE.Face4&&(d(v,h,j,m)||d(v,j,k,m))){g={distance:this.origin.distanceTo(v),point:v,face:g,object:b};F.push(g)}}}return F}}; +THREE.Rectangle=function(){function b(){h=f-d;j=g-c}var d,c,f,g,h,j,k=!0;this.getX=function(){return d};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(m,p,o,v){k=!1;d=m;c=p;f=o;g=v;b()};this.addPoint=function(m,p){if(k){k=!1;d=m;c=p;f=m;g=p}else{d=dm?f:m;g=g>p?g:p}b()}; +this.add3Points=function(m,p,o,v,y,u){if(k){k=!1;d=mo?m>y?m:y:o>y?o:y;g=p>v?p>u?p:u:v>u?v:u}else{d=mo?m>y?m>f?m:f:y>f?y:f:o>y?o>f?o:f:y>f?y:f;g=p>v?p>u?p>g?p:g:u>g?u:g:v>u?v>g?v:g:u>g?u:g}b()};this.addRectangle=function(m){if(k){k=!1;d=m.getLeft();c=m.getTop();f=m.getRight();g=m.getBottom()}else{d=dm.getRight()? +f:m.getRight();g=g>m.getBottom()?g:m.getBottom()}b()};this.inflate=function(m){d-=m;c-=m;f+=m;g+=m;b()};this.minSelf=function(m){d=d>m.getLeft()?d:m.getLeft();c=c>m.getTop()?c:m.getTop();f=f=0&&Math.min(g,m.getBottom())-Math.max(c,m.getTop())>=0};this.empty=function(){k=!0;g=f=c=d=0;b()};this.isEmpty=function(){return k}}; +THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}}; +THREE.Matrix4=function(b,d,c,f,g,h,j,k,m,p,o,v,y,u,B,F){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,m||0,p||0,o||1,v||0,y||0,u||0,B||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,m,p,o,v,y,u,B,F){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=p;this.n33=o;this.n34=v;this.n41=y;this.n42=u;this.n43=B;this.n44=F;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,c){var f=THREE.Matrix4.__v1, +g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23* +f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize(); +return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,p=b.n24,o=b.n31,v=b.n32,y=b.n33,u=b.n34,B=b.n41,F=b.n42,J=b.n43,H=b.n44,W=d.n11,A=d.n12,L=d.n13,O=d.n14,R=d.n21,Ca=d.n22, +ka=d.n23,va=d.n24,aa=d.n31,e=d.n32,da=d.n33,ya=d.n34;this.n11=c*W+f*R+g*aa;this.n12=c*A+f*Ca+g*e;this.n13=c*L+f*ka+g*da;this.n14=c*O+f*va+g*ya+h;this.n21=j*W+k*R+m*aa;this.n22=j*A+k*Ca+m*e;this.n23=j*L+k*ka+m*da;this.n24=j*O+k*va+m*ya+p;this.n31=o*W+v*R+y*aa;this.n32=o*A+v*Ca+y*e;this.n33=o*L+v*ka+y*da;this.n34=o*O+v*va+y*ya+u;this.n41=B*W+F*R+J*aa;this.n42=B*A+F*Ca+J*e;this.n43=B*L+F*ka+J*da;this.n44=B*O+F*va+J*ya+H;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]= +this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*= +b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,p=this.n32,o=this.n33,v=this.n34,y=this.n41,u=this.n42,B=this.n43,F=this.n44;return f*j*p*y-c*k*p*y-f*h*o*y+d*k*o*y+c*h*v*y-d*j*v*y-f*j*m*u+c*k*m*u+f*g*o*u-b*k*o*u-c*g*v*u+b*j*v*u+f*h*m*B-d*k*m*B-f*g*p*B+b*k*p*B+d*g*v*B-b*h*v*B-c*h*m*F+d*j*m*F+c*g*p*F-b*j*p*F-d*g*o*F+b*h*o*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31= this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]= this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42; -b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0, -0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),g= -1-d,h=b.x,j=b.y,k=b.z,m=g*h,p=g*j;this.set(m*h+d,m*j-f*k,m*k+f*j,0,m*j+f*k,p*j+d,p*k-f*h,0,m*k-f*j,p*k+f*h,g*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var c=b.x,d=b.y,f=b.z;b=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(f);f=Math.sin(f);var j=b*d,k=c*d;this.n11=g*h;this.n12=-g*f;this.n13=d;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-c*g;this.n31=-j*h+c*f;this.n32=j*f+c*h;this.n33= -b*g;return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,g=b.w,h=c+c,j=d+d,k=f+f;b=c*h;var m=c*j;c*=k;var p=d*j;d*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=m-g;this.n13=c+j;this.n21=m+g;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y;b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14= -b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}}; -THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,p=b.n24,o=b.n31,w=b.n32,y=b.n33,v=b.n34,B=b.n41,F=b.n42,I=b.n43,N=b.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*v*F-p*y*F+p*w*I-k*v*I-m*w*N+k*y*N;c.n12=h*y*F-g*v*F-h*w*I+f*v*I+g*w*N-f*y*N;c.n13=g*p*F-h*m*F+h*k*I-f*p*I-g*k*N+f*m*N;c.n14=h*m*w-g*p*w-h*k*y+f*p*y+g*k*v-f*m*v;c.n21=p*y*B-m*v*B-p*o*I+j*v*I+m*o*N-j*y*N;c.n22=g*v*B-h*y*B+h*o*I-d*v*I-g*o*N+d*y*N;c.n23=h*m*B-g*p*B-h*j*I+d*p*I+g*j*N-d*m*N; -c.n24=g*p*o-h*m*o+h*j*y-d*p*y-g*j*v+d*m*v;c.n31=k*v*B-p*w*B+p*o*F-j*v*F-k*o*N+j*w*N;c.n32=h*w*B-f*v*B-h*o*F+d*v*F+f*o*N-d*w*N;c.n33=g*p*B-h*k*B+h*j*F-d*p*F-f*j*N+d*k*N;c.n34=h*k*o-f*p*o-h*j*w+d*p*w+f*j*v-d*k*v;c.n41=m*w*B-k*y*B-m*o*F+j*y*F+k*o*I-j*w*I;c.n42=f*y*B-g*w*B+g*o*F-d*y*F-f*o*I+d*w*I;c.n43=g*k*B-f*m*B-g*j*F+d*m*F+f*j*I-d*k*I;c.n44=f*m*o-g*k*o+g*j*w-d*m*w-f*j*y+d*k*y;c.multiplyScalar(1/b.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,w=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*f;d[1]=b*g;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*m;d[6]=b*p;d[7]=b*o;d[8]=b*w;return c}; -THREE.Matrix4.makeFrustum=function(b,c,d,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*g/(f-d);j.n23=(f+d)/(f-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,f){var g;b=d*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,d,f)}; -THREE.Matrix4.makeOrtho=function(b,c,d,f,g,h){var j,k,m,p;j=new THREE.Matrix4;k=c-b;m=d-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+f)/m);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; +b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,c){this.set(1,0,0,b,0,1,0,d,0,0,1,c,0,0, +0,1);return this},setScale:function(b,d,c){this.set(b,0,0,0,0,d,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var c=Math.cos(d),f=Math.sin(d),g= +1-c,h=b.x,j=b.y,k=b.z,m=g*h,p=g*j;this.set(m*h+c,m*j-f*k,m*k+f*j,0,m*j+f*k,p*j+c,p*k-f*h,0,m*k-f*j,p*k+f*h,g*k*k+c,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,c=b.y,f=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=b*c,k=d*c;this.n11=g*h;this.n12=-g*f;this.n13=c;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-d*g;this.n31=-j*h+d*f;this.n32=j*f+d*h;this.n33= +b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,c=b.y,f=b.z,g=b.w,h=d+d,j=c+c,k=f+f;b=d*h;var m=d*j;d*=k;var p=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=m-g;this.n13=d+j;this.n21=m+g;this.n22=1-(b+f);this.n23=c-h;this.n31=d-j;this.n32=c+h;this.n33=1-(b+p);return this},scale:function(b){var d=b.x,c=b.y;b=b.z;this.n11*=d;this.n12*=c;this.n13*=b;this.n21*=d;this.n22*=c;this.n23*=b;this.n31*=d;this.n32*=c;this.n33*=b;this.n41*=d;this.n42*=c;this.n43*=b;return this},extractPosition:function(b){this.n14= +b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var c=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}}; +THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,p=b.n24,o=b.n31,v=b.n32,y=b.n33,u=b.n34,B=b.n41,F=b.n42,J=b.n43,H=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=m*u*F-p*y*F+p*v*J-k*u*J-m*v*H+k*y*H;d.n12=h*y*F-g*u*F-h*v*J+f*u*J+g*v*H-f*y*H;d.n13=g*p*F-h*m*F+h*k*J-f*p*J-g*k*H+f*m*H;d.n14=h*m*v-g*p*v-h*k*y+f*p*y+g*k*u-f*m*u;d.n21=p*y*B-m*u*B-p*o*J+j*u*J+m*o*H-j*y*H;d.n22=g*u*B-h*y*B+h*o*J-c*u*J-g*o*H+c*y*H;d.n23=h*m*B-g*p*B-h*j*J+c*p*J+g*j*H-c*m*H; +d.n24=g*p*o-h*m*o+h*j*y-c*p*y-g*j*u+c*m*u;d.n31=k*u*B-p*v*B+p*o*F-j*u*F-k*o*H+j*v*H;d.n32=h*v*B-f*u*B-h*o*F+c*u*F+f*o*H-c*v*H;d.n33=g*p*B-h*k*B+h*j*F-c*p*F-f*j*H+c*k*H;d.n34=h*k*o-f*p*o-h*j*v+c*p*v+f*j*u-c*k*u;d.n41=m*v*B-k*y*B-m*o*F+j*y*F+k*o*J-j*v*J;d.n42=f*y*B-g*v*B+g*o*F-c*y*F-f*o*J+c*v*J;d.n43=g*k*B-f*m*B-g*j*F+c*m*F+f*j*J-c*k*J;d.n44=f*m*o-g*k*o+g*j*v-c*m*v-f*j*y+c*k*y;d.multiplyScalar(1/b.determinant());return d}; +THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,v=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*m;c[6]=b*p;c[7]=b*o;c[8]=b*v;return d}; +THREE.Matrix4.makeFrustum=function(b,d,c,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,c,f){var g;b=c*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,c,f)}; +THREE.Matrix4.makeOrtho=function(b,d,c,f,g,h){var j,k,m,p;j=new THREE.Matrix4;k=d-b;m=c-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((d+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((c+f)/m);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible= !0;this._vector=new THREE.Vector3}; -THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===-1){b.parent!== -undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1){b.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!== -1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}b=0;for(var f=this.children.length;b=1){d.w=b.w;d.x=b.x;d.y=b.y;d.z=b.z;return d}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){d.w=0.5*(b.w+c.w);d.x=0.5*(b.x+c.x);d.y=0.5*(b.y+c.y);d.z=0.5*(b.z+c.z);return d}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*g+c.w*f;d.x=b.x*g+c.x*f;d.y=b.y*g+c.y*f;d.z=b.z*g+c.z*f;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; -THREE.Face3=function(b,c,d,f,g,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3}; -THREE.Face4=function(b,c,d,f,g,h,j){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)}; -THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; -THREE.Geometry.prototype={computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.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 c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x; -if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;cthis.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];o=this.points[d[1]]; -w=this.points[d[2]];y=this.points[d[3]];k=j*j;m=j*k;f.x=c(p.x,o.x,w.x,y.x,j,k,m);f.y=c(p.y,o.y,w.y,y.y,j,k,m);f.z=c(p.z,o.z,w.z,y.z,j,k,m);return f};this.getControlPointsArray=function(){var v,B,F=this.points.length,I=[];for(v=0;v=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; +THREE.Face3=function(b,d,c,f,g,h){this.a=b;this.b=d;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3}; +THREE.Face4=function(b,d,c,f,g,h,j){this.a=b;this.b=d;this.c=c;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)}; +THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; +THREE.Geometry.prototype={computeCentroids:function(){var b,d,c;b=0;for(d=this.faces.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 d=1,c=this.vertices.length;dthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x; +if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,c=this.vertices.length;dthis.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];o=this.points[c[1]]; +v=this.points[c[2]];y=this.points[c[3]];k=j*j;m=j*k;f.x=d(p.x,o.x,v.x,y.x,j,k,m);f.y=d(p.y,o.y,v.y,y.y,j,k,m);f.z=d(p.z,o.z,v.z,y.z,j,k,m);return f};this.getControlPointsArray=function(){var u,B,F=this.points.length,J=[];for(u=0;u1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v);f=f<0?0:1}if(d==="pos"){d=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= -this.getPrevKeyWith("pos",v,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",v,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);d.x=g[0];d.y=g[1];d.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(d=== -"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(d==="scl"){d=b.scale;d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!0);for(v=0;vb.length-2?h:h+1;d[3]=h>b.length-3?h:h+2;h=b[d[0]];k=b[d[1]];m=b[d[2]];p=b[d[3]];d=g*g;j=g*d;f[0]=this.interpolate(h[0],k[0],m[0],p[0],g,d,j);f[1]=this.interpolate(h[1],k[1],m[1],p[1],g,d,j);f[2]=this.interpolate(h[2],k[2],m[2],p[2],g,d,j);return f}; -THREE.Animation.prototype.interpolate=function(b,c,d,f,g,h,j){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*j+(-3*(c-d)-2*b-f)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var f=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d0?d:0:d>=0?d:d+f.length;d>=0;d--)if(f[d][b]!==undefined)return f[d];return this.data.hierarchy[c].keys[f.length-1]}; -THREE.Camera=function(b,c,d,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype; -THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)}; -THREE.Camera.prototype.update=function(b,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate= -!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= +this.getPrevKeyWith("pos",u,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);c.x=g[0];c.y=g[1];c.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(c=== +"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(c==="scl"){c=b.scale;c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!0);for(u=0;ub.length-2?h:h+1;c[3]=h>b.length-3?h:h+2;h=b[c[0]];k=b[c[1]];m=b[c[2]];p=b[c[3]];c=g*g;j=g*c;f[0]=this.interpolate(h[0],k[0],m[0],p[0],g,c,j);f[1]=this.interpolate(h[1],k[1],m[1],p[1],g,c,j);f[2]=this.interpolate(h[2],k[2],m[2],p[2],g,c,j);return f}; +THREE.Animation.prototype.interpolate=function(b,d,c,f,g,h,j){b=(c-b)*0.5;f=(f-d)*0.5;return(2*(d-c)+b+f)*j+(-3*(d-c)-2*b-f)*h+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[f.length-1]}; +THREE.Camera=function(b,d,c,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=c||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype; +THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)}; +THREE.Camera.prototype.update=function(b,d,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);d=!0}else{this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate= +!1;d=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible= -!1;this.LODs[f].object3D.visible=!0}else break;for(;f1){b=c.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible= +!1;this.LODs[f].object3D.visible=!0}else break;for(;fv){c=o;o=v;v=c}}else if(ou){c=y;y=u;u=c}}else if(y=0&&Y>=0&&oa>=0&&pa>=0)return!0;else if(Ea<0&&Y<0||oa<0&&pa<0)return!1;else{if(Ea<0)ya=Math.max(ya,Ea/(Ea-Y));else Y<0&&(za=Math.min(za,Ea/(Ea-Y)));if(oa<0)ya=Math.max(ya,oa/(oa-pa));else pa<0&&(za=Math.min(za,oa/(oa-pa)));if(za=0&&Y>=0&&oa>=0&&pa>=0)return!0;else if(Ea<0&&Y<0||oa<0&&pa<0)return!1;else{if(Ea<0)ya=Math.max(ya,Ea/(Ea-Y));else Y<0&&(za=Math.min(za,Ea/(Ea-Y)));if(oa<0)ya=Math.max(ya,oa/(oa-pa));else pa<0&&(za=Math.min(za,oa/(oa-pa)));if(zaEa&&j.positionScreen.z0&&O.z<1){Ta=A[W]=A[W]||new THREE.RenderableParticle;W++;N=Ta;N.x=O.x/O.w;N.y=O.y/O.w;N.z=O.z;N.rotation=ua.rotation.z;N.scale.x=ua.scale.x*Math.abs(N.x-(O.x+da.projectionMatrix.n11)/(O.w+da.projectionMatrix.n14));N.scale.y=ua.scale.y*Math.abs(N.y-(O.y+da.projectionMatrix.n22)/(O.w+da.projectionMatrix.n24));N.materials=ua.materials;za.push(N)}}}}ya&&za.sort(c);return za}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){d=j;f=k;g=d/2;h=f/2};this.render=function(j,k){var m,p,o,w,y,v,B,F;b=c.projectScene(j,k);m=0;for(p=b.length;m>1;Ba=ha.height>>1;sa=ja.scale.x*m;qa=ja.scale.y*p;la=sa*Q;Ja=qa*Ba;ab.set(V.x-la,V.y-Ja,V.x+la,V.y+Ja);if(ea.instersects(ab)){o.save();o.translate(V.x,V.y);o.rotate(-ja.rotation); -o.scale(sa,-qa);o.translate(-Q,-Ba);o.drawImage(ha,0,0);o.restore()}}}else if(sa instanceof THREE.ParticleCanvasMaterial){la=ja.scale.x*m;Ja=ja.scale.y*p;ab.set(V.x-la,V.y-Ja,V.x+la,V.y+Ja);if(ea.instersects(ab)){d(sa.color.__styleString);qa=sa.color.__styleString;if(I!=qa)o.fillStyle=I=qa;o.save();o.translate(V.x,V.y);o.rotate(-ja.rotation);o.scale(la,Ja);sa.program(o);o.restore()}}}function cb(V,ja,sa,la){b(la.opacity);c(la.blending);o.beginPath();o.moveTo(V.positionScreen.x,V.positionScreen.y); -o.lineTo(ja.positionScreen.x,ja.positionScreen.y);o.closePath();if(la instanceof THREE.LineBasicMaterial){ma.__styleString=la.color.__styleString;V=la.linewidth;if(N!=V)o.lineWidth=N=V;V=la.linecap;if(W!=V)o.lineCap=W=V;V=la.linejoin;if(A!=V)o.lineJoin=A=V;d(ma.__styleString);o.stroke();ab.inflate(la.linewidth*2)}}function Ga(V,ja,sa,la,Ja,qa,ha,Q,Ba){b(Q.opacity);c(Q.blending);aa=V.positionScreen.x;e=V.positionScreen.y;da=ja.positionScreen.x;ya=ja.positionScreen.y;za=sa.positionScreen.x;Ea=sa.positionScreen.y; +pa=1;for(ta=fa.length;pa0&&O.z<1){Ta=A[W]=A[W]||new THREE.RenderableParticle;W++;H=Ta;H.x=O.x/O.w;H.y=O.y/O.w;H.z=O.z;H.rotation=ua.rotation.z;H.scale.x=ua.scale.x*Math.abs(H.x-(O.x+da.projectionMatrix.n11)/(O.w+da.projectionMatrix.n14));H.scale.y=ua.scale.y*Math.abs(H.y-(O.y+da.projectionMatrix.n22)/(O.w+da.projectionMatrix.n24));H.materials=ua.materials;za.push(H)}}}}ya&&za.sort(d);return za}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var m,p,o,v,y,u,B,F;b=d.projectScene(j,k);m=0;for(p=b.length;m>1;Ba=ha.height>>1;sa=ja.scale.x*m;qa=ja.scale.y*p;la=sa*Q;Ja=qa*Ba;ab.set(V.x-la,V.y-Ja,V.x+la,V.y+Ja);if(ea.instersects(ab)){o.save();o.translate(V.x,V.y);o.rotate(-ja.rotation); +o.scale(sa,-qa);o.translate(-Q,-Ba);o.drawImage(ha,0,0);o.restore()}}}else if(sa instanceof THREE.ParticleCanvasMaterial){la=ja.scale.x*m;Ja=ja.scale.y*p;ab.set(V.x-la,V.y-Ja,V.x+la,V.y+Ja);if(ea.instersects(ab)){c(sa.color.__styleString);qa=sa.color.__styleString;if(J!=qa)o.fillStyle=J=qa;o.save();o.translate(V.x,V.y);o.rotate(-ja.rotation);o.scale(la,Ja);sa.program(o);o.restore()}}}function cb(V,ja,sa,la){b(la.opacity);d(la.blending);o.beginPath();o.moveTo(V.positionScreen.x,V.positionScreen.y); +o.lineTo(ja.positionScreen.x,ja.positionScreen.y);o.closePath();if(la instanceof THREE.LineBasicMaterial){ma.__styleString=la.color.__styleString;V=la.linewidth;if(H!=V)o.lineWidth=H=V;V=la.linecap;if(W!=V)o.lineCap=W=V;V=la.linejoin;if(A!=V)o.lineJoin=A=V;c(ma.__styleString);o.stroke();ab.inflate(la.linewidth*2)}}function Ga(V,ja,sa,la,Ja,qa,ha,Q,Ba){b(Q.opacity);d(Q.blending);aa=V.positionScreen.x;e=V.positionScreen.y;da=ja.positionScreen.x;ya=ja.positionScreen.y;za=sa.positionScreen.x;Ea=sa.positionScreen.y; Fa(aa,e,da,ya,za,Ea);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Qa=ha.uvs[0];t(aa,e,da,ya,za,Ea,Q.map.image,Qa[la].u,Qa[la].v,Qa[Ja].u,Qa[Ja].v,Qa[qa].u,Qa[qa].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){V=ra.matrixWorldInverse;G.copy(ha.vertexNormalsWorld[0]);U=(G.x*V.n11+G.y*V.n12+G.z*V.n13)*0.5+0.5;ca=-(G.x*V.n21+G.y*V.n22+G.z*V.n23)*0.5+0.5;G.copy(ha.vertexNormalsWorld[1]);na=(G.x*V.n11+G.y*V.n12+G.z* V.n13)*0.5+0.5;Aa=-(G.x*V.n21+G.y*V.n22+G.z*V.n23)*0.5+0.5;G.copy(ha.vertexNormalsWorld[2]);La=(G.x*V.n11+G.y*V.n12+G.z*V.n13)*0.5+0.5;wa=-(G.x*V.n21+G.y*V.n22+G.z*V.n23)*0.5+0.5;t(aa,e,da,ya,za,Ea,Q.envMap.image,U,ca,na,Aa,La,wa)}}else Q.wireframe?D(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Qa=ha.uvs[0];t(aa,e,da,ya, -za,Ea,Q.map.image,Qa[la].u,Qa[la].v,Qa[Ja].u,Qa[Ja].v,Qa[qa].u,Qa[qa].v)}c(THREE.SubtractiveBlending)}if(n)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Da.r=ga.r=ia.r=u.r;Da.g=ga.g=ia.g=u.g;Da.b=ga.b=ia.b=u.b;xa(Ba,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Da);xa(Ba,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ga);xa(Ba,ha.v3.positionWorld,ha.vertexNormalsWorld[2],ia);ua.r=(ga.r+ia.r)*0.5;ua.g=(ga.g+ia.g)*0.5;ua.b=(ga.b+ia.b)*0.5;Za=db(Da,ga,ia,ua);t(aa,e,da, -ya,za,Ea,Za,0,0,1,0,0,1)}else{C.r=u.r;C.g=u.g;C.b=u.b;xa(Ba,ha.centroidWorld,ha.normalWorld,C);ma.r=Q.color.r*C.r;ma.g=Q.color.g*C.g;ma.b=Q.color.b*C.b;ma.updateStyleString();Q.wireframe?D(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(ma.__styleString)}else Q.wireframe?D(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Ta=ra.near;Ya=ra.far;Da.r=Da.g=Da.b=1-hb(V.positionScreen.z, +za,Ea,Q.map.image,Qa[la].u,Qa[la].v,Qa[Ja].u,Qa[Ja].v,Qa[qa].u,Qa[qa].v)}d(THREE.SubtractiveBlending)}if(n)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Da.r=ga.r=ia.r=w.r;Da.g=ga.g=ia.g=w.g;Da.b=ga.b=ia.b=w.b;xa(Ba,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Da);xa(Ba,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ga);xa(Ba,ha.v3.positionWorld,ha.vertexNormalsWorld[2],ia);ua.r=(ga.r+ia.r)*0.5;ua.g=(ga.g+ia.g)*0.5;ua.b=(ga.b+ia.b)*0.5;Za=db(Da,ga,ia,ua);t(aa,e,da, +ya,za,Ea,Za,0,0,1,0,0,1)}else{C.r=w.r;C.g=w.g;C.b=w.b;xa(Ba,ha.centroidWorld,ha.normalWorld,C);ma.r=Q.color.r*C.r;ma.g=Q.color.g*C.g;ma.b=Q.color.b*C.b;ma.updateStyleString();Q.wireframe?D(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(ma.__styleString)}else Q.wireframe?D(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Ta=ra.near;Ya=ra.far;Da.r=Da.g=Da.b=1-hb(V.positionScreen.z, Ta,Ya);ga.r=ga.g=ga.b=1-hb(ja.positionScreen.z,Ta,Ya);ia.r=ia.g=ia.b=1-hb(sa.positionScreen.z,Ta,Ya);ua.r=(ga.r+ia.r)*0.5;ua.g=(ga.g+ia.g)*0.5;ua.b=(ga.b+ia.b)*0.5;Za=db(Da,ga,ia,ua);t(aa,e,da,ya,za,Ea,Za,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=Ra(ha.normalWorld.x);ma.g=Ra(ha.normalWorld.y);ma.b=Ra(ha.normalWorld.z);ma.updateStyleString();Q.wireframe?D(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(ma.__styleString)}}function Ha(V,ja,sa,la, -Ja,qa,ha,Q,Ba){b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap){Ga(V,ja,la,0,1,3,ha,Q,Ba);Ga(Ja,sa,qa,1,2,3,ha,Q,Ba)}else{aa=V.positionScreen.x;e=V.positionScreen.y;da=ja.positionScreen.x;ya=ja.positionScreen.y;za=sa.positionScreen.x;Ea=sa.positionScreen.y;Y=la.positionScreen.x;oa=la.positionScreen.y;pa=Ja.positionScreen.x;ta=Ja.positionScreen.y;fa=qa.positionScreen.x;Z=qa.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){Ua(aa,e,da,ya,za,Ea,Y,oa);Q.wireframe?D(Q.color.__styleString,Q.wireframeLinewidth, -Q.wireframeLinecap,Q.wireframeLinejoin):$(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(n)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4){Da.r=ga.r=ia.r=ua.r=u.r;Da.g=ga.g=ia.g=ua.g=u.g;Da.b=ga.b=ia.b=ua.b=u.b;xa(Ba,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Da);xa(Ba,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ga);xa(Ba,ha.v4.positionWorld,ha.vertexNormalsWorld[3],ia);xa(Ba,ha.v3.positionWorld,ha.vertexNormalsWorld[2],ua);Za=db(Da,ga, -ia,ua);Fa(aa,e,da,ya,Y,oa);t(aa,e,da,ya,Y,oa,Za,0,0,1,0,0,1);Fa(pa,ta,za,Ea,fa,Z);t(pa,ta,za,Ea,fa,Z,Za,1,0,1,1,0,1)}else{C.r=u.r;C.g=u.g;C.b=u.b;xa(Ba,ha.centroidWorld,ha.normalWorld,C);ma.r=Q.color.r*C.r;ma.g=Q.color.g*C.g;ma.b=Q.color.b*C.b;ma.updateStyleString();Ua(aa,e,da,ya,za,Ea,Y,oa);Q.wireframe?D(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(ma.__styleString)}else{Ua(aa,e,da,ya,za,Ea,Y,oa);Q.wireframe?D(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap, +Ja,qa,ha,Q,Ba){b(Q.opacity);d(Q.blending);if(Q.map||Q.envMap){Ga(V,ja,la,0,1,3,ha,Q,Ba);Ga(Ja,sa,qa,1,2,3,ha,Q,Ba)}else{aa=V.positionScreen.x;e=V.positionScreen.y;da=ja.positionScreen.x;ya=ja.positionScreen.y;za=sa.positionScreen.x;Ea=sa.positionScreen.y;Y=la.positionScreen.x;oa=la.positionScreen.y;pa=Ja.positionScreen.x;ta=Ja.positionScreen.y;fa=qa.positionScreen.x;Z=qa.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){Ua(aa,e,da,ya,za,Ea,Y,oa);Q.wireframe?D(Q.color.__styleString,Q.wireframeLinewidth, +Q.wireframeLinecap,Q.wireframeLinejoin):$(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(n)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4){Da.r=ga.r=ia.r=ua.r=w.r;Da.g=ga.g=ia.g=ua.g=w.g;Da.b=ga.b=ia.b=ua.b=w.b;xa(Ba,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Da);xa(Ba,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ga);xa(Ba,ha.v4.positionWorld,ha.vertexNormalsWorld[3],ia);xa(Ba,ha.v3.positionWorld,ha.vertexNormalsWorld[2],ua);Za=db(Da,ga, +ia,ua);Fa(aa,e,da,ya,Y,oa);t(aa,e,da,ya,Y,oa,Za,0,0,1,0,0,1);Fa(pa,ta,za,Ea,fa,Z);t(pa,ta,za,Ea,fa,Z,Za,1,0,1,1,0,1)}else{C.r=w.r;C.g=w.g;C.b=w.b;xa(Ba,ha.centroidWorld,ha.normalWorld,C);ma.r=Q.color.r*C.r;ma.g=Q.color.g*C.g;ma.b=Q.color.b*C.b;ma.updateStyleString();Ua(aa,e,da,ya,za,Ea,Y,oa);Q.wireframe?D(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(ma.__styleString)}else{Ua(aa,e,da,ya,za,Ea,Y,oa);Q.wireframe?D(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap, Q.wireframeLinejoin):$(Q.color.__styleString)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=Ra(ha.normalWorld.x);ma.g=Ra(ha.normalWorld.y);ma.b=Ra(ha.normalWorld.z);ma.updateStyleString();Ua(aa,e,da,ya,za,Ea,Y,oa);Q.wireframe?D(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(ma.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Ta=ra.near;Ya=ra.far;Da.r=Da.g=Da.b=1-hb(V.positionScreen.z,Ta,Ya);ga.r=ga.g=ga.b=1-hb(ja.positionScreen.z,Ta,Ya);ia.r=ia.g= -ia.b=1-hb(la.positionScreen.z,Ta,Ya);ua.r=ua.g=ua.b=1-hb(sa.positionScreen.z,Ta,Ya);Za=db(Da,ga,ia,ua);Fa(aa,e,da,ya,Y,oa);t(aa,e,da,ya,Y,oa,Za,0,0,1,0,0,1);Fa(pa,ta,za,Ea,fa,Z);t(pa,ta,za,Ea,fa,Z,Za,1,0,1,1,0,1)}}}function Fa(V,ja,sa,la,Ja,qa){o.beginPath();o.moveTo(V,ja);o.lineTo(sa,la);o.lineTo(Ja,qa);o.lineTo(V,ja);o.closePath()}function Ua(V,ja,sa,la,Ja,qa,ha,Q){o.beginPath();o.moveTo(V,ja);o.lineTo(sa,la);o.lineTo(Ja,qa);o.lineTo(ha,Q);o.lineTo(V,ja);o.closePath()}function D(V,ja,sa,la){if(N!= -ja)o.lineWidth=N=ja;if(W!=sa)o.lineCap=W=sa;if(A!=la)o.lineJoin=A=la;d(V);o.stroke();ab.inflate(ja*2)}function $(V){if(I!=V)o.fillStyle=I=V;o.fill()}function t(V,ja,sa,la,Ja,qa,ha,Q,Ba,Oa,Ka,ib,gb){var Xa,$a;Xa=ha.width-1;$a=ha.height-1;Q*=Xa;Ba*=$a;Oa*=Xa;Ka*=$a;ib*=Xa;gb*=$a;sa-=V;la-=ja;Ja-=V;qa-=ja;Oa-=Q;Ka-=Ba;ib-=Q;gb-=Ba;Xa=Oa*gb-ib*Ka;if(Xa!=0){$a=1/Xa;Xa=(gb*sa-Ka*Ja)*$a;Ka=(gb*la-Ka*qa)*$a;sa=(Oa*Ja-ib*sa)*$a;la=(Oa*qa-ib*la)*$a;V=V-Xa*Q-sa*Ba;ja=ja-Ka*Q-la*Ba;o.save();o.transform(Xa,Ka, +ia.b=1-hb(la.positionScreen.z,Ta,Ya);ua.r=ua.g=ua.b=1-hb(sa.positionScreen.z,Ta,Ya);Za=db(Da,ga,ia,ua);Fa(aa,e,da,ya,Y,oa);t(aa,e,da,ya,Y,oa,Za,0,0,1,0,0,1);Fa(pa,ta,za,Ea,fa,Z);t(pa,ta,za,Ea,fa,Z,Za,1,0,1,1,0,1)}}}function Fa(V,ja,sa,la,Ja,qa){o.beginPath();o.moveTo(V,ja);o.lineTo(sa,la);o.lineTo(Ja,qa);o.lineTo(V,ja);o.closePath()}function Ua(V,ja,sa,la,Ja,qa,ha,Q){o.beginPath();o.moveTo(V,ja);o.lineTo(sa,la);o.lineTo(Ja,qa);o.lineTo(ha,Q);o.lineTo(V,ja);o.closePath()}function D(V,ja,sa,la){if(H!= +ja)o.lineWidth=H=ja;if(W!=sa)o.lineCap=W=sa;if(A!=la)o.lineJoin=A=la;c(V);o.stroke();ab.inflate(ja*2)}function $(V){if(J!=V)o.fillStyle=J=V;o.fill()}function t(V,ja,sa,la,Ja,qa,ha,Q,Ba,Oa,Ka,ib,gb){var Xa,$a;Xa=ha.width-1;$a=ha.height-1;Q*=Xa;Ba*=$a;Oa*=Xa;Ka*=$a;ib*=Xa;gb*=$a;sa-=V;la-=ja;Ja-=V;qa-=ja;Oa-=Q;Ka-=Ba;ib-=Q;gb-=Ba;Xa=Oa*gb-ib*Ka;if(Xa!=0){$a=1/Xa;Xa=(gb*sa-Ka*Ja)*$a;Ka=(gb*la-Ka*qa)*$a;sa=(Oa*Ja-ib*sa)*$a;la=(Oa*qa-ib*la)*$a;V=V-Xa*Q-sa*Ba;ja=ja-Ka*Q-la*Ba;o.save();o.transform(Xa,Ka, sa,la,V,ja);o.clip();o.drawImage(ha,0,0);o.restore()}}function db(V,ja,sa,la){var Ja=~~(V.r*255),qa=~~(V.g*255);V=~~(V.b*255);var ha=~~(ja.r*255),Q=~~(ja.g*255);ja=~~(ja.b*255);var Ba=~~(sa.r*255),Oa=~~(sa.g*255);sa=~~(sa.b*255);var Ka=~~(la.r*255),ib=~~(la.g*255);la=~~(la.b*255);E[0]=Ja<0?0:Ja>255?255:Ja;E[1]=qa<0?0:qa>255?255:qa;E[2]=V<0?0:V>255?255:V;E[4]=ha<0?0:ha>255?255:ha;E[5]=Q<0?0:Q>255?255:Q;E[6]=ja<0?0:ja>255?255:ja;E[8]=Ba<0?0:Ba>255?255:Ba;E[9]=Oa<0?0:Oa>255?255:Oa;E[10]=sa<0?0:sa>255? -255:sa;E[12]=Ka<0?0:Ka>255?255:Ka;E[13]=ib<0?0:ib>255?255:ib;E[14]=la<0?0:la>255?255:la;H.putImageData(S,0,0);J.drawImage(L,0,0);return M}function hb(V,ja,sa){V=(V-ja)/(sa-ja);return V*V*(3-2*V)}function Ra(V){V=(V+1)*0.5;return V<0?0:V>1?1:V}function Sa(V,ja){var sa=ja.x-V.x,la=ja.y-V.y,Ja=1/Math.sqrt(sa*sa+la*la);sa*=Ja;la*=Ja;ja.x+=sa;ja.y+=la;V.x-=sa;V.y-=la}var jb,kb,Ia,Va,Pa,bb,Wa,T;this.autoClear?this.clear():o.setTransform(1,0,0,-1,m,p);f=g.projectScene(P,ra,this.sortElements);(n=P.lights.length> -0)&&Na(P);jb=0;for(kb=f.length;jb0){pa.r+=Z.color.r*ma;pa.g+=Z.color.g*ma;pa.b+=Z.color.b*ma}}else if(Z instanceof THREE.PointLight){va.sub(Z.position,oa.centroidWorld);va.normalize();ma=oa.normalWorld.dot(va)*Z.intensity;if(ma>0){pa.r+=Z.color.r*ma;pa.g+=Z.color.g*ma;pa.b+=Z.color.b*ma}}}}function c(Y,oa,pa,ta,fa,Z){da=f(ya++); -da.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(fa instanceof THREE.MeshBasicMaterial)A.__styleString=fa.color.__styleString;else if(fa instanceof THREE.MeshLambertMaterial)if(W){K.r=O.r;K.g=O.g;K.b=O.b;b(Z,ta,K);A.r=fa.color.r*K.r;A.g=fa.color.g*K.g;A.b=fa.color.b*K.b;A.updateStyleString()}else A.__styleString=fa.color.__styleString;else if(fa instanceof THREE.MeshDepthMaterial){ka= +255:sa;E[12]=Ka<0?0:Ka>255?255:Ka;E[13]=ib<0?0:ib>255?255:ib;E[14]=la<0?0:la>255?255:la;I.putImageData(S,0,0);K.drawImage(M,0,0);return N}function hb(V,ja,sa){V=(V-ja)/(sa-ja);return V*V*(3-2*V)}function Ra(V){V=(V+1)*0.5;return V<0?0:V>1?1:V}function Sa(V,ja){var sa=ja.x-V.x,la=ja.y-V.y,Ja=1/Math.sqrt(sa*sa+la*la);sa*=Ja;la*=Ja;ja.x+=sa;ja.y+=la;V.x-=sa;V.y-=la}var jb,kb,Ia,Va,Pa,bb,Wa,T;this.autoClear?this.clear():o.setTransform(1,0,0,-1,m,p);f=g.projectScene(P,ra,this.sortElements);(n=P.lights.length> +0)&&Na(P);jb=0;for(kb=f.length;jb0){pa.r+=Z.color.r*ma;pa.g+=Z.color.g*ma;pa.b+=Z.color.b*ma}}else if(Z instanceof THREE.PointLight){va.sub(Z.position,oa.centroidWorld);va.normalize();ma=oa.normalWorld.dot(va)*Z.intensity;if(ma>0){pa.r+=Z.color.r*ma;pa.g+=Z.color.g*ma;pa.b+=Z.color.b*ma}}}}function d(Y,oa,pa,ta,fa,Z){da=f(ya++); +da.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(fa instanceof THREE.MeshBasicMaterial)A.__styleString=fa.color.__styleString;else if(fa instanceof THREE.MeshLambertMaterial)if(W){L.r=O.r;L.g=O.g;L.b=O.b;b(Z,ta,L);A.r=fa.color.r*L.r;A.g=fa.color.g*L.g;A.b=fa.color.b*L.b;A.updateStyleString()}else A.__styleString=fa.color.__styleString;else if(fa instanceof THREE.MeshDepthMaterial){ka= 1-fa.__2near/(fa.__farPlusNear-ta.z*fa.__farMinusNear);A.setRGB(ka,ka,ka)}else fa instanceof THREE.MeshNormalMaterial&&A.setRGB(g(ta.normalWorld.x),g(ta.normalWorld.y),g(ta.normalWorld.z));fa.wireframe?da.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+fa.wireframeLinewidth+"; stroke-opacity: "+fa.opacity+"; stroke-linecap: "+fa.wireframeLinecap+"; stroke-linejoin: "+fa.wireframeLinejoin):da.setAttribute("style","fill: "+A.__styleString+"; fill-opacity: "+fa.opacity); -k.appendChild(da)}function d(Y,oa,pa,ta,fa,Z,ma){da=f(ya++);da.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(Z instanceof THREE.MeshBasicMaterial)A.__styleString=Z.color.__styleString;else if(Z instanceof THREE.MeshLambertMaterial)if(W){K.r=O.r;K.g=O.g;K.b=O.b;b(ma,fa,K);A.r=Z.color.r*K.r;A.g=Z.color.g*K.g;A.b=Z.color.b*K.b; +k.appendChild(da)}function c(Y,oa,pa,ta,fa,Z,ma){da=f(ya++);da.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(Z instanceof THREE.MeshBasicMaterial)A.__styleString=Z.color.__styleString;else if(Z instanceof THREE.MeshLambertMaterial)if(W){L.r=O.r;L.g=O.g;L.b=O.b;b(ma,fa,L);A.r=Z.color.r*L.r;A.g=Z.color.g*L.g;A.b=Z.color.b*L.b; A.updateStyleString()}else A.__styleString=Z.color.__styleString;else if(Z instanceof THREE.MeshDepthMaterial){ka=1-Z.__2near/(Z.__farPlusNear-fa.z*Z.__farMinusNear);A.setRGB(ka,ka,ka)}else Z instanceof THREE.MeshNormalMaterial&&A.setRGB(g(fa.normalWorld.x),g(fa.normalWorld.y),g(fa.normalWorld.z));Z.wireframe?da.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+Z.wireframeLinewidth+"; stroke-opacity: "+Z.opacity+"; stroke-linecap: "+Z.wireframeLinecap+"; stroke-linejoin: "+ -Z.wireframeLinejoin):da.setAttribute("style","fill: "+A.__styleString+"; fill-opacity: "+Z.opacity);k.appendChild(da)}function f(Y){if(aa[Y]==null){aa[Y]=document.createElementNS("http://www.w3.org/2000/svg","path");Ea==0&&aa[Y].setAttribute("shape-rendering","crispEdges")}return aa[Y]}function g(Y){return Y<0?Math.min((1+Y)*0.5,0.5):0.5+Math.min(Y*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,p,o,w,y,v,B,F,I=new THREE.Rectangle,N=new THREE.Rectangle, -W=!1,A=new THREE.Color(16777215),K=new THREE.Color(16777215),O=new THREE.Color(0),R=new THREE.Color(0),Ca=new THREE.Color(0),ka,va=new THREE.Vector3,aa=[],e=[],da,ya,za,Ea=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(Y){switch(Y){case "high":Ea=1;break;case "low":Ea=0}};this.setSize=function(Y,oa){m=Y;p=oa;o=m/2;w=p/2;k.setAttribute("viewBox",-o+" "+-w+" "+m+" "+p);k.setAttribute("width",m);k.setAttribute("height",p);I.set(-o,-w,o,w)};this.clear= +Z.wireframeLinejoin):da.setAttribute("style","fill: "+A.__styleString+"; fill-opacity: "+Z.opacity);k.appendChild(da)}function f(Y){if(aa[Y]==null){aa[Y]=document.createElementNS("http://www.w3.org/2000/svg","path");Ea==0&&aa[Y].setAttribute("shape-rendering","crispEdges")}return aa[Y]}function g(Y){return Y<0?Math.min((1+Y)*0.5,0.5):0.5+Math.min(Y*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,p,o,v,y,u,B,F,J=new THREE.Rectangle,H=new THREE.Rectangle, +W=!1,A=new THREE.Color(16777215),L=new THREE.Color(16777215),O=new THREE.Color(0),R=new THREE.Color(0),Ca=new THREE.Color(0),ka,va=new THREE.Vector3,aa=[],e=[],da,ya,za,Ea=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(Y){switch(Y){case "high":Ea=1;break;case "low":Ea=0}};this.setSize=function(Y,oa){m=Y;p=oa;o=m/2;v=p/2;k.setAttribute("viewBox",-o+" "+-v+" "+m+" "+p);k.setAttribute("width",m);k.setAttribute("height",p);J.set(-o,-v,o,v)};this.clear= function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(Y,oa){var pa,ta,fa,Z,ma,Da,ga,ia;this.autoClear&&this.clear();h=j.projectScene(Y,oa,this.sortElements);za=ya=0;if(W=Y.lights.length>0){ga=Y.lights;O.setRGB(0,0,0);R.setRGB(0,0,0);Ca.setRGB(0,0,0);pa=0;for(ta=ga.length;paE){M=J;E=S[M]}e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[M]);e.vertexAttribPointer(C["morphTarget"+u],3,e.FLOAT,!1,0,0); -G.__webglMorphTargetInfluences[u]=E;H[M]=1;E=-1;u++}}e.uniform1fv(x.program.uniforms.morphTargetInfluences,G.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}if(z.__webglCustomAttributes)for(L in z.__webglCustomAttributes)if(n[L]>=0){C=z.__webglCustomAttributes[L];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(n[L],C.size,e.FLOAT,!1,0,0)}if(n.color>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglColorBuffer); +THREE.WebGLRenderer=function(b){function d(n,C,w){var x,z,G,M=n.vertices,I=M.length,S=n.colors,E=S.length,N=n.__vertexArray,K=n.__colorArray,X=n.__sortArray,P=n.__dirtyVertices,ra=n.__dirtyColors;if(w.sortParticles){Ta.multiplySelf(w.matrixWorld);for(x=0;xE){N=K;E=S[N]}e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[N]);e.vertexAttribPointer(C["morphTarget"+w],3,e.FLOAT,!1,0,0); +G.__webglMorphTargetInfluences[w]=E;I[N]=1;E=-1;w++}}e.uniform1fv(x.program.uniforms.morphTargetInfluences,G.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}if(z.__webglCustomAttributes)for(M in z.__webglCustomAttributes)if(n[M]>=0){C=z.__webglCustomAttributes[M];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(n[M],C.size,e.FLOAT,!1,0,0)}if(n.color>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglColorBuffer); e.vertexAttribPointer(n.color,3,e.FLOAT,!1,0,0)}if(n.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglNormalBuffer);e.vertexAttribPointer(n.normal,3,e.FLOAT,!1,0,0)}if(n.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglTangentBuffer);e.vertexAttribPointer(n.tangent,4,e.FLOAT,!1,0,0)}if(n.uv>=0)if(z.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,z.__webglUVBuffer);e.vertexAttribPointer(n.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv)}else e.disableVertexAttribArray(n.uv);if(n.uv2>=0)if(z.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER, z.__webglUV2Buffer);e.vertexAttribPointer(n.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv2)}else e.disableVertexAttribArray(n.uv2);if(x.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexABuffer);e.vertexAttribPointer(n.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexBBuffer);e.vertexAttribPointer(n.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinIndicesBuffer);e.vertexAttribPointer(n.skinIndex, 4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinWeightsBuffer);e.vertexAttribPointer(n.skinWeight,4,e.FLOAT,!1,0,0)}if(G instanceof THREE.Mesh)if(x.wireframe){e.lineWidth(x.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglLineBuffer);e.drawElements(e.LINES,z.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglFaceBuffer);e.drawElements(e.TRIANGLES,z.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(G instanceof THREE.Line){G=G.type==THREE.LineStrip? -e.LINE_STRIP:e.LINES;e.lineWidth(x.linewidth);e.drawArrays(G,0,z.__webglLineCount)}else if(G instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,z.__webglParticleCount);else G instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount)}}function g(n,C,u){if(!n.__webglVertexBuffer)n.__webglVertexBuffer=e.createBuffer();if(!n.__webglNormalBuffer)n.__webglNormalBuffer=e.createBuffer();if(n.hasPos){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.positionArray, -e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(u==THREE.FlatShading){var x,z,G,L,H,S,E,M,J,X,P=n.count*3;for(X=0;X0&&Na[0]< +wa.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(Y)}function B(n,C){var w,x,z;w=_sprite.attributes;var G=_sprite.uniforms,M=ia/ga,I,S=[],E=ga*0.5,N=ia*0.5,K=!0;e.useProgram(_sprite.program);za=_sprite.program;fa="";if(!ab){e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);ab=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer); +e.vertexAttribPointer(w.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(w.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(G.projectionMatrix,!1,Ya);e.activeTexture(e.TEXTURE0);e.uniform1i(G.map,0);w=0;for(x=n.__webglSprites.length;w0&&Na[0]< ga&&Na[1]>0&&Na[1]0.0010&&H.scale>0.0010){ra[0]=H.x;ra[1]=H.y;ra[2]=H.z;X=H.size*H.scale/ia;P[0]=X*E;P[1]=X;e.uniform3fv(xa.screenPosition,ra);e.uniform2fv(xa.scale,P);e.uniform1f(xa.rotation, -H.rotation);e.uniform1f(xa.opacity,H.opacity);K(H.blending);R(H.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Y)}function I(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function N(n){var C,u,x,z,G;if(n instanceof THREE.Mesh){u=n.geometry;for(C in u.geometryGroups){x=u.geometryGroups[C]; -G=!1;for(z in x.__webglCustomAttributes)if(x.__webglCustomAttributes[z].needsUpdate){G=!0;break}if(u.__dirtyVertices||u.__dirtyMorphTargets||u.__dirtyElements||u.__dirtyUvs||u.__dirtyNormals||u.__dirtyColors||u.__dirtyTangents||G){G=e.DYNAMIC_DRAW;var L=void 0,H=void 0,S=void 0,E=void 0;S=void 0;var M=void 0,J=void 0,X=void 0,P=void 0,ra=void 0,Na=void 0,xa=void 0,Ma=void 0,cb=void 0,Ga=void 0,Ha=void 0,Fa=void 0,Ua=void 0;J=void 0;X=void 0;E=void 0;P=void 0;E=void 0;var D=void 0,$=void 0;J=void 0; -D=void 0;$=void 0;var t=void 0,db=void 0;D=void 0;$=void 0;t=void 0;db=void 0;D=void 0;$=void 0;t=void 0;db=void 0;D=void 0;$=void 0;t=void 0;E=void 0;P=void 0;M=void 0;S=void 0;S=void 0;D=void 0;$=void 0;t=void 0;var hb=void 0,Ra=0,Sa=0,jb=0,kb=0,Ia=0,Va=0,Pa=0,bb=0,Wa=0,T=0,V=0;$=D=0;var ja=x.__vertexArray,sa=x.__uvArray,la=x.__uv2Array,Ja=x.__normalArray,qa=x.__tangentArray,ha=x.__colorArray,Q=x.__skinVertexAArray,Ba=x.__skinVertexBArray,Oa=x.__skinIndexArray,Ka=x.__skinWeightArray,ib=x.__morphTargetsArrays, -gb=x.__webglCustomAttributes;t=void 0;var Xa=x.__faceArray,$a=x.__lineArray,zb=x.__needsSmoothNormals;Na=x.__vertexColorType;ra=x.__uvType;xa=x.__normalType;var eb=n.geometry,tb=eb.__dirtyVertices,ub=eb.__dirtyElements,sb=eb.__dirtyUvs,vb=eb.__dirtyNormals,wb=eb.__dirtyTangents,xb=eb.__dirtyColors,yb=eb.__dirtyMorphTargets,ob=eb.vertices,Ab=x.faces,Db=eb.faces,Bb=eb.faceVertexUvs[0],Cb=eb.faceVertexUvs[1],pb=eb.skinVerticesA,qb=eb.skinVerticesB,rb=eb.skinIndices,mb=eb.skinWeights,nb=eb.edgeFaces, -lb=eb.morphTargets;if(gb)for(hb in gb){gb[hb].offset=0;gb[hb].offsetSrc=0}L=0;for(H=Ab.length;L0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ha,G)}if(vb){e.bindBuffer(e.ARRAY_BUFFER,x.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Ja,G)}if(wb&&eb.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,x.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,qa,G)}if(sb&&jb>0){e.bindBuffer(e.ARRAY_BUFFER, -x.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,sa,G)}if(sb&&kb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,la,G)}if(ub){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Xa,G);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,$a,G)}if(T>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,Q,G);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexBBuffer); -e.bufferData(e.ARRAY_BUFFER,Ba,G);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,Oa,G);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,Ka,G)}}}u.__dirtyVertices=!1;u.__dirtyMorphTargets=!1;u.__dirtyElements=!1;u.__dirtyUvs=!1;u.__dirtyNormals=!1;u.__dirtyTangents=!1;u.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){u=n.geometry;if(u.__dirtyVertices||u.__dirtyColors){n=u;C=e.DYNAMIC_DRAW;Na=n.vertices;x=n.colors;xa=Na.length; -G=x.length;Ma=n.__vertexArray;L=n.__colorArray;cb=n.__dirtyColors;if(n.__dirtyVertices){for(H=0;H65535){M[S].counter+=1;E=M[S].hash+"_"+M[S].counter;n.geometryGroups[E]==undefined&&(n.geometryGroups[E]={faces:[],materials:H,vertices:0,numMorphTargets:J})}n.geometryGroups[E].faces.push(z);n.geometryGroups[E].vertices+=L}}function A(n,C, -u){n.push({buffer:C,object:u,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(n){if(n!=fa){switch(n){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA, -e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}fa=n}}function O(n,C,u){if((u.width&u.width-1)==0&&(u.height&u.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,aa(C.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,aa(C.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,aa(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,aa(C.minFilter));e.generateMipmap(n)}else{e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_MAG_FILTER, +ea.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);w.positionScreen.x=ra[0];w.positionScreen.y=ra[1];w.positionScreen.z=ra[2];w.customUpdateCallback?w.customUpdateCallback(w):w.updateLensFlares();e.uniform1i(xa.renderType,2);e.enable(e.BLEND);G=0;for(M=w.lensFlares.length;G0.001&&I.scale>0.001){ra[0]=I.x;ra[1]=I.y;ra[2]=I.z;X=I.size*I.scale/ia;P[0]=X*E;P[1]=X;e.uniform3fv(xa.screenPosition,ra);e.uniform2fv(xa.scale,P);e.uniform1f(xa.rotation,I.rotation); +e.uniform1f(xa.opacity,I.opacity);L(I.blending);R(I.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Y)}function J(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function H(n){var C,w,x,z,G;if(n instanceof THREE.Mesh){w=n.geometry;for(C in w.geometryGroups){x=w.geometryGroups[C];G=!1;for(z in x.__webglCustomAttributes)if(x.__webglCustomAttributes[z].needsUpdate){G= +!0;break}if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents||G){G=e.DYNAMIC_DRAW;var M=void 0,I=void 0,S=void 0,E=void 0;S=void 0;var N=void 0,K=void 0,X=void 0,P=void 0,ra=void 0,Na=void 0,xa=void 0,Ma=void 0,cb=void 0,Ga=void 0,Ha=void 0,Fa=void 0,Ua=void 0;K=void 0;X=void 0;E=void 0;P=void 0;E=void 0;var D=void 0,$=void 0;K=void 0;D=void 0;$=void 0;var t=void 0,db=void 0;D=void 0;$=void 0;t=void 0;db=void 0;D=void 0; +$=void 0;t=void 0;db=void 0;D=void 0;$=void 0;t=void 0;E=void 0;P=void 0;N=void 0;S=void 0;S=void 0;D=void 0;$=void 0;t=void 0;var hb=void 0,Ra=0,Sa=0,jb=0,kb=0,Ia=0,Va=0,Pa=0,bb=0,Wa=0,T=0,V=0;$=D=0;var ja=x.__vertexArray,sa=x.__uvArray,la=x.__uv2Array,Ja=x.__normalArray,qa=x.__tangentArray,ha=x.__colorArray,Q=x.__skinVertexAArray,Ba=x.__skinVertexBArray,Oa=x.__skinIndexArray,Ka=x.__skinWeightArray,ib=x.__morphTargetsArrays,gb=x.__webglCustomAttributes;t=void 0;var Xa=x.__faceArray,$a=x.__lineArray, +yb=x.__needsSmoothNormals;Na=x.__vertexColorType;ra=x.__uvType;xa=x.__normalType;var eb=n.geometry,sb=eb.__dirtyVertices,tb=eb.__dirtyElements,rb=eb.__dirtyUvs,ub=eb.__dirtyNormals,vb=eb.__dirtyTangents,wb=eb.__dirtyColors,xb=eb.__dirtyMorphTargets,nb=eb.vertices,zb=x.faces,Cb=eb.faces,Ab=eb.faceVertexUvs[0],Bb=eb.faceVertexUvs[1],ob=eb.skinVerticesA,pb=eb.skinVerticesB,qb=eb.skinIndices,lb=eb.skinWeights,mb=n instanceof THREE.ShadowVolume?eb.edgeFaces:undefined;morphTargets=eb.morphTargets;if(gb)for(hb in gb){gb[hb].offset= +0;gb[hb].offsetSrc=0}M=0;for(I=zb.length;M0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ha,G)}if(ub){e.bindBuffer(e.ARRAY_BUFFER,x.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Ja,G)}if(vb&&eb.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,x.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER, +qa,G)}if(rb&&jb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,sa,G)}if(rb&&kb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,la,G)}if(tb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Xa,G);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,$a,G)}if(T>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,Q,G);e.bindBuffer(e.ARRAY_BUFFER, +x.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,G);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,Oa,G);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,Ka,G)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;C=e.DYNAMIC_DRAW;Na=n.vertices; +x=n.colors;xa=Na.length;G=x.length;Ma=n.__vertexArray;M=n.__colorArray;cb=n.__dirtyColors;if(n.__dirtyVertices){for(I=0;I65535){N[S].counter+=1;E=N[S].hash+"_"+N[S].counter;n.geometryGroups[E]==undefined&&(n.geometryGroups[E]={faces:[],materials:I,vertices:0,numMorphTargets:K})}n.geometryGroups[E].faces.push(z);n.geometryGroups[E].vertices+= +M}}function A(n,C,w){n.push({buffer:C,object:w,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(n){if(n!=fa){switch(n){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA, +e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}fa=n}}function O(n,C,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,aa(C.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,aa(C.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,aa(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,aa(C.minFilter));e.generateMipmap(n)}else{e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_MAG_FILTER, va(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,va(C.minFilter))}}function R(n,C){if(n.needsUpdate){if(n.__webglInit){e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n.image)}else{n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n.image);n.__webglInit=!0}O(e.TEXTURE_2D,n,n.image);e.bindTexture(e.TEXTURE_2D,null);n.needsUpdate=!1}e.activeTexture(e.TEXTURE0+ C);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function Ca(n){if(n&&!n.__webglFramebuffer){if(n.depthBuffer===undefined)n.depthBuffer=!0;if(n.stencilBuffer===undefined)n.stencilBuffer=!0;n.__webglFramebuffer=e.createFramebuffer();n.__webglRenderbuffer=e.createRenderbuffer();n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,aa(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,aa(n.wrapT));e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER,aa(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,aa(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,aa(n.format),n.width,n.height,0,aa(n.format),aa(n.type),null);e.bindRenderbuffer(e.RENDERBUFFER,n.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.__webglTexture,0);if(n.depthBuffer&&!n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height); -e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,u;if(n){C= -n.__webglFramebuffer;u=n.width;n=n.height}else{C=null;u=ga;n=ia}if(C!=Ea){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ma,Da,u,n);Ea=C}}function ka(n,C){var u;if(n=="fragment")u=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(u=e.createShader(e.VERTEX_SHADER));e.shaderSource(u,C);e.compileShader(u);if(!e.getShaderParameter(u,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(u));console.error(C);return null}return u}function va(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST; +e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,w;if(n){C= +n.__webglFramebuffer;w=n.width;n=n.height}else{C=null;w=ga;n=ia}if(C!=Ea){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ma,Da,w,n);Ea=C}}function ka(n,C){var w;if(n=="fragment")w=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(w=e.createShader(e.VERTEX_SHADER));e.shaderSource(w,C);e.compileShader(w);if(!e.getShaderParameter(w,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(w));console.error(C);return null}return w}function va(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST; default:return e.LINEAR}}function aa(n){switch(n){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR; case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0} var e,da=document.createElement("canvas"),ya=[],za=null,Ea=null,Y=!0,oa=this,pa=null,ta=null,fa=null,Z=null,ma=0,Da=0,ga=0,ia=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ta=new THREE.Matrix4,Ya=new Float32Array(16),Za=new Float32Array(16),Qa=new THREE.Vector4,U={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ca=!0,na=!0,Aa=new THREE.Color(0),La=0;if(b){if(b.stencil!= -undefined)ca=b.stencil;if(b.antialias!==undefined)na=b.antialias;b.clearColor!==undefined&&Aa.setHex(b.clearColor);if(b.clearAlpha!==undefined)La=b.clearAlpha}this.maxMorphTargets=8;this.domElement=da;this.autoClear=!0;this.sortObjects=!0;(function(n,C,u,x){try{if(!(e=da.getContext("experimental-webgl",{antialias:n,stencil:x})))throw"Error creating WebGL context.";}catch(z){console.error(z)}console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+ -" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,C.g,C.b,u)})(na,Aa,La,ca);this.context=e;if(ca){var wa={};wa.vertices=new Float32Array(12);wa.faces=new Uint16Array(6);wa.darkness=0.5;wa.vertices[0]=-20;wa.vertices[1]=-20;wa.vertices[2]=-1;wa.vertices[3]= +undefined)ca=b.stencil;if(b.antialias!==undefined)na=b.antialias;b.clearColor!==undefined&&Aa.setHex(b.clearColor);if(b.clearAlpha!==undefined)La=b.clearAlpha}this.maxMorphTargets=8;this.domElement=da;this.autoClear=!0;this.sortObjects=!0;(function(n,C,w,x){try{if(!(e=da.getContext("experimental-webgl",{antialias:n,stencil:x})))throw"Error creating WebGL context.";}catch(z){console.error(z)}console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+ +" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,C.g,C.b,w)})(na,Aa,La,ca);this.context=e;if(ca){var wa={};wa.vertices=new Float32Array(12);wa.faces=new Uint16Array(6);wa.darkness=0.5;wa.vertices[0]=-20;wa.vertices[1]=-20;wa.vertices[2]=-1;wa.vertices[3]= 20;wa.vertices[4]=-20;wa.vertices[5]=-1;wa.vertices[6]=20;wa.vertices[7]=20;wa.vertices[8]=-1;wa.vertices[9]=-20;wa.vertices[10]=20;wa.vertices[11]=-1;wa.faces[0]=0;wa.faces[1]=1;wa.faces[2]=2;wa.faces[3]=0;wa.faces[4]=2;wa.faces[5]=3;wa.vertexBuffer=e.createBuffer();wa.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,wa.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,wa.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,wa.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,wa.faces, e.STATIC_DRAW);wa.program=e.createProgram();e.attachShader(wa.program,ka("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(wa.program,ka("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(wa.program);wa.vertexLocation=e.getAttribLocation(wa.program,"position");wa.projectionLocation=e.getUniformLocation(wa.program,"projectionMatrix");wa.darknessLocation=e.getUniformLocation(wa.program,"darkness")}var ea={};ea.vertices=new Float32Array(16);ea.faces=new Uint16Array(6); b=0;ea.vertices[b++]=-1;ea.vertices[b++]=-1;ea.vertices[b++]=0;ea.vertices[b++]=0;ea.vertices[b++]=1;ea.vertices[b++]=-1;ea.vertices[b++]=1;ea.vertices[b++]=0;ea.vertices[b++]=1;ea.vertices[b++]=1;ea.vertices[b++]=1;ea.vertices[b++]=1;ea.vertices[b++]=-1;ea.vertices[b++]=1;ea.vertices[b++]=0;ea.vertices[b++]=1;b=0;ea.faces[b++]=0;ea.faces[b++]=1;ea.faces[b++]=2;ea.faces[b++]=0;ea.faces[b++]=2;ea.faces[b++]=3;ea.vertexBuffer=e.createBuffer();ea.elementBuffer=e.createBuffer();ea.tempTexture=e.createTexture(); @@ -317,62 +320,48 @@ e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTE _sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=e.createBuffer();_sprite.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,_sprite.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,_sprite.faces,e.STATIC_DRAW); _sprite.program=e.createProgram();e.attachShader(_sprite.program,ka("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,ka("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale= e.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=e.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=e.getUniformLocation(_sprite.program,"useScreenCoordinates"); -_sprite.uniforms.affectedByDistance=e.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=e.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");var ab=!1;this.setSize=function(n,C){da.width=n;da.height=C;this.setViewport(0,0,da.width,da.height)};this.setViewport=function(n,C,u,x){ma= -n;Da=C;ga=u;ia=x;e.viewport(ma,Da,ga,ia)};this.setScissor=function(n,C,u,x){e.scissor(n,C,u,x)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){Y=n;e.depthMask(n)};this.setClearColorHex=function(n,C){var u=new THREE.Color(n);e.clearColor(u.r,u.g,u.b,C)};this.setClearColor=function(n,C){e.clearColor(n.r,n.g,n.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness= -function(n){wa.darkness=n};this.initMaterial=function(n,C,u,x){var z,G,L;if(n instanceof THREE.MeshDepthMaterial)L="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)L="shadowVolumeDynamic";else if(n instanceof THREE.MeshNormalMaterial)L="normal";else if(n instanceof THREE.MeshBasicMaterial)L="basic";else if(n instanceof THREE.MeshLambertMaterial)L="lambert";else if(n instanceof THREE.MeshPhongMaterial)L="phong";else if(n instanceof THREE.LineBasicMaterial)L="basic";else n instanceof THREE.ParticleBasicMaterial&& -(L="particle_basic");if(L){var H=THREE.ShaderLib[L];n.uniforms=Uniforms.clone(H.uniforms);n.vertexShader=H.vertexShader;n.fragmentShader=H.fragmentShader}var S,E,M;S=M=H=0;for(E=C.length;S0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights, -"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_BONES "+u.maxBones,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"",u.skinning?"#define USE_SKINNING":"",u.morphTargets?"#define USE_MORPHTARGETS":"",u.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n"); -e.attachShader(X,ka("fragment",prefix_fragment+S));e.attachShader(X,ka("vertex",prefix_vertex+E));e.linkProgram(X);e.getProgramParameter(X,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(X,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");X.uniforms={};X.attributes={};var P;S=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(P in H)S.push(P); -P=S;H=0;for(S=P.length;H=0&&e.enableVertexAttribArray(J.color);J.normal>= -0&&e.enableVertexAttribArray(J.normal);J.tangent>=0&&e.enableVertexAttribArray(J.tangent);if(n.skinning&&J.skinVertexA>=0&&J.skinVertexB>=0&&J.skinIndex>=0&&J.skinWeight>=0){e.enableVertexAttribArray(J.skinVertexA);e.enableVertexAttribArray(J.skinVertexB);e.enableVertexAttribArray(J.skinIndex);e.enableVertexAttribArray(J.skinWeight)}for(z in n.attributes)J[z]>=0&&e.enableVertexAttribArray(J[z]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(J.morphTarget0>=0){e.enableVertexAttribArray(J.morphTarget0); -n.numSupportedMorphTargets++}if(J.morphTarget1>=0){e.enableVertexAttribArray(J.morphTarget1);n.numSupportedMorphTargets++}if(J.morphTarget2>=0){e.enableVertexAttribArray(J.morphTarget2);n.numSupportedMorphTargets++}if(J.morphTarget3>=0){e.enableVertexAttribArray(J.morphTarget3);n.numSupportedMorphTargets++}if(J.morphTarget4>=0){e.enableVertexAttribArray(J.morphTarget4);n.numSupportedMorphTargets++}if(J.morphTarget5>=0){e.enableVertexAttribArray(J.morphTarget5);n.numSupportedMorphTargets++}if(J.morphTarget6>= -0){e.enableVertexAttribArray(J.morphTarget6);n.numSupportedMorphTargets++}if(J.morphTarget7>=0){e.enableVertexAttribArray(J.morphTarget7);n.numSupportedMorphTargets++}x.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(z=this.maxMorphTargets;n0||X.faceVertexUvs.length>0)L.__uvArray=new Float32Array(S*2);if(X.faceUvs.length>1||X.faceVertexUvs.length>1)L.__uv2Array=new Float32Array(S*2)}if(H.geometry.skinWeights.length&&H.geometry.skinIndices.length){L.__skinVertexAArray= -new Float32Array(S*4);L.__skinVertexBArray=new Float32Array(S*4);L.__skinIndexArray=new Float32Array(S*4);L.__skinWeightArray=new Float32Array(S*4)}L.__faceArray=new Uint16Array(ra*3+(H.geometry.edgeFaces?H.geometry.edgeFaces.length*6:0));L.__lineArray=new Uint16Array(Na*2);if(L.numMorphTargets){L.__morphTargetsArrays=[];X=0;for(P=L.numMorphTargets;X=0;z--){x=u.__webglObjects[z].object;if(C==x){u.__webglObjects.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}C=0;for(u=n.__webglObjects.length;C0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+w.maxDirLights, +"#define MAX_POINT_LIGHTS "+w.maxPointLights,"#define MAX_BONES "+w.maxBones,w.map?"#define USE_MAP":"",w.envMap?"#define USE_ENVMAP":"",w.lightMap?"#define USE_LIGHTMAP":"",w.vertexColors?"#define USE_COLOR":"",w.skinning?"#define USE_SKINNING":"",w.morphTargets?"#define USE_MORPHTARGETS":"",w.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n"); +e.attachShader(X,ka("fragment",prefix_fragment+S));e.attachShader(X,ka("vertex",prefix_vertex+E));e.linkProgram(X);e.getProgramParameter(X,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(X,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");X.uniforms={};X.attributes={};var P;S=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(P in I)S.push(P); +P=S;I=0;for(S=P.length;I=0&&e.enableVertexAttribArray(K.color);K.normal>= +0&&e.enableVertexAttribArray(K.normal);K.tangent>=0&&e.enableVertexAttribArray(K.tangent);if(n.skinning&&K.skinVertexA>=0&&K.skinVertexB>=0&&K.skinIndex>=0&&K.skinWeight>=0){e.enableVertexAttribArray(K.skinVertexA);e.enableVertexAttribArray(K.skinVertexB);e.enableVertexAttribArray(K.skinIndex);e.enableVertexAttribArray(K.skinWeight)}for(z in n.attributes)K[z]>=0&&e.enableVertexAttribArray(K[z]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(K.morphTarget0>=0){e.enableVertexAttribArray(K.morphTarget0); +n.numSupportedMorphTargets++}if(K.morphTarget1>=0){e.enableVertexAttribArray(K.morphTarget1);n.numSupportedMorphTargets++}if(K.morphTarget2>=0){e.enableVertexAttribArray(K.morphTarget2);n.numSupportedMorphTargets++}if(K.morphTarget3>=0){e.enableVertexAttribArray(K.morphTarget3);n.numSupportedMorphTargets++}if(K.morphTarget4>=0){e.enableVertexAttribArray(K.morphTarget4);n.numSupportedMorphTargets++}if(K.morphTarget5>=0){e.enableVertexAttribArray(K.morphTarget5);n.numSupportedMorphTargets++}if(K.morphTarget6>= +0){e.enableVertexAttribArray(K.morphTarget6);n.numSupportedMorphTargets++}if(K.morphTarget7>=0){e.enableVertexAttribArray(K.morphTarget7);n.numSupportedMorphTargets++}x.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(z=this.maxMorphTargets;n0||X.faceVertexUvs.length>0)M.__uvArray=new Float32Array(S*2);if(X.faceUvs.length>1||X.faceVertexUvs.length>1)M.__uv2Array=new Float32Array(S*2)}if(I.geometry.skinWeights.length&&I.geometry.skinIndices.length){M.__skinVertexAArray= +new Float32Array(S*4);M.__skinVertexBArray=new Float32Array(S*4);M.__skinIndexArray=new Float32Array(S*4);M.__skinWeightArray=new Float32Array(S*4)}M.__faceArray=new Uint16Array(ra*3+(I.geometry.edgeFaces?I.geometry.edgeFaces.length*6:0));M.__lineArray=new Uint16Array(Na*2);if(M.numMorphTargets){M.__morphTargetsArrays=[];X=0;for(P=M.numMorphTargets;X=0;z--){x=w.__webglObjects[z].object;if(C==x){w.__webglObjects.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}C=0;for(w=n.__webglObjects.length;C0}}; -THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBAFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!== -undefined?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==undefined?d.stencilBuffer:!0}; -THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,c,d){d&&b.update(undefined,!1,c);d=b.sounds;var f,g=d.length;for(f=0;fh?this.hits.push(g):this.hits.unshift(g);h=f}}return this.hits}; -THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var d=0;c[d]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[d]);if(fc.length)return null;return c[d]}; -THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var d=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g=0;g=k*h))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);if(Math.abs(g.x)>Math.abs(g.y))if(Math.abs(g.x)>Math.abs(g.z)){b=k.y-c.y;g=d.y-c.y;h=f.y-c.y; -k=k.z-c.z;d=d.z-c.z;f=f.z-c.z}else{b=k.x-c.x;g=d.x-c.x;h=f.x-c.x;k=k.y-c.y;d=d.y-c.y;f=f.y-c.y}else if(Math.abs(g.y)>Math.abs(g.z)){b=k.x-c.x;g=d.x-c.x;h=f.x-c.x;k=k.z-c.z;d=d.z-c.z;f=f.z-c.z}else{b=k.x-c.x;g=d.x-c.x;h=f.x-c.x;k=k.y-c.y;d=d.y-c.y;f=f.y-c.y}c=g*f-d*h;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-k*h)*c;if(!(f>=0))return Number.MAX_VALUE;c*=g*k-d*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return j}; -THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var d=new THREE.Ray(b.origin.clone(),b.direction.clone()),f=THREE.Matrix4.makeInvert(c.matrixWorld);f.multiplyVector3(d.origin);f.rotateAxis(d.direction);d.direction.normalize();return d}; -THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;d=c.dynamic&&c.mesh&&c.mesh.matrixWorld?this.makeRayLocal(b,c.mesh):new THREE.Ray(b.origin.clone(),b.direction.clone());var f=0,g=0,h=0,j=0,k=0,m=0,p=!0;if(d.origin.xc.max.x){f=c.max.x-d.origin.x;f/=d.direction.x;p=!1;j=1}if(d.origin.yc.max.y){g=c.max.y-d.origin.y;g/=d.direction.y;p=!1;k= -1}if(d.origin.zc.max.z){h=c.max.z-d.origin.z;h/=d.direction.z;p=!1;m=1}if(p)return-1;p=0;if(g>f){p=1;f=g}if(h>f){p=2;f=h}switch(p){case 0:k=d.origin.y+d.direction.y*f;if(kc.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*f;if(dc.max.z)return Number.MAX_VALUE;c.normal=new THREE.Vector3(j,0,0);break;case 1:j=d.origin.x+d.direction.x*f;if(jc.max.x)return Number.MAX_VALUE;d=d.origin.z+ -d.direction.z*f;if(dc.max.z)return Number.MAX_VALUE;c.normal=new THREE.Vector3(0,k,0);break;case 2:j=d.origin.x+d.direction.x*f;if(jc.max.x)return Number.MAX_VALUE;k=d.origin.y+d.direction.y*f;if(kc.max.y)return Number.MAX_VALUE;c.normal=new THREE.Vector3(0,0,m)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var d=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(d<0)d=(f-b.origin.dot(c.normal))/d;else return Number.MAX_VALUE;return d>0?d:Number.MAX_VALUE}; -THREE.CollisionSystem.prototype.raySphere=function(b,c){var d=c.center.clone().subSelf(b.origin);if(d.lengthSq=0)return Math.abs(f)-Math.sqrt(d);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionUtils={}; -THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,d=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]);d=new THREE.BoxCollider(d,c);d.mesh=b;return d};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c}; -THREE.CollisionUtils.MeshColliderWBox=function(b){for(var c=b.geometry.vertices,d=c.length,f=b.geometry.faces,g=f.length,h=[],j=[],k=[],m=0;m= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}", @@ -381,99 +370,99 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i25&&(h=25);g=(h-1)*0.5;d=Array(h);for(c=f=0;c25&&(h=25);g=(h-1)*0.5;c=Array(h);for(d=f=0;d -this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);var d=this.lookSpeed;this.activeLook||(d=0);this.lon+=this.mouseX*d;this.lookVertical&&(this.lat-=this.mouseY*d);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 f=this.target.position,g=this.position;f.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);f.y=g.y+100*Math.cos(this.phi);f.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*d;this.lookVertical&&(this.lat-=this.mouseY*d);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=(this.phi-0)*(this.verticalMax-this.verticalMin)/ -3.14+this.verticalMin;f=this.target.position;g=this.position;f.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);f.y=g.y+100*Math.cos(this.phi);f.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(d){d.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this, -this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))}; -THREE.PathCamera=function(b){function c(p,o,w,y){var v={name:w,fps:0.6,length:y,hierarchy:[]},B,F=o.getControlPointsArray(),I=o.getLength(),N=F.length,W=0;B=N-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:F[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B +this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);var c=this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi= +(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var f=this.target.position,g=this.position;f.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);f.y=g.y+100*Math.cos(this.phi);f.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/ +3.14+this.verticalMin;f=this.target.position;g=this.position;f.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);f.y=g.y+100*Math.cos(this.phi);f.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(c){c.preventDefault()},!1);this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this, +this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))}; +THREE.PathCamera=function(b){function d(p,o,v,y){var u={name:v,fps:0.6,length:y,hierarchy:[]},B,F=o.getControlPointsArray(),J=o.getLength(),H=F.length,W=0;B=H-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:F[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B=0?y:y+g;y=this.verticalAngleMap.srcRange;v=this.verticalAngleMap.dstRange; -this.phi=(this.phi-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.horizontalAngleMap.srcRange;v=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,w)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); -this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(m,j);b.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation= -c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(p,o){return function(){o.apply(p,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; -var Cube=function(b,c,d,f,g,h,j,k,m){function p(I,N,W,A,K,O,R,Ca){var ka,va,aa=f||1,e=g||1,da=K/2,ya=O/2,za=o.vertices.length;if(I=="x"&&N=="y"||I=="y"&&N=="x")ka="z";else if(I=="x"&&N=="z"||I=="z"&&N=="x"){ka="y";e=h||1}else if(I=="z"&&N=="y"||I=="y"&&N=="z"){ka="x";aa=h||1}var Ea=aa+1,Y=e+1;K/=aa;var oa=O/e;for(va=0;va0){j(0,0,-o-(h||0));for(m=b;m0){j(0,0,o+(g||0));for(m= -b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m=0?y:y+g;y=this.verticalAngleMap.srcRange;u=this.verticalAngleMap.dstRange; +this.phi=(this.phi-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[0];y=this.horizontalAngleMap.srcRange;u=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,v)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); +this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(m,j);b.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation= +d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(p,o){return function(){o.apply(p,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; +var Cube=function(b,d,c,f,g,h,j,k,m){function p(J,H,W,A,L,O,R,Ca){var ka,va,aa=f||1,e=g||1,da=L/2,ya=O/2,za=o.vertices.length;if(J=="x"&&H=="y"||J=="y"&&H=="x")ka="z";else if(J=="x"&&H=="z"||J=="z"&&H=="x"){ka="y";e=h||1}else if(J=="z"&&H=="y"||J=="y"&&H=="z"){ka="x";aa=h||1}var Ea=aa+1,Y=e+1;L/=aa;var oa=O/e;for(va=0;va0){j(0,0,-o-(h||0));for(m=b;m0){j(0,0,o+(g||0));for(m= +b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,k,y)))-1);p.push(o)}c.push(p)}var v,B,F;g=c.length;for(d=0;d0)for(f=0;f1){v=this.vertices[j].position.clone(); -B=this.vertices[m].position.clone();F=this.vertices[p].position.clone();v.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,m,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,w,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; -var Torus=function(b,c,d,f){this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=f||6;b=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){f=d/this.segmentsT*2*Math.PI;var g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d= -1;d<=this.segmentsT;++d){f=(this.segmentsT+1)*c+d;g=(this.segmentsT+1)*c+d-1;var h=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; -var TorusKnot=function(b,c,d,f,g,h,j){function k(w,y,v,B,F,I){y=v/B*w;v=Math.cos(y);return new THREE.Vector3(F*(2+v)*0.5*Math.cos(w),F*(2+v)*Math.sin(w)*0.5,I*F*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,k,y)))-1);p.push(o)}d.push(p)}var u,B,F;g=d.length;for(c=0;c0)for(f=0;f1){u=this.vertices[j].position.clone(); +B=this.vertices[m].position.clone();F=this.vertices[p].position.clone();u.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,m,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,v,J])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Torus=function(b,d,c,f){this.radius=b||100;this.tube=d||40;this.segmentsR=c||8;this.segmentsT=f||6;b=[];THREE.Geometry.call(this);for(d=0;d<=this.segmentsR;++d)for(c=0;c<=this.segmentsT;++c){f=c/this.segmentsT*2*Math.PI;var g=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([c/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(c= +1;c<=this.segmentsT;++c){f=(this.segmentsT+1)*d+c;g=(this.segmentsT+1)*d+c-1;var h=(this.segmentsT+1)*(d-1)+c-1,j=(this.segmentsT+1)*(d-1)+c;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; +var TorusKnot=function(b,d,c,f,g,h,j){function k(v,y,u,B,F,J){y=u/B*v;u=Math.cos(y);return new THREE.Vector3(F*(2+u)*0.5*Math.cos(v),F*(2+u)*Math.sin(v)*0.5,J*F*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b>7)-127;na|=(La&127)<<16|Aa<<8;if(na==0&&ea==-127)return 0;return(1-2*(wa>>7))*(1+na*Math.pow(2,-23))*Math.pow(2,ea)}function k(U,ca){var na=o(U,ca),Aa=o(U,ca+1),La=o(U,ca+2);return(o(U,ca+3)<<24)+(La<<16)+(Aa<<8)+na}function m(U,ca){var na=o(U,ca);return(o(U,ca+1)<<8)+na}function p(U,ca){var na=o(U, -ca);return na>127?na-256:na}function o(U,ca){return U.charCodeAt(ca)&255}function w(U){var ca,na,Aa;ca=k(b,U);na=k(b,U+R);Aa=k(b,U+Ca);U=m(b,U+ka);THREE.BinaryLoader.prototype.f3(N,ca,na,Aa,U)}function y(U){var ca,na,Aa,La,wa,ea;ca=k(b,U);na=k(b,U+R);Aa=k(b,U+Ca);La=m(b,U+ka);wa=k(b,U+va);ea=k(b,U+aa);U=k(b,U+e);THREE.BinaryLoader.prototype.f3n(N,K,ca,na,Aa,La,wa,ea,U)}function v(U){var ca,na,Aa,La;ca=k(b,U);na=k(b,U+da);Aa=k(b,U+ya);La=k(b,U+za);U=m(b,U+Ea);THREE.BinaryLoader.prototype.f4(N,ca,na, -Aa,La,U)}function B(U){var ca,na,Aa,La,wa,ea,fb,ab;ca=k(b,U);na=k(b,U+da);Aa=k(b,U+ya);La=k(b,U+za);wa=m(b,U+Ea);ea=k(b,U+Y);fb=k(b,U+oa);ab=k(b,U+pa);U=k(b,U+ta);THREE.BinaryLoader.prototype.f4n(N,K,ca,na,Aa,La,wa,ea,fb,ab,U)}function F(U){var ca,na;ca=k(b,U);na=k(b,U+fa);U=k(b,U+Z);THREE.BinaryLoader.prototype.uv3(N.faceVertexUvs[0],O[ca*2],O[ca*2+1],O[na*2],O[na*2+1],O[U*2],O[U*2+1])}function I(U){var ca,na,Aa;ca=k(b,U);na=k(b,U+ma);Aa=k(b,U+Da);U=k(b,U+ga);THREE.BinaryLoader.prototype.uv4(N.faceVertexUvs[0], -O[ca*2],O[ca*2+1],O[na*2],O[na*2+1],O[Aa*2],O[Aa*2+1],O[U*2],O[U*2+1])}var N=this,W=0,A,K=[],O=[],R,Ca,ka,va,aa,e,da,ya,za,Ea,Y,oa,pa,ta,fa,Z,ma,Da,ga,ia,ua,Ta,Ya,Za,Qa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(N,f,h);A={signature:b.substr(W,8),header_bytes:o(b,W+8),vertex_coordinate_bytes:o(b,W+9),normal_coordinate_bytes:o(b,W+10),uv_coordinate_bytes:o(b,W+11),vertex_index_bytes:o(b,W+12),normal_index_bytes:o(b,W+13),uv_index_bytes:o(b,W+14),material_index_bytes:o(b,W+15),nvertices:k(b, +j=0;for(k=p.length;j>7)-127;na|=(La&127)<<16|Aa<<8;if(na==0&&ea==-127)return 0;return(1-2*(wa>>7))*(1+na*Math.pow(2,-23))*Math.pow(2,ea)}function k(U,ca){var na=o(U,ca),Aa=o(U,ca+1),La=o(U,ca+2);return(o(U,ca+3)<<24)+(La<<16)+(Aa<<8)+na}function m(U,ca){var na=o(U,ca);return(o(U,ca+1)<<8)+na}function p(U,ca){var na=o(U, +ca);return na>127?na-256:na}function o(U,ca){return U.charCodeAt(ca)&255}function v(U){var ca,na,Aa;ca=k(b,U);na=k(b,U+R);Aa=k(b,U+Ca);U=m(b,U+ka);THREE.BinaryLoader.prototype.f3(H,ca,na,Aa,U)}function y(U){var ca,na,Aa,La,wa,ea;ca=k(b,U);na=k(b,U+R);Aa=k(b,U+Ca);La=m(b,U+ka);wa=k(b,U+va);ea=k(b,U+aa);U=k(b,U+e);THREE.BinaryLoader.prototype.f3n(H,L,ca,na,Aa,La,wa,ea,U)}function u(U){var ca,na,Aa,La;ca=k(b,U);na=k(b,U+da);Aa=k(b,U+ya);La=k(b,U+za);U=m(b,U+Ea);THREE.BinaryLoader.prototype.f4(H,ca,na, +Aa,La,U)}function B(U){var ca,na,Aa,La,wa,ea,fb,ab;ca=k(b,U);na=k(b,U+da);Aa=k(b,U+ya);La=k(b,U+za);wa=m(b,U+Ea);ea=k(b,U+Y);fb=k(b,U+oa);ab=k(b,U+pa);U=k(b,U+ta);THREE.BinaryLoader.prototype.f4n(H,L,ca,na,Aa,La,wa,ea,fb,ab,U)}function F(U){var ca,na;ca=k(b,U);na=k(b,U+fa);U=k(b,U+Z);THREE.BinaryLoader.prototype.uv3(H.faceVertexUvs[0],O[ca*2],O[ca*2+1],O[na*2],O[na*2+1],O[U*2],O[U*2+1])}function J(U){var ca,na,Aa;ca=k(b,U);na=k(b,U+ma);Aa=k(b,U+Da);U=k(b,U+ga);THREE.BinaryLoader.prototype.uv4(H.faceVertexUvs[0], +O[ca*2],O[ca*2+1],O[na*2],O[na*2+1],O[Aa*2],O[Aa*2+1],O[U*2],O[U*2+1])}var H=this,W=0,A,L=[],O=[],R,Ca,ka,va,aa,e,da,ya,za,Ea,Y,oa,pa,ta,fa,Z,ma,Da,ga,ia,ua,Ta,Ya,Za,Qa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(H,f,h);A={signature:b.substr(W,8),header_bytes:o(b,W+8),vertex_coordinate_bytes:o(b,W+9),normal_coordinate_bytes:o(b,W+10),uv_coordinate_bytes:o(b,W+11),vertex_index_bytes:o(b,W+12),normal_index_bytes:o(b,W+13),uv_index_bytes:o(b,W+14),material_index_bytes:o(b,W+15),nvertices:k(b, W+16),nnormals:k(b,W+16+4),nuvs:k(b,W+16+8),ntri_flat:k(b,W+16+12),ntri_smooth:k(b,W+16+16),ntri_flat_uv:k(b,W+16+20),ntri_smooth_uv:k(b,W+16+24),nquad_flat:k(b,W+16+28),nquad_smooth:k(b,W+16+32),nquad_flat_uv:k(b,W+16+36),nquad_smooth_uv:k(b,W+16+40)};W+=A.header_bytes;R=A.vertex_index_bytes;Ca=A.vertex_index_bytes*2;ka=A.vertex_index_bytes*3;va=A.vertex_index_bytes*3+A.material_index_bytes;aa=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;e=A.vertex_index_bytes*3+A.material_index_bytes+ A.normal_index_bytes*2;da=A.vertex_index_bytes;ya=A.vertex_index_bytes*2;za=A.vertex_index_bytes*3;Ea=A.vertex_index_bytes*4;Y=A.vertex_index_bytes*4+A.material_index_bytes;oa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;pa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;ta=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;fa=A.uv_index_bytes;Z=A.uv_index_bytes*2;ma=A.uv_index_bytes;Da=A.uv_index_bytes*2;ga=A.uv_index_bytes*3;h=A.vertex_index_bytes* 3+A.material_index_bytes;Qa=A.vertex_index_bytes*4+A.material_index_bytes;ia=A.ntri_flat*h;ua=A.ntri_smooth*(h+A.normal_index_bytes*3);Ta=A.ntri_flat_uv*(h+A.uv_index_bytes*3);Ya=A.ntri_smooth_uv*(h+A.normal_index_bytes*3+A.uv_index_bytes*3);Za=A.nquad_flat*Qa;h=A.nquad_smooth*(Qa+A.normal_index_bytes*4);Qa=A.nquad_flat_uv*(Qa+A.uv_index_bytes*4);W+=function(U){for(var ca,na,Aa,La=A.vertex_coordinate_bytes*3,wa=U+A.nvertices*La;U=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(d){if(this.count!=0){for(var f=this.count*3;fthis.size-1&&(m=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(o-k);v<1&&(v=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var B,F,I,N,W,A;w0&&(this.field[I+B]+=N)}}}};this.addPlaneX=function(d,f){var g,h,j,k,m,p=this.size,o=this.yd,w=this.zd,y=this.field,v=p*Math.sqrt(d/f);v>p&&(v=p);for(g=0;g0)for(h=0;ho&&(B=o);for(h=0;h0){m=h*w;for(g=0;gsize&&(dist=size);for(j=0;j0){m=zd*j;for(h=0;h=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;fthis.size-1&&(m=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 u=Math.floor(o-k);u<1&&(u=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var B,F,J,H,W,A;v0&&(this.field[J+B]+=H)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,p=this.size,o=this.yd,v=this.zd,y=this.field,u=p*Math.sqrt(c/f);u>p&&(u=p);for(g=0;g0)for(h=0;ho&&(B=o);for(h=0;h0){m=h*v;for(g=0;gsize&&(dist=size);for(j=0;j0){m=zd*j;for(h=0;hh?this.hits.push(g):this.hits.unshift(g);h=f}}return this.hits}; +THREE.CollisionSystem.prototype.rayCastNearest=function(b){var d=this.rayCastAll(b);if(d.length==0)return null;for(var c=0;d[c]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,d[c]);if(fd.length)return null;return d[c]}; +THREE.CollisionSystem.prototype.rayCast=function(b,d){if(d instanceof THREE.PlaneCollider)return this.rayPlane(b,d);else if(d instanceof THREE.SphereCollider)return this.raySphere(b,d);else if(d instanceof THREE.BoxCollider)return this.rayBox(b,d);else if(d instanceof THREE.MeshCollider&&d.box)return this.rayBox(b,d.box)}; +THREE.CollisionSystem.prototype.rayMesh=function(b,d){for(var c=this.makeRayLocal(b,d.mesh),f=Number.MAX_VALUE,g=0;g=k*h))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);if(Math.abs(g.x)>Math.abs(g.y))if(Math.abs(g.x)>Math.abs(g.z)){b=k.y-d.y;g=c.y-d.y;h=f.y-d.y; +k=k.z-d.z;c=c.z-d.z;f=f.z-d.z}else{b=k.x-d.x;g=c.x-d.x;h=f.x-d.x;k=k.y-d.y;c=c.y-d.y;f=f.y-d.y}else if(Math.abs(g.y)>Math.abs(g.z)){b=k.x-d.x;g=c.x-d.x;h=f.x-d.x;k=k.z-d.z;c=c.z-d.z;f=f.z-d.z}else{b=k.x-d.x;g=c.x-d.x;h=f.x-d.x;k=k.y-d.y;c=c.y-d.y;f=f.y-d.y}d=g*f-c*h;if(d==0)return Number.MAX_VALUE;d=1/d;f=(b*f-k*h)*d;if(!(f>=0))return Number.MAX_VALUE;d*=g*k-c*b;if(!(d>=0))return Number.MAX_VALUE;if(!(1-f-d>=0))return Number.MAX_VALUE;return j}; +THREE.CollisionSystem.prototype.makeRayLocal=function(b,d){var c=new THREE.Ray(b.origin.clone(),b.direction.clone()),f=THREE.Matrix4.makeInvert(d.matrixWorld);f.multiplyVector3(c.origin);f.rotateAxis(c.direction);c.direction.normalize();return c}; +THREE.CollisionSystem.prototype.rayBox=function(b,d){var c;c=d.dynamic&&d.mesh&&d.mesh.matrixWorld?this.makeRayLocal(b,d.mesh):new THREE.Ray(b.origin.clone(),b.direction.clone());var f=0,g=0,h=0,j=0,k=0,m=0,p=!0;if(c.origin.xd.max.x){f=d.max.x-c.origin.x;f/=c.direction.x;p=!1;j=1}if(c.origin.yd.max.y){g=d.max.y-c.origin.y;g/=c.direction.y;p=!1;k= +1}if(c.origin.zd.max.z){h=d.max.z-c.origin.z;h/=c.direction.z;p=!1;m=1}if(p)return-1;p=0;if(g>f){p=1;f=g}if(h>f){p=2;f=h}switch(p){case 0:k=c.origin.y+c.direction.y*f;if(kd.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*f;if(cd.max.z)return Number.MAX_VALUE;d.normal=new THREE.Vector3(j,0,0);break;case 1:j=c.origin.x+c.direction.x*f;if(jd.max.x)return Number.MAX_VALUE;c=c.origin.z+ +c.direction.z*f;if(cd.max.z)return Number.MAX_VALUE;d.normal=new THREE.Vector3(0,k,0);break;case 2:j=c.origin.x+c.direction.x*f;if(jd.max.x)return Number.MAX_VALUE;k=c.origin.y+c.direction.y*f;if(kd.max.y)return Number.MAX_VALUE;d.normal=new THREE.Vector3(0,0,m)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,d){var c=b.direction.dot(d.normal),f=d.point.dot(d.normal);if(c<0)c=(f-b.origin.dot(d.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE}; +THREE.CollisionSystem.prototype.raySphere=function(b,d){var c=d.center.clone().subSelf(b.origin);if(c.lengthSq=0)return Math.abs(f)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionUtils={}; +THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var d=b.geometry.boundingBox,c=new THREE.Vector3(d.x[0],d.y[0],d.z[0]);d=new THREE.Vector3(d.x[1],d.y[1],d.z[1]);c=new THREE.BoxCollider(c,d);c.mesh=b;return c};THREE.CollisionUtils.MeshAABB=function(b){var d=THREE.CollisionUtils.MeshOBB(b);d.min.addSelf(b.position);d.max.addSelf(b.position);d.dynamic=!1;return d}; +THREE.CollisionUtils.MeshColliderWBox=function(b){for(var d=b.geometry.vertices,c=d.length,f=b.geometry.faces,g=f.length,h=[],j=[],k=[],m=0;m=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){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);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.001){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);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,e,d,g){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=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)}; THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; diff --git a/build/custom/ThreeDOM.js b/build/custom/ThreeDOM.js index a06701585d..c59f18dd5c 100644 --- a/build/custom/ThreeDOM.js +++ b/build/custom/ThreeDOM.js @@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined? THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=e*d;this.w=f*g-i*c;this.x=f*c+i*g;this.y=e*b*g+a*d*c;this.z=a*d*g-e*b*c;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);if(a==0)this.w=this.z=this.y=this.x=0;else{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,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this}, multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,l=h*e+i*c-g*d,m=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+l*-i-m*-f;b.y=l*h+c*-f+m*-g-j*-i;b.z=m*h+c*-i+j*-f-l*-g;return b}}; -THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){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);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.001){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);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,e,d,g){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=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)}; THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}}; diff --git a/build/custom/ThreeExtras.js b/build/custom/ThreeExtras.js index a77b382765..dec48508fa 100644 --- a/build/custom/ThreeExtras.js +++ b/build/custom/ThreeExtras.js @@ -1,11 +1,11 @@ // ThreeExtras.js r38 - http://github.com/mrdoob/three.js -var GeometryUtils={merge:function(a,f){var b=f instanceof THREE.Mesh,e=a.vertices.length,c=b?f.geometry:f,d=a.vertices,g=c.vertices,h=a.faces,j=c.faces,m=a.faceVertexUvs[0];c=c.faceVertexUvs[0];b&&f.matrixAutoUpdate&&f.updateMatrix();for(var k=0,n=g.length;k= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}", @@ -14,98 +14,98 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i25&&(d=25);c=(d-1)*0.5;b=Array(d);for(f=e=0;f25&&(f=25);e=(f-1)*0.5;c=Array(f);for(b=d=0;b -this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);var b=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 e=this.target.position,c=this.position;e.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);e.y=c.y+100*Math.cos(this.phi);e.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}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;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/ -3.14+this.verticalMin;e=this.target.position;c=this.position;e.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);e.y=c.y+100*Math.cos(this.phi);e.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",f(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",f(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",f(this, -this.onMouseUp),!1);this.domElement.addEventListener("keydown",f(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",f(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.prototype.translate=function(a,f){this.matrix.rotateAxis(f);if(this.noFly)f.y=0;this.position.addSelf(f.multiplyScalar(a));this.target.position.addSelf(f.multiplyScalar(a))}; -THREE.PathCamera=function(a){function f(m,k,n,p){var t={name:n,fps:0.6,length:p,hierarchy:[]},w,x=k.getControlPointsArray(),u=k.getLength(),B=x.length,z=0;w=B-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:x[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[w]={time:p,pos:x[w],rot:[0,0,0,1],scl:[1,1,1]};for(w=1;w +this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);var c=this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi= +(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var d=this.target.position,e=this.position;d.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);d.y=e.y+100*Math.cos(this.phi);d.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/ +3.14+this.verticalMin;d=this.target.position;e=this.position;d.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);d.y=e.y+100*Math.cos(this.phi);d.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(c){c.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.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))}; +THREE.PathCamera=function(a){function b(l,k,n,p){var t={name:n,fps:0.6,length:p,hierarchy:[]},w,x=k.getControlPointsArray(),u=k.getLength(),B=x.length,z=0;w=B-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:x[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[w]={time:p,pos:x[w],rot:[0,0,0,1],scl:[1,1,1]};for(w=1;w=0?p:p+c;p=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange; -this.phi=(this.phi-p[0])*(t[1]-t[0])/(p[1]-p[0])+t[0];p=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(t[1]-t[0])/(p[1]-p[0])+t[0];p=this.target.position;p.x=100*Math.sin(this.phi)*Math.cos(this.theta);p.y=100*Math.cos(this.phi);p.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,m,k,n)};this.onMouseMove=function(m){this.mouseX=m.clientX-this.windowHalfX;this.mouseY=m.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); -this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var g=new THREE.MeshLambertMaterial({color:65280}),h=new Cube(10,10,20),j=new Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(j,g);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation= -f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(m,k){return function(){k.apply(m,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; -var Cube=function(a,f,b,e,c,d,g,h,j){function m(u,B,z,l,y,C,G,K){var J,I,E=e||1,L=c||1,P=y/2,Q=C/2,R=k.vertices.length;if(u=="x"&&B=="y"||u=="y"&&B=="x")J="z";else if(u=="x"&&B=="z"||u=="z"&&B=="x"){J="y";L=d||1}else if(u=="z"&&B=="y"||u=="y"&&B=="z"){J="x";E=d||1}var M=E+1,F=L+1;y/=E;var N=C/L;for(I=0;I0){g(0,0,-k-(d||0));for(j=a;j0){g(0,0,k+(c||0));for(j= -a+a/2;j<2*a;j++)h.faces.push(new THREE.Face4(2*a+1,(2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a))}j=0;for(a=this.faces.length;j=0?p:p+e;p=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange; +this.phi=(this.phi-p[0])*(t[1]-t[0])/(p[1]-p[0])+t[0];p=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(t[1]-t[0])/(p[1]-p[0])+t[0];p=this.target.position;p.x=100*Math.sin(this.phi)*Math.cos(this.theta);p.y=100*Math.cos(this.phi);p.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,l,k,n)};this.onMouseMove=function(l){this.mouseX=l.clientX-this.windowHalfX;this.mouseY=l.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); +this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),g=new Cube(10,10,20),j=new Cube(2,2,10);this.animationParent=new THREE.Mesh(g,a);a=new THREE.Mesh(j,h);a.position.set(0,10,0);this.animation=b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation= +b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(l,k){return function(){k.apply(l,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; +var Cube=function(a,b,c,d,e,f,h,g,j){function l(u,B,z,m,y,C,G,K){var J,I,E=d||1,L=e||1,P=y/2,Q=C/2,R=k.vertices.length;if(u=="x"&&B=="y"||u=="y"&&B=="x")J="z";else if(u=="x"&&B=="z"||u=="z"&&B=="x"){J="y";L=f||1}else if(u=="z"&&B=="y"||u=="y"&&B=="z"){J="x";E=f||1}var M=E+1,F=L+1;y/=E;var N=C/L;for(I=0;I0){h(0,0,-k-(f||0));for(j=a;j0){h(0,0,k+(e||0));for(j= +a+a/2;j<2*a;j++)g.faces.push(new THREE.Face4(2*a+1,(2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a))}j=0;for(a=this.faces.length;j0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,h,p)))-1);m.push(k)}f.push(m)}var t,w,x;c=f.length;for(b=0;b0)for(e=0;e1){t=this.vertices[g].position.clone(); -w=this.vertices[j].position.clone();x=this.vertices[m].position.clone();t.normalize();w.normalize();x.normalize();this.faces.push(new THREE.Face3(g,j,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z)]));this.faceVertexUvs[0].push([k,n,u])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; -var Torus=function(a,f,b,e){this.radius=a||100;this.tube=f||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(f=0;f<=this.segmentsR;++f)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var c=f/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(c))*Math.cos(e),(this.radius+this.tube*Math.cos(c))*Math.sin(e),this.tube*Math.sin(c))));a.push([b/this.segmentsT,1-f/this.segmentsR])}for(f=1;f<=this.segmentsR;++f)for(b= -1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*f+b;c=(this.segmentsT+1)*f+b-1;var d=(this.segmentsT+1)*(f-1)+b-1,g=(this.segmentsT+1)*(f-1)+b;this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[g][0],a[g][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; -var TorusKnot=function(a,f,b,e,c,d,g){function h(n,p,t,w,x,u){p=t/w*n;t=Math.cos(p);return new THREE.Vector3(x*(2+t)*0.5*Math.cos(n),x*(2+t)*Math.sin(n)*0.5,u*x*Math.sin(p)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=f||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=c||2;this.q=d||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;d=new THREE.Vector3;for(a=0;a0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,g,p)))-1);l.push(k)}b.push(l)}var t,w,x;e=b.length;for(c=0;c0)for(d=0;d1){t=this.vertices[h].position.clone(); +w=this.vertices[j].position.clone();x=this.vertices[l].position.clone();t.normalize();w.normalize();x.normalize();this.faces.push(new THREE.Face3(h,j,l,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z)]));this.faceVertexUvs[0].push([k,n,u])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Torus=function(a,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var e=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c= +1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;e=(this.segmentsT+1)*b+c-1;var f=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,e,f,h));this.faceVertexUvs[0].push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; +var TorusKnot=function(a,b,c,d,e,f,h){function g(n,p,t,w,x,u){p=t/w*n;t=Math.cos(p);return new THREE.Vector3(x*(2+t)*0.5*Math.cos(n),x*(2+t)*Math.sin(n)*0.5,u*x*Math.sin(p)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a>7)-127;A|=(H&127)<<16|D<<8;if(A==0&&V==-127)return 0;return(1-2*(S>>7))*(1+A*Math.pow(2,-23))*Math.pow(2,V)}function h(o,v){var A=k(o,v),D=k(o,v+1),H=k(o,v+2);return(k(o,v+3)<<24)+(H<<16)+(D<<8)+A}function j(o,v){var A=k(o,v);return(k(o,v+1)<<8)+A}function m(o,v){var A=k(o,v);return A>127?A-256:A}function k(o, -v){return o.charCodeAt(v)&255}function n(o){var v,A,D;v=h(a,o);A=h(a,o+G);D=h(a,o+K);o=j(a,o+J);THREE.BinaryLoader.prototype.f3(B,v,A,D,o)}function p(o){var v,A,D,H,S,V;v=h(a,o);A=h(a,o+G);D=h(a,o+K);H=j(a,o+J);S=h(a,o+I);V=h(a,o+E);o=h(a,o+L);THREE.BinaryLoader.prototype.f3n(B,y,v,A,D,H,S,V,o)}function t(o){var v,A,D,H;v=h(a,o);A=h(a,o+P);D=h(a,o+Q);H=h(a,o+R);o=j(a,o+M);THREE.BinaryLoader.prototype.f4(B,v,A,D,H,o)}function w(o){var v,A,D,H,S,V,ca,da;v=h(a,o);A=h(a,o+P);D=h(a,o+Q);H=h(a,o+R);S=j(a, -o+M);V=h(a,o+F);ca=h(a,o+N);da=h(a,o+O);o=h(a,o+T);THREE.BinaryLoader.prototype.f4n(B,y,v,A,D,H,S,V,ca,da,o)}function x(o){var v,A;v=h(a,o);A=h(a,o+U);o=h(a,o+X);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],C[v*2],C[v*2+1],C[A*2],C[A*2+1],C[o*2],C[o*2+1])}function u(o){var v,A,D;v=h(a,o);A=h(a,o+ea);D=h(a,o+fa);o=h(a,o+ga);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],C[v*2],C[v*2+1],C[A*2],C[A*2+1],C[D*2],C[D*2+1],C[o*2],C[o*2+1])}var B=this,z=0,l,y=[],C=[],G,K,J,I,E,L,P,Q,R,M,F,N,O, -T,U,X,ea,fa,ga,Y,Z,$,aa,ba,W;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,e,d);l={signature:a.substr(z,8),header_bytes:k(a,z+8),vertex_coordinate_bytes:k(a,z+9),normal_coordinate_bytes:k(a,z+10),uv_coordinate_bytes:k(a,z+11),vertex_index_bytes:k(a,z+12),normal_index_bytes:k(a,z+13),uv_index_bytes:k(a,z+14),material_index_bytes:k(a,z+15),nvertices:h(a,z+16),nnormals:h(a,z+16+4),nuvs:h(a,z+16+8),ntri_flat:h(a,z+16+12),ntri_smooth:h(a,z+16+16),ntri_flat_uv:h(a,z+16+20),ntri_smooth_uv:h(a, -z+16+24),nquad_flat:h(a,z+16+28),nquad_smooth:h(a,z+16+32),nquad_flat_uv:h(a,z+16+36),nquad_smooth_uv:h(a,z+16+40)};z+=l.header_bytes;G=l.vertex_index_bytes;K=l.vertex_index_bytes*2;J=l.vertex_index_bytes*3;I=l.vertex_index_bytes*3+l.material_index_bytes;E=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes;L=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*2;P=l.vertex_index_bytes;Q=l.vertex_index_bytes*2;R=l.vertex_index_bytes*3;M=l.vertex_index_bytes*4;F=l.vertex_index_bytes* -4+l.material_index_bytes;N=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes;O=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*2;T=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*3;U=l.uv_index_bytes;X=l.uv_index_bytes*2;ea=l.uv_index_bytes;fa=l.uv_index_bytes*2;ga=l.uv_index_bytes*3;d=l.vertex_index_bytes*3+l.material_index_bytes;W=l.vertex_index_bytes*4+l.material_index_bytes;Y=l.ntri_flat*d;Z=l.ntri_smooth*(d+l.normal_index_bytes*3);$=l.ntri_flat_uv* -(d+l.uv_index_bytes*3);aa=l.ntri_smooth_uv*(d+l.normal_index_bytes*3+l.uv_index_bytes*3);ba=l.nquad_flat*W;d=l.nquad_smooth*(W+l.normal_index_bytes*4);W=l.nquad_flat_uv*(W+l.uv_index_bytes*4);z+=function(o){for(var v,A,D,H=l.vertex_coordinate_bytes*3,S=o+l.nvertices*H;o>7)-127;A|=(H&127)<<16|D<<8;if(A==0&&V==-127)return 0;return(1-2*(S>>7))*(1+A*Math.pow(2,-23))*Math.pow(2,V)}function g(o,v){var A=k(o,v),D=k(o,v+1),H=k(o,v+2);return(k(o,v+3)<<24)+(H<<16)+(D<<8)+A}function j(o,v){var A=k(o,v);return(k(o,v+1)<<8)+A}function l(o,v){var A=k(o,v);return A>127?A-256:A}function k(o, +v){return o.charCodeAt(v)&255}function n(o){var v,A,D;v=g(a,o);A=g(a,o+G);D=g(a,o+K);o=j(a,o+J);THREE.BinaryLoader.prototype.f3(B,v,A,D,o)}function p(o){var v,A,D,H,S,V;v=g(a,o);A=g(a,o+G);D=g(a,o+K);H=j(a,o+J);S=g(a,o+I);V=g(a,o+E);o=g(a,o+L);THREE.BinaryLoader.prototype.f3n(B,y,v,A,D,H,S,V,o)}function t(o){var v,A,D,H;v=g(a,o);A=g(a,o+P);D=g(a,o+Q);H=g(a,o+R);o=j(a,o+M);THREE.BinaryLoader.prototype.f4(B,v,A,D,H,o)}function w(o){var v,A,D,H,S,V,ca,da;v=g(a,o);A=g(a,o+P);D=g(a,o+Q);H=g(a,o+R);S=j(a, +o+M);V=g(a,o+F);ca=g(a,o+N);da=g(a,o+O);o=g(a,o+T);THREE.BinaryLoader.prototype.f4n(B,y,v,A,D,H,S,V,ca,da,o)}function x(o){var v,A;v=g(a,o);A=g(a,o+U);o=g(a,o+X);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],C[v*2],C[v*2+1],C[A*2],C[A*2+1],C[o*2],C[o*2+1])}function u(o){var v,A,D;v=g(a,o);A=g(a,o+ea);D=g(a,o+fa);o=g(a,o+ga);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],C[v*2],C[v*2+1],C[A*2],C[A*2+1],C[D*2],C[D*2+1],C[o*2],C[o*2+1])}var B=this,z=0,m,y=[],C=[],G,K,J,I,E,L,P,Q,R,M,F,N,O, +T,U,X,ea,fa,ga,Y,Z,$,aa,ba,W;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,d,f);m={signature:a.substr(z,8),header_bytes:k(a,z+8),vertex_coordinate_bytes:k(a,z+9),normal_coordinate_bytes:k(a,z+10),uv_coordinate_bytes:k(a,z+11),vertex_index_bytes:k(a,z+12),normal_index_bytes:k(a,z+13),uv_index_bytes:k(a,z+14),material_index_bytes:k(a,z+15),nvertices:g(a,z+16),nnormals:g(a,z+16+4),nuvs:g(a,z+16+8),ntri_flat:g(a,z+16+12),ntri_smooth:g(a,z+16+16),ntri_flat_uv:g(a,z+16+20),ntri_smooth_uv:g(a, +z+16+24),nquad_flat:g(a,z+16+28),nquad_smooth:g(a,z+16+32),nquad_flat_uv:g(a,z+16+36),nquad_smooth_uv:g(a,z+16+40)};z+=m.header_bytes;G=m.vertex_index_bytes;K=m.vertex_index_bytes*2;J=m.vertex_index_bytes*3;I=m.vertex_index_bytes*3+m.material_index_bytes;E=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;L=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;P=m.vertex_index_bytes;Q=m.vertex_index_bytes*2;R=m.vertex_index_bytes*3;M=m.vertex_index_bytes*4;F=m.vertex_index_bytes* +4+m.material_index_bytes;N=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes;O=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;T=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;U=m.uv_index_bytes;X=m.uv_index_bytes*2;ea=m.uv_index_bytes;fa=m.uv_index_bytes*2;ga=m.uv_index_bytes*3;f=m.vertex_index_bytes*3+m.material_index_bytes;W=m.vertex_index_bytes*4+m.material_index_bytes;Y=m.ntri_flat*f;Z=m.ntri_smooth*(f+m.normal_index_bytes*3);$=m.ntri_flat_uv* +(f+m.uv_index_bytes*3);aa=m.ntri_smooth_uv*(f+m.normal_index_bytes*3+m.uv_index_bytes*3);ba=m.nquad_flat*W;f=m.nquad_smooth*(W+m.normal_index_bytes*4);W=m.nquad_flat_uv*(W+m.uv_index_bytes*4);z+=function(o){for(var v,A,D,H=m.vertex_coordinate_bytes*3,S=o+m.nvertices*H;o=this.maxCount-3&&h(this)};this.begin= -function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;ethis.size-1&&(j=this.size-1);var p=Math.floor(m-h);p<1&&(p=1);m=Math.floor(m+h);m>this.size-1&&(m=this.size-1);var t=Math.floor(k-h);t<1&&(t=1);h=Math.floor(k+h); -h>this.size-1&&(h=this.size-1);for(var w,x,u,B,z,l;n0&&(this.field[u+w]+=B)}}}};this.addPlaneX=function(b,e){var c,d,g,h,j,m=this.size,k=this.yd,n=this.zd,p=this.field,t=m*Math.sqrt(b/e);t>m&&(t=m);for(c=0;c0)for(d=0;dk&&(w=k);for(d=0;d0){j=d*n;for(c=0;csize&&(dist=size);for(g=0;g0){j=zd*g;for(d=0;d=this.maxCount-3&&g(this)};this.begin= +function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;dthis.size-1&&(j=this.size-1);var p=Math.floor(l-g);p<1&&(p=1);l=Math.floor(l+g);l>this.size-1&&(l=this.size-1);var t=Math.floor(k-g);t<1&&(t=1);g=Math.floor(k+g); +g>this.size-1&&(g=this.size-1);for(var w,x,u,B,z,m;n0&&(this.field[u+w]+=B)}}}};this.addPlaneX=function(c,d){var e,f,h,g,j,l=this.size,k=this.yd,n=this.zd,p=this.field,t=l*Math.sqrt(c/d);t>l&&(t=l);for(e=0;e0)for(f=0;fk&&(w=k);for(f=0;f0){j=f*n;for(e=0;esize&&(dist=size);for(h=0;h0){j=zd*h;for(f=0;ff?this.hits.push(e):this.hits.unshift(e);f=d}}return this.hits}; +THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var d=this.rayMesh(a,b[c]);if(db.length)return null;return b[c]}; +THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)}; +THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),d=Number.MAX_VALUE,e=0;e=g*f))return Number.MAX_VALUE;h/=g;g=THREE.CollisionSystem.__v3;g.copy(a.direction);g.multiplyScalar(h);g.addSelf(a.origin);if(Math.abs(e.x)>Math.abs(e.y))if(Math.abs(e.x)>Math.abs(e.z)){a=g.y-b.y;e=c.y-b.y;f=d.y-b.y; +g=g.z-b.z;c=c.z-b.z;d=d.z-b.z}else{a=g.x-b.x;e=c.x-b.x;f=d.x-b.x;g=g.y-b.y;c=c.y-b.y;d=d.y-b.y}else if(Math.abs(e.y)>Math.abs(e.z)){a=g.x-b.x;e=c.x-b.x;f=d.x-b.x;g=g.z-b.z;c=c.z-b.z;d=d.z-b.z}else{a=g.x-b.x;e=c.x-b.x;f=d.x-b.x;g=g.y-b.y;c=c.y-b.y;d=d.y-b.y}b=e*d-c*f;if(b==0)return Number.MAX_VALUE;b=1/b;d=(a*d-g*f)*b;if(!(d>=0))return Number.MAX_VALUE;b*=e*g-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-d-b>=0))return Number.MAX_VALUE;return h}; +THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=new THREE.Ray(a.origin.clone(),a.direction.clone()),d=THREE.Matrix4.makeInvert(b.matrixWorld);d.multiplyVector3(c.origin);d.rotateAxis(c.direction);c.direction.normalize();return c}; +THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;c=b.dynamic&&b.mesh&&b.mesh.matrixWorld?this.makeRayLocal(a,b.mesh):new THREE.Ray(a.origin.clone(),a.direction.clone());var d=0,e=0,f=0,h=0,g=0,j=0,l=!0;if(c.origin.xb.max.x){d=b.max.x-c.origin.x;d/=c.direction.x;l=!1;h=1}if(c.origin.yb.max.y){e=b.max.y-c.origin.y;e/=c.direction.y;l=!1;g= +1}if(c.origin.zb.max.z){f=b.max.z-c.origin.z;f/=c.direction.z;l=!1;j=1}if(l)return-1;l=0;if(e>d){l=1;d=e}if(f>d){l=2;d=f}switch(l){case 0:g=c.origin.y+c.direction.y*d;if(gb.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*d;if(cb.max.z)return Number.MAX_VALUE;b.normal=new THREE.Vector3(h,0,0);break;case 1:h=c.origin.x+c.direction.x*d;if(hb.max.x)return Number.MAX_VALUE;c=c.origin.z+ +c.direction.z*d;if(cb.max.z)return Number.MAX_VALUE;b.normal=new THREE.Vector3(0,g,0);break;case 2:h=c.origin.x+c.direction.x*d;if(hb.max.x)return Number.MAX_VALUE;g=c.origin.y+c.direction.y*d;if(gb.max.y)return Number.MAX_VALUE;b.normal=new THREE.Vector3(0,0,j)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),d=b.point.dot(b.normal);if(c<0)c=(d-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE}; +THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq=0)return Math.abs(d)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionUtils={}; +THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]);b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]);c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b}; +THREE.CollisionUtils.MeshColliderWBox=function(a){for(var b=a.geometry.vertices,c=b.length,d=a.geometry.faces,e=d.length,f=[],h=[],g=[],j=0;j=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){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);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.001){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);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,e,d,g){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=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)}; THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; diff --git a/build/custom/ThreeWebGL.js b/build/custom/ThreeWebGL.js index ac10f8c427..19a805ff09 100644 --- a/build/custom/ThreeWebGL.js +++ b/build/custom/ThreeWebGL.js @@ -1,90 +1,90 @@ // ThreeWebGL.js r38 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(b){this.setHex(b)}; -THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,d,e){var h,g,k,j,p,q;if(e==0)h=g=k=0;else{j=Math.floor(b*6);p=b*6-j;b=e*(1-d);q=e*(1-d*p);d=e*(1-d*(1-p));switch(j){case 1:h=q;g=e;k=b;break;case 2:h=b;g=e;k=d;break;case 3:h=b;g=q;k=e;break;case 4:h=d;g=b;k=e;break;case 5:h=e;g=b; -k=q;break;case 6:case 0:h=e;g=d;k=b}}this.r=h;this.g=g;this.b=k;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g* -255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)}; -THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ -this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,d,e){this.set(b||0,d||0,e||0)}; -THREE.Vector3.prototype={set:function(b,d,e){this.x=b;this.y=d;this.z=e;return this},copy:function(b){this.set(b.x,b.y,b.z);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z);return this},addScalar:function(b){this.set(this.x+b,this.y+b,this.z+b);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z);return this},cross:function(b, -d){this.set(b.y*d.z-b.z*d.y,b.z*d.x-b.x*d.z,b.x*d.y-b.y*d.x);return this},crossSelf:function(b){var d=this.x,e=this.y,h=this.z;this.set(e*b.z-h*b.y,h*b.x-d*b.z,d*b.y-e*b.x);return this},multiply:function(b,d){this.set(b.x*d.x,b.y*d.y,b.z*d.z);return this},multiplySelf:function(b){this.set(this.x*b.x,this.y*b.y,this.z*b.z);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b,this.z*b);return this},divideSelf:function(b){this.set(this.x/b.x,this.y/b.y,this.z/b.z);return this},divideScalar:function(b){this.set(this.x/ -b,this.y/b,this.z/b);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var d=this.x-b.x,e=this.y-b.y;b=this.z-b.z;return d*d+e*e+b*b},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var b= -this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){this.y=Math.asin(b.n13);var d=Math.cos(this.y);if(Math.abs(d)>1.0E-5){this.x=Math.atan2(-b.n23/d,b.n33/d);this.z=Math.atan2(-b.n13/d,b.n11/d)}else{this.x=0;this.z=Math.atan2(b.n21,b.n22)}},setLength:function(b){return this.normalize().multiplyScalar(b)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)< -1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,e,h){this.set(b||0,d||0,e||0,h||1)}; -THREE.Vector4.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x* -b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(b){var d,e,h=b.objects,g=[];b=0;for(d=h.length;b0&&V>0&&Z+V< -1}var e,h,g,k,j,p,q,v,E,G,I,H=b.geometry,L=H.vertices,M=[];e=0;for(h=H.faces.length;e0:E<0)){v=v.dot((new THREE.Vector3).sub(k, -G))/E;G=G.addSelf(I.multiplyScalar(v));if(g instanceof THREE.Face3){if(d(G,k,j,p)){g={distance:this.origin.distanceTo(G),point:G,face:g,object:b};M.push(g)}}else if(g instanceof THREE.Face4&&(d(G,k,j,q)||d(G,j,p,q))){g={distance:this.origin.distanceTo(G),point:G,face:g,object:b};M.push(g)}}}return M}}; -THREE.Rectangle=function(){function b(){k=h-d;j=g-e}var d,e,h,g,k,j,p=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return h};this.getBottom=function(){return g};this.set=function(q,v,E,G){p=!1;d=q;e=v;h=E;g=G;b()};this.addPoint=function(q,v){if(p){p=!1;d=q;e=v;h=q;g=v}else{d=dq?h:q;g=g>v?g:v}b()}; -this.add3Points=function(q,v,E,G,I,H){if(p){p=!1;d=qE?q>I?q:I:E>I?E:I;g=v>G?v>H?v:H:G>H?G:H}else{d=qE?q>I?q>h?q:h:I>h?I:h:E>I?E>h?E:h:I>h?I:h;g=v>G?v>H?v>g?v:g:H>g?H:g:G>H?G>g?G:g:H>g?H:g}b()};this.addRectangle=function(q){if(p){p=!1;d=q.getLeft();e=q.getTop();h=q.getRight();g=q.getBottom()}else{d=dq.getRight()? -h:q.getRight();g=g>q.getBottom()?g:q.getBottom()}b()};this.inflate=function(q){d-=q;e-=q;h+=q;g+=q;b()};this.minSelf=function(q){d=d>q.getLeft()?d:q.getLeft();e=e>q.getTop()?e:q.getTop();h=h=0&&Math.min(g,q.getBottom())-Math.max(e,q.getTop())>=0};this.empty=function(){p=!0;g=h=e=d=0;b()};this.isEmpty=function(){return p}}; -THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}}; -THREE.Matrix4=function(b,d,e,h,g,k,j,p,q,v,E,G,I,H,L,M){this.set(b||1,d||0,e||0,h||0,g||0,k||1,j||0,p||0,q||0,v||0,E||1,G||0,I||0,H||0,L||0,M||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(b,d,e,h,g,k,j,p,q,v,E,G,I,H,L,M){this.n11=b;this.n12=d;this.n13=e;this.n14=h;this.n21=g;this.n22=k;this.n23=j;this.n24=p;this.n31=q;this.n32=v;this.n33=E;this.n34=G;this.n41=I;this.n42=H;this.n43=L;this.n44=M;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var h=THREE.Matrix4.__v1, -g=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,d).normalize();if(k.length()===0)k.z=1;h.cross(e,k).normalize();if(h.length()===0){k.x+=1.0E-4;h.cross(e,k).normalize()}g.cross(k,h).normalize();this.n11=h.x;this.n12=g.x;this.n13=k.x;this.n21=h.y;this.n22=g.y;this.n23=k.y;this.n31=h.z;this.n32=g.z;this.n33=k.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,h=b.z,g=1/(this.n41*d+this.n42*e+this.n43*h+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*h+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23* -h+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*h+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,h=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*h+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*h+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*h+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*h+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,h=b.z;b.x=d*this.n11+e*this.n12+h*this.n13;b.y=d*this.n21+e*this.n22+h*this.n23;b.z=d*this.n31+e*this.n32+h*this.n33;b.normalize(); -return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,j=b.n21,p=b.n22,q=b.n23,v=b.n24,E=b.n31,G=b.n32,I=b.n33,H=b.n34,L=b.n41,M=b.n42,V=b.n43,P=b.n44,sa=d.n11,da=d.n12,oa=d.n13,Z=d.n14,K=d.n21,Ia=d.n22, -ca=d.n23,Ea=d.n24,fa=d.n31,c=d.n32,R=d.n33,pa=d.n34;this.n11=e*sa+h*K+g*fa;this.n12=e*da+h*Ia+g*c;this.n13=e*oa+h*ca+g*R;this.n14=e*Z+h*Ea+g*pa+k;this.n21=j*sa+p*K+q*fa;this.n22=j*da+p*Ia+q*c;this.n23=j*oa+p*ca+q*R;this.n24=j*Z+p*Ea+q*pa+v;this.n31=E*sa+G*K+I*fa;this.n32=E*da+G*Ia+I*c;this.n33=E*oa+G*ca+I*R;this.n34=E*Z+G*Ea+I*pa+H;this.n41=L*sa+M*K+V*fa;this.n42=L*da+M*Ia+V*c;this.n43=L*oa+M*ca+V*R;this.n44=L*Z+M*Ea+V*pa+P;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11; -e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*= -b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,g=this.n21,k=this.n22,j=this.n23,p=this.n24,q=this.n31,v=this.n32,E=this.n33,G=this.n34,I=this.n41,H=this.n42,L=this.n43,M=this.n44;return h*j*v*I-e*p*v*I-h*k*E*I+d*p*E*I+e*k*G*I-d*j*G*I-h*j*q*H+e*p*q*H+h*g*E*H-b*p*E*H-e*g*G*H+b*j*G*H+h*k*q*L-d*p*q*L-h*g*v*L+b*p*v*L+d*g*G*L-b*k*G*L-e*k*q*M+d*j*q*M+e*g*v*M-b*j*v*M-d*g*E*M+b*k*E*M},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31= +THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,e,d){this.r=b;this.g=e;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,e,d){var h,g,k,i,p,q;if(d==0)h=g=k=0;else{i=Math.floor(b*6);p=b*6-i;b=d*(1-e);q=d*(1-e*p);e=d*(1-e*(1-p));switch(i){case 1:h=q;g=d;k=b;break;case 2:h=b;g=d;k=e;break;case 3:h=b;g=q;k=d;break;case 4:h=e;g=b;k=d;break;case 5:h=d;g=b; +k=q;break;case 6:case 0:h=d;g=e;k=b}}this.r=h;this.g=g;this.b=k;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g* +255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,e){this.set(b||0,e||0)}; +THREE.Vector2.prototype={set:function(b,e){this.x=b;this.y=e;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,e){this.set(b.x+e.x,b.y+e.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,e){this.set(b.x-e.x,b.y-e.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ +this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,e,d){this.set(b||0,e||0,d||0)}; +THREE.Vector3.prototype={set:function(b,e,d){this.x=b;this.y=e;this.z=d;return this},copy:function(b){this.set(b.x,b.y,b.z);return this},add:function(b,e){this.set(b.x+e.x,b.y+e.y,b.z+e.z);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z);return this},addScalar:function(b){this.set(this.x+b,this.y+b,this.z+b);return this},sub:function(b,e){this.set(b.x-e.x,b.y-e.y,b.z-e.z);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z);return this},cross:function(b, +e){this.set(b.y*e.z-b.z*e.y,b.z*e.x-b.x*e.z,b.x*e.y-b.y*e.x);return this},crossSelf:function(b){var e=this.x,d=this.y,h=this.z;this.set(d*b.z-h*b.y,h*b.x-e*b.z,e*b.y-d*b.x);return this},multiply:function(b,e){this.set(b.x*e.x,b.y*e.y,b.z*e.z);return this},multiplySelf:function(b){this.set(this.x*b.x,this.y*b.y,this.z*b.z);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b,this.z*b);return this},divideSelf:function(b){this.set(this.x/b.x,this.y/b.y,this.z/b.z);return this},divideScalar:function(b){this.set(this.x/ +b,this.y/b,this.z/b);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var e=this.x-b.x,d=this.y-b.y;b=this.z-b.z;return e*e+d*d+b*b},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var b= +this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){this.y=Math.asin(b.n13);var e=Math.cos(this.y);if(Math.abs(e)>1.0E-5){this.x=Math.atan2(-b.n23/e,b.n33/e);this.z=Math.atan2(-b.n13/e,b.n11/e)}else{this.x=0;this.z=Math.atan2(b.n21,b.n22)}},setLength:function(b){return this.normalize().multiplyScalar(b)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)< +1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,e,d,h){this.set(b||0,e||0,d||0,h||1)}; +THREE.Vector4.prototype={set:function(b,e,d,h){this.x=b;this.y=e;this.z=d;this.w=h;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,e){this.set(b.x+e.x,b.y+e.y,b.z+e.z,b.w+e.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,e){this.set(b.x-e.x,b.y-e.y,b.z-e.z,b.w-e.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x* +b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,e){this.set(this.x+(b.x-this.x)*e,this.y+(b.y-this.y)*e,this.z+(b.z-this.z)*e,this.w+(b.w-this.w)*e)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,e){this.origin=b||new THREE.Vector3;this.direction=e||new THREE.Vector3}; +THREE.Ray.prototype={intersectScene:function(b){var e,d,h=b.objects,g=[];b=0;for(e=h.length;b0&&U>0&&Z+U< +1}var d,h,g,k,i,p,q,u,D,E,I,F=b.geometry,M=F.vertices,N=[];d=0;for(h=F.faces.length;d0:D<0)){u=u.dot((new THREE.Vector3).sub(k, +E))/D;E=E.addSelf(I.multiplyScalar(u));if(g instanceof THREE.Face3){if(e(E,k,i,p)){g={distance:this.origin.distanceTo(E),point:E,face:g,object:b};N.push(g)}}else if(g instanceof THREE.Face4&&(e(E,k,i,q)||e(E,i,p,q))){g={distance:this.origin.distanceTo(E),point:E,face:g,object:b};N.push(g)}}}return N}}; +THREE.Rectangle=function(){function b(){k=h-e;i=g-d}var e,d,h,g,k,i,p=!0;this.getX=function(){return e};this.getY=function(){return d};this.getWidth=function(){return k};this.getHeight=function(){return i};this.getLeft=function(){return e};this.getTop=function(){return d};this.getRight=function(){return h};this.getBottom=function(){return g};this.set=function(q,u,D,E){p=!1;e=q;d=u;h=D;g=E;b()};this.addPoint=function(q,u){if(p){p=!1;e=q;d=u;h=q;g=u}else{e=eq?h:q;g=g>u?g:u}b()}; +this.add3Points=function(q,u,D,E,I,F){if(p){p=!1;e=qD?q>I?q:I:D>I?D:I;g=u>E?u>F?u:F:E>F?E:F}else{e=qD?q>I?q>h?q:h:I>h?I:h:D>I?D>h?D:h:I>h?I:h;g=u>E?u>F?u>g?u:g:F>g?F:g:E>F?E>g?E:g:F>g?F:g}b()};this.addRectangle=function(q){if(p){p=!1;e=q.getLeft();d=q.getTop();h=q.getRight();g=q.getBottom()}else{e=eq.getRight()? +h:q.getRight();g=g>q.getBottom()?g:q.getBottom()}b()};this.inflate=function(q){e-=q;d-=q;h+=q;g+=q;b()};this.minSelf=function(q){e=e>q.getLeft()?e:q.getLeft();d=d>q.getTop()?d:q.getTop();h=h=0&&Math.min(g,q.getBottom())-Math.max(d,q.getTop())>=0};this.empty=function(){p=!0;g=h=d=e=0;b()};this.isEmpty=function(){return p}}; +THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,e=this.m;b=e[1];e[1]=e[3];e[3]=b;b=e[2];e[2]=e[6];e[6]=b;b=e[5];e[5]=e[7];e[7]=b;return this},transposeIntoArray:function(b){var e=this.m;b[0]=e[0];b[1]=e[3];b[2]=e[6];b[3]=e[1];b[4]=e[4];b[5]=e[7];b[6]=e[2];b[7]=e[5];b[8]=e[8];return this}}; +THREE.Matrix4=function(b,e,d,h,g,k,i,p,q,u,D,E,I,F,M,N){this.set(b||1,e||0,d||0,h||0,g||0,k||1,i||0,p||0,q||0,u||0,D||1,E||0,I||0,F||0,M||0,N||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(b,e,d,h,g,k,i,p,q,u,D,E,I,F,M,N){this.n11=b;this.n12=e;this.n13=d;this.n14=h;this.n21=g;this.n22=k;this.n23=i;this.n24=p;this.n31=q;this.n32=u;this.n33=D;this.n34=E;this.n41=I;this.n42=F;this.n43=M;this.n44=N;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,e,d){var h=THREE.Matrix4.__v1, +g=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,e).normalize();if(k.length()===0)k.z=1;h.cross(d,k).normalize();if(h.length()===0){k.x+=1.0E-4;h.cross(d,k).normalize()}g.cross(k,h).normalize();this.n11=h.x;this.n12=g.x;this.n13=k.x;this.n21=h.y;this.n22=g.y;this.n23=k.y;this.n31=h.z;this.n32=g.z;this.n33=k.z;return this},multiplyVector3:function(b){var e=b.x,d=b.y,h=b.z,g=1/(this.n41*e+this.n42*d+this.n43*h+this.n44);b.x=(this.n11*e+this.n12*d+this.n13*h+this.n14)*g;b.y=(this.n21*e+this.n22*d+this.n23* +h+this.n24)*g;b.z=(this.n31*e+this.n32*d+this.n33*h+this.n34)*g;return b},multiplyVector4:function(b){var e=b.x,d=b.y,h=b.z,g=b.w;b.x=this.n11*e+this.n12*d+this.n13*h+this.n14*g;b.y=this.n21*e+this.n22*d+this.n23*h+this.n24*g;b.z=this.n31*e+this.n32*d+this.n33*h+this.n34*g;b.w=this.n41*e+this.n42*d+this.n43*h+this.n44*g;return b},rotateAxis:function(b){var e=b.x,d=b.y,h=b.z;b.x=e*this.n11+d*this.n12+h*this.n13;b.y=e*this.n21+d*this.n22+h*this.n23;b.z=e*this.n31+d*this.n32+h*this.n33;b.normalize(); +return b},crossVector:function(b){var e=new THREE.Vector4;e.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;e.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;e.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;e.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return e},multiply:function(b,e){var d=b.n11,h=b.n12,g=b.n13,k=b.n14,i=b.n21,p=b.n22,q=b.n23,u=b.n24,D=b.n31,E=b.n32,I=b.n33,F=b.n34,M=b.n41,N=b.n42,U=b.n43,L=b.n44,sa=e.n11,da=e.n12,oa=e.n13,Z=e.n14,K=e.n21,Ia=e.n22, +ca=e.n23,Ea=e.n24,fa=e.n31,c=e.n32,R=e.n33,pa=e.n34;this.n11=d*sa+h*K+g*fa;this.n12=d*da+h*Ia+g*c;this.n13=d*oa+h*ca+g*R;this.n14=d*Z+h*Ea+g*pa+k;this.n21=i*sa+p*K+q*fa;this.n22=i*da+p*Ia+q*c;this.n23=i*oa+p*ca+q*R;this.n24=i*Z+p*Ea+q*pa+u;this.n31=D*sa+E*K+I*fa;this.n32=D*da+E*Ia+I*c;this.n33=D*oa+E*ca+I*R;this.n34=D*Z+E*Ea+I*pa+F;this.n41=M*sa+N*K+U*fa;this.n42=M*da+N*Ia+U*c;this.n43=M*oa+N*ca+U*R;this.n44=M*Z+N*Ea+U*pa+L;return this},multiplyToArray:function(b,e,d){this.multiply(b,e);d[0]=this.n11; +d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*= +b;return this},determinant:function(){var b=this.n11,e=this.n12,d=this.n13,h=this.n14,g=this.n21,k=this.n22,i=this.n23,p=this.n24,q=this.n31,u=this.n32,D=this.n33,E=this.n34,I=this.n41,F=this.n42,M=this.n43,N=this.n44;return h*i*u*I-d*p*u*I-h*k*D*I+e*p*D*I+d*k*E*I-e*i*E*I-h*i*q*F+d*p*q*F+h*g*D*F-b*p*D*F-d*g*E*F+b*i*E*F+h*k*q*M-e*p*q*M-h*g*u*M+b*p*u*M+e*g*E*M-b*k*E*M-d*k*q*N+e*i*q*N+d*g*u*N-b*i*u*N-e*g*D*N+b*k*D*N},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31= this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]= this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42; -b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0, -0,1);return this},setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),h=Math.sin(d),g= -1-e,k=b.x,j=b.y,p=b.z,q=g*k,v=g*j;this.set(q*k+e,q*j-h*p,q*p+h*j,0,q*j+h*p,v*j+e,v*p-h*k,0,q*p-h*j,v*p+h*k,g*p*p+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,e=b.y,h=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(e);e=Math.sin(e);var k=Math.cos(h);h=Math.sin(h);var j=b*e,p=d*e;this.n11=g*k;this.n12=-g*h;this.n13=e;this.n21=p*k+b*h;this.n22=-p*h+b*k;this.n23=-d*g;this.n31=-j*k+d*h;this.n32=j*h+d*k;this.n33= -b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,h=b.z,g=b.w,k=d+d,j=e+e,p=h+h;b=d*k;var q=d*j;d*=p;var v=e*j;e*=p;h*=p;k*=g;j*=g;g*=p;this.n11=1-(v+h);this.n12=q-g;this.n13=d+j;this.n21=q+g;this.n22=1-(b+h);this.n23=e-k;this.n31=d-j;this.n32=e+k;this.n33=1-(b+v);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14= -b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,h=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*h;this.n22=b.n22*h;this.n32=b.n32*h;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}}; -THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,j=b.n21,p=b.n22,q=b.n23,v=b.n24,E=b.n31,G=b.n32,I=b.n33,H=b.n34,L=b.n41,M=b.n42,V=b.n43,P=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=q*H*M-v*I*M+v*G*V-p*H*V-q*G*P+p*I*P;d.n12=k*I*M-g*H*M-k*G*V+h*H*V+g*G*P-h*I*P;d.n13=g*v*M-k*q*M+k*p*V-h*v*V-g*p*P+h*q*P;d.n14=k*q*G-g*v*G-k*p*I+h*v*I+g*p*H-h*q*H;d.n21=v*I*L-q*H*L-v*E*V+j*H*V+q*E*P-j*I*P;d.n22=g*H*L-k*I*L+k*E*V-e*H*V-g*E*P+e*I*P;d.n23=k*q*L-g*v*L-k*j*V+e*v*V+g*j*P-e*q*P; -d.n24=g*v*E-k*q*E+k*j*I-e*v*I-g*j*H+e*q*H;d.n31=p*H*L-v*G*L+v*E*M-j*H*M-p*E*P+j*G*P;d.n32=k*G*L-h*H*L-k*E*M+e*H*M+h*E*P-e*G*P;d.n33=g*v*L-k*p*L+k*j*M-e*v*M-h*j*P+e*p*P;d.n34=k*p*E-h*v*E-k*j*G+e*v*G+h*j*H-e*p*H;d.n41=q*G*L-p*I*L-q*E*M+j*I*M+p*E*V-j*G*V;d.n42=h*I*L-g*G*L+g*E*M-e*I*M-h*E*V+e*G*V;d.n43=g*p*L-h*q*L-g*j*M+e*q*M+h*j*V-e*p*V;d.n44=h*q*E-g*p*E+g*j*G-e*q*G-h*j*I+e*p*I;d.multiplyScalar(1/b.determinant());return d}; -THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,h=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,p=b.n33*b.n11-b.n31*b.n13,q=-b.n32*b.n11+b.n31*b.n12,v=b.n23*b.n12-b.n22*b.n13,E=-b.n23*b.n11+b.n21*b.n13,G=b.n22*b.n11-b.n21*b.n12;b=b.n11*h+b.n21*j+b.n31*v;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*h;e[1]=b*g;e[2]=b*k;e[3]=b*j;e[4]=b*p;e[5]=b*q;e[6]=b*v;e[7]=b*E;e[8]=b*G;return d}; -THREE.Matrix4.makeFrustum=function(b,d,e,h,g,k){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(h-e);j.n23=(h+e)/(h-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(k+g)/(k-g);j.n34=-2*k*g/(k-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,e,h){var g;b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,h)}; -THREE.Matrix4.makeOrtho=function(b,d,e,h,g,k){var j,p,q,v;j=new THREE.Matrix4;p=d-b;q=e-h;v=k-g;j.n11=2/p;j.n12=0;j.n13=0;j.n14=-((d+b)/p);j.n21=0;j.n22=2/q;j.n23=0;j.n24=-((e+h)/q);j.n31=0;j.n32=0;j.n33=-2/v;j.n34=-((k+g)/v);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; +b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,e){b[e]=this.n11;b[e+1]=this.n21;b[e+2]=this.n31;b[e+3]=this.n41;b[e+4]=this.n12;b[e+5]=this.n22;b[e+6]=this.n32;b[e+7]=this.n42;b[e+8]=this.n13;b[e+9]=this.n23;b[e+10]=this.n33;b[e+11]=this.n43;b[e+12]=this.n14;b[e+13]=this.n24;b[e+14]=this.n34;b[e+15]=this.n44;return b},setTranslation:function(b,e,d){this.set(1,0,0,b,0,1,0,e,0,0,1,d,0,0, +0,1);return this},setScale:function(b,e,d){this.set(b,0,0,0,0,e,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var e=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,e,-b,0,0,b,e,0,0,0,0,1);return this},setRotationY:function(b){var e=Math.cos(b);b=Math.sin(b);this.set(e,0,b,0,0,1,0,0,-b,0,e,0,0,0,0,1);return this},setRotationZ:function(b){var e=Math.cos(b);b=Math.sin(b);this.set(e,-b,0,0,b,e,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,e){var d=Math.cos(e),h=Math.sin(e),g= +1-d,k=b.x,i=b.y,p=b.z,q=g*k,u=g*i;this.set(q*k+d,q*i-h*p,q*p+h*i,0,q*i+h*p,u*i+d,u*p-h*k,0,q*p-h*i,u*p+h*k,g*p*p+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var e=b.x,d=b.y,h=b.z;b=Math.cos(e);e=Math.sin(e);var g=Math.cos(d);d=Math.sin(d);var k=Math.cos(h);h=Math.sin(h);var i=b*d,p=e*d;this.n11=g*k;this.n12=-g*h;this.n13=d;this.n21=p*k+b*h;this.n22=-p*h+b*k;this.n23=-e*g;this.n31=-i*k+e*h;this.n32=i*h+e*k;this.n33= +b*g;return this},setRotationFromQuaternion:function(b){var e=b.x,d=b.y,h=b.z,g=b.w,k=e+e,i=d+d,p=h+h;b=e*k;var q=e*i;e*=p;var u=d*i;d*=p;h*=p;k*=g;i*=g;g*=p;this.n11=1-(u+h);this.n12=q-g;this.n13=e+i;this.n21=q+g;this.n22=1-(b+h);this.n23=d-k;this.n31=e-i;this.n32=d+k;this.n33=1-(b+u);return this},scale:function(b){var e=b.x,d=b.y;b=b.z;this.n11*=e;this.n12*=d;this.n13*=b;this.n21*=e;this.n22*=d;this.n23*=b;this.n31*=e;this.n32*=d;this.n33*=b;this.n41*=e;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14= +b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,e){var d=1/e.x,h=1/e.y,g=1/e.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*h;this.n22=b.n22*h;this.n32=b.n32*h;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}}; +THREE.Matrix4.makeInvert=function(b,e){var d=b.n11,h=b.n12,g=b.n13,k=b.n14,i=b.n21,p=b.n22,q=b.n23,u=b.n24,D=b.n31,E=b.n32,I=b.n33,F=b.n34,M=b.n41,N=b.n42,U=b.n43,L=b.n44;e===undefined&&(e=new THREE.Matrix4);e.n11=q*F*N-u*I*N+u*E*U-p*F*U-q*E*L+p*I*L;e.n12=k*I*N-g*F*N-k*E*U+h*F*U+g*E*L-h*I*L;e.n13=g*u*N-k*q*N+k*p*U-h*u*U-g*p*L+h*q*L;e.n14=k*q*E-g*u*E-k*p*I+h*u*I+g*p*F-h*q*F;e.n21=u*I*M-q*F*M-u*D*U+i*F*U+q*D*L-i*I*L;e.n22=g*F*M-k*I*M+k*D*U-d*F*U-g*D*L+d*I*L;e.n23=k*q*M-g*u*M-k*i*U+d*u*U+g*i*L-d*q*L; +e.n24=g*u*D-k*q*D+k*i*I-d*u*I-g*i*F+d*q*F;e.n31=p*F*M-u*E*M+u*D*N-i*F*N-p*D*L+i*E*L;e.n32=k*E*M-h*F*M-k*D*N+d*F*N+h*D*L-d*E*L;e.n33=g*u*M-k*p*M+k*i*N-d*u*N-h*i*L+d*p*L;e.n34=k*p*D-h*u*D-k*i*E+d*u*E+h*i*F-d*p*F;e.n41=q*E*M-p*I*M-q*D*N+i*I*N+p*D*U-i*E*U;e.n42=h*I*M-g*E*M+g*D*N-d*I*N-h*D*U+d*E*U;e.n43=g*p*M-h*q*M-g*i*N+d*q*N+h*i*U-d*p*U;e.n44=h*q*D-g*p*D+g*i*E-d*q*E-h*i*I+d*p*I;e.multiplyScalar(1/b.determinant());return e}; +THREE.Matrix4.makeInvert3x3=function(b){var e=b.m33,d=e.m,h=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,i=-b.n33*b.n12+b.n32*b.n13,p=b.n33*b.n11-b.n31*b.n13,q=-b.n32*b.n11+b.n31*b.n12,u=b.n23*b.n12-b.n22*b.n13,D=-b.n23*b.n11+b.n21*b.n13,E=b.n22*b.n11-b.n21*b.n12;b=b.n11*h+b.n21*i+b.n31*u;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*h;d[1]=b*g;d[2]=b*k;d[3]=b*i;d[4]=b*p;d[5]=b*q;d[6]=b*u;d[7]=b*D;d[8]=b*E;return e}; +THREE.Matrix4.makeFrustum=function(b,e,d,h,g,k){var i;i=new THREE.Matrix4;i.n11=2*g/(e-b);i.n12=0;i.n13=(e+b)/(e-b);i.n14=0;i.n21=0;i.n22=2*g/(h-d);i.n23=(h+d)/(h-d);i.n24=0;i.n31=0;i.n32=0;i.n33=-(k+g)/(k-g);i.n34=-2*k*g/(k-g);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(b,e,d,h){var g;b=d*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*e,b*e,g,b,d,h)}; +THREE.Matrix4.makeOrtho=function(b,e,d,h,g,k){var i,p,q,u;i=new THREE.Matrix4;p=e-b;q=d-h;u=k-g;i.n11=2/p;i.n12=0;i.n13=0;i.n14=-((e+b)/p);i.n21=0;i.n22=2/q;i.n23=0;i.n24=-((d+h)/q);i.n31=0;i.n32=0;i.n33=-2/u;i.n34=-((k+g)/u);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible= !0;this._vector=new THREE.Vector3}; -THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===-1){b.parent!== -undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d instanceof THREE.Scene===!1&&d!==undefined;)d=d.parent;d!==undefined&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1){b.parent=undefined;this.children.splice(d,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!== -1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(b,d,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||d){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;d=!0}b=0;for(var h=this.children.length;b=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var k=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}g=Math.sin((1-h)*k)/j;h=Math.sin(h*k)/j;e.w=b.w*g+d.w*h;e.x=b.x*g+d.x*h;e.y=b.y*g+d.y*h;e.z=b.z*g+d.z*h;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; -THREE.Face3=function(b,d,e,h,g,k){this.a=b;this.b=d;this.c=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3}; -THREE.Face4=function(b,d,e,h,g,k,j){this.a=b;this.b=d;this.c=e;this.d=h;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)}; -THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; -THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.faces.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 d=1,e=this.vertices.length;dthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x; -if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;d=1){d.w=b.w;d.x=b.x;d.y=b.y;d.z=b.z;return d}var k=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.001){d.w=0.5*(b.w+e.w);d.x=0.5*(b.x+e.x);d.y=0.5*(b.y+e.y);d.z=0.5*(b.z+e.z);return d}g=Math.sin((1-h)*k)/i;h=Math.sin(h*k)/i;d.w=b.w*g+e.w*h;d.x=b.x*g+e.x*h;d.y=b.y*g+e.y*h;d.z=b.z*g+e.z*h;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; +THREE.Face3=function(b,e,d,h,g,k){this.a=b;this.b=e;this.c=d;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3}; +THREE.Face4=function(b,e,d,h,g,k,i){this.a=b;this.b=e;this.c=d;this.d=h;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};THREE.UV=function(b,e){this.set(b||0,e||0)}; +THREE.UV.prototype={set:function(b,e){this.u=b;this.v=e;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; +THREE.Geometry.prototype={computeCentroids:function(){var b,e,d;b=0;for(e=this.faces.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 e=1,d=this.vertices.length;ethis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x; +if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,e=0,d=this.vertices.length;e1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+h+" on bone "+H);h=h<0?0:1}if(e==="pos"){e=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){e.x=g[0]+(k[0]-g[0])*h;e.y=g[1]+(k[1]-g[1])*h;e.z=g[2]+(k[2]-g[2])*h}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= -this.getPrevKeyWith("pos",H,j.index-1).pos;this.points[1]=g;this.points[2]=k;this.points[3]=this.getNextKeyWith("pos",H,p.index+1).pos;h=h*0.33+0.33;g=this.interpolateCatmullRom(this.points,h);e.x=g[0];e.y=g[1];e.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){h=this.interpolateCatmullRom(this.points,h*1.01);this.target.set(h[0],h[1],h[2]);this.target.subSelf(e);this.target.y=0;this.target.normalize();h=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,h,0)}}}else if(e=== -"rot")THREE.Quaternion.slerp(g,k,b.quaternion,h);else if(e==="scl"){e=b.scale;e.x=g[0]+(k[0]-g[0])*h;e.y=g[1]+(k[1]-g[1])*h;e.z=g[2]+(k[2]-g[2])*h}}}}if(this.JITCompile&&E[0][v]===undefined){this.hierarchy[0].update(undefined,!0);for(H=0;Hb.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];p=b[e[1]];q=b[e[2]];v=b[e[3]];e=g*g;j=g*e;h[0]=this.interpolate(k[0],p[0],q[0],v[0],g,e,j);h[1]=this.interpolate(k[1],p[1],q[1],v[1],g,e,j);h[2]=this.interpolate(k[2],p[2],q[2],v[2],g,e,j);return h}; -THREE.Animation.prototype.interpolate=function(b,d,e,h,g,k,j){b=(e-b)*0.5;h=(h-d)*0.5;return(2*(d-e)+b+h)*j+(-3*(d-e)-2*b-h)*k+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,e){var h=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=e0?e:0:e>=0?e:e+h.length;e>=0;e--)if(h[e][b]!==undefined)return h[e];return this.data.hierarchy[d].keys[h.length-1]}; -THREE.Camera=function(b,d,e,h,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=h||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype; -THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)}; -THREE.Camera.prototype.update=function(b,d,e){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);d=!0}else{this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate= -!1;d=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+h+" on bone "+F);h=h<0?0:1}if(d==="pos"){d=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=g[0]+(k[0]-g[0])*h;d.y=g[1]+(k[1]-g[1])*h;d.z=g[2]+(k[2]-g[2])*h}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= +this.getPrevKeyWith("pos",F,i.index-1).pos;this.points[1]=g;this.points[2]=k;this.points[3]=this.getNextKeyWith("pos",F,p.index+1).pos;h=h*0.33+0.33;g=this.interpolateCatmullRom(this.points,h);d.x=g[0];d.y=g[1];d.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){h=this.interpolateCatmullRom(this.points,h*1.01);this.target.set(h[0],h[1],h[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();h=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,h,0)}}}else if(d=== +"rot")THREE.Quaternion.slerp(g,k,b.quaternion,h);else if(d==="scl"){d=b.scale;d.x=g[0]+(k[0]-g[0])*h;d.y=g[1]+(k[1]-g[1])*h;d.z=g[2]+(k[2]-g[2])*h}}}}if(this.JITCompile&&D[0][u]===undefined){this.hierarchy[0].update(undefined,!0);for(F=0;Fb.length-2?k:k+1;d[3]=k>b.length-3?k:k+2;k=b[d[0]];p=b[d[1]];q=b[d[2]];u=b[d[3]];d=g*g;i=g*d;h[0]=this.interpolate(k[0],p[0],q[0],u[0],g,d,i);h[1]=this.interpolate(k[1],p[1],q[1],u[1],g,d,i);h[2]=this.interpolate(k[2],p[2],q[2],u[2],g,d,i);return h}; +THREE.Animation.prototype.interpolate=function(b,e,d,h,g,k,i){b=(d-b)*0.5;h=(h-e)*0.5;return(2*(e-d)+b+h)*i+(-3*(e-d)-2*b-h)*k+b*g+e};THREE.Animation.prototype.getNextKeyWith=function(b,e,d){var h=this.data.hierarchy[e].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d0?d:0:d>=0?d:d+h.length;d>=0;d--)if(h[d][b]!==undefined)return h[d];return this.data.hierarchy[e].keys[h.length-1]}; +THREE.Camera=function(b,e,d,h,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=e||1;this.near=d||0.1;this.far=h||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype; +THREE.Camera.prototype.translate=function(b,e){this.matrix.rotateAxis(e);this.position.addSelf(e.multiplyScalar(b));this.target.position.addSelf(e.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)}; +THREE.Camera.prototype.update=function(b,e,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);e=!0}else{this.matrixAutoUpdate&&(e|=this.updateMatrix());if(e||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate= +!1;e=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var h=1;h=this.LODs[h].visibleAtDistance){this.LODs[h-1].object3D.visible= -!1;this.LODs[h].object3D.visible=!0}else break;for(;h=0&&ta>=0&&aa>=0&&ma>=0)return!0;else if(Fa<0&&ta<0||aa<0&&ma<0)return!1;else{if(Fa<0)pa=Math.max(pa,Fa/(Fa-ta));else ta<0&&(ra=Math.min(ra,Fa/(Fa-ta)));if(aa<0)pa=Math.max(pa,aa/(aa-ma));else ma<0&&(ra=Math.min(ra,aa/(aa-ma)));if(ra1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var h=1;h=this.LODs[h].visibleAtDistance){this.LODs[h-1].object3D.visible= +!1;this.LODs[h].object3D.visible=!0}else break;for(;hE){d=D;D=E;E=d}}else if(DF){d=I;I=F;F=d}}else if(I=0&&ta>=0&&aa>=0&&ma>=0)return!0;else if(Fa<0&&ta<0||aa<0&&ma<0)return!1;else{if(Fa<0)pa=Math.max(pa,Fa/(Fa-ta));else ta<0&&(ra=Math.min(ra,Fa/(Fa-ta)));if(aa<0)pa=Math.max(pa,aa/(aa-ma));else ma<0&&(ra=Math.min(ra,aa/(aa-ma)));if(raFa&&j.positionScreen.z0&&Z.z<1){Pa=da[sa]=da[sa]||new THREE.RenderableParticle;sa++;P=Pa;P.x=Z.x/Z.w;P.y=Z.y/Z.w;P.z=Z.z;P.rotation=$.rotation.z;P.scale.x=$.scale.x*Math.abs(P.x-(Z.x+R.projectionMatrix.n11)/(Z.w+R.projectionMatrix.n14));P.scale.y=$.scale.y*Math.abs(P.y-(Z.y+R.projectionMatrix.n22)/(Z.w+R.projectionMatrix.n24));P.materials=$.materials;ra.push(P)}}}}pa&&ra.sort(d);return ra}}; -THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,e){e&&b.update(undefined,!1,d);e=b.sounds;var h,g=e.length;for(h=0;hFa&&i.positionScreen.z0&&Z.z<1){Pa=da[sa]=da[sa]||new THREE.RenderableParticle;sa++;L=Pa;L.x=Z.x/Z.w;L.y=Z.y/Z.w;L.z=Z.z;L.rotation=$.rotation.z;L.scale.x=$.scale.x*Math.abs(L.x-(Z.x+R.projectionMatrix.n11)/(Z.w+R.projectionMatrix.n14));L.scale.y=$.scale.y*Math.abs(L.y-(Z.y+R.projectionMatrix.n22)/(Z.w+R.projectionMatrix.n24));L.materials=$.materials;ra.push(L)}}}}pa&&ra.sort(e);return ra}}; +THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,e,d){d&&b.update(undefined,!1,e);d=b.sounds;var h,g=d.length;for(h=0;ht){y=z;t=A[y]}c.bindBuffer(c.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[y]);c.vertexAttribPointer(s["morphTarget"+m],3,c.FLOAT,!1,0,0);w.__webglMorphTargetInfluences[m]=t;u[y]=1;t=-1;m++}}c.uniform1fv(n.program.uniforms.morphTargetInfluences, +n instanceof THREE.MeshShaderMaterial||n.skinning)&&c.uniformMatrix4fv(x.viewMatrix,!1,Xa);if(n instanceof THREE.ShadowVolumeDynamicMaterial){f=v.directionalLightDirection.value;f[0]=-s[1].position.x;f[1]=-s[1].position.y;f[2]=-s[1].position.z;c.uniform3fv(x.directionalLightDirection,f);c.uniformMatrix4fv(x.objectMatrix,!1,o._objectMatrixArray);c.uniformMatrix4fv(x.viewMatrix,!1,Xa)}if(n.skinning){c.uniformMatrix4fv(x.cameraInverseMatrix,!1,Xa);c.uniformMatrix4fv(x.boneGlobalMatrices,!1,o.boneMatrices)}return w} +function h(f,s,m,n,o,w){if(n.opacity!=0){var x;f=d(f,s,m,n,w).attributes;if(n.morphTargets){s=n.program.attributes;w.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[w.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,o.__webglVertexBuffer);c.vertexAttribPointer(s.position,3,c.FLOAT,!1,0,0);if(w.morphTargetForcedOrder.length){m=0;for(var v=w.morphTargetForcedOrder,A=w.morphTargetInfluences;mt){y=z;t=A[y]}c.bindBuffer(c.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[y]);c.vertexAttribPointer(s["morphTarget"+m],3,c.FLOAT,!1,0,0);w.__webglMorphTargetInfluences[m]=t;v[y]=1;t=-1;m++}}c.uniform1fv(n.program.uniforms.morphTargetInfluences, w.__webglMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,o.__webglVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(o.__webglCustomAttributes)for(x in o.__webglCustomAttributes)if(f[x]>=0){s=o.__webglCustomAttributes[x];c.bindBuffer(c.ARRAY_BUFFER,s.buffer);c.vertexAttribPointer(f[x],s.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,o.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,o.__webglNormalBuffer); c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,o.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(o.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,o.__webglUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(o.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,o.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2); if(n.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,o.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,o.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,o.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,o.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight, 4,c.FLOAT,!1,0,0)}if(w instanceof THREE.Mesh)if(n.wireframe){c.lineWidth(n.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer);c.drawElements(c.LINES,o.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer);c.drawElements(c.TRIANGLES,o.__webglFaceCount,c.UNSIGNED_SHORT,0)}else if(w instanceof THREE.Line){w=w.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(n.linewidth);c.drawArrays(w,0,o.__webglLineCount)}else if(w instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,o.__webglParticleCount);else w instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,o.__webglVertexCount)}}function g(f,s,m){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();if(!f.__webglNormalBuffer)f.__webglNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.position);c.vertexAttribPointer(s.attributes.position, -3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);if(m==THREE.FlatShading){var n,o,w,x,u,A,t,y,z,D,B=f.count*3;for(D=0;D0&&W[0]0&&W[1]0.0010&&u.scale>0.0010){N[0]=u.x;N[1]=u.y;N[2]=u.z;D=u.size*u.scale/za;B[0]=D*t;B[1]=D;c.uniform3fv(O.screenPosition,N);c.uniform2fv(O.scale,B);c.uniform1f(O.rotation,u.rotation);c.uniform1f(O.opacity,u.opacity);oa(u.blending);K(u.texture,1);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT, -0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function V(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function P(f){var s,m,n,o,w;if(f instanceof THREE.Mesh){m=f.geometry;for(s in m.geometryGroups){n=m.geometryGroups[s];w=!1;for(o in n.__webglCustomAttributes)if(n.__webglCustomAttributes[o].needsUpdate){w=!0;break}if(m.__dirtyVertices|| -m.__dirtyMorphTargets||m.__dirtyElements||m.__dirtyUvs||m.__dirtyNormals||m.__dirtyColors||m.__dirtyTangents||w){w=c.DYNAMIC_DRAW;var x=void 0,u=void 0,A=void 0,t=void 0;A=void 0;var y=void 0,z=void 0,D=void 0,B=void 0,N=void 0,W=void 0,O=void 0,X=void 0,Ga=void 0,S=void 0,Q=void 0,T=void 0,ua=void 0;z=void 0;D=void 0;t=void 0;B=void 0;t=void 0;var r=void 0,F=void 0;z=void 0;r=void 0;F=void 0;var i=void 0,Ka=void 0;r=void 0;F=void 0;i=void 0;Ka=void 0;r=void 0;F=void 0;i=void 0;Ka=void 0;r=void 0; -F=void 0;i=void 0;t=void 0;B=void 0;y=void 0;A=void 0;A=void 0;r=void 0;F=void 0;i=void 0;var Wa=void 0,va=0,Aa=0,bb=0,cb=0,Ja=0,La=0,ea=0,Ma=0,xa=0,C=0,Ba=0;F=r=0;var Ca=n.__vertexArray,ib=n.__uvArray,jb=n.__uv2Array,Qa=n.__normalArray,ha=n.__tangentArray,Da=n.__colorArray,ia=n.__skinVertexAArray,ja=n.__skinVertexBArray,ka=n.__skinIndexArray,la=n.__skinWeightArray,kb=n.__morphTargetsArrays,Ra=n.__webglCustomAttributes;i=void 0;var Na=n.__faceArray,Oa=n.__lineArray,tb=n.__needsSmoothNormals;W=n.__vertexColorType; -N=n.__uvType;O=n.__normalType;var Ha=f.geometry,lb=Ha.__dirtyVertices,mb=Ha.__dirtyElements,hb=Ha.__dirtyUvs,nb=Ha.__dirtyNormals,ob=Ha.__dirtyTangents,pb=Ha.__dirtyColors,qb=Ha.__dirtyMorphTargets,db=Ha.vertices,ub=n.faces,zb=Ha.faces,vb=Ha.faceVertexUvs[0],wb=Ha.faceVertexUvs[1],eb=Ha.skinVerticesA,fb=Ha.skinVerticesB,gb=Ha.skinIndices,Xa=Ha.skinWeights,ab=Ha.edgeFaces,Ta=Ha.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}x=0;for(u=ub.length;x0){c.bindBuffer(c.ARRAY_BUFFER,n.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Da,w)}if(nb){c.bindBuffer(c.ARRAY_BUFFER,n.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,w)}if(ob&&Ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,n.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,w)}if(hb&&bb>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,ib,w)}if(hb&&cb>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,jb,w)}if(mb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, -n.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,w);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,w)}if(C>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,w);c.bindBuffer(c.ARRAY_BUFFER,n.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ja,w);c.bindBuffer(c.ARRAY_BUFFER,n.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,w);c.bindBuffer(c.ARRAY_BUFFER,n.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER, -la,w)}}}m.__dirtyVertices=!1;m.__dirtyMorphTargets=!1;m.__dirtyElements=!1;m.__dirtyUvs=!1;m.__dirtyNormals=!1;m.__dirtyTangents=!1;m.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){m=f.geometry;if(m.__dirtyVertices||m.__dirtyColors){f=m;s=c.DYNAMIC_DRAW;W=f.vertices;n=f.colors;O=W.length;w=n.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u65535){y[A].counter+=1;t=y[A].hash+"_"+y[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:z})}f.geometryGroups[t].faces.push(o);f.geometryGroups[t].vertices+=x}}function da(f,s,m){f.push({buffer:s,object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function oa(f){if(f!=ga){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD); -c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD);c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}ga=f}}function Z(f,s,m){if((m.width&m.width-1)==0&&(m.height&m.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,fa(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,fa(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,fa(s.magFilter)); -c.texParameteri(f,c.TEXTURE_MIN_FILTER,fa(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,Ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,Ea(s.minFilter))}}function K(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture(); -c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}Z(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function Ia(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer(); -f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,fa(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,fa(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,fa(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,fa(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,fa(f.format),f.width,f.height,0,fa(f.format),fa(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER, -f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&&!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER, -f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,m;if(f){s=f.__webglFramebuffer;m=f.width;f=f.height}else{s=null;m=ya;f=za}if(s!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(wa,qa,m,f);Fa=s}}function ca(f,s){var m;if(f=="fragment")m=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(m=c.createShader(c.VERTEX_SHADER));c.shaderSource(m, -s);c.compileShader(m);if(!c.getShaderParameter(m,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(m));console.error(s);return null}return m}function Ea(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function fa(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST; -case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT; -case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var c,R=document.createElement("canvas"),pa=[],ra=null,Fa=null,ta=!0,aa=this,ma=null,na=null,ga=null,Y=null,wa=0,qa=0,ya=0,za=0,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4, -new THREE.Vector4,new THREE.Vector4],Pa=new THREE.Matrix4,Ua=new Float32Array(16),Ya=new Float32Array(16),Va=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Za=!0,$a=!0,xb=new THREE.Color(0),yb=0;if(b){if(b.stencil!=undefined)Za=b.stencil;if(b.antialias!==undefined)$a=b.antialias;b.clearColor!==undefined&&xb.setHex(b.clearColor);if(b.clearAlpha!==undefined)yb=b.clearAlpha}this.maxMorphTargets=8;this.domElement= -R;this.autoClear=!0;this.sortObjects=!0;(function(f,s,m,n){try{if(!(c=R.getContext("experimental-webgl",{antialias:f,stencil:n})))throw"Error creating WebGL context.";}catch(o){console.error(o)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE); -c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(s.r,s.g,s.b,m)})($a,xb,yb,Za);this.context=c;if(Za){var U={};U.vertices=new Float32Array(12);U.faces=new Uint16Array(6);U.darkness=0.5;U.vertices[0]=-20;U.vertices[1]=-20;U.vertices[2]=-1;U.vertices[3]=20;U.vertices[4]=-20;U.vertices[5]=-1;U.vertices[6]=20;U.vertices[7]=20;U.vertices[8]=-1;U.vertices[9]=-20;U.vertices[10]=20;U.vertices[11]=-1;U.faces[0]=0;U.faces[1]=1;U.faces[2]=2;U.faces[3]= -0;U.faces[4]=2;U.faces[5]=3;U.vertexBuffer=c.createBuffer();U.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,U.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,U.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,U.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,U.faces,c.STATIC_DRAW);U.program=c.createProgram();c.attachShader(U.program,ca("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(U.program,ca("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(U.program); -U.vertexLocation=c.getAttribLocation(U.program,"position");U.projectionLocation=c.getUniformLocation(U.program,"projectionMatrix");U.darknessLocation=c.getUniformLocation(U.program,"darkness")}var J={};J.vertices=new Float32Array(16);J.faces=new Uint16Array(6);b=0;J.vertices[b++]=-1;J.vertices[b++]=-1;J.vertices[b++]=0;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=-1; -J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;b=0;J.faces[b++]=0;J.faces[b++]=1;J.faces[b++]=2;J.faces[b++]=0;J.faces[b++]=2;J.faces[b++]=3;J.vertexBuffer=c.createBuffer();J.elementBuffer=c.createBuffer();J.tempTexture=c.createTexture();J.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,J.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,J.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,J.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D, -J.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE); -c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);if(c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){J.hasVertexTexture=!1;J.program=c.createProgram();c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(J.program,ca("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{J.hasVertexTexture=!0;J.program=c.createProgram(); -c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));c.attachShader(J.program,ca("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}c.linkProgram(J.program);J.attributes={};J.uniforms={};J.attributes.vertex=c.getAttribLocation(J.program,"position");J.attributes.uv=c.getAttribLocation(J.program,"UV");J.uniforms.renderType=c.getUniformLocation(J.program,"renderType");J.uniforms.map=c.getUniformLocation(J.program,"map");J.uniforms.occlusionMap=c.getUniformLocation(J.program, -"occlusionMap");J.uniforms.opacity=c.getUniformLocation(J.program,"opacity");J.uniforms.scale=c.getUniformLocation(J.program,"scale");J.uniforms.rotation=c.getUniformLocation(J.program,"rotation");J.uniforms.screenPosition=c.getUniformLocation(J.program,"screenPosition");var sb=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]= --1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer); -c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();c.attachShader(_sprite.program,ca("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,ca("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program, -"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program, -"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program, -"projectionMatrix");var rb=!1;this.setSize=function(f,s){R.width=f;R.height=s;this.setViewport(0,0,R.width,R.height)};this.setViewport=function(f,s,m,n){wa=f;qa=s;ya=m;za=n;c.viewport(wa,qa,ya,za)};this.setScissor=function(f,s,m,n){c.scissor(f,s,m,n)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){ta=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var m=new THREE.Color(f);c.clearColor(m.r,m.g,m.b,s)};this.setClearColor= -function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){U.darkness=f};this.initMaterial=function(f,s,m,n){var o,w,x;if(f instanceof THREE.MeshDepthMaterial)x="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)x="shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)x="normal";else if(f instanceof THREE.MeshBasicMaterial)x="basic";else if(f instanceof THREE.MeshLambertMaterial)x= -"lambert";else if(f instanceof THREE.MeshPhongMaterial)x="phong";else if(f instanceof THREE.LineBasicMaterial)x="basic";else f instanceof THREE.ParticleBasicMaterial&&(x="particle_basic");if(x){var u=THREE.ShaderLib[x];f.uniforms=Uniforms.clone(u.uniforms);f.vertexShader=u.vertexShader;f.fragmentShader=u.fragmentShader}var A,t,y;A=y=u=0;for(t=s.length;A0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+m.maxDirLights,"#define MAX_POINT_LIGHTS "+m.maxPointLights,"#define MAX_BONES "+m.maxBones,m.map?"#define USE_MAP":"",m.envMap?"#define USE_ENVMAP":"",m.lightMap?"#define USE_LIGHTMAP":"",m.vertexColors?"#define USE_COLOR":"",m.skinning?"#define USE_SKINNING":"",m.morphTargets?"#define USE_MORPHTARGETS":"",m.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n"); -c.attachShader(D,ca("fragment",prefix_fragment+A));c.attachShader(D,ca("vertex",prefix_vertex+t));c.linkProgram(D);c.getProgramParameter(D,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(D,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");D.uniforms={};D.attributes={};var B;A=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in u)A.push(B); -B=A;u=0;for(A=B.length;u=0&&c.enableVertexAttribArray(z.color);z.normal>= +c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);ga="";ra=V.program;c.useProgram(V.program);c.uniformMatrix4fv(V.projectionLocation,!1,Ta);c.uniform1f(V.darknessLocation,V.darkness);c.bindBuffer(c.ARRAY_BUFFER,V.vertexBuffer);c.vertexAttribPointer(V.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(V.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,V.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST); +c.enable(c.DEPTH_TEST);c.depthMask(ta)}function M(f,s){var m,n,o;m=_sprite.attributes;var w=_sprite.uniforms,x=za/ya,v,A=[],t=ya*0.5,y=za*0.5,z=!0;c.useProgram(_sprite.program);ra=_sprite.program;ga="";if(!qb){c.enableVertexAttribArray(_sprite.attributes.position);c.enableVertexAttribArray(_sprite.attributes.uv);qb=!0}c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(m.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(m.uv, +2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(w.projectionMatrix,!1,Ta);c.activeTexture(c.TEXTURE0);c.uniform1i(w.map,0);m=0;for(n=f.__webglSprites.length;m0&&W[0]0&&W[1]0.001&&v.scale>0.001){O[0]=v.x;O[1]=v.y;O[2]=v.z;G=v.size*v.scale/za;B[0]=G*t;B[1]=G;c.uniform3fv(P.screenPosition,O);c.uniform2fv(P.scale,B);c.uniform1f(P.rotation,v.rotation);c.uniform1f(P.opacity,v.opacity);oa(v.blending);K(v.texture,1);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT, +0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function U(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function L(f){var s,m,n,o,w;if(f instanceof THREE.Mesh){m=f.geometry;for(s in m.geometryGroups){n=m.geometryGroups[s];w=!1;for(o in n.__webglCustomAttributes)if(n.__webglCustomAttributes[o].needsUpdate){w=!0;break}if(m.__dirtyVertices|| +m.__dirtyMorphTargets||m.__dirtyElements||m.__dirtyUvs||m.__dirtyNormals||m.__dirtyColors||m.__dirtyTangents||w){w=c.DYNAMIC_DRAW;var x=void 0,v=void 0,A=void 0,t=void 0;A=void 0;var y=void 0,z=void 0,G=void 0,B=void 0,O=void 0,W=void 0,P=void 0,X=void 0,Ga=void 0,S=void 0,Q=void 0,T=void 0,ua=void 0;z=void 0;G=void 0;t=void 0;B=void 0;t=void 0;var r=void 0,H=void 0;z=void 0;r=void 0;H=void 0;var j=void 0,Ka=void 0;r=void 0;H=void 0;j=void 0;Ka=void 0;r=void 0;H=void 0;j=void 0;Ka=void 0;r=void 0; +H=void 0;j=void 0;t=void 0;B=void 0;y=void 0;A=void 0;A=void 0;r=void 0;H=void 0;j=void 0;var Va=void 0,va=0,Aa=0,ab=0,bb=0,Ja=0,La=0,ea=0,Ma=0,xa=0,C=0,Ba=0;H=r=0;var Ca=n.__vertexArray,hb=n.__uvArray,ib=n.__uv2Array,Qa=n.__normalArray,ha=n.__tangentArray,Da=n.__colorArray,ia=n.__skinVertexAArray,ja=n.__skinVertexBArray,ka=n.__skinIndexArray,la=n.__skinWeightArray,jb=n.__morphTargetsArrays,Ra=n.__webglCustomAttributes;j=void 0;var Na=n.__faceArray,Oa=n.__lineArray,sb=n.__needsSmoothNormals;W=n.__vertexColorType; +O=n.__uvType;P=n.__normalType;var Ha=f.geometry,kb=Ha.__dirtyVertices,lb=Ha.__dirtyElements,gb=Ha.__dirtyUvs,mb=Ha.__dirtyNormals,nb=Ha.__dirtyTangents,ob=Ha.__dirtyColors,pb=Ha.__dirtyMorphTargets,cb=Ha.vertices,tb=n.faces,yb=Ha.faces,ub=Ha.faceVertexUvs[0],vb=Ha.faceVertexUvs[1],db=Ha.skinVerticesA,eb=Ha.skinVerticesB,fb=Ha.skinIndices,Wa=Ha.skinWeights,$a=f instanceof THREE.ShadowVolume?Ha.edgeFaces:undefined;morphTargets=Ha.morphTargets;if(Ra)for(Va in Ra){Ra[Va].offset=0;Ra[Va].offsetSrc=0}x= +0;for(v=tb.length;x0){c.bindBuffer(c.ARRAY_BUFFER,n.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Da,w)}if(mb){c.bindBuffer(c.ARRAY_BUFFER,n.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,w)}if(nb&&Ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,n.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,w)}if(gb&&ab>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,hb,w)}if(gb&& +bb>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,ib,w)}if(lb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,w);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,w)}if(C>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,w);c.bindBuffer(c.ARRAY_BUFFER,n.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ja,w);c.bindBuffer(c.ARRAY_BUFFER, +n.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,w);c.bindBuffer(c.ARRAY_BUFFER,n.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,la,w)}}}m.__dirtyVertices=!1;m.__dirtyMorphTargets=!1;m.__dirtyElements=!1;m.__dirtyUvs=!1;m.__dirtyNormals=!1;m.__dirtyTangents=!1;m.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){m=f.geometry;if(m.__dirtyVertices||m.__dirtyColors){f=m;s=c.DYNAMIC_DRAW;W=f.vertices;n=f.colors;P=W.length;w=n.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors; +if(f.__dirtyVertices){for(v=0;v65535){y[A].counter+=1;t=y[A].hash+"_"+y[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:v,vertices:0,numMorphTargets:z})}f.geometryGroups[t].faces.push(o);f.geometryGroups[t].vertices+=x}}function da(f,s,m){f.push({buffer:s,object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function oa(f){if(f!= +ga){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD);c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}ga=f}}function Z(f,s,m){if((m.width&m.width-1)==0&&(m.height& +m.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,fa(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,fa(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,fa(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,fa(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,Ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,Ea(s.minFilter))}}function K(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D, +f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}Z(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function Ia(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer=== +undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,fa(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,fa(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,fa(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,fa(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,fa(f.format),f.width,f.height, +0,fa(f.format),fa(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&&!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER, +c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,m;if(f){s=f.__webglFramebuffer;m=f.width;f=f.height}else{s=null;m=ya;f=za}if(s!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(wa,qa,m,f);Fa=s}}function ca(f,s){var m;if(f=="fragment")m= +c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(m=c.createShader(c.VERTEX_SHADER));c.shaderSource(m,s);c.compileShader(m);if(!c.getShaderParameter(m,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(m));console.error(s);return null}return m}function Ea(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function fa(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE; +case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT; +case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var c,R=document.createElement("canvas"),pa=[],ra=null,Fa=null,ta=!0,aa=this,ma=null,na=null,ga=null,Y=null,wa= +0,qa=0,ya=0,za=0,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Pa=new THREE.Matrix4,Ta=new Float32Array(16),Xa=new Float32Array(16),Ua=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Ya=!0,Za=!0,wb=new THREE.Color(0),xb=0;if(b){if(b.stencil!=undefined)Ya=b.stencil;if(b.antialias!==undefined)Za=b.antialias;b.clearColor!==undefined&&wb.setHex(b.clearColor); +if(b.clearAlpha!==undefined)xb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=R;this.autoClear=!0;this.sortObjects=!0;(function(f,s,m,n){try{if(!(c=R.getContext("experimental-webgl",{antialias:f,stencil:n})))throw"Error creating WebGL context.";}catch(o){console.error(o)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST); +c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(s.r,s.g,s.b,m)})(Za,wb,xb,Ya);this.context=c;if(Ya){var V={};V.vertices=new Float32Array(12);V.faces=new Uint16Array(6);V.darkness=0.5;V.vertices[0]=-20;V.vertices[1]=-20;V.vertices[2]=-1;V.vertices[3]=20;V.vertices[4]=-20;V.vertices[5]=-1;V.vertices[6]=20;V.vertices[7]=20;V.vertices[8]=-1;V.vertices[9]=-20;V.vertices[10]= +20;V.vertices[11]=-1;V.faces[0]=0;V.faces[1]=1;V.faces[2]=2;V.faces[3]=0;V.faces[4]=2;V.faces[5]=3;V.vertexBuffer=c.createBuffer();V.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,V.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,V.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,V.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,V.faces,c.STATIC_DRAW);V.program=c.createProgram();c.attachShader(V.program,ca("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(V.program, +ca("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(V.program);V.vertexLocation=c.getAttribLocation(V.program,"position");V.projectionLocation=c.getUniformLocation(V.program,"projectionMatrix");V.darknessLocation=c.getUniformLocation(V.program,"darkness")}var J={};J.vertices=new Float32Array(16);J.faces=new Uint16Array(6);b=0;J.vertices[b++]=-1;J.vertices[b++]=-1;J.vertices[b++]=0;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]= +1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;b=0;J.faces[b++]=0;J.faces[b++]=1;J.faces[b++]=2;J.faces[b++]=0;J.faces[b++]=2;J.faces[b++]=3;J.vertexBuffer=c.createBuffer();J.elementBuffer=c.createBuffer();J.tempTexture=c.createTexture();J.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,J.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,J.elementBuffer); +c.bufferData(c.ELEMENT_ARRAY_BUFFER,J.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA, +16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);if(c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){J.hasVertexTexture=!1;J.program=c.createProgram();c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(J.program,ca("vertex", +THREE.ShaderLib.lensFlare.vertexShader))}else{J.hasVertexTexture=!0;J.program=c.createProgram();c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));c.attachShader(J.program,ca("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}c.linkProgram(J.program);J.attributes={};J.uniforms={};J.attributes.vertex=c.getAttribLocation(J.program,"position");J.attributes.uv=c.getAttribLocation(J.program,"UV");J.uniforms.renderType=c.getUniformLocation(J.program, +"renderType");J.uniforms.map=c.getUniformLocation(J.program,"map");J.uniforms.occlusionMap=c.getUniformLocation(J.program,"occlusionMap");J.uniforms.opacity=c.getUniformLocation(J.program,"opacity");J.uniforms.scale=c.getUniformLocation(J.program,"scale");J.uniforms.rotation=c.getUniformLocation(J.program,"rotation");J.uniforms.screenPosition=c.getUniformLocation(J.program,"screenPosition");var rb=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]= +-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer= +c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();c.attachShader(_sprite.program,ca("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,ca("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program); +_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment= +c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix= +c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var qb=!1;this.setSize=function(f,s){R.width=f;R.height=s;this.setViewport(0,0,R.width,R.height)};this.setViewport=function(f,s,m,n){wa=f;qa=s;ya=m;za=n;c.viewport(wa,qa,ya,za)};this.setScissor=function(f,s,m,n){c.scissor(f,s,m,n)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){ta= +f;c.depthMask(f)};this.setClearColorHex=function(f,s){var m=new THREE.Color(f);c.clearColor(m.r,m.g,m.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){V.darkness=f};this.initMaterial=function(f,s,m,n){var o,w,x;if(f instanceof THREE.MeshDepthMaterial)x="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)x="shadowVolumeDynamic";else if(f instanceof +THREE.MeshNormalMaterial)x="normal";else if(f instanceof THREE.MeshBasicMaterial)x="basic";else if(f instanceof THREE.MeshLambertMaterial)x="lambert";else if(f instanceof THREE.MeshPhongMaterial)x="phong";else if(f instanceof THREE.LineBasicMaterial)x="basic";else f instanceof THREE.ParticleBasicMaterial&&(x="particle_basic");if(x){var v=THREE.ShaderLib[x];f.uniforms=Uniforms.clone(v.uniforms);f.vertexShader=v.vertexShader;f.fragmentShader=v.fragmentShader}var A,t,y;A=y=v=0;for(t=s.length;A0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+m.maxDirLights,"#define MAX_POINT_LIGHTS "+m.maxPointLights,"#define MAX_BONES "+m.maxBones,m.map?"#define USE_MAP":"",m.envMap?"#define USE_ENVMAP":"",m.lightMap?"#define USE_LIGHTMAP":"",m.vertexColors? +"#define USE_COLOR":"",m.skinning?"#define USE_SKINNING":"",m.morphTargets?"#define USE_MORPHTARGETS":"",m.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n"); +c.attachShader(G,ca("fragment",prefix_fragment+A));c.attachShader(G,ca("vertex",prefix_vertex+t));c.linkProgram(G);c.getProgramParameter(G,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(G,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");G.uniforms={};G.attributes={};var B;A=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in v)A.push(B); +B=A;v=0;for(A=B.length;v=0&&c.enableVertexAttribArray(z.color);z.normal>= 0&&c.enableVertexAttribArray(z.normal);z.tangent>=0&&c.enableVertexAttribArray(z.tangent);if(f.skinning&&z.skinVertexA>=0&&z.skinVertexB>=0&&z.skinIndex>=0&&z.skinWeight>=0){c.enableVertexAttribArray(z.skinVertexA);c.enableVertexAttribArray(z.skinVertexB);c.enableVertexAttribArray(z.skinIndex);c.enableVertexAttribArray(z.skinWeight)}for(o in f.attributes)z[o]>=0&&c.enableVertexAttribArray(z[o]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(z.morphTarget0>=0){c.enableVertexAttribArray(z.morphTarget0); f.numSupportedMorphTargets++}if(z.morphTarget1>=0){c.enableVertexAttribArray(z.morphTarget1);f.numSupportedMorphTargets++}if(z.morphTarget2>=0){c.enableVertexAttribArray(z.morphTarget2);f.numSupportedMorphTargets++}if(z.morphTarget3>=0){c.enableVertexAttribArray(z.morphTarget3);f.numSupportedMorphTargets++}if(z.morphTarget4>=0){c.enableVertexAttribArray(z.morphTarget4);f.numSupportedMorphTargets++}if(z.morphTarget5>=0){c.enableVertexAttribArray(z.morphTarget5);f.numSupportedMorphTargets++}if(z.morphTarget6>= -0){c.enableVertexAttribArray(z.morphTarget6);f.numSupportedMorphTargets++}if(z.morphTarget7>=0){c.enableVertexAttribArray(z.morphTarget7);f.numSupportedMorphTargets++}n.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(o=this.maxMorphTargets;f=0){c.enableVertexAttribArray(z.morphTarget7);f.numSupportedMorphTargets++}n.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(o=this.maxMorphTargets;f0||D.faceVertexUvs.length>0)x.__uvArray=new Float32Array(A*2);if(D.faceUvs.length>1||D.faceVertexUvs.length>1)x.__uv2Array=new Float32Array(A*2)}if(u.geometry.skinWeights.length&&u.geometry.skinIndices.length){x.__skinVertexAArray=new Float32Array(A*4);x.__skinVertexBArray=new Float32Array(A* -4);x.__skinIndexArray=new Float32Array(A*4);x.__skinWeightArray=new Float32Array(A*4)}x.__faceArray=new Uint16Array(N*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0));x.__lineArray=new Uint16Array(W*2);if(x.numMorphTargets){x.__morphTargetsArrays=[];D=0;for(B=x.numMorphTargets;D0||G.faceVertexUvs.length>0)x.__uvArray=new Float32Array(A*2);if(G.faceUvs.length>1||G.faceVertexUvs.length>1)x.__uv2Array=new Float32Array(A*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length){x.__skinVertexAArray=new Float32Array(A*4);x.__skinVertexBArray=new Float32Array(A* +4);x.__skinIndexArray=new Float32Array(A*4);x.__skinWeightArray=new Float32Array(A*4)}x.__faceArray=new Uint16Array(O*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*6:0));x.__lineArray=new Uint16Array(W*2);if(x.numMorphTargets){x.__morphTargetsArrays=[];G=0;for(B=x.numMorphTargets;G=0;o--){n=m.__webglObjects[o].object;if(s==n){m.__webglObjects.splice(o,1);break}}f.__objectsRemoved.splice(0,1)}s=0;for(m=f.__webglObjects.length;s=0;o--){n=m.__webglObjects[o].object;if(s==n){m.__webglObjects.splice(o,1);break}}f.__objectsRemoved.splice(0,1)}s=0;for(m=f.__webglObjects.length;s0}}; -THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==undefined?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==undefined?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==undefined?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==undefined?e.minFilter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBAFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!== -undefined?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==undefined?e.stencilBuffer:!0}; +THREE.WebGLRenderTarget=function(b,e,d){this.width=b;this.height=e;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBAFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!== +undefined?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==undefined?d.stencilBuffer:!0}; -- GitLab