diff --git a/build/Three.js b/build/Three.js index 468f9044273c764a8a9bda725b3e47527d989f43..d60e4d5c065bd23b04c65fe18e0fb0755b176b5a 100755 --- a/build/Three.js +++ b/build/Three.js @@ -1,60 +1,60 @@ -// Three.js r29 - http://github.com/mrdoob/three.js +// Three.js r30 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)}; -THREE.Color.prototype={setRGB:function(a,c,e){this.r=a;this.g=c;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)+ +THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)+")"},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* -this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,e){this.x=a||0;this.y=c||0;this.z=e||0}; -THREE.Vector3.prototype={set:function(a,c,e){this.x=a;this.y=c;this.z=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, -cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,e=this.y,g=this.z;this.x=e*a.z-g*a.y;this.y=g*a.x-c*a.z;this.z=c*a.y-e*a.x;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c= -this.x-a.x,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+e*e+a*a)},distanceToSquared:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return c*c+e*e+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0, -0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},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)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,c,e,g){this.x=a||0;this.y=c||0;this.z=e||0;this.w=g||1}; -THREE.Vector4.prototype={set:function(a,c,e,g){this.x=a;this.y=c;this.z=e;this.w=g;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; +this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0}; +THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, +cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,g=this.z;this.x=d*a.z-g*a.y;this.y=g*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c= +this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0, +0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},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)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,c,d,g){this.x=a||0;this.y=c||0;this.z=d||0;this.w=g||1}; +THREE.Vector4.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var c,e,g=a.objects,b=[];a=0;for(c=g.length;a0&&v>0&&H+v<1}var e,g,b,d,n,q,o,f,h,k, -i,m=a.geometry,l=m.vertices,s=[];e=0;for(g=m.faces.length;e= -0&&Math.min(b,o.getBottom())-Math.max(e,o.getTop())>=0};this.empty=function(){q=true;b=g=e=c=0;a()};this.isEmpty=function(){return q};this.toString=function(){return"THREE.Rectangle ( left: "+c+", right: "+g+", top: "+e+", bottom: "+b+", width: "+d+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}}; +THREE.Ray.prototype={intersectScene:function(a){var c,d,g=a.objects,h=[];a=0;for(c=g.length;a0&&M>0&&o+M<1}var d,g,h,q,m,b,l,y,C,E, +w,D=a.geometry,N=D.vertices,J=[];d=0;for(g=D.faces.length;d= +0&&Math.min(h,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){b=true;h=g=d=c=0;a()};this.isEmpty=function(){return b};this.toString=function(){return"THREE.Rectangle ( left: "+c+", right: "+g+", top: "+d+", bottom: "+h+", width: "+q+", height: "+m+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}}; THREE.Matrix4=function(){}; THREE.Matrix4.prototype={n11:1,n12:0,n13:0,n14:0,n21:0,n22:1,n23:0,n24:0,n31:0,n32:0,n33:1,n34:0,n41:0,n42:0,n43:0,n44:1,identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41= -a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44},lookAt:function(a,c,e){var g=new THREE.Vector3,b=new THREE.Vector3,d=new THREE.Vector3;d.sub(a,c).normalize();g.cross(e,d).normalize();b.cross(d,g).normalize();this.n11=g.x;this.n12=g.y;this.n13=g.z;this.n14=-g.dot(a);this.n21=b.x;this.n22=b.y;this.n23=b.z;this.n24=-b.dot(a);this.n31=d.x;this.n32=d.y;this.n33=d.z;this.n34=-d.dot(a);this.n43=this.n42=this.n41=0;this.n44=1},transform:function(a){var c=a.x,e=a.y,g=a.z,b=a.w||1;a.x=this.n11*c+this.n12* -e+this.n13*g+this.n14*b;a.y=this.n21*c+this.n22*e+this.n23*g+this.n24*b;a.z=this.n31*c+this.n32*e+this.n33*g+this.n34*b;b=this.n41*c+this.n42*e+this.n43*g+this.n44*b;if(a.w)a.w=b;else{c=1/b;a.x*=c;a.y*=c;a.z*=c}return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c}, -multiply:function(a,c){this.n11=a.n11*c.n11+a.n12*c.n21+a.n13*c.n31+a.n14*c.n41;this.n12=a.n11*c.n12+a.n12*c.n22+a.n13*c.n32+a.n14*c.n42;this.n13=a.n11*c.n13+a.n12*c.n23+a.n13*c.n33+a.n14*c.n43;this.n14=a.n11*c.n14+a.n12*c.n24+a.n13*c.n34+a.n14*c.n44;this.n21=a.n21*c.n11+a.n22*c.n21+a.n23*c.n31+a.n24*c.n41;this.n22=a.n21*c.n12+a.n22*c.n22+a.n23*c.n32+a.n24*c.n42;this.n23=a.n21*c.n13+a.n22*c.n23+a.n23*c.n33+a.n24*c.n43;this.n24=a.n21*c.n14+a.n22*c.n24+a.n23*c.n34+a.n24*c.n44;this.n31=a.n31*c.n11+a.n32* -c.n21+a.n33*c.n31+a.n34*c.n41;this.n32=a.n31*c.n12+a.n32*c.n22+a.n33*c.n32+a.n34*c.n42;this.n33=a.n31*c.n13+a.n32*c.n23+a.n33*c.n33+a.n34*c.n43;this.n34=a.n31*c.n14+a.n32*c.n24+a.n33*c.n34+a.n34*c.n44;this.n41=a.n41*c.n11+a.n42*c.n21+a.n43*c.n31+a.n44*c.n41;this.n42=a.n41*c.n12+a.n42*c.n22+a.n43*c.n32+a.n44*c.n42;this.n43=a.n41*c.n13+a.n42*c.n23+a.n43*c.n33+a.n44*c.n43;this.n44=a.n41*c.n14+a.n42*c.n24+a.n43*c.n34+a.n44*c.n44},multiplySelf:function(a){var c=this.n11,e=this.n12,g=this.n13,b=this.n14, -d=this.n21,n=this.n22,q=this.n23,o=this.n24,f=this.n31,h=this.n32,k=this.n33,i=this.n34,m=this.n41,l=this.n42,s=this.n43,v=this.n44;this.n11=c*a.n11+e*a.n21+g*a.n31+b*a.n41;this.n12=c*a.n12+e*a.n22+g*a.n32+b*a.n42;this.n13=c*a.n13+e*a.n23+g*a.n33+b*a.n43;this.n14=c*a.n14+e*a.n24+g*a.n34+b*a.n44;this.n21=d*a.n11+n*a.n21+q*a.n31+o*a.n41;this.n22=d*a.n12+n*a.n22+q*a.n32+o*a.n42;this.n23=d*a.n13+n*a.n23+q*a.n33+o*a.n43;this.n24=d*a.n14+n*a.n24+q*a.n34+o*a.n44;this.n31=f*a.n11+h*a.n21+k*a.n31+i*a.n41; -this.n32=f*a.n12+h*a.n22+k*a.n32+i*a.n42;this.n33=f*a.n13+h*a.n23+k*a.n33+i*a.n43;this.n34=f*a.n14+h*a.n24+k*a.n34+i*a.n44;this.n41=m*a.n11+l*a.n21+s*a.n31+v*a.n41;this.n42=m*a.n12+l*a.n22+s*a.n32+v*a.n42;this.n43=m*a.n13+l*a.n23+s*a.n33+v*a.n43;this.n44=m*a.n14+l*a.n24+s*a.n34+v*a.n44},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*= -a},determinant:function(){return this.n14*this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*this.n42+this.n14*this.n22*this.n31*this.n43- -this.n12*this.n24*this.n31*this.n43-this.n14*this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(c,e,g){var b=c[e];c[e]=c[g];c[g]=b}a(this,"n21","n12");a(this,"n31","n13"); -a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){return[this.n11,this.n21,this.n31,this.n41,this.n12,this.n22,this.n32,this.n42,this.n13,this.n23,this.n33, -this.n43,this.n14,this.n24,this.n34,this.n44]},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,e){var g=new THREE.Matrix4;g.n14=a;g.n24=c;g.n34=e;return g};THREE.Matrix4.scaleMatrix=function(a,c,e){var g=new THREE.Matrix4;g.n11=a;g.n22=c;g.n33=e;return g}; +a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44},lookAt:function(a,c,d){var g=new THREE.Vector3,h=new THREE.Vector3,q=new THREE.Vector3;q.sub(a,c).normalize();g.cross(d,q).normalize();h.cross(q,g).normalize();this.n11=g.x;this.n12=g.y;this.n13=g.z;this.n14=-g.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a);this.n31=q.x;this.n32=q.y;this.n33=q.z;this.n34=-q.dot(a);this.n43=this.n42=this.n41=0;this.n44=1},transformVector3:function(a){var c=a.x,d=a.y,g=a.z;a.x=this.n11*c+this.n12* +d+this.n13*g+this.n14;a.y=this.n21*c+this.n22*d+this.n23*g+this.n24;a.z=this.n31*c+this.n32*d+this.n33*g+this.n34;a.multiplyScalar(1/(this.n41*c+this.n42*d+this.n43*g+this.n44));return a},transformVector4:function(a){var c=a.x,d=a.y,g=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*g+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23*g+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*g+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*g+this.n44*h;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11* +a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,g=a.n12,h=a.n13,q=a.n14,m=a.n21,b=a.n22,l=a.n23,y=a.n24,C=a.n31,E=a.n32,w=a.n33,D=a.n34,N=a.n41,J=a.n42,M=a.n43,t=a.n44,f=c.n11,e=c.n12,i=c.n13,o=c.n14,j=c.n21,k=c.n22,n=c.n23,s=c.n24,G=c.n31,r=c.n32,R=c.n33,x=c.n34,u=c.n41,U=c.n42,P=c.n43, +z=c.n44;this.n11=d*f+g*j+h*G+q*u;this.n12=d*e+g*k+h*r+q*U;this.n13=d*i+g*n+h*R+q*P;this.n14=d*o+g*s+h*x+q*z;this.n21=m*f+b*j+l*G+y*u;this.n22=m*e+b*k+l*r+y*U;this.n23=m*i+b*n+l*R+y*P;this.n24=m*o+b*s+l*x+y*z;this.n31=C*f+E*j+w*G+D*u;this.n32=C*e+E*k+w*r+D*U;this.n33=C*i+E*n+w*R+D*P;this.n34=C*o+E*s+w*x+D*z;this.n41=N*f+J*j+M*G+t*u;this.n42=N*e+J*k+M*r+t*U;this.n43=N*i+J*n+M*R+t*P;this.n44=N*o+J*s+M*x+t*z},multiplySelf:function(a){var c=this.n11,d=this.n12,g=this.n13,h=this.n14,q=this.n21,m=this.n22, +b=this.n23,l=this.n24,y=this.n31,C=this.n32,E=this.n33,w=this.n34,D=this.n41,N=this.n42,J=this.n43,M=this.n44;this.n11=c*a.n11+d*a.n21+g*a.n31+h*a.n41;this.n12=c*a.n12+d*a.n22+g*a.n32+h*a.n42;this.n13=c*a.n13+d*a.n23+g*a.n33+h*a.n43;this.n14=c*a.n14+d*a.n24+g*a.n34+h*a.n44;this.n21=q*a.n11+m*a.n21+b*a.n31+l*a.n41;this.n22=q*a.n12+m*a.n22+b*a.n32+l*a.n42;this.n23=q*a.n13+m*a.n23+b*a.n33+l*a.n43;this.n24=q*a.n14+m*a.n24+b*a.n34+l*a.n44;this.n31=y*a.n11+C*a.n21+E*a.n31+w*a.n41;this.n32=y*a.n12+C*a.n22+ +E*a.n32+w*a.n42;this.n33=y*a.n13+C*a.n23+E*a.n33+w*a.n43;this.n34=y*a.n14+C*a.n24+E*a.n34+w*a.n44;this.n41=D*a.n11+N*a.n21+J*a.n31+M*a.n41;this.n42=D*a.n12+N*a.n22+J*a.n32+M*a.n42;this.n43=D*a.n13+N*a.n23+J*a.n33+M*a.n43;this.n44=D*a.n14+N*a.n24+J*a.n34+M*a.n44},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a},determinant:function(){return this.n14* +this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14* +this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(c,d,g){var h=c[d];c[d]=c[g];c[g]=h}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this, +"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){return[this.n11,this.n21,this.n31,this.n41,this.n12,this.n22,this.n32,this.n42,this.n13,this.n23,this.n33,this.n43,this.n14,this.n24,this.n34,this.n44]}, +toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var g=new THREE.Matrix4;g.n14=a;g.n24=c;g.n34=d;return g};THREE.Matrix4.scaleMatrix=function(a,c,d){var g=new THREE.Matrix4;g.n11=a;g.n22=c;g.n33=d;return g}; THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.n22=c.n33=Math.cos(a);c.n32=Math.sin(a);c.n23=-c.n32;return c};THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.n11=c.n33=Math.cos(a);c.n13=Math.sin(a);c.n31=-c.n13;return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.n11=c.n22=Math.cos(a);c.n21=Math.sin(a);c.n12=-c.n21;return c}; -THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var e=new THREE.Matrix4,g=Math.cos(c),b=Math.sin(c),d=1-g,n=a.x,q=a.y,o=a.z;e.n11=d*n*n+g;e.n12=d*n*q-b*o;e.n13=d*n*o+b*q;e.n21=d*n*q+b*o;e.n22=d*q*q+g;e.n23=d*q*o-b*n;e.n31=d*n*o-b*q;e.n32=d*q*o+b*n;e.n33=d*o*o+g;return e}; +THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4,g=Math.cos(c),h=Math.sin(c),q=1-g,m=a.x,b=a.y,l=a.z;d.n11=q*m*m+g;d.n12=q*m*b-h*l;d.n13=q*m*l+h*b;d.n21=q*m*b+h*l;d.n22=q*b*b+g;d.n23=q*b*l-h*m;d.n31=q*m*l-h*b;d.n32=q*b*l+h*m;d.n33=q*l*l+g;return d}; THREE.Matrix4.makeInvert=function(a){var c=new THREE.Matrix4;c.n11=a.n23*a.n34*a.n42-a.n24*a.n33*a.n42+a.n24*a.n32*a.n43-a.n22*a.n34*a.n43-a.n23*a.n32*a.n44+a.n22*a.n33*a.n44;c.n12=a.n14*a.n33*a.n42-a.n13*a.n34*a.n42-a.n14*a.n32*a.n43+a.n12*a.n34*a.n43+a.n13*a.n32*a.n44-a.n12*a.n33*a.n44;c.n13=a.n13*a.n24*a.n42-a.n14*a.n23*a.n42+a.n14*a.n22*a.n43-a.n12*a.n24*a.n43-a.n13*a.n22*a.n44+a.n12*a.n23*a.n44;c.n14=a.n14*a.n23*a.n32-a.n13*a.n24*a.n32-a.n14*a.n22*a.n33+a.n12*a.n24*a.n33+a.n13*a.n22*a.n34-a.n12* a.n23*a.n34;c.n21=a.n24*a.n33*a.n41-a.n23*a.n34*a.n41-a.n24*a.n31*a.n43+a.n21*a.n34*a.n43+a.n23*a.n31*a.n44-a.n21*a.n33*a.n44;c.n22=a.n13*a.n34*a.n41-a.n14*a.n33*a.n41+a.n14*a.n31*a.n43-a.n11*a.n34*a.n43-a.n13*a.n31*a.n44+a.n11*a.n33*a.n44;c.n23=a.n14*a.n23*a.n41-a.n13*a.n24*a.n41-a.n14*a.n21*a.n43+a.n11*a.n24*a.n43+a.n13*a.n21*a.n44-a.n11*a.n23*a.n44;c.n24=a.n13*a.n24*a.n31-a.n14*a.n23*a.n31+a.n14*a.n21*a.n33-a.n11*a.n24*a.n33-a.n13*a.n21*a.n34+a.n11*a.n23*a.n34;c.n31=a.n22*a.n34*a.n41-a.n24*a.n32* a.n41+a.n24*a.n31*a.n42-a.n21*a.n34*a.n42-a.n22*a.n31*a.n44+a.n21*a.n32*a.n44;c.n32=a.n14*a.n32*a.n41-a.n12*a.n34*a.n41-a.n14*a.n31*a.n42+a.n11*a.n34*a.n42+a.n12*a.n31*a.n44-a.n11*a.n32*a.n44;c.n33=a.n13*a.n24*a.n41-a.n14*a.n22*a.n41+a.n14*a.n21*a.n42-a.n11*a.n24*a.n42-a.n12*a.n21*a.n44+a.n11*a.n22*a.n44;c.n34=a.n14*a.n22*a.n31-a.n12*a.n24*a.n31-a.n14*a.n21*a.n32+a.n11*a.n24*a.n32+a.n12*a.n21*a.n34-a.n11*a.n22*a.n34;c.n41=a.n23*a.n32*a.n41-a.n22*a.n33*a.n41-a.n23*a.n31*a.n42+a.n21*a.n33*a.n42+a.n22* a.n31*a.n43-a.n21*a.n32*a.n43;c.n42=a.n12*a.n33*a.n41-a.n13*a.n32*a.n41+a.n13*a.n31*a.n42-a.n11*a.n33*a.n42-a.n12*a.n31*a.n43+a.n11*a.n32*a.n43;c.n43=a.n13*a.n22*a.n41-a.n12*a.n23*a.n41-a.n13*a.n21*a.n42+a.n11*a.n23*a.n42+a.n12*a.n21*a.n43-a.n11*a.n22*a.n43;c.n44=a.n12*a.n23*a.n31-a.n13*a.n22*a.n31+a.n13*a.n21*a.n32-a.n11*a.n23*a.n32-a.n12*a.n21*a.n33+a.n11*a.n22*a.n33;c.multiplyScalar(1/a.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=new THREE.Matrix3;var e=c[10]*c[5]-c[6]*c[9],g=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],d=-c[10]*c[4]+c[6]*c[8],n=c[10]*c[0]-c[2]*c[8],q=-c[6]*c[0]+c[2]*c[4],o=c[9]*c[4]-c[5]*c[8],f=-c[9]*c[0]+c[1]*c[8],h=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*d+c[2]*o;if(c==0)throw"matrix not invertible";c=1/c;a.m[0]=c*e;a.m[1]=c*g;a.m[2]=c*b;a.m[3]=c*d;a.m[4]=c*n;a.m[5]=c*q;a.m[6]=c*o;a.m[7]=c*f;a.m[8]=c*h;return a}; -THREE.Matrix4.makeFrustum=function(a,c,e,g,b,d){var n,q,o;n=new THREE.Matrix4;q=2*b/(c-a);o=2*b/(g-e);a=(c+a)/(c-a);e=(g+e)/(g-e);g=-(d+b)/(d-b);b=-2*d*b/(d-b);n.n11=q;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=o;n.n23=e;n.n24=0;n.n31=0;n.n32=0;n.n33=g;n.n34=b;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,c,e,g){var b;a=e*Math.tan(a*Math.PI/360);b=-a;return THREE.Matrix4.makeFrustum(b*c,a*c,b,a,e,g)}; -THREE.Matrix4.makeOrtho=function(a,c,e,g,b,d){var n,q,o,f;n=new THREE.Matrix4;q=c-a;o=e-g;f=d-b;a=(c+a)/q;e=(e+g)/o;b=(d+b)/f;n.n11=2/q;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/o;n.n23=0;n.n24=-e;n.n31=0;n.n32=0;n.n33=-2/f;n.n34=-b;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=new THREE.Matrix3;var d=c[10]*c[5]-c[6]*c[9],g=-c[10]*c[1]+c[2]*c[9],h=c[6]*c[1]-c[2]*c[5],q=-c[10]*c[4]+c[6]*c[8],m=c[10]*c[0]-c[2]*c[8],b=-c[6]*c[0]+c[2]*c[4],l=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],C=c[5]*c[0]-c[1]*c[4];c=c[0]*d+c[1]*q+c[2]*l;if(c==0)throw"matrix not invertible";c=1/c;a.m[0]=c*d;a.m[1]=c*g;a.m[2]=c*h;a.m[3]=c*q;a.m[4]=c*m;a.m[5]=c*b;a.m[6]=c*l;a.m[7]=c*y;a.m[8]=c*C;return a}; +THREE.Matrix4.makeFrustum=function(a,c,d,g,h,q){var m,b,l;m=new THREE.Matrix4;b=2*h/(c-a);l=2*h/(g-d);a=(c+a)/(c-a);d=(g+d)/(g-d);g=-(q+h)/(q-h);h=-2*q*h/(q-h);m.n11=b;m.n12=0;m.n13=a;m.n14=0;m.n21=0;m.n22=l;m.n23=d;m.n24=0;m.n31=0;m.n32=0;m.n33=g;m.n34=h;m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(a,c,d,g){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,g)}; +THREE.Matrix4.makeOrtho=function(a,c,d,g,h,q){var m,b,l,y;m=new THREE.Matrix4;b=c-a;l=d-g;y=q-h;a=(c+a)/b;d=(d+g)/l;h=(q+h)/y;m.n11=2/b;m.n12=0;m.n13=0;m.n14=-a;m.n21=0;m.n22=2/l;m.n23=0;m.n24=-d;m.n31=0;m.n32=0;m.n33=-2/y;m.n34=-h;m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m}; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,c,e,g,b){this.a=a;this.b=c;this.c=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.material=b instanceof Array?b:[b]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,c,e,g,b,d){this.a=a;this.b=c;this.c=e;this.d=g;this.centroid=new THREE.Vector3;this.normal=b instanceof THREE.Vector3?b:new THREE.Vector3;this.vertexNormals=b instanceof Array?b:[];this.material=d instanceof Array?d:[d]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; +THREE.Face3=function(a,c,d,g,h){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.material=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,c,d,g,h,q){this.a=a;this.b=c;this.c=d;this.d=g;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.material=q instanceof Array?q:[q]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[]}; -THREE.Geometry.prototype={computeCentroids:function(){var a,c,e;a=0;for(c=this.faces.length;a +THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a 0){this.bbox={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 a=1,c=this.vertices.length;athis.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.y this.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.zthis.bbox.z[1])this.bbox.z[1]=vertex.position.z}}},toString:function(){return"THREE.Geometry ( vertices: "+this.vertices+", faces: "+this.faces+" )"}}; -THREE.Camera=function(a,c,e,g){this.position=new THREE.Vector3(0,0,0);this.target={position:new THREE.Vector3(0,0,0)};this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4;this.projectionMatrix=THREE.Matrix4.makePerspective(a,c,e,g);this.autoUpdateMatrix=true;this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.toString=function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)}; +THREE.Camera=function(a,c,d,g){this.position=new THREE.Vector3(0,0,0);this.target={position:new THREE.Vector3(0,0,0)};this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4;this.projectionMatrix=THREE.Matrix4.makePerspective(a,c,d,g);this.autoUpdateMatrix=true;this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.toString=function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)}; THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight; THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.translationMatrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.scaleMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.autoUpdateMatrix=this.visible=true;this.updateMatrix=function(){this.matrixPosition=THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z);this.rotationMatrix=THREE.Matrix4.rotationXMatrix(this.rotation.x); this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.scaleMatrix=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);this.matrix.multiplySelf(this.rotationMatrix);this.matrix.multiplySelf(this.scaleMatrix)}};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a instanceof Array?a:[a];this.autoUpdateMatrix=false}; THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.material=c instanceof Array?c:[c]};THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line; -THREE.Mesh=function(a,c,e){THREE.Object3D.call(this);this.geometry=a;this.material=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.materialFaceGroup={};this.sortFacesByMaterial();e&&this.normalizeUVs();this.geometry.computeBoundingBox()};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh; -THREE.Mesh.prototype.sortFacesByMaterial=function(){function a(h){var k=[];c=0;for(e=h.length;c65535){f[q].counter+=1;o=f[q].hash+"_"+f[q].counter;if(this.materialFaceGroup[o]==undefined)this.materialFaceGroup[o]={faces:[],material:n,vertices:0}}this.materialFaceGroup[o].faces.push(g);this.materialFaceGroup[o].vertices+=d}};THREE.Mesh.prototype.normalizeUVs=function(){var a,c,e,g,b;a=0;for(c=this.geometry.uvs.length;a65535){y[b].counter+=1;l=y[b].hash+"_"+y[b].counter;if(this.materialFaceGroup[l]==undefined)this.materialFaceGroup[l]={faces:[],material:m,vertices:0}}this.materialFaceGroup[l].faces.push(g);this.materialFaceGroup[l].vertices+=q}};THREE.Mesh.prototype.normalizeUVs=function(){var a,c,d,g,h;a=0;for(c=this.geometry.uvs.length;acolor: "+ this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
linewidth: "+this.linewidth+"
linecap: "+this.linecap+"
linejoin: "+this.linejoin+"
)"}}; @@ -74,90 +74,94 @@ this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wiref THREE.MeshDepthMaterial=function(a){this.near=1;this.far=1E3;this.opacity=1;this.blending=THREE.NormalBlending;if(a){if(a.near!==undefined)this.near=a.near;if(a.far!==undefined)this.far=a.far;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.__2near=2*this.near;this.__farPlusNear=this.far+this.near;this.__farMinusNear=this.far-this.near;this.toString=function(){return"THREE.MeshDepthMaterial"}}; THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){this.toString=function(){return"THREE.MeshFaceMaterial"}}; THREE.MeshCubeMaterial=function(a){this.id=THREE.MeshCubeMaterial.value++;this.env_map=null;this.blending=THREE.NormalBlending;if(a)if(a.env_map!==undefined)this.env_map=a.env_map;this.toString=function(){return"THREE.MeshCubeMaterial( id: "+this.id+"
env_map: "+this.env_map+" )"}};THREE.MeshCubeMaterialCounter={value:0}; +THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!==undefined)this.uniforms= +a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshShaderMaterial (
id: "+this.id+"
blending: "+ +this.blending+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
)"}};THREE.MeshShaderMaterialCounter={value:0}; THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16711680);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
blending: "+ this.blending+"
)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16711680);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; -THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,e,g){this.image=a;this.loaded=false;this.mapping=c!==undefined?c:THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdge;this.wrap_t=g!==undefined?g:THREE.ClampToEdge;this.toString=function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
)"}}; -THREE.UVMapping=0;THREE.ReflectionMap=1;THREE.RefractionMap=2;THREE.Multiply=0;THREE.Mix=1;THREE.Repeat=0;THREE.ClampToEdge=1;THREE.MirroredRepeat=2;THREE.TextureCube=function(a,c){this.image=a;this.mapping=c?c:THREE.ReflectionMap;this.toString=function(){return"THREE.TextureCube (
image: "+this.image+"
mapping: "+this.mapping+"
)"}}; +THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,g){this.image=a;this.loaded=false;this.mapping=c!==undefined?c:THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdge;this.wrap_t=g!==undefined?g:THREE.ClampToEdge;this.toString=function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
)"}}; +THREE.UVMapping=0;THREE.ReflectionMapping=1;THREE.RefractionMapping=2;THREE.Multiply=0;THREE.Mix=1;THREE.Repeat=0;THREE.ClampToEdge=1;THREE.MirroredRepeat=2;THREE.TextureCube=function(a,c){this.image=a;this.mapping=c?c:THREE.ReflectionMap;this.toString=function(){return"THREE.TextureCube (
image: "+this.image+"
mapping: "+this.mapping+"
)"}}; THREE.Scene=function(){this.objects=[];this.lights=[];this.addObject=function(a){this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}}; -THREE.Projector=function(){function a(L,u){var w=0,H=1,A=L.z+L.w,I=u.z+u.w,p=-L.z+L.w,x=-u.z+u.w;if(A>=0&&I>=0&&p>=0&&x>=0)return true;else if(A<0&&I<0||p<0&&x<0)return false;else{if(A<0)w=Math.max(w,A/(A-I));else if(I<0)H=Math.min(H,A/(A-I));if(p<0)w=Math.max(w,p/(p-x));else if(x<0)H=Math.min(H,p/(p-x));if(H0&&r.z<1}Q=C.geometry.faces;A=0;for(I=Q.length;A0&&i.z<1){f=k[h]=k[h]||new THREE.RenderableParticle;f.x=i.x/i.w;f.y=i.y/i.w;f.z=i.z;f.rotation=C.rotation.z;f.scale.x=C.scale.x*Math.abs(f.x-(i.x+u.projectionMatrix.n11)/(i.w+u.projectionMatrix.n14));f.scale.y=C.scale.y*Math.abs(f.y-(i.y+u.projectionMatrix.n22)/(i.w+u.projectionMatrix.n24));f.material=C.material;c.push(f);h++}}}c.sort(function(U,z){return z.z-U.z});return c};this.unprojectVector=function(L,u){var w=new THREE.Matrix4;w.multiply(THREE.Matrix4.makeInvert(u.matrix),THREE.Matrix4.makeInvert(u.projectionMatrix)); -w.transform(L);return L}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,e,g,b,d;this.domElement=document.createElement("div");this.setSize=function(n,q){e=n;g=q;b=e/2;d=g/2};this.render=function(n,q){var o,f,h,k,i,m,l,s;a=c.projectScene(n,q);o=0;for(f=a.length;o0){B.r+=W.r*F;B.g+=W.g*F;B.b+=W.b*F}}else if(F instanceof THREE.PointLight){ra.sub(F.position,T);ra.normalize();F=P.dot(ra)*N;if(F>0){B.r+=W.r*F;B.g+=W.g*F;B.b+=W.b*F}}}}function c(D,T,P,B,t,F){if(t.opacity!=0){d(t.opacity);n(t.blending);Y=D.positionScreen.x;C=D.positionScreen.y;Z=T.positionScreen.x; -O=T.positionScreen.y;aa=P.positionScreen.x;ca=P.positionScreen.y;var W=Y,N=C,S=Z,X=O,V=aa,ba=ca;j.beginPath();j.moveTo(W,N);j.lineTo(S,X);j.lineTo(V,ba);j.lineTo(W,N);j.closePath();if(t instanceof THREE.MeshBasicMaterial)if(t.map)b(Y,C,Z,O,aa,ca,t.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else t.wireframe?e(t.color.__styleString,t.wireframe_linewidth):g(t.color.__styleString);else if(t instanceof THREE.MeshLambertMaterial){if(t.map&&!t.wireframe){b(Y,C,Z,O,aa,ca, -t.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);n(THREE.SubtractiveBlending)}if(da)if(t.shading==THREE.SmoothShading&&!t.wireframe){Q.r=r.r=E.r=ea.r;Q.g=r.g=E.g=ea.g;Q.b=r.b=E.b=ea.b;a(F,B.v1.positionWorld,B.vertexNormalsWorld[0],Q);a(F,B.v2.positionWorld,B.vertexNormalsWorld[1],r);a(F,B.v3.positionWorld,B.vertexNormalsWorld[2],E);K.r=(r.r+E.r)*0.5;K.g=(r.g+E.g)*0.5;K.b=(r.b+E.b)*0.5;R=q(Q,r,E,K);b(Y,C,Z,O,aa,ca,R,0,0,1,0,0,1)}else{fa.r=ea.r;fa.g=ea.g;fa.b=ea.b;a(F, -B.centroidWorld,B.normalWorld,fa);M.r=t.color.r*fa.r;M.g=t.color.g*fa.g;M.b=t.color.b*fa.b;M.updateStyleString();t.wireframe?e(M.__styleString,t.wireframe_linewidth):g(M.__styleString)}else t.wireframe?e(t.color.__styleString,t.wireframe_linewidth):g(t.color.__styleString)}else if(t instanceof THREE.MeshDepthMaterial){U=t.__2near;z=t.__farPlusNear;y=t.__farMinusNear;Q.r=Q.g=Q.b=1-U/(z-D.positionScreen.z*y);r.r=r.g=r.b=1-U/(z-T.positionScreen.z*y);E.r=E.g=E.b=1-U/(z-P.positionScreen.z*y);K.r=(r.r+ -E.r)*0.5;K.g=(r.g+E.g)*0.5;K.b=(r.b+E.b)*0.5;R=q(Q,r,E,K);b(Y,C,Z,O,aa,ca,R,0,0,1,0,0,1)}else if(t instanceof THREE.MeshNormalMaterial){M.r=o(B.normalWorld.x);M.g=o(B.normalWorld.y);M.b=o(B.normalWorld.z);M.updateStyleString();t.wireframe?e(M.__styleString,t.wireframe_linewidth):g(M.__styleString)}}}function e(D,T){if(w!=D)j.strokeStyle=w=D;if(A!=T)j.lineWidth=A=T;j.stroke()}function g(D){if(H!=D)j.fillStyle=H=D;j.fill()}function b(D,T,P,B,t,F,W,N,S,X,V,ba,ja){var ia=W.width-1,ga=W.height-1;N*=ia; -S*=ga;X*=ia;V*=ga;ba*=ia;ja*=ga;P-=D;B-=T;t-=D;F-=T;X-=N;V-=S;ba-=N;ja-=S;ga=1/(X*ja-ba*V);ia=(ja*P-V*t)*ga;V=(ja*B-V*F)*ga;P=(X*t-ba*P)*ga;B=(X*F-ba*B)*ga;D=D-ia*N-P*S;T=T-V*N-B*S;j.save();j.transform(ia,V,P,B,D,T);j.clip();j.drawImage(W,0,0);j.restore()}function d(D){if(L!=D)j.globalAlpha=L=D}function n(D){if(u!=D){switch(D){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation= -"darker"}u=D}}function q(D,T,P,B){ha[0]=~~(D.r*255);ha[1]=~~(D.g*255);ha[2]=~~(D.b*255);ha[4]=~~(T.r*255);ha[5]=~~(T.g*255);ha[6]=~~(T.b*255);ha[8]=~~(P.r*255);ha[9]=~~(P.g*255);ha[10]=~~(P.b*255);ha[12]=~~(B.r*255);ha[13]=~~(B.g*255);ha[14]=~~(B.b*255);na.putImageData(sa,0,0);qa.drawImage(oa,0,0);return pa}function o(D){return D<0?Math.min((1+D)*0.5,0.5):0.5+Math.min(D*0.5,0.5)}function f(D,T){var P=T.x-D.x,B=T.y-D.y,t=1/Math.sqrt(P*P+B*B);P*=t;B*=t;T.x+=P;T.y+=B;D.x-=P;D.y-=B}var h=null,k=new THREE.Projector, -i=document.createElement("canvas"),m,l,s,v,j=i.getContext("2d"),L=1,u=0,w=null,H=null,A=1,I,p,x,Y,C,Z,O,aa,ca,M=new THREE.Color,Q=new THREE.Color,r=new THREE.Color,E=new THREE.Color,K=new THREE.Color,U,z,y,R,$=new THREE.Rectangle,G=new THREE.Rectangle,J=new THREE.Rectangle,da=false,fa=new THREE.Color,ea=new THREE.Color,ka=new THREE.Color,la=new THREE.Color,va=Math.PI*2,ra=new THREE.Vector3;new THREE.UV;new THREE.UV;new THREE.UV;new THREE.UV;var oa,na,sa,ha,pa,qa,ma=16;oa=document.createElement("canvas"); -oa.width=oa.height=2;na=oa.getContext("2d");na.fillStyle="rgba(0,0,0,1)";na.fillRect(0,0,2,2);sa=na.getImageData(0,0,2,2);ha=sa.data;pa=document.createElement("canvas");pa.width=pa.height=ma;qa=pa.getContext("2d");qa.translate(-ma/2,-ma/2);qa.scale(ma,ma);ma--;this.domElement=i;this.autoClear=true;this.setSize=function(D,T){m=D;l=T;s=m/2;v=l/2;i.width=m;i.height=l;$.set(-s,-v,s,v)};this.clear=function(){if(!G.isEmpty()){G.inflate(1);G.minSelf($);j.clearRect(G.getX(),G.getY(),G.getWidth(),G.getHeight()); -G.empty()}};this.render=function(D,T){var P,B,t,F,W,N,S,X;j.setTransform(1,0,0,-1,s,v);this.autoClear&&this.clear();h=k.projectScene(D,T);if(da=D.lights.length>0){W=D.lights;ea.setRGB(0,0,0);ka.setRGB(0,0,0);la.setRGB(0,0,0);P=0;for(B=W.length;P>1;ua=ga.height>>1;ja=S.scale.x*s;ia=S.scale.y*v;X=ja*ta;ba=ia*ua;J.set(N.x-X,N.y-ba,N.x+X,N.y+ba);if($.instersects(J)){j.save();j.translate(N.x,N.y);j.rotate(-S.rotation); -j.scale(ja,-ia);j.translate(-ta,-ua);j.drawImage(ga,0,0);j.restore()}}}else if(V instanceof THREE.ParticleCircleMaterial){if(da){fa.r=ea.r+ka.r+la.r;fa.g=ea.g+ka.g+la.g;fa.b=ea.b+ka.b+la.b;M.r=V.color.r*fa.r;M.g=V.color.g*fa.g;M.b=V.color.b*fa.b;M.updateStyleString()}else M.__styleString=V.color.__styleString;X=S.scale.x*s;ba=S.scale.y*v;J.set(N.x-X,N.y-ba,N.x+X,N.y+ba);if($.instersects(J)){V=M.__styleString;if(H!=V)j.fillStyle=H=V;j.save();j.translate(N.x,N.y);j.rotate(-S.rotation);j.scale(X,ba); -j.beginPath();j.arc(0,0,1,0,va,true);j.closePath();j.fill();j.restore()}}}}}else if(t instanceof THREE.RenderableLine){I=t.v1;p=t.v2;I.positionScreen.x*=s;I.positionScreen.y*=v;p.positionScreen.x*=s;p.positionScreen.y*=v;J.addPoint(I.positionScreen.x,I.positionScreen.y);J.addPoint(p.positionScreen.x,p.positionScreen.y);if($.instersects(J)){F=0;for(W=t.material.length;F0){K.r+=y.color.r*R;K.g+=y.color.g*R;K.b+=y.color.b*R}}else if(y instanceof THREE.PointLight){x.sub(y.position,E.centroidWorld);x.normalize();R=E.normalWorld.dot(x)*y.intensity;if(R>0){K.r+=y.color.r*R;K.g+=y.color.g*R;K.b+=y.color.b*R}}}}function c(r,E,K,U,z,y){O=g(aa++);O.setAttribute("d","M "+r.positionScreen.x+ -" "+r.positionScreen.y+" L "+E.positionScreen.x+" "+E.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+"z");if(z instanceof THREE.MeshBasicMaterial)u.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshLambertMaterial)if(L){w.r=H.r;w.g=H.g;w.b=H.b;a(y,U,w);u.r=z.color.r*w.r;u.g=z.color.g*w.g;u.b=z.color.b*w.b;u.updateStyleString()}else u.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshDepthMaterial){p=1-z.__2near/(z.__farPlusNear-U.z*z.__farMinusNear); -u.setRGB(p,p,p)}else z instanceof THREE.MeshNormalMaterial&&u.setRGB(b(U.normalWorld.x),b(U.normalWorld.y),b(U.normalWorld.z));z.wireframe?O.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+z.wireframe_linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframe_linecap+"; stroke-linejoin: "+z.wireframe_linejoin):O.setAttribute("style","fill: "+u.__styleString+"; fill-opacity: "+z.opacity);q.appendChild(O)}function e(r,E,K,U,z,y,R){O=g(aa++);O.setAttribute("d", -"M "+r.positionScreen.x+" "+r.positionScreen.y+" L "+E.positionScreen.x+" "+E.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+" L "+U.positionScreen.x+","+U.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)u.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(L){w.r=H.r;w.g=H.g;w.b=H.b;a(R,z,w);u.r=y.color.r*w.r;u.g=y.color.g*w.g;u.b=y.color.b*w.b;u.updateStyleString()}else u.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshDepthMaterial){p= -1-y.__2near/(y.__farPlusNear-z.z*y.__farMinusNear);u.setRGB(p,p,p)}else y instanceof THREE.MeshNormalMaterial&&u.setRGB(b(z.normalWorld.x),b(z.normalWorld.y),b(z.normalWorld.z));y.wireframe?O.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+y.wireframe_linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframe_linecap+"; stroke-linejoin: "+y.wireframe_linejoin):O.setAttribute("style","fill: "+u.__styleString+"; fill-opacity: "+y.opacity);q.appendChild(O)} -function g(r){if(Y[r]==null){Y[r]=document.createElementNS("http://www.w3.org/2000/svg","path");Q==0&&Y[r].setAttribute("shape-rendering","crispEdges");return Y[r]}return Y[r]}function b(r){return r<0?Math.min((1+r)*0.5,0.5):0.5+Math.min(r*0.5,0.5)}var d=null,n=new THREE.Projector,q=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,f,h,k,i,m,l,s,v=new THREE.Rectangle,j=new THREE.Rectangle,L=false,u=new THREE.Color(16777215),w=new THREE.Color(16777215),H=new THREE.Color(0),A=new THREE.Color(0), -I=new THREE.Color(0),p,x=new THREE.Vector3,Y=[],C=[],Z=[],O,aa,ca,M,Q=1;this.domElement=q;this.autoClear=true;this.setQuality=function(r){switch(r){case "high":Q=1;break;case "low":Q=0}};this.setSize=function(r,E){o=r;f=E;h=o/2;k=f/2;q.setAttribute("viewBox",-h+" "+-k+" "+o+" "+f);q.setAttribute("width",o);q.setAttribute("height",f);v.set(-h,-k,h,k)};this.clear=function(){for(;q.childNodes.length>0;)q.removeChild(q.childNodes[0])};this.render=function(r,E){var K,U,z,y,R,$,G,J;this.autoClear&&this.clear(); -d=n.projectScene(r,E);M=ca=aa=0;if(L=r.lights.length>0){G=r.lights;H.setRGB(0,0,0);A.setRGB(0,0,0);I.setRGB(0,0,0);K=0;for(U=G.length;K= 0.0 )": -"",h?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",h?"pointDiffuse += mColor * pointDiffuseWeight;":"",h?"pointSpecular += mSpecular * pointSpecularWeight;":"",h?"}":"",f?"vec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );":"",f?"vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",f?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",f?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",f?"vec3 dirVector = normalize( lDirection.xyz );":"",f?"vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );": -"",f?"float dirDotNormalHalf = dot( normal, dirHalfVector );":"",f?"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );":"",f?"float dirSpecularWeight = 0.0;":"",f?"if ( dirDotNormalHalf >= 0.0 )":"",f?"dirSpecularWeight = pow( dirDotNormalHalf, mShininess );":"",f?"dirDiffuse += mColor * dirDiffuseWeight;":"",f?"dirSpecular += mSpecular * dirSpecularWeight;":"",f?"}":"","vec4 totalLight = mAmbient;",f?"totalLight += dirDiffuse + dirSpecular;":"",h?"totalLight += pointDiffuse + pointSpecular;": -"","if ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mapColor.rgb * totalLight.xyz * vLightWeighting, cubeColor.rgb, mReflectivity ), mapColor.a );\n} else {\ngl_FragColor = vec4( mapColor.rgb * cubeColor.rgb * totalLight.xyz * vLightWeighting, mapColor.a );\n}\n} else if ( material == 1 ) {\nif ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mColor.rgb * mapColor.rgb * vLightWeighting, cubeColor.rgb, mReflectivity ), mColor.a * mapColor.a );\n} else {\ngl_FragColor = vec4( mColor.rgb * mapColor.rgb * cubeColor.rgb * vLightWeighting, mColor.a * mapColor.a );\n}\n} else {\nif ( mixEnvMap ) {\ngl_FragColor = mix( mColor * mapColor, cubeColor, mReflectivity );\n} else {\ngl_FragColor = mColor * mapColor * cubeColor;\n}\n}\n}"].join("\n"))); -b.attachShader(d,c("vertex",[f?"#define MAX_DIR_LIGHTS "+f:"",h?"#define MAX_POINT_LIGHTS "+h:"","attribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nuniform vec3 cameraPosition;\nuniform bool enableLighting;\nuniform bool useRefract;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;\nuniform vec3 ambientLightColor;",f?"uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];":"",f?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"",h?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];": -"",h?"uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];":"","uniform mat4 objMatrix;\nuniform mat4 viewMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat3 normalMatrix;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",h?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform float mRefractionRatio;\nvoid main(void) {\nvec4 mPosition = objMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 nWorld = mat3( objMatrix[0].xyz, objMatrix[1].xyz, objMatrix[2].xyz ) * normal;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec3 transformedNormal = normalize( normalMatrix * normal );\nif ( !enableLighting ) {\nvLightWeighting = vec3( 1.0, 1.0, 1.0 );\n} else {\nvLightWeighting = ambientLightColor;", -f?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",f?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",f?"float directionalLightWeighting = max( dot( transformedNormal, normalize(lDirection.xyz ) ), 0.0 );":"",f?"vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;":"",f?"}":"",h?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",h?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",h?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );": -"",h?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",h?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",h?"}":"","}\nvNormal = transformedNormal;\nvUv = uv;\nif ( useRefract ) {\nvReflect = refract( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz), mRefractionRatio );\n} else {\nvReflect = reflect( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz) );\n}\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n"))); -b.linkProgram(d);if(!b.getProgramParameter(d,b.LINK_STATUS)){alert("Could not initialise shaders");alert("VALIDATE_STATUS: "+b.getProgramParameter(d,b.VALIDATE_STATUS));alert(b.getError())}b.useProgram(d);d.viewMatrix=b.getUniformLocation(d,"viewMatrix");d.modelViewMatrix=b.getUniformLocation(d,"modelViewMatrix");d.projectionMatrix=b.getUniformLocation(d,"projectionMatrix");d.normalMatrix=b.getUniformLocation(d,"normalMatrix");d.objMatrix=b.getUniformLocation(d,"objMatrix");d.cameraPosition=b.getUniformLocation(d, -"cameraPosition");d.enableLighting=b.getUniformLocation(d,"enableLighting");d.ambientLightColor=b.getUniformLocation(d,"ambientLightColor");if(f){d.directionalLightNumber=b.getUniformLocation(d,"directionalLightNumber");d.directionalLightColor=b.getUniformLocation(d,"directionalLightColor");d.directionalLightDirection=b.getUniformLocation(d,"directionalLightDirection")}if(h){d.pointLightNumber=b.getUniformLocation(d,"pointLightNumber");d.pointLightColor=b.getUniformLocation(d,"pointLightColor");d.pointLightPosition= -b.getUniformLocation(d,"pointLightPosition")}d.material=b.getUniformLocation(d,"material");d.mColor=b.getUniformLocation(d,"mColor");d.mOpacity=b.getUniformLocation(d,"mOpacity");d.mReflectivity=b.getUniformLocation(d,"mReflectivity");d.mAmbient=b.getUniformLocation(d,"mAmbient");d.mSpecular=b.getUniformLocation(d,"mSpecular");d.mShininess=b.getUniformLocation(d,"mShininess");d.enableMap=b.getUniformLocation(d,"enableMap");b.uniform1i(d.enableMap,0);d.tMap=b.getUniformLocation(d,"tMap");b.uniform1i(d.tMap, -0);d.enableCubeMap=b.getUniformLocation(d,"enableCubeMap");b.uniform1i(d.enableCubeMap,0);d.tCube=b.getUniformLocation(d,"tCube");b.uniform1i(d.tCube,1);d.mixEnvMap=b.getUniformLocation(d,"mixEnvMap");b.uniform1i(d.mixEnvMap,0);d.mRefractionRatio=b.getUniformLocation(d,"mRefractionRatio");d.useRefract=b.getUniformLocation(d,"useRefract");b.uniform1i(d.useRefract,0);d.m2Near=b.getUniformLocation(d,"m2Near");d.mFarPlusNear=b.getUniformLocation(d,"mFarPlusNear");d.mFarMinusNear=b.getUniformLocation(d, -"mFarMinusNear");d.position=b.getAttribLocation(d,"position");b.enableVertexAttribArray(d.position);d.normal=b.getAttribLocation(d,"normal");b.enableVertexAttribArray(d.normal);d.uv=b.getAttribLocation(d,"uv");b.enableVertexAttribArray(d.uv);d.viewMatrixArray=new Float32Array(16);d.modelViewMatrixArray=new Float32Array(16);d.projectionMatrixArray=new Float32Array(16)})(a.directional,a.point);this.setSize=function(f,h){g.width=f;g.height=h;b.viewport(0,0,g.width,g.height)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT| -b.DEPTH_BUFFER_BIT)};this.setupLights=function(f){var h,k,i,m,l=[],s=[],v=[];m=[];var j=[];b.uniform1i(d.enableLighting,f.lights.length);h=0;for(k=f.lights.length;h=0;k--){i=f.__webGLObjects[k].__object;h==i&&f.__webGLObjects.splice(k,1)}};this.setupMatrices=function(f, -h){f.autoUpdateMatrix&&f.updateMatrix();n.multiply(h.matrix,f.matrix);d.viewMatrixArray=new Float32Array(h.matrix.flatten());d.modelViewMatrixArray=new Float32Array(n.flatten());d.projectionMatrixArray=new Float32Array(h.projectionMatrix.flatten());q=THREE.Matrix4.makeInvert3x3(n).transpose();d.normalMatrixArray=new Float32Array(q.m);b.uniformMatrix4fv(d.viewMatrix,false,d.viewMatrixArray);b.uniformMatrix4fv(d.modelViewMatrix,false,d.modelViewMatrixArray);b.uniformMatrix4fv(d.projectionMatrix,false, -d.projectionMatrixArray);b.uniformMatrix3fv(d.normalMatrix,false,d.normalMatrixArray);b.uniformMatrix4fv(d.objMatrix,false,new Float32Array(f.matrix.flatten()))};this.setBlending=function(f){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(f,h){if(f){!h||h=="ccw"?b.frontFace(b.CCW): -b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK);else f=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)}}; -THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.meshMaterial=null;this.overdraw=false;this.uvs=[null,null,null]}; -THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.material=null}; \ No newline at end of file +THREE.Projector=function(){function a(f,e){var i=0,o=1,j=f.z+f.w,k=e.z+e.w,n=-f.z+f.w,s=-e.z+e.w;if(j>=0&&k>=0&&n>=0&&s>=0)return true;else if(j<0&&k<0||n<0&&s<0)return false;else{if(j<0)i=Math.max(i,j/(j-k));else if(k<0)o=Math.min(o,j/(j-k));if(n<0)i=Math.max(i,n/(n-s));else if(s<0)o=Math.min(o,n/(n-s));if(o0&&p.z<1}z=r.geometry.faces;j=0;for(k=z.length;j0&&w.z<1){y=E[C]=E[C]||new THREE.RenderableParticle;y.x=w.x/w.w;y.y=w.y/w.w;y.z=w.z;y.rotation=r.rotation.z;y.scale.x=r.scale.x*Math.abs(y.x-(w.x+e.projectionMatrix.n11)/(w.w+e.projectionMatrix.n14));y.scale.y=r.scale.y*Math.abs(y.y-(w.y+e.projectionMatrix.n22)/(w.w+e.projectionMatrix.n24));y.material=r.material;c.push(y);C++}}}c.sort(function(S,B){return B.z-S.z});return c};this.unprojectVector=function(f,e){var i=new THREE.Matrix4; +i.multiply(THREE.Matrix4.makeInvert(e.matrix),THREE.Matrix4.makeInvert(e.projectionMatrix));i.transformVector3(f);return f}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,g,h,q;this.domElement=document.createElement("div");this.setSize=function(m,b){d=m;g=b;h=d/2;q=g/2};this.render=function(m,b){var l,y,C,E,w,D,N,J;a=c.projectScene(m,b);l=0;for(y=a.length;l0){F.r+=$.r*L;F.g+=$.g*L;F.b+=$.b*L}}else if(L instanceof THREE.PointLight){sa.sub(L.position,Y);sa.normalize();L=V.dot(sa)*Q;if(L>0){F.r+=$.r*L;F.g+=$.g*L;F.b+=$.b*L}}}}function c(I,Y,V,F,v,L){if(v.opacity!=0){q(v.opacity);m(v.blending);R=I.positionScreen.x;x=I.positionScreen.y;u=Y.positionScreen.x; +U=Y.positionScreen.y;P=V.positionScreen.x;z=V.positionScreen.y;var $=R,Q=x,X=u,aa=U,Z=P,ca=z;t.beginPath();t.moveTo($,Q);t.lineTo(X,aa);t.lineTo(Z,ca);t.lineTo($,Q);t.closePath();if(v instanceof THREE.MeshBasicMaterial)if(v.map)h(R,x,u,U,P,z,v.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);else v.wireframe?d(v.color.__styleString,v.wireframe_linewidth):g(v.color.__styleString);else if(v instanceof THREE.MeshLambertMaterial){if(v.map&&!v.wireframe){h(R,x,u,U,P,z,v.map.image, +F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);m(THREE.SubtractiveBlending)}if(ta)if(!v.wireframe&&v.shading==THREE.SmoothShading&&F.vertexNormalsWorld.length==3){K.r=H.r=S.r=ga.r;K.g=H.g=S.g=ga.g;K.b=H.b=S.b=ga.b;a(L,F.v1.positionWorld,F.vertexNormalsWorld[0],K);a(L,F.v2.positionWorld,F.vertexNormalsWorld[1],H);a(L,F.v3.positionWorld,F.vertexNormalsWorld[2],S);B.r=(H.r+S.r)*0.5;B.g=(H.g+S.g)*0.5;B.b=(H.b+S.b)*0.5;O=b(K,H,S,B);h(R,x,u,U,P,z,O,0,0,1,0,0,1)}else{ha.r=ga.r;ha.g=ga.g; +ha.b=ga.b;a(L,F.centroidWorld,F.normalWorld,ha);p.r=v.color.r*ha.r;p.g=v.color.g*ha.g;p.b=v.color.b*ha.b;p.updateStyleString();v.wireframe?d(p.__styleString,v.wireframe_linewidth):g(p.__styleString)}else v.wireframe?d(v.color.__styleString,v.wireframe_linewidth):g(v.color.__styleString)}else if(v instanceof THREE.MeshDepthMaterial){A=v.__2near;W=v.__farPlusNear;ea=v.__farMinusNear;K.r=K.g=K.b=1-A/(W-I.positionScreen.z*ea);H.r=H.g=H.b=1-A/(W-Y.positionScreen.z*ea);S.r=S.g=S.b=1-A/(W-V.positionScreen.z* +ea);B.r=(H.r+S.r)*0.5;B.g=(H.g+S.g)*0.5;B.b=(H.b+S.b)*0.5;O=b(K,H,S,B);h(R,x,u,U,P,z,O,0,0,1,0,0,1)}else if(v instanceof THREE.MeshNormalMaterial){p.r=l(F.normalWorld.x);p.g=l(F.normalWorld.y);p.b=l(F.normalWorld.z);p.updateStyleString();v.wireframe?d(p.__styleString,v.wireframe_linewidth):g(p.__styleString)}}}function d(I,Y){if(i!=I)t.strokeStyle=i=I;if(j!=Y)t.lineWidth=j=Y;t.stroke();da.inflate(Y*2)}function g(I){if(o!=I)t.fillStyle=o=I;t.fill()}function h(I,Y,V,F,v,L,$,Q,X,aa,Z,ca,ka){var ja,fa; +ja=$.width-1;fa=$.height-1;Q*=ja;X*=fa;aa*=ja;Z*=fa;ca*=ja;ka*=fa;V-=I;F-=Y;v-=I;L-=Y;aa-=Q;Z-=X;ca-=Q;ka-=X;fa=1/(aa*ka-ca*Z);ja=(ka*V-Z*v)*fa;Z=(ka*F-Z*L)*fa;V=(aa*v-ca*V)*fa;F=(aa*L-ca*F)*fa;I=I-ja*Q-V*X;Y=Y-Z*Q-F*X;t.save();t.transform(ja,Z,V,F,I,Y);t.clip();t.drawImage($,0,0);t.restore()}function q(I){if(f!=I)t.globalAlpha=f=I}function m(I){if(e!=I){switch(I){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter"; +break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}e=I}}function b(I,Y,V,F){ia[0]=n(0,k(255,~~(I.r*255)));ia[1]=n(0,k(255,~~(I.g*255)));ia[2]=n(0,k(255,~~(I.b*255)));ia[4]=n(0,k(255,~~(Y.r*255)));ia[5]=n(0,k(255,~~(Y.g*255)));ia[6]=n(0,k(255,~~(Y.b*255)));ia[8]=n(0,k(255,~~(V.r*255)));ia[9]=n(0,k(255,~~(V.g*255)));ia[10]=n(0,k(255,~~(V.b*255)));ia[12]=n(0,k(255,~~(F.r*255)));ia[13]=n(0,k(255,~~(F.g*255)));ia[14]=n(0,k(255,~~(F.b*255)));oa.putImageData(ua,0,0);ra.drawImage(pa, +0,0);return qa}function l(I){return I<0?k((1+I)*0.5,0.5):0.5+k(I*0.5,0.5)}function y(I,Y){var V=Y.x-I.x,F=Y.y-I.y,v=1/Math.sqrt(V*V+F*F);V*=v;F*=v;Y.x+=V;Y.y+=F;I.x-=V;I.y-=F}var C=null,E=new THREE.Projector,w=document.createElement("canvas"),D,N,J,M,t=w.getContext("2d"),f=1,e=0,i=null,o=null,j=1,k=Math.min,n=Math.max,s,G,r,R,x,u,U,P,z,p=new THREE.Color,K=new THREE.Color,H=new THREE.Color,S=new THREE.Color,B=new THREE.Color,A,W,ea,O,T=new THREE.Rectangle,ba=new THREE.Rectangle,da=new THREE.Rectangle, +ta=false,ha=new THREE.Color,ga=new THREE.Color,la=new THREE.Color,ma=new THREE.Color,xa=Math.PI*2,sa=new THREE.Vector3,pa,oa,ua,ia,qa,ra,na=16;pa=document.createElement("canvas");pa.width=pa.height=2;oa=pa.getContext("2d");oa.fillStyle="rgba(0,0,0,1)";oa.fillRect(0,0,2,2);ua=oa.getImageData(0,0,2,2);ia=ua.data;qa=document.createElement("canvas");qa.width=qa.height=na;ra=qa.getContext("2d");ra.translate(-na/2,-na/2);ra.scale(na,na);na--;this.domElement=w;this.autoClear=true;this.setSize=function(I, +Y){D=I;N=Y;J=D/2;M=N/2;w.width=D;w.height=N;T.set(-J,-M,J,M)};this.clear=function(){if(!ba.isEmpty()){ba.inflate(1);ba.minSelf(T);t.clearRect(ba.getX(),ba.getY(),ba.getWidth(),ba.getHeight());ba.empty()}};this.render=function(I,Y){var V,F,v,L,$,Q,X,aa;t.setTransform(1,0,0,-1,J,M);this.autoClear&&this.clear();C=E.projectScene(I,Y);if(ta=I.lights.length>0){$=I.lights;ga.setRGB(0,0,0);la.setRGB(0,0,0);ma.setRGB(0,0,0);V=0;for(F=$.length;V>1;wa=fa.height>>1;ka=X.scale.x*J;ja=X.scale.y*M;aa=ka*va;ca=ja*wa;da.set(Q.x-aa,Q.y-ca,Q.x+aa,Q.y+ca);if(T.instersects(da)){t.save();t.translate(Q.x,Q.y);t.rotate(-X.rotation);t.scale(ka,-ja);t.translate(-va,-wa);t.drawImage(fa,0,0);t.restore()}}}else if(Z instanceof THREE.ParticleCircleMaterial){if(ta){ha.r=ga.r+la.r+ma.r;ha.g=ga.g+la.g+ma.g;ha.b=ga.b+la.b+ma.b;p.r=Z.color.r*ha.r;p.g=Z.color.g*ha.g;p.b=Z.color.b*ha.b;p.updateStyleString()}else p.__styleString=Z.color.__styleString; +aa=X.scale.x*J;ca=X.scale.y*M;da.set(Q.x-aa,Q.y-ca,Q.x+aa,Q.y+ca);if(T.instersects(da)){Z=p.__styleString;if(o!=Z)t.fillStyle=o=Z;t.save();t.translate(Q.x,Q.y);t.rotate(-X.rotation);t.scale(aa,ca);t.beginPath();t.arc(0,0,1,0,xa,true);t.closePath();t.fill();t.restore()}}}}}else if(v instanceof THREE.RenderableLine){s=v.v1;G=v.v2;s.positionScreen.x*=J;s.positionScreen.y*=M;G.positionScreen.x*=J;G.positionScreen.y*=M;da.addPoint(s.positionScreen.x,s.positionScreen.y);da.addPoint(G.positionScreen.x,G.positionScreen.y); +if(T.instersects(da)){L=0;for($=v.material.length;L<$;){X=s;aa=G;Q=v.material[L++];if(Q.opacity!=0){q(Q.opacity);m(Q.blending);t.beginPath();t.moveTo(X.positionScreen.x,X.positionScreen.y);t.lineTo(aa.positionScreen.x,aa.positionScreen.y);t.closePath();if(Q instanceof THREE.LineBasicMaterial){p.__styleString=Q.color.__styleString;X=Q.linewidth;if(j!=X)t.lineWidth=j=X;X=p.__styleString;if(i!=X)t.strokeStyle=i=X;t.stroke();da.inflate(Q.linewidth*2)}}}}}else if(v instanceof THREE.RenderableFace3){s= +v.v1;G=v.v2;r=v.v3;s.positionScreen.x*=J;s.positionScreen.y*=M;G.positionScreen.x*=J;G.positionScreen.y*=M;r.positionScreen.x*=J;r.positionScreen.y*=M;if(v.overdraw){y(s.positionScreen,G.positionScreen);y(G.positionScreen,r.positionScreen);y(r.positionScreen,s.positionScreen)}da.addPoint(s.positionScreen.x,s.positionScreen.y);da.addPoint(G.positionScreen.x,G.positionScreen.y);da.addPoint(r.positionScreen.x,r.positionScreen.y);if(T.instersects(da)){L=0;for($=v.meshMaterial.length;L<$;){aa=v.meshMaterial[L++]; +if(aa instanceof THREE.MeshFaceMaterial){Q=0;for(X=v.faceMaterial.length;Q0){H.r+=A.color.r*W;H.g+=A.color.g*W;H.b+=A.color.b*W}}else if(A instanceof THREE.PointLight){s.sub(A.position,K.centroidWorld);s.normalize();W=K.normalWorld.dot(s)*A.intensity;if(W>0){H.r+=A.color.r*W;H.g+=A.color.g*W;H.b+=A.color.b*W}}}}function c(p,K,H,S,B,A){x=g(u++);x.setAttribute("d","M "+p.positionScreen.x+ +" "+p.positionScreen.y+" L "+K.positionScreen.x+" "+K.positionScreen.y+" L "+H.positionScreen.x+","+H.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)e.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(f){i.r=o.r;i.g=o.g;i.b=o.b;a(A,S,i);e.r=B.color.r*i.r;e.g=B.color.g*i.g;e.b=B.color.b*i.b;e.updateStyleString()}else e.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){n=1-B.__2near/(B.__farPlusNear-S.z*B.__farMinusNear); +e.setRGB(n,n,n)}else B instanceof THREE.MeshNormalMaterial&&e.setRGB(h(S.normalWorld.x),h(S.normalWorld.y),h(S.normalWorld.z));B.wireframe?x.setAttribute("style","fill: none; stroke: "+e.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):x.setAttribute("style","fill: "+e.__styleString+"; fill-opacity: "+B.opacity);b.appendChild(x)}function d(p,K,H,S,B,A,W){x=g(u++);x.setAttribute("d", +"M "+p.positionScreen.x+" "+p.positionScreen.y+" L "+K.positionScreen.x+" "+K.positionScreen.y+" L "+H.positionScreen.x+","+H.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(A instanceof THREE.MeshBasicMaterial)e.__styleString=A.color.__styleString;else if(A instanceof THREE.MeshLambertMaterial)if(f){i.r=o.r;i.g=o.g;i.b=o.b;a(W,B,i);e.r=A.color.r*i.r;e.g=A.color.g*i.g;e.b=A.color.b*i.b;e.updateStyleString()}else e.__styleString=A.color.__styleString;else if(A instanceof THREE.MeshDepthMaterial){n= +1-A.__2near/(A.__farPlusNear-B.z*A.__farMinusNear);e.setRGB(n,n,n)}else A instanceof THREE.MeshNormalMaterial&&e.setRGB(h(B.normalWorld.x),h(B.normalWorld.y),h(B.normalWorld.z));A.wireframe?x.setAttribute("style","fill: none; stroke: "+e.__styleString+"; stroke-width: "+A.wireframe_linewidth+"; stroke-opacity: "+A.opacity+"; stroke-linecap: "+A.wireframe_linecap+"; stroke-linejoin: "+A.wireframe_linejoin):x.setAttribute("style","fill: "+e.__styleString+"; fill-opacity: "+A.opacity);b.appendChild(x)} +function g(p){if(G[p]==null){G[p]=document.createElementNS("http://www.w3.org/2000/svg","path");z==0&&G[p].setAttribute("shape-rendering","crispEdges");return G[p]}return G[p]}function h(p){return p<0?Math.min((1+p)*0.5,0.5):0.5+Math.min(p*0.5,0.5)}var q=null,m=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,y,C,E,w,D,N,J,M=new THREE.Rectangle,t=new THREE.Rectangle,f=false,e=new THREE.Color(16777215),i=new THREE.Color(16777215),o=new THREE.Color(0),j=new THREE.Color(0), +k=new THREE.Color(0),n,s=new THREE.Vector3,G=[],r=[],R=[],x,u,U,P,z=1;this.domElement=b;this.autoClear=true;this.setQuality=function(p){switch(p){case "high":z=1;break;case "low":z=0}};this.setSize=function(p,K){l=p;y=K;C=l/2;E=y/2;b.setAttribute("viewBox",-C+" "+-E+" "+l+" "+y);b.setAttribute("width",l);b.setAttribute("height",y);M.set(-C,-E,C,E)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};this.render=function(p,K){var H,S,B,A,W,ea,O,T;this.autoClear&&this.clear(); +q=m.projectScene(p,K);P=U=u=0;if(f=p.lights.length>0){O=p.lights;o.setRGB(0,0,0);j.setRGB(0,0,0);k.setRGB(0,0,0);H=0;for(S=O.length;H= 0.0 )": +"",e?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",e?"pointDiffuse += mColor * pointDiffuseWeight;":"",e?"pointSpecular += mSpecular * pointSpecularWeight;":"",e?"}":"",f?"vec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );":"",f?"vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",f?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",f?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",f?"vec3 dirVector = normalize( lDirection.xyz );":"",f?"vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );": +"",f?"float dirDotNormalHalf = dot( normal, dirHalfVector );":"",f?"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );":"",f?"float dirSpecularWeight = 0.0;":"",f?"if ( dirDotNormalHalf >= 0.0 )":"",f?"dirSpecularWeight = pow( dirDotNormalHalf, mShininess );":"",f?"dirDiffuse += mColor * dirDiffuseWeight;":"",f?"dirSpecular += mSpecular * dirSpecularWeight;":"",f?"}":"","vec4 totalLight = mAmbient;",f?"totalLight += dirDiffuse + dirSpecular;":"",e?"totalLight += pointDiffuse + pointSpecular;": +"","if ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mapColor.rgb * totalLight.xyz * vLightWeighting, cubeColor.rgb, mReflectivity ), mapColor.a );\n} else {\ngl_FragColor = vec4( mapColor.rgb * cubeColor.rgb * totalLight.xyz * vLightWeighting, mapColor.a );\n}\n} else if ( material == 1 ) {\nif ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mColor.rgb * mapColor.rgb * vLightWeighting, cubeColor.rgb, mReflectivity ), mColor.a * mapColor.a );\n} else {\ngl_FragColor = vec4( mColor.rgb * mapColor.rgb * cubeColor.rgb * vLightWeighting, mColor.a * mapColor.a );\n}\n} else {\nif ( mixEnvMap ) {\ngl_FragColor = mix( mColor * mapColor, cubeColor, mReflectivity );\n} else {\ngl_FragColor = mColor * mapColor * cubeColor;\n}\n}\n}"].join("\n"); +l=c(o,i);b.useProgram(l);d(l,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract","m2Near","mFarPlusNear","mFarMinusNear"]);f&&d(l,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);e&&d(l,["pointLightNumber","pointLightColor", +"pointLightPosition"]);b.uniform1i(l.uniforms.enableMap,0);b.uniform1i(l.uniforms.tMap,0);b.uniform1i(l.uniforms.enableCubeMap,0);b.uniform1i(l.uniforms.tCube,1);b.uniform1i(l.uniforms.mixEnvMap,0);b.uniform1i(l.uniforms.useRefract,0);g(l)})(a.directional,a.point);this.setSize=function(f,e){m.width=f;m.height=e;b.viewport(0,0,m.width,m.height)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(f,e){var i,o,j,k,n,s=[],G=[],r=[];k=[];n=[];b.uniform1i(f.uniforms.enableLighting, +e.lights.length);i=0;for(o=e.lights.length;i=0;i--){o=f.__webGLObjects[i].__object;e==o&&f.__webGLObjects.splice(i,1)}};this.setupMatrices=function(f, +e){f.autoUpdateMatrix&&f.updateMatrix();C.multiply(e.matrix,f.matrix);w.set(e.matrix.flatten());D.set(C.flatten());N.set(e.projectionMatrix.flatten());E=THREE.Matrix4.makeInvert3x3(C).transpose();J.set(E.m);M.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,w);b.uniformMatrix4fv(f.uniforms.modelViewMatrix,false,D);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,N);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,J);b.uniformMatrix4fv(f.uniforms.objectMatrix, +false,M)};this.loadCamera=function(f,e){b.uniform3f(f.uniforms.cameraPosition,e.position.x,e.position.y,e.position.z)};this.setBlending=function(f){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(f,e){if(f){!e||e=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK); +else f=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)}};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterial=this.meshMaterial=null;this.overdraw=false;this.uvs=[null,null,null]}; +THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.material=null};