Browse Source

Updated builds.

Mr.doob 14 years ago
parent
commit
95ec00f8ac
3 changed files with 543 additions and 544 deletions
  1. 168 168
      build/Three.js
  2. 169 169
      build/ThreeDebug.js
  3. 206 207
      build/ThreeExtras.js

+ 168 - 168
build/Three.js

@@ -1,168 +1,168 @@
-// Three.js r29 - 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)+
-","+~~(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;
-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,h=[];a=0;for(c=g.length;a<c;a++){e=g[a];if(e instanceof THREE.Mesh)h=h.concat(this.intersectObject(e))}h.sort(function(q,m){return q.distance-m.distance});return h},intersectObject:function(a){function c(O,s,f,d){d=d.clone().subSelf(s);f=f.clone().subSelf(s);var i=O.clone().subSelf(s);O=d.dot(d);s=d.dot(f);d=d.dot(i);var o=f.dot(f);f=f.dot(i);i=1/(O*o-s*s);o=(o*d-s*f)*i;O=(O*f-s*d)*i;return o>0&&O>0&&o+O<1}var e,g,h,q,m,b,l,y,E,H,
-w,F=a.geometry,P=F.vertices,N=[];e=0;for(g=F.faces.length;e<g;e++){h=F.faces[e];H=this.origin.clone();w=this.direction.clone();q=a.matrix.transform(P[h.a].position.clone());m=a.matrix.transform(P[h.b].position.clone());b=a.matrix.transform(P[h.c].position.clone());l=h instanceof THREE.Face4?a.matrix.transform(P[h.d].position.clone()):null;y=a.rotationMatrix.transform(h.normal.clone());E=w.dot(y);if(E<0){y=y.dot((new THREE.Vector3).sub(q,H))/E;H=H.addSelf(w.multiplyScalar(y));if(h instanceof THREE.Face3){if(c(H,
-q,m,b)){h={distance:this.origin.distanceTo(H),point:H,face:h,object:a};N.push(h)}}else if(h instanceof THREE.Face4)if(c(H,q,m,l)||c(H,m,b,l)){h={distance:this.origin.distanceTo(H),point:H,face:h,object:a};N.push(h)}}}return N}};
-THREE.Rectangle=function(){function a(){q=g-c;m=h-e}var c,e,g,h,q,m,b=true;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return q};this.getHeight=function(){return m};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return g};this.getBottom=function(){return h};this.set=function(l,y,E,H){b=false;c=l;e=y;g=E;h=H;a()};this.addPoint=function(l,y){if(b){b=false;c=l;e=y;g=l;h=y}else{c=Math.min(c,l);e=Math.min(e,y);g=Math.max(g,
-l);h=Math.max(h,y)}a()};this.addRectangle=function(l){if(b){b=false;c=l.getLeft();e=l.getTop();g=l.getRight();h=l.getBottom()}else{c=Math.min(c,l.getLeft());e=Math.min(e,l.getTop());g=Math.max(g,l.getRight());h=Math.max(h,l.getBottom())}a()};this.inflate=function(l){c-=l;e-=l;g+=l;h+=l;a()};this.minSelf=function(l){c=Math.max(c,l.getLeft());e=Math.max(e,l.getTop());g=Math.min(g,l.getRight());h=Math.min(h,l.getBottom());a()};this.instersects=function(l){return Math.min(g,l.getRight())-Math.max(c,l.getLeft())>=
-0&&Math.min(h,l.getBottom())-Math.max(e,l.getTop())>=0};this.empty=function(){b=true;h=g=e=c=0;a()};this.isEmpty=function(){return b};this.toString=function(){return"THREE.Rectangle ( left: "+c+", right: "+g+", top: "+e+", 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,h=new THREE.Vector3,q=new THREE.Vector3;q.sub(a,c).normalize();g.cross(e,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},transform:function(a){var c=a.x,e=a.y,g=a.z,h=a.w||1;a.x=this.n11*c+this.n12*
-e+this.n13*g+this.n14*h;a.y=this.n21*c+this.n22*e+this.n23*g+this.n24*h;a.z=this.n31*c+this.n32*e+this.n33*g+this.n34*h;h=this.n41*c+this.n42*e+this.n43*g+this.n44*h;if(a.w)a.w=h;else{c=1/h;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,h=this.n14,
-q=this.n21,m=this.n22,b=this.n23,l=this.n24,y=this.n31,E=this.n32,H=this.n33,w=this.n34,F=this.n41,P=this.n42,N=this.n43,O=this.n44;this.n11=c*a.n11+e*a.n21+g*a.n31+h*a.n41;this.n12=c*a.n12+e*a.n22+g*a.n32+h*a.n42;this.n13=c*a.n13+e*a.n23+g*a.n33+h*a.n43;this.n14=c*a.n14+e*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+E*a.n21+H*a.n31+w*a.n41;
-this.n32=y*a.n12+E*a.n22+H*a.n32+w*a.n42;this.n33=y*a.n13+E*a.n23+H*a.n33+w*a.n43;this.n34=y*a.n14+E*a.n24+H*a.n34+w*a.n44;this.n41=F*a.n11+P*a.n21+N*a.n31+O*a.n41;this.n42=F*a.n12+P*a.n22+N*a.n32+O*a.n42;this.n43=F*a.n13+P*a.n23+N*a.n33+O*a.n43;this.n44=F*a.n14+P*a.n24+N*a.n34+O*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 h=c[e];c[e]=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,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};
-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),h=Math.sin(c),q=1-g,m=a.x,b=a.y,l=a.z;e.n11=q*m*m+g;e.n12=q*m*b-h*l;e.n13=q*m*l+h*b;e.n21=q*m*b+h*l;e.n22=q*b*b+g;e.n23=q*b*l-h*m;e.n31=q*m*l-h*b;e.n32=q*b*l+h*m;e.n33=q*l*l+g;return e};
-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],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],E=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*q+c[2]*l;if(c==0)throw"matrix not invertible";c=1/c;a.m[0]=c*e;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*E;return a};
-THREE.Matrix4.makeFrustum=function(a,c,e,g,h,q){var m,b,l;m=new THREE.Matrix4;b=2*h/(c-a);l=2*h/(g-e);a=(c+a)/(c-a);e=(g+e)/(g-e);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=e;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,e,g){var h;a=e*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,e,g)};
-THREE.Matrix4.makeOrtho=function(a,c,e,g,h,q){var m,b,l,y;m=new THREE.Matrix4;b=c-a;l=e-g;y=q-h;a=(c+a)/b;e=(e+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=-e;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,h){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=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,c,e,g,h,q){this.a=a;this.b=c;this.c=e;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<c;a++){e=this.faces[a];e.centroid.set(0,0,0);e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);if(e instanceof THREE.Face3)e.centroid.divideScalar(3);else if(e instanceof THREE.Face4){e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeNormals:function(a){var c,e,g,h,q,m,b=new THREE.Vector3,
-l=new THREE.Vector3;g=0;for(h=this.vertices.length;g<h;g++){q=this.vertices[g];q.normal.set(0,0,0)}g=0;for(h=this.faces.length;g<h;g++){q=this.faces[g];if(a&&q.vertexNormals.length){b.set(0,0,0);c=0;for(e=q.normal.length;c<e;c++)b.addSelf(q.vertexNormals[c]);b.divideScalar(3)}else{c=this.vertices[q.a];e=this.vertices[q.b];m=this.vertices[q.c];b.sub(m.position,e.position);l.sub(c.position,e.position);b.crossSelf(l)}b.isZero()||b.normalize();q.normal.copy(b)}},computeBoundingBox:function(){if(this.vertices.length>
-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;a<c;a++){vertex=this.vertices[a];if(vertex.position.x<this.bbox.x[0])this.bbox.x[0]=vertex.position.x;else if(vertex.position.x>this.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.y<this.bbox.y[0])this.bbox.y[0]=vertex.position.y;else if(vertex.position.y>
-this.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.z<this.bbox.z[0])this.bbox.z[0]=vertex.position.z;else if(vertex.position.z>this.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.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(E){var H=[];c=0;for(e=E.length;c<e;c++)E[c]==undefined?H.push("undefined"):H.push(E[c].toString());return H.join("_")}var c,e,g,h,q,m,b,l,y={};g=0;for(h=this.geometry.faces.length;g<h;g++){q=this.geometry.faces[g];m=q.material;b=a(m);if(y[b]==undefined)y[b]={hash:b,counter:0};l=y[b].hash+"_"+y[b].counter;if(this.materialFaceGroup[l]==undefined)this.materialFaceGroup[l]={faces:[],material:m,vertices:0};q=q instanceof THREE.Face3?3:4;if(this.materialFaceGroup[l].vertices+
-q>65535){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,e,g,h;a=0;for(c=this.geometry.uvs.length;a<c;a++){h=this.geometry.uvs[a];e=0;for(g=h.length;e<g;e++){if(h[e].u!=1)h[e].u-=Math.floor(h[e].u);if(h[e].v!=1)h[e].v-=Math.floor(h[e].v)}}};THREE.FlatShading=0;
-THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
-THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16711680);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";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;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}this.toString=function(){return"THREE.LineBasicMaterial (<br/>color: "+
-this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
-THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(15658734);this.env_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.env_map!==
-undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+
-this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
-THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(15658734);this.env_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;
-if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+
-this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
-THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(15658734);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;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.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
-a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
-this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>"+ +")"}};THREE.MeshPhongMaterialCounter={value:0};
-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+"<br/>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 (<br/>id: "+this.id+"<br/>blending: "+
-this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};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 (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+
-this.blending+"<br/>)"}};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 (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
-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 (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>)"}};
-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 (<br/>image: "+this.image+"<br/>mapping: "+this.mapping+"<br/>)"}};
-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(f,d){var i=0,o=1,k=f.z+f.w,j=d.z+d.w,n=-f.z+f.w,t=-d.z+d.w;if(k>=0&&j>=0&&n>=0&&t>=0)return true;else if(k<0&&j<0||n<0&&t<0)return false;else{if(k<0)i=Math.max(i,k/(k-j));else if(j<0)o=Math.min(o,k/(k-j));if(n<0)i=Math.max(i,n/(n-t));else if(t<0)o=Math.min(o,n/(n-t));if(o<i)return false;else{f.lerpSelf(d,i);d.lerpSelf(f,1-o);return true}}}var c=null,e,g,h,q=[],m,b,l=[],y,E,H=[],w=new THREE.Vector4,F=new THREE.Matrix4,P=new THREE.Matrix4,N=new THREE.Vector4,O=
-new THREE.Vector4,s;this.projectScene=function(f,d){var i,o,k,j,n,t,Q,r,T,x,v,U,I,z,p,B,M;c=[];h=_face4Count=b=E=0;d.autoUpdateMatrix&&d.updateMatrix();F.multiply(d.projectionMatrix,d.matrix);Q=f.objects;i=0;for(o=Q.length;i<o;i++){r=Q[i];r.autoUpdateMatrix&&r.updateMatrix();T=r.matrix;x=r.rotationMatrix;v=r.material;U=r.overdraw;if(r instanceof THREE.Mesh){I=r.geometry.vertices;k=0;for(j=I.length;k<j;k++){z=I[k];z.positionWorld.copy(z.position);T.transform(z.positionWorld);p=z.positionScreen;p.copy(z.positionWorld);
-F.transform(p);p.multiplyScalar(1/p.w);z.__visible=p.z>0&&p.z<1}z=r.geometry.faces;k=0;for(j=z.length;k<j;k++){p=z[k];if(p instanceof THREE.Face3){n=I[p.a];t=I[p.b];B=I[p.c];if(n.__visible&&t.__visible&&B.__visible)if(r.doubleSided||r.flipSided!=(B.positionScreen.x-n.positionScreen.x)*(t.positionScreen.y-n.positionScreen.y)-(B.positionScreen.y-n.positionScreen.y)*(t.positionScreen.x-n.positionScreen.x)<0){e=q[h]=q[h]||new THREE.RenderableFace3;e.v1.positionWorld.copy(n.positionWorld);e.v2.positionWorld.copy(t.positionWorld);
-e.v3.positionWorld.copy(B.positionWorld);e.v1.positionScreen.copy(n.positionScreen);e.v2.positionScreen.copy(t.positionScreen);e.v3.positionScreen.copy(B.positionScreen);e.normalWorld.copy(p.normal);x.transform(e.normalWorld);e.centroidWorld.copy(p.centroid);T.transform(e.centroidWorld);e.centroidScreen.copy(e.centroidWorld);F.transform(e.centroidScreen);B=p.vertexNormals;s=e.vertexNormalsWorld;n=0;for(t=B.length;n<t;n++){M=s[n].copy(B[n]);x.transform(M)}e.z=e.centroidScreen.z;e.meshMaterial=v;e.faceMaterial=
-p.material;e.overdraw=U;if(r.geometry.uvs[k]){e.uvs[0]=r.geometry.uvs[k][0];e.uvs[1]=r.geometry.uvs[k][1];e.uvs[2]=r.geometry.uvs[k][2]}c.push(e);h++}}else if(p instanceof THREE.Face4){n=I[p.a];t=I[p.b];B=I[p.c];M=I[p.d];if(n.__visible&&t.__visible&&B.__visible&&M.__visible)if(r.doubleSided||r.flipSided!=((M.positionScreen.x-n.positionScreen.x)*(t.positionScreen.y-n.positionScreen.y)-(M.positionScreen.y-n.positionScreen.y)*(t.positionScreen.x-n.positionScreen.x)<0||(t.positionScreen.x-B.positionScreen.x)*
-(M.positionScreen.y-B.positionScreen.y)-(t.positionScreen.y-B.positionScreen.y)*(M.positionScreen.x-B.positionScreen.x)<0)){e=q[h]=q[h]||new THREE.RenderableFace3;e.v1.positionWorld.copy(n.positionWorld);e.v2.positionWorld.copy(t.positionWorld);e.v3.positionWorld.copy(M.positionWorld);e.v1.positionScreen.copy(n.positionScreen);e.v2.positionScreen.copy(t.positionScreen);e.v3.positionScreen.copy(M.positionScreen);e.normalWorld.copy(p.normal);x.transform(e.normalWorld);e.centroidWorld.copy(p.centroid);
-T.transform(e.centroidWorld);e.centroidScreen.copy(e.centroidWorld);F.transform(e.centroidScreen);e.z=e.centroidScreen.z;e.meshMaterial=v;e.faceMaterial=p.material;e.overdraw=U;if(r.geometry.uvs[k]){e.uvs[0]=r.geometry.uvs[k][0];e.uvs[1]=r.geometry.uvs[k][1];e.uvs[2]=r.geometry.uvs[k][3]}c.push(e);h++;g=q[h]=q[h]||new THREE.RenderableFace3;g.v1.positionWorld.copy(t.positionWorld);g.v2.positionWorld.copy(B.positionWorld);g.v3.positionWorld.copy(M.positionWorld);g.v1.positionScreen.copy(t.positionScreen);
-g.v2.positionScreen.copy(B.positionScreen);g.v3.positionScreen.copy(M.positionScreen);g.normalWorld.copy(e.normalWorld);g.centroidWorld.copy(e.centroidWorld);g.centroidScreen.copy(e.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterial=v;g.faceMaterial=p.material;g.overdraw=U;if(r.geometry.uvs[k]){g.uvs[0]=r.geometry.uvs[k][1];g.uvs[1]=r.geometry.uvs[k][2];g.uvs[2]=r.geometry.uvs[k][3]}c.push(g);h++}}}}else if(r instanceof THREE.Line){P.multiply(F,T);I=r.geometry.vertices;z=I[0];z.positionScreen.copy(z.position);
-P.transform(z.positionScreen);k=1;for(j=I.length;k<j;k++){n=I[k];n.positionScreen.copy(n.position);P.transform(n.positionScreen);t=I[k-1];N.copy(n.positionScreen);O.copy(t.positionScreen);if(a(N,O)){N.multiplyScalar(1/N.w);O.multiplyScalar(1/O.w);m=l[b]=l[b]||new THREE.RenderableLine;m.v1.positionScreen.copy(N);m.v2.positionScreen.copy(O);m.z=Math.max(N.z,O.z);m.material=r.material;c.push(m);b++}}}else if(r instanceof THREE.Particle){w.set(r.position.x,r.position.y,r.position.z,1);F.transform(w);
-w.z/=w.w;if(w.z>0&&w.z<1){y=H[E]=H[E]||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+d.projectionMatrix.n11)/(w.w+d.projectionMatrix.n14));y.scale.y=r.scale.y*Math.abs(y.y-(w.y+d.projectionMatrix.n22)/(w.w+d.projectionMatrix.n24));y.material=r.material;c.push(y);E++}}}c.sort(function(Y,C){return C.z-Y.z});return c};this.unprojectVector=function(f,d){var i=new THREE.Matrix4;i.multiply(THREE.Matrix4.makeInvert(d.matrix),THREE.Matrix4.makeInvert(d.projectionMatrix));
-i.transform(f);return f}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,e,g,h,q;this.domElement=document.createElement("div");this.setSize=function(m,b){e=m;g=b;h=e/2;q=g/2};this.render=function(m,b){var l,y,E,H,w,F,P,N;a=c.projectScene(m,b);l=0;for(y=a.length;l<y;l++){w=a[l];if(w instanceof THREE.RenderableParticle){P=w.x*h+h;N=w.y*q+q;E=0;for(H=w.material.length;E<H;E++){F=w.material[E];if(F instanceof THREE.ParticleDOMMaterial){F=F.domElement;F.style.left=P+"px";F.style.top=N+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(G,X,S,D){var u,J,$,R,W=G.lights;G=0;for(u=W.length;G<u;G++){J=W[G];$=J.color;R=J.intensity;if(J instanceof THREE.DirectionalLight){J=S.dot(J.position)*R;if(J>0){D.r+=$.r*J;D.g+=$.g*J;D.b+=$.b*J}}else if(J instanceof THREE.PointLight){ra.sub(J.position,X);ra.normalize();J=S.dot(ra)*R;if(J>0){D.r+=$.r*J;D.g+=$.g*J;D.b+=$.b*J}}}}function c(G,X,S,D,u,J){if(u.opacity!=0){q(u.opacity);m(u.blending);Q=G.positionScreen.x;r=G.positionScreen.y;T=X.positionScreen.x;
-x=X.positionScreen.y;v=S.positionScreen.x;U=S.positionScreen.y;var $=Q,R=r,W=T,aa=x,Z=v,ca=U;s.beginPath();s.moveTo($,R);s.lineTo(W,aa);s.lineTo(Z,ca);s.lineTo($,R);s.closePath();if(u instanceof THREE.MeshBasicMaterial)if(u.map)h(Q,r,T,x,v,U,u.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);else u.wireframe?e(u.color.__styleString,u.wireframe_linewidth):g(u.color.__styleString);else if(u instanceof THREE.MeshLambertMaterial){if(u.map&&!u.wireframe){h(Q,r,T,x,v,U,u.map.image,
-D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);m(THREE.SubtractiveBlending)}if(da)if(u.shading==THREE.SmoothShading&&!u.wireframe){z.r=p.r=B.r=ea.r;z.g=p.g=B.g=ea.g;z.b=p.b=B.b=ea.b;a(J,D.v1.positionWorld,D.vertexNormalsWorld[0],z);a(J,D.v2.positionWorld,D.vertexNormalsWorld[1],p);a(J,D.v3.positionWorld,D.vertexNormalsWorld[2],B);M.r=(p.r+B.r)*0.5;M.g=(p.g+B.g)*0.5;M.b=(p.b+B.b)*0.5;V=b(z,p,B,M);h(Q,r,T,x,v,U,V,0,0,1,0,0,1)}else{fa.r=ea.r;fa.g=ea.g;fa.b=ea.b;a(J,D.centroidWorld,
-D.normalWorld,fa);I.r=u.color.r*fa.r;I.g=u.color.g*fa.g;I.b=u.color.b*fa.b;I.updateStyleString();u.wireframe?e(I.__styleString,u.wireframe_linewidth):g(I.__styleString)}else u.wireframe?e(u.color.__styleString,u.wireframe_linewidth):g(u.color.__styleString)}else if(u instanceof THREE.MeshDepthMaterial){Y=u.__2near;C=u.__farPlusNear;A=u.__farMinusNear;z.r=z.g=z.b=1-Y/(C-G.positionScreen.z*A);p.r=p.g=p.b=1-Y/(C-X.positionScreen.z*A);B.r=B.g=B.b=1-Y/(C-S.positionScreen.z*A);M.r=(p.r+B.r)*0.5;M.g=(p.g+
-B.g)*0.5;M.b=(p.b+B.b)*0.5;V=b(z,p,B,M);h(Q,r,T,x,v,U,V,0,0,1,0,0,1)}else if(u instanceof THREE.MeshNormalMaterial){I.r=l(D.normalWorld.x);I.g=l(D.normalWorld.y);I.b=l(D.normalWorld.z);I.updateStyleString();u.wireframe?e(I.__styleString,u.wireframe_linewidth):g(I.__styleString)}}}function e(G,X){if(i!=G)s.strokeStyle=i=G;if(k!=X)s.lineWidth=k=X;s.stroke()}function g(G){if(o!=G)s.fillStyle=o=G;s.fill()}function h(G,X,S,D,u,J,$,R,W,aa,Z,ca,ja){var ia=$.width-1,ga=$.height-1;R*=ia;W*=ga;aa*=ia;Z*=ga;
-ca*=ia;ja*=ga;S-=G;D-=X;u-=G;J-=X;aa-=R;Z-=W;ca-=R;ja-=W;ga=1/(aa*ja-ca*Z);ia=(ja*S-Z*u)*ga;Z=(ja*D-Z*J)*ga;S=(aa*u-ca*S)*ga;D=(aa*J-ca*D)*ga;G=G-ia*R-S*W;X=X-Z*R-D*W;s.save();s.transform(ia,Z,S,D,G,X);s.clip();s.drawImage($,0,0);s.restore()}function q(G){if(f!=G)s.globalAlpha=f=G}function m(G){if(d!=G){switch(G){case THREE.NormalBlending:s.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:s.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:s.globalCompositeOperation=
-"darker"}d=G}}function b(G,X,S,D){ha[0]=~~(G.r*255);ha[1]=~~(G.g*255);ha[2]=~~(G.b*255);ha[4]=~~(X.r*255);ha[5]=~~(X.g*255);ha[6]=~~(X.b*255);ha[8]=~~(S.r*255);ha[9]=~~(S.g*255);ha[10]=~~(S.b*255);ha[12]=~~(D.r*255);ha[13]=~~(D.g*255);ha[14]=~~(D.b*255);na.putImageData(sa,0,0);qa.drawImage(oa,0,0);return pa}function l(G){return G<0?Math.min((1+G)*0.5,0.5):0.5+Math.min(G*0.5,0.5)}function y(G,X){var S=X.x-G.x,D=X.y-G.y,u=1/Math.sqrt(S*S+D*D);S*=u;D*=u;X.x+=S;X.y+=D;G.x-=S;G.y-=D}var E=null,H=new THREE.Projector,
-w=document.createElement("canvas"),F,P,N,O,s=w.getContext("2d"),f=1,d=0,i=null,o=null,k=1,j,n,t,Q,r,T,x,v,U,I=new THREE.Color,z=new THREE.Color,p=new THREE.Color,B=new THREE.Color,M=new THREE.Color,Y,C,A,V,ba=new THREE.Rectangle,K=new THREE.Rectangle,L=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=w;this.autoClear=true;this.setSize=function(G,X){F=G;P=X;N=F/2;O=P/2;w.width=F;w.height=P;ba.set(-N,-O,N,O)};this.clear=function(){if(!K.isEmpty()){K.inflate(1);K.minSelf(ba);s.clearRect(K.getX(),K.getY(),K.getWidth(),K.getHeight());
-K.empty()}};this.render=function(G,X){var S,D,u,J,$,R,W,aa;s.setTransform(1,0,0,-1,N,O);this.autoClear&&this.clear();E=H.projectScene(G,X);if(da=G.lights.length>0){$=G.lights;ea.setRGB(0,0,0);ka.setRGB(0,0,0);la.setRGB(0,0,0);S=0;for(D=$.length;S<D;S++){u=$[S];J=u.color;if(u instanceof THREE.AmbientLight){ea.r+=J.r;ea.g+=J.g;ea.b+=J.b}else if(u instanceof THREE.DirectionalLight){ka.r+=J.r;ka.g+=J.g;ka.b+=J.b}else if(u instanceof THREE.PointLight){la.r+=J.r;la.g+=J.g;la.b+=J.b}}}S=0;for(D=E.length;S<
-D;S++){u=E[S];L.empty();if(u instanceof THREE.RenderableParticle){j=u;j.x*=N;j.y*=O;J=0;for($=u.material.length;J<$;J++){R=j;W=u;var Z=u.material[J];if(Z.opacity!=0){q(Z.opacity);m(Z.blending);aa=void 0;var ca=void 0,ja=void 0,ia=void 0,ga=void 0,ta=void 0,ua=void 0;if(Z instanceof THREE.ParticleBasicMaterial){if(Z.map){ga=Z.map;ta=ga.width>>1;ua=ga.height>>1;ja=W.scale.x*N;ia=W.scale.y*O;aa=ja*ta;ca=ia*ua;L.set(R.x-aa,R.y-ca,R.x+aa,R.y+ca);if(ba.instersects(L)){s.save();s.translate(R.x,R.y);s.rotate(-W.rotation);
-s.scale(ja,-ia);s.translate(-ta,-ua);s.drawImage(ga,0,0);s.restore()}}}else if(Z 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;I.r=Z.color.r*fa.r;I.g=Z.color.g*fa.g;I.b=Z.color.b*fa.b;I.updateStyleString()}else I.__styleString=Z.color.__styleString;aa=W.scale.x*N;ca=W.scale.y*O;L.set(R.x-aa,R.y-ca,R.x+aa,R.y+ca);if(ba.instersects(L)){Z=I.__styleString;if(o!=Z)s.fillStyle=o=Z;s.save();s.translate(R.x,R.y);s.rotate(-W.rotation);s.scale(aa,
-ca);s.beginPath();s.arc(0,0,1,0,va,true);s.closePath();s.fill();s.restore()}}}}}else if(u instanceof THREE.RenderableLine){j=u.v1;n=u.v2;j.positionScreen.x*=N;j.positionScreen.y*=O;n.positionScreen.x*=N;n.positionScreen.y*=O;L.addPoint(j.positionScreen.x,j.positionScreen.y);L.addPoint(n.positionScreen.x,n.positionScreen.y);if(ba.instersects(L)){J=0;for($=u.material.length;J<$;){W=j;aa=n;R=u.material[J++];if(R.opacity!=0){q(R.opacity);m(R.blending);s.beginPath();s.moveTo(W.positionScreen.x,W.positionScreen.y);
-s.lineTo(aa.positionScreen.x,aa.positionScreen.y);s.closePath();if(R instanceof THREE.LineBasicMaterial){I.__styleString=R.color.__styleString;W=R.linewidth;if(k!=W)s.lineWidth=k=W;W=I.__styleString;if(i!=W)s.strokeStyle=i=W;s.stroke();L.inflate(R.linewidth*2)}}}}}else if(u instanceof THREE.RenderableFace3){j=u.v1;n=u.v2;t=u.v3;j.positionScreen.x*=N;j.positionScreen.y*=O;n.positionScreen.x*=N;n.positionScreen.y*=O;t.positionScreen.x*=N;t.positionScreen.y*=O;if(u.overdraw){y(j.positionScreen,n.positionScreen);
-y(n.positionScreen,t.positionScreen);y(t.positionScreen,j.positionScreen)}L.addPoint(j.positionScreen.x,j.positionScreen.y);L.addPoint(n.positionScreen.x,n.positionScreen.y);L.addPoint(t.positionScreen.x,t.positionScreen.y);if(ba.instersects(L)){J=0;for($=u.meshMaterial.length;J<$;){aa=u.meshMaterial[J++];if(aa instanceof THREE.MeshFaceMaterial){R=0;for(W=u.faceMaterial.length;R<W;)(aa=u.faceMaterial[R++])&&c(j,n,t,u,aa,G)}else c(j,n,t,u,aa,G)}}}K.addRectangle(L)}s.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(p,B,M){var Y,C,A,V;Y=0;for(C=p.lights.length;Y<C;Y++){A=p.lights[Y];if(A instanceof THREE.DirectionalLight){V=B.normalWorld.dot(A.position)*A.intensity;if(V>0){M.r+=A.color.r*V;M.g+=A.color.g*V;M.b+=A.color.b*V}}else if(A instanceof THREE.PointLight){t.sub(A.position,B.centroidWorld);t.normalize();V=B.normalWorld.dot(t)*A.intensity;if(V>0){M.r+=A.color.r*V;M.g+=A.color.g*V;M.b+=A.color.b*V}}}}function c(p,B,M,Y,C,A){x=g(v++);x.setAttribute("d","M "+p.positionScreen.x+
-" "+p.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)d.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshLambertMaterial)if(f){i.r=o.r;i.g=o.g;i.b=o.b;a(A,Y,i);d.r=C.color.r*i.r;d.g=C.color.g*i.g;d.b=C.color.b*i.b;d.updateStyleString()}else d.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshDepthMaterial){n=1-C.__2near/(C.__farPlusNear-Y.z*C.__farMinusNear);
-d.setRGB(n,n,n)}else C instanceof THREE.MeshNormalMaterial&&d.setRGB(h(Y.normalWorld.x),h(Y.normalWorld.y),h(Y.normalWorld.z));C.wireframe?x.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+C.wireframe_linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframe_linecap+"; stroke-linejoin: "+C.wireframe_linejoin):x.setAttribute("style","fill: "+d.__styleString+"; fill-opacity: "+C.opacity);b.appendChild(x)}function e(p,B,M,Y,C,A,V){x=g(v++);x.setAttribute("d",
-"M "+p.positionScreen.x+" "+p.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+" L "+Y.positionScreen.x+","+Y.positionScreen.y+"z");if(A instanceof THREE.MeshBasicMaterial)d.__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(V,C,i);d.r=A.color.r*i.r;d.g=A.color.g*i.g;d.b=A.color.b*i.b;d.updateStyleString()}else d.__styleString=A.color.__styleString;else if(A instanceof THREE.MeshDepthMaterial){n=
-1-A.__2near/(A.__farPlusNear-C.z*A.__farMinusNear);d.setRGB(n,n,n)}else A instanceof THREE.MeshNormalMaterial&&d.setRGB(h(C.normalWorld.x),h(C.normalWorld.y),h(C.normalWorld.z));A.wireframe?x.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+A.wireframe_linewidth+"; stroke-opacity: "+A.opacity+"; stroke-linecap: "+A.wireframe_linecap+"; stroke-linejoin: "+A.wireframe_linejoin):x.setAttribute("style","fill: "+d.__styleString+"; fill-opacity: "+A.opacity);b.appendChild(x)}
-function g(p){if(Q[p]==null){Q[p]=document.createElementNS("http://www.w3.org/2000/svg","path");z==0&&Q[p].setAttribute("shape-rendering","crispEdges");return Q[p]}return Q[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,E,H,w,F,P,N,O=new THREE.Rectangle,s=new THREE.Rectangle,f=false,d=new THREE.Color(16777215),i=new THREE.Color(16777215),o=new THREE.Color(0),k=new THREE.Color(0),
-j=new THREE.Color(0),n,t=new THREE.Vector3,Q=[],r=[],T=[],x,v,U,I,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,B){l=p;y=B;E=l/2;H=y/2;b.setAttribute("viewBox",-E+" "+-H+" "+l+" "+y);b.setAttribute("width",l);b.setAttribute("height",y);O.set(-E,-H,E,H)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};this.render=function(p,B){var M,Y,C,A,V,ba,K,L;this.autoClear&&this.clear();
-q=m.projectScene(p,B);I=U=v=0;if(f=p.lights.length>0){K=p.lights;o.setRGB(0,0,0);k.setRGB(0,0,0);j.setRGB(0,0,0);M=0;for(Y=K.length;M<Y;M++){C=K[M];A=C.color;if(C instanceof THREE.AmbientLight){o.r+=A.r;o.g+=A.g;o.b+=A.b}else if(C instanceof THREE.DirectionalLight){k.r+=A.r;k.g+=A.g;k.b+=A.b}else if(C instanceof THREE.PointLight){j.r+=A.r;j.g+=A.g;j.b+=A.b}}}M=0;for(Y=q.length;M<Y;M++){K=q[M];s.empty();if(K instanceof THREE.RenderableParticle){w=K;w.x*=E;w.y*=-H;C=0;for(A=K.material.length;C<A;C++)if(L=
-K.material[C]){V=w;ba=K;L=L;var da=U++;if(r[da]==null){r[da]=document.createElementNS("http://www.w3.org/2000/svg","circle");z==0&&r[da].setAttribute("shape-rendering","crispEdges")}x=r[da];x.setAttribute("cx",V.x);x.setAttribute("cy",V.y);x.setAttribute("r",ba.scale.x*E);if(L instanceof THREE.ParticleCircleMaterial){if(f){i.r=o.r+k.r+j.r;i.g=o.g+k.g+j.g;i.b=o.b+k.b+j.b;d.r=L.color.r*i.r;d.g=L.color.g*i.g;d.b=L.color.b*i.b;d.updateStyleString()}else d=L.color;x.setAttribute("style","fill: "+d.__styleString)}b.appendChild(x)}}else if(K instanceof
-THREE.RenderableLine){w=K.v1;F=K.v2;w.positionScreen.x*=E;w.positionScreen.y*=-H;F.positionScreen.x*=E;F.positionScreen.y*=-H;s.addPoint(w.positionScreen.x,w.positionScreen.y);s.addPoint(F.positionScreen.x,F.positionScreen.y);if(O.instersects(s)){C=0;for(A=K.material.length;C<A;)if(L=K.material[C++]){V=w;ba=F;L=L;da=I++;if(T[da]==null){T[da]=document.createElementNS("http://www.w3.org/2000/svg","line");z==0&&T[da].setAttribute("shape-rendering","crispEdges")}x=T[da];x.setAttribute("x1",V.positionScreen.x);
-x.setAttribute("y1",V.positionScreen.y);x.setAttribute("x2",ba.positionScreen.x);x.setAttribute("y2",ba.positionScreen.y);if(L instanceof THREE.LineBasicMaterial){d.__styleString=L.color.__styleString;x.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+L.linewidth+"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.linecap+"; stroke-linejoin: "+L.linejoin);b.appendChild(x)}}}}else if(K instanceof THREE.RenderableFace3){w=K.v1;F=K.v2;P=K.v3;w.positionScreen.x*=E;w.positionScreen.y*=
--H;F.positionScreen.x*=E;F.positionScreen.y*=-H;P.positionScreen.x*=E;P.positionScreen.y*=-H;s.addPoint(w.positionScreen.x,w.positionScreen.y);s.addPoint(F.positionScreen.x,F.positionScreen.y);s.addPoint(P.positionScreen.x,P.positionScreen.y);if(O.instersects(s)){C=0;for(A=K.meshMaterial.length;C<A;){L=K.meshMaterial[C++];if(L instanceof THREE.MeshFaceMaterial){V=0;for(ba=K.faceMaterial.length;V<ba;)(L=K.faceMaterial[V++])&&c(w,F,P,K,L,p)}else L&&c(w,F,P,K,L,p)}}}else if(K instanceof THREE.RenderableFace4){w=
-K.v1;F=K.v2;P=K.v3;N=K.v4;w.positionScreen.x*=E;w.positionScreen.y*=-H;F.positionScreen.x*=E;F.positionScreen.y*=-H;P.positionScreen.x*=E;P.positionScreen.y*=-H;N.positionScreen.x*=E;N.positionScreen.y*=-H;s.addPoint(w.positionScreen.x,w.positionScreen.y);s.addPoint(F.positionScreen.x,F.positionScreen.y);s.addPoint(P.positionScreen.x,P.positionScreen.y);s.addPoint(N.positionScreen.x,N.positionScreen.y);if(O.instersects(s)){C=0;for(A=K.meshMaterial.length;C<A;){L=K.meshMaterial[C++];if(L instanceof
-THREE.MeshFaceMaterial){V=0;for(ba=K.faceMaterial.length;V<ba;)(L=K.faceMaterial[V++])&&e(w,F,P,N,K,L,p)}else L&&e(w,F,P,N,K,L,p)}}}}}};
-THREE.WebGLRenderer=function(a){function c(f,d){var i=b.createProgram();b.attachShader(i,h("fragment","#ifdef GL_ES\nprecision highp float;\n#endif\n"+f));b.attachShader(i,h("vertex",d));b.linkProgram(i);if(!b.getProgramParameter(i,b.LINK_STATUS)){alert("Could not initialise shaders");alert("VALIDATE_STATUS: "+b.getProgramParameter(i,b.VALIDATE_STATUS));alert(b.getError())}i.uniforms={};return i}function e(f,d){var i,o,k;i=0;for(o=d.length;i<o;i++){k=d[i];f.uniforms[k]=b.getUniformLocation(f,k)}}
-function g(f){f.position=b.getAttribLocation(f,"position");b.enableVertexAttribArray(f.position);f.normal=b.getAttribLocation(f,"normal");b.enableVertexAttribArray(f.normal);f.uv=b.getAttribLocation(f,"uv");b.enableVertexAttribArray(f.uv)}function h(f,d){var i;if(f=="fragment")i=b.createShader(b.FRAGMENT_SHADER);else if(f=="vertex")i=b.createShader(b.VERTEX_SHADER);b.shaderSource(i,d);b.compileShader(i);if(!b.getShaderParameter(i,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(i));return null}return i}
-function q(f){switch(f){case THREE.Repeat:return b.REPEAT;case THREE.ClampToEdge:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeat:return b.MIRRORED_REPEAT}return 0}var m=document.createElement("canvas"),b,l,y,E=new THREE.Matrix4,H,w=new Float32Array(16),F=new Float32Array(16),P=new Float32Array(16),N=new Float32Array(9),O=new Float32Array(16);a=function(f,d){if(f){var i,o,k,j=pointLights=maxDirLights=maxPointLights=0;i=0;for(o=f.lights.length;i<o;i++){k=f.lights[i];k instanceof THREE.DirectionalLight&&
-j++;k instanceof THREE.PointLight&&pointLights++}if(pointLights+j<=d){maxDirLights=j;maxPointLights=pointLights}else{maxDirLights=Math.ceil(d*j/(pointLights+j));maxPointLights=d-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:d-1}}(a,4);this.domElement=m;this.autoClear=true;try{b=m.getContext("experimental-webgl",{antialias:true})}catch(s){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);
-b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(0,0,0,0);(function(f,d){var i=[f?"#define MAX_DIR_LIGHTS "+f:"",d?"#define MAX_POINT_LIGHTS "+d:"","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 ];":"",d?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",d?"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;",d?"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?"}":"",d?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",d?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",d?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
-"",d?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",d?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",d?"}":"","}\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"),
-o=[f?"#define MAX_DIR_LIGHTS "+f:"",d?"#define MAX_POINT_LIGHTS "+d:"","uniform int material;\nuniform bool enableMap;\nuniform bool enableCubeMap;\nuniform bool mixEnvMap;\nuniform samplerCube tCube;\nuniform float mReflectivity;\nuniform sampler2D tMap;\nuniform vec4 mColor;\nuniform float mOpacity;\nuniform vec4 mAmbient;\nuniform vec4 mSpecular;\nuniform float mShininess;\nuniform float m2Near;\nuniform float mFarPlusNear;\nuniform float mFarMinusNear;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;",
-f?"uniform mat4 viewMatrix;":"",f?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",d?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform vec3 cameraPosition;\nvoid main() {\nvec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nvec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nif ( enableMap ) {\nmapColor = texture2D( tMap, vUv );\n}\nif ( enableCubeMap ) {\ncubeColor.r = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) ).r;\ncubeColor.g = textureCube( tCube, vec3( -vReflect.x + 0.005, vReflect.yz ) ).g;\ncubeColor.b = textureCube( tCube, vec3( -vReflect.x + 0.01, vReflect.yz ) ).b;\n}\nif ( material == 5 ) { \nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( -wPos.x, wPos.yz ) );\n} else if ( material == 4 ) { \ngl_FragColor = vec4( 0.5*normalize( vNormal ) + vec3(0.5, 0.5, 0.5), mOpacity );\n} else if ( material == 3 ) { \nfloat w = 0.5;\ngl_FragColor = vec4( w, w, w, mOpacity );\n} else if ( material == 2 ) { \nvec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );",
-d?"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",d?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",d?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",d?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",d?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",d?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",d?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",d?"float pointSpecularWeight = 0.0;":"",d?"if ( pointDotNormalHalf >= 0.0 )":
-"",d?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",d?"pointDiffuse  += mColor * pointDiffuseWeight;":"",d?"pointSpecular += mSpecular * pointSpecularWeight;":"",d?"}":"",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;":"",d?"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);e(l,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract","m2Near","mFarPlusNear","mFarMinusNear"]);f&&e(l,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);d&&e(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,d){m.width=f;m.height=d;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,d){var i,o,k,j,n,t=[],Q=[],r=[];j=[];n=[];b.uniform1i(f.uniforms.enableLighting,
-d.lights.length);i=0;for(o=d.lights.length;i<o;i++){k=d.lights[i];if(k instanceof THREE.AmbientLight)t.push(k);else if(k instanceof THREE.DirectionalLight)r.push(k);else k instanceof THREE.PointLight&&Q.push(k)}i=k=j=n=0;for(o=t.length;i<o;i++){k+=t[i].color.r;j+=t[i].color.g;n+=t[i].color.b}b.uniform3f(f.uniforms.ambientLightColor,k,j,n);j=[];n=[];i=0;for(o=r.length;i<o;i++){k=r[i];j.push(k.color.r*k.intensity);j.push(k.color.g*k.intensity);j.push(k.color.b*k.intensity);n.push(k.position.x);n.push(k.position.y);
-n.push(k.position.z)}if(r.length){b.uniform1i(f.uniforms.directionalLightNumber,r.length);b.uniform3fv(f.uniforms.directionalLightDirection,n);b.uniform3fv(f.uniforms.directionalLightColor,j)}j=[];n=[];i=0;for(o=Q.length;i<o;i++){k=Q[i];j.push(k.color.r*k.intensity);j.push(k.color.g*k.intensity);j.push(k.color.b*k.intensity);n.push(k.position.x);n.push(k.position.y);n.push(k.position.z)}if(Q.length){b.uniform1i(f.uniforms.pointLightNumber,Q.length);b.uniform3fv(f.uniforms.pointLightPosition,n);b.uniform3fv(f.uniforms.pointLightColor,
-j)}};this.createBuffers=function(f,d){var i,o,k,j,n,t,Q,r,T=[],x=[],v=[],U=[],I=[],z=0,p=f.materialFaceGroup[d],B;k=false;i=0;for(o=f.material.length;i<o;i++){meshMaterial=f.material[i];if(meshMaterial instanceof THREE.MeshFaceMaterial){n=0;for(B=p.material.length;n<B;n++)if(p.material[n]&&p.material[n].shading!=undefined&&p.material[n].shading==THREE.SmoothShading){k=true;break}}else if(meshMaterial&&meshMaterial.shading!=undefined&&meshMaterial.shading==THREE.SmoothShading){k=true;break}if(k)break}B=
-k;i=0;for(o=p.faces.length;i<o;i++){k=p.faces[i];j=f.geometry.faces[k];n=j.vertexNormals;faceNormal=j.normal;k=f.geometry.uvs[k];if(j instanceof THREE.Face3){t=f.geometry.vertices[j.a].position;Q=f.geometry.vertices[j.b].position;r=f.geometry.vertices[j.c].position;v.push(t.x,t.y,t.z);v.push(Q.x,Q.y,Q.z);v.push(r.x,r.y,r.z);if(n.length==3&&B)for(j=0;j<3;j++)U.push(n[j].x,n[j].y,n[j].z);else for(j=0;j<3;j++)U.push(faceNormal.x,faceNormal.y,faceNormal.z);if(k)for(j=0;j<3;j++)I.push(k[j].u,k[j].v);T.push(z,
-z+1,z+2);x.push(z,z+1);x.push(z,z+2);x.push(z+1,z+2);z+=3}else if(j instanceof THREE.Face4){t=f.geometry.vertices[j.a].position;Q=f.geometry.vertices[j.b].position;r=f.geometry.vertices[j.c].position;j=f.geometry.vertices[j.d].position;v.push(t.x,t.y,t.z);v.push(Q.x,Q.y,Q.z);v.push(r.x,r.y,r.z);v.push(j.x,j.y,j.z);if(n.length==4&&B)for(j=0;j<4;j++)U.push(n[j].x,n[j].y,n[j].z);else for(j=0;j<4;j++)U.push(faceNormal.x,faceNormal.y,faceNormal.z);if(k)for(j=0;j<4;j++)I.push(k[j].u,k[j].v);T.push(z,z+
-1,z+2);T.push(z,z+2,z+3);x.push(z,z+1);x.push(z,z+2);x.push(z,z+3);x.push(z+1,z+2);x.push(z+2,z+3);z+=4}}if(v.length){p.__webGLVertexBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(v),b.STATIC_DRAW);p.__webGLNormalBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(U),b.STATIC_DRAW);p.__webGLUVBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLUVBuffer);
-b.bufferData(b.ARRAY_BUFFER,new Float32Array(I),b.STATIC_DRAW);p.__webGLFaceBuffer=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(T),b.STATIC_DRAW);p.__webGLLineBuffer=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(x),b.STATIC_DRAW);p.__webGLFaceCount=T.length;p.__webGLLineCount=x.length}};this.renderBuffer=function(f,d,i){var o,k,j,n,t,Q,r,
-T,x,v;if(d instanceof THREE.MeshShaderMaterial){if(!d.program){d.program=c(d.fragment_shader,d.vertex_shader);t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objMatrix","cameraPosition"];for(v in d.uniforms)t.push(v);e(d.program,t);g(d.program)}v=d.program}else v=l;if(v!=y){b.useProgram(v);y=v}if(d instanceof THREE.MeshShaderMaterial){t=v;T=d.uniforms;var U,I;for(k in T){U=T[k].type;x=T[k].value;I=t.uniforms[k];if(U=="i")b.uniform1i(I,x);else if(U=="f")b.uniform1f(I,x);else if(U==
-"t"){b.uniform1i(I,x);x=T[k].texture;if(x instanceof THREE.TextureCube&&x.image.length==6){if(!x.image.__webGLTextureCube&&!x.image.__cubeMapInitialized&&x.image.loadCount==6){x.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,x.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,
-b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(U=0;U<6;++U)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+U,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,x.image[U]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);x.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_CUBE_MAP,x.image.__webGLTextureCube)}}}this.loadCamera(v,f);this.loadMatrices(v)}else if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshBasicMaterial){f=
-d.color;o=d.opacity;j=d.wireframe;n=d.wireframe_linewidth;Q=d.map;r=d.env_map;t=d.combine==THREE.Mix;k=d.reflectivity;x=d.env_map&&d.env_map.mapping==THREE.RefractionMap;T=d.refraction_ratio;b.uniform4f(v.uniforms.mColor,f.r*o,f.g*o,f.b*o,o);b.uniform1i(v.uniforms.mixEnvMap,t);b.uniform1f(v.uniforms.mReflectivity,k);b.uniform1i(v.uniforms.useRefract,x);b.uniform1f(v.uniforms.mRefractionRatio,T)}if(d instanceof THREE.MeshNormalMaterial){o=d.opacity;b.uniform1f(v.uniforms.mOpacity,o);b.uniform1i(v.uniforms.material,
-4)}else if(d instanceof THREE.MeshDepthMaterial){o=d.opacity;j=d.wireframe;n=d.wireframe_linewidth;b.uniform1f(v.uniforms.mOpacity,o);b.uniform1f(v.uniforms.m2Near,d.__2near);b.uniform1f(v.uniforms.mFarPlusNear,d.__farPlusNear);b.uniform1f(v.uniforms.mFarMinusNear,d.__farMinusNear);b.uniform1i(v.uniforms.material,3)}else if(d instanceof THREE.MeshPhongMaterial){f=d.ambient;k=d.specular;t=d.shininess;b.uniform4f(v.uniforms.mAmbient,f.r,f.g,f.b,o);b.uniform4f(v.uniforms.mSpecular,k.r,k.g,k.b,o);b.uniform1f(v.uniforms.mShininess,
-t);b.uniform1i(v.uniforms.material,2)}else if(d instanceof THREE.MeshLambertMaterial)b.uniform1i(v.uniforms.material,1);else if(d instanceof THREE.MeshBasicMaterial)b.uniform1i(v.uniforms.material,0);else if(d instanceof THREE.MeshCubeMaterial){b.uniform1i(v.uniforms.material,5);r=d.env_map}if(Q){if(!d.map.__webGLTexture&&d.map.image.loaded){d.map.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.map.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,d.map.image);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,q(d.map.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,q(d.map.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.map.__webGLTexture);b.uniform1i(v.uniforms.tMap,0);b.uniform1i(v.uniforms.enableMap,1)}else b.uniform1i(v.uniforms.enableMap,
-0);if(r){if(d.env_map&&d.env_map instanceof THREE.TextureCube&&d.env_map.image.length==6){if(!d.env_map.image.__webGLTextureCube&&!d.env_map.image.__cubeMapInitialized&&d.env_map.image.loadCount==6){d.env_map.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,d.env_map.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,
-b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(o=0;o<6;++o)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,d.env_map.image[o]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);d.env_map.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_CUBE_MAP,d.env_map.image.__webGLTextureCube);b.uniform1i(v.uniforms.tCube,1)}b.uniform1i(v.uniforms.enableCubeMap,1)}else b.uniform1i(v.uniforms.enableCubeMap,
-0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLVertexBuffer);b.vertexAttribPointer(v.position,3,b.FLOAT,false,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.vertexAttribPointer(v.normal,3,b.FLOAT,false,0,0);if(Q){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUVBuffer);b.enableVertexAttribArray(v.uv);b.vertexAttribPointer(v.uv,2,b.FLOAT,false,0,0)}else b.disableVertexAttribArray(v.uv);if(j){b.lineWidth(n);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.drawElements(b.LINES,i.__webGLLineCount,
-b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,i.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,d,i,o,k){var j,n,t,Q,r;t=0;for(Q=d.material.length;t<Q;t++){j=d.material[t];if(j instanceof THREE.MeshFaceMaterial){j=0;for(n=i.material.length;j<n;j++)if((r=i.material[j])&&r.blending==o&&r.opacity<1==k){this.setBlending(r.blending);this.renderBuffer(f,r,i)}}else if((r=j)&&r.blending==o&&r.opacity<1==k){this.setBlending(r.blending);
-this.renderBuffer(f,r,i)}}};this.render=function(f,d){var i,o;this.initWebGLObjects(f);this.autoClear&&this.clear();d.autoUpdateMatrix&&d.updateMatrix();this.loadCamera(l,d);this.setupLights(l,f);i=0;for(o=f.__webGLObjects.length;i<o;i++){webGLObject=f.__webGLObjects[i];if(webGLObject.__object.visible){this.setupMatrices(webGLObject.__object,d);this.loadMatrices(l);this.renderPass(d,webGLObject.__object,webGLObject,THREE.NormalBlending,false)}}i=0;for(o=f.__webGLObjects.length;i<o;i++){webGLObject=
-f.__webGLObjects[i];if(webGLObject.__object.visible){this.setupMatrices(webGLObject.__object,d);this.loadMatrices(l);this.renderPass(d,webGLObject.__object,webGLObject,THREE.AdditiveBlending,false);this.renderPass(d,webGLObject.__object,webGLObject,THREE.SubtractiveBlending,false);this.renderPass(d,webGLObject.__object,webGLObject,THREE.AdditiveBlending,true);this.renderPass(d,webGLObject.__object,webGLObject,THREE.SubtractiveBlending,true);this.renderPass(d,webGLObject.__object,webGLObject,THREE.NormalBlending,
-true)}}};this.initWebGLObjects=function(f){var d,i,o,k,j;if(!f.__webGLObjects)f.__webGLObjects=[];d=0;for(i=f.objects.length;d<i;d++){o=f.objects[d];if(o instanceof THREE.Mesh)for(k in o.materialFaceGroup){j=o.materialFaceGroup[k];if(!j.__webGLVertexBuffer){this.createBuffers(o,k);j.__object=o;f.__webGLObjects.push(j)}}}};this.removeObject=function(f,d){var i,o;for(i=f.__webGLObjects.length-1;i>=0;i--){o=f.__webGLObjects[i].__object;d==o&&f.__webGLObjects.splice(i,1)}};this.setupMatrices=function(f,
-d){f.autoUpdateMatrix&&f.updateMatrix();E.multiply(d.matrix,f.matrix);w.set(d.matrix.flatten());F.set(E.flatten());P.set(d.projectionMatrix.flatten());H=THREE.Matrix4.makeInvert3x3(E).transpose();N.set(H.m);O.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,w);b.uniformMatrix4fv(f.uniforms.modelViewMatrix,false,F);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,P);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,N);b.uniformMatrix4fv(f.uniforms.objMatrix,
-false,O)};this.loadCamera=function(f,d){b.uniform3f(f.uniforms.cameraPosition,d.position.x,d.position.y,d.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,d){if(f){!d||d=="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};
+// 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,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,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,d,g=a.objects,h=[];a=0;for(c=g.length;a<c;a++){d=g[a];if(d instanceof THREE.Mesh)h=h.concat(this.intersectObject(d))}h.sort(function(q,m){return q.distance-m.distance});return h},intersectObject:function(a){function c(M,t,f,e){e=e.clone().subSelf(t);f=f.clone().subSelf(t);var i=M.clone().subSelf(t);M=e.dot(e);t=e.dot(f);e=e.dot(i);var o=f.dot(f);f=f.dot(i);i=1/(M*o-t*t);o=(o*e-t*f)*i;M=(M*f-t*e)*i;return o>0&&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<g;d++){h=D.faces[d];E=this.origin.clone();w=this.direction.clone();q=a.matrix.transformVector3(N[h.a].position.clone());m=a.matrix.transformVector3(N[h.b].position.clone());b=a.matrix.transformVector3(N[h.c].position.clone());l=h instanceof THREE.Face4?a.matrix.transformVector3(N[h.d].position.clone()):null;y=a.rotationMatrix.transformVector3(h.normal.clone());C=w.dot(y);if(C<0){y=y.dot((new THREE.Vector3).sub(q,E))/C;E=E.addSelf(w.multiplyScalar(y));
+if(h instanceof THREE.Face3){if(c(E,q,m,b)){h={distance:this.origin.distanceTo(E),point:E,face:h,object:a};J.push(h)}}else if(h instanceof THREE.Face4)if(c(E,q,m,l)||c(E,m,b,l)){h={distance:this.origin.distanceTo(E),point:E,face:h,object:a};J.push(h)}}}return J}};
+THREE.Rectangle=function(){function a(){q=g-c;m=h-d}var c,d,g,h,q,m,b=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return q};this.getHeight=function(){return m};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return g};this.getBottom=function(){return h};this.set=function(l,y,C,E){b=false;c=l;d=y;g=C;h=E;a()};this.addPoint=function(l,y){if(b){b=false;c=l;d=y;g=l;h=y}else{c=Math.min(c,l);d=Math.min(d,y);g=Math.max(g,
+l);h=Math.max(h,y)}a()};this.addRectangle=function(l){if(b){b=false;c=l.getLeft();d=l.getTop();g=l.getRight();h=l.getBottom()}else{c=Math.min(c,l.getLeft());d=Math.min(d,l.getTop());g=Math.max(g,l.getRight());h=Math.max(h,l.getBottom())}a()};this.inflate=function(l){c-=l;d-=l;g+=l;h+=l;a()};this.minSelf=function(l){c=Math.max(c,l.getLeft());d=Math.max(d,l.getTop());g=Math.min(g,l.getRight());h=Math.min(h,l.getBottom());a()};this.instersects=function(l){return Math.min(g,l.getRight())-Math.max(c,l.getLeft())>=
+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,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 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 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,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,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);if(d instanceof THREE.Face3)d.centroid.divideScalar(3);else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeNormals:function(a){var c,d,g,h,q,m,b=new THREE.Vector3,
+l=new THREE.Vector3;g=0;for(h=this.vertices.length;g<h;g++){q=this.vertices[g];q.normal.set(0,0,0)}g=0;for(h=this.faces.length;g<h;g++){q=this.faces[g];if(a&&q.vertexNormals.length){b.set(0,0,0);c=0;for(d=q.normal.length;c<d;c++)b.addSelf(q.vertexNormals[c]);b.divideScalar(3)}else{c=this.vertices[q.a];d=this.vertices[q.b];m=this.vertices[q.c];b.sub(m.position,d.position);l.sub(c.position,d.position);b.crossSelf(l)}b.isZero()||b.normalize();q.normal.copy(b)}},computeBoundingBox:function(){if(this.vertices.length>
+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;a<c;a++){vertex=this.vertices[a];if(vertex.position.x<this.bbox.x[0])this.bbox.x[0]=vertex.position.x;else if(vertex.position.x>this.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.y<this.bbox.y[0])this.bbox.y[0]=vertex.position.y;else if(vertex.position.y>
+this.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.z<this.bbox.z[0])this.bbox.z[0]=vertex.position.z;else if(vertex.position.z>this.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,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,d){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();d&&this.normalizeUVs();this.geometry.computeBoundingBox()};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;
+THREE.Mesh.prototype.sortFacesByMaterial=function(){function a(C){var E=[];c=0;for(d=C.length;c<d;c++)C[c]==undefined?E.push("undefined"):E.push(C[c].toString());return E.join("_")}var c,d,g,h,q,m,b,l,y={};g=0;for(h=this.geometry.faces.length;g<h;g++){q=this.geometry.faces[g];m=q.material;b=a(m);if(y[b]==undefined)y[b]={hash:b,counter:0};l=y[b].hash+"_"+y[b].counter;if(this.materialFaceGroup[l]==undefined)this.materialFaceGroup[l]={faces:[],material:m,vertices:0};q=q instanceof THREE.Face3?3:4;if(this.materialFaceGroup[l].vertices+
+q>65535){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;a<c;a++){h=this.geometry.uvs[a];d=0;for(g=h.length;d<g;d++){if(h[d].u!=1)h[d].u-=Math.floor(h[d].u);if(h[d].v!=1)h[d].v-=Math.floor(h[d].v)}}};THREE.FlatShading=0;
+THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
+THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16711680);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";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;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}this.toString=function(){return"THREE.LineBasicMaterial (<br/>color: "+
+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
+THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(15658734);this.env_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.env_map!==
+undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+
+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
+THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(15658734);this.env_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;
+if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+
+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
+THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(15658734);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;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.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
+a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>"+ +")"}};THREE.MeshPhongMaterialCounter={value:0};
+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+"<br/>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 (<br/>id: "+this.id+"<br/>blending: "+
+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};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 (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+
+this.blending+"<br/>)"}};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 (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
+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 (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>)"}};
+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 (<br/>image: "+this.image+"<br/>mapping: "+this.mapping+"<br/>)"}};
+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(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(o<i)return false;else{f.lerpSelf(e,i);e.lerpSelf(f,1-o);return true}}}var c=null,d,g,h,q=[],m,b,l=[],y,C,E=[],w=new THREE.Vector4,D=new THREE.Matrix4,N=new THREE.Matrix4,J=new THREE.Vector4,M=
+new THREE.Vector4,t;this.projectScene=function(f,e){var i,o,j,k,n,s,G,r,R,x,u,U,P,z,p,K,H;c=[];h=b=C=0;e.autoUpdateMatrix&&e.updateMatrix();D.multiply(e.projectionMatrix,e.matrix);G=f.objects;i=0;for(o=G.length;i<o;i++){r=G[i];r.autoUpdateMatrix&&r.updateMatrix();R=r.matrix;x=r.rotationMatrix;u=r.material;U=r.overdraw;if(r instanceof THREE.Mesh){P=r.geometry.vertices;j=0;for(k=P.length;j<k;j++){z=P[j];z.positionWorld.copy(z.position);R.transformVector3(z.positionWorld);p=z.positionScreen;p.copy(z.positionWorld);
+D.transformVector4(p);p.multiplyScalar(1/p.w);z.__visible=p.z>0&&p.z<1}z=r.geometry.faces;j=0;for(k=z.length;j<k;j++){p=z[j];if(p instanceof THREE.Face3){n=P[p.a];s=P[p.b];K=P[p.c];if(n.__visible&&s.__visible&&K.__visible)if(r.doubleSided||r.flipSided!=(K.positionScreen.x-n.positionScreen.x)*(s.positionScreen.y-n.positionScreen.y)-(K.positionScreen.y-n.positionScreen.y)*(s.positionScreen.x-n.positionScreen.x)<0){d=q[h]=q[h]||new THREE.RenderableFace3;d.v1.positionWorld.copy(n.positionWorld);d.v2.positionWorld.copy(s.positionWorld);
+d.v3.positionWorld.copy(K.positionWorld);d.v1.positionScreen.copy(n.positionScreen);d.v2.positionScreen.copy(s.positionScreen);d.v3.positionScreen.copy(K.positionScreen);d.normalWorld.copy(p.normal);x.transformVector3(d.normalWorld);d.centroidWorld.copy(p.centroid);R.transformVector3(d.centroidWorld);d.centroidScreen.copy(d.centroidWorld);D.transformVector3(d.centroidScreen);K=p.vertexNormals;t=d.vertexNormalsWorld;n=0;for(s=K.length;n<s;n++){H=t[n]=t[n]||new THREE.Vector3;H.copy(K[n]);x.transformVector3(H)}d.z=
+d.centroidScreen.z;d.meshMaterial=u;d.faceMaterial=p.material;d.overdraw=U;if(r.geometry.uvs[j]){d.uvs[0]=r.geometry.uvs[j][0];d.uvs[1]=r.geometry.uvs[j][1];d.uvs[2]=r.geometry.uvs[j][2]}c.push(d);h++}}else if(p instanceof THREE.Face4){n=P[p.a];s=P[p.b];K=P[p.c];H=P[p.d];if(n.__visible&&s.__visible&&K.__visible&&H.__visible)if(r.doubleSided||r.flipSided!=((H.positionScreen.x-n.positionScreen.x)*(s.positionScreen.y-n.positionScreen.y)-(H.positionScreen.y-n.positionScreen.y)*(s.positionScreen.x-n.positionScreen.x)<
+0||(s.positionScreen.x-K.positionScreen.x)*(H.positionScreen.y-K.positionScreen.y)-(s.positionScreen.y-K.positionScreen.y)*(H.positionScreen.x-K.positionScreen.x)<0)){d=q[h]=q[h]||new THREE.RenderableFace3;d.v1.positionWorld.copy(n.positionWorld);d.v2.positionWorld.copy(s.positionWorld);d.v3.positionWorld.copy(H.positionWorld);d.v1.positionScreen.copy(n.positionScreen);d.v2.positionScreen.copy(s.positionScreen);d.v3.positionScreen.copy(H.positionScreen);d.normalWorld.copy(p.normal);x.transformVector3(d.normalWorld);
+d.centroidWorld.copy(p.centroid);R.transformVector3(d.centroidWorld);d.centroidScreen.copy(d.centroidWorld);D.transformVector3(d.centroidScreen);d.z=d.centroidScreen.z;d.meshMaterial=u;d.faceMaterial=p.material;d.overdraw=U;if(r.geometry.uvs[j]){d.uvs[0]=r.geometry.uvs[j][0];d.uvs[1]=r.geometry.uvs[j][1];d.uvs[2]=r.geometry.uvs[j][3]}c.push(d);h++;g=q[h]=q[h]||new THREE.RenderableFace3;g.v1.positionWorld.copy(s.positionWorld);g.v2.positionWorld.copy(K.positionWorld);g.v3.positionWorld.copy(H.positionWorld);
+g.v1.positionScreen.copy(s.positionScreen);g.v2.positionScreen.copy(K.positionScreen);g.v3.positionScreen.copy(H.positionScreen);g.normalWorld.copy(d.normalWorld);g.centroidWorld.copy(d.centroidWorld);g.centroidScreen.copy(d.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterial=u;g.faceMaterial=p.material;g.overdraw=U;if(r.geometry.uvs[j]){g.uvs[0]=r.geometry.uvs[j][1];g.uvs[1]=r.geometry.uvs[j][2];g.uvs[2]=r.geometry.uvs[j][3]}c.push(g);h++}}}}else if(r instanceof THREE.Line){N.multiply(D,R);P=r.geometry.vertices;
+z=P[0];z.positionScreen.copy(z.position);N.transformVector4(z.positionScreen);j=1;for(k=P.length;j<k;j++){n=P[j];n.positionScreen.copy(n.position);N.transformVector4(n.positionScreen);s=P[j-1];J.copy(n.positionScreen);M.copy(s.positionScreen);if(a(J,M)){J.multiplyScalar(1/J.w);M.multiplyScalar(1/M.w);m=l[b]=l[b]||new THREE.RenderableLine;m.v1.positionScreen.copy(J);m.v2.positionScreen.copy(M);m.z=Math.max(J.z,M.z);m.material=r.material;c.push(m);b++}}}else if(r instanceof THREE.Particle){w.set(r.position.x,
+r.position.y,r.position.z,1);D.transformVector4(w);w.z/=w.w;if(w.z>0&&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;l<y;l++){w=a[l];if(w instanceof THREE.RenderableParticle){N=w.x*h+h;J=w.y*q+q;C=0;for(E=w.material.length;C<E;C++){D=w.material[C];if(D instanceof THREE.ParticleDOMMaterial){D=D.domElement;D.style.left=N+"px";D.style.top=J+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(I,Y,V,F){var v,L,$,Q,X=I.lights;I=0;for(v=X.length;I<v;I++){L=X[I];$=L.color;Q=L.intensity;if(L instanceof THREE.DirectionalLight){L=V.dot(L.position)*Q;if(L>0){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<F;V++){v=$[V];L=v.color;if(v instanceof THREE.AmbientLight){ga.r+=
+L.r;ga.g+=L.g;ga.b+=L.b}else if(v instanceof THREE.DirectionalLight){la.r+=L.r;la.g+=L.g;la.b+=L.b}else if(v instanceof THREE.PointLight){ma.r+=L.r;ma.g+=L.g;ma.b+=L.b}}}V=0;for(F=C.length;V<F;V++){v=C[V];da.empty();if(v instanceof THREE.RenderableParticle){s=v;s.x*=J;s.y*=M;L=0;for($=v.material.length;L<$;L++){Q=s;X=v;var Z=v.material[L];if(Z.opacity!=0){q(Z.opacity);m(Z.blending);aa=void 0;var ca=void 0,ka=void 0,ja=void 0,fa=void 0,va=void 0,wa=void 0;if(Z instanceof THREE.ParticleBasicMaterial){if(Z.map){fa=
+Z.map;va=fa.width>>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;Q<X;)(aa=v.faceMaterial[Q++])&&c(s,G,r,v,aa,I)}else c(s,G,r,v,aa,I)}}}ba.addRectangle(da)}t.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(p,K,H){var S,B,A,W;S=0;for(B=p.lights.length;S<B;S++){A=p.lights[S];if(A instanceof THREE.DirectionalLight){W=K.normalWorld.dot(A.position)*A.intensity;if(W>0){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<S;H++){B=O[H];A=B.color;if(B instanceof THREE.AmbientLight){o.r+=A.r;o.g+=A.g;o.b+=A.b}else if(B instanceof THREE.DirectionalLight){j.r+=A.r;j.g+=A.g;j.b+=A.b}else if(B instanceof THREE.PointLight){k.r+=A.r;k.g+=A.g;k.b+=A.b}}}H=0;for(S=q.length;H<S;H++){O=q[H];t.empty();if(O instanceof THREE.RenderableParticle){w=O;w.x*=C;w.y*=-E;B=0;for(A=O.material.length;B<A;B++)if(T=
+O.material[B]){W=w;ea=O;T=T;var ba=U++;if(r[ba]==null){r[ba]=document.createElementNS("http://www.w3.org/2000/svg","circle");z==0&&r[ba].setAttribute("shape-rendering","crispEdges")}x=r[ba];x.setAttribute("cx",W.x);x.setAttribute("cy",W.y);x.setAttribute("r",ea.scale.x*C);if(T instanceof THREE.ParticleCircleMaterial){if(f){i.r=o.r+j.r+k.r;i.g=o.g+j.g+k.g;i.b=o.b+j.b+k.b;e.r=T.color.r*i.r;e.g=T.color.g*i.g;e.b=T.color.b*i.b;e.updateStyleString()}else e=T.color;x.setAttribute("style","fill: "+e.__styleString)}b.appendChild(x)}}else if(O instanceof
+THREE.RenderableLine){w=O.v1;D=O.v2;w.positionScreen.x*=C;w.positionScreen.y*=-E;D.positionScreen.x*=C;D.positionScreen.y*=-E;t.addPoint(w.positionScreen.x,w.positionScreen.y);t.addPoint(D.positionScreen.x,D.positionScreen.y);if(M.instersects(t)){B=0;for(A=O.material.length;B<A;)if(T=O.material[B++]){W=w;ea=D;T=T;ba=P++;if(R[ba]==null){R[ba]=document.createElementNS("http://www.w3.org/2000/svg","line");z==0&&R[ba].setAttribute("shape-rendering","crispEdges")}x=R[ba];x.setAttribute("x1",W.positionScreen.x);
+x.setAttribute("y1",W.positionScreen.y);x.setAttribute("x2",ea.positionScreen.x);x.setAttribute("y2",ea.positionScreen.y);if(T instanceof THREE.LineBasicMaterial){e.__styleString=T.color.__styleString;x.setAttribute("style","fill: none; stroke: "+e.__styleString+"; stroke-width: "+T.linewidth+"; stroke-opacity: "+T.opacity+"; stroke-linecap: "+T.linecap+"; stroke-linejoin: "+T.linejoin);b.appendChild(x)}}}}else if(O instanceof THREE.RenderableFace3){w=O.v1;D=O.v2;N=O.v3;w.positionScreen.x*=C;w.positionScreen.y*=
+-E;D.positionScreen.x*=C;D.positionScreen.y*=-E;N.positionScreen.x*=C;N.positionScreen.y*=-E;t.addPoint(w.positionScreen.x,w.positionScreen.y);t.addPoint(D.positionScreen.x,D.positionScreen.y);t.addPoint(N.positionScreen.x,N.positionScreen.y);if(M.instersects(t)){B=0;for(A=O.meshMaterial.length;B<A;){T=O.meshMaterial[B++];if(T instanceof THREE.MeshFaceMaterial){W=0;for(ea=O.faceMaterial.length;W<ea;)(T=O.faceMaterial[W++])&&c(w,D,N,O,T,p)}else T&&c(w,D,N,O,T,p)}}}else if(O instanceof THREE.RenderableFace4){w=
+O.v1;D=O.v2;N=O.v3;J=O.v4;w.positionScreen.x*=C;w.positionScreen.y*=-E;D.positionScreen.x*=C;D.positionScreen.y*=-E;N.positionScreen.x*=C;N.positionScreen.y*=-E;J.positionScreen.x*=C;J.positionScreen.y*=-E;t.addPoint(w.positionScreen.x,w.positionScreen.y);t.addPoint(D.positionScreen.x,D.positionScreen.y);t.addPoint(N.positionScreen.x,N.positionScreen.y);t.addPoint(J.positionScreen.x,J.positionScreen.y);if(M.instersects(t)){B=0;for(A=O.meshMaterial.length;B<A;){T=O.meshMaterial[B++];if(T instanceof
+THREE.MeshFaceMaterial){W=0;for(ea=O.faceMaterial.length;W<ea;)(T=O.faceMaterial[W++])&&d(w,D,N,J,O,T,p)}else T&&d(w,D,N,J,O,T,p)}}}}}};
+THREE.WebGLRenderer=function(a){function c(f,e){var i=b.createProgram();b.attachShader(i,h("fragment","#ifdef GL_ES\nprecision highp float;\n#endif\n"+f));b.attachShader(i,h("vertex",e));b.linkProgram(i);if(!b.getProgramParameter(i,b.LINK_STATUS)){alert("Could not initialise shaders");alert("VALIDATE_STATUS: "+b.getProgramParameter(i,b.VALIDATE_STATUS));alert(b.getError())}i.uniforms={};return i}function d(f,e){var i,o,j;i=0;for(o=e.length;i<o;i++){j=e[i];f.uniforms[j]=b.getUniformLocation(f,j)}}
+function g(f){f.position=b.getAttribLocation(f,"position");b.enableVertexAttribArray(f.position);f.normal=b.getAttribLocation(f,"normal");b.enableVertexAttribArray(f.normal);f.uv=b.getAttribLocation(f,"uv");b.enableVertexAttribArray(f.uv)}function h(f,e){var i;if(f=="fragment")i=b.createShader(b.FRAGMENT_SHADER);else if(f=="vertex")i=b.createShader(b.VERTEX_SHADER);b.shaderSource(i,e);b.compileShader(i);if(!b.getShaderParameter(i,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(i));return null}return i}
+function q(f){switch(f){case THREE.Repeat:return b.REPEAT;case THREE.ClampToEdge:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeat:return b.MIRRORED_REPEAT}return 0}var m=document.createElement("canvas"),b,l,y,C=new THREE.Matrix4,E,w=new Float32Array(16),D=new Float32Array(16),N=new Float32Array(16),J=new Float32Array(9),M=new Float32Array(16);a=function(f,e){if(f){var i,o,j,k=pointLights=maxDirLights=maxPointLights=0;i=0;for(o=f.lights.length;i<o;i++){j=f.lights[i];j instanceof THREE.DirectionalLight&&
+k++;j instanceof THREE.PointLight&&pointLights++}if(pointLights+k<=e){maxDirLights=k;maxPointLights=pointLights}else{maxDirLights=Math.ceil(e*k/(pointLights+k));maxPointLights=e-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:e-1}}(a,4);this.domElement=m;this.autoClear=true;try{b=m.getContext("experimental-webgl",{antialias:true})}catch(t){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);
+b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(0,0,0,0);(function(f,e){var i=[f?"#define MAX_DIR_LIGHTS "+f:"",e?"#define MAX_POINT_LIGHTS "+e:"","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 ];":"",e?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",e?"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;",e?"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?"}":"",e?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",e?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",e?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
+"",e?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",e?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",e?"}":"","}\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"),
+o=[f?"#define MAX_DIR_LIGHTS "+f:"",e?"#define MAX_POINT_LIGHTS "+e:"","uniform int material;\nuniform bool enableMap;\nuniform bool enableCubeMap;\nuniform bool mixEnvMap;\nuniform samplerCube tCube;\nuniform float mReflectivity;\nuniform sampler2D tMap;\nuniform vec4 mColor;\nuniform float mOpacity;\nuniform vec4 mAmbient;\nuniform vec4 mSpecular;\nuniform float mShininess;\nuniform float m2Near;\nuniform float mFarPlusNear;\nuniform float mFarMinusNear;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;",
+f?"uniform mat4 viewMatrix;":"",f?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",e?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform vec3 cameraPosition;\nvoid main() {\nvec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nvec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nif ( enableMap ) {\nmapColor = texture2D( tMap, vUv );\n}\nif ( enableCubeMap ) {\ncubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n}\nif ( material == 5 ) { \nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( -wPos.x, wPos.yz ) );\n} else if ( material == 4 ) { \ngl_FragColor = vec4( 0.5*normalize( vNormal ) + vec3(0.5, 0.5, 0.5), mOpacity );\n} else if ( material == 3 ) { \nfloat w = 0.5;\ngl_FragColor = vec4( w, w, w, mOpacity );\n} else if ( material == 2 ) { \nvec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );",
+e?"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",e?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",e?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",e?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",e?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",e?"float pointSpecularWeight = 0.0;":"",e?"if ( pointDotNormalHalf >= 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","objMatrix","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<o;i++){j=e.lights[i];if(j instanceof THREE.AmbientLight)s.push(j);else if(j instanceof THREE.DirectionalLight)r.push(j);else j instanceof THREE.PointLight&&G.push(j)}i=j=k=n=0;for(o=s.length;i<o;i++){j+=s[i].color.r;k+=s[i].color.g;n+=s[i].color.b}b.uniform3f(f.uniforms.ambientLightColor,j,k,n);k=[];n=[];i=0;for(o=r.length;i<o;i++){j=r[i];k.push(j.color.r*j.intensity);k.push(j.color.g*j.intensity);k.push(j.color.b*j.intensity);n.push(j.position.x);n.push(j.position.y);
+n.push(j.position.z)}if(r.length){b.uniform1i(f.uniforms.directionalLightNumber,r.length);b.uniform3fv(f.uniforms.directionalLightDirection,n);b.uniform3fv(f.uniforms.directionalLightColor,k)}k=[];n=[];i=0;for(o=G.length;i<o;i++){j=G[i];k.push(j.color.r*j.intensity);k.push(j.color.g*j.intensity);k.push(j.color.b*j.intensity);n.push(j.position.x);n.push(j.position.y);n.push(j.position.z)}if(G.length){b.uniform1i(f.uniforms.pointLightNumber,G.length);b.uniform3fv(f.uniforms.pointLightPosition,n);b.uniform3fv(f.uniforms.pointLightColor,
+k)}};this.createBuffers=function(f,e){var i,o,j,k,n,s,G,r,R=[],x=[],u=[],U=[],P=[],z=0,p=f.materialFaceGroup[e],K;j=false;i=0;for(o=f.material.length;i<o;i++){meshMaterial=f.material[i];if(meshMaterial instanceof THREE.MeshFaceMaterial){n=0;for(K=p.material.length;n<K;n++)if(p.material[n]&&p.material[n].shading!=undefined&&p.material[n].shading==THREE.SmoothShading){j=true;break}}else if(meshMaterial&&meshMaterial.shading!=undefined&&meshMaterial.shading==THREE.SmoothShading){j=true;break}if(j)break}K=
+j;i=0;for(o=p.faces.length;i<o;i++){j=p.faces[i];k=f.geometry.faces[j];n=k.vertexNormals;faceNormal=k.normal;j=f.geometry.uvs[j];if(k instanceof THREE.Face3){s=f.geometry.vertices[k.a].position;G=f.geometry.vertices[k.b].position;r=f.geometry.vertices[k.c].position;u.push(s.x,s.y,s.z);u.push(G.x,G.y,G.z);u.push(r.x,r.y,r.z);if(n.length==3&&K)for(k=0;k<3;k++)U.push(n[k].x,n[k].y,n[k].z);else for(k=0;k<3;k++)U.push(faceNormal.x,faceNormal.y,faceNormal.z);if(j)for(k=0;k<3;k++)P.push(j[k].u,j[k].v);R.push(z,
+z+1,z+2);x.push(z,z+1);x.push(z,z+2);x.push(z+1,z+2);z+=3}else if(k instanceof THREE.Face4){s=f.geometry.vertices[k.a].position;G=f.geometry.vertices[k.b].position;r=f.geometry.vertices[k.c].position;k=f.geometry.vertices[k.d].position;u.push(s.x,s.y,s.z);u.push(G.x,G.y,G.z);u.push(r.x,r.y,r.z);u.push(k.x,k.y,k.z);if(n.length==4&&K)for(k=0;k<4;k++)U.push(n[k].x,n[k].y,n[k].z);else for(k=0;k<4;k++)U.push(faceNormal.x,faceNormal.y,faceNormal.z);if(j)for(k=0;k<4;k++)P.push(j[k].u,j[k].v);R.push(z,z+
+1,z+2);R.push(z,z+2,z+3);x.push(z,z+1);x.push(z,z+2);x.push(z,z+3);x.push(z+1,z+2);x.push(z+2,z+3);z+=4}}if(u.length){p.__webGLVertexBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(u),b.STATIC_DRAW);p.__webGLNormalBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(U),b.STATIC_DRAW);p.__webGLUVBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLUVBuffer);
+b.bufferData(b.ARRAY_BUFFER,new Float32Array(P),b.STATIC_DRAW);p.__webGLFaceBuffer=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(R),b.STATIC_DRAW);p.__webGLLineBuffer=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(x),b.STATIC_DRAW);p.__webGLFaceCount=R.length;p.__webGLLineCount=x.length}};this.renderBuffer=function(f,e,i){var o,j,k,n,s,G,r,
+R,x,u;if(e instanceof THREE.MeshShaderMaterial){if(!e.program){e.program=c(e.fragment_shader,e.vertex_shader);s=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objMatrix","cameraPosition"];for(u in e.uniforms)s.push(u);d(e.program,s);g(e.program)}u=e.program}else u=l;if(u!=y){b.useProgram(u);y=u}if(e instanceof THREE.MeshShaderMaterial){s=u;R=e.uniforms;var U,P;for(j in R){U=R[j].type;x=R[j].value;P=s.uniforms[j];if(U=="i")b.uniform1i(P,x);else if(U=="f")b.uniform1f(P,x);else if(U==
+"t"){b.uniform1i(P,x);x=R[j].texture;if(x instanceof THREE.TextureCube&&x.image.length==6){if(!x.image.__webGLTextureCube&&!x.image.__cubeMapInitialized&&x.image.loadCount==6){x.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,x.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,
+b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(U=0;U<6;++U)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+U,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,x.image[U]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);x.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_CUBE_MAP,x.image.__webGLTextureCube)}}}this.loadCamera(u,f);this.loadMatrices(u)}else if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshBasicMaterial){f=
+e.color;o=e.opacity;k=e.wireframe;n=e.wireframe_linewidth;G=e.map;r=e.env_map;s=e.combine==THREE.Mix;j=e.reflectivity;x=e.env_map&&e.env_map.mapping==THREE.RefractionMapping;R=e.refraction_ratio;b.uniform4f(u.uniforms.mColor,f.r*o,f.g*o,f.b*o,o);b.uniform1i(u.uniforms.mixEnvMap,s);b.uniform1f(u.uniforms.mReflectivity,j);b.uniform1i(u.uniforms.useRefract,x);b.uniform1f(u.uniforms.mRefractionRatio,R)}if(e instanceof THREE.MeshNormalMaterial){o=e.opacity;b.uniform1f(u.uniforms.mOpacity,o);b.uniform1i(u.uniforms.material,
+4)}else if(e instanceof THREE.MeshDepthMaterial){o=e.opacity;k=e.wireframe;n=e.wireframe_linewidth;b.uniform1f(u.uniforms.mOpacity,o);b.uniform1f(u.uniforms.m2Near,e.__2near);b.uniform1f(u.uniforms.mFarPlusNear,e.__farPlusNear);b.uniform1f(u.uniforms.mFarMinusNear,e.__farMinusNear);b.uniform1i(u.uniforms.material,3)}else if(e instanceof THREE.MeshPhongMaterial){f=e.ambient;j=e.specular;s=e.shininess;b.uniform4f(u.uniforms.mAmbient,f.r,f.g,f.b,o);b.uniform4f(u.uniforms.mSpecular,j.r,j.g,j.b,o);b.uniform1f(u.uniforms.mShininess,
+s);b.uniform1i(u.uniforms.material,2)}else if(e instanceof THREE.MeshLambertMaterial)b.uniform1i(u.uniforms.material,1);else if(e instanceof THREE.MeshBasicMaterial)b.uniform1i(u.uniforms.material,0);else if(e instanceof THREE.MeshCubeMaterial){b.uniform1i(u.uniforms.material,5);r=e.env_map}if(G){if(!e.map.__webGLTexture&&e.map.image.loaded){e.map.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,e.map.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.map.image);
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,q(e.map.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,q(e.map.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,e.map.__webGLTexture);b.uniform1i(u.uniforms.tMap,0);b.uniform1i(u.uniforms.enableMap,1)}else b.uniform1i(u.uniforms.enableMap,
+0);if(r){if(e.env_map&&e.env_map instanceof THREE.TextureCube&&e.env_map.image.length==6){if(!e.env_map.image.__webGLTextureCube&&!e.env_map.image.__cubeMapInitialized&&e.env_map.image.loadCount==6){e.env_map.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,e.env_map.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,
+b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(o=0;o<6;++o)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[o]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);e.env_map.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_CUBE_MAP,e.env_map.image.__webGLTextureCube);b.uniform1i(u.uniforms.tCube,1)}b.uniform1i(u.uniforms.enableCubeMap,1)}else b.uniform1i(u.uniforms.enableCubeMap,
+0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLVertexBuffer);b.vertexAttribPointer(u.position,3,b.FLOAT,false,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.vertexAttribPointer(u.normal,3,b.FLOAT,false,0,0);if(G){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUVBuffer);b.enableVertexAttribArray(u.uv);b.vertexAttribPointer(u.uv,2,b.FLOAT,false,0,0)}else b.disableVertexAttribArray(u.uv);if(k){b.lineWidth(n);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.drawElements(b.LINES,i.__webGLLineCount,
+b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,i.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,e,i,o,j){var k,n,s,G,r;s=0;for(G=e.material.length;s<G;s++){k=e.material[s];if(k instanceof THREE.MeshFaceMaterial){k=0;for(n=i.material.length;k<n;k++)if((r=i.material[k])&&r.blending==o&&r.opacity<1==j){this.setBlending(r.blending);this.renderBuffer(f,r,i)}}else if((r=k)&&r.blending==o&&r.opacity<1==j){this.setBlending(r.blending);
+this.renderBuffer(f,r,i)}}};this.render=function(f,e){var i,o;this.initWebGLObjects(f);this.autoClear&&this.clear();e.autoUpdateMatrix&&e.updateMatrix();this.loadCamera(l,e);this.setupLights(l,f);i=0;for(o=f.__webGLObjects.length;i<o;i++){webGLObject=f.__webGLObjects[i];if(webGLObject.__object.visible){this.setupMatrices(webGLObject.__object,e);this.loadMatrices(l);this.renderPass(e,webGLObject.__object,webGLObject,THREE.NormalBlending,false)}}i=0;for(o=f.__webGLObjects.length;i<o;i++){webGLObject=
+f.__webGLObjects[i];if(webGLObject.__object.visible){this.setupMatrices(webGLObject.__object,e);this.loadMatrices(l);this.renderPass(e,webGLObject.__object,webGLObject,THREE.AdditiveBlending,false);this.renderPass(e,webGLObject.__object,webGLObject,THREE.SubtractiveBlending,false);this.renderPass(e,webGLObject.__object,webGLObject,THREE.AdditiveBlending,true);this.renderPass(e,webGLObject.__object,webGLObject,THREE.SubtractiveBlending,true);this.renderPass(e,webGLObject.__object,webGLObject,THREE.NormalBlending,
+true)}}};this.initWebGLObjects=function(f){var e,i,o,j,k;if(!f.__webGLObjects)f.__webGLObjects=[];e=0;for(i=f.objects.length;e<i;e++){o=f.objects[e];if(o instanceof THREE.Mesh)for(j in o.materialFaceGroup){k=o.materialFaceGroup[j];if(!k.__webGLVertexBuffer){this.createBuffers(o,j);k.__object=o;f.__webGLObjects.push(k)}}}};this.removeObject=function(f,e){var i,o;for(i=f.__webGLObjects.length-1;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.objMatrix,
+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};

+ 169 - 169
build/ThreeDebug.js

@@ -1,169 +1,169 @@
-// ThreeDebug.js r29 - 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)+
-","+~~(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;
-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,h=[];a=0;for(c=g.length;a<c;a++){e=g[a];if(e instanceof THREE.Mesh)h=h.concat(this.intersectObject(e))}h.sort(function(q,m){return q.distance-m.distance});return h},intersectObject:function(a){function c(P,r,f,d){d=d.clone().subSelf(r);f=f.clone().subSelf(r);var i=P.clone().subSelf(r);P=d.dot(d);r=d.dot(f);d=d.dot(i);var o=f.dot(f);f=f.dot(i);i=1/(P*o-r*r);o=(o*d-r*f)*i;P=(P*f-r*d)*i;return o>0&&P>0&&o+P<1}var e,g,h,q,m,b,l,y,E,I,
-w,F=a.geometry,Q=F.vertices,O=[];e=0;for(g=F.faces.length;e<g;e++){h=F.faces[e];I=this.origin.clone();w=this.direction.clone();q=a.matrix.transform(Q[h.a].position.clone());m=a.matrix.transform(Q[h.b].position.clone());b=a.matrix.transform(Q[h.c].position.clone());l=h instanceof THREE.Face4?a.matrix.transform(Q[h.d].position.clone()):null;y=a.rotationMatrix.transform(h.normal.clone());E=w.dot(y);if(E<0){y=y.dot((new THREE.Vector3).sub(q,I))/E;I=I.addSelf(w.multiplyScalar(y));if(h instanceof THREE.Face3){if(c(I,
-q,m,b)){h={distance:this.origin.distanceTo(I),point:I,face:h,object:a};O.push(h)}}else if(h instanceof THREE.Face4)if(c(I,q,m,l)||c(I,m,b,l)){h={distance:this.origin.distanceTo(I),point:I,face:h,object:a};O.push(h)}}}return O}};
-THREE.Rectangle=function(){function a(){q=g-c;m=h-e}var c,e,g,h,q,m,b=true;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return q};this.getHeight=function(){return m};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return g};this.getBottom=function(){return h};this.set=function(l,y,E,I){b=false;c=l;e=y;g=E;h=I;a()};this.addPoint=function(l,y){if(b){b=false;c=l;e=y;g=l;h=y}else{c=Math.min(c,l);e=Math.min(e,y);g=Math.max(g,
-l);h=Math.max(h,y)}a()};this.addRectangle=function(l){if(b){b=false;c=l.getLeft();e=l.getTop();g=l.getRight();h=l.getBottom()}else{c=Math.min(c,l.getLeft());e=Math.min(e,l.getTop());g=Math.max(g,l.getRight());h=Math.max(h,l.getBottom())}a()};this.inflate=function(l){c-=l;e-=l;g+=l;h+=l;a()};this.minSelf=function(l){c=Math.max(c,l.getLeft());e=Math.max(e,l.getTop());g=Math.min(g,l.getRight());h=Math.min(h,l.getBottom());a()};this.instersects=function(l){return Math.min(g,l.getRight())-Math.max(c,l.getLeft())>=
-0&&Math.min(h,l.getBottom())-Math.max(e,l.getTop())>=0};this.empty=function(){b=true;h=g=e=c=0;a()};this.isEmpty=function(){return b};this.toString=function(){return"THREE.Rectangle ( left: "+c+", right: "+g+", top: "+e+", 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,h=new THREE.Vector3,q=new THREE.Vector3;q.sub(a,c).normalize();g.cross(e,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},transform:function(a){var c=a.x,e=a.y,g=a.z,h=a.w||1;a.x=this.n11*c+this.n12*
-e+this.n13*g+this.n14*h;a.y=this.n21*c+this.n22*e+this.n23*g+this.n24*h;a.z=this.n31*c+this.n32*e+this.n33*g+this.n34*h;h=this.n41*c+this.n42*e+this.n43*g+this.n44*h;if(a.w)a.w=h;else{c=1/h;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,h=this.n14,
-q=this.n21,m=this.n22,b=this.n23,l=this.n24,y=this.n31,E=this.n32,I=this.n33,w=this.n34,F=this.n41,Q=this.n42,O=this.n43,P=this.n44;this.n11=c*a.n11+e*a.n21+g*a.n31+h*a.n41;this.n12=c*a.n12+e*a.n22+g*a.n32+h*a.n42;this.n13=c*a.n13+e*a.n23+g*a.n33+h*a.n43;this.n14=c*a.n14+e*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+E*a.n21+I*a.n31+w*a.n41;
-this.n32=y*a.n12+E*a.n22+I*a.n32+w*a.n42;this.n33=y*a.n13+E*a.n23+I*a.n33+w*a.n43;this.n34=y*a.n14+E*a.n24+I*a.n34+w*a.n44;this.n41=F*a.n11+Q*a.n21+O*a.n31+P*a.n41;this.n42=F*a.n12+Q*a.n22+O*a.n32+P*a.n42;this.n43=F*a.n13+Q*a.n23+O*a.n33+P*a.n43;this.n44=F*a.n14+Q*a.n24+O*a.n34+P*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 h=c[e];c[e]=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,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};
-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),h=Math.sin(c),q=1-g,m=a.x,b=a.y,l=a.z;e.n11=q*m*m+g;e.n12=q*m*b-h*l;e.n13=q*m*l+h*b;e.n21=q*m*b+h*l;e.n22=q*b*b+g;e.n23=q*b*l-h*m;e.n31=q*m*l-h*b;e.n32=q*b*l+h*m;e.n33=q*l*l+g;return e};
-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],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],E=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*q+c[2]*l;if(c==0)throw"matrix not invertible";c=1/c;a.m[0]=c*e;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*E;return a};
-THREE.Matrix4.makeFrustum=function(a,c,e,g,h,q){var m,b,l;m=new THREE.Matrix4;b=2*h/(c-a);l=2*h/(g-e);a=(c+a)/(c-a);e=(g+e)/(g-e);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=e;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,e,g){var h;a=e*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,e,g)};
-THREE.Matrix4.makeOrtho=function(a,c,e,g,h,q){var m,b,l,y;m=new THREE.Matrix4;b=c-a;l=e-g;y=q-h;a=(c+a)/b;e=(e+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=-e;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,h){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=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,c,e,g,h,q){this.a=a;this.b=c;this.c=e;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<c;a++){e=this.faces[a];e.centroid.set(0,0,0);e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);if(e instanceof THREE.Face3)e.centroid.divideScalar(3);else if(e instanceof THREE.Face4){e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeNormals:function(a){var c,e,g,h,q,m,b=new THREE.Vector3,
-l=new THREE.Vector3;g=0;for(h=this.vertices.length;g<h;g++){q=this.vertices[g];q.normal.set(0,0,0)}g=0;for(h=this.faces.length;g<h;g++){q=this.faces[g];if(a&&q.vertexNormals.length){b.set(0,0,0);c=0;for(e=q.normal.length;c<e;c++)b.addSelf(q.vertexNormals[c]);b.divideScalar(3)}else{c=this.vertices[q.a];e=this.vertices[q.b];m=this.vertices[q.c];b.sub(m.position,e.position);l.sub(c.position,e.position);b.crossSelf(l)}b.isZero()||b.normalize();q.normal.copy(b)}},computeBoundingBox:function(){if(this.vertices.length>
-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;a<c;a++){vertex=this.vertices[a];if(vertex.position.x<this.bbox.x[0])this.bbox.x[0]=vertex.position.x;else if(vertex.position.x>this.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.y<this.bbox.y[0])this.bbox.y[0]=vertex.position.y;else if(vertex.position.y>
-this.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.z<this.bbox.z[0])this.bbox.z[0]=vertex.position.z;else if(vertex.position.z>this.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.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(E){var I=[];c=0;for(e=E.length;c<e;c++)E[c]==undefined?I.push("undefined"):I.push(E[c].toString());return I.join("_")}var c,e,g,h,q,m,b,l,y={};g=0;for(h=this.geometry.faces.length;g<h;g++){q=this.geometry.faces[g];m=q.material;b=a(m);if(y[b]==undefined)y[b]={hash:b,counter:0};l=y[b].hash+"_"+y[b].counter;if(this.materialFaceGroup[l]==undefined)this.materialFaceGroup[l]={faces:[],material:m,vertices:0};q=q instanceof THREE.Face3?3:4;if(this.materialFaceGroup[l].vertices+
-q>65535){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,e,g,h;a=0;for(c=this.geometry.uvs.length;a<c;a++){h=this.geometry.uvs[a];e=0;for(g=h.length;e<g;e++){if(h[e].u!=1)h[e].u-=Math.floor(h[e].u);if(h[e].v!=1)h[e].v-=Math.floor(h[e].v)}}};THREE.FlatShading=0;
-THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
-THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16711680);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";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;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}this.toString=function(){return"THREE.LineBasicMaterial (<br/>color: "+
-this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
-THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(15658734);this.env_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.env_map!==
-undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+
-this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
-THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(15658734);this.env_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;
-if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+
-this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
-THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(15658734);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;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.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
-a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
-this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>"+ +")"}};THREE.MeshPhongMaterialCounter={value:0};
-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+"<br/>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 (<br/>id: "+this.id+"<br/>blending: "+
-this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};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 (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+
-this.blending+"<br/>)"}};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 (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
-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 (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>)"}};
-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 (<br/>image: "+this.image+"<br/>mapping: "+this.mapping+"<br/>)"}};
-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(f,d){var i=0,o=1,k=f.z+f.w,j=d.z+d.w,n=-f.z+f.w,t=-d.z+d.w;if(k>=0&&j>=0&&n>=0&&t>=0)return true;else if(k<0&&j<0||n<0&&t<0)return false;else{if(k<0)i=Math.max(i,k/(k-j));else if(j<0)o=Math.min(o,k/(k-j));if(n<0)i=Math.max(i,n/(n-t));else if(t<0)o=Math.min(o,n/(n-t));if(o<i)return false;else{f.lerpSelf(d,i);d.lerpSelf(f,1-o);return true}}}var c=null,e,g,h,q=[],m,b,l=[],y,E,I=[],w=new THREE.Vector4,F=new THREE.Matrix4,Q=new THREE.Matrix4,O=new THREE.Vector4,P=
-new THREE.Vector4,r;this.projectScene=function(f,d){var i,o,k,j,n,t,R,s,T,x,v,U,J,z,p,B,N;c=[];h=_face4Count=b=E=0;d.autoUpdateMatrix&&d.updateMatrix();F.multiply(d.projectionMatrix,d.matrix);R=f.objects;i=0;for(o=R.length;i<o;i++){s=R[i];s.autoUpdateMatrix&&s.updateMatrix();T=s.matrix;x=s.rotationMatrix;v=s.material;U=s.overdraw;if(s instanceof THREE.Mesh){J=s.geometry.vertices;k=0;for(j=J.length;k<j;k++){z=J[k];z.positionWorld.copy(z.position);T.transform(z.positionWorld);p=z.positionScreen;p.copy(z.positionWorld);
-F.transform(p);p.multiplyScalar(1/p.w);z.__visible=p.z>0&&p.z<1}z=s.geometry.faces;k=0;for(j=z.length;k<j;k++){p=z[k];if(p instanceof THREE.Face3){n=J[p.a];t=J[p.b];B=J[p.c];if(n.__visible&&t.__visible&&B.__visible)if(s.doubleSided||s.flipSided!=(B.positionScreen.x-n.positionScreen.x)*(t.positionScreen.y-n.positionScreen.y)-(B.positionScreen.y-n.positionScreen.y)*(t.positionScreen.x-n.positionScreen.x)<0){e=q[h]=q[h]||new THREE.RenderableFace3;e.v1.positionWorld.copy(n.positionWorld);e.v2.positionWorld.copy(t.positionWorld);
-e.v3.positionWorld.copy(B.positionWorld);e.v1.positionScreen.copy(n.positionScreen);e.v2.positionScreen.copy(t.positionScreen);e.v3.positionScreen.copy(B.positionScreen);e.normalWorld.copy(p.normal);x.transform(e.normalWorld);e.centroidWorld.copy(p.centroid);T.transform(e.centroidWorld);e.centroidScreen.copy(e.centroidWorld);F.transform(e.centroidScreen);B=p.vertexNormals;r=e.vertexNormalsWorld;n=0;for(t=B.length;n<t;n++){N=r[n].copy(B[n]);x.transform(N)}e.z=e.centroidScreen.z;e.meshMaterial=v;e.faceMaterial=
-p.material;e.overdraw=U;if(s.geometry.uvs[k]){e.uvs[0]=s.geometry.uvs[k][0];e.uvs[1]=s.geometry.uvs[k][1];e.uvs[2]=s.geometry.uvs[k][2]}c.push(e);h++}}else if(p instanceof THREE.Face4){n=J[p.a];t=J[p.b];B=J[p.c];N=J[p.d];if(n.__visible&&t.__visible&&B.__visible&&N.__visible)if(s.doubleSided||s.flipSided!=((N.positionScreen.x-n.positionScreen.x)*(t.positionScreen.y-n.positionScreen.y)-(N.positionScreen.y-n.positionScreen.y)*(t.positionScreen.x-n.positionScreen.x)<0||(t.positionScreen.x-B.positionScreen.x)*
-(N.positionScreen.y-B.positionScreen.y)-(t.positionScreen.y-B.positionScreen.y)*(N.positionScreen.x-B.positionScreen.x)<0)){e=q[h]=q[h]||new THREE.RenderableFace3;e.v1.positionWorld.copy(n.positionWorld);e.v2.positionWorld.copy(t.positionWorld);e.v3.positionWorld.copy(N.positionWorld);e.v1.positionScreen.copy(n.positionScreen);e.v2.positionScreen.copy(t.positionScreen);e.v3.positionScreen.copy(N.positionScreen);e.normalWorld.copy(p.normal);x.transform(e.normalWorld);e.centroidWorld.copy(p.centroid);
-T.transform(e.centroidWorld);e.centroidScreen.copy(e.centroidWorld);F.transform(e.centroidScreen);e.z=e.centroidScreen.z;e.meshMaterial=v;e.faceMaterial=p.material;e.overdraw=U;if(s.geometry.uvs[k]){e.uvs[0]=s.geometry.uvs[k][0];e.uvs[1]=s.geometry.uvs[k][1];e.uvs[2]=s.geometry.uvs[k][3]}c.push(e);h++;g=q[h]=q[h]||new THREE.RenderableFace3;g.v1.positionWorld.copy(t.positionWorld);g.v2.positionWorld.copy(B.positionWorld);g.v3.positionWorld.copy(N.positionWorld);g.v1.positionScreen.copy(t.positionScreen);
-g.v2.positionScreen.copy(B.positionScreen);g.v3.positionScreen.copy(N.positionScreen);g.normalWorld.copy(e.normalWorld);g.centroidWorld.copy(e.centroidWorld);g.centroidScreen.copy(e.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterial=v;g.faceMaterial=p.material;g.overdraw=U;if(s.geometry.uvs[k]){g.uvs[0]=s.geometry.uvs[k][1];g.uvs[1]=s.geometry.uvs[k][2];g.uvs[2]=s.geometry.uvs[k][3]}c.push(g);h++}}}}else if(s instanceof THREE.Line){Q.multiply(F,T);J=s.geometry.vertices;z=J[0];z.positionScreen.copy(z.position);
-Q.transform(z.positionScreen);k=1;for(j=J.length;k<j;k++){n=J[k];n.positionScreen.copy(n.position);Q.transform(n.positionScreen);t=J[k-1];O.copy(n.positionScreen);P.copy(t.positionScreen);if(a(O,P)){O.multiplyScalar(1/O.w);P.multiplyScalar(1/P.w);m=l[b]=l[b]||new THREE.RenderableLine;m.v1.positionScreen.copy(O);m.v2.positionScreen.copy(P);m.z=Math.max(O.z,P.z);m.material=s.material;c.push(m);b++}}}else if(s instanceof THREE.Particle){w.set(s.position.x,s.position.y,s.position.z,1);F.transform(w);
-w.z/=w.w;if(w.z>0&&w.z<1){y=I[E]=I[E]||new THREE.RenderableParticle;y.x=w.x/w.w;y.y=w.y/w.w;y.z=w.z;y.rotation=s.rotation.z;y.scale.x=s.scale.x*Math.abs(y.x-(w.x+d.projectionMatrix.n11)/(w.w+d.projectionMatrix.n14));y.scale.y=s.scale.y*Math.abs(y.y-(w.y+d.projectionMatrix.n22)/(w.w+d.projectionMatrix.n24));y.material=s.material;c.push(y);E++}}}c.sort(function(Y,C){return C.z-Y.z});return c};this.unprojectVector=function(f,d){var i=new THREE.Matrix4;i.multiply(THREE.Matrix4.makeInvert(d.matrix),THREE.Matrix4.makeInvert(d.projectionMatrix));
-i.transform(f);return f}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,e,g,h,q;this.domElement=document.createElement("div");this.setSize=function(m,b){e=m;g=b;h=e/2;q=g/2};this.render=function(m,b){var l,y,E,I,w,F,Q,O;a=c.projectScene(m,b);l=0;for(y=a.length;l<y;l++){w=a[l];if(w instanceof THREE.RenderableParticle){Q=w.x*h+h;O=w.y*q+q;E=0;for(I=w.material.length;E<I;E++){F=w.material[E];if(F instanceof THREE.ParticleDOMMaterial){F=F.domElement;F.style.left=Q+"px";F.style.top=O+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(G,X,S,D){var u,K,$,L,W=G.lights;G=0;for(u=W.length;G<u;G++){K=W[G];$=K.color;L=K.intensity;if(K instanceof THREE.DirectionalLight){K=S.dot(K.position)*L;if(K>0){D.r+=$.r*K;D.g+=$.g*K;D.b+=$.b*K}}else if(K instanceof THREE.PointLight){ra.sub(K.position,X);ra.normalize();K=S.dot(ra)*L;if(K>0){D.r+=$.r*K;D.g+=$.g*K;D.b+=$.b*K}}}}function c(G,X,S,D,u,K){if(u.opacity!=0){q(u.opacity);m(u.blending);R=G.positionScreen.x;s=G.positionScreen.y;T=X.positionScreen.x;
-x=X.positionScreen.y;v=S.positionScreen.x;U=S.positionScreen.y;var $=R,L=s,W=T,aa=x,Z=v,ca=U;r.beginPath();r.moveTo($,L);r.lineTo(W,aa);r.lineTo(Z,ca);r.lineTo($,L);r.closePath();if(u instanceof THREE.MeshBasicMaterial)if(u.map)h(R,s,T,x,v,U,u.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);else u.wireframe?e(u.color.__styleString,u.wireframe_linewidth):g(u.color.__styleString);else if(u instanceof THREE.MeshLambertMaterial){if(u.map&&!u.wireframe){h(R,s,T,x,v,U,u.map.image,
-D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);m(THREE.SubtractiveBlending)}if(da)if(u.shading==THREE.SmoothShading&&!u.wireframe){z.r=p.r=B.r=ea.r;z.g=p.g=B.g=ea.g;z.b=p.b=B.b=ea.b;a(K,D.v1.positionWorld,D.vertexNormalsWorld[0],z);a(K,D.v2.positionWorld,D.vertexNormalsWorld[1],p);a(K,D.v3.positionWorld,D.vertexNormalsWorld[2],B);N.r=(p.r+B.r)*0.5;N.g=(p.g+B.g)*0.5;N.b=(p.b+B.b)*0.5;V=b(z,p,B,N);h(R,s,T,x,v,U,V,0,0,1,0,0,1)}else{fa.r=ea.r;fa.g=ea.g;fa.b=ea.b;a(K,D.centroidWorld,
-D.normalWorld,fa);J.r=u.color.r*fa.r;J.g=u.color.g*fa.g;J.b=u.color.b*fa.b;J.updateStyleString();u.wireframe?e(J.__styleString,u.wireframe_linewidth):g(J.__styleString)}else u.wireframe?e(u.color.__styleString,u.wireframe_linewidth):g(u.color.__styleString)}else if(u instanceof THREE.MeshDepthMaterial){Y=u.__2near;C=u.__farPlusNear;A=u.__farMinusNear;z.r=z.g=z.b=1-Y/(C-G.positionScreen.z*A);p.r=p.g=p.b=1-Y/(C-X.positionScreen.z*A);B.r=B.g=B.b=1-Y/(C-S.positionScreen.z*A);N.r=(p.r+B.r)*0.5;N.g=(p.g+
-B.g)*0.5;N.b=(p.b+B.b)*0.5;V=b(z,p,B,N);h(R,s,T,x,v,U,V,0,0,1,0,0,1)}else if(u instanceof THREE.MeshNormalMaterial){J.r=l(D.normalWorld.x);J.g=l(D.normalWorld.y);J.b=l(D.normalWorld.z);J.updateStyleString();u.wireframe?e(J.__styleString,u.wireframe_linewidth):g(J.__styleString)}}}function e(G,X){if(i!=G)r.strokeStyle=i=G;if(k!=X)r.lineWidth=k=X;r.stroke()}function g(G){if(o!=G)r.fillStyle=o=G;r.fill()}function h(G,X,S,D,u,K,$,L,W,aa,Z,ca,ja){var ia=$.width-1,ga=$.height-1;L*=ia;W*=ga;aa*=ia;Z*=ga;
-ca*=ia;ja*=ga;S-=G;D-=X;u-=G;K-=X;aa-=L;Z-=W;ca-=L;ja-=W;ga=1/(aa*ja-ca*Z);ia=(ja*S-Z*u)*ga;Z=(ja*D-Z*K)*ga;S=(aa*u-ca*S)*ga;D=(aa*K-ca*D)*ga;G=G-ia*L-S*W;X=X-Z*L-D*W;r.save();r.transform(ia,Z,S,D,G,X);r.clip();r.drawImage($,0,0);r.restore()}function q(G){if(f!=G)r.globalAlpha=f=G}function m(G){if(d!=G){switch(G){case THREE.NormalBlending:r.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:r.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:r.globalCompositeOperation=
-"darker"}d=G}}function b(G,X,S,D){ha[0]=~~(G.r*255);ha[1]=~~(G.g*255);ha[2]=~~(G.b*255);ha[4]=~~(X.r*255);ha[5]=~~(X.g*255);ha[6]=~~(X.b*255);ha[8]=~~(S.r*255);ha[9]=~~(S.g*255);ha[10]=~~(S.b*255);ha[12]=~~(D.r*255);ha[13]=~~(D.g*255);ha[14]=~~(D.b*255);na.putImageData(sa,0,0);qa.drawImage(oa,0,0);return pa}function l(G){return G<0?Math.min((1+G)*0.5,0.5):0.5+Math.min(G*0.5,0.5)}function y(G,X){var S=X.x-G.x,D=X.y-G.y,u=1/Math.sqrt(S*S+D*D);S*=u;D*=u;X.x+=S;X.y+=D;G.x-=S;G.y-=D}var E=null,I=new THREE.Projector,
-w=document.createElement("canvas"),F,Q,O,P,r=w.getContext("2d"),f=1,d=0,i=null,o=null,k=1,j,n,t,R,s,T,x,v,U,J=new THREE.Color,z=new THREE.Color,p=new THREE.Color,B=new THREE.Color,N=new THREE.Color,Y,C,A,V,ba=new THREE.Rectangle,H=new THREE.Rectangle,M=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=w;this.autoClear=true;this.setSize=function(G,X){F=G;Q=X;O=F/2;P=Q/2;w.width=F;w.height=Q;ba.set(-O,-P,O,P)};this.clear=function(){if(!H.isEmpty()){H.inflate(1);H.minSelf(ba);r.clearRect(H.getX(),H.getY(),H.getWidth(),H.getHeight());
-H.empty()}};this.render=function(G,X){var S,D,u,K,$,L,W,aa;r.setTransform(1,0,0,-1,O,P);this.autoClear&&this.clear();E=I.projectScene(G,X);r.fillStyle="rgba(0, 255, 255, 0.5)";r.fillRect(ba.getX(),ba.getY(),ba.getWidth(),ba.getHeight());if(da=G.lights.length>0){$=G.lights;ea.setRGB(0,0,0);ka.setRGB(0,0,0);la.setRGB(0,0,0);S=0;for(D=$.length;S<D;S++){u=$[S];K=u.color;if(u instanceof THREE.AmbientLight){ea.r+=K.r;ea.g+=K.g;ea.b+=K.b}else if(u instanceof THREE.DirectionalLight){ka.r+=K.r;ka.g+=K.g;ka.b+=
-K.b}else if(u instanceof THREE.PointLight){la.r+=K.r;la.g+=K.g;la.b+=K.b}}}S=0;for(D=E.length;S<D;S++){u=E[S];M.empty();if(u instanceof THREE.RenderableParticle){j=u;j.x*=O;j.y*=P;K=0;for($=u.material.length;K<$;K++)a:{L=j;W=u;var Z=u.material[K];if(Z.opacity!=0){q(Z.opacity);m(Z.blending);aa=void 0;var ca=void 0,ja=void 0,ia=void 0,ga=void 0,ta=void 0,ua=void 0;if(Z instanceof THREE.ParticleBasicMaterial){if(Z.map){ga=Z.map;ta=ga.width>>1;ua=ga.height>>1;ja=W.scale.x*O;ia=W.scale.y*P;aa=ja*ta;ca=
-ia*ua;M.set(L.x-aa,L.y-ca,L.x+aa,L.y+ca);if(!ba.instersects(M))break a;r.save();r.translate(L.x,L.y);r.rotate(-W.rotation);r.scale(ja,-ia);r.translate(-ta,-ua);r.drawImage(ga,0,0);r.restore()}r.beginPath();r.moveTo(L.x-10,L.y);r.lineTo(L.x+10,L.y);r.moveTo(L.x,L.y-10);r.lineTo(L.x,L.y+10);r.closePath();r.strokeStyle="rgb(255,255,0)";r.stroke()}else if(Z 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;J.r=Z.color.r*fa.r;J.g=Z.color.g*fa.g;
-J.b=Z.color.b*fa.b;J.updateStyleString()}else J.__styleString=Z.color.__styleString;aa=W.scale.x*O;ca=W.scale.y*P;M.set(L.x-aa,L.y-ca,L.x+aa,L.y+ca);if(ba.instersects(M)){Z=J.__styleString;if(o!=Z)r.fillStyle=o=Z;r.save();r.translate(L.x,L.y);r.rotate(-W.rotation);r.scale(aa,ca);r.beginPath();r.arc(0,0,1,0,va,true);r.closePath();r.fill();r.restore()}}}}}else if(u instanceof THREE.RenderableLine){j=u.v1;n=u.v2;j.positionScreen.x*=O;j.positionScreen.y*=P;n.positionScreen.x*=O;n.positionScreen.y*=P;
-M.addPoint(j.positionScreen.x,j.positionScreen.y);M.addPoint(n.positionScreen.x,n.positionScreen.y);if(ba.instersects(M)){K=0;for($=u.material.length;K<$;){W=j;aa=n;L=u.material[K++];if(L.opacity!=0){q(L.opacity);m(L.blending);r.beginPath();r.moveTo(W.positionScreen.x,W.positionScreen.y);r.lineTo(aa.positionScreen.x,aa.positionScreen.y);r.closePath();if(L instanceof THREE.LineBasicMaterial){J.__styleString=L.color.__styleString;W=L.linewidth;if(k!=W)r.lineWidth=k=W;W=J.__styleString;if(i!=W)r.strokeStyle=
-i=W;r.stroke();M.inflate(L.linewidth*2)}}}}}else if(u instanceof THREE.RenderableFace3){j=u.v1;n=u.v2;t=u.v3;j.positionScreen.x*=O;j.positionScreen.y*=P;n.positionScreen.x*=O;n.positionScreen.y*=P;t.positionScreen.x*=O;t.positionScreen.y*=P;if(u.overdraw){y(j.positionScreen,n.positionScreen);y(n.positionScreen,t.positionScreen);y(t.positionScreen,j.positionScreen)}M.addPoint(j.positionScreen.x,j.positionScreen.y);M.addPoint(n.positionScreen.x,n.positionScreen.y);M.addPoint(t.positionScreen.x,t.positionScreen.y);
-if(ba.instersects(M)){K=0;for($=u.meshMaterial.length;K<$;){aa=u.meshMaterial[K++];if(aa instanceof THREE.MeshFaceMaterial){L=0;for(W=u.faceMaterial.length;L<W;)(aa=u.faceMaterial[L++])&&c(j,n,t,u,aa,G)}else c(j,n,t,u,aa,G)}}}H.addRectangle(M)}r.lineWidth=1;r.strokeStyle="rgba( 255, 0, 0, 0.5 )";r.strokeRect(H.getX(),H.getY(),H.getWidth(),H.getHeight());r.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(p,B,N){var Y,C,A,V;Y=0;for(C=p.lights.length;Y<C;Y++){A=p.lights[Y];if(A instanceof THREE.DirectionalLight){V=B.normalWorld.dot(A.position)*A.intensity;if(V>0){N.r+=A.color.r*V;N.g+=A.color.g*V;N.b+=A.color.b*V}}else if(A instanceof THREE.PointLight){t.sub(A.position,B.centroidWorld);t.normalize();V=B.normalWorld.dot(t)*A.intensity;if(V>0){N.r+=A.color.r*V;N.g+=A.color.g*V;N.b+=A.color.b*V}}}}function c(p,B,N,Y,C,A){x=g(v++);x.setAttribute("d","M "+p.positionScreen.x+
-" "+p.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+N.positionScreen.x+","+N.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)d.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshLambertMaterial)if(f){i.r=o.r;i.g=o.g;i.b=o.b;a(A,Y,i);d.r=C.color.r*i.r;d.g=C.color.g*i.g;d.b=C.color.b*i.b;d.updateStyleString()}else d.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshDepthMaterial){n=1-C.__2near/(C.__farPlusNear-Y.z*C.__farMinusNear);
-d.setRGB(n,n,n)}else C instanceof THREE.MeshNormalMaterial&&d.setRGB(h(Y.normalWorld.x),h(Y.normalWorld.y),h(Y.normalWorld.z));C.wireframe?x.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+C.wireframe_linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframe_linecap+"; stroke-linejoin: "+C.wireframe_linejoin):x.setAttribute("style","fill: "+d.__styleString+"; fill-opacity: "+C.opacity);b.appendChild(x)}function e(p,B,N,Y,C,A,V){x=g(v++);x.setAttribute("d",
-"M "+p.positionScreen.x+" "+p.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+N.positionScreen.x+","+N.positionScreen.y+" L "+Y.positionScreen.x+","+Y.positionScreen.y+"z");if(A instanceof THREE.MeshBasicMaterial)d.__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(V,C,i);d.r=A.color.r*i.r;d.g=A.color.g*i.g;d.b=A.color.b*i.b;d.updateStyleString()}else d.__styleString=A.color.__styleString;else if(A instanceof THREE.MeshDepthMaterial){n=
-1-A.__2near/(A.__farPlusNear-C.z*A.__farMinusNear);d.setRGB(n,n,n)}else A instanceof THREE.MeshNormalMaterial&&d.setRGB(h(C.normalWorld.x),h(C.normalWorld.y),h(C.normalWorld.z));A.wireframe?x.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+A.wireframe_linewidth+"; stroke-opacity: "+A.opacity+"; stroke-linecap: "+A.wireframe_linecap+"; stroke-linejoin: "+A.wireframe_linejoin):x.setAttribute("style","fill: "+d.__styleString+"; fill-opacity: "+A.opacity);b.appendChild(x)}
-function g(p){if(R[p]==null){R[p]=document.createElementNS("http://www.w3.org/2000/svg","path");z==0&&R[p].setAttribute("shape-rendering","crispEdges");return R[p]}return R[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,E,I,w,F,Q,O,P=new THREE.Rectangle,r=new THREE.Rectangle,f=false,d=new THREE.Color(16777215),i=new THREE.Color(16777215),o=new THREE.Color(0),k=new THREE.Color(0),
-j=new THREE.Color(0),n,t=new THREE.Vector3,R=[],s=[],T=[],x,v,U,J,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,B){l=p;y=B;E=l/2;I=y/2;b.setAttribute("viewBox",-E+" "+-I+" "+l+" "+y);b.setAttribute("width",l);b.setAttribute("height",y);P.set(-E,-I,E,I)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};this.render=function(p,B){var N,Y,C,A,V,ba,H,M;this.autoClear&&this.clear();
-q=m.projectScene(p,B);J=U=v=0;if(f=p.lights.length>0){H=p.lights;o.setRGB(0,0,0);k.setRGB(0,0,0);j.setRGB(0,0,0);N=0;for(Y=H.length;N<Y;N++){C=H[N];A=C.color;if(C instanceof THREE.AmbientLight){o.r+=A.r;o.g+=A.g;o.b+=A.b}else if(C instanceof THREE.DirectionalLight){k.r+=A.r;k.g+=A.g;k.b+=A.b}else if(C instanceof THREE.PointLight){j.r+=A.r;j.g+=A.g;j.b+=A.b}}}N=0;for(Y=q.length;N<Y;N++){H=q[N];r.empty();if(H instanceof THREE.RenderableParticle){w=H;w.x*=E;w.y*=-I;C=0;for(A=H.material.length;C<A;C++)if(M=
-H.material[C]){V=w;ba=H;M=M;var da=U++;if(s[da]==null){s[da]=document.createElementNS("http://www.w3.org/2000/svg","circle");z==0&&s[da].setAttribute("shape-rendering","crispEdges")}x=s[da];x.setAttribute("cx",V.x);x.setAttribute("cy",V.y);x.setAttribute("r",ba.scale.x*E);if(M instanceof THREE.ParticleCircleMaterial){if(f){i.r=o.r+k.r+j.r;i.g=o.g+k.g+j.g;i.b=o.b+k.b+j.b;d.r=M.color.r*i.r;d.g=M.color.g*i.g;d.b=M.color.b*i.b;d.updateStyleString()}else d=M.color;x.setAttribute("style","fill: "+d.__styleString)}b.appendChild(x)}}else if(H instanceof
-THREE.RenderableLine){w=H.v1;F=H.v2;w.positionScreen.x*=E;w.positionScreen.y*=-I;F.positionScreen.x*=E;F.positionScreen.y*=-I;r.addPoint(w.positionScreen.x,w.positionScreen.y);r.addPoint(F.positionScreen.x,F.positionScreen.y);if(P.instersects(r)){C=0;for(A=H.material.length;C<A;)if(M=H.material[C++]){V=w;ba=F;M=M;da=J++;if(T[da]==null){T[da]=document.createElementNS("http://www.w3.org/2000/svg","line");z==0&&T[da].setAttribute("shape-rendering","crispEdges")}x=T[da];x.setAttribute("x1",V.positionScreen.x);
-x.setAttribute("y1",V.positionScreen.y);x.setAttribute("x2",ba.positionScreen.x);x.setAttribute("y2",ba.positionScreen.y);if(M instanceof THREE.LineBasicMaterial){d.__styleString=M.color.__styleString;x.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+M.linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.linecap+"; stroke-linejoin: "+M.linejoin);b.appendChild(x)}}}}else if(H instanceof THREE.RenderableFace3){w=H.v1;F=H.v2;Q=H.v3;w.positionScreen.x*=E;w.positionScreen.y*=
--I;F.positionScreen.x*=E;F.positionScreen.y*=-I;Q.positionScreen.x*=E;Q.positionScreen.y*=-I;r.addPoint(w.positionScreen.x,w.positionScreen.y);r.addPoint(F.positionScreen.x,F.positionScreen.y);r.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(P.instersects(r)){C=0;for(A=H.meshMaterial.length;C<A;){M=H.meshMaterial[C++];if(M instanceof THREE.MeshFaceMaterial){V=0;for(ba=H.faceMaterial.length;V<ba;)(M=H.faceMaterial[V++])&&c(w,F,Q,H,M,p)}else M&&c(w,F,Q,H,M,p)}}}else if(H instanceof THREE.RenderableFace4){w=
-H.v1;F=H.v2;Q=H.v3;O=H.v4;w.positionScreen.x*=E;w.positionScreen.y*=-I;F.positionScreen.x*=E;F.positionScreen.y*=-I;Q.positionScreen.x*=E;Q.positionScreen.y*=-I;O.positionScreen.x*=E;O.positionScreen.y*=-I;r.addPoint(w.positionScreen.x,w.positionScreen.y);r.addPoint(F.positionScreen.x,F.positionScreen.y);r.addPoint(Q.positionScreen.x,Q.positionScreen.y);r.addPoint(O.positionScreen.x,O.positionScreen.y);if(P.instersects(r)){C=0;for(A=H.meshMaterial.length;C<A;){M=H.meshMaterial[C++];if(M instanceof
-THREE.MeshFaceMaterial){V=0;for(ba=H.faceMaterial.length;V<ba;)(M=H.faceMaterial[V++])&&e(w,F,Q,O,H,M,p)}else M&&e(w,F,Q,O,H,M,p)}}}}}};
-THREE.WebGLRenderer=function(a){function c(f,d){var i=b.createProgram();b.attachShader(i,h("fragment","#ifdef GL_ES\nprecision highp float;\n#endif\n"+f));b.attachShader(i,h("vertex",d));b.linkProgram(i);if(!b.getProgramParameter(i,b.LINK_STATUS)){alert("Could not initialise shaders");alert("VALIDATE_STATUS: "+b.getProgramParameter(i,b.VALIDATE_STATUS));alert(b.getError())}i.uniforms={};return i}function e(f,d){var i,o,k;i=0;for(o=d.length;i<o;i++){k=d[i];f.uniforms[k]=b.getUniformLocation(f,k)}}
-function g(f){f.position=b.getAttribLocation(f,"position");b.enableVertexAttribArray(f.position);f.normal=b.getAttribLocation(f,"normal");b.enableVertexAttribArray(f.normal);f.uv=b.getAttribLocation(f,"uv");b.enableVertexAttribArray(f.uv)}function h(f,d){var i;if(f=="fragment")i=b.createShader(b.FRAGMENT_SHADER);else if(f=="vertex")i=b.createShader(b.VERTEX_SHADER);b.shaderSource(i,d);b.compileShader(i);if(!b.getShaderParameter(i,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(i));return null}return i}
-function q(f){switch(f){case THREE.Repeat:return b.REPEAT;case THREE.ClampToEdge:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeat:return b.MIRRORED_REPEAT}return 0}var m=document.createElement("canvas"),b,l,y,E=new THREE.Matrix4,I,w=new Float32Array(16),F=new Float32Array(16),Q=new Float32Array(16),O=new Float32Array(9),P=new Float32Array(16);a=function(f,d){if(f){var i,o,k,j=pointLights=maxDirLights=maxPointLights=0;i=0;for(o=f.lights.length;i<o;i++){k=f.lights[i];k instanceof THREE.DirectionalLight&&
-j++;k instanceof THREE.PointLight&&pointLights++}if(pointLights+j<=d){maxDirLights=j;maxPointLights=pointLights}else{maxDirLights=Math.ceil(d*j/(pointLights+j));maxPointLights=d-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:d-1}}(a,4);this.domElement=m;this.autoClear=true;try{b=m.getContext("experimental-webgl",{antialias:true})}catch(r){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);
-b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(0,0,0,0);(function(f,d){var i=[f?"#define MAX_DIR_LIGHTS "+f:"",d?"#define MAX_POINT_LIGHTS "+d:"","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 ];":"",d?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",d?"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;",d?"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?"}":"",d?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",d?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",d?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
-"",d?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",d?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",d?"}":"","}\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"),
-o=[f?"#define MAX_DIR_LIGHTS "+f:"",d?"#define MAX_POINT_LIGHTS "+d:"","uniform int material;\nuniform bool enableMap;\nuniform bool enableCubeMap;\nuniform bool mixEnvMap;\nuniform samplerCube tCube;\nuniform float mReflectivity;\nuniform sampler2D tMap;\nuniform vec4 mColor;\nuniform float mOpacity;\nuniform vec4 mAmbient;\nuniform vec4 mSpecular;\nuniform float mShininess;\nuniform float m2Near;\nuniform float mFarPlusNear;\nuniform float mFarMinusNear;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;",
-f?"uniform mat4 viewMatrix;":"",f?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",d?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform vec3 cameraPosition;\nvoid main() {\nvec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nvec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nif ( enableMap ) {\nmapColor = texture2D( tMap, vUv );\n}\nif ( enableCubeMap ) {\ncubeColor.r = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) ).r;\ncubeColor.g = textureCube( tCube, vec3( -vReflect.x + 0.005, vReflect.yz ) ).g;\ncubeColor.b = textureCube( tCube, vec3( -vReflect.x + 0.01, vReflect.yz ) ).b;\n}\nif ( material == 5 ) { \nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( -wPos.x, wPos.yz ) );\n} else if ( material == 4 ) { \ngl_FragColor = vec4( 0.5*normalize( vNormal ) + vec3(0.5, 0.5, 0.5), mOpacity );\n} else if ( material == 3 ) { \nfloat w = 0.5;\ngl_FragColor = vec4( w, w, w, mOpacity );\n} else if ( material == 2 ) { \nvec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );",
-d?"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",d?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",d?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",d?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",d?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",d?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",d?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",d?"float pointSpecularWeight = 0.0;":"",d?"if ( pointDotNormalHalf >= 0.0 )":
-"",d?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",d?"pointDiffuse  += mColor * pointDiffuseWeight;":"",d?"pointSpecular += mSpecular * pointSpecularWeight;":"",d?"}":"",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;":"",d?"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);e(l,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract","m2Near","mFarPlusNear","mFarMinusNear"]);f&&e(l,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);d&&e(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,d){m.width=f;m.height=d;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,d){var i,o,k,j,n,t=[],R=[],s=[];j=[];n=[];b.uniform1i(f.uniforms.enableLighting,
-d.lights.length);i=0;for(o=d.lights.length;i<o;i++){k=d.lights[i];if(k instanceof THREE.AmbientLight)t.push(k);else if(k instanceof THREE.DirectionalLight)s.push(k);else k instanceof THREE.PointLight&&R.push(k)}i=k=j=n=0;for(o=t.length;i<o;i++){k+=t[i].color.r;j+=t[i].color.g;n+=t[i].color.b}b.uniform3f(f.uniforms.ambientLightColor,k,j,n);j=[];n=[];i=0;for(o=s.length;i<o;i++){k=s[i];j.push(k.color.r*k.intensity);j.push(k.color.g*k.intensity);j.push(k.color.b*k.intensity);n.push(k.position.x);n.push(k.position.y);
-n.push(k.position.z)}if(s.length){b.uniform1i(f.uniforms.directionalLightNumber,s.length);b.uniform3fv(f.uniforms.directionalLightDirection,n);b.uniform3fv(f.uniforms.directionalLightColor,j)}j=[];n=[];i=0;for(o=R.length;i<o;i++){k=R[i];j.push(k.color.r*k.intensity);j.push(k.color.g*k.intensity);j.push(k.color.b*k.intensity);n.push(k.position.x);n.push(k.position.y);n.push(k.position.z)}if(R.length){b.uniform1i(f.uniforms.pointLightNumber,R.length);b.uniform3fv(f.uniforms.pointLightPosition,n);b.uniform3fv(f.uniforms.pointLightColor,
-j)}};this.createBuffers=function(f,d){var i,o,k,j,n,t,R,s,T=[],x=[],v=[],U=[],J=[],z=0,p=f.materialFaceGroup[d],B;k=false;i=0;for(o=f.material.length;i<o;i++){meshMaterial=f.material[i];if(meshMaterial instanceof THREE.MeshFaceMaterial){n=0;for(B=p.material.length;n<B;n++)if(p.material[n]&&p.material[n].shading!=undefined&&p.material[n].shading==THREE.SmoothShading){k=true;break}}else if(meshMaterial&&meshMaterial.shading!=undefined&&meshMaterial.shading==THREE.SmoothShading){k=true;break}if(k)break}B=
-k;i=0;for(o=p.faces.length;i<o;i++){k=p.faces[i];j=f.geometry.faces[k];n=j.vertexNormals;faceNormal=j.normal;k=f.geometry.uvs[k];if(j instanceof THREE.Face3){t=f.geometry.vertices[j.a].position;R=f.geometry.vertices[j.b].position;s=f.geometry.vertices[j.c].position;v.push(t.x,t.y,t.z);v.push(R.x,R.y,R.z);v.push(s.x,s.y,s.z);if(n.length==3&&B)for(j=0;j<3;j++)U.push(n[j].x,n[j].y,n[j].z);else for(j=0;j<3;j++)U.push(faceNormal.x,faceNormal.y,faceNormal.z);if(k)for(j=0;j<3;j++)J.push(k[j].u,k[j].v);T.push(z,
-z+1,z+2);x.push(z,z+1);x.push(z,z+2);x.push(z+1,z+2);z+=3}else if(j instanceof THREE.Face4){t=f.geometry.vertices[j.a].position;R=f.geometry.vertices[j.b].position;s=f.geometry.vertices[j.c].position;j=f.geometry.vertices[j.d].position;v.push(t.x,t.y,t.z);v.push(R.x,R.y,R.z);v.push(s.x,s.y,s.z);v.push(j.x,j.y,j.z);if(n.length==4&&B)for(j=0;j<4;j++)U.push(n[j].x,n[j].y,n[j].z);else for(j=0;j<4;j++)U.push(faceNormal.x,faceNormal.y,faceNormal.z);if(k)for(j=0;j<4;j++)J.push(k[j].u,k[j].v);T.push(z,z+
-1,z+2);T.push(z,z+2,z+3);x.push(z,z+1);x.push(z,z+2);x.push(z,z+3);x.push(z+1,z+2);x.push(z+2,z+3);z+=4}}if(v.length){p.__webGLVertexBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(v),b.STATIC_DRAW);p.__webGLNormalBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(U),b.STATIC_DRAW);p.__webGLUVBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLUVBuffer);
-b.bufferData(b.ARRAY_BUFFER,new Float32Array(J),b.STATIC_DRAW);p.__webGLFaceBuffer=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(T),b.STATIC_DRAW);p.__webGLLineBuffer=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(x),b.STATIC_DRAW);p.__webGLFaceCount=T.length;p.__webGLLineCount=x.length}};this.renderBuffer=function(f,d,i){var o,k,j,n,t,R,s,
-T,x,v;if(d instanceof THREE.MeshShaderMaterial){if(!d.program){d.program=c(d.fragment_shader,d.vertex_shader);t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objMatrix","cameraPosition"];for(v in d.uniforms)t.push(v);e(d.program,t);g(d.program)}v=d.program}else v=l;if(v!=y){b.useProgram(v);y=v}if(d instanceof THREE.MeshShaderMaterial){t=v;T=d.uniforms;var U,J;for(k in T){U=T[k].type;x=T[k].value;J=t.uniforms[k];if(U=="i")b.uniform1i(J,x);else if(U=="f")b.uniform1f(J,x);else if(U==
-"t"){b.uniform1i(J,x);x=T[k].texture;if(x instanceof THREE.TextureCube&&x.image.length==6){if(!x.image.__webGLTextureCube&&!x.image.__cubeMapInitialized&&x.image.loadCount==6){x.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,x.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,
-b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(U=0;U<6;++U)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+U,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,x.image[U]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);x.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_CUBE_MAP,x.image.__webGLTextureCube)}}}this.loadCamera(v,f);this.loadMatrices(v)}else if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshBasicMaterial){f=
-d.color;o=d.opacity;j=d.wireframe;n=d.wireframe_linewidth;R=d.map;s=d.env_map;t=d.combine==THREE.Mix;k=d.reflectivity;x=d.env_map&&d.env_map.mapping==THREE.RefractionMap;T=d.refraction_ratio;b.uniform4f(v.uniforms.mColor,f.r*o,f.g*o,f.b*o,o);b.uniform1i(v.uniforms.mixEnvMap,t);b.uniform1f(v.uniforms.mReflectivity,k);b.uniform1i(v.uniforms.useRefract,x);b.uniform1f(v.uniforms.mRefractionRatio,T)}if(d instanceof THREE.MeshNormalMaterial){o=d.opacity;b.uniform1f(v.uniforms.mOpacity,o);b.uniform1i(v.uniforms.material,
-4)}else if(d instanceof THREE.MeshDepthMaterial){o=d.opacity;j=d.wireframe;n=d.wireframe_linewidth;b.uniform1f(v.uniforms.mOpacity,o);b.uniform1f(v.uniforms.m2Near,d.__2near);b.uniform1f(v.uniforms.mFarPlusNear,d.__farPlusNear);b.uniform1f(v.uniforms.mFarMinusNear,d.__farMinusNear);b.uniform1i(v.uniforms.material,3)}else if(d instanceof THREE.MeshPhongMaterial){f=d.ambient;k=d.specular;t=d.shininess;b.uniform4f(v.uniforms.mAmbient,f.r,f.g,f.b,o);b.uniform4f(v.uniforms.mSpecular,k.r,k.g,k.b,o);b.uniform1f(v.uniforms.mShininess,
-t);b.uniform1i(v.uniforms.material,2)}else if(d instanceof THREE.MeshLambertMaterial)b.uniform1i(v.uniforms.material,1);else if(d instanceof THREE.MeshBasicMaterial)b.uniform1i(v.uniforms.material,0);else if(d instanceof THREE.MeshCubeMaterial){b.uniform1i(v.uniforms.material,5);s=d.env_map}if(R){if(!d.map.__webGLTexture&&d.map.image.loaded){d.map.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.map.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,d.map.image);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,q(d.map.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,q(d.map.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.map.__webGLTexture);b.uniform1i(v.uniforms.tMap,0);b.uniform1i(v.uniforms.enableMap,1)}else b.uniform1i(v.uniforms.enableMap,
-0);if(s){if(d.env_map&&d.env_map instanceof THREE.TextureCube&&d.env_map.image.length==6){if(!d.env_map.image.__webGLTextureCube&&!d.env_map.image.__cubeMapInitialized&&d.env_map.image.loadCount==6){d.env_map.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,d.env_map.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,
-b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(o=0;o<6;++o)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,d.env_map.image[o]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);d.env_map.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_CUBE_MAP,d.env_map.image.__webGLTextureCube);b.uniform1i(v.uniforms.tCube,1)}b.uniform1i(v.uniforms.enableCubeMap,1)}else b.uniform1i(v.uniforms.enableCubeMap,
-0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLVertexBuffer);b.vertexAttribPointer(v.position,3,b.FLOAT,false,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.vertexAttribPointer(v.normal,3,b.FLOAT,false,0,0);if(R){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUVBuffer);b.enableVertexAttribArray(v.uv);b.vertexAttribPointer(v.uv,2,b.FLOAT,false,0,0)}else b.disableVertexAttribArray(v.uv);if(j){b.lineWidth(n);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.drawElements(b.LINES,i.__webGLLineCount,
-b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,i.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,d,i,o,k){var j,n,t,R,s;t=0;for(R=d.material.length;t<R;t++){j=d.material[t];if(j instanceof THREE.MeshFaceMaterial){j=0;for(n=i.material.length;j<n;j++)if((s=i.material[j])&&s.blending==o&&s.opacity<1==k){this.setBlending(s.blending);this.renderBuffer(f,s,i)}}else if((s=j)&&s.blending==o&&s.opacity<1==k){this.setBlending(s.blending);
-this.renderBuffer(f,s,i)}}};this.render=function(f,d){var i,o;this.initWebGLObjects(f);this.autoClear&&this.clear();d.autoUpdateMatrix&&d.updateMatrix();this.loadCamera(l,d);this.setupLights(l,f);i=0;for(o=f.__webGLObjects.length;i<o;i++){webGLObject=f.__webGLObjects[i];if(webGLObject.__object.visible){this.setupMatrices(webGLObject.__object,d);this.loadMatrices(l);this.renderPass(d,webGLObject.__object,webGLObject,THREE.NormalBlending,false)}}i=0;for(o=f.__webGLObjects.length;i<o;i++){webGLObject=
-f.__webGLObjects[i];if(webGLObject.__object.visible){this.setupMatrices(webGLObject.__object,d);this.loadMatrices(l);this.renderPass(d,webGLObject.__object,webGLObject,THREE.AdditiveBlending,false);this.renderPass(d,webGLObject.__object,webGLObject,THREE.SubtractiveBlending,false);this.renderPass(d,webGLObject.__object,webGLObject,THREE.AdditiveBlending,true);this.renderPass(d,webGLObject.__object,webGLObject,THREE.SubtractiveBlending,true);this.renderPass(d,webGLObject.__object,webGLObject,THREE.NormalBlending,
-true)}}};this.initWebGLObjects=function(f){var d,i,o,k,j;if(!f.__webGLObjects)f.__webGLObjects=[];d=0;for(i=f.objects.length;d<i;d++){o=f.objects[d];if(o instanceof THREE.Mesh)for(k in o.materialFaceGroup){j=o.materialFaceGroup[k];if(!j.__webGLVertexBuffer){this.createBuffers(o,k);j.__object=o;f.__webGLObjects.push(j)}}}};this.removeObject=function(f,d){var i,o;for(i=f.__webGLObjects.length-1;i>=0;i--){o=f.__webGLObjects[i].__object;d==o&&f.__webGLObjects.splice(i,1)}};this.setupMatrices=function(f,
-d){f.autoUpdateMatrix&&f.updateMatrix();E.multiply(d.matrix,f.matrix);w.set(d.matrix.flatten());F.set(E.flatten());Q.set(d.projectionMatrix.flatten());I=THREE.Matrix4.makeInvert3x3(E).transpose();O.set(I.m);P.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,w);b.uniformMatrix4fv(f.uniforms.modelViewMatrix,false,F);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,Q);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,O);b.uniformMatrix4fv(f.uniforms.objMatrix,
-false,P)};this.loadCamera=function(f,d){b.uniform3f(f.uniforms.cameraPosition,d.position.x,d.position.y,d.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,d){if(f){!d||d=="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};
+// ThreeDebug.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,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,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,d,g=a.objects,h=[];a=0;for(c=g.length;a<c;a++){d=g[a];if(d instanceof THREE.Mesh)h=h.concat(this.intersectObject(d))}h.sort(function(q,m){return q.distance-m.distance});return h},intersectObject:function(a){function c(M,r,f,e){e=e.clone().subSelf(r);f=f.clone().subSelf(r);var i=M.clone().subSelf(r);M=e.dot(e);r=e.dot(f);e=e.dot(i);var o=f.dot(f);f=f.dot(i);i=1/(M*o-r*r);o=(o*e-r*f)*i;M=(M*f-r*e)*i;return o>0&&M>0&&o+M<1}var d,g,h,q,m,b,l,y,C,E,
+w,D=a.geometry,O=D.vertices,J=[];d=0;for(g=D.faces.length;d<g;d++){h=D.faces[d];E=this.origin.clone();w=this.direction.clone();q=a.matrix.transformVector3(O[h.a].position.clone());m=a.matrix.transformVector3(O[h.b].position.clone());b=a.matrix.transformVector3(O[h.c].position.clone());l=h instanceof THREE.Face4?a.matrix.transformVector3(O[h.d].position.clone()):null;y=a.rotationMatrix.transformVector3(h.normal.clone());C=w.dot(y);if(C<0){y=y.dot((new THREE.Vector3).sub(q,E))/C;E=E.addSelf(w.multiplyScalar(y));
+if(h instanceof THREE.Face3){if(c(E,q,m,b)){h={distance:this.origin.distanceTo(E),point:E,face:h,object:a};J.push(h)}}else if(h instanceof THREE.Face4)if(c(E,q,m,l)||c(E,m,b,l)){h={distance:this.origin.distanceTo(E),point:E,face:h,object:a};J.push(h)}}}return J}};
+THREE.Rectangle=function(){function a(){q=g-c;m=h-d}var c,d,g,h,q,m,b=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return q};this.getHeight=function(){return m};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return g};this.getBottom=function(){return h};this.set=function(l,y,C,E){b=false;c=l;d=y;g=C;h=E;a()};this.addPoint=function(l,y){if(b){b=false;c=l;d=y;g=l;h=y}else{c=Math.min(c,l);d=Math.min(d,y);g=Math.max(g,
+l);h=Math.max(h,y)}a()};this.addRectangle=function(l){if(b){b=false;c=l.getLeft();d=l.getTop();g=l.getRight();h=l.getBottom()}else{c=Math.min(c,l.getLeft());d=Math.min(d,l.getTop());g=Math.max(g,l.getRight());h=Math.max(h,l.getBottom())}a()};this.inflate=function(l){c-=l;d-=l;g+=l;h+=l;a()};this.minSelf=function(l){c=Math.max(c,l.getLeft());d=Math.max(d,l.getTop());g=Math.min(g,l.getRight());h=Math.min(h,l.getBottom());a()};this.instersects=function(l){return Math.min(g,l.getRight())-Math.max(c,l.getLeft())>=
+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,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,O=a.n41,J=a.n42,M=a.n43,r=a.n44,f=c.n11,e=c.n12,i=c.n13,o=c.n14,j=c.n21,k=c.n22,n=c.n23,t=c.n24,G=c.n31,s=c.n32,S=c.n33,x=c.n34,u=c.n41,U=c.n42,R=c.n43,
+z=c.n44;this.n11=d*f+g*j+h*G+q*u;this.n12=d*e+g*k+h*s+q*U;this.n13=d*i+g*n+h*S+q*R;this.n14=d*o+g*t+h*x+q*z;this.n21=m*f+b*j+l*G+y*u;this.n22=m*e+b*k+l*s+y*U;this.n23=m*i+b*n+l*S+y*R;this.n24=m*o+b*t+l*x+y*z;this.n31=C*f+E*j+w*G+D*u;this.n32=C*e+E*k+w*s+D*U;this.n33=C*i+E*n+w*S+D*R;this.n34=C*o+E*t+w*x+D*z;this.n41=O*f+J*j+M*G+r*u;this.n42=O*e+J*k+M*s+r*U;this.n43=O*i+J*n+M*S+r*R;this.n44=O*o+J*t+M*x+r*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,O=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+O*a.n21+J*a.n31+M*a.n41;this.n42=D*a.n12+O*a.n22+J*a.n32+M*a.n42;this.n43=D*a.n13+O*a.n23+J*a.n33+M*a.n43;this.n44=D*a.n14+O*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 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 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,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,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);if(d instanceof THREE.Face3)d.centroid.divideScalar(3);else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeNormals:function(a){var c,d,g,h,q,m,b=new THREE.Vector3,
+l=new THREE.Vector3;g=0;for(h=this.vertices.length;g<h;g++){q=this.vertices[g];q.normal.set(0,0,0)}g=0;for(h=this.faces.length;g<h;g++){q=this.faces[g];if(a&&q.vertexNormals.length){b.set(0,0,0);c=0;for(d=q.normal.length;c<d;c++)b.addSelf(q.vertexNormals[c]);b.divideScalar(3)}else{c=this.vertices[q.a];d=this.vertices[q.b];m=this.vertices[q.c];b.sub(m.position,d.position);l.sub(c.position,d.position);b.crossSelf(l)}b.isZero()||b.normalize();q.normal.copy(b)}},computeBoundingBox:function(){if(this.vertices.length>
+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;a<c;a++){vertex=this.vertices[a];if(vertex.position.x<this.bbox.x[0])this.bbox.x[0]=vertex.position.x;else if(vertex.position.x>this.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.y<this.bbox.y[0])this.bbox.y[0]=vertex.position.y;else if(vertex.position.y>
+this.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.z<this.bbox.z[0])this.bbox.z[0]=vertex.position.z;else if(vertex.position.z>this.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,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,d){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();d&&this.normalizeUVs();this.geometry.computeBoundingBox()};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;
+THREE.Mesh.prototype.sortFacesByMaterial=function(){function a(C){var E=[];c=0;for(d=C.length;c<d;c++)C[c]==undefined?E.push("undefined"):E.push(C[c].toString());return E.join("_")}var c,d,g,h,q,m,b,l,y={};g=0;for(h=this.geometry.faces.length;g<h;g++){q=this.geometry.faces[g];m=q.material;b=a(m);if(y[b]==undefined)y[b]={hash:b,counter:0};l=y[b].hash+"_"+y[b].counter;if(this.materialFaceGroup[l]==undefined)this.materialFaceGroup[l]={faces:[],material:m,vertices:0};q=q instanceof THREE.Face3?3:4;if(this.materialFaceGroup[l].vertices+
+q>65535){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;a<c;a++){h=this.geometry.uvs[a];d=0;for(g=h.length;d<g;d++){if(h[d].u!=1)h[d].u-=Math.floor(h[d].u);if(h[d].v!=1)h[d].v-=Math.floor(h[d].v)}}};THREE.FlatShading=0;
+THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
+THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16711680);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";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;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}this.toString=function(){return"THREE.LineBasicMaterial (<br/>color: "+
+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
+THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(15658734);this.env_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.env_map!==
+undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+
+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
+THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(15658734);this.env_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;
+if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+
+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
+THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(15658734);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;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.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
+a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>"+ +")"}};THREE.MeshPhongMaterialCounter={value:0};
+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+"<br/>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 (<br/>id: "+this.id+"<br/>blending: "+
+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};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 (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+
+this.blending+"<br/>)"}};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 (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
+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 (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>)"}};
+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 (<br/>image: "+this.image+"<br/>mapping: "+this.mapping+"<br/>)"}};
+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(f,e){var i=0,o=1,j=f.z+f.w,k=e.z+e.w,n=-f.z+f.w,t=-e.z+e.w;if(j>=0&&k>=0&&n>=0&&t>=0)return true;else if(j<0&&k<0||n<0&&t<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-t));else if(t<0)o=Math.min(o,n/(n-t));if(o<i)return false;else{f.lerpSelf(e,i);e.lerpSelf(f,1-o);return true}}}var c=null,d,g,h,q=[],m,b,l=[],y,C,E=[],w=new THREE.Vector4,D=new THREE.Matrix4,O=new THREE.Matrix4,J=new THREE.Vector4,M=
+new THREE.Vector4,r;this.projectScene=function(f,e){var i,o,j,k,n,t,G,s,S,x,u,U,R,z,p,K,H;c=[];h=b=C=0;e.autoUpdateMatrix&&e.updateMatrix();D.multiply(e.projectionMatrix,e.matrix);G=f.objects;i=0;for(o=G.length;i<o;i++){s=G[i];s.autoUpdateMatrix&&s.updateMatrix();S=s.matrix;x=s.rotationMatrix;u=s.material;U=s.overdraw;if(s instanceof THREE.Mesh){R=s.geometry.vertices;j=0;for(k=R.length;j<k;j++){z=R[j];z.positionWorld.copy(z.position);S.transformVector3(z.positionWorld);p=z.positionScreen;p.copy(z.positionWorld);
+D.transformVector4(p);p.multiplyScalar(1/p.w);z.__visible=p.z>0&&p.z<1}z=s.geometry.faces;j=0;for(k=z.length;j<k;j++){p=z[j];if(p instanceof THREE.Face3){n=R[p.a];t=R[p.b];K=R[p.c];if(n.__visible&&t.__visible&&K.__visible)if(s.doubleSided||s.flipSided!=(K.positionScreen.x-n.positionScreen.x)*(t.positionScreen.y-n.positionScreen.y)-(K.positionScreen.y-n.positionScreen.y)*(t.positionScreen.x-n.positionScreen.x)<0){d=q[h]=q[h]||new THREE.RenderableFace3;d.v1.positionWorld.copy(n.positionWorld);d.v2.positionWorld.copy(t.positionWorld);
+d.v3.positionWorld.copy(K.positionWorld);d.v1.positionScreen.copy(n.positionScreen);d.v2.positionScreen.copy(t.positionScreen);d.v3.positionScreen.copy(K.positionScreen);d.normalWorld.copy(p.normal);x.transformVector3(d.normalWorld);d.centroidWorld.copy(p.centroid);S.transformVector3(d.centroidWorld);d.centroidScreen.copy(d.centroidWorld);D.transformVector3(d.centroidScreen);K=p.vertexNormals;r=d.vertexNormalsWorld;n=0;for(t=K.length;n<t;n++){H=r[n]=r[n]||new THREE.Vector3;H.copy(K[n]);x.transformVector3(H)}d.z=
+d.centroidScreen.z;d.meshMaterial=u;d.faceMaterial=p.material;d.overdraw=U;if(s.geometry.uvs[j]){d.uvs[0]=s.geometry.uvs[j][0];d.uvs[1]=s.geometry.uvs[j][1];d.uvs[2]=s.geometry.uvs[j][2]}c.push(d);h++}}else if(p instanceof THREE.Face4){n=R[p.a];t=R[p.b];K=R[p.c];H=R[p.d];if(n.__visible&&t.__visible&&K.__visible&&H.__visible)if(s.doubleSided||s.flipSided!=((H.positionScreen.x-n.positionScreen.x)*(t.positionScreen.y-n.positionScreen.y)-(H.positionScreen.y-n.positionScreen.y)*(t.positionScreen.x-n.positionScreen.x)<
+0||(t.positionScreen.x-K.positionScreen.x)*(H.positionScreen.y-K.positionScreen.y)-(t.positionScreen.y-K.positionScreen.y)*(H.positionScreen.x-K.positionScreen.x)<0)){d=q[h]=q[h]||new THREE.RenderableFace3;d.v1.positionWorld.copy(n.positionWorld);d.v2.positionWorld.copy(t.positionWorld);d.v3.positionWorld.copy(H.positionWorld);d.v1.positionScreen.copy(n.positionScreen);d.v2.positionScreen.copy(t.positionScreen);d.v3.positionScreen.copy(H.positionScreen);d.normalWorld.copy(p.normal);x.transformVector3(d.normalWorld);
+d.centroidWorld.copy(p.centroid);S.transformVector3(d.centroidWorld);d.centroidScreen.copy(d.centroidWorld);D.transformVector3(d.centroidScreen);d.z=d.centroidScreen.z;d.meshMaterial=u;d.faceMaterial=p.material;d.overdraw=U;if(s.geometry.uvs[j]){d.uvs[0]=s.geometry.uvs[j][0];d.uvs[1]=s.geometry.uvs[j][1];d.uvs[2]=s.geometry.uvs[j][3]}c.push(d);h++;g=q[h]=q[h]||new THREE.RenderableFace3;g.v1.positionWorld.copy(t.positionWorld);g.v2.positionWorld.copy(K.positionWorld);g.v3.positionWorld.copy(H.positionWorld);
+g.v1.positionScreen.copy(t.positionScreen);g.v2.positionScreen.copy(K.positionScreen);g.v3.positionScreen.copy(H.positionScreen);g.normalWorld.copy(d.normalWorld);g.centroidWorld.copy(d.centroidWorld);g.centroidScreen.copy(d.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterial=u;g.faceMaterial=p.material;g.overdraw=U;if(s.geometry.uvs[j]){g.uvs[0]=s.geometry.uvs[j][1];g.uvs[1]=s.geometry.uvs[j][2];g.uvs[2]=s.geometry.uvs[j][3]}c.push(g);h++}}}}else if(s instanceof THREE.Line){O.multiply(D,S);R=s.geometry.vertices;
+z=R[0];z.positionScreen.copy(z.position);O.transformVector4(z.positionScreen);j=1;for(k=R.length;j<k;j++){n=R[j];n.positionScreen.copy(n.position);O.transformVector4(n.positionScreen);t=R[j-1];J.copy(n.positionScreen);M.copy(t.positionScreen);if(a(J,M)){J.multiplyScalar(1/J.w);M.multiplyScalar(1/M.w);m=l[b]=l[b]||new THREE.RenderableLine;m.v1.positionScreen.copy(J);m.v2.positionScreen.copy(M);m.z=Math.max(J.z,M.z);m.material=s.material;c.push(m);b++}}}else if(s instanceof THREE.Particle){w.set(s.position.x,
+s.position.y,s.position.z,1);D.transformVector4(w);w.z/=w.w;if(w.z>0&&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=s.rotation.z;y.scale.x=s.scale.x*Math.abs(y.x-(w.x+e.projectionMatrix.n11)/(w.w+e.projectionMatrix.n14));y.scale.y=s.scale.y*Math.abs(y.y-(w.y+e.projectionMatrix.n22)/(w.w+e.projectionMatrix.n24));y.material=s.material;c.push(y);C++}}}c.sort(function(T,B){return B.z-T.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,O,J;a=c.projectScene(m,b);l=0;for(y=a.length;l<y;l++){w=a[l];if(w instanceof THREE.RenderableParticle){O=w.x*h+h;J=w.y*q+q;C=0;for(E=w.material.length;C<E;C++){D=w.material[C];if(D instanceof THREE.ParticleDOMMaterial){D=D.domElement;D.style.left=O+"px";D.style.top=J+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(I,Y,V,F){var v,L,$,N,X=I.lights;I=0;for(v=X.length;I<v;I++){L=X[I];$=L.color;N=L.intensity;if(L instanceof THREE.DirectionalLight){L=V.dot(L.position)*N;if(L>0){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)*N;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);S=I.positionScreen.x;x=I.positionScreen.y;u=Y.positionScreen.x;
+U=Y.positionScreen.y;R=V.positionScreen.x;z=V.positionScreen.y;var $=S,N=x,X=u,aa=U,Z=R,ca=z;r.beginPath();r.moveTo($,N);r.lineTo(X,aa);r.lineTo(Z,ca);r.lineTo($,N);r.closePath();if(v instanceof THREE.MeshBasicMaterial)if(v.map)h(S,x,u,U,R,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(S,x,u,U,R,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=T.r=ga.r;K.g=H.g=T.g=ga.g;K.b=H.b=T.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],T);B.r=(H.r+T.r)*0.5;B.g=(H.g+T.g)*0.5;B.b=(H.b+T.b)*0.5;P=b(K,H,T,B);h(S,x,u,U,R,z,P,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);T.r=T.g=T.b=1-A/(W-V.positionScreen.z*
+ea);B.r=(H.r+T.r)*0.5;B.g=(H.g+T.g)*0.5;B.b=(H.b+T.b)*0.5;P=b(K,H,T,B);h(S,x,u,U,R,z,P,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)r.strokeStyle=i=I;if(j!=Y)r.lineWidth=j=Y;r.stroke();da.inflate(Y*2)}function g(I){if(o!=I)r.fillStyle=o=I;r.fill()}function h(I,Y,V,F,v,L,$,N,X,aa,Z,ca,ka){var ja,fa;
+ja=$.width-1;fa=$.height-1;N*=ja;X*=fa;aa*=ja;Z*=fa;ca*=ja;ka*=fa;V-=I;F-=Y;v-=I;L-=Y;aa-=N;Z-=X;ca-=N;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*N-V*X;Y=Y-Z*N-F*X;r.save();r.transform(ja,Z,V,F,I,Y);r.clip();r.drawImage($,0,0);r.restore()}function q(I){if(f!=I)r.globalAlpha=f=I}function m(I){if(e!=I){switch(I){case THREE.NormalBlending:r.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:r.globalCompositeOperation="lighter";
+break;case THREE.SubtractiveBlending:r.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,O,J,M,r=w.getContext("2d"),f=1,e=0,i=null,o=null,j=1,k=Math.min,n=Math.max,t,G,s,S,x,u,U,R,z,p=new THREE.Color,K=new THREE.Color,H=new THREE.Color,T=new THREE.Color,B=new THREE.Color,A,W,ea,P,Q=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;O=Y;J=D/2;M=O/2;w.width=D;w.height=O;Q.set(-J,-M,J,M)};this.clear=function(){if(!ba.isEmpty()){ba.inflate(1);ba.minSelf(Q);r.clearRect(ba.getX(),ba.getY(),ba.getWidth(),ba.getHeight());ba.empty()}};this.render=function(I,Y){var V,F,v,L,$,N,X,aa;r.setTransform(1,0,0,-1,J,M);this.autoClear&&this.clear();C=E.projectScene(I,Y);r.fillStyle="rgba(0, 255, 255, 0.5)";r.fillRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight());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<F;V++){v=$[V];L=v.color;if(v instanceof THREE.AmbientLight){ga.r+=L.r;ga.g+=L.g;ga.b+=L.b}else if(v instanceof THREE.DirectionalLight){la.r+=L.r;la.g+=L.g;la.b+=L.b}else if(v instanceof THREE.PointLight){ma.r+=L.r;ma.g+=L.g;ma.b+=L.b}}}V=0;for(F=C.length;V<F;V++){v=C[V];da.empty();if(v instanceof THREE.RenderableParticle){t=v;t.x*=J;t.y*=M;L=0;for($=v.material.length;L<$;L++)a:{N=t;X=v;var Z=v.material[L];if(Z.opacity!=0){q(Z.opacity);m(Z.blending);aa=void 0;var ca=void 0,
+ka=void 0,ja=void 0,fa=void 0,va=void 0,wa=void 0;if(Z instanceof THREE.ParticleBasicMaterial){if(Z.map){fa=Z.map;va=fa.width>>1;wa=fa.height>>1;ka=X.scale.x*J;ja=X.scale.y*M;aa=ka*va;ca=ja*wa;da.set(N.x-aa,N.y-ca,N.x+aa,N.y+ca);if(!Q.instersects(da))break a;r.save();r.translate(N.x,N.y);r.rotate(-X.rotation);r.scale(ka,-ja);r.translate(-va,-wa);r.drawImage(fa,0,0);r.restore()}r.beginPath();r.moveTo(N.x-10,N.y);r.lineTo(N.x+10,N.y);r.moveTo(N.x,N.y-10);r.lineTo(N.x,N.y+10);r.closePath();r.strokeStyle=
+"rgb(255,255,0)";r.stroke()}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(N.x-aa,N.y-ca,N.x+aa,N.y+ca);if(Q.instersects(da)){Z=p.__styleString;if(o!=Z)r.fillStyle=o=Z;r.save();r.translate(N.x,N.y);r.rotate(-X.rotation);r.scale(aa,ca);r.beginPath();r.arc(0,0,1,0,xa,true);
+r.closePath();r.fill();r.restore()}}}}}else if(v instanceof THREE.RenderableLine){t=v.v1;G=v.v2;t.positionScreen.x*=J;t.positionScreen.y*=M;G.positionScreen.x*=J;G.positionScreen.y*=M;da.addPoint(t.positionScreen.x,t.positionScreen.y);da.addPoint(G.positionScreen.x,G.positionScreen.y);if(Q.instersects(da)){L=0;for($=v.material.length;L<$;){X=t;aa=G;N=v.material[L++];if(N.opacity!=0){q(N.opacity);m(N.blending);r.beginPath();r.moveTo(X.positionScreen.x,X.positionScreen.y);r.lineTo(aa.positionScreen.x,
+aa.positionScreen.y);r.closePath();if(N instanceof THREE.LineBasicMaterial){p.__styleString=N.color.__styleString;X=N.linewidth;if(j!=X)r.lineWidth=j=X;X=p.__styleString;if(i!=X)r.strokeStyle=i=X;r.stroke();da.inflate(N.linewidth*2)}}}}}else if(v instanceof THREE.RenderableFace3){t=v.v1;G=v.v2;s=v.v3;t.positionScreen.x*=J;t.positionScreen.y*=M;G.positionScreen.x*=J;G.positionScreen.y*=M;s.positionScreen.x*=J;s.positionScreen.y*=M;if(v.overdraw){y(t.positionScreen,G.positionScreen);y(G.positionScreen,
+s.positionScreen);y(s.positionScreen,t.positionScreen)}da.addPoint(t.positionScreen.x,t.positionScreen.y);da.addPoint(G.positionScreen.x,G.positionScreen.y);da.addPoint(s.positionScreen.x,s.positionScreen.y);if(Q.instersects(da)){L=0;for($=v.meshMaterial.length;L<$;){aa=v.meshMaterial[L++];if(aa instanceof THREE.MeshFaceMaterial){N=0;for(X=v.faceMaterial.length;N<X;)(aa=v.faceMaterial[N++])&&c(t,G,s,v,aa,I)}else c(t,G,s,v,aa,I)}}}ba.addRectangle(da)}r.lineWidth=1;r.strokeStyle="rgba( 255, 0, 0, 0.5 )";
+r.strokeRect(ba.getX(),ba.getY(),ba.getWidth(),ba.getHeight());r.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(p,K,H){var T,B,A,W;T=0;for(B=p.lights.length;T<B;T++){A=p.lights[T];if(A instanceof THREE.DirectionalLight){W=K.normalWorld.dot(A.position)*A.intensity;if(W>0){H.r+=A.color.r*W;H.g+=A.color.g*W;H.b+=A.color.b*W}}else if(A instanceof THREE.PointLight){t.sub(A.position,K.centroidWorld);t.normalize();W=K.normalWorld.dot(t)*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,T,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,T,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-T.z*B.__farMinusNear);
+e.setRGB(n,n,n)}else B instanceof THREE.MeshNormalMaterial&&e.setRGB(h(T.normalWorld.x),h(T.normalWorld.y),h(T.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,T,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 "+T.positionScreen.x+","+T.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,O,J,M=new THREE.Rectangle,r=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,t=new THREE.Vector3,G=[],s=[],S=[],x,u,U,R,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,T,B,A,W,ea,P,Q;this.autoClear&&this.clear();
+q=m.projectScene(p,K);R=U=u=0;if(f=p.lights.length>0){P=p.lights;o.setRGB(0,0,0);j.setRGB(0,0,0);k.setRGB(0,0,0);H=0;for(T=P.length;H<T;H++){B=P[H];A=B.color;if(B instanceof THREE.AmbientLight){o.r+=A.r;o.g+=A.g;o.b+=A.b}else if(B instanceof THREE.DirectionalLight){j.r+=A.r;j.g+=A.g;j.b+=A.b}else if(B instanceof THREE.PointLight){k.r+=A.r;k.g+=A.g;k.b+=A.b}}}H=0;for(T=q.length;H<T;H++){P=q[H];r.empty();if(P instanceof THREE.RenderableParticle){w=P;w.x*=C;w.y*=-E;B=0;for(A=P.material.length;B<A;B++)if(Q=
+P.material[B]){W=w;ea=P;Q=Q;var ba=U++;if(s[ba]==null){s[ba]=document.createElementNS("http://www.w3.org/2000/svg","circle");z==0&&s[ba].setAttribute("shape-rendering","crispEdges")}x=s[ba];x.setAttribute("cx",W.x);x.setAttribute("cy",W.y);x.setAttribute("r",ea.scale.x*C);if(Q instanceof THREE.ParticleCircleMaterial){if(f){i.r=o.r+j.r+k.r;i.g=o.g+j.g+k.g;i.b=o.b+j.b+k.b;e.r=Q.color.r*i.r;e.g=Q.color.g*i.g;e.b=Q.color.b*i.b;e.updateStyleString()}else e=Q.color;x.setAttribute("style","fill: "+e.__styleString)}b.appendChild(x)}}else if(P instanceof
+THREE.RenderableLine){w=P.v1;D=P.v2;w.positionScreen.x*=C;w.positionScreen.y*=-E;D.positionScreen.x*=C;D.positionScreen.y*=-E;r.addPoint(w.positionScreen.x,w.positionScreen.y);r.addPoint(D.positionScreen.x,D.positionScreen.y);if(M.instersects(r)){B=0;for(A=P.material.length;B<A;)if(Q=P.material[B++]){W=w;ea=D;Q=Q;ba=R++;if(S[ba]==null){S[ba]=document.createElementNS("http://www.w3.org/2000/svg","line");z==0&&S[ba].setAttribute("shape-rendering","crispEdges")}x=S[ba];x.setAttribute("x1",W.positionScreen.x);
+x.setAttribute("y1",W.positionScreen.y);x.setAttribute("x2",ea.positionScreen.x);x.setAttribute("y2",ea.positionScreen.y);if(Q instanceof THREE.LineBasicMaterial){e.__styleString=Q.color.__styleString;x.setAttribute("style","fill: none; stroke: "+e.__styleString+"; stroke-width: "+Q.linewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.linecap+"; stroke-linejoin: "+Q.linejoin);b.appendChild(x)}}}}else if(P instanceof THREE.RenderableFace3){w=P.v1;D=P.v2;O=P.v3;w.positionScreen.x*=C;w.positionScreen.y*=
+-E;D.positionScreen.x*=C;D.positionScreen.y*=-E;O.positionScreen.x*=C;O.positionScreen.y*=-E;r.addPoint(w.positionScreen.x,w.positionScreen.y);r.addPoint(D.positionScreen.x,D.positionScreen.y);r.addPoint(O.positionScreen.x,O.positionScreen.y);if(M.instersects(r)){B=0;for(A=P.meshMaterial.length;B<A;){Q=P.meshMaterial[B++];if(Q instanceof THREE.MeshFaceMaterial){W=0;for(ea=P.faceMaterial.length;W<ea;)(Q=P.faceMaterial[W++])&&c(w,D,O,P,Q,p)}else Q&&c(w,D,O,P,Q,p)}}}else if(P instanceof THREE.RenderableFace4){w=
+P.v1;D=P.v2;O=P.v3;J=P.v4;w.positionScreen.x*=C;w.positionScreen.y*=-E;D.positionScreen.x*=C;D.positionScreen.y*=-E;O.positionScreen.x*=C;O.positionScreen.y*=-E;J.positionScreen.x*=C;J.positionScreen.y*=-E;r.addPoint(w.positionScreen.x,w.positionScreen.y);r.addPoint(D.positionScreen.x,D.positionScreen.y);r.addPoint(O.positionScreen.x,O.positionScreen.y);r.addPoint(J.positionScreen.x,J.positionScreen.y);if(M.instersects(r)){B=0;for(A=P.meshMaterial.length;B<A;){Q=P.meshMaterial[B++];if(Q instanceof
+THREE.MeshFaceMaterial){W=0;for(ea=P.faceMaterial.length;W<ea;)(Q=P.faceMaterial[W++])&&d(w,D,O,J,P,Q,p)}else Q&&d(w,D,O,J,P,Q,p)}}}}}};
+THREE.WebGLRenderer=function(a){function c(f,e){var i=b.createProgram();b.attachShader(i,h("fragment","#ifdef GL_ES\nprecision highp float;\n#endif\n"+f));b.attachShader(i,h("vertex",e));b.linkProgram(i);if(!b.getProgramParameter(i,b.LINK_STATUS)){alert("Could not initialise shaders");alert("VALIDATE_STATUS: "+b.getProgramParameter(i,b.VALIDATE_STATUS));alert(b.getError())}i.uniforms={};return i}function d(f,e){var i,o,j;i=0;for(o=e.length;i<o;i++){j=e[i];f.uniforms[j]=b.getUniformLocation(f,j)}}
+function g(f){f.position=b.getAttribLocation(f,"position");b.enableVertexAttribArray(f.position);f.normal=b.getAttribLocation(f,"normal");b.enableVertexAttribArray(f.normal);f.uv=b.getAttribLocation(f,"uv");b.enableVertexAttribArray(f.uv)}function h(f,e){var i;if(f=="fragment")i=b.createShader(b.FRAGMENT_SHADER);else if(f=="vertex")i=b.createShader(b.VERTEX_SHADER);b.shaderSource(i,e);b.compileShader(i);if(!b.getShaderParameter(i,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(i));return null}return i}
+function q(f){switch(f){case THREE.Repeat:return b.REPEAT;case THREE.ClampToEdge:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeat:return b.MIRRORED_REPEAT}return 0}var m=document.createElement("canvas"),b,l,y,C=new THREE.Matrix4,E,w=new Float32Array(16),D=new Float32Array(16),O=new Float32Array(16),J=new Float32Array(9),M=new Float32Array(16);a=function(f,e){if(f){var i,o,j,k=pointLights=maxDirLights=maxPointLights=0;i=0;for(o=f.lights.length;i<o;i++){j=f.lights[i];j instanceof THREE.DirectionalLight&&
+k++;j instanceof THREE.PointLight&&pointLights++}if(pointLights+k<=e){maxDirLights=k;maxPointLights=pointLights}else{maxDirLights=Math.ceil(e*k/(pointLights+k));maxPointLights=e-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:e-1}}(a,4);this.domElement=m;this.autoClear=true;try{b=m.getContext("experimental-webgl",{antialias:true})}catch(r){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);
+b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(0,0,0,0);(function(f,e){var i=[f?"#define MAX_DIR_LIGHTS "+f:"",e?"#define MAX_POINT_LIGHTS "+e:"","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 ];":"",e?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",e?"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;",e?"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?"}":"",e?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",e?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",e?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
+"",e?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",e?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",e?"}":"","}\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"),
+o=[f?"#define MAX_DIR_LIGHTS "+f:"",e?"#define MAX_POINT_LIGHTS "+e:"","uniform int material;\nuniform bool enableMap;\nuniform bool enableCubeMap;\nuniform bool mixEnvMap;\nuniform samplerCube tCube;\nuniform float mReflectivity;\nuniform sampler2D tMap;\nuniform vec4 mColor;\nuniform float mOpacity;\nuniform vec4 mAmbient;\nuniform vec4 mSpecular;\nuniform float mShininess;\nuniform float m2Near;\nuniform float mFarPlusNear;\nuniform float mFarMinusNear;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;",
+f?"uniform mat4 viewMatrix;":"",f?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",e?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform vec3 cameraPosition;\nvoid main() {\nvec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nvec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nif ( enableMap ) {\nmapColor = texture2D( tMap, vUv );\n}\nif ( enableCubeMap ) {\ncubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n}\nif ( material == 5 ) { \nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( -wPos.x, wPos.yz ) );\n} else if ( material == 4 ) { \ngl_FragColor = vec4( 0.5*normalize( vNormal ) + vec3(0.5, 0.5, 0.5), mOpacity );\n} else if ( material == 3 ) { \nfloat w = 0.5;\ngl_FragColor = vec4( w, w, w, mOpacity );\n} else if ( material == 2 ) { \nvec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );",
+e?"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",e?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",e?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",e?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",e?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",e?"float pointSpecularWeight = 0.0;":"",e?"if ( pointDotNormalHalf >= 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","objMatrix","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,t=[],G=[],s=[];k=[];n=[];b.uniform1i(f.uniforms.enableLighting,
+e.lights.length);i=0;for(o=e.lights.length;i<o;i++){j=e.lights[i];if(j instanceof THREE.AmbientLight)t.push(j);else if(j instanceof THREE.DirectionalLight)s.push(j);else j instanceof THREE.PointLight&&G.push(j)}i=j=k=n=0;for(o=t.length;i<o;i++){j+=t[i].color.r;k+=t[i].color.g;n+=t[i].color.b}b.uniform3f(f.uniforms.ambientLightColor,j,k,n);k=[];n=[];i=0;for(o=s.length;i<o;i++){j=s[i];k.push(j.color.r*j.intensity);k.push(j.color.g*j.intensity);k.push(j.color.b*j.intensity);n.push(j.position.x);n.push(j.position.y);
+n.push(j.position.z)}if(s.length){b.uniform1i(f.uniforms.directionalLightNumber,s.length);b.uniform3fv(f.uniforms.directionalLightDirection,n);b.uniform3fv(f.uniforms.directionalLightColor,k)}k=[];n=[];i=0;for(o=G.length;i<o;i++){j=G[i];k.push(j.color.r*j.intensity);k.push(j.color.g*j.intensity);k.push(j.color.b*j.intensity);n.push(j.position.x);n.push(j.position.y);n.push(j.position.z)}if(G.length){b.uniform1i(f.uniforms.pointLightNumber,G.length);b.uniform3fv(f.uniforms.pointLightPosition,n);b.uniform3fv(f.uniforms.pointLightColor,
+k)}};this.createBuffers=function(f,e){var i,o,j,k,n,t,G,s,S=[],x=[],u=[],U=[],R=[],z=0,p=f.materialFaceGroup[e],K;j=false;i=0;for(o=f.material.length;i<o;i++){meshMaterial=f.material[i];if(meshMaterial instanceof THREE.MeshFaceMaterial){n=0;for(K=p.material.length;n<K;n++)if(p.material[n]&&p.material[n].shading!=undefined&&p.material[n].shading==THREE.SmoothShading){j=true;break}}else if(meshMaterial&&meshMaterial.shading!=undefined&&meshMaterial.shading==THREE.SmoothShading){j=true;break}if(j)break}K=
+j;i=0;for(o=p.faces.length;i<o;i++){j=p.faces[i];k=f.geometry.faces[j];n=k.vertexNormals;faceNormal=k.normal;j=f.geometry.uvs[j];if(k instanceof THREE.Face3){t=f.geometry.vertices[k.a].position;G=f.geometry.vertices[k.b].position;s=f.geometry.vertices[k.c].position;u.push(t.x,t.y,t.z);u.push(G.x,G.y,G.z);u.push(s.x,s.y,s.z);if(n.length==3&&K)for(k=0;k<3;k++)U.push(n[k].x,n[k].y,n[k].z);else for(k=0;k<3;k++)U.push(faceNormal.x,faceNormal.y,faceNormal.z);if(j)for(k=0;k<3;k++)R.push(j[k].u,j[k].v);S.push(z,
+z+1,z+2);x.push(z,z+1);x.push(z,z+2);x.push(z+1,z+2);z+=3}else if(k instanceof THREE.Face4){t=f.geometry.vertices[k.a].position;G=f.geometry.vertices[k.b].position;s=f.geometry.vertices[k.c].position;k=f.geometry.vertices[k.d].position;u.push(t.x,t.y,t.z);u.push(G.x,G.y,G.z);u.push(s.x,s.y,s.z);u.push(k.x,k.y,k.z);if(n.length==4&&K)for(k=0;k<4;k++)U.push(n[k].x,n[k].y,n[k].z);else for(k=0;k<4;k++)U.push(faceNormal.x,faceNormal.y,faceNormal.z);if(j)for(k=0;k<4;k++)R.push(j[k].u,j[k].v);S.push(z,z+
+1,z+2);S.push(z,z+2,z+3);x.push(z,z+1);x.push(z,z+2);x.push(z,z+3);x.push(z+1,z+2);x.push(z+2,z+3);z+=4}}if(u.length){p.__webGLVertexBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(u),b.STATIC_DRAW);p.__webGLNormalBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(U),b.STATIC_DRAW);p.__webGLUVBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLUVBuffer);
+b.bufferData(b.ARRAY_BUFFER,new Float32Array(R),b.STATIC_DRAW);p.__webGLFaceBuffer=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(S),b.STATIC_DRAW);p.__webGLLineBuffer=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(x),b.STATIC_DRAW);p.__webGLFaceCount=S.length;p.__webGLLineCount=x.length}};this.renderBuffer=function(f,e,i){var o,j,k,n,t,G,s,
+S,x,u;if(e instanceof THREE.MeshShaderMaterial){if(!e.program){e.program=c(e.fragment_shader,e.vertex_shader);t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objMatrix","cameraPosition"];for(u in e.uniforms)t.push(u);d(e.program,t);g(e.program)}u=e.program}else u=l;if(u!=y){b.useProgram(u);y=u}if(e instanceof THREE.MeshShaderMaterial){t=u;S=e.uniforms;var U,R;for(j in S){U=S[j].type;x=S[j].value;R=t.uniforms[j];if(U=="i")b.uniform1i(R,x);else if(U=="f")b.uniform1f(R,x);else if(U==
+"t"){b.uniform1i(R,x);x=S[j].texture;if(x instanceof THREE.TextureCube&&x.image.length==6){if(!x.image.__webGLTextureCube&&!x.image.__cubeMapInitialized&&x.image.loadCount==6){x.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,x.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,
+b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(U=0;U<6;++U)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+U,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,x.image[U]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);x.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_CUBE_MAP,x.image.__webGLTextureCube)}}}this.loadCamera(u,f);this.loadMatrices(u)}else if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshBasicMaterial){f=
+e.color;o=e.opacity;k=e.wireframe;n=e.wireframe_linewidth;G=e.map;s=e.env_map;t=e.combine==THREE.Mix;j=e.reflectivity;x=e.env_map&&e.env_map.mapping==THREE.RefractionMapping;S=e.refraction_ratio;b.uniform4f(u.uniforms.mColor,f.r*o,f.g*o,f.b*o,o);b.uniform1i(u.uniforms.mixEnvMap,t);b.uniform1f(u.uniforms.mReflectivity,j);b.uniform1i(u.uniforms.useRefract,x);b.uniform1f(u.uniforms.mRefractionRatio,S)}if(e instanceof THREE.MeshNormalMaterial){o=e.opacity;b.uniform1f(u.uniforms.mOpacity,o);b.uniform1i(u.uniforms.material,
+4)}else if(e instanceof THREE.MeshDepthMaterial){o=e.opacity;k=e.wireframe;n=e.wireframe_linewidth;b.uniform1f(u.uniforms.mOpacity,o);b.uniform1f(u.uniforms.m2Near,e.__2near);b.uniform1f(u.uniforms.mFarPlusNear,e.__farPlusNear);b.uniform1f(u.uniforms.mFarMinusNear,e.__farMinusNear);b.uniform1i(u.uniforms.material,3)}else if(e instanceof THREE.MeshPhongMaterial){f=e.ambient;j=e.specular;t=e.shininess;b.uniform4f(u.uniforms.mAmbient,f.r,f.g,f.b,o);b.uniform4f(u.uniforms.mSpecular,j.r,j.g,j.b,o);b.uniform1f(u.uniforms.mShininess,
+t);b.uniform1i(u.uniforms.material,2)}else if(e instanceof THREE.MeshLambertMaterial)b.uniform1i(u.uniforms.material,1);else if(e instanceof THREE.MeshBasicMaterial)b.uniform1i(u.uniforms.material,0);else if(e instanceof THREE.MeshCubeMaterial){b.uniform1i(u.uniforms.material,5);s=e.env_map}if(G){if(!e.map.__webGLTexture&&e.map.image.loaded){e.map.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,e.map.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.map.image);
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,q(e.map.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,q(e.map.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,e.map.__webGLTexture);b.uniform1i(u.uniforms.tMap,0);b.uniform1i(u.uniforms.enableMap,1)}else b.uniform1i(u.uniforms.enableMap,
+0);if(s){if(e.env_map&&e.env_map instanceof THREE.TextureCube&&e.env_map.image.length==6){if(!e.env_map.image.__webGLTextureCube&&!e.env_map.image.__cubeMapInitialized&&e.env_map.image.loadCount==6){e.env_map.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,e.env_map.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,
+b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(o=0;o<6;++o)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[o]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);e.env_map.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_CUBE_MAP,e.env_map.image.__webGLTextureCube);b.uniform1i(u.uniforms.tCube,1)}b.uniform1i(u.uniforms.enableCubeMap,1)}else b.uniform1i(u.uniforms.enableCubeMap,
+0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLVertexBuffer);b.vertexAttribPointer(u.position,3,b.FLOAT,false,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.vertexAttribPointer(u.normal,3,b.FLOAT,false,0,0);if(G){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUVBuffer);b.enableVertexAttribArray(u.uv);b.vertexAttribPointer(u.uv,2,b.FLOAT,false,0,0)}else b.disableVertexAttribArray(u.uv);if(k){b.lineWidth(n);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.drawElements(b.LINES,i.__webGLLineCount,
+b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,i.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,e,i,o,j){var k,n,t,G,s;t=0;for(G=e.material.length;t<G;t++){k=e.material[t];if(k instanceof THREE.MeshFaceMaterial){k=0;for(n=i.material.length;k<n;k++)if((s=i.material[k])&&s.blending==o&&s.opacity<1==j){this.setBlending(s.blending);this.renderBuffer(f,s,i)}}else if((s=k)&&s.blending==o&&s.opacity<1==j){this.setBlending(s.blending);
+this.renderBuffer(f,s,i)}}};this.render=function(f,e){var i,o;this.initWebGLObjects(f);this.autoClear&&this.clear();e.autoUpdateMatrix&&e.updateMatrix();this.loadCamera(l,e);this.setupLights(l,f);i=0;for(o=f.__webGLObjects.length;i<o;i++){webGLObject=f.__webGLObjects[i];if(webGLObject.__object.visible){this.setupMatrices(webGLObject.__object,e);this.loadMatrices(l);this.renderPass(e,webGLObject.__object,webGLObject,THREE.NormalBlending,false)}}i=0;for(o=f.__webGLObjects.length;i<o;i++){webGLObject=
+f.__webGLObjects[i];if(webGLObject.__object.visible){this.setupMatrices(webGLObject.__object,e);this.loadMatrices(l);this.renderPass(e,webGLObject.__object,webGLObject,THREE.AdditiveBlending,false);this.renderPass(e,webGLObject.__object,webGLObject,THREE.SubtractiveBlending,false);this.renderPass(e,webGLObject.__object,webGLObject,THREE.AdditiveBlending,true);this.renderPass(e,webGLObject.__object,webGLObject,THREE.SubtractiveBlending,true);this.renderPass(e,webGLObject.__object,webGLObject,THREE.NormalBlending,
+true)}}};this.initWebGLObjects=function(f){var e,i,o,j,k;if(!f.__webGLObjects)f.__webGLObjects=[];e=0;for(i=f.objects.length;e<i;e++){o=f.objects[e];if(o instanceof THREE.Mesh)for(j in o.materialFaceGroup){k=o.materialFaceGroup[j];if(!k.__webGLVertexBuffer){this.createBuffers(o,j);k.__object=o;f.__webGLObjects.push(k)}}}};this.removeObject=function(f,e){var i,o;for(i=f.__webGLObjects.length-1;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());O.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,O);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,J);b.uniformMatrix4fv(f.uniforms.objMatrix,
+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};

+ 206 - 207
build/ThreeExtras.js

@@ -1,207 +1,206 @@
-// ThreeExtras.js r29 - 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,b,d){this.r=a;this.g=b;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,b){this.x=a||0;this.y=b||0};
-THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.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,b,d){this.x=a||0;this.y=b||0;this.z=d||0};
-THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;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,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.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,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
-cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,d=this.y,f=this.z;this.x=d*a.z-f*a.y;this.y=f*a.x-b*a.z;this.z=b*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 b=
-this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+d*d+a*a)},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+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,b,d,f){this.x=a||0;this.y=b||0;this.z=d||0;this.w=f||1};
-THREE.Vector4.prototype={set:function(a,b,d,f){this.x=a;this.y=b;this.z=d;this.w=f;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,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
-return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},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,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,d,f=a.objects,g=[];a=0;for(b=f.length;a<b;a++){d=f[a];if(d instanceof THREE.Mesh)g=g.concat(this.intersectObject(d))}g.sort(function(i,k){return i.distance-k.distance});return g},intersectObject:function(a){function b(K,u,h,e){e=e.clone().subSelf(u);h=h.clone().subSelf(u);var m=K.clone().subSelf(u);K=e.dot(e);u=e.dot(h);e=e.dot(m);var r=h.dot(h);h=h.dot(m);m=1/(K*r-u*u);r=(r*e-u*h)*m;K=(K*h-u*e)*m;return r>0&&K>0&&r+K<1}var d,f,g,i,k,c,j,y,s,D,
-q,w=a.geometry,v=w.vertices,z=[];d=0;for(f=w.faces.length;d<f;d++){g=w.faces[d];D=this.origin.clone();q=this.direction.clone();i=a.matrix.transform(v[g.a].position.clone());k=a.matrix.transform(v[g.b].position.clone());c=a.matrix.transform(v[g.c].position.clone());j=g instanceof THREE.Face4?a.matrix.transform(v[g.d].position.clone()):null;y=a.rotationMatrix.transform(g.normal.clone());s=q.dot(y);if(s<0){y=y.dot((new THREE.Vector3).sub(i,D))/s;D=D.addSelf(q.multiplyScalar(y));if(g instanceof THREE.Face3){if(b(D,
-i,k,c)){g={distance:this.origin.distanceTo(D),point:D,face:g,object:a};z.push(g)}}else if(g instanceof THREE.Face4)if(b(D,i,k,j)||b(D,k,c,j)){g={distance:this.origin.distanceTo(D),point:D,face:g,object:a};z.push(g)}}}return z}};
-THREE.Rectangle=function(){function a(){i=f-b;k=g-d}var b,d,f,g,i,k,c=true;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return k};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(j,y,s,D){c=false;b=j;d=y;f=s;g=D;a()};this.addPoint=function(j,y){if(c){c=false;b=j;d=y;f=j;g=y}else{b=Math.min(b,j);d=Math.min(d,y);f=Math.max(f,
-j);g=Math.max(g,y)}a()};this.addRectangle=function(j){if(c){c=false;b=j.getLeft();d=j.getTop();f=j.getRight();g=j.getBottom()}else{b=Math.min(b,j.getLeft());d=Math.min(d,j.getTop());f=Math.max(f,j.getRight());g=Math.max(g,j.getBottom())}a()};this.inflate=function(j){b-=j;d-=j;f+=j;g+=j;a()};this.minSelf=function(j){b=Math.max(b,j.getLeft());d=Math.max(d,j.getTop());f=Math.min(f,j.getRight());g=Math.min(g,j.getBottom());a()};this.instersects=function(j){return Math.min(f,j.getRight())-Math.max(b,j.getLeft())>=
-0&&Math.min(g,j.getBottom())-Math.max(d,j.getTop())>=0};this.empty=function(){c=true;g=f=d=b=0;a()};this.isEmpty=function(){return c};this.toString=function(){return"THREE.Rectangle ( left: "+b+", right: "+f+", top: "+d+", bottom: "+g+", width: "+i+", height: "+k+" )"}};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,b,d){var f=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3;i.sub(a,b).normalize();f.cross(d,i).normalize();g.cross(i,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1},transform:function(a){var b=a.x,d=a.y,f=a.z,g=a.w||1;a.x=this.n11*b+this.n12*
-d+this.n13*f+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*f+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*f+this.n34*g;g=this.n41*b+this.n42*d+this.n43*f+this.n44*g;if(a.w)a.w=g;else{b=1/g;a.x*=b;a.y*=b;a.z*=b}return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},
-multiply:function(a,b){this.n11=a.n11*b.n11+a.n12*b.n21+a.n13*b.n31+a.n14*b.n41;this.n12=a.n11*b.n12+a.n12*b.n22+a.n13*b.n32+a.n14*b.n42;this.n13=a.n11*b.n13+a.n12*b.n23+a.n13*b.n33+a.n14*b.n43;this.n14=a.n11*b.n14+a.n12*b.n24+a.n13*b.n34+a.n14*b.n44;this.n21=a.n21*b.n11+a.n22*b.n21+a.n23*b.n31+a.n24*b.n41;this.n22=a.n21*b.n12+a.n22*b.n22+a.n23*b.n32+a.n24*b.n42;this.n23=a.n21*b.n13+a.n22*b.n23+a.n23*b.n33+a.n24*b.n43;this.n24=a.n21*b.n14+a.n22*b.n24+a.n23*b.n34+a.n24*b.n44;this.n31=a.n31*b.n11+a.n32*
-b.n21+a.n33*b.n31+a.n34*b.n41;this.n32=a.n31*b.n12+a.n32*b.n22+a.n33*b.n32+a.n34*b.n42;this.n33=a.n31*b.n13+a.n32*b.n23+a.n33*b.n33+a.n34*b.n43;this.n34=a.n31*b.n14+a.n32*b.n24+a.n33*b.n34+a.n34*b.n44;this.n41=a.n41*b.n11+a.n42*b.n21+a.n43*b.n31+a.n44*b.n41;this.n42=a.n41*b.n12+a.n42*b.n22+a.n43*b.n32+a.n44*b.n42;this.n43=a.n41*b.n13+a.n42*b.n23+a.n43*b.n33+a.n44*b.n43;this.n44=a.n41*b.n14+a.n42*b.n24+a.n43*b.n34+a.n44*b.n44},multiplySelf:function(a){var b=this.n11,d=this.n12,f=this.n13,g=this.n14,
-i=this.n21,k=this.n22,c=this.n23,j=this.n24,y=this.n31,s=this.n32,D=this.n33,q=this.n34,w=this.n41,v=this.n42,z=this.n43,K=this.n44;this.n11=b*a.n11+d*a.n21+f*a.n31+g*a.n41;this.n12=b*a.n12+d*a.n22+f*a.n32+g*a.n42;this.n13=b*a.n13+d*a.n23+f*a.n33+g*a.n43;this.n14=b*a.n14+d*a.n24+f*a.n34+g*a.n44;this.n21=i*a.n11+k*a.n21+c*a.n31+j*a.n41;this.n22=i*a.n12+k*a.n22+c*a.n32+j*a.n42;this.n23=i*a.n13+k*a.n23+c*a.n33+j*a.n43;this.n24=i*a.n14+k*a.n24+c*a.n34+j*a.n44;this.n31=y*a.n11+s*a.n21+D*a.n31+q*a.n41;
-this.n32=y*a.n12+s*a.n22+D*a.n32+q*a.n42;this.n33=y*a.n13+s*a.n23+D*a.n33+q*a.n43;this.n34=y*a.n14+s*a.n24+D*a.n34+q*a.n44;this.n41=w*a.n11+v*a.n21+z*a.n31+K*a.n41;this.n42=w*a.n12+v*a.n22+z*a.n32+K*a.n42;this.n43=w*a.n13+v*a.n23+z*a.n33+K*a.n43;this.n44=w*a.n14+v*a.n24+z*a.n34+K*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(b,d,f){var g=b[d];b[d]=b[f];b[f]=g}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,b,d){var f=new THREE.Matrix4;f.n14=a;f.n24=b;f.n34=d;return f};THREE.Matrix4.scaleMatrix=function(a,b,d){var f=new THREE.Matrix4;f.n11=a;f.n22=b;f.n33=d;return f};
-THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.n22=b.n33=Math.cos(a);b.n32=Math.sin(a);b.n23=-b.n32;return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n33=Math.cos(a);b.n13=Math.sin(a);b.n31=-b.n13;return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n22=Math.cos(a);b.n21=Math.sin(a);b.n12=-b.n21;return b};
-THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var d=new THREE.Matrix4,f=Math.cos(b),g=Math.sin(b),i=1-f,k=a.x,c=a.y,j=a.z;d.n11=i*k*k+f;d.n12=i*k*c-g*j;d.n13=i*k*j+g*c;d.n21=i*k*c+g*j;d.n22=i*c*c+f;d.n23=i*c*j-g*k;d.n31=i*k*j-g*c;d.n32=i*c*j+g*k;d.n33=i*j*j+f;return d};
-THREE.Matrix4.makeInvert=function(a){var b=new THREE.Matrix4;b.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;b.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;b.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;b.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;b.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;b.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;b.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;b.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;b.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;b.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;b.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;b.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;b.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;b.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;b.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;b.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;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var d=b[10]*b[5]-b[6]*b[9],f=-b[10]*b[1]+b[2]*b[9],g=b[6]*b[1]-b[2]*b[5],i=-b[10]*b[4]+b[6]*b[8],k=b[10]*b[0]-b[2]*b[8],c=-b[6]*b[0]+b[2]*b[4],j=b[9]*b[4]-b[5]*b[8],y=-b[9]*b[0]+b[1]*b[8],s=b[5]*b[0]-b[1]*b[4];b=b[0]*d+b[1]*i+b[2]*j;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*d;a.m[1]=b*f;a.m[2]=b*g;a.m[3]=b*i;a.m[4]=b*k;a.m[5]=b*c;a.m[6]=b*j;a.m[7]=b*y;a.m[8]=b*s;return a};
-THREE.Matrix4.makeFrustum=function(a,b,d,f,g,i){var k,c,j;k=new THREE.Matrix4;c=2*g/(b-a);j=2*g/(f-d);a=(b+a)/(b-a);d=(f+d)/(f-d);f=-(i+g)/(i-g);g=-2*i*g/(i-g);k.n11=c;k.n12=0;k.n13=a;k.n14=0;k.n21=0;k.n22=j;k.n23=d;k.n24=0;k.n31=0;k.n32=0;k.n33=f;k.n34=g;k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,d,f){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,f)};
-THREE.Matrix4.makeOrtho=function(a,b,d,f,g,i){var k,c,j,y;k=new THREE.Matrix4;c=b-a;j=d-f;y=i-g;a=(b+a)/c;d=(d+f)/j;g=(i+g)/y;k.n11=2/c;k.n12=0;k.n13=0;k.n14=-a;k.n21=0;k.n22=2/j;k.n23=0;k.n24=-d;k.n31=0;k.n32=0;k.n33=-2/y;k.n34=-g;k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};
-THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||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,b,d,f,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.material=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,b,d,f,g,i){this.a=a;this.b=b;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.material=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||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,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);if(d instanceof THREE.Face3)d.centroid.divideScalar(3);else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeNormals:function(a){var b,d,f,g,i,k,c=new THREE.Vector3,
-j=new THREE.Vector3;f=0;for(g=this.vertices.length;f<g;f++){i=this.vertices[f];i.normal.set(0,0,0)}f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];if(a&&i.vertexNormals.length){c.set(0,0,0);b=0;for(d=i.normal.length;b<d;b++)c.addSelf(i.vertexNormals[b]);c.divideScalar(3)}else{b=this.vertices[i.a];d=this.vertices[i.b];k=this.vertices[i.c];c.sub(k.position,d.position);j.sub(b.position,d.position);c.crossSelf(j)}c.isZero()||c.normalize();i.normal.copy(c)}},computeBoundingBox:function(){if(this.vertices.length>
-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,b=this.vertices.length;a<b;a++){vertex=this.vertices[a];if(vertex.position.x<this.bbox.x[0])this.bbox.x[0]=vertex.position.x;else if(vertex.position.x>this.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.y<this.bbox.y[0])this.bbox.y[0]=vertex.position.y;else if(vertex.position.y>
-this.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.z<this.bbox.z[0])this.bbox.z[0]=vertex.position.z;else if(vertex.position.z>this.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,b,d,f){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,b,d,f);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,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;
-THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||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,b){THREE.Object3D.call(this);this.geometry=a;this.material=b instanceof Array?b:[b]};THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.material=b instanceof Array?b:[b];this.overdraw=this.doubleSided=this.flipSided=false;this.materialFaceGroup={};this.sortFacesByMaterial();d&&this.normalizeUVs();this.geometry.computeBoundingBox()};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;
-THREE.Mesh.prototype.sortFacesByMaterial=function(){function a(s){var D=[];b=0;for(d=s.length;b<d;b++)s[b]==undefined?D.push("undefined"):D.push(s[b].toString());return D.join("_")}var b,d,f,g,i,k,c,j,y={};f=0;for(g=this.geometry.faces.length;f<g;f++){i=this.geometry.faces[f];k=i.material;c=a(k);if(y[c]==undefined)y[c]={hash:c,counter:0};j=y[c].hash+"_"+y[c].counter;if(this.materialFaceGroup[j]==undefined)this.materialFaceGroup[j]={faces:[],material:k,vertices:0};i=i instanceof THREE.Face3?3:4;if(this.materialFaceGroup[j].vertices+
-i>65535){y[c].counter+=1;j=y[c].hash+"_"+y[c].counter;if(this.materialFaceGroup[j]==undefined)this.materialFaceGroup[j]={faces:[],material:k,vertices:0}}this.materialFaceGroup[j].faces.push(f);this.materialFaceGroup[j].vertices+=i}};THREE.Mesh.prototype.normalizeUVs=function(){var a,b,d,f,g;a=0;for(b=this.geometry.uvs.length;a<b;a++){g=this.geometry.uvs[a];d=0;for(f=g.length;d<f;d++){if(g[d].u!=1)g[d].u-=Math.floor(g[d].u);if(g[d].v!=1)g[d].v-=Math.floor(g[d].v)}}};THREE.FlatShading=0;
-THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
-THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16711680);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";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;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}this.toString=function(){return"THREE.LineBasicMaterial (<br/>color: "+
-this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
-THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(15658734);this.env_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.env_map!==
-undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+
-this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
-THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(15658734);this.env_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;
-if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+
-this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
-THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(15658734);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;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.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
-a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
-this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>"+ +")"}};THREE.MeshPhongMaterialCounter={value:0};
-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+"<br/>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 (<br/>id: "+this.id+"<br/>blending: "+
-this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};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 (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+
-this.blending+"<br/>)"}};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 (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
-THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,b,d,f){this.image=a;this.loaded=false;this.mapping=b!==undefined?b:THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdge;this.wrap_t=f!==undefined?f:THREE.ClampToEdge;this.toString=function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>)"}};
-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,b){this.image=a;this.mapping=b?b:THREE.ReflectionMap;this.toString=function(){return"THREE.TextureCube (<br/>image: "+this.image+"<br/>mapping: "+this.mapping+"<br/>)"}};
-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(h,e){var m=0,r=1,p=h.z+h.w,o=e.z+e.w,x=-h.z+h.w,C=-e.z+e.w;if(p>=0&&o>=0&&x>=0&&C>=0)return true;else if(p<0&&o<0||x<0&&C<0)return false;else{if(p<0)m=Math.max(m,p/(p-o));else if(o<0)r=Math.min(r,p/(p-o));if(x<0)m=Math.max(m,x/(x-C));else if(C<0)r=Math.min(r,x/(x-C));if(r<m)return false;else{h.lerpSelf(e,m);e.lerpSelf(h,1-r);return true}}}var b=null,d,f,g,i=[],k,c,j=[],y,s,D=[],q=new THREE.Vector4,w=new THREE.Matrix4,v=new THREE.Matrix4,z=new THREE.Vector4,K=
-new THREE.Vector4,u;this.projectScene=function(h,e){var m,r,p,o,x,C,S,B,V,G,E,W,O,I,A,L,T;b=[];g=_face4Count=c=s=0;e.autoUpdateMatrix&&e.updateMatrix();w.multiply(e.projectionMatrix,e.matrix);S=h.objects;m=0;for(r=S.length;m<r;m++){B=S[m];B.autoUpdateMatrix&&B.updateMatrix();V=B.matrix;G=B.rotationMatrix;E=B.material;W=B.overdraw;if(B instanceof THREE.Mesh){O=B.geometry.vertices;p=0;for(o=O.length;p<o;p++){I=O[p];I.positionWorld.copy(I.position);V.transform(I.positionWorld);A=I.positionScreen;A.copy(I.positionWorld);
-w.transform(A);A.multiplyScalar(1/A.w);I.__visible=A.z>0&&A.z<1}I=B.geometry.faces;p=0;for(o=I.length;p<o;p++){A=I[p];if(A instanceof THREE.Face3){x=O[A.a];C=O[A.b];L=O[A.c];if(x.__visible&&C.__visible&&L.__visible)if(B.doubleSided||B.flipSided!=(L.positionScreen.x-x.positionScreen.x)*(C.positionScreen.y-x.positionScreen.y)-(L.positionScreen.y-x.positionScreen.y)*(C.positionScreen.x-x.positionScreen.x)<0){d=i[g]=i[g]||new THREE.RenderableFace3;d.v1.positionWorld.copy(x.positionWorld);d.v2.positionWorld.copy(C.positionWorld);
-d.v3.positionWorld.copy(L.positionWorld);d.v1.positionScreen.copy(x.positionScreen);d.v2.positionScreen.copy(C.positionScreen);d.v3.positionScreen.copy(L.positionScreen);d.normalWorld.copy(A.normal);G.transform(d.normalWorld);d.centroidWorld.copy(A.centroid);V.transform(d.centroidWorld);d.centroidScreen.copy(d.centroidWorld);w.transform(d.centroidScreen);L=A.vertexNormals;u=d.vertexNormalsWorld;x=0;for(C=L.length;x<C;x++){T=u[x].copy(L[x]);G.transform(T)}d.z=d.centroidScreen.z;d.meshMaterial=E;d.faceMaterial=
-A.material;d.overdraw=W;if(B.geometry.uvs[p]){d.uvs[0]=B.geometry.uvs[p][0];d.uvs[1]=B.geometry.uvs[p][1];d.uvs[2]=B.geometry.uvs[p][2]}b.push(d);g++}}else if(A instanceof THREE.Face4){x=O[A.a];C=O[A.b];L=O[A.c];T=O[A.d];if(x.__visible&&C.__visible&&L.__visible&&T.__visible)if(B.doubleSided||B.flipSided!=((T.positionScreen.x-x.positionScreen.x)*(C.positionScreen.y-x.positionScreen.y)-(T.positionScreen.y-x.positionScreen.y)*(C.positionScreen.x-x.positionScreen.x)<0||(C.positionScreen.x-L.positionScreen.x)*
-(T.positionScreen.y-L.positionScreen.y)-(C.positionScreen.y-L.positionScreen.y)*(T.positionScreen.x-L.positionScreen.x)<0)){d=i[g]=i[g]||new THREE.RenderableFace3;d.v1.positionWorld.copy(x.positionWorld);d.v2.positionWorld.copy(C.positionWorld);d.v3.positionWorld.copy(T.positionWorld);d.v1.positionScreen.copy(x.positionScreen);d.v2.positionScreen.copy(C.positionScreen);d.v3.positionScreen.copy(T.positionScreen);d.normalWorld.copy(A.normal);G.transform(d.normalWorld);d.centroidWorld.copy(A.centroid);
-V.transform(d.centroidWorld);d.centroidScreen.copy(d.centroidWorld);w.transform(d.centroidScreen);d.z=d.centroidScreen.z;d.meshMaterial=E;d.faceMaterial=A.material;d.overdraw=W;if(B.geometry.uvs[p]){d.uvs[0]=B.geometry.uvs[p][0];d.uvs[1]=B.geometry.uvs[p][1];d.uvs[2]=B.geometry.uvs[p][3]}b.push(d);g++;f=i[g]=i[g]||new THREE.RenderableFace3;f.v1.positionWorld.copy(C.positionWorld);f.v2.positionWorld.copy(L.positionWorld);f.v3.positionWorld.copy(T.positionWorld);f.v1.positionScreen.copy(C.positionScreen);
-f.v2.positionScreen.copy(L.positionScreen);f.v3.positionScreen.copy(T.positionScreen);f.normalWorld.copy(d.normalWorld);f.centroidWorld.copy(d.centroidWorld);f.centroidScreen.copy(d.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterial=E;f.faceMaterial=A.material;f.overdraw=W;if(B.geometry.uvs[p]){f.uvs[0]=B.geometry.uvs[p][1];f.uvs[1]=B.geometry.uvs[p][2];f.uvs[2]=B.geometry.uvs[p][3]}b.push(f);g++}}}}else if(B instanceof THREE.Line){v.multiply(w,V);O=B.geometry.vertices;I=O[0];I.positionScreen.copy(I.position);
-v.transform(I.positionScreen);p=1;for(o=O.length;p<o;p++){x=O[p];x.positionScreen.copy(x.position);v.transform(x.positionScreen);C=O[p-1];z.copy(x.positionScreen);K.copy(C.positionScreen);if(a(z,K)){z.multiplyScalar(1/z.w);K.multiplyScalar(1/K.w);k=j[c]=j[c]||new THREE.RenderableLine;k.v1.positionScreen.copy(z);k.v2.positionScreen.copy(K);k.z=Math.max(z.z,K.z);k.material=B.material;b.push(k);c++}}}else if(B instanceof THREE.Particle){q.set(B.position.x,B.position.y,B.position.z,1);w.transform(q);
-q.z/=q.w;if(q.z>0&&q.z<1){y=D[s]=D[s]||new THREE.RenderableParticle;y.x=q.x/q.w;y.y=q.y/q.w;y.z=q.z;y.rotation=B.rotation.z;y.scale.x=B.scale.x*Math.abs(y.x-(q.x+e.projectionMatrix.n11)/(q.w+e.projectionMatrix.n14));y.scale.y=B.scale.y*Math.abs(y.y-(q.y+e.projectionMatrix.n22)/(q.w+e.projectionMatrix.n24));y.material=B.material;b.push(y);s++}}}b.sort(function($,M){return M.z-$.z});return b};this.unprojectVector=function(h,e){var m=new THREE.Matrix4;m.multiply(THREE.Matrix4.makeInvert(e.matrix),THREE.Matrix4.makeInvert(e.projectionMatrix));
-m.transform(h);return h}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,f,g,i;this.domElement=document.createElement("div");this.setSize=function(k,c){d=k;f=c;g=d/2;i=f/2};this.render=function(k,c){var j,y,s,D,q,w,v,z;a=b.projectScene(k,c);j=0;for(y=a.length;j<y;j++){q=a[j];if(q instanceof THREE.RenderableParticle){v=q.x*g+g;z=q.y*i+i;s=0;for(D=q.material.length;s<D;s++){w=q.material[s];if(w instanceof THREE.ParticleDOMMaterial){w=w.domElement;w.style.left=v+"px";w.style.top=z+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(P,aa,Y,N){var F,R,da,U,Z=P.lights;P=0;for(F=Z.length;P<F;P++){R=Z[P];da=R.color;U=R.intensity;if(R instanceof THREE.DirectionalLight){R=Y.dot(R.position)*U;if(R>0){N.r+=da.r*R;N.g+=da.g*R;N.b+=da.b*R}}else if(R instanceof THREE.PointLight){sa.sub(R.position,aa);sa.normalize();R=Y.dot(sa)*U;if(R>0){N.r+=da.r*R;N.g+=da.g*R;N.b+=da.b*R}}}}function b(P,aa,Y,N,F,R){if(F.opacity!=0){i(F.opacity);k(F.blending);S=P.positionScreen.x;B=P.positionScreen.y;V=aa.positionScreen.x;
-G=aa.positionScreen.y;E=Y.positionScreen.x;W=Y.positionScreen.y;var da=S,U=B,Z=V,ea=G,ca=E,ga=W;u.beginPath();u.moveTo(da,U);u.lineTo(Z,ea);u.lineTo(ca,ga);u.lineTo(da,U);u.closePath();if(F instanceof THREE.MeshBasicMaterial)if(F.map)g(S,B,V,G,E,W,F.map.image,N.uvs[0].u,N.uvs[0].v,N.uvs[1].u,N.uvs[1].v,N.uvs[2].u,N.uvs[2].v);else F.wireframe?d(F.color.__styleString,F.wireframe_linewidth):f(F.color.__styleString);else if(F instanceof THREE.MeshLambertMaterial){if(F.map&&!F.wireframe){g(S,B,V,G,E,W,
-F.map.image,N.uvs[0].u,N.uvs[0].v,N.uvs[1].u,N.uvs[1].v,N.uvs[2].u,N.uvs[2].v);k(THREE.SubtractiveBlending)}if(H)if(F.shading==THREE.SmoothShading&&!F.wireframe){I.r=A.r=L.r=ba.r;I.g=A.g=L.g=ba.g;I.b=A.b=L.b=ba.b;a(R,N.v1.positionWorld,N.vertexNormalsWorld[0],I);a(R,N.v2.positionWorld,N.vertexNormalsWorld[1],A);a(R,N.v3.positionWorld,N.vertexNormalsWorld[2],L);T.r=(A.r+L.r)*0.5;T.g=(A.g+L.g)*0.5;T.b=(A.b+L.b)*0.5;X=c(I,A,L,T);g(S,B,V,G,E,W,X,0,0,1,0,0,1)}else{Q.r=ba.r;Q.g=ba.g;Q.b=ba.b;a(R,N.centroidWorld,
-N.normalWorld,Q);O.r=F.color.r*Q.r;O.g=F.color.g*Q.g;O.b=F.color.b*Q.b;O.updateStyleString();F.wireframe?d(O.__styleString,F.wireframe_linewidth):f(O.__styleString)}else F.wireframe?d(F.color.__styleString,F.wireframe_linewidth):f(F.color.__styleString)}else if(F instanceof THREE.MeshDepthMaterial){$=F.__2near;M=F.__farPlusNear;J=F.__farMinusNear;I.r=I.g=I.b=1-$/(M-P.positionScreen.z*J);A.r=A.g=A.b=1-$/(M-aa.positionScreen.z*J);L.r=L.g=L.b=1-$/(M-Y.positionScreen.z*J);T.r=(A.r+L.r)*0.5;T.g=(A.g+L.g)*
-0.5;T.b=(A.b+L.b)*0.5;X=c(I,A,L,T);g(S,B,V,G,E,W,X,0,0,1,0,0,1)}else if(F instanceof THREE.MeshNormalMaterial){O.r=j(N.normalWorld.x);O.g=j(N.normalWorld.y);O.b=j(N.normalWorld.z);O.updateStyleString();F.wireframe?d(O.__styleString,F.wireframe_linewidth):f(O.__styleString)}}}function d(P,aa){if(m!=P)u.strokeStyle=m=P;if(p!=aa)u.lineWidth=p=aa;u.stroke()}function f(P){if(r!=P)u.fillStyle=r=P;u.fill()}function g(P,aa,Y,N,F,R,da,U,Z,ea,ca,ga,la){var ja=da.width-1,ha=da.height-1;U*=ja;Z*=ha;ea*=ja;ca*=
-ha;ga*=ja;la*=ha;Y-=P;N-=aa;F-=P;R-=aa;ea-=U;ca-=Z;ga-=U;la-=Z;ha=1/(ea*la-ga*ca);ja=(la*Y-ca*F)*ha;ca=(la*N-ca*R)*ha;Y=(ea*F-ga*Y)*ha;N=(ea*R-ga*N)*ha;P=P-ja*U-Y*Z;aa=aa-ca*U-N*Z;u.save();u.transform(ja,ca,Y,N,P,aa);u.clip();u.drawImage(da,0,0);u.restore()}function i(P){if(h!=P)u.globalAlpha=h=P}function k(P){if(e!=P){switch(P){case THREE.NormalBlending:u.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:u.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:u.globalCompositeOperation=
-"darker"}e=P}}function c(P,aa,Y,N){ia[0]=~~(P.r*255);ia[1]=~~(P.g*255);ia[2]=~~(P.b*255);ia[4]=~~(aa.r*255);ia[5]=~~(aa.g*255);ia[6]=~~(aa.b*255);ia[8]=~~(Y.r*255);ia[9]=~~(Y.g*255);ia[10]=~~(Y.b*255);ia[12]=~~(N.r*255);ia[13]=~~(N.g*255);ia[14]=~~(N.b*255);na.putImageData(ta,0,0);qa.drawImage(oa,0,0);return pa}function j(P){return P<0?Math.min((1+P)*0.5,0.5):0.5+Math.min(P*0.5,0.5)}function y(P,aa){var Y=aa.x-P.x,N=aa.y-P.y,F=1/Math.sqrt(Y*Y+N*N);Y*=F;N*=F;aa.x+=Y;aa.y+=N;P.x-=Y;P.y-=N}var s=null,
-D=new THREE.Projector,q=document.createElement("canvas"),w,v,z,K,u=q.getContext("2d"),h=1,e=0,m=null,r=null,p=1,o,x,C,S,B,V,G,E,W,O=new THREE.Color,I=new THREE.Color,A=new THREE.Color,L=new THREE.Color,T=new THREE.Color,$,M,J,X,l=new THREE.Rectangle,n=new THREE.Rectangle,t=new THREE.Rectangle,H=false,Q=new THREE.Color,ba=new THREE.Color,fa=new THREE.Color,ka=new THREE.Color,ra=Math.PI*2,sa=new THREE.Vector3;new THREE.UV;new THREE.UV;new THREE.UV;new THREE.UV;var oa,na,ta,ia,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);ta=na.getImageData(0,0,2,2);ia=ta.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=q;this.autoClear=true;this.setSize=function(P,aa){w=P;v=aa;z=w/2;K=v/2;q.width=w;q.height=v;l.set(-z,-K,z,K)};this.clear=function(){if(!n.isEmpty()){n.inflate(1);n.minSelf(l);u.clearRect(n.getX(),n.getY(),n.getWidth(),n.getHeight());
-n.empty()}};this.render=function(P,aa){var Y,N,F,R,da,U,Z,ea;u.setTransform(1,0,0,-1,z,K);this.autoClear&&this.clear();s=D.projectScene(P,aa);if(H=P.lights.length>0){da=P.lights;ba.setRGB(0,0,0);fa.setRGB(0,0,0);ka.setRGB(0,0,0);Y=0;for(N=da.length;Y<N;Y++){F=da[Y];R=F.color;if(F instanceof THREE.AmbientLight){ba.r+=R.r;ba.g+=R.g;ba.b+=R.b}else if(F instanceof THREE.DirectionalLight){fa.r+=R.r;fa.g+=R.g;fa.b+=R.b}else if(F instanceof THREE.PointLight){ka.r+=R.r;ka.g+=R.g;ka.b+=R.b}}}Y=0;for(N=s.length;Y<
-N;Y++){F=s[Y];t.empty();if(F instanceof THREE.RenderableParticle){o=F;o.x*=z;o.y*=K;R=0;for(da=F.material.length;R<da;R++){U=o;Z=F;var ca=F.material[R];if(ca.opacity!=0){i(ca.opacity);k(ca.blending);ea=void 0;var ga=void 0,la=void 0,ja=void 0,ha=void 0,ua=void 0,va=void 0;if(ca instanceof THREE.ParticleBasicMaterial){if(ca.map){ha=ca.map;ua=ha.width>>1;va=ha.height>>1;la=Z.scale.x*z;ja=Z.scale.y*K;ea=la*ua;ga=ja*va;t.set(U.x-ea,U.y-ga,U.x+ea,U.y+ga);if(l.instersects(t)){u.save();u.translate(U.x,U.y);
-u.rotate(-Z.rotation);u.scale(la,-ja);u.translate(-ua,-va);u.drawImage(ha,0,0);u.restore()}}}else if(ca instanceof THREE.ParticleCircleMaterial){if(H){Q.r=ba.r+fa.r+ka.r;Q.g=ba.g+fa.g+ka.g;Q.b=ba.b+fa.b+ka.b;O.r=ca.color.r*Q.r;O.g=ca.color.g*Q.g;O.b=ca.color.b*Q.b;O.updateStyleString()}else O.__styleString=ca.color.__styleString;ea=Z.scale.x*z;ga=Z.scale.y*K;t.set(U.x-ea,U.y-ga,U.x+ea,U.y+ga);if(l.instersects(t)){ca=O.__styleString;if(r!=ca)u.fillStyle=r=ca;u.save();u.translate(U.x,U.y);u.rotate(-Z.rotation);
-u.scale(ea,ga);u.beginPath();u.arc(0,0,1,0,ra,true);u.closePath();u.fill();u.restore()}}}}}else if(F instanceof THREE.RenderableLine){o=F.v1;x=F.v2;o.positionScreen.x*=z;o.positionScreen.y*=K;x.positionScreen.x*=z;x.positionScreen.y*=K;t.addPoint(o.positionScreen.x,o.positionScreen.y);t.addPoint(x.positionScreen.x,x.positionScreen.y);if(l.instersects(t)){R=0;for(da=F.material.length;R<da;){Z=o;ea=x;U=F.material[R++];if(U.opacity!=0){i(U.opacity);k(U.blending);u.beginPath();u.moveTo(Z.positionScreen.x,
-Z.positionScreen.y);u.lineTo(ea.positionScreen.x,ea.positionScreen.y);u.closePath();if(U instanceof THREE.LineBasicMaterial){O.__styleString=U.color.__styleString;Z=U.linewidth;if(p!=Z)u.lineWidth=p=Z;Z=O.__styleString;if(m!=Z)u.strokeStyle=m=Z;u.stroke();t.inflate(U.linewidth*2)}}}}}else if(F instanceof THREE.RenderableFace3){o=F.v1;x=F.v2;C=F.v3;o.positionScreen.x*=z;o.positionScreen.y*=K;x.positionScreen.x*=z;x.positionScreen.y*=K;C.positionScreen.x*=z;C.positionScreen.y*=K;if(F.overdraw){y(o.positionScreen,
-x.positionScreen);y(x.positionScreen,C.positionScreen);y(C.positionScreen,o.positionScreen)}t.addPoint(o.positionScreen.x,o.positionScreen.y);t.addPoint(x.positionScreen.x,x.positionScreen.y);t.addPoint(C.positionScreen.x,C.positionScreen.y);if(l.instersects(t)){R=0;for(da=F.meshMaterial.length;R<da;){ea=F.meshMaterial[R++];if(ea instanceof THREE.MeshFaceMaterial){U=0;for(Z=F.faceMaterial.length;U<Z;)(ea=F.faceMaterial[U++])&&b(o,x,C,F,ea,P)}else b(o,x,C,F,ea,P)}}}n.addRectangle(t)}u.setTransform(1,
-0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(A,L,T){var $,M,J,X;$=0;for(M=A.lights.length;$<M;$++){J=A.lights[$];if(J instanceof THREE.DirectionalLight){X=L.normalWorld.dot(J.position)*J.intensity;if(X>0){T.r+=J.color.r*X;T.g+=J.color.g*X;T.b+=J.color.b*X}}else if(J instanceof THREE.PointLight){C.sub(J.position,L.centroidWorld);C.normalize();X=L.normalWorld.dot(C)*J.intensity;if(X>0){T.r+=J.color.r*X;T.g+=J.color.g*X;T.b+=J.color.b*X}}}}function b(A,L,T,$,M,J){G=f(E++);G.setAttribute("d","M "+A.positionScreen.x+
-" "+A.positionScreen.y+" L "+L.positionScreen.x+" "+L.positionScreen.y+" L "+T.positionScreen.x+","+T.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)e.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(h){m.r=r.r;m.g=r.g;m.b=r.b;a(J,$,m);e.r=M.color.r*m.r;e.g=M.color.g*m.g;e.b=M.color.b*m.b;e.updateStyleString()}else e.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){x=1-M.__2near/(M.__farPlusNear-$.z*M.__farMinusNear);
-e.setRGB(x,x,x)}else M instanceof THREE.MeshNormalMaterial&&e.setRGB(g($.normalWorld.x),g($.normalWorld.y),g($.normalWorld.z));M.wireframe?G.setAttribute("style","fill: none; stroke: "+e.__styleString+"; stroke-width: "+M.wireframe_linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframe_linecap+"; stroke-linejoin: "+M.wireframe_linejoin):G.setAttribute("style","fill: "+e.__styleString+"; fill-opacity: "+M.opacity);c.appendChild(G)}function d(A,L,T,$,M,J,X){G=f(E++);G.setAttribute("d",
-"M "+A.positionScreen.x+" "+A.positionScreen.y+" L "+L.positionScreen.x+" "+L.positionScreen.y+" L "+T.positionScreen.x+","+T.positionScreen.y+" L "+$.positionScreen.x+","+$.positionScreen.y+"z");if(J instanceof THREE.MeshBasicMaterial)e.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshLambertMaterial)if(h){m.r=r.r;m.g=r.g;m.b=r.b;a(X,M,m);e.r=J.color.r*m.r;e.g=J.color.g*m.g;e.b=J.color.b*m.b;e.updateStyleString()}else e.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshDepthMaterial){x=
-1-J.__2near/(J.__farPlusNear-M.z*J.__farMinusNear);e.setRGB(x,x,x)}else J instanceof THREE.MeshNormalMaterial&&e.setRGB(g(M.normalWorld.x),g(M.normalWorld.y),g(M.normalWorld.z));J.wireframe?G.setAttribute("style","fill: none; stroke: "+e.__styleString+"; stroke-width: "+J.wireframe_linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframe_linecap+"; stroke-linejoin: "+J.wireframe_linejoin):G.setAttribute("style","fill: "+e.__styleString+"; fill-opacity: "+J.opacity);c.appendChild(G)}
-function f(A){if(S[A]==null){S[A]=document.createElementNS("http://www.w3.org/2000/svg","path");I==0&&S[A].setAttribute("shape-rendering","crispEdges");return S[A]}return S[A]}function g(A){return A<0?Math.min((1+A)*0.5,0.5):0.5+Math.min(A*0.5,0.5)}var i=null,k=new THREE.Projector,c=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,y,s,D,q,w,v,z,K=new THREE.Rectangle,u=new THREE.Rectangle,h=false,e=new THREE.Color(16777215),m=new THREE.Color(16777215),r=new THREE.Color(0),p=new THREE.Color(0),
-o=new THREE.Color(0),x,C=new THREE.Vector3,S=[],B=[],V=[],G,E,W,O,I=1;this.domElement=c;this.autoClear=true;this.setQuality=function(A){switch(A){case "high":I=1;break;case "low":I=0}};this.setSize=function(A,L){j=A;y=L;s=j/2;D=y/2;c.setAttribute("viewBox",-s+" "+-D+" "+j+" "+y);c.setAttribute("width",j);c.setAttribute("height",y);K.set(-s,-D,s,D)};this.clear=function(){for(;c.childNodes.length>0;)c.removeChild(c.childNodes[0])};this.render=function(A,L){var T,$,M,J,X,l,n,t;this.autoClear&&this.clear();
-i=k.projectScene(A,L);O=W=E=0;if(h=A.lights.length>0){n=A.lights;r.setRGB(0,0,0);p.setRGB(0,0,0);o.setRGB(0,0,0);T=0;for($=n.length;T<$;T++){M=n[T];J=M.color;if(M instanceof THREE.AmbientLight){r.r+=J.r;r.g+=J.g;r.b+=J.b}else if(M instanceof THREE.DirectionalLight){p.r+=J.r;p.g+=J.g;p.b+=J.b}else if(M instanceof THREE.PointLight){o.r+=J.r;o.g+=J.g;o.b+=J.b}}}T=0;for($=i.length;T<$;T++){n=i[T];u.empty();if(n instanceof THREE.RenderableParticle){q=n;q.x*=s;q.y*=-D;M=0;for(J=n.material.length;M<J;M++)if(t=
-n.material[M]){X=q;l=n;t=t;var H=W++;if(B[H]==null){B[H]=document.createElementNS("http://www.w3.org/2000/svg","circle");I==0&&B[H].setAttribute("shape-rendering","crispEdges")}G=B[H];G.setAttribute("cx",X.x);G.setAttribute("cy",X.y);G.setAttribute("r",l.scale.x*s);if(t instanceof THREE.ParticleCircleMaterial){if(h){m.r=r.r+p.r+o.r;m.g=r.g+p.g+o.g;m.b=r.b+p.b+o.b;e.r=t.color.r*m.r;e.g=t.color.g*m.g;e.b=t.color.b*m.b;e.updateStyleString()}else e=t.color;G.setAttribute("style","fill: "+e.__styleString)}c.appendChild(G)}}else if(n instanceof
-THREE.RenderableLine){q=n.v1;w=n.v2;q.positionScreen.x*=s;q.positionScreen.y*=-D;w.positionScreen.x*=s;w.positionScreen.y*=-D;u.addPoint(q.positionScreen.x,q.positionScreen.y);u.addPoint(w.positionScreen.x,w.positionScreen.y);if(K.instersects(u)){M=0;for(J=n.material.length;M<J;)if(t=n.material[M++]){X=q;l=w;t=t;H=O++;if(V[H]==null){V[H]=document.createElementNS("http://www.w3.org/2000/svg","line");I==0&&V[H].setAttribute("shape-rendering","crispEdges")}G=V[H];G.setAttribute("x1",X.positionScreen.x);
-G.setAttribute("y1",X.positionScreen.y);G.setAttribute("x2",l.positionScreen.x);G.setAttribute("y2",l.positionScreen.y);if(t instanceof THREE.LineBasicMaterial){e.__styleString=t.color.__styleString;G.setAttribute("style","fill: none; stroke: "+e.__styleString+"; stroke-width: "+t.linewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.linecap+"; stroke-linejoin: "+t.linejoin);c.appendChild(G)}}}}else if(n instanceof THREE.RenderableFace3){q=n.v1;w=n.v2;v=n.v3;q.positionScreen.x*=s;q.positionScreen.y*=
--D;w.positionScreen.x*=s;w.positionScreen.y*=-D;v.positionScreen.x*=s;v.positionScreen.y*=-D;u.addPoint(q.positionScreen.x,q.positionScreen.y);u.addPoint(w.positionScreen.x,w.positionScreen.y);u.addPoint(v.positionScreen.x,v.positionScreen.y);if(K.instersects(u)){M=0;for(J=n.meshMaterial.length;M<J;){t=n.meshMaterial[M++];if(t instanceof THREE.MeshFaceMaterial){X=0;for(l=n.faceMaterial.length;X<l;)(t=n.faceMaterial[X++])&&b(q,w,v,n,t,A)}else t&&b(q,w,v,n,t,A)}}}else if(n instanceof THREE.RenderableFace4){q=
-n.v1;w=n.v2;v=n.v3;z=n.v4;q.positionScreen.x*=s;q.positionScreen.y*=-D;w.positionScreen.x*=s;w.positionScreen.y*=-D;v.positionScreen.x*=s;v.positionScreen.y*=-D;z.positionScreen.x*=s;z.positionScreen.y*=-D;u.addPoint(q.positionScreen.x,q.positionScreen.y);u.addPoint(w.positionScreen.x,w.positionScreen.y);u.addPoint(v.positionScreen.x,v.positionScreen.y);u.addPoint(z.positionScreen.x,z.positionScreen.y);if(K.instersects(u)){M=0;for(J=n.meshMaterial.length;M<J;){t=n.meshMaterial[M++];if(t instanceof
-THREE.MeshFaceMaterial){X=0;for(l=n.faceMaterial.length;X<l;)(t=n.faceMaterial[X++])&&d(q,w,v,z,n,t,A)}else t&&d(q,w,v,z,n,t,A)}}}}}};
-THREE.WebGLRenderer=function(a){function b(h,e){var m=c.createProgram();c.attachShader(m,g("fragment","#ifdef GL_ES\nprecision highp float;\n#endif\n"+h));c.attachShader(m,g("vertex",e));c.linkProgram(m);if(!c.getProgramParameter(m,c.LINK_STATUS)){alert("Could not initialise shaders");alert("VALIDATE_STATUS: "+c.getProgramParameter(m,c.VALIDATE_STATUS));alert(c.getError())}m.uniforms={};return m}function d(h,e){var m,r,p;m=0;for(r=e.length;m<r;m++){p=e[m];h.uniforms[p]=c.getUniformLocation(h,p)}}
-function f(h){h.position=c.getAttribLocation(h,"position");c.enableVertexAttribArray(h.position);h.normal=c.getAttribLocation(h,"normal");c.enableVertexAttribArray(h.normal);h.uv=c.getAttribLocation(h,"uv");c.enableVertexAttribArray(h.uv)}function g(h,e){var m;if(h=="fragment")m=c.createShader(c.FRAGMENT_SHADER);else if(h=="vertex")m=c.createShader(c.VERTEX_SHADER);c.shaderSource(m,e);c.compileShader(m);if(!c.getShaderParameter(m,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(m));return null}return m}
-function i(h){switch(h){case THREE.Repeat:return c.REPEAT;case THREE.ClampToEdge:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeat:return c.MIRRORED_REPEAT}return 0}var k=document.createElement("canvas"),c,j,y,s=new THREE.Matrix4,D,q=new Float32Array(16),w=new Float32Array(16),v=new Float32Array(16),z=new Float32Array(9),K=new Float32Array(16);a=function(h,e){if(h){var m,r,p,o=pointLights=maxDirLights=maxPointLights=0;m=0;for(r=h.lights.length;m<r;m++){p=h.lights[m];p instanceof THREE.DirectionalLight&&
-o++;p instanceof THREE.PointLight&&pointLights++}if(pointLights+o<=e){maxDirLights=o;maxPointLights=pointLights}else{maxDirLights=Math.ceil(e*o/(pointLights+o));maxPointLights=e-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:e-1}}(a,4);this.domElement=k;this.autoClear=true;try{c=k.getContext("experimental-webgl",{antialias:true})}catch(u){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}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.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(0,0,0,0);(function(h,e){var m=[h?"#define MAX_DIR_LIGHTS "+h:"",e?"#define MAX_POINT_LIGHTS "+e:"","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;",
-h?"uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];":"",h?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"",e?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",e?"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;",e?"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;",
-h?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",h?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",h?"float directionalLightWeighting = max( dot( transformedNormal, normalize(lDirection.xyz ) ), 0.0 );":"",h?"vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;":"",h?"}":"",e?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",e?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",e?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
-"",e?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",e?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",e?"}":"","}\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"),
-r=[h?"#define MAX_DIR_LIGHTS "+h:"",e?"#define MAX_POINT_LIGHTS "+e:"","uniform int material;\nuniform bool enableMap;\nuniform bool enableCubeMap;\nuniform bool mixEnvMap;\nuniform samplerCube tCube;\nuniform float mReflectivity;\nuniform sampler2D tMap;\nuniform vec4 mColor;\nuniform float mOpacity;\nuniform vec4 mAmbient;\nuniform vec4 mSpecular;\nuniform float mShininess;\nuniform float m2Near;\nuniform float mFarPlusNear;\nuniform float mFarMinusNear;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;",
-h?"uniform mat4 viewMatrix;":"",h?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",e?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform vec3 cameraPosition;\nvoid main() {\nvec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nvec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nif ( enableMap ) {\nmapColor = texture2D( tMap, vUv );\n}\nif ( enableCubeMap ) {\ncubeColor.r = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) ).r;\ncubeColor.g = textureCube( tCube, vec3( -vReflect.x + 0.005, vReflect.yz ) ).g;\ncubeColor.b = textureCube( tCube, vec3( -vReflect.x + 0.01, vReflect.yz ) ).b;\n}\nif ( material == 5 ) { \nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( -wPos.x, wPos.yz ) );\n} else if ( material == 4 ) { \ngl_FragColor = vec4( 0.5*normalize( vNormal ) + vec3(0.5, 0.5, 0.5), mOpacity );\n} else if ( material == 3 ) { \nfloat w = 0.5;\ngl_FragColor = vec4( w, w, w, mOpacity );\n} else if ( material == 2 ) { \nvec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );",
-e?"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",e?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",e?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",e?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",e?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",e?"float pointSpecularWeight = 0.0;":"",e?"if ( pointDotNormalHalf >= 0.0 )":
-"",e?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",e?"pointDiffuse  += mColor * pointDiffuseWeight;":"",e?"pointSpecular += mSpecular * pointSpecularWeight;":"",e?"}":"",h?"vec4 dirDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",h?"vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",h?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",h?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",h?"vec3 dirVector = normalize( lDirection.xyz );":"",h?"vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );":
-"",h?"float dirDotNormalHalf = dot( normal, dirHalfVector );":"",h?"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );":"",h?"float dirSpecularWeight = 0.0;":"",h?"if ( dirDotNormalHalf >= 0.0 )":"",h?"dirSpecularWeight = pow( dirDotNormalHalf, mShininess );":"",h?"dirDiffuse  += mColor * dirDiffuseWeight;":"",h?"dirSpecular += mSpecular * dirSpecularWeight;":"",h?"}":"","vec4 totalLight = mAmbient;",h?"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");
-j=b(r,m);c.useProgram(j);d(j,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract","m2Near","mFarPlusNear","mFarMinusNear"]);h&&d(j,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);e&&d(j,["pointLightNumber","pointLightColor",
-"pointLightPosition"]);c.uniform1i(j.uniforms.enableMap,0);c.uniform1i(j.uniforms.tMap,0);c.uniform1i(j.uniforms.enableCubeMap,0);c.uniform1i(j.uniforms.tCube,1);c.uniform1i(j.uniforms.mixEnvMap,0);c.uniform1i(j.uniforms.useRefract,0);f(j)})(a.directional,a.point);this.setSize=function(h,e){k.width=h;k.height=e;c.viewport(0,0,k.width,k.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(h,e){var m,r,p,o,x,C=[],S=[],B=[];o=[];x=[];c.uniform1i(h.uniforms.enableLighting,
-e.lights.length);m=0;for(r=e.lights.length;m<r;m++){p=e.lights[m];if(p instanceof THREE.AmbientLight)C.push(p);else if(p instanceof THREE.DirectionalLight)B.push(p);else p instanceof THREE.PointLight&&S.push(p)}m=p=o=x=0;for(r=C.length;m<r;m++){p+=C[m].color.r;o+=C[m].color.g;x+=C[m].color.b}c.uniform3f(h.uniforms.ambientLightColor,p,o,x);o=[];x=[];m=0;for(r=B.length;m<r;m++){p=B[m];o.push(p.color.r*p.intensity);o.push(p.color.g*p.intensity);o.push(p.color.b*p.intensity);x.push(p.position.x);x.push(p.position.y);
-x.push(p.position.z)}if(B.length){c.uniform1i(h.uniforms.directionalLightNumber,B.length);c.uniform3fv(h.uniforms.directionalLightDirection,x);c.uniform3fv(h.uniforms.directionalLightColor,o)}o=[];x=[];m=0;for(r=S.length;m<r;m++){p=S[m];o.push(p.color.r*p.intensity);o.push(p.color.g*p.intensity);o.push(p.color.b*p.intensity);x.push(p.position.x);x.push(p.position.y);x.push(p.position.z)}if(S.length){c.uniform1i(h.uniforms.pointLightNumber,S.length);c.uniform3fv(h.uniforms.pointLightPosition,x);c.uniform3fv(h.uniforms.pointLightColor,
-o)}};this.createBuffers=function(h,e){var m,r,p,o,x,C,S,B,V=[],G=[],E=[],W=[],O=[],I=0,A=h.materialFaceGroup[e],L;p=false;m=0;for(r=h.material.length;m<r;m++){meshMaterial=h.material[m];if(meshMaterial instanceof THREE.MeshFaceMaterial){x=0;for(L=A.material.length;x<L;x++)if(A.material[x]&&A.material[x].shading!=undefined&&A.material[x].shading==THREE.SmoothShading){p=true;break}}else if(meshMaterial&&meshMaterial.shading!=undefined&&meshMaterial.shading==THREE.SmoothShading){p=true;break}if(p)break}L=
-p;m=0;for(r=A.faces.length;m<r;m++){p=A.faces[m];o=h.geometry.faces[p];x=o.vertexNormals;faceNormal=o.normal;p=h.geometry.uvs[p];if(o instanceof THREE.Face3){C=h.geometry.vertices[o.a].position;S=h.geometry.vertices[o.b].position;B=h.geometry.vertices[o.c].position;E.push(C.x,C.y,C.z);E.push(S.x,S.y,S.z);E.push(B.x,B.y,B.z);if(x.length==3&&L)for(o=0;o<3;o++)W.push(x[o].x,x[o].y,x[o].z);else for(o=0;o<3;o++)W.push(faceNormal.x,faceNormal.y,faceNormal.z);if(p)for(o=0;o<3;o++)O.push(p[o].u,p[o].v);V.push(I,
-I+1,I+2);G.push(I,I+1);G.push(I,I+2);G.push(I+1,I+2);I+=3}else if(o instanceof THREE.Face4){C=h.geometry.vertices[o.a].position;S=h.geometry.vertices[o.b].position;B=h.geometry.vertices[o.c].position;o=h.geometry.vertices[o.d].position;E.push(C.x,C.y,C.z);E.push(S.x,S.y,S.z);E.push(B.x,B.y,B.z);E.push(o.x,o.y,o.z);if(x.length==4&&L)for(o=0;o<4;o++)W.push(x[o].x,x[o].y,x[o].z);else for(o=0;o<4;o++)W.push(faceNormal.x,faceNormal.y,faceNormal.z);if(p)for(o=0;o<4;o++)O.push(p[o].u,p[o].v);V.push(I,I+
-1,I+2);V.push(I,I+2,I+3);G.push(I,I+1);G.push(I,I+2);G.push(I,I+3);G.push(I+1,I+2);G.push(I+2,I+3);I+=4}}if(E.length){A.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,A.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(E),c.STATIC_DRAW);A.__webGLNormalBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,A.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(W),c.STATIC_DRAW);A.__webGLUVBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,A.__webGLUVBuffer);
-c.bufferData(c.ARRAY_BUFFER,new Float32Array(O),c.STATIC_DRAW);A.__webGLFaceBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(V),c.STATIC_DRAW);A.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(G),c.STATIC_DRAW);A.__webGLFaceCount=V.length;A.__webGLLineCount=G.length}};this.renderBuffer=function(h,e,m){var r,p,o,x,C,S,B,
-V,G,E;if(e instanceof THREE.MeshShaderMaterial){if(!e.program){e.program=b(e.fragment_shader,e.vertex_shader);C=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objMatrix","cameraPosition"];for(E in e.uniforms)C.push(E);d(e.program,C);f(e.program)}E=e.program}else E=j;if(E!=y){c.useProgram(E);y=E}if(e instanceof THREE.MeshShaderMaterial){C=E;V=e.uniforms;var W,O;for(p in V){W=V[p].type;G=V[p].value;O=C.uniforms[p];if(W=="i")c.uniform1i(O,G);else if(W=="f")c.uniform1f(O,G);else if(W==
-"t"){c.uniform1i(O,G);G=V[p].texture;if(G instanceof THREE.TextureCube&&G.image.length==6){if(!G.image.__webGLTextureCube&&!G.image.__cubeMapInitialized&&G.image.loadCount==6){G.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,G.image.__webGLTextureCube);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,
-c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(W=0;W<6;++W)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,G.image[W]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);G.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE1);c.bindTexture(c.TEXTURE_CUBE_MAP,G.image.__webGLTextureCube)}}}this.loadCamera(E,h);this.loadMatrices(E)}else if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshBasicMaterial){h=
-e.color;r=e.opacity;o=e.wireframe;x=e.wireframe_linewidth;S=e.map;B=e.env_map;C=e.combine==THREE.Mix;p=e.reflectivity;G=e.env_map&&e.env_map.mapping==THREE.RefractionMap;V=e.refraction_ratio;c.uniform4f(E.uniforms.mColor,h.r*r,h.g*r,h.b*r,r);c.uniform1i(E.uniforms.mixEnvMap,C);c.uniform1f(E.uniforms.mReflectivity,p);c.uniform1i(E.uniforms.useRefract,G);c.uniform1f(E.uniforms.mRefractionRatio,V)}if(e instanceof THREE.MeshNormalMaterial){r=e.opacity;c.uniform1f(E.uniforms.mOpacity,r);c.uniform1i(E.uniforms.material,
-4)}else if(e instanceof THREE.MeshDepthMaterial){r=e.opacity;o=e.wireframe;x=e.wireframe_linewidth;c.uniform1f(E.uniforms.mOpacity,r);c.uniform1f(E.uniforms.m2Near,e.__2near);c.uniform1f(E.uniforms.mFarPlusNear,e.__farPlusNear);c.uniform1f(E.uniforms.mFarMinusNear,e.__farMinusNear);c.uniform1i(E.uniforms.material,3)}else if(e instanceof THREE.MeshPhongMaterial){h=e.ambient;p=e.specular;C=e.shininess;c.uniform4f(E.uniforms.mAmbient,h.r,h.g,h.b,r);c.uniform4f(E.uniforms.mSpecular,p.r,p.g,p.b,r);c.uniform1f(E.uniforms.mShininess,
-C);c.uniform1i(E.uniforms.material,2)}else if(e instanceof THREE.MeshLambertMaterial)c.uniform1i(E.uniforms.material,1);else if(e instanceof THREE.MeshBasicMaterial)c.uniform1i(E.uniforms.material,0);else if(e instanceof THREE.MeshCubeMaterial){c.uniform1i(E.uniforms.material,5);B=e.env_map}if(S){if(!e.map.__webGLTexture&&e.map.image.loaded){e.map.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,e.map.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,e.map.image);
-c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,i(e.map.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,i(e.map.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,e.map.__webGLTexture);c.uniform1i(E.uniforms.tMap,0);c.uniform1i(E.uniforms.enableMap,1)}else c.uniform1i(E.uniforms.enableMap,
-0);if(B){if(e.env_map&&e.env_map instanceof THREE.TextureCube&&e.env_map.image.length==6){if(!e.env_map.image.__webGLTextureCube&&!e.env_map.image.__cubeMapInitialized&&e.env_map.image.loadCount==6){e.env_map.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,e.env_map.image.__webGLTextureCube);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,
-c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(r=0;r<6;++r)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,e.env_map.image[r]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);e.env_map.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE1);c.bindTexture(c.TEXTURE_CUBE_MAP,e.env_map.image.__webGLTextureCube);c.uniform1i(E.uniforms.tCube,1)}c.uniform1i(E.uniforms.enableCubeMap,1)}else c.uniform1i(E.uniforms.enableCubeMap,
-0);c.bindBuffer(c.ARRAY_BUFFER,m.__webGLVertexBuffer);c.vertexAttribPointer(E.position,3,c.FLOAT,false,0,0);c.bindBuffer(c.ARRAY_BUFFER,m.__webGLNormalBuffer);c.vertexAttribPointer(E.normal,3,c.FLOAT,false,0,0);if(S){c.bindBuffer(c.ARRAY_BUFFER,m.__webGLUVBuffer);c.enableVertexAttribArray(E.uv);c.vertexAttribPointer(E.uv,2,c.FLOAT,false,0,0)}else c.disableVertexAttribArray(E.uv);if(o){c.lineWidth(x);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webGLLineBuffer);c.drawElements(c.LINES,m.__webGLLineCount,
-c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,m.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(h,e,m,r,p){var o,x,C,S,B;C=0;for(S=e.material.length;C<S;C++){o=e.material[C];if(o instanceof THREE.MeshFaceMaterial){o=0;for(x=m.material.length;o<x;o++)if((B=m.material[o])&&B.blending==r&&B.opacity<1==p){this.setBlending(B.blending);this.renderBuffer(h,B,m)}}else if((B=o)&&B.blending==r&&B.opacity<1==p){this.setBlending(B.blending);
-this.renderBuffer(h,B,m)}}};this.render=function(h,e){var m,r;this.initWebGLObjects(h);this.autoClear&&this.clear();e.autoUpdateMatrix&&e.updateMatrix();this.loadCamera(j,e);this.setupLights(j,h);m=0;for(r=h.__webGLObjects.length;m<r;m++){webGLObject=h.__webGLObjects[m];if(webGLObject.__object.visible){this.setupMatrices(webGLObject.__object,e);this.loadMatrices(j);this.renderPass(e,webGLObject.__object,webGLObject,THREE.NormalBlending,false)}}m=0;for(r=h.__webGLObjects.length;m<r;m++){webGLObject=
-h.__webGLObjects[m];if(webGLObject.__object.visible){this.setupMatrices(webGLObject.__object,e);this.loadMatrices(j);this.renderPass(e,webGLObject.__object,webGLObject,THREE.AdditiveBlending,false);this.renderPass(e,webGLObject.__object,webGLObject,THREE.SubtractiveBlending,false);this.renderPass(e,webGLObject.__object,webGLObject,THREE.AdditiveBlending,true);this.renderPass(e,webGLObject.__object,webGLObject,THREE.SubtractiveBlending,true);this.renderPass(e,webGLObject.__object,webGLObject,THREE.NormalBlending,
-true)}}};this.initWebGLObjects=function(h){var e,m,r,p,o;if(!h.__webGLObjects)h.__webGLObjects=[];e=0;for(m=h.objects.length;e<m;e++){r=h.objects[e];if(r instanceof THREE.Mesh)for(p in r.materialFaceGroup){o=r.materialFaceGroup[p];if(!o.__webGLVertexBuffer){this.createBuffers(r,p);o.__object=r;h.__webGLObjects.push(o)}}}};this.removeObject=function(h,e){var m,r;for(m=h.__webGLObjects.length-1;m>=0;m--){r=h.__webGLObjects[m].__object;e==r&&h.__webGLObjects.splice(m,1)}};this.setupMatrices=function(h,
-e){h.autoUpdateMatrix&&h.updateMatrix();s.multiply(e.matrix,h.matrix);q.set(e.matrix.flatten());w.set(s.flatten());v.set(e.projectionMatrix.flatten());D=THREE.Matrix4.makeInvert3x3(s).transpose();z.set(D.m);K.set(h.matrix.flatten())};this.loadMatrices=function(h){c.uniformMatrix4fv(h.uniforms.viewMatrix,false,q);c.uniformMatrix4fv(h.uniforms.modelViewMatrix,false,w);c.uniformMatrix4fv(h.uniforms.projectionMatrix,false,v);c.uniformMatrix3fv(h.uniforms.normalMatrix,false,z);c.uniformMatrix4fv(h.uniforms.objMatrix,
-false,K)};this.loadCamera=function(h,e){c.uniform3f(h.uniforms.cameraPosition,e.position.x,e.position.y,e.position.z)};this.setBlending=function(h){switch(h){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(h,e){if(h){!e||e=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(h=="back")c.cullFace(c.BACK);
-else h=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.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};
-var GeometryUtils={merge:function(a,b){var d=b instanceof THREE.Mesh,f=a.vertices.length,g=d?b.geometry:b,i=a.vertices,k=g.vertices,c=a.faces,j=g.faces,y=a.uvs;g=g.uvs;d&&b.updateMatrix();for(var s=0,D=k.length;s<D;s++){var q=new THREE.Vertex(k[s].position.clone());d&&b.matrix.transform(q.position);i.push(q)}s=0;for(D=j.length;s<D;s++){d=j[s];var w;k=d.vertexNormals;if(d instanceof THREE.Face3)w=new THREE.Face3(d.a+f,d.b+f,d.c+f);else if(d instanceof THREE.Face4)w=new THREE.Face4(d.a+f,d.b+f,d.c+
-f,d.d+f);d=0;for(i=k.length;d<i;d++){q=k[d];w.vertexNormals.push(q.clone())}c.push(w)}s=0;for(D=g.length;s<D;s++){f=g[s];c=[];d=0;for(i=f.length;d<i;d++)c.push(new THREE.UV(f[d].u,f[d].v));y.push(c)}}},ImageUtils={loadArray:function(a){var b,d,f=[];b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].loaded=0;f[b].onload=function(){f.loadCount+=1;this.loaded=1};f[b].src=a[b]}return f}},SceneUtils={addMesh:function(a,b,d,f,g,i,k,c,j,y){b=new THREE.Mesh(b,y);b.scale.x=b.scale.y=b.scale.z=d;b.position.x=
-f;b.position.y=g;b.position.z=i;b.rotation.x=k;b.rotation.y=c;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,d){d=new THREE.MeshCubeMaterial({env_map:d});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,true),d);a.addObject(b);return b},addPanoramaCube:function(a,b,d){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));
-f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));mesh=new THREE.Mesh(new Cube(b,b,b,1,1,f,true),new THREE.MeshFaceMaterial);a.addObject(mesh);return mesh},addPanoramaCubePlanes:function(a,b,d){var f=b/2;b=new Plane(b,b);var g=Math.PI/2,i=Math.PI;SceneUtils.addMesh(a,b,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));SceneUtils.addMesh(a,b,1,-f,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));
-SceneUtils.addMesh(a,b,1,f,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));SceneUtils.addMesh(a,b,1,0,f,0,g,0,i,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));SceneUtils.addMesh(a,b,1,0,-f,0,-g,0,i,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},
-fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
-vertex_shader:"attribute vec3 position;\nattribute vec3 normal;\nattribute vec3 uv;\nuniform mat4 objMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform vec3 cameraPosition;\nuniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main(void) {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objMatrix[0].xyz, objMatrix[1].xyz, objMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"}}},
-Cube=function(a,b,d,f,g,i,k){function c(w,v,z,K,u,h,e,m){var r=f||1,p=g||1,o=r+1,x=p+1;u=u/r;h=h/p;var C=j.vertices.length,S;if(w=="x"&&v=="y"||w=="y"&&v=="x")S="z";else if(w=="x"&&v=="z"||w=="z"&&v=="x")S="y";else if(w=="z"&&v=="y"||w=="y"&&v=="z")S="x";for(iy=0;iy<x;iy++)for(ix=0;ix<o;ix++){var B=new THREE.Vector3;B[w]=(ix*u-y)*z;B[v]=(iy*h-s)*K;B[S]=e;j.vertices.push(new THREE.Vertex(B))}for(iy=0;iy<p;iy++)for(ix=0;ix<r;ix++){j.faces.push(new THREE.Face4(ix+o*iy+C,ix+o*(iy+1)+C,ix+1+o*(iy+1)+C,
-ix+1+o*iy+C,null,m));j.uvs.push([new THREE.UV(ix/r,iy/p),new THREE.UV(ix/r,(iy+1)/p),new THREE.UV((ix+1)/r,(iy+1)/p),new THREE.UV((ix+1)/r,iy/p)])}}THREE.Geometry.call(this);var j=this,y=a/2,s=b/2,D=d/2;k=k?-1:1;if(i!==undefined)if(i instanceof Array)this.materials=i;else{this.materials=[];for(var q=0;q<6;q++)this.materials.push([i])}else this.materials=[];c("z","y",1*k,-1,d,b,-y,this.materials[0]);c("z","y",-1*k,-1,d,b,y,this.materials[1]);c("x","z",1*k,1,a,d,s,this.materials[2]);c("x","z",1*k,-1,
-a,d,-s,this.materials[3]);c("x","y",1*k,-1,a,b,D,this.materials[4]);c("x","y",-1*k,-1,a,b,-D,this.materials[5]);(function(){for(var w=[],v=[],z=0,K=j.vertices.length;z<K;z++){for(var u=j.vertices[z],h=false,e=0,m=w.length;e<m;e++){var r=w[e];if(u.position.x==r.position.x&&u.position.y==r.position.y&&u.position.z==r.position.z){v[z]=e;h=true;break}}if(!h){v[z]=w.length;w.push(new THREE.Vertex(u.position.clone()))}}z=0;for(K=j.faces.length;z<K;z++){u=j.faces[z];u.a=v[u.a];u.b=v[u.b];u.c=v[u.c];u.d=
-v[u.d]}j.vertices=w})();this.computeCentroids();this.computeNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,b,d,f,g){function i(j,y,s){k.vertices.push(new THREE.Vertex(new THREE.Vector3(j,y,s)))}THREE.Geometry.call(this);var k=this,c;for(c=0;c<a;c++)i(Math.sin(6.283*c/a)*b,Math.cos(6.283*c/a)*b,0);for(c=0;c<a;c++)i(Math.sin(6.283*c/a)*d,Math.cos(6.283*c/a)*d,f);for(c=0;c<a;c++)k.faces.push(new THREE.Face4(c,c+a,a+(c+1)%a,(c+1)%a));if(d!=0){i(0,0,-g);for(c=a;c<a+a/2;c++)k.faces.push(new THREE.Face4(2*a,(2*c-2*a)%a,(2*c-2*a+1)%a,(2*c-2*a+2)%a))}if(b!=0){i(0,0,f+g);for(c=a+a/2;c<2*
-a;c++)k.faces.push(new THREE.Face4((2*c-2*a+2)%a+a,(2*c-2*a+1)%a+a,(2*c-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Plane=function(a,b,d,f){THREE.Geometry.call(this);var g,i=a/2,k=b/2;d=d||1;f=f||1;var c=d+1,j=f+1;a=a/d;var y=b/f;for(g=0;g<j;g++)for(b=0;b<c;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-i,-(g*y-k),0)));for(g=0;g<f;g++)for(b=0;b<d;b++){this.faces.push(new THREE.Face4(b+c*g,b+c*(g+1),b+1+c*(g+1),b+1+c*g));this.uvs.push([new THREE.UV(b/d,g/f),new THREE.UV(b/d,(g+1)/f),new THREE.UV((b+1)/d,(g+1)/f),new THREE.UV((b+1)/d,g/f)])}this.computeCentroids();this.computeNormals()};
-Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,b,d){THREE.Geometry.call(this);var f,g=Math.max(3,b||8),i=Math.max(2,d||6);b=[];for(d=0;d<i+1;d++){f=d/i;var k=a*Math.cos(f*Math.PI),c=a*Math.sin(f*Math.PI),j=[],y=0;for(f=0;f<g;f++){var s=2*f/g,D=c*Math.sin(s*Math.PI);s=c*Math.cos(s*Math.PI);(d==0||d==i)&&f>0||(y=this.vertices.push(new THREE.Vertex(new THREE.Vector3(s,k,D)))-1);j.push(y)}b.push(j)}var q,w,v;a=b.length;for(d=0;d<a;d++){g=b[d].length;if(d>0)for(f=0;f<g;f++){j=f==g-1;i=b[d][j?0:f+1];k=b[d][j?g-1:f];c=b[d-1][j?
-g-1:f];j=b[d-1][j?0:f+1];D=d/(a-1);q=(d-1)/(a-1);w=(f+1)/g;s=f/g;y=new THREE.UV(1-w,D);D=new THREE.UV(1-s,D);s=new THREE.UV(1-s,q);var z=new THREE.UV(1-w,q);if(d<b.length-1){q=this.vertices[i].position.clone();w=this.vertices[k].position.clone();v=this.vertices[c].position.clone();q.normalize();w.normalize();v.normalize();this.faces.push(new THREE.Face3(i,k,c,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(v.x,v.y,v.z)]));this.uvs.push([y,D,s])}if(d>1){q=this.vertices[i].position.clone();
-w=this.vertices[c].position.clone();v=this.vertices[j].position.clone();q.normalize();w.normalize();v.normalize();this.faces.push(new THREE.Face3(i,c,j,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(v.x,v.y,v.z)]));this.uvs.push([y,s,z])}}}this.computeCentroids();this.computeNormals()};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?this.addStatusElement():null};
-THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
-b},loadAsciiOld:function(a,b){var d=document.createElement("script");d.type="text/javascript";d.onload=b;d.src=a;document.getElementsByTagName("head")[0].appendChild(d)},loadAscii:function(a,b,d){var f=(new Date).getTime();a=new Worker(a);a.onmessage=function(g){THREE.Loader.prototype.createModel(g.data,b,d)};a.postMessage(f)},loadBinary:function(a,b,d){var f=(new Date).getTime();a=new Worker(a);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(i){THREE.Loader.prototype.loadAjaxBuffers(i.data.buffers,
-i.data.materials,b,d,g)};a.onerror=function(i){alert("worker.onerror: "+i.message+"\n"+i.data);i.preventDefault()};a.postMessage(f)},loadAjaxBuffers:function(a,b,d,f,g){var i=new XMLHttpRequest,k=f+"/"+a,c=0;i.onreadystatechange=function(){if(i.readyState==4)i.status==200||i.status==0?THREE.Loader.prototype.createBinModel(i.responseText,d,f,b):alert("Couldn't load ["+k+"] ["+i.status+"]");else if(i.readyState==3){if(g){if(c==0)c=i.getResponseHeader("Content-Length");g({total:c,loaded:i.responseText.length})}}else if(i.readyState==
-2)c=i.getResponseHeader("Content-Length")};i.open("GET",k,true);i.overrideMimeType("text/plain; charset=x-user-defined");i.setRequestHeader("Content-Type","text/plain");i.send(null)},createBinModel:function(a,b,d,f){var g=function(i){function k(l,n){var t=s(l,n),H=s(l,n+1),Q=s(l,n+2),ba=s(l,n+3),fa=(ba<<1&255|Q>>7)-127;t=(Q&127)<<16|H<<8|t;if(t==0&&fa==-127)return 0;return(1-2*(ba>>7))*(1+t*Math.pow(2,-23))*Math.pow(2,fa)}function c(l,n){var t=s(l,n),H=s(l,n+1),Q=s(l,n+2);return(s(l,n+3)<<24)+(Q<<
-16)+(H<<8)+t}function j(l,n){var t=s(l,n);return(s(l,n+1)<<8)+t}function y(l,n){var t=s(l,n);return t>127?t-256:t}function s(l,n){return l.charCodeAt(n)&255}function D(l){var n,t,H;n=c(a,l);t=c(a,l+p);H=c(a,l+o);l=j(a,l+x);THREE.Loader.prototype.f3(u,n,t,H,l)}function q(l){var n,t,H,Q,ba,fa;n=c(a,l);t=c(a,l+p);H=c(a,l+o);Q=j(a,l+x);ba=c(a,l+C);fa=c(a,l+S);l=c(a,l+B);THREE.Loader.prototype.f3n(u,m,n,t,H,Q,ba,fa,l)}function w(l){var n,t,H,Q;n=c(a,l);t=c(a,l+V);H=c(a,l+G);Q=c(a,l+E);l=j(a,l+W);THREE.Loader.prototype.f4(u,
-n,t,H,Q,l)}function v(l){var n,t,H,Q,ba,fa,ka,ra;n=c(a,l);t=c(a,l+V);H=c(a,l+G);Q=c(a,l+E);ba=j(a,l+W);fa=c(a,l+O);ka=c(a,l+I);ra=c(a,l+A);l=c(a,l+L);THREE.Loader.prototype.f4n(u,m,n,t,H,Q,ba,fa,ka,ra,l)}function z(l){var n,t;n=c(a,l);t=c(a,l+T);l=c(a,l+$);THREE.Loader.prototype.uv3(u,r[n*2],r[n*2+1],r[t*2],r[t*2+1],r[l*2],r[l*2+1])}function K(l){var n,t,H;n=c(a,l);t=c(a,l+M);H=c(a,l+J);l=c(a,l+X);THREE.Loader.prototype.uv4(u,r[n*2],r[n*2+1],r[t*2],r[t*2+1],r[H*2],r[H*2+1],r[l*2],r[l*2+1])}var u=
-this,h=0,e,m=[],r=[],p,o,x,C,S,B,V,G,E,W,O,I,A,L,T,$,M,J,X;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(u,f,i);e={signature:a.substr(h,8),header_bytes:s(a,h+8),vertex_coordinate_bytes:s(a,h+9),normal_coordinate_bytes:s(a,h+10),uv_coordinate_bytes:s(a,h+11),vertex_index_bytes:s(a,h+12),normal_index_bytes:s(a,h+13),uv_index_bytes:s(a,h+14),material_index_bytes:s(a,h+15),nvertices:c(a,h+16),nnormals:c(a,h+16+4),nuvs:c(a,h+16+8),ntri_flat:c(a,h+16+12),ntri_smooth:c(a,h+16+16),ntri_flat_uv:c(a,
-h+16+20),ntri_smooth_uv:c(a,h+16+24),nquad_flat:c(a,h+16+28),nquad_smooth:c(a,h+16+32),nquad_flat_uv:c(a,h+16+36),nquad_smooth_uv:c(a,h+16+40)};h+=e.header_bytes;p=e.vertex_index_bytes;o=e.vertex_index_bytes*2;x=e.vertex_index_bytes*3;C=e.vertex_index_bytes*3+e.material_index_bytes;S=e.vertex_index_bytes*3+e.material_index_bytes+e.normal_index_bytes;B=e.vertex_index_bytes*3+e.material_index_bytes+e.normal_index_bytes*2;V=e.vertex_index_bytes;G=e.vertex_index_bytes*2;E=e.vertex_index_bytes*3;W=e.vertex_index_bytes*
-4;O=e.vertex_index_bytes*4+e.material_index_bytes;I=e.vertex_index_bytes*4+e.material_index_bytes+e.normal_index_bytes;A=e.vertex_index_bytes*4+e.material_index_bytes+e.normal_index_bytes*2;L=e.vertex_index_bytes*4+e.material_index_bytes+e.normal_index_bytes*3;T=e.uv_index_bytes;$=e.uv_index_bytes*2;M=e.uv_index_bytes;J=e.uv_index_bytes*2;X=e.uv_index_bytes*3;h+=function(l){var n,t,H,Q=e.vertex_coordinate_bytes*3,ba=l+e.nvertices*Q;for(l=l;l<ba;l+=Q){n=k(a,l);t=k(a,l+e.vertex_coordinate_bytes);H=
-k(a,l+e.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(u,n,t,H)}return e.nvertices*Q}(h);h+=function(l){var n,t,H,Q=e.normal_coordinate_bytes*3,ba=l+e.nnormals*Q;for(l=l;l<ba;l+=Q){n=y(a,l);t=y(a,l+e.normal_coordinate_bytes);H=y(a,l+e.normal_coordinate_bytes*2);m.push(n/127,t/127,H/127)}return e.nnormals*Q}(h);h+=function(l){var n,t,H=e.uv_coordinate_bytes*2,Q=l+e.nuvs*H;for(l=l;l<Q;l+=H){n=k(a,l);t=k(a,l+e.uv_coordinate_bytes);r.push(n,t)}return e.nuvs*H}(h);h+=function(l){var n,t=e.vertex_index_bytes*
-3+e.material_index_bytes,H=l+e.ntri_flat*t;for(n=l;n<H;n+=t)D(n);return H-l}(h);h+=function(l){var n,t=e.vertex_index_bytes*3+e.material_index_bytes+e.normal_index_bytes*3,H=l+e.ntri_smooth*t;for(n=l;n<H;n+=t)q(n);return H-l}(h);h+=function(l){var n,t=e.vertex_index_bytes*3+e.material_index_bytes,H=t+e.uv_index_bytes*3,Q=l+e.ntri_flat_uv*H;for(n=l;n<Q;n+=H){D(n);z(n+t)}return Q-l}(h);h+=function(l){var n,t=e.vertex_index_bytes*3+e.material_index_bytes+e.normal_index_bytes*3,H=t+e.uv_index_bytes*3,
-Q=l+e.ntri_smooth_uv*H;for(n=l;n<Q;n+=H){q(n);z(n+t)}return Q-l}(h);h+=function(l){var n,t=e.vertex_index_bytes*4+e.material_index_bytes,H=l+e.nquad_flat*t;for(n=l;n<H;n+=t)w(n);return H-l}(h);h+=function(l){var n,t=e.vertex_index_bytes*4+e.material_index_bytes+e.normal_index_bytes*4,H=l+e.nquad_smooth*t;for(n=l;n<H;n+=t)v(n);return H-l}(h);h+=function(l){var n,t=e.vertex_index_bytes*4+e.material_index_bytes,H=t+e.uv_index_bytes*4,Q=l+e.nquad_flat_uv*H;for(n=l;n<Q;n+=H){w(n);K(n+t)}return Q-l}(h);
-h+=function(l){var n,t=e.vertex_index_bytes*4+e.material_index_bytes+e.normal_index_bytes*4,H=t+e.uv_index_bytes*4,Q=l+e.nquad_smooth_uv*H;for(n=l;n<Q;n+=H){v(n);K(n+t)}return Q-l}(h);this.computeCentroids();this.computeNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g(d))},createModel:function(a,b,d){var f=function(g){var i=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(i,a.materials,g);(function(){var k,c,j,y,s;k=0;for(c=a.vertices.length;k<c;k+=3){j=
-a.vertices[k];y=a.vertices[k+1];s=a.vertices[k+2];THREE.Loader.prototype.v(i,j,y,s)}})();(function(){function k(v,z){THREE.Loader.prototype.f3(i,v[z],v[z+1],v[z+2],v[z+3])}function c(v,z){THREE.Loader.prototype.f3n(i,a.normals,v[z],v[z+1],v[z+2],v[z+3],v[z+4],v[z+5],v[z+6])}function j(v,z){THREE.Loader.prototype.f4(i,v[z],v[z+1],v[z+2],v[z+3],v[z+4])}function y(v,z){THREE.Loader.prototype.f4n(i,a.normals,v[z],v[z+1],v[z+2],v[z+3],v[z+4],v[z+5],v[z+6],v[z+7],v[z+8])}function s(v,z){var K,u,h;K=v[z];
-u=v[z+1];h=v[z+2];THREE.Loader.prototype.uv3(i,a.uvs[K*2],a.uvs[K*2+1],a.uvs[u*2],a.uvs[u*2+1],a.uvs[h*2],a.uvs[h*2+1])}function D(v,z){var K,u,h,e;K=v[z];u=v[z+1];h=v[z+2];e=v[z+3];THREE.Loader.prototype.uv4(i,a.uvs[K*2],a.uvs[K*2+1],a.uvs[u*2],a.uvs[u*2+1],a.uvs[h*2],a.uvs[h*2+1],a.uvs[e*2],a.uvs[e*2+1])}var q,w;q=0;for(w=a.triangles.length;q<w;q+=4)k(a.triangles,q);q=0;for(w=a.triangles_uv.length;q<w;q+=7){k(a.triangles_uv,q);s(a.triangles_uv,q+4)}q=0;for(w=a.triangles_n.length;q<w;q+=7)c(a.triangles_n,
-q);q=0;for(w=a.triangles_n_uv.length;q<w;q+=10){c(a.triangles_n_uv,q);s(a.triangles_n_uv,q+7)}q=0;for(w=a.quads.length;q<w;q+=5)j(a.quads,q);q=0;for(w=a.quads_uv.length;q<w;q+=9){j(a.quads_uv,q);D(a.quads_uv,q+5)}q=0;for(w=a.quads_n.length;q<w;q+=9)y(a.quads_n,q);q=0;for(w=a.quads_n_uv.length;q<w;q+=13){y(a.quads_n_uv,q);D(a.quads_n_uv,q+9)}})();this.computeCentroids();this.computeNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(d))},v:function(a,b,d,f){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,
-d,f)))},f3:function(a,b,d,f,g){a.faces.push(new THREE.Face3(b,d,f,null,a.materials[g]))},f4:function(a,b,d,f,g,i){a.faces.push(new THREE.Face4(b,d,f,g,null,a.materials[i]))},f3n:function(a,b,d,f,g,i,k,c,j){i=a.materials[i];var y=b[c*3],s=b[c*3+1];c=b[c*3+2];var D=b[j*3],q=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(d,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(y,s,c),new THREE.Vector3(D,q,j)],i))},f4n:function(a,b,d,f,g,i,k,c,j,y,s){k=a.materials[k];var D=b[j*3],q=b[j*
-3+1];j=b[j*3+2];var w=b[y*3],v=b[y*3+1];y=b[y*3+2];var z=b[s*3],K=b[s*3+1];s=b[s*3+2];a.faces.push(new THREE.Face4(d,f,g,i,[new THREE.Vector3(b[c*3],b[c*3+1],b[c*3+2]),new THREE.Vector3(D,q,j),new THREE.Vector3(w,v,y),new THREE.Vector3(z,K,s)],k))},uv3:function(a,b,d,f,g,i,k){var c=[];c.push(new THREE.UV(b,d));c.push(new THREE.UV(f,g));c.push(new THREE.UV(i,k));a.uvs.push(c)},uv4:function(a,b,d,f,g,i,k,c,j){var y=[];y.push(new THREE.UV(b,d));y.push(new THREE.UV(f,g));y.push(new THREE.UV(i,k));y.push(new THREE.UV(c,
-j));a.uvs.push(y)},init_materials:function(a,b,d){a.materials=[];for(var f=0;f<b.length;++f)a.materials[f]=[THREE.Loader.prototype.createMaterial(b[f],d)]},createMaterial:function(a,b){function d(i){i=Math.log(i)/Math.LN2;return Math.floor(i)==i}var f,g;if(a.map_diffuse&&b){g=document.createElement("canvas");f=new THREE.MeshLambertMaterial({map:new THREE.Texture(g)});g=new Image;g.onload=function(){if(!d(this.width)||!d(this.height)){var i=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),k=Math.pow(2,
-Math.round(Math.log(this.height)/Math.LN2));f.map.image.width=i;f.map.image.height=k;f.map.image.getContext("2d").drawImage(this,0,0,i,k)}else f.map.image=this;f.map.image.loaded=1};g.src=b+"/"+a.map_diffuse}else if(a.col_diffuse){g=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*255;f=new THREE.MeshLambertMaterial({color:g,opacity:a.transparency})}else f=a.a_dbg_color?new THREE.MeshLambertMaterial({color:a.a_dbg_color}):new THREE.MeshLambertMaterial({color:15658734});return f}};
+// ThreeExtras.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,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,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,f=this.z;this.x=d*a.z-f*a.y;this.y=f*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,f){this.x=a||0;this.y=c||0;this.z=d||0;this.w=f||1};
+THREE.Vector4.prototype={set:function(a,c,d,f){this.x=a;this.y=c;this.z=d;this.w=f;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,d,f=a.objects,g=[];a=0;for(c=f.length;a<c;a++){d=f[a];if(d instanceof THREE.Mesh)g=g.concat(this.intersectObject(d))}g.sort(function(i,k){return i.distance-k.distance});return g},intersectObject:function(a){function c(I,t,h,e){e=e.clone().subSelf(t);h=h.clone().subSelf(t);var l=I.clone().subSelf(t);I=e.dot(e);t=e.dot(h);e=e.dot(l);var r=h.dot(h);h=h.dot(l);l=1/(I*r-t*t);r=(r*e-t*h)*l;I=(I*h-t*e)*l;return r>0&&I>0&&r+I<1}var d,f,g,i,k,b,j,x,s,D,
+o,v=a.geometry,u=v.vertices,y=[];d=0;for(f=v.faces.length;d<f;d++){g=v.faces[d];D=this.origin.clone();o=this.direction.clone();i=a.matrix.transformVector3(u[g.a].position.clone());k=a.matrix.transformVector3(u[g.b].position.clone());b=a.matrix.transformVector3(u[g.c].position.clone());j=g instanceof THREE.Face4?a.matrix.transformVector3(u[g.d].position.clone()):null;x=a.rotationMatrix.transformVector3(g.normal.clone());s=o.dot(x);if(s<0){x=x.dot((new THREE.Vector3).sub(i,D))/s;D=D.addSelf(o.multiplyScalar(x));
+if(g instanceof THREE.Face3){if(c(D,i,k,b)){g={distance:this.origin.distanceTo(D),point:D,face:g,object:a};y.push(g)}}else if(g instanceof THREE.Face4)if(c(D,i,k,j)||c(D,k,b,j)){g={distance:this.origin.distanceTo(D),point:D,face:g,object:a};y.push(g)}}}return y}};
+THREE.Rectangle=function(){function a(){i=f-c;k=g-d}var c,d,f,g,i,k,b=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(j,x,s,D){b=false;c=j;d=x;f=s;g=D;a()};this.addPoint=function(j,x){if(b){b=false;c=j;d=x;f=j;g=x}else{c=Math.min(c,j);d=Math.min(d,x);f=Math.max(f,
+j);g=Math.max(g,x)}a()};this.addRectangle=function(j){if(b){b=false;c=j.getLeft();d=j.getTop();f=j.getRight();g=j.getBottom()}else{c=Math.min(c,j.getLeft());d=Math.min(d,j.getTop());f=Math.max(f,j.getRight());g=Math.max(g,j.getBottom())}a()};this.inflate=function(j){c-=j;d-=j;f+=j;g+=j;a()};this.minSelf=function(j){c=Math.max(c,j.getLeft());d=Math.max(d,j.getTop());f=Math.min(f,j.getRight());g=Math.min(g,j.getBottom());a()};this.instersects=function(j){return Math.min(f,j.getRight())-Math.max(c,j.getLeft())>=
+0&&Math.min(g,j.getBottom())-Math.max(d,j.getTop())>=0};this.empty=function(){b=true;g=f=d=c=0;a()};this.isEmpty=function(){return b};this.toString=function(){return"THREE.Rectangle ( left: "+c+", right: "+f+", top: "+d+", bottom: "+g+", width: "+i+", height: "+k+" )"}};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,d){var f=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3;i.sub(a,c).normalize();f.cross(d,i).normalize();g.cross(i,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1},transformVector3:function(a){var c=a.x,d=a.y,f=a.z;a.x=this.n11*c+this.n12*
+d+this.n13*f+this.n14;a.y=this.n21*c+this.n22*d+this.n23*f+this.n24;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34;a.multiplyScalar(1/(this.n41*c+this.n42*d+this.n43*f+this.n44));return a},transformVector4:function(a){var c=a.x,d=a.y,f=a.z,g=a.w;a.x=this.n11*c+this.n12*d+this.n13*f+this.n14*g;a.y=this.n21*c+this.n22*d+this.n23*f+this.n24*g;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34*g;a.w=this.n41*c+this.n42*d+this.n43*f+this.n44*g;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,f=a.n12,g=a.n13,i=a.n14,k=a.n21,b=a.n22,j=a.n23,x=a.n24,s=a.n31,D=a.n32,o=a.n33,v=a.n34,u=a.n41,y=a.n42,I=a.n43,t=a.n44,h=c.n11,e=c.n12,l=c.n13,r=c.n14,n=c.n21,p=c.n22,w=c.n23,C=c.n24,L=c.n31,B=c.n32,U=c.n33,F=c.n34,E=c.n41,V=c.n42,T=c.n43,
+J=c.n44;this.n11=d*h+f*n+g*L+i*E;this.n12=d*e+f*p+g*B+i*V;this.n13=d*l+f*w+g*U+i*T;this.n14=d*r+f*C+g*F+i*J;this.n21=k*h+b*n+j*L+x*E;this.n22=k*e+b*p+j*B+x*V;this.n23=k*l+b*w+j*U+x*T;this.n24=k*r+b*C+j*F+x*J;this.n31=s*h+D*n+o*L+v*E;this.n32=s*e+D*p+o*B+v*V;this.n33=s*l+D*w+o*U+v*T;this.n34=s*r+D*C+o*F+v*J;this.n41=u*h+y*n+I*L+t*E;this.n42=u*e+y*p+I*B+t*V;this.n43=u*l+y*w+I*U+t*T;this.n44=u*r+y*C+I*F+t*J},multiplySelf:function(a){var c=this.n11,d=this.n12,f=this.n13,g=this.n14,i=this.n21,k=this.n22,
+b=this.n23,j=this.n24,x=this.n31,s=this.n32,D=this.n33,o=this.n34,v=this.n41,u=this.n42,y=this.n43,I=this.n44;this.n11=c*a.n11+d*a.n21+f*a.n31+g*a.n41;this.n12=c*a.n12+d*a.n22+f*a.n32+g*a.n42;this.n13=c*a.n13+d*a.n23+f*a.n33+g*a.n43;this.n14=c*a.n14+d*a.n24+f*a.n34+g*a.n44;this.n21=i*a.n11+k*a.n21+b*a.n31+j*a.n41;this.n22=i*a.n12+k*a.n22+b*a.n32+j*a.n42;this.n23=i*a.n13+k*a.n23+b*a.n33+j*a.n43;this.n24=i*a.n14+k*a.n24+b*a.n34+j*a.n44;this.n31=x*a.n11+s*a.n21+D*a.n31+o*a.n41;this.n32=x*a.n12+s*a.n22+
+D*a.n32+o*a.n42;this.n33=x*a.n13+s*a.n23+D*a.n33+o*a.n43;this.n34=x*a.n14+s*a.n24+D*a.n34+o*a.n44;this.n41=v*a.n11+u*a.n21+y*a.n31+I*a.n41;this.n42=v*a.n12+u*a.n22+y*a.n32+I*a.n42;this.n43=v*a.n13+u*a.n23+y*a.n33+I*a.n43;this.n44=v*a.n14+u*a.n24+y*a.n34+I*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,f){var g=c[d];c[d]=c[f];c[f]=g}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 f=new THREE.Matrix4;f.n14=a;f.n24=c;f.n34=d;return f};THREE.Matrix4.scaleMatrix=function(a,c,d){var f=new THREE.Matrix4;f.n11=a;f.n22=c;f.n33=d;return f};
+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 d=new THREE.Matrix4,f=Math.cos(c),g=Math.sin(c),i=1-f,k=a.x,b=a.y,j=a.z;d.n11=i*k*k+f;d.n12=i*k*b-g*j;d.n13=i*k*j+g*b;d.n21=i*k*b+g*j;d.n22=i*b*b+f;d.n23=i*b*j-g*k;d.n31=i*k*j-g*b;d.n32=i*b*j+g*k;d.n33=i*j*j+f;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 d=c[10]*c[5]-c[6]*c[9],f=-c[10]*c[1]+c[2]*c[9],g=c[6]*c[1]-c[2]*c[5],i=-c[10]*c[4]+c[6]*c[8],k=c[10]*c[0]-c[2]*c[8],b=-c[6]*c[0]+c[2]*c[4],j=c[9]*c[4]-c[5]*c[8],x=-c[9]*c[0]+c[1]*c[8],s=c[5]*c[0]-c[1]*c[4];c=c[0]*d+c[1]*i+c[2]*j;if(c==0)throw"matrix not invertible";c=1/c;a.m[0]=c*d;a.m[1]=c*f;a.m[2]=c*g;a.m[3]=c*i;a.m[4]=c*k;a.m[5]=c*b;a.m[6]=c*j;a.m[7]=c*x;a.m[8]=c*s;return a};
+THREE.Matrix4.makeFrustum=function(a,c,d,f,g,i){var k,b,j;k=new THREE.Matrix4;b=2*g/(c-a);j=2*g/(f-d);a=(c+a)/(c-a);d=(f+d)/(f-d);f=-(i+g)/(i-g);g=-2*i*g/(i-g);k.n11=b;k.n12=0;k.n13=a;k.n14=0;k.n21=0;k.n22=j;k.n23=d;k.n24=0;k.n31=0;k.n32=0;k.n33=f;k.n34=g;k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,c,d,f){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,d,f)};
+THREE.Matrix4.makeOrtho=function(a,c,d,f,g,i){var k,b,j,x;k=new THREE.Matrix4;b=c-a;j=d-f;x=i-g;a=(c+a)/b;d=(d+f)/j;g=(i+g)/x;k.n11=2/b;k.n12=0;k.n13=0;k.n14=-a;k.n21=0;k.n22=2/j;k.n23=0;k.n24=-d;k.n31=0;k.n32=0;k.n33=-2/x;k.n34=-g;k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};
+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,d,f,g){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.material=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
+THREE.Face4=function(a,c,d,f,g,i){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.material=i instanceof Array?i:[i]};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,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);if(d instanceof THREE.Face3)d.centroid.divideScalar(3);else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeNormals:function(a){var c,d,f,g,i,k,b=new THREE.Vector3,
+j=new THREE.Vector3;f=0;for(g=this.vertices.length;f<g;f++){i=this.vertices[f];i.normal.set(0,0,0)}f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];if(a&&i.vertexNormals.length){b.set(0,0,0);c=0;for(d=i.normal.length;c<d;c++)b.addSelf(i.vertexNormals[c]);b.divideScalar(3)}else{c=this.vertices[i.a];d=this.vertices[i.b];k=this.vertices[i.c];b.sub(k.position,d.position);j.sub(c.position,d.position);b.crossSelf(j)}b.isZero()||b.normalize();i.normal.copy(b)}},computeBoundingBox:function(){if(this.vertices.length>
+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;a<c;a++){vertex=this.vertices[a];if(vertex.position.x<this.bbox.x[0])this.bbox.x[0]=vertex.position.x;else if(vertex.position.x>this.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.y<this.bbox.y[0])this.bbox.y[0]=vertex.position.y;else if(vertex.position.y>
+this.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.z<this.bbox.z[0])this.bbox.z[0]=vertex.position.z;else if(vertex.position.z>this.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,d,f){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,f);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,d){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();d&&this.normalizeUVs();this.geometry.computeBoundingBox()};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;
+THREE.Mesh.prototype.sortFacesByMaterial=function(){function a(s){var D=[];c=0;for(d=s.length;c<d;c++)s[c]==undefined?D.push("undefined"):D.push(s[c].toString());return D.join("_")}var c,d,f,g,i,k,b,j,x={};f=0;for(g=this.geometry.faces.length;f<g;f++){i=this.geometry.faces[f];k=i.material;b=a(k);if(x[b]==undefined)x[b]={hash:b,counter:0};j=x[b].hash+"_"+x[b].counter;if(this.materialFaceGroup[j]==undefined)this.materialFaceGroup[j]={faces:[],material:k,vertices:0};i=i instanceof THREE.Face3?3:4;if(this.materialFaceGroup[j].vertices+
+i>65535){x[b].counter+=1;j=x[b].hash+"_"+x[b].counter;if(this.materialFaceGroup[j]==undefined)this.materialFaceGroup[j]={faces:[],material:k,vertices:0}}this.materialFaceGroup[j].faces.push(f);this.materialFaceGroup[j].vertices+=i}};THREE.Mesh.prototype.normalizeUVs=function(){var a,c,d,f,g;a=0;for(c=this.geometry.uvs.length;a<c;a++){g=this.geometry.uvs[a];d=0;for(f=g.length;d<f;d++){if(g[d].u!=1)g[d].u-=Math.floor(g[d].u);if(g[d].v!=1)g[d].v-=Math.floor(g[d].v)}}};THREE.FlatShading=0;
+THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
+THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16711680);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";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;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}this.toString=function(){return"THREE.LineBasicMaterial (<br/>color: "+
+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
+THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(15658734);this.env_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.env_map!==
+undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+
+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
+THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(15658734);this.env_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;
+if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+
+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
+THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(15658734);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.Multiply;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;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.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
+a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;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.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>"+ +")"}};THREE.MeshPhongMaterialCounter={value:0};
+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+"<br/>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 (<br/>id: "+this.id+"<br/>blending: "+
+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};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 (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+
+this.blending+"<br/>)"}};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 (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
+THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,f){this.image=a;this.loaded=false;this.mapping=c!==undefined?c:THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdge;this.wrap_t=f!==undefined?f:THREE.ClampToEdge;this.toString=function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>)"}};
+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 (<br/>image: "+this.image+"<br/>mapping: "+this.mapping+"<br/>)"}};
+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(h,e){var l=0,r=1,n=h.z+h.w,p=e.z+e.w,w=-h.z+h.w,C=-e.z+e.w;if(n>=0&&p>=0&&w>=0&&C>=0)return true;else if(n<0&&p<0||w<0&&C<0)return false;else{if(n<0)l=Math.max(l,n/(n-p));else if(p<0)r=Math.min(r,n/(n-p));if(w<0)l=Math.max(l,w/(w-C));else if(C<0)r=Math.min(r,w/(w-C));if(r<l)return false;else{h.lerpSelf(e,l);e.lerpSelf(h,1-r);return true}}}var c=null,d,f,g,i=[],k,b,j=[],x,s,D=[],o=new THREE.Vector4,v=new THREE.Matrix4,u=new THREE.Matrix4,y=new THREE.Vector4,I=
+new THREE.Vector4,t;this.projectScene=function(h,e){var l,r,n,p,w,C,L,B,U,F,E,V,T,J,A,Q,N;c=[];g=b=s=0;e.autoUpdateMatrix&&e.updateMatrix();v.multiply(e.projectionMatrix,e.matrix);L=h.objects;l=0;for(r=L.length;l<r;l++){B=L[l];B.autoUpdateMatrix&&B.updateMatrix();U=B.matrix;F=B.rotationMatrix;E=B.material;V=B.overdraw;if(B instanceof THREE.Mesh){T=B.geometry.vertices;n=0;for(p=T.length;n<p;n++){J=T[n];J.positionWorld.copy(J.position);U.transformVector3(J.positionWorld);A=J.positionScreen;A.copy(J.positionWorld);
+v.transformVector4(A);A.multiplyScalar(1/A.w);J.__visible=A.z>0&&A.z<1}J=B.geometry.faces;n=0;for(p=J.length;n<p;n++){A=J[n];if(A instanceof THREE.Face3){w=T[A.a];C=T[A.b];Q=T[A.c];if(w.__visible&&C.__visible&&Q.__visible)if(B.doubleSided||B.flipSided!=(Q.positionScreen.x-w.positionScreen.x)*(C.positionScreen.y-w.positionScreen.y)-(Q.positionScreen.y-w.positionScreen.y)*(C.positionScreen.x-w.positionScreen.x)<0){d=i[g]=i[g]||new THREE.RenderableFace3;d.v1.positionWorld.copy(w.positionWorld);d.v2.positionWorld.copy(C.positionWorld);
+d.v3.positionWorld.copy(Q.positionWorld);d.v1.positionScreen.copy(w.positionScreen);d.v2.positionScreen.copy(C.positionScreen);d.v3.positionScreen.copy(Q.positionScreen);d.normalWorld.copy(A.normal);F.transformVector3(d.normalWorld);d.centroidWorld.copy(A.centroid);U.transformVector3(d.centroidWorld);d.centroidScreen.copy(d.centroidWorld);v.transformVector3(d.centroidScreen);Q=A.vertexNormals;t=d.vertexNormalsWorld;w=0;for(C=Q.length;w<C;w++){N=t[w]=t[w]||new THREE.Vector3;N.copy(Q[w]);F.transformVector3(N)}d.z=
+d.centroidScreen.z;d.meshMaterial=E;d.faceMaterial=A.material;d.overdraw=V;if(B.geometry.uvs[n]){d.uvs[0]=B.geometry.uvs[n][0];d.uvs[1]=B.geometry.uvs[n][1];d.uvs[2]=B.geometry.uvs[n][2]}c.push(d);g++}}else if(A instanceof THREE.Face4){w=T[A.a];C=T[A.b];Q=T[A.c];N=T[A.d];if(w.__visible&&C.__visible&&Q.__visible&&N.__visible)if(B.doubleSided||B.flipSided!=((N.positionScreen.x-w.positionScreen.x)*(C.positionScreen.y-w.positionScreen.y)-(N.positionScreen.y-w.positionScreen.y)*(C.positionScreen.x-w.positionScreen.x)<
+0||(C.positionScreen.x-Q.positionScreen.x)*(N.positionScreen.y-Q.positionScreen.y)-(C.positionScreen.y-Q.positionScreen.y)*(N.positionScreen.x-Q.positionScreen.x)<0)){d=i[g]=i[g]||new THREE.RenderableFace3;d.v1.positionWorld.copy(w.positionWorld);d.v2.positionWorld.copy(C.positionWorld);d.v3.positionWorld.copy(N.positionWorld);d.v1.positionScreen.copy(w.positionScreen);d.v2.positionScreen.copy(C.positionScreen);d.v3.positionScreen.copy(N.positionScreen);d.normalWorld.copy(A.normal);F.transformVector3(d.normalWorld);
+d.centroidWorld.copy(A.centroid);U.transformVector3(d.centroidWorld);d.centroidScreen.copy(d.centroidWorld);v.transformVector3(d.centroidScreen);d.z=d.centroidScreen.z;d.meshMaterial=E;d.faceMaterial=A.material;d.overdraw=V;if(B.geometry.uvs[n]){d.uvs[0]=B.geometry.uvs[n][0];d.uvs[1]=B.geometry.uvs[n][1];d.uvs[2]=B.geometry.uvs[n][3]}c.push(d);g++;f=i[g]=i[g]||new THREE.RenderableFace3;f.v1.positionWorld.copy(C.positionWorld);f.v2.positionWorld.copy(Q.positionWorld);f.v3.positionWorld.copy(N.positionWorld);
+f.v1.positionScreen.copy(C.positionScreen);f.v2.positionScreen.copy(Q.positionScreen);f.v3.positionScreen.copy(N.positionScreen);f.normalWorld.copy(d.normalWorld);f.centroidWorld.copy(d.centroidWorld);f.centroidScreen.copy(d.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterial=E;f.faceMaterial=A.material;f.overdraw=V;if(B.geometry.uvs[n]){f.uvs[0]=B.geometry.uvs[n][1];f.uvs[1]=B.geometry.uvs[n][2];f.uvs[2]=B.geometry.uvs[n][3]}c.push(f);g++}}}}else if(B instanceof THREE.Line){u.multiply(v,U);T=B.geometry.vertices;
+J=T[0];J.positionScreen.copy(J.position);u.transformVector4(J.positionScreen);n=1;for(p=T.length;n<p;n++){w=T[n];w.positionScreen.copy(w.position);u.transformVector4(w.positionScreen);C=T[n-1];y.copy(w.positionScreen);I.copy(C.positionScreen);if(a(y,I)){y.multiplyScalar(1/y.w);I.multiplyScalar(1/I.w);k=j[b]=j[b]||new THREE.RenderableLine;k.v1.positionScreen.copy(y);k.v2.positionScreen.copy(I);k.z=Math.max(y.z,I.z);k.material=B.material;c.push(k);b++}}}else if(B instanceof THREE.Particle){o.set(B.position.x,
+B.position.y,B.position.z,1);v.transformVector4(o);o.z/=o.w;if(o.z>0&&o.z<1){x=D[s]=D[s]||new THREE.RenderableParticle;x.x=o.x/o.w;x.y=o.y/o.w;x.z=o.z;x.rotation=B.rotation.z;x.scale.x=B.scale.x*Math.abs(x.x-(o.x+e.projectionMatrix.n11)/(o.w+e.projectionMatrix.n14));x.scale.y=B.scale.y*Math.abs(x.y-(o.y+e.projectionMatrix.n22)/(o.w+e.projectionMatrix.n24));x.material=B.material;c.push(x);s++}}}c.sort(function(W,M){return M.z-W.z});return c};this.unprojectVector=function(h,e){var l=new THREE.Matrix4;
+l.multiply(THREE.Matrix4.makeInvert(e.matrix),THREE.Matrix4.makeInvert(e.projectionMatrix));l.transformVector3(h);return h}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,f,g,i;this.domElement=document.createElement("div");this.setSize=function(k,b){d=k;f=b;g=d/2;i=f/2};this.render=function(k,b){var j,x,s,D,o,v,u,y;a=c.projectScene(k,b);j=0;for(x=a.length;j<x;j++){o=a[j];if(o instanceof THREE.RenderableParticle){u=o.x*g+g;y=o.y*i+i;s=0;for(D=o.material.length;s<D;s++){v=o.material[s];if(v instanceof THREE.ParticleDOMMaterial){v=v.domElement;v.style.left=u+"px";v.style.top=y+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(R,aa,Z,O){var H,S,ca,X,$=R.lights;R=0;for(H=$.length;R<H;R++){S=$[R];ca=S.color;X=S.intensity;if(S instanceof THREE.DirectionalLight){S=Z.dot(S.position)*X;if(S>0){O.r+=ca.r*S;O.g+=ca.g*S;O.b+=ca.b*S}}else if(S instanceof THREE.PointLight){ta.sub(S.position,aa);ta.normalize();S=Z.dot(ta)*X;if(S>0){O.r+=ca.r*S;O.g+=ca.g*S;O.b+=ca.b*S}}}}function c(R,aa,Z,O,H,S){if(H.opacity!=0){i(H.opacity);k(H.blending);U=R.positionScreen.x;F=R.positionScreen.y;E=aa.positionScreen.x;
+V=aa.positionScreen.y;T=Z.positionScreen.x;J=Z.positionScreen.y;var ca=U,X=F,$=E,da=V,ba=T,ha=J;t.beginPath();t.moveTo(ca,X);t.lineTo($,da);t.lineTo(ba,ha);t.lineTo(ca,X);t.closePath();if(H instanceof THREE.MeshBasicMaterial)if(H.map)g(U,F,E,V,T,J,H.map.image,O.uvs[0].u,O.uvs[0].v,O.uvs[1].u,O.uvs[1].v,O.uvs[2].u,O.uvs[2].v);else H.wireframe?d(H.color.__styleString,H.wireframe_linewidth):f(H.color.__styleString);else if(H instanceof THREE.MeshLambertMaterial){if(H.map&&!H.wireframe){g(U,F,E,V,T,J,
+H.map.image,O.uvs[0].u,O.uvs[0].v,O.uvs[1].u,O.uvs[1].v,O.uvs[2].u,O.uvs[2].v);k(THREE.SubtractiveBlending)}if(fa)if(!H.wireframe&&H.shading==THREE.SmoothShading&&O.vertexNormalsWorld.length==3){Q.r=N.r=W.r=ga.r;Q.g=N.g=W.g=ga.g;Q.b=N.b=W.b=ga.b;a(S,O.v1.positionWorld,O.vertexNormalsWorld[0],Q);a(S,O.v2.positionWorld,O.vertexNormalsWorld[1],N);a(S,O.v3.positionWorld,O.vertexNormalsWorld[2],W);M.r=(N.r+W.r)*0.5;M.g=(N.g+W.g)*0.5;M.b=(N.b+W.b)*0.5;q=b(Q,N,W,M);g(U,F,E,V,T,J,q,0,0,1,0,0,1)}else{ea.r=
+ga.r;ea.g=ga.g;ea.b=ga.b;a(S,O.centroidWorld,O.normalWorld,ea);A.r=H.color.r*ea.r;A.g=H.color.g*ea.g;A.b=H.color.b*ea.b;A.updateStyleString();H.wireframe?d(A.__styleString,H.wireframe_linewidth):f(A.__styleString)}else H.wireframe?d(H.color.__styleString,H.wireframe_linewidth):f(H.color.__styleString)}else if(H instanceof THREE.MeshDepthMaterial){K=H.__2near;Y=H.__farPlusNear;m=H.__farMinusNear;Q.r=Q.g=Q.b=1-K/(Y-R.positionScreen.z*m);N.r=N.g=N.b=1-K/(Y-aa.positionScreen.z*m);W.r=W.g=W.b=1-K/(Y-Z.positionScreen.z*
+m);M.r=(N.r+W.r)*0.5;M.g=(N.g+W.g)*0.5;M.b=(N.b+W.b)*0.5;q=b(Q,N,W,M);g(U,F,E,V,T,J,q,0,0,1,0,0,1)}else if(H instanceof THREE.MeshNormalMaterial){A.r=j(O.normalWorld.x);A.g=j(O.normalWorld.y);A.b=j(O.normalWorld.z);A.updateStyleString();H.wireframe?d(A.__styleString,H.wireframe_linewidth):f(A.__styleString)}}}function d(R,aa){if(l!=R)t.strokeStyle=l=R;if(n!=aa)t.lineWidth=n=aa;t.stroke();P.inflate(aa*2)}function f(R){if(r!=R)t.fillStyle=r=R;t.fill()}function g(R,aa,Z,O,H,S,ca,X,$,da,ba,ha,ma){var ka,
+ia;ka=ca.width-1;ia=ca.height-1;X*=ka;$*=ia;da*=ka;ba*=ia;ha*=ka;ma*=ia;Z-=R;O-=aa;H-=R;S-=aa;da-=X;ba-=$;ha-=X;ma-=$;ia=1/(da*ma-ha*ba);ka=(ma*Z-ba*H)*ia;ba=(ma*O-ba*S)*ia;Z=(da*H-ha*Z)*ia;O=(da*S-ha*O)*ia;R=R-ka*X-Z*$;aa=aa-ba*X-O*$;t.save();t.transform(ka,ba,Z,O,R,aa);t.clip();t.drawImage(ca,0,0);t.restore()}function i(R){if(h!=R)t.globalAlpha=h=R}function k(R){if(e!=R){switch(R){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation=
+"lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}e=R}}function b(R,aa,Z,O){ja[0]=w(0,p(255,~~(R.r*255)));ja[1]=w(0,p(255,~~(R.g*255)));ja[2]=w(0,p(255,~~(R.b*255)));ja[4]=w(0,p(255,~~(aa.r*255)));ja[5]=w(0,p(255,~~(aa.g*255)));ja[6]=w(0,p(255,~~(aa.b*255)));ja[8]=w(0,p(255,~~(Z.r*255)));ja[9]=w(0,p(255,~~(Z.g*255)));ja[10]=w(0,p(255,~~(Z.b*255)));ja[12]=w(0,p(255,~~(O.r*255)));ja[13]=w(0,p(255,~~(O.g*255)));ja[14]=w(0,p(255,~~(O.b*255)));pa.putImageData(ua,0,0);sa.drawImage(qa,
+0,0);return ra}function j(R){return R<0?p((1+R)*0.5,0.5):0.5+p(R*0.5,0.5)}function x(R,aa){var Z=aa.x-R.x,O=aa.y-R.y,H=1/Math.sqrt(Z*Z+O*O);Z*=H;O*=H;aa.x+=Z;aa.y+=O;R.x-=Z;R.y-=O}var s=null,D=new THREE.Projector,o=document.createElement("canvas"),v,u,y,I,t=o.getContext("2d"),h=1,e=0,l=null,r=null,n=1,p=Math.min,w=Math.max,C,L,B,U,F,E,V,T,J,A=new THREE.Color,Q=new THREE.Color,N=new THREE.Color,W=new THREE.Color,M=new THREE.Color,K,Y,m,q,z=new THREE.Rectangle,G=new THREE.Rectangle,P=new THREE.Rectangle,
+fa=false,ea=new THREE.Color,ga=new THREE.Color,la=new THREE.Color,na=new THREE.Color,xa=Math.PI*2,ta=new THREE.Vector3,qa,pa,ua,ja,ra,sa,oa=16;qa=document.createElement("canvas");qa.width=qa.height=2;pa=qa.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);ua=pa.getImageData(0,0,2,2);ja=ua.data;ra=document.createElement("canvas");ra.width=ra.height=oa;sa=ra.getContext("2d");sa.translate(-oa/2,-oa/2);sa.scale(oa,oa);oa--;this.domElement=o;this.autoClear=true;this.setSize=function(R,
+aa){v=R;u=aa;y=v/2;I=u/2;o.width=v;o.height=u;z.set(-y,-I,y,I)};this.clear=function(){if(!G.isEmpty()){G.inflate(1);G.minSelf(z);t.clearRect(G.getX(),G.getY(),G.getWidth(),G.getHeight());G.empty()}};this.render=function(R,aa){var Z,O,H,S,ca,X,$,da;t.setTransform(1,0,0,-1,y,I);this.autoClear&&this.clear();s=D.projectScene(R,aa);if(fa=R.lights.length>0){ca=R.lights;ga.setRGB(0,0,0);la.setRGB(0,0,0);na.setRGB(0,0,0);Z=0;for(O=ca.length;Z<O;Z++){H=ca[Z];S=H.color;if(H instanceof THREE.AmbientLight){ga.r+=
+S.r;ga.g+=S.g;ga.b+=S.b}else if(H instanceof THREE.DirectionalLight){la.r+=S.r;la.g+=S.g;la.b+=S.b}else if(H instanceof THREE.PointLight){na.r+=S.r;na.g+=S.g;na.b+=S.b}}}Z=0;for(O=s.length;Z<O;Z++){H=s[Z];P.empty();if(H instanceof THREE.RenderableParticle){C=H;C.x*=y;C.y*=I;S=0;for(ca=H.material.length;S<ca;S++){X=C;$=H;var ba=H.material[S];if(ba.opacity!=0){i(ba.opacity);k(ba.blending);da=void 0;var ha=void 0,ma=void 0,ka=void 0,ia=void 0,va=void 0,wa=void 0;if(ba instanceof THREE.ParticleBasicMaterial){if(ba.map){ia=
+ba.map;va=ia.width>>1;wa=ia.height>>1;ma=$.scale.x*y;ka=$.scale.y*I;da=ma*va;ha=ka*wa;P.set(X.x-da,X.y-ha,X.x+da,X.y+ha);if(z.instersects(P)){t.save();t.translate(X.x,X.y);t.rotate(-$.rotation);t.scale(ma,-ka);t.translate(-va,-wa);t.drawImage(ia,0,0);t.restore()}}}else if(ba instanceof THREE.ParticleCircleMaterial){if(fa){ea.r=ga.r+la.r+na.r;ea.g=ga.g+la.g+na.g;ea.b=ga.b+la.b+na.b;A.r=ba.color.r*ea.r;A.g=ba.color.g*ea.g;A.b=ba.color.b*ea.b;A.updateStyleString()}else A.__styleString=ba.color.__styleString;
+da=$.scale.x*y;ha=$.scale.y*I;P.set(X.x-da,X.y-ha,X.x+da,X.y+ha);if(z.instersects(P)){ba=A.__styleString;if(r!=ba)t.fillStyle=r=ba;t.save();t.translate(X.x,X.y);t.rotate(-$.rotation);t.scale(da,ha);t.beginPath();t.arc(0,0,1,0,xa,true);t.closePath();t.fill();t.restore()}}}}}else if(H instanceof THREE.RenderableLine){C=H.v1;L=H.v2;C.positionScreen.x*=y;C.positionScreen.y*=I;L.positionScreen.x*=y;L.positionScreen.y*=I;P.addPoint(C.positionScreen.x,C.positionScreen.y);P.addPoint(L.positionScreen.x,L.positionScreen.y);
+if(z.instersects(P)){S=0;for(ca=H.material.length;S<ca;){$=C;da=L;X=H.material[S++];if(X.opacity!=0){i(X.opacity);k(X.blending);t.beginPath();t.moveTo($.positionScreen.x,$.positionScreen.y);t.lineTo(da.positionScreen.x,da.positionScreen.y);t.closePath();if(X instanceof THREE.LineBasicMaterial){A.__styleString=X.color.__styleString;$=X.linewidth;if(n!=$)t.lineWidth=n=$;$=A.__styleString;if(l!=$)t.strokeStyle=l=$;t.stroke();P.inflate(X.linewidth*2)}}}}}else if(H instanceof THREE.RenderableFace3){C=
+H.v1;L=H.v2;B=H.v3;C.positionScreen.x*=y;C.positionScreen.y*=I;L.positionScreen.x*=y;L.positionScreen.y*=I;B.positionScreen.x*=y;B.positionScreen.y*=I;if(H.overdraw){x(C.positionScreen,L.positionScreen);x(L.positionScreen,B.positionScreen);x(B.positionScreen,C.positionScreen)}P.addPoint(C.positionScreen.x,C.positionScreen.y);P.addPoint(L.positionScreen.x,L.positionScreen.y);P.addPoint(B.positionScreen.x,B.positionScreen.y);if(z.instersects(P)){S=0;for(ca=H.meshMaterial.length;S<ca;){da=H.meshMaterial[S++];
+if(da instanceof THREE.MeshFaceMaterial){X=0;for($=H.faceMaterial.length;X<$;)(da=H.faceMaterial[X++])&&c(C,L,B,H,da,R)}else c(C,L,B,H,da,R)}}}G.addRectangle(P)}t.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(A,Q,N){var W,M,K,Y;W=0;for(M=A.lights.length;W<M;W++){K=A.lights[W];if(K instanceof THREE.DirectionalLight){Y=Q.normalWorld.dot(K.position)*K.intensity;if(Y>0){N.r+=K.color.r*Y;N.g+=K.color.g*Y;N.b+=K.color.b*Y}}else if(K instanceof THREE.PointLight){C.sub(K.position,Q.centroidWorld);C.normalize();Y=Q.normalWorld.dot(C)*K.intensity;if(Y>0){N.r+=K.color.r*Y;N.g+=K.color.g*Y;N.b+=K.color.b*Y}}}}function c(A,Q,N,W,M,K){F=f(E++);F.setAttribute("d","M "+A.positionScreen.x+
+" "+A.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+N.positionScreen.x+","+N.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)e.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(h){l.r=r.r;l.g=r.g;l.b=r.b;a(K,W,l);e.r=M.color.r*l.r;e.g=M.color.g*l.g;e.b=M.color.b*l.b;e.updateStyleString()}else e.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){w=1-M.__2near/(M.__farPlusNear-W.z*M.__farMinusNear);
+e.setRGB(w,w,w)}else M instanceof THREE.MeshNormalMaterial&&e.setRGB(g(W.normalWorld.x),g(W.normalWorld.y),g(W.normalWorld.z));M.wireframe?F.setAttribute("style","fill: none; stroke: "+e.__styleString+"; stroke-width: "+M.wireframe_linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframe_linecap+"; stroke-linejoin: "+M.wireframe_linejoin):F.setAttribute("style","fill: "+e.__styleString+"; fill-opacity: "+M.opacity);b.appendChild(F)}function d(A,Q,N,W,M,K,Y){F=f(E++);F.setAttribute("d",
+"M "+A.positionScreen.x+" "+A.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+N.positionScreen.x+","+N.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(K instanceof THREE.MeshBasicMaterial)e.__styleString=K.color.__styleString;else if(K instanceof THREE.MeshLambertMaterial)if(h){l.r=r.r;l.g=r.g;l.b=r.b;a(Y,M,l);e.r=K.color.r*l.r;e.g=K.color.g*l.g;e.b=K.color.b*l.b;e.updateStyleString()}else e.__styleString=K.color.__styleString;else if(K instanceof THREE.MeshDepthMaterial){w=
+1-K.__2near/(K.__farPlusNear-M.z*K.__farMinusNear);e.setRGB(w,w,w)}else K instanceof THREE.MeshNormalMaterial&&e.setRGB(g(M.normalWorld.x),g(M.normalWorld.y),g(M.normalWorld.z));K.wireframe?F.setAttribute("style","fill: none; stroke: "+e.__styleString+"; stroke-width: "+K.wireframe_linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.wireframe_linecap+"; stroke-linejoin: "+K.wireframe_linejoin):F.setAttribute("style","fill: "+e.__styleString+"; fill-opacity: "+K.opacity);b.appendChild(F)}
+function f(A){if(L[A]==null){L[A]=document.createElementNS("http://www.w3.org/2000/svg","path");J==0&&L[A].setAttribute("shape-rendering","crispEdges");return L[A]}return L[A]}function g(A){return A<0?Math.min((1+A)*0.5,0.5):0.5+Math.min(A*0.5,0.5)}var i=null,k=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,x,s,D,o,v,u,y,I=new THREE.Rectangle,t=new THREE.Rectangle,h=false,e=new THREE.Color(16777215),l=new THREE.Color(16777215),r=new THREE.Color(0),n=new THREE.Color(0),
+p=new THREE.Color(0),w,C=new THREE.Vector3,L=[],B=[],U=[],F,E,V,T,J=1;this.domElement=b;this.autoClear=true;this.setQuality=function(A){switch(A){case "high":J=1;break;case "low":J=0}};this.setSize=function(A,Q){j=A;x=Q;s=j/2;D=x/2;b.setAttribute("viewBox",-s+" "+-D+" "+j+" "+x);b.setAttribute("width",j);b.setAttribute("height",x);I.set(-s,-D,s,D)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};this.render=function(A,Q){var N,W,M,K,Y,m,q,z;this.autoClear&&this.clear();
+i=k.projectScene(A,Q);T=V=E=0;if(h=A.lights.length>0){q=A.lights;r.setRGB(0,0,0);n.setRGB(0,0,0);p.setRGB(0,0,0);N=0;for(W=q.length;N<W;N++){M=q[N];K=M.color;if(M instanceof THREE.AmbientLight){r.r+=K.r;r.g+=K.g;r.b+=K.b}else if(M instanceof THREE.DirectionalLight){n.r+=K.r;n.g+=K.g;n.b+=K.b}else if(M instanceof THREE.PointLight){p.r+=K.r;p.g+=K.g;p.b+=K.b}}}N=0;for(W=i.length;N<W;N++){q=i[N];t.empty();if(q instanceof THREE.RenderableParticle){o=q;o.x*=s;o.y*=-D;M=0;for(K=q.material.length;M<K;M++)if(z=
+q.material[M]){Y=o;m=q;z=z;var G=V++;if(B[G]==null){B[G]=document.createElementNS("http://www.w3.org/2000/svg","circle");J==0&&B[G].setAttribute("shape-rendering","crispEdges")}F=B[G];F.setAttribute("cx",Y.x);F.setAttribute("cy",Y.y);F.setAttribute("r",m.scale.x*s);if(z instanceof THREE.ParticleCircleMaterial){if(h){l.r=r.r+n.r+p.r;l.g=r.g+n.g+p.g;l.b=r.b+n.b+p.b;e.r=z.color.r*l.r;e.g=z.color.g*l.g;e.b=z.color.b*l.b;e.updateStyleString()}else e=z.color;F.setAttribute("style","fill: "+e.__styleString)}b.appendChild(F)}}else if(q instanceof
+THREE.RenderableLine){o=q.v1;v=q.v2;o.positionScreen.x*=s;o.positionScreen.y*=-D;v.positionScreen.x*=s;v.positionScreen.y*=-D;t.addPoint(o.positionScreen.x,o.positionScreen.y);t.addPoint(v.positionScreen.x,v.positionScreen.y);if(I.instersects(t)){M=0;for(K=q.material.length;M<K;)if(z=q.material[M++]){Y=o;m=v;z=z;G=T++;if(U[G]==null){U[G]=document.createElementNS("http://www.w3.org/2000/svg","line");J==0&&U[G].setAttribute("shape-rendering","crispEdges")}F=U[G];F.setAttribute("x1",Y.positionScreen.x);
+F.setAttribute("y1",Y.positionScreen.y);F.setAttribute("x2",m.positionScreen.x);F.setAttribute("y2",m.positionScreen.y);if(z instanceof THREE.LineBasicMaterial){e.__styleString=z.color.__styleString;F.setAttribute("style","fill: none; stroke: "+e.__styleString+"; stroke-width: "+z.linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.linecap+"; stroke-linejoin: "+z.linejoin);b.appendChild(F)}}}}else if(q instanceof THREE.RenderableFace3){o=q.v1;v=q.v2;u=q.v3;o.positionScreen.x*=s;o.positionScreen.y*=
+-D;v.positionScreen.x*=s;v.positionScreen.y*=-D;u.positionScreen.x*=s;u.positionScreen.y*=-D;t.addPoint(o.positionScreen.x,o.positionScreen.y);t.addPoint(v.positionScreen.x,v.positionScreen.y);t.addPoint(u.positionScreen.x,u.positionScreen.y);if(I.instersects(t)){M=0;for(K=q.meshMaterial.length;M<K;){z=q.meshMaterial[M++];if(z instanceof THREE.MeshFaceMaterial){Y=0;for(m=q.faceMaterial.length;Y<m;)(z=q.faceMaterial[Y++])&&c(o,v,u,q,z,A)}else z&&c(o,v,u,q,z,A)}}}else if(q instanceof THREE.RenderableFace4){o=
+q.v1;v=q.v2;u=q.v3;y=q.v4;o.positionScreen.x*=s;o.positionScreen.y*=-D;v.positionScreen.x*=s;v.positionScreen.y*=-D;u.positionScreen.x*=s;u.positionScreen.y*=-D;y.positionScreen.x*=s;y.positionScreen.y*=-D;t.addPoint(o.positionScreen.x,o.positionScreen.y);t.addPoint(v.positionScreen.x,v.positionScreen.y);t.addPoint(u.positionScreen.x,u.positionScreen.y);t.addPoint(y.positionScreen.x,y.positionScreen.y);if(I.instersects(t)){M=0;for(K=q.meshMaterial.length;M<K;){z=q.meshMaterial[M++];if(z instanceof
+THREE.MeshFaceMaterial){Y=0;for(m=q.faceMaterial.length;Y<m;)(z=q.faceMaterial[Y++])&&d(o,v,u,y,q,z,A)}else z&&d(o,v,u,y,q,z,A)}}}}}};
+THREE.WebGLRenderer=function(a){function c(h,e){var l=b.createProgram();b.attachShader(l,g("fragment","#ifdef GL_ES\nprecision highp float;\n#endif\n"+h));b.attachShader(l,g("vertex",e));b.linkProgram(l);if(!b.getProgramParameter(l,b.LINK_STATUS)){alert("Could not initialise shaders");alert("VALIDATE_STATUS: "+b.getProgramParameter(l,b.VALIDATE_STATUS));alert(b.getError())}l.uniforms={};return l}function d(h,e){var l,r,n;l=0;for(r=e.length;l<r;l++){n=e[l];h.uniforms[n]=b.getUniformLocation(h,n)}}
+function f(h){h.position=b.getAttribLocation(h,"position");b.enableVertexAttribArray(h.position);h.normal=b.getAttribLocation(h,"normal");b.enableVertexAttribArray(h.normal);h.uv=b.getAttribLocation(h,"uv");b.enableVertexAttribArray(h.uv)}function g(h,e){var l;if(h=="fragment")l=b.createShader(b.FRAGMENT_SHADER);else if(h=="vertex")l=b.createShader(b.VERTEX_SHADER);b.shaderSource(l,e);b.compileShader(l);if(!b.getShaderParameter(l,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(l));return null}return l}
+function i(h){switch(h){case THREE.Repeat:return b.REPEAT;case THREE.ClampToEdge:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeat:return b.MIRRORED_REPEAT}return 0}var k=document.createElement("canvas"),b,j,x,s=new THREE.Matrix4,D,o=new Float32Array(16),v=new Float32Array(16),u=new Float32Array(16),y=new Float32Array(9),I=new Float32Array(16);a=function(h,e){if(h){var l,r,n,p=pointLights=maxDirLights=maxPointLights=0;l=0;for(r=h.lights.length;l<r;l++){n=h.lights[l];n instanceof THREE.DirectionalLight&&
+p++;n instanceof THREE.PointLight&&pointLights++}if(pointLights+p<=e){maxDirLights=p;maxPointLights=pointLights}else{maxDirLights=Math.ceil(e*p/(pointLights+p));maxPointLights=e-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:e-1}}(a,4);this.domElement=k;this.autoClear=true;try{b=k.getContext("experimental-webgl",{antialias:true})}catch(t){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);
+b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(0,0,0,0);(function(h,e){var l=[h?"#define MAX_DIR_LIGHTS "+h:"",e?"#define MAX_POINT_LIGHTS "+e:"","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;",
+h?"uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];":"",h?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"",e?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",e?"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;",e?"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;",
+h?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",h?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",h?"float directionalLightWeighting = max( dot( transformedNormal, normalize(lDirection.xyz ) ), 0.0 );":"",h?"vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;":"",h?"}":"",e?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",e?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",e?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
+"",e?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",e?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",e?"}":"","}\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"),
+r=[h?"#define MAX_DIR_LIGHTS "+h:"",e?"#define MAX_POINT_LIGHTS "+e:"","uniform int material;\nuniform bool enableMap;\nuniform bool enableCubeMap;\nuniform bool mixEnvMap;\nuniform samplerCube tCube;\nuniform float mReflectivity;\nuniform sampler2D tMap;\nuniform vec4 mColor;\nuniform float mOpacity;\nuniform vec4 mAmbient;\nuniform vec4 mSpecular;\nuniform float mShininess;\nuniform float m2Near;\nuniform float mFarPlusNear;\nuniform float mFarMinusNear;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;",
+h?"uniform mat4 viewMatrix;":"",h?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",e?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform vec3 cameraPosition;\nvoid main() {\nvec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nvec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nif ( enableMap ) {\nmapColor = texture2D( tMap, vUv );\n}\nif ( enableCubeMap ) {\ncubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n}\nif ( material == 5 ) { \nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( -wPos.x, wPos.yz ) );\n} else if ( material == 4 ) { \ngl_FragColor = vec4( 0.5*normalize( vNormal ) + vec3(0.5, 0.5, 0.5), mOpacity );\n} else if ( material == 3 ) { \nfloat w = 0.5;\ngl_FragColor = vec4( w, w, w, mOpacity );\n} else if ( material == 2 ) { \nvec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );",
+e?"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",e?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",e?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",e?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",e?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",e?"float pointSpecularWeight = 0.0;":"",e?"if ( pointDotNormalHalf >= 0.0 )":
+"",e?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",e?"pointDiffuse  += mColor * pointDiffuseWeight;":"",e?"pointSpecular += mSpecular * pointSpecularWeight;":"",e?"}":"",h?"vec4 dirDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",h?"vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",h?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",h?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",h?"vec3 dirVector = normalize( lDirection.xyz );":"",h?"vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );":
+"",h?"float dirDotNormalHalf = dot( normal, dirHalfVector );":"",h?"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );":"",h?"float dirSpecularWeight = 0.0;":"",h?"if ( dirDotNormalHalf >= 0.0 )":"",h?"dirSpecularWeight = pow( dirDotNormalHalf, mShininess );":"",h?"dirDiffuse  += mColor * dirDiffuseWeight;":"",h?"dirSpecular += mSpecular * dirSpecularWeight;":"",h?"}":"","vec4 totalLight = mAmbient;",h?"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");
+j=c(r,l);b.useProgram(j);d(j,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract","m2Near","mFarPlusNear","mFarMinusNear"]);h&&d(j,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);e&&d(j,["pointLightNumber","pointLightColor",
+"pointLightPosition"]);b.uniform1i(j.uniforms.enableMap,0);b.uniform1i(j.uniforms.tMap,0);b.uniform1i(j.uniforms.enableCubeMap,0);b.uniform1i(j.uniforms.tCube,1);b.uniform1i(j.uniforms.mixEnvMap,0);b.uniform1i(j.uniforms.useRefract,0);f(j)})(a.directional,a.point);this.setSize=function(h,e){k.width=h;k.height=e;b.viewport(0,0,k.width,k.height)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(h,e){var l,r,n,p,w,C=[],L=[],B=[];p=[];w=[];b.uniform1i(h.uniforms.enableLighting,
+e.lights.length);l=0;for(r=e.lights.length;l<r;l++){n=e.lights[l];if(n instanceof THREE.AmbientLight)C.push(n);else if(n instanceof THREE.DirectionalLight)B.push(n);else n instanceof THREE.PointLight&&L.push(n)}l=n=p=w=0;for(r=C.length;l<r;l++){n+=C[l].color.r;p+=C[l].color.g;w+=C[l].color.b}b.uniform3f(h.uniforms.ambientLightColor,n,p,w);p=[];w=[];l=0;for(r=B.length;l<r;l++){n=B[l];p.push(n.color.r*n.intensity);p.push(n.color.g*n.intensity);p.push(n.color.b*n.intensity);w.push(n.position.x);w.push(n.position.y);
+w.push(n.position.z)}if(B.length){b.uniform1i(h.uniforms.directionalLightNumber,B.length);b.uniform3fv(h.uniforms.directionalLightDirection,w);b.uniform3fv(h.uniforms.directionalLightColor,p)}p=[];w=[];l=0;for(r=L.length;l<r;l++){n=L[l];p.push(n.color.r*n.intensity);p.push(n.color.g*n.intensity);p.push(n.color.b*n.intensity);w.push(n.position.x);w.push(n.position.y);w.push(n.position.z)}if(L.length){b.uniform1i(h.uniforms.pointLightNumber,L.length);b.uniform3fv(h.uniforms.pointLightPosition,w);b.uniform3fv(h.uniforms.pointLightColor,
+p)}};this.createBuffers=function(h,e){var l,r,n,p,w,C,L,B,U=[],F=[],E=[],V=[],T=[],J=0,A=h.materialFaceGroup[e],Q;n=false;l=0;for(r=h.material.length;l<r;l++){meshMaterial=h.material[l];if(meshMaterial instanceof THREE.MeshFaceMaterial){w=0;for(Q=A.material.length;w<Q;w++)if(A.material[w]&&A.material[w].shading!=undefined&&A.material[w].shading==THREE.SmoothShading){n=true;break}}else if(meshMaterial&&meshMaterial.shading!=undefined&&meshMaterial.shading==THREE.SmoothShading){n=true;break}if(n)break}Q=
+n;l=0;for(r=A.faces.length;l<r;l++){n=A.faces[l];p=h.geometry.faces[n];w=p.vertexNormals;faceNormal=p.normal;n=h.geometry.uvs[n];if(p instanceof THREE.Face3){C=h.geometry.vertices[p.a].position;L=h.geometry.vertices[p.b].position;B=h.geometry.vertices[p.c].position;E.push(C.x,C.y,C.z);E.push(L.x,L.y,L.z);E.push(B.x,B.y,B.z);if(w.length==3&&Q)for(p=0;p<3;p++)V.push(w[p].x,w[p].y,w[p].z);else for(p=0;p<3;p++)V.push(faceNormal.x,faceNormal.y,faceNormal.z);if(n)for(p=0;p<3;p++)T.push(n[p].u,n[p].v);U.push(J,
+J+1,J+2);F.push(J,J+1);F.push(J,J+2);F.push(J+1,J+2);J+=3}else if(p instanceof THREE.Face4){C=h.geometry.vertices[p.a].position;L=h.geometry.vertices[p.b].position;B=h.geometry.vertices[p.c].position;p=h.geometry.vertices[p.d].position;E.push(C.x,C.y,C.z);E.push(L.x,L.y,L.z);E.push(B.x,B.y,B.z);E.push(p.x,p.y,p.z);if(w.length==4&&Q)for(p=0;p<4;p++)V.push(w[p].x,w[p].y,w[p].z);else for(p=0;p<4;p++)V.push(faceNormal.x,faceNormal.y,faceNormal.z);if(n)for(p=0;p<4;p++)T.push(n[p].u,n[p].v);U.push(J,J+
+1,J+2);U.push(J,J+2,J+3);F.push(J,J+1);F.push(J,J+2);F.push(J,J+3);F.push(J+1,J+2);F.push(J+2,J+3);J+=4}}if(E.length){A.__webGLVertexBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,A.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(E),b.STATIC_DRAW);A.__webGLNormalBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,A.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(V),b.STATIC_DRAW);A.__webGLUVBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,A.__webGLUVBuffer);
+b.bufferData(b.ARRAY_BUFFER,new Float32Array(T),b.STATIC_DRAW);A.__webGLFaceBuffer=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(U),b.STATIC_DRAW);A.__webGLLineBuffer=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(F),b.STATIC_DRAW);A.__webGLFaceCount=U.length;A.__webGLLineCount=F.length}};this.renderBuffer=function(h,e,l){var r,n,p,w,C,L,B,
+U,F,E;if(e instanceof THREE.MeshShaderMaterial){if(!e.program){e.program=c(e.fragment_shader,e.vertex_shader);C=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objMatrix","cameraPosition"];for(E in e.uniforms)C.push(E);d(e.program,C);f(e.program)}E=e.program}else E=j;if(E!=x){b.useProgram(E);x=E}if(e instanceof THREE.MeshShaderMaterial){C=E;U=e.uniforms;var V,T;for(n in U){V=U[n].type;F=U[n].value;T=C.uniforms[n];if(V=="i")b.uniform1i(T,F);else if(V=="f")b.uniform1f(T,F);else if(V==
+"t"){b.uniform1i(T,F);F=U[n].texture;if(F instanceof THREE.TextureCube&&F.image.length==6){if(!F.image.__webGLTextureCube&&!F.image.__cubeMapInitialized&&F.image.loadCount==6){F.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,F.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,
+b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(V=0;V<6;++V)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+V,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,F.image[V]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);F.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_CUBE_MAP,F.image.__webGLTextureCube)}}}this.loadCamera(E,h);this.loadMatrices(E)}else if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshBasicMaterial){h=
+e.color;r=e.opacity;p=e.wireframe;w=e.wireframe_linewidth;L=e.map;B=e.env_map;C=e.combine==THREE.Mix;n=e.reflectivity;F=e.env_map&&e.env_map.mapping==THREE.RefractionMapping;U=e.refraction_ratio;b.uniform4f(E.uniforms.mColor,h.r*r,h.g*r,h.b*r,r);b.uniform1i(E.uniforms.mixEnvMap,C);b.uniform1f(E.uniforms.mReflectivity,n);b.uniform1i(E.uniforms.useRefract,F);b.uniform1f(E.uniforms.mRefractionRatio,U)}if(e instanceof THREE.MeshNormalMaterial){r=e.opacity;b.uniform1f(E.uniforms.mOpacity,r);b.uniform1i(E.uniforms.material,
+4)}else if(e instanceof THREE.MeshDepthMaterial){r=e.opacity;p=e.wireframe;w=e.wireframe_linewidth;b.uniform1f(E.uniforms.mOpacity,r);b.uniform1f(E.uniforms.m2Near,e.__2near);b.uniform1f(E.uniforms.mFarPlusNear,e.__farPlusNear);b.uniform1f(E.uniforms.mFarMinusNear,e.__farMinusNear);b.uniform1i(E.uniforms.material,3)}else if(e instanceof THREE.MeshPhongMaterial){h=e.ambient;n=e.specular;C=e.shininess;b.uniform4f(E.uniforms.mAmbient,h.r,h.g,h.b,r);b.uniform4f(E.uniforms.mSpecular,n.r,n.g,n.b,r);b.uniform1f(E.uniforms.mShininess,
+C);b.uniform1i(E.uniforms.material,2)}else if(e instanceof THREE.MeshLambertMaterial)b.uniform1i(E.uniforms.material,1);else if(e instanceof THREE.MeshBasicMaterial)b.uniform1i(E.uniforms.material,0);else if(e instanceof THREE.MeshCubeMaterial){b.uniform1i(E.uniforms.material,5);B=e.env_map}if(L){if(!e.map.__webGLTexture&&e.map.image.loaded){e.map.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,e.map.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.map.image);
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,i(e.map.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,i(e.map.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,e.map.__webGLTexture);b.uniform1i(E.uniforms.tMap,0);b.uniform1i(E.uniforms.enableMap,1)}else b.uniform1i(E.uniforms.enableMap,
+0);if(B){if(e.env_map&&e.env_map instanceof THREE.TextureCube&&e.env_map.image.length==6){if(!e.env_map.image.__webGLTextureCube&&!e.env_map.image.__cubeMapInitialized&&e.env_map.image.loadCount==6){e.env_map.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,e.env_map.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,
+b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(r=0;r<6;++r)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[r]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);e.env_map.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_CUBE_MAP,e.env_map.image.__webGLTextureCube);b.uniform1i(E.uniforms.tCube,1)}b.uniform1i(E.uniforms.enableCubeMap,1)}else b.uniform1i(E.uniforms.enableCubeMap,
+0);b.bindBuffer(b.ARRAY_BUFFER,l.__webGLVertexBuffer);b.vertexAttribPointer(E.position,3,b.FLOAT,false,0,0);b.bindBuffer(b.ARRAY_BUFFER,l.__webGLNormalBuffer);b.vertexAttribPointer(E.normal,3,b.FLOAT,false,0,0);if(L){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLUVBuffer);b.enableVertexAttribArray(E.uv);b.vertexAttribPointer(E.uv,2,b.FLOAT,false,0,0)}else b.disableVertexAttribArray(E.uv);if(p){b.lineWidth(w);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLLineBuffer);b.drawElements(b.LINES,l.__webGLLineCount,
+b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,l.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(h,e,l,r,n){var p,w,C,L,B;C=0;for(L=e.material.length;C<L;C++){p=e.material[C];if(p instanceof THREE.MeshFaceMaterial){p=0;for(w=l.material.length;p<w;p++)if((B=l.material[p])&&B.blending==r&&B.opacity<1==n){this.setBlending(B.blending);this.renderBuffer(h,B,l)}}else if((B=p)&&B.blending==r&&B.opacity<1==n){this.setBlending(B.blending);
+this.renderBuffer(h,B,l)}}};this.render=function(h,e){var l,r;this.initWebGLObjects(h);this.autoClear&&this.clear();e.autoUpdateMatrix&&e.updateMatrix();this.loadCamera(j,e);this.setupLights(j,h);l=0;for(r=h.__webGLObjects.length;l<r;l++){webGLObject=h.__webGLObjects[l];if(webGLObject.__object.visible){this.setupMatrices(webGLObject.__object,e);this.loadMatrices(j);this.renderPass(e,webGLObject.__object,webGLObject,THREE.NormalBlending,false)}}l=0;for(r=h.__webGLObjects.length;l<r;l++){webGLObject=
+h.__webGLObjects[l];if(webGLObject.__object.visible){this.setupMatrices(webGLObject.__object,e);this.loadMatrices(j);this.renderPass(e,webGLObject.__object,webGLObject,THREE.AdditiveBlending,false);this.renderPass(e,webGLObject.__object,webGLObject,THREE.SubtractiveBlending,false);this.renderPass(e,webGLObject.__object,webGLObject,THREE.AdditiveBlending,true);this.renderPass(e,webGLObject.__object,webGLObject,THREE.SubtractiveBlending,true);this.renderPass(e,webGLObject.__object,webGLObject,THREE.NormalBlending,
+true)}}};this.initWebGLObjects=function(h){var e,l,r,n,p;if(!h.__webGLObjects)h.__webGLObjects=[];e=0;for(l=h.objects.length;e<l;e++){r=h.objects[e];if(r instanceof THREE.Mesh)for(n in r.materialFaceGroup){p=r.materialFaceGroup[n];if(!p.__webGLVertexBuffer){this.createBuffers(r,n);p.__object=r;h.__webGLObjects.push(p)}}}};this.removeObject=function(h,e){var l,r;for(l=h.__webGLObjects.length-1;l>=0;l--){r=h.__webGLObjects[l].__object;e==r&&h.__webGLObjects.splice(l,1)}};this.setupMatrices=function(h,
+e){h.autoUpdateMatrix&&h.updateMatrix();s.multiply(e.matrix,h.matrix);o.set(e.matrix.flatten());v.set(s.flatten());u.set(e.projectionMatrix.flatten());D=THREE.Matrix4.makeInvert3x3(s).transpose();y.set(D.m);I.set(h.matrix.flatten())};this.loadMatrices=function(h){b.uniformMatrix4fv(h.uniforms.viewMatrix,false,o);b.uniformMatrix4fv(h.uniforms.modelViewMatrix,false,v);b.uniformMatrix4fv(h.uniforms.projectionMatrix,false,u);b.uniformMatrix3fv(h.uniforms.normalMatrix,false,y);b.uniformMatrix4fv(h.uniforms.objMatrix,
+false,I)};this.loadCamera=function(h,e){b.uniform3f(h.uniforms.cameraPosition,e.position.x,e.position.y,e.position.z)};this.setBlending=function(h){switch(h){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(h,e){if(h){!e||e=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(h=="back")b.cullFace(b.BACK);
+else h=="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};
+var GeometryUtils={merge:function(a,c){var d=c instanceof THREE.Mesh,f=a.vertices.length,g=d?c.geometry:c,i=a.vertices,k=g.vertices,b=a.faces,j=g.faces,x=a.uvs;g=g.uvs;d&&c.updateMatrix();for(var s=0,D=k.length;s<D;s++){var o=new THREE.Vertex(k[s].position.clone());d&&c.matrix.transformVector3(o.position);i.push(o)}s=0;for(D=j.length;s<D;s++){d=j[s];var v;k=d.vertexNormals;if(d instanceof THREE.Face3)v=new THREE.Face3(d.a+f,d.b+f,d.c+f);else if(d instanceof THREE.Face4)v=new THREE.Face4(d.a+f,d.b+
+f,d.c+f,d.d+f);d=0;for(i=k.length;d<i;d++){o=k[d];v.vertexNormals.push(o.clone())}b.push(v)}s=0;for(D=g.length;s<D;s++){f=g[s];b=[];d=0;for(i=f.length;d<i;d++)b.push(new THREE.UV(f[d].u,f[d].v));x.push(b)}}},ImageUtils={loadArray:function(a){var c,d,f=[];c=f.loadCount=0;for(d=a.length;c<d;++c){f[c]=new Image;f[c].loaded=0;f[c].onload=function(){f.loadCount+=1;this.loaded=1};f[c].src=a[c]}return f}},SceneUtils={addMesh:function(a,c,d,f,g,i,k,b,j,x){c=new THREE.Mesh(c,x);c.scale.x=c.scale.y=c.scale.z=
+d;c.position.x=f;c.position.y=g;c.position.z=i;c.rotation.x=k;c.rotation.y=b;c.rotation.z=j;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,d){d=new THREE.MeshCubeMaterial({env_map:d});c=new THREE.Mesh(new Cube(c,c,c,1,1,null,true),d);a.addObject(c);return c},addPanoramaCube:function(a,c,d){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));
+f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));mesh=new THREE.Mesh(new Cube(c,c,c,1,1,f,true),new THREE.MeshFaceMaterial);a.addObject(mesh);return mesh},addPanoramaCubePlanes:function(a,c,d){var f=c/2;c=new Plane(c,c);var g=Math.PI/2,i=Math.PI;SceneUtils.addMesh(a,c,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));SceneUtils.addMesh(a,
+c,1,-f,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));SceneUtils.addMesh(a,c,1,f,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));SceneUtils.addMesh(a,c,1,0,f,0,g,0,i,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));SceneUtils.addMesh(a,c,1,0,-f,0,-g,0,i,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",
+value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
+vertex_shader:"attribute vec3 position;\nattribute vec3 normal;\nattribute vec3 uv;\nuniform mat4 objMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform vec3 cameraPosition;\nuniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main(void) {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objMatrix[0].xyz, objMatrix[1].xyz, objMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"}}},
+Cube=function(a,c,d,f,g,i,k){function b(v,u,y,I,t,h,e,l){var r=f||1,n=g||1,p=r+1,w=n+1;t=t/r;h=h/n;var C=j.vertices.length,L;if(v=="x"&&u=="y"||v=="y"&&u=="x")L="z";else if(v=="x"&&u=="z"||v=="z"&&u=="x")L="y";else if(v=="z"&&u=="y"||v=="y"&&u=="z")L="x";for(iy=0;iy<w;iy++)for(ix=0;ix<p;ix++){var B=new THREE.Vector3;B[v]=(ix*t-x)*y;B[u]=(iy*h-s)*I;B[L]=e;j.vertices.push(new THREE.Vertex(B))}for(iy=0;iy<n;iy++)for(ix=0;ix<r;ix++){j.faces.push(new THREE.Face4(ix+p*iy+C,ix+p*(iy+1)+C,ix+1+p*(iy+1)+C,
+ix+1+p*iy+C,null,l));j.uvs.push([new THREE.UV(ix/r,iy/n),new THREE.UV(ix/r,(iy+1)/n),new THREE.UV((ix+1)/r,(iy+1)/n),new THREE.UV((ix+1)/r,iy/n)])}}THREE.Geometry.call(this);var j=this,x=a/2,s=c/2,D=d/2;k=k?-1:1;if(i!==undefined)if(i instanceof Array)this.materials=i;else{this.materials=[];for(var o=0;o<6;o++)this.materials.push([i])}else this.materials=[];b("z","y",1*k,-1,d,c,-x,this.materials[0]);b("z","y",-1*k,-1,d,c,x,this.materials[1]);b("x","z",1*k,1,a,d,s,this.materials[2]);b("x","z",1*k,-1,
+a,d,-s,this.materials[3]);b("x","y",1*k,-1,a,c,D,this.materials[4]);b("x","y",-1*k,-1,a,c,-D,this.materials[5]);(function(){for(var v=[],u=[],y=0,I=j.vertices.length;y<I;y++){for(var t=j.vertices[y],h=false,e=0,l=v.length;e<l;e++){var r=v[e];if(t.position.x==r.position.x&&t.position.y==r.position.y&&t.position.z==r.position.z){u[y]=e;h=true;break}}if(!h){u[y]=v.length;v.push(new THREE.Vertex(t.position.clone()))}}y=0;for(I=j.faces.length;y<I;y++){t=j.faces[y];t.a=u[t.a];t.b=u[t.b];t.c=u[t.c];t.d=
+u[t.d]}j.vertices=v})();this.computeCentroids();this.computeNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(a,c,d,f,g){function i(j,x,s){k.vertices.push(new THREE.Vertex(new THREE.Vector3(j,x,s)))}THREE.Geometry.call(this);var k=this,b;for(b=0;b<a;b++)i(Math.sin(6.283*b/a)*c,Math.cos(6.283*b/a)*c,0);for(b=0;b<a;b++)i(Math.sin(6.283*b/a)*d,Math.cos(6.283*b/a)*d,f);for(b=0;b<a;b++)k.faces.push(new THREE.Face4(b,b+a,a+(b+1)%a,(b+1)%a));if(d!=0){i(0,0,-g);for(b=a;b<a+a/2;b++)k.faces.push(new THREE.Face4(2*a,(2*b-2*a)%a,(2*b-2*a+1)%a,(2*b-2*a+2)%a))}if(c!=0){i(0,0,f+g);for(b=a+a/2;b<2*
+a;b++)k.faces.push(new THREE.Face4((2*b-2*a+2)%a+a,(2*b-2*a+1)%a+a,(2*b-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
+var Plane=function(a,c,d,f){THREE.Geometry.call(this);var g,i=a/2,k=c/2;d=d||1;f=f||1;var b=d+1,j=f+1;a=a/d;var x=c/f;for(g=0;g<j;g++)for(c=0;c<b;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-i,-(g*x-k),0)));for(g=0;g<f;g++)for(c=0;c<d;c++){this.faces.push(new THREE.Face4(c+b*g,c+b*(g+1),c+1+b*(g+1),c+1+b*g));this.uvs.push([new THREE.UV(c/d,g/f),new THREE.UV(c/d,(g+1)/f),new THREE.UV((c+1)/d,(g+1)/f),new THREE.UV((c+1)/d,g/f)])}this.computeCentroids();this.computeNormals()};
+Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
+var Sphere=function(a,c,d){THREE.Geometry.call(this);var f,g=Math.max(3,c||8),i=Math.max(2,d||6);c=[];for(d=0;d<i+1;d++){f=d/i;var k=a*Math.cos(f*Math.PI),b=a*Math.sin(f*Math.PI),j=[],x=0;for(f=0;f<g;f++){var s=2*f/g,D=b*Math.sin(s*Math.PI);s=b*Math.cos(s*Math.PI);(d==0||d==i)&&f>0||(x=this.vertices.push(new THREE.Vertex(new THREE.Vector3(s,k,D)))-1);j.push(x)}c.push(j)}var o,v,u;a=c.length;for(d=0;d<a;d++){g=c[d].length;if(d>0)for(f=0;f<g;f++){j=f==g-1;i=c[d][j?0:f+1];k=c[d][j?g-1:f];b=c[d-1][j?
+g-1:f];j=c[d-1][j?0:f+1];D=d/(a-1);o=(d-1)/(a-1);v=(f+1)/g;s=f/g;x=new THREE.UV(1-v,D);D=new THREE.UV(1-s,D);s=new THREE.UV(1-s,o);var y=new THREE.UV(1-v,o);if(d<c.length-1){o=this.vertices[i].position.clone();v=this.vertices[k].position.clone();u=this.vertices[b].position.clone();o.normalize();v.normalize();u.normalize();this.faces.push(new THREE.Face3(i,k,b,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(u.x,u.y,u.z)]));this.uvs.push([x,D,s])}if(d>1){o=this.vertices[i].position.clone();
+v=this.vertices[b].position.clone();u=this.vertices[j].position.clone();o.normalize();v.normalize();u.normalize();this.faces.push(new THREE.Face3(i,b,j,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(u.x,u.y,u.z)]));this.uvs.push([x,s,y])}}}this.computeCentroids();this.computeNormals()};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?this.addStatusElement():null};
+THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
+c},loadAsciiOld:function(a,c){var d=document.createElement("script");d.type="text/javascript";d.onload=c;d.src=a;document.getElementsByTagName("head")[0].appendChild(d)},loadAscii:function(a,c,d){var f=(new Date).getTime();a=new Worker(a);a.onmessage=function(g){THREE.Loader.prototype.createModel(g.data,c,d)};a.postMessage(f)},loadBinary:function(a,c,d){var f=(new Date).getTime();a=new Worker(a);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(i){THREE.Loader.prototype.loadAjaxBuffers(i.data.buffers,
+i.data.materials,c,d,g)};a.onerror=function(i){alert("worker.onerror: "+i.message+"\n"+i.data);i.preventDefault()};a.postMessage(f)},loadAjaxBuffers:function(a,c,d,f,g){var i=new XMLHttpRequest,k=f+"/"+a,b=0;i.onreadystatechange=function(){if(i.readyState==4)i.status==200||i.status==0?THREE.Loader.prototype.createBinModel(i.responseText,d,f,c):alert("Couldn't load ["+k+"] ["+i.status+"]");else if(i.readyState==3){if(g){if(b==0)b=i.getResponseHeader("Content-Length");g({total:b,loaded:i.responseText.length})}}else if(i.readyState==
+2)b=i.getResponseHeader("Content-Length")};i.open("GET",k,true);i.overrideMimeType("text/plain; charset=x-user-defined");i.setRequestHeader("Content-Type","text/plain");i.send(null)},createBinModel:function(a,c,d,f){var g=function(i){function k(m,q){var z=s(m,q),G=s(m,q+1),P=s(m,q+2),fa=s(m,q+3),ea=(fa<<1&255|P>>7)-127;z=(P&127)<<16|G<<8|z;if(z==0&&ea==-127)return 0;return(1-2*(fa>>7))*(1+z*Math.pow(2,-23))*Math.pow(2,ea)}function b(m,q){var z=s(m,q),G=s(m,q+1),P=s(m,q+2);return(s(m,q+3)<<24)+(P<<
+16)+(G<<8)+z}function j(m,q){var z=s(m,q);return(s(m,q+1)<<8)+z}function x(m,q){var z=s(m,q);return z>127?z-256:z}function s(m,q){return m.charCodeAt(q)&255}function D(m){var q,z,G;q=b(a,m);z=b(a,m+n);G=b(a,m+p);m=j(a,m+w);THREE.Loader.prototype.f3(t,q,z,G,m)}function o(m){var q,z,G,P,fa,ea;q=b(a,m);z=b(a,m+n);G=b(a,m+p);P=j(a,m+w);fa=b(a,m+C);ea=b(a,m+L);m=b(a,m+B);THREE.Loader.prototype.f3n(t,l,q,z,G,P,fa,ea,m)}function v(m){var q,z,G,P;q=b(a,m);z=b(a,m+U);G=b(a,m+F);P=b(a,m+E);m=j(a,m+V);THREE.Loader.prototype.f4(t,
+q,z,G,P,m)}function u(m){var q,z,G,P,fa,ea,ga,la;q=b(a,m);z=b(a,m+U);G=b(a,m+F);P=b(a,m+E);fa=j(a,m+V);ea=b(a,m+T);ga=b(a,m+J);la=b(a,m+A);m=b(a,m+Q);THREE.Loader.prototype.f4n(t,l,q,z,G,P,fa,ea,ga,la,m)}function y(m){var q,z;q=b(a,m);z=b(a,m+N);m=b(a,m+W);THREE.Loader.prototype.uv3(t,r[q*2],r[q*2+1],r[z*2],r[z*2+1],r[m*2],r[m*2+1])}function I(m){var q,z,G;q=b(a,m);z=b(a,m+M);G=b(a,m+K);m=b(a,m+Y);THREE.Loader.prototype.uv4(t,r[q*2],r[q*2+1],r[z*2],r[z*2+1],r[G*2],r[G*2+1],r[m*2],r[m*2+1])}var t=
+this,h=0,e,l=[],r=[],n,p,w,C,L,B,U,F,E,V,T,J,A,Q,N,W,M,K,Y;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(t,f,i);e={signature:a.substr(h,8),header_bytes:s(a,h+8),vertex_coordinate_bytes:s(a,h+9),normal_coordinate_bytes:s(a,h+10),uv_coordinate_bytes:s(a,h+11),vertex_index_bytes:s(a,h+12),normal_index_bytes:s(a,h+13),uv_index_bytes:s(a,h+14),material_index_bytes:s(a,h+15),nvertices:b(a,h+16),nnormals:b(a,h+16+4),nuvs:b(a,h+16+8),ntri_flat:b(a,h+16+12),ntri_smooth:b(a,h+16+16),ntri_flat_uv:b(a,
+h+16+20),ntri_smooth_uv:b(a,h+16+24),nquad_flat:b(a,h+16+28),nquad_smooth:b(a,h+16+32),nquad_flat_uv:b(a,h+16+36),nquad_smooth_uv:b(a,h+16+40)};h+=e.header_bytes;n=e.vertex_index_bytes;p=e.vertex_index_bytes*2;w=e.vertex_index_bytes*3;C=e.vertex_index_bytes*3+e.material_index_bytes;L=e.vertex_index_bytes*3+e.material_index_bytes+e.normal_index_bytes;B=e.vertex_index_bytes*3+e.material_index_bytes+e.normal_index_bytes*2;U=e.vertex_index_bytes;F=e.vertex_index_bytes*2;E=e.vertex_index_bytes*3;V=e.vertex_index_bytes*
+4;T=e.vertex_index_bytes*4+e.material_index_bytes;J=e.vertex_index_bytes*4+e.material_index_bytes+e.normal_index_bytes;A=e.vertex_index_bytes*4+e.material_index_bytes+e.normal_index_bytes*2;Q=e.vertex_index_bytes*4+e.material_index_bytes+e.normal_index_bytes*3;N=e.uv_index_bytes;W=e.uv_index_bytes*2;M=e.uv_index_bytes;K=e.uv_index_bytes*2;Y=e.uv_index_bytes*3;h+=function(m){var q,z,G,P=e.vertex_coordinate_bytes*3,fa=m+e.nvertices*P;for(m=m;m<fa;m+=P){q=k(a,m);z=k(a,m+e.vertex_coordinate_bytes);G=
+k(a,m+e.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(t,q,z,G)}return e.nvertices*P}(h);h+=function(m){var q,z,G,P=e.normal_coordinate_bytes*3,fa=m+e.nnormals*P;for(m=m;m<fa;m+=P){q=x(a,m);z=x(a,m+e.normal_coordinate_bytes);G=x(a,m+e.normal_coordinate_bytes*2);l.push(q/127,z/127,G/127)}return e.nnormals*P}(h);h+=function(m){var q,z,G=e.uv_coordinate_bytes*2,P=m+e.nuvs*G;for(m=m;m<P;m+=G){q=k(a,m);z=k(a,m+e.uv_coordinate_bytes);r.push(q,z)}return e.nuvs*G}(h);h+=function(m){var q,z=e.vertex_index_bytes*
+3+e.material_index_bytes,G=m+e.ntri_flat*z;for(q=m;q<G;q+=z)D(q);return G-m}(h);h+=function(m){var q,z=e.vertex_index_bytes*3+e.material_index_bytes+e.normal_index_bytes*3,G=m+e.ntri_smooth*z;for(q=m;q<G;q+=z)o(q);return G-m}(h);h+=function(m){var q,z=e.vertex_index_bytes*3+e.material_index_bytes,G=z+e.uv_index_bytes*3,P=m+e.ntri_flat_uv*G;for(q=m;q<P;q+=G){D(q);y(q+z)}return P-m}(h);h+=function(m){var q,z=e.vertex_index_bytes*3+e.material_index_bytes+e.normal_index_bytes*3,G=z+e.uv_index_bytes*3,
+P=m+e.ntri_smooth_uv*G;for(q=m;q<P;q+=G){o(q);y(q+z)}return P-m}(h);h+=function(m){var q,z=e.vertex_index_bytes*4+e.material_index_bytes,G=m+e.nquad_flat*z;for(q=m;q<G;q+=z)v(q);return G-m}(h);h+=function(m){var q,z=e.vertex_index_bytes*4+e.material_index_bytes+e.normal_index_bytes*4,G=m+e.nquad_smooth*z;for(q=m;q<G;q+=z)u(q);return G-m}(h);h+=function(m){var q,z=e.vertex_index_bytes*4+e.material_index_bytes,G=z+e.uv_index_bytes*4,P=m+e.nquad_flat_uv*G;for(q=m;q<P;q+=G){v(q);I(q+z)}return P-m}(h);
+h+=function(m){var q,z=e.vertex_index_bytes*4+e.material_index_bytes+e.normal_index_bytes*4,G=z+e.uv_index_bytes*4,P=m+e.nquad_smooth_uv*G;for(q=m;q<P;q+=G){u(q);I(q+z)}return P-m}(h);this.computeCentroids();this.computeNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(d))},createModel:function(a,c,d){var f=function(g){var i=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(i,a.materials,g);(function(){var k,b,j,x,s;k=0;for(b=a.vertices.length;k<b;k+=3){j=
+a.vertices[k];x=a.vertices[k+1];s=a.vertices[k+2];THREE.Loader.prototype.v(i,j,x,s)}})();(function(){function k(u,y){THREE.Loader.prototype.f3(i,u[y],u[y+1],u[y+2],u[y+3])}function b(u,y){THREE.Loader.prototype.f3n(i,a.normals,u[y],u[y+1],u[y+2],u[y+3],u[y+4],u[y+5],u[y+6])}function j(u,y){THREE.Loader.prototype.f4(i,u[y],u[y+1],u[y+2],u[y+3],u[y+4])}function x(u,y){THREE.Loader.prototype.f4n(i,a.normals,u[y],u[y+1],u[y+2],u[y+3],u[y+4],u[y+5],u[y+6],u[y+7],u[y+8])}function s(u,y){var I,t,h;I=u[y];
+t=u[y+1];h=u[y+2];THREE.Loader.prototype.uv3(i,a.uvs[I*2],a.uvs[I*2+1],a.uvs[t*2],a.uvs[t*2+1],a.uvs[h*2],a.uvs[h*2+1])}function D(u,y){var I,t,h,e;I=u[y];t=u[y+1];h=u[y+2];e=u[y+3];THREE.Loader.prototype.uv4(i,a.uvs[I*2],a.uvs[I*2+1],a.uvs[t*2],a.uvs[t*2+1],a.uvs[h*2],a.uvs[h*2+1],a.uvs[e*2],a.uvs[e*2+1])}var o,v;o=0;for(v=a.triangles.length;o<v;o+=4)k(a.triangles,o);o=0;for(v=a.triangles_uv.length;o<v;o+=7){k(a.triangles_uv,o);s(a.triangles_uv,o+4)}o=0;for(v=a.triangles_n.length;o<v;o+=7)b(a.triangles_n,
+o);o=0;for(v=a.triangles_n_uv.length;o<v;o+=10){b(a.triangles_n_uv,o);s(a.triangles_n_uv,o+7)}o=0;for(v=a.quads.length;o<v;o+=5)j(a.quads,o);o=0;for(v=a.quads_uv.length;o<v;o+=9){j(a.quads_uv,o);D(a.quads_uv,o+5)}o=0;for(v=a.quads_n.length;o<v;o+=9)x(a.quads_n,o);o=0;for(v=a.quads_n_uv.length;o<v;o+=13){x(a.quads_n_uv,o);D(a.quads_n_uv,o+9)}})();this.computeCentroids();this.computeNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(d))},v:function(a,c,d,f){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,
+d,f)))},f3:function(a,c,d,f,g){a.faces.push(new THREE.Face3(c,d,f,null,a.materials[g]))},f4:function(a,c,d,f,g,i){a.faces.push(new THREE.Face4(c,d,f,g,null,a.materials[i]))},f3n:function(a,c,d,f,g,i,k,b,j){i=a.materials[i];var x=c[b*3],s=c[b*3+1];b=c[b*3+2];var D=c[j*3],o=c[j*3+1];j=c[j*3+2];a.faces.push(new THREE.Face3(d,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(x,s,b),new THREE.Vector3(D,o,j)],i))},f4n:function(a,c,d,f,g,i,k,b,j,x,s){k=a.materials[k];var D=c[j*3],o=c[j*
+3+1];j=c[j*3+2];var v=c[x*3],u=c[x*3+1];x=c[x*3+2];var y=c[s*3],I=c[s*3+1];s=c[s*3+2];a.faces.push(new THREE.Face4(d,f,g,i,[new THREE.Vector3(c[b*3],c[b*3+1],c[b*3+2]),new THREE.Vector3(D,o,j),new THREE.Vector3(v,u,x),new THREE.Vector3(y,I,s)],k))},uv3:function(a,c,d,f,g,i,k){var b=[];b.push(new THREE.UV(c,d));b.push(new THREE.UV(f,g));b.push(new THREE.UV(i,k));a.uvs.push(b)},uv4:function(a,c,d,f,g,i,k,b,j){var x=[];x.push(new THREE.UV(c,d));x.push(new THREE.UV(f,g));x.push(new THREE.UV(i,k));x.push(new THREE.UV(b,
+j));a.uvs.push(x)},init_materials:function(a,c,d){a.materials=[];for(var f=0;f<c.length;++f)a.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],d)]},createMaterial:function(a,c){function d(i){i=Math.log(i)/Math.LN2;return Math.floor(i)==i}var f,g;if(a.map_diffuse&&c){g=document.createElement("canvas");f=new THREE.MeshLambertMaterial({map:new THREE.Texture(g)});g=new Image;g.onload=function(){if(!d(this.width)||!d(this.height)){var i=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),k=Math.pow(2,
+Math.round(Math.log(this.height)/Math.LN2));f.map.image.width=i;f.map.image.height=k;f.map.image.getContext("2d").drawImage(this,0,0,i,k)}else f.map.image=this;f.map.image.loaded=1};g.src=c+"/"+a.map_diffuse}else if(a.col_diffuse){g=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*255;f=new THREE.MeshLambertMaterial({color:g,opacity:a.transparency})}else f=a.a_dbg_color?new THREE.MeshLambertMaterial({color:a.a_dbg_color}):new THREE.MeshLambertMaterial({color:15658734});return f}};