فهرست منبع

Cube.js matching WebGLRenderer cubemap.

Mr.doob 14 سال پیش
والد
کامیت
a1d014c110

+ 84 - 85
build/Three.js

@@ -11,40 +11,40 @@ distanceToSquared:function(a){var c=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return
 THREE.Vector4.prototype={set:function(a,c,f,b){this.x=a;this.y=c;this.z=f;this.w=b;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,f,b=a.objects,d=[];a=0;for(c=b.length;a<c;a++){f=b[a];if(f instanceof THREE.Mesh)d=d.concat(this.intersectObject(f))}d.sort(function(i,n){return i.distance-n.distance});return d},intersectObject:function(a){function c(A,J,N,p){p=p.clone().subSelf(J);N=N.clone().subSelf(J);var t=A.clone().subSelf(J);A=p.dot(p);J=p.dot(N);p=p.dot(t);var j=N.dot(N);N=N.dot(t);t=1/(A*j-J*J);j=(j*p-J*N)*t;A=(A*N-J*p)*t;return j>0&&A>0&&j+A<1}var f,b,d,i,n,r,e,g,m,h,
-l,q=a.geometry,o=q.vertices,s=[];f=0;for(b=q.faces.length;f<b;f++){d=q.faces[f];h=this.origin.clone();l=this.direction.clone();i=a.matrix.transform(o[d.a].position.clone());n=a.matrix.transform(o[d.b].position.clone());r=a.matrix.transform(o[d.c].position.clone());e=d instanceof THREE.Face4?a.matrix.transform(o[d.d].position.clone()):null;g=a.matrixRotation.transform(d.normal.clone());m=l.dot(g);if(m<0){g=g.dot((new THREE.Vector3).sub(i,h))/m;h=h.addSelf(l.multiplyScalar(g));if(d instanceof THREE.Face3){if(c(h,
-i,n,r)){d={distance:this.origin.distanceTo(h),point:h,face:d,object:a};s.push(d)}}else if(d instanceof THREE.Face4)if(c(h,i,n,e)||c(h,n,r,e)){d={distance:this.origin.distanceTo(h),point:h,face:d,object:a};s.push(d)}}}return s}};
-THREE.Rectangle=function(){function a(){i=b-c;n=d-f}var c,f,b,d,i,n,r=true;this.getX=function(){return c};this.getY=function(){return f};this.getWidth=function(){return i};this.getHeight=function(){return n};this.getLeft=function(){return c};this.getTop=function(){return f};this.getRight=function(){return b};this.getBottom=function(){return d};this.set=function(e,g,m,h){r=false;c=e;f=g;b=m;d=h;a()};this.addPoint=function(e,g){if(r){r=false;c=e;f=g;b=e;d=g}else{c=Math.min(c,e);f=Math.min(f,g);b=Math.max(b,
-e);d=Math.max(d,g)}a()};this.addRectangle=function(e){if(r){r=false;c=e.getLeft();f=e.getTop();b=e.getRight();d=e.getBottom()}else{c=Math.min(c,e.getLeft());f=Math.min(f,e.getTop());b=Math.max(b,e.getRight());d=Math.max(d,e.getBottom())}a()};this.inflate=function(e){c-=e;f-=e;b+=e;d+=e;a()};this.minSelf=function(e){c=Math.max(c,e.getLeft());f=Math.max(f,e.getTop());b=Math.min(b,e.getRight());d=Math.min(d,e.getBottom());a()};this.instersects=function(e){return Math.min(b,e.getRight())-Math.max(c,e.getLeft())>=
-0&&Math.min(d,e.getBottom())-Math.max(f,e.getTop())>=0};this.empty=function(){r=true;d=b=f=c=0;a()};this.isEmpty=function(){return r};this.toString=function(){return"THREE.Rectangle ( left: "+c+", right: "+b+", top: "+f+", bottom: "+d+", width: "+i+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
+THREE.Ray.prototype={intersectScene:function(a){var c,f,b=a.objects,d=[];a=0;for(c=b.length;a<c;a++){f=b[a];if(f instanceof THREE.Mesh)d=d.concat(this.intersectObject(f))}d.sort(function(j,n){return j.distance-n.distance});return d},intersectObject:function(a){function c(A,I,N,p){p=p.clone().subSelf(I);N=N.clone().subSelf(I);var s=A.clone().subSelf(I);A=p.dot(p);I=p.dot(N);p=p.dot(s);var k=N.dot(N);N=N.dot(s);s=1/(A*k-I*I);k=(k*p-I*N)*s;A=(A*N-I*p)*s;return k>0&&A>0&&k+A<1}var f,b,d,j,n,q,e,g,m,h,
+o,i=a.geometry,r=i.vertices,w=[];f=0;for(b=i.faces.length;f<b;f++){d=i.faces[f];h=this.origin.clone();o=this.direction.clone();j=a.matrix.transform(r[d.a].position.clone());n=a.matrix.transform(r[d.b].position.clone());q=a.matrix.transform(r[d.c].position.clone());e=d instanceof THREE.Face4?a.matrix.transform(r[d.d].position.clone()):null;g=a.matrixRotation.transform(d.normal.clone());m=o.dot(g);if(m<0){g=g.dot((new THREE.Vector3).sub(j,h))/m;h=h.addSelf(o.multiplyScalar(g));if(d instanceof THREE.Face3){if(c(h,
+j,n,q)){d={distance:this.origin.distanceTo(h),point:h,face:d,object:a};w.push(d)}}else if(d instanceof THREE.Face4)if(c(h,j,n,e)||c(h,n,q,e)){d={distance:this.origin.distanceTo(h),point:h,face:d,object:a};w.push(d)}}}return w}};
+THREE.Rectangle=function(){function a(){j=b-c;n=d-f}var c,f,b,d,j,n,q=true;this.getX=function(){return c};this.getY=function(){return f};this.getWidth=function(){return j};this.getHeight=function(){return n};this.getLeft=function(){return c};this.getTop=function(){return f};this.getRight=function(){return b};this.getBottom=function(){return d};this.set=function(e,g,m,h){q=false;c=e;f=g;b=m;d=h;a()};this.addPoint=function(e,g){if(q){q=false;c=e;f=g;b=e;d=g}else{c=Math.min(c,e);f=Math.min(f,g);b=Math.max(b,
+e);d=Math.max(d,g)}a()};this.addRectangle=function(e){if(q){q=false;c=e.getLeft();f=e.getTop();b=e.getRight();d=e.getBottom()}else{c=Math.min(c,e.getLeft());f=Math.min(f,e.getTop());b=Math.max(b,e.getRight());d=Math.max(d,e.getBottom())}a()};this.inflate=function(e){c-=e;f-=e;b+=e;d+=e;a()};this.minSelf=function(e){c=Math.max(c,e.getLeft());f=Math.max(f,e.getTop());b=Math.min(b,e.getRight());d=Math.min(d,e.getBottom());a()};this.instersects=function(e){return Math.min(b,e.getRight())-Math.max(c,e.getLeft())>=
+0&&Math.min(d,e.getBottom())-Math.max(f,e.getTop())>=0};this.empty=function(){q=true;d=b=f=c=0;a()};this.isEmpty=function(){return q};this.toString=function(){return"THREE.Rectangle ( left: "+c+", right: "+b+", top: "+f+", bottom: "+d+", width: "+j+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
 THREE.Matrix4=function(){this._x=new THREE.Vector3;this._y=new THREE.Vector3;this._z=new THREE.Vector3};
 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,f){var b=this._x,d=this._y,i=this._z;i.sub(a,c);i.normalize();b.cross(f,i);b.normalize();d.cross(i,b);d.normalize();this.n11=b.x;this.n12=b.y;this.n13=b.z;this.n14=-b.dot(a);this.n21=d.x;this.n22=d.y;this.n23=d.z;this.n24=-d.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 c=a.x,f=a.y,b=a.z,d=a.w?a.w:1;a.x=this.n11*c+this.n12*f+this.n13*b+this.n14*
+a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44},lookAt:function(a,c,f){var b=this._x,d=this._y,j=this._z;j.sub(a,c);j.normalize();b.cross(f,j);b.normalize();d.cross(j,b);d.normalize();this.n11=b.x;this.n12=b.y;this.n13=b.z;this.n14=-b.dot(a);this.n21=d.x;this.n22=d.y;this.n23=d.z;this.n24=-d.dot(a);this.n31=j.x;this.n32=j.y;this.n33=j.z;this.n34=-j.dot(a);this.n43=this.n42=this.n41=0;this.n44=1},transform:function(a){var c=a.x,f=a.y,b=a.z,d=a.w?a.w:1;a.x=this.n11*c+this.n12*f+this.n13*b+this.n14*
 d;a.y=this.n21*c+this.n22*f+this.n23*b+this.n24*d;a.z=this.n31*c+this.n32*f+this.n33*b+this.n34*d;d=this.n41*c+this.n42*f+this.n43*b+this.n44*d;if(a.w)a.w=d;else{a.x/=d;a.y/=d;a.z/=d}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,f=this.n12,b=this.n13,d=this.n14,i=this.n21,n=this.n22,
-r=this.n23,e=this.n24,g=this.n31,m=this.n32,h=this.n33,l=this.n34,q=this.n41,o=this.n42,s=this.n43,A=this.n44;this.n11=c*a.n11+f*a.n21+b*a.n31+d*a.n41;this.n12=c*a.n12+f*a.n22+b*a.n32+d*a.n42;this.n13=c*a.n13+f*a.n23+b*a.n33+d*a.n43;this.n14=c*a.n14+f*a.n24+b*a.n34+d*a.n44;this.n21=i*a.n11+n*a.n21+r*a.n31+e*a.n41;this.n22=i*a.n12+n*a.n22+r*a.n32+e*a.n42;this.n23=i*a.n13+n*a.n23+r*a.n33+e*a.n43;this.n24=i*a.n14+n*a.n24+r*a.n34+e*a.n44;this.n31=g*a.n11+m*a.n21+h*a.n31+l*a.n41;this.n32=g*a.n12+m*a.n22+
-h*a.n32+l*a.n42;this.n33=g*a.n13+m*a.n23+h*a.n33+l*a.n43;this.n34=g*a.n14+m*a.n24+h*a.n34+l*a.n44;this.n41=q*a.n11+o*a.n21+s*a.n31+A*a.n41;this.n42=q*a.n12+o*a.n22+s*a.n32+A*a.n42;this.n43=q*a.n13+o*a.n23+s*a.n33+A*a.n43;this.n44=q*a.n14+o*a.n24+s*a.n34+A*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*
+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,f=this.n12,b=this.n13,d=this.n14,j=this.n21,n=this.n22,
+q=this.n23,e=this.n24,g=this.n31,m=this.n32,h=this.n33,o=this.n34,i=this.n41,r=this.n42,w=this.n43,A=this.n44;this.n11=c*a.n11+f*a.n21+b*a.n31+d*a.n41;this.n12=c*a.n12+f*a.n22+b*a.n32+d*a.n42;this.n13=c*a.n13+f*a.n23+b*a.n33+d*a.n43;this.n14=c*a.n14+f*a.n24+b*a.n34+d*a.n44;this.n21=j*a.n11+n*a.n21+q*a.n31+e*a.n41;this.n22=j*a.n12+n*a.n22+q*a.n32+e*a.n42;this.n23=j*a.n13+n*a.n23+q*a.n33+e*a.n43;this.n24=j*a.n14+n*a.n24+q*a.n34+e*a.n44;this.n31=g*a.n11+m*a.n21+h*a.n31+o*a.n41;this.n32=g*a.n12+m*a.n22+
+h*a.n32+o*a.n42;this.n33=g*a.n13+m*a.n23+h*a.n33+o*a.n43;this.n34=g*a.n14+m*a.n24+h*a.n34+o*a.n44;this.n41=i*a.n11+r*a.n21+w*a.n31+A*a.n41;this.n42=i*a.n12+r*a.n22+w*a.n32+A*a.n42;this.n43=i*a.n13+r*a.n23+w*a.n33+A*a.n43;this.n44=i*a.n14+r*a.n24+w*a.n34+A*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,f,b){var d=c[f];c[f]=c[b];c[b]=d}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,f){var b=new THREE.Matrix4;b.n14=a;b.n24=c;b.n34=f;return b};THREE.Matrix4.scaleMatrix=function(a,c,f){var b=new THREE.Matrix4;b.n11=a;b.n22=c;b.n33=f;return b};
 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 f=new THREE.Matrix4,b=Math.cos(c),d=Math.sin(c),i=1-b,n=a.x,r=a.y,e=a.z;f.n11=i*n*n+b;f.n12=i*n*r-d*e;f.n13=i*n*e+d*r;f.n21=i*n*r+d*e;f.n22=i*r*r+b;f.n23=i*r*e-d*n;f.n31=i*n*e-d*r;f.n32=i*r*e+d*n;f.n33=i*e*e+b;return f};
+THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var f=new THREE.Matrix4,b=Math.cos(c),d=Math.sin(c),j=1-b,n=a.x,q=a.y,e=a.z;f.n11=j*n*n+b;f.n12=j*n*q-d*e;f.n13=j*n*e+d*q;f.n21=j*n*q+d*e;f.n22=j*q*q+b;f.n23=j*q*e-d*n;f.n31=j*n*e-d*q;f.n32=j*q*e+d*n;f.n33=j*e*e+b;return f};
 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 f=c[10]*c[5]-c[6]*c[9],b=-c[10]*c[1]+c[2]*c[9],d=c[6]*c[1]-c[2]*c[5],i=-c[10]*c[4]+c[6]*c[8],n=c[10]*c[0]-c[2]*c[8],r=-c[6]*c[0]+c[2]*c[4],e=c[9]*c[4]-c[5]*c[8],g=-c[9]*c[0]+c[1]*c[8],m=c[5]*c[0]-c[1]*c[4];c=c[0]*f+c[1]*i+c[2]*e;if(c==0)throw"matrix not invertible";c=1/c;a.m[0]=c*f;a.m[1]=c*b;a.m[2]=c*d;a.m[3]=c*i;a.m[4]=c*n;a.m[5]=c*r;a.m[6]=c*e;a.m[7]=c*g;a.m[8]=c*m;return a};
-THREE.Matrix4.makeFrustum=function(a,c,f,b,d,i){var n,r,e;n=new THREE.Matrix4;r=2*d/(c-a);e=2*d/(b-f);a=(c+a)/(c-a);f=(b+f)/(b-f);b=-(i+d)/(i-d);d=-2*i*d/(i-d);n.n11=r;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=e;n.n23=f;n.n24=0;n.n31=0;n.n32=0;n.n33=b;n.n34=d;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,c,f,b){var d;a=f*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*c,a*c,d,a,f,b)};
-THREE.Matrix4.makeOrtho=function(a,c,f,b,d,i){var n,r,e,g;n=new THREE.Matrix4;r=c-a;e=f-b;g=i-d;a=(c+a)/r;f=(f+b)/e;d=(i+d)/g;n.n11=2/r;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/e;n.n23=0;n.n24=-f;n.n31=0;n.n32=0;n.n33=-2/g;n.n34=-d;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=new THREE.Matrix3;var f=c[10]*c[5]-c[6]*c[9],b=-c[10]*c[1]+c[2]*c[9],d=c[6]*c[1]-c[2]*c[5],j=-c[10]*c[4]+c[6]*c[8],n=c[10]*c[0]-c[2]*c[8],q=-c[6]*c[0]+c[2]*c[4],e=c[9]*c[4]-c[5]*c[8],g=-c[9]*c[0]+c[1]*c[8],m=c[5]*c[0]-c[1]*c[4];c=c[0]*f+c[1]*j+c[2]*e;if(c==0)throw"matrix not invertible";c=1/c;a.m[0]=c*f;a.m[1]=c*b;a.m[2]=c*d;a.m[3]=c*j;a.m[4]=c*n;a.m[5]=c*q;a.m[6]=c*e;a.m[7]=c*g;a.m[8]=c*m;return a};
+THREE.Matrix4.makeFrustum=function(a,c,f,b,d,j){var n,q,e;n=new THREE.Matrix4;q=2*d/(c-a);e=2*d/(b-f);a=(c+a)/(c-a);f=(b+f)/(b-f);b=-(j+d)/(j-d);d=-2*j*d/(j-d);n.n11=q;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=e;n.n23=f;n.n24=0;n.n31=0;n.n32=0;n.n33=b;n.n34=d;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,c,f,b){var d;a=f*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*c,a*c,d,a,f,b)};
+THREE.Matrix4.makeOrtho=function(a,c,f,b,d,j){var n,q,e,g;n=new THREE.Matrix4;q=c-a;e=f-b;g=j-d;a=(c+a)/q;f=(f+b)/e;d=(j+d)/g;n.n11=2/q;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/e;n.n23=0;n.n24=-f;n.n31=0;n.n32=0;n.n33=-2/g;n.n34=-d;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};
 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,f,b,d){this.a=a;this.b=c;this.c=f;this.centroid=new THREE.Vector3;this.normal=b instanceof THREE.Vector3?b:new THREE.Vector3;this.vertexNormals=b instanceof Array?b:[];this.material=d instanceof Array?d:[d]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,c,f,b,d,i){this.a=a;this.b=c;this.c=f;this.d=b;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];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.Face4=function(a,c,f,b,d,j){this.a=a;this.b=c;this.c=f;this.d=b;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.material=j instanceof Array?j:[j]};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,f;a=0;for(c=this.faces.length;a<c;a++){f=this.faces[a];f.centroid.set(0,0,0);if(f instanceof THREE.Face3){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);f.centroid.divideScalar(3)}else if(f instanceof THREE.Face4){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);
-f.centroid.addSelf(this.vertices[f.d].position);f.centroid.divideScalar(4)}}},computeNormals:function(a){var c,f,b,d,i,n,r=new THREE.Vector3,e=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){i=this.vertices[b];i.normal.set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){i=this.faces[b];if(a&&i.vertexNormals.length){r.set(0,0,0);c=0;for(f=i.normal.length;c<f;c++)r.addSelf(i.vertexNormals[c]);r.divideScalar(3)}else{c=this.vertices[i.a];f=this.vertices[i.b];n=this.vertices[i.c];r.sub(n.position,
-f.position);e.sub(c.position,f.position);r.crossSelf(e)}r.isZero()||r.normalize();i.normal.copy(r)}},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>
+f.centroid.addSelf(this.vertices[f.d].position);f.centroid.divideScalar(4)}}},computeNormals:function(a){var c,f,b,d,j,n,q=new THREE.Vector3,e=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){j=this.vertices[b];j.normal.set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){j=this.faces[b];if(a&&j.vertexNormals.length){q.set(0,0,0);c=0;for(f=j.normal.length;c<f;c++)q.addSelf(j.vertexNormals[c]);q.divideScalar(3)}else{c=this.vertices[j.a];f=this.vertices[j.b];n=this.vertices[j.c];q.sub(n.position,
+f.position);e.sub(c.position,f.position);q.crossSelf(e)}q.isZero()||q.normalize();j.normal.copy(q)}},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,f,b){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,f,b);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(-16777216|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;
@@ -53,8 +53,8 @@ THREE.Object3D=function(){this.position=new THREE.Vector3;this.rotation=new THRE
 this.matrixRotation.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.matrixRotation.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.matrixScale=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);this.matrix.multiplySelf(this.matrixRotation);this.matrix.multiplySelf(this.matrixScale)}};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,f){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();f&&this.normalizeUVs();this.geometry.computeBoundingBox()};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;
-THREE.Mesh.prototype.sortFacesByMaterial=function(){function a(m){var h=[];c=0;for(f=m.length;c<f;c++)m[c]==undefined?h.push("undefined"):h.push(m[c].toString());return h.join("_")}var c,f,b,d,i,n,r,e,g={};b=0;for(d=this.geometry.faces.length;b<d;b++){i=this.geometry.faces[b];n=i.material;r=a(n);if(g[r]==undefined)g[r]={hash:r,counter:0};e=g[r].hash+"_"+g[r].counter;if(this.materialFaceGroup[e]==undefined)this.materialFaceGroup[e]={faces:[],material:n,vertices:0};i=i instanceof THREE.Face3?3:4;if(this.materialFaceGroup[e].vertices+
-i>65535){g[r].counter+=1;e=g[r].hash+"_"+g[r].counter;if(this.materialFaceGroup[e]==undefined)this.materialFaceGroup[e]={faces:[],material:n,vertices:0}}this.materialFaceGroup[e].faces.push(b);this.materialFaceGroup[e].vertices+=i}};THREE.Mesh.prototype.normalizeUVs=function(){var a,c,f,b,d;a=0;for(c=this.geometry.uvs.length;a<c;a++){d=this.geometry.uvs[a];f=0;for(b=d.length;f<b;f++){if(d[f].u!=1)d[f].u-=Math.floor(d[f].u);if(d[f].v!=1)d[f].v-=Math.floor(d[f].v)}}};THREE.FlatShading=0;
+THREE.Mesh.prototype.sortFacesByMaterial=function(){function a(m){var h=[];c=0;for(f=m.length;c<f;c++)m[c]==undefined?h.push("undefined"):h.push(m[c].toString());return h.join("_")}var c,f,b,d,j,n,q,e,g={};b=0;for(d=this.geometry.faces.length;b<d;b++){j=this.geometry.faces[b];n=j.material;q=a(n);if(g[q]==undefined)g[q]={hash:q,counter:0};e=g[q].hash+"_"+g[q].counter;if(this.materialFaceGroup[e]==undefined)this.materialFaceGroup[e]={faces:[],material:n,vertices:0};j=j instanceof THREE.Face3?3:4;if(this.materialFaceGroup[e].vertices+
+j>65535){g[q].counter+=1;e=g[q].hash+"_"+g[q].counter;if(this.materialFaceGroup[e]==undefined)this.materialFaceGroup[e]={faces:[],material:n,vertices:0}}this.materialFaceGroup[e].faces.push(b);this.materialFaceGroup[e].vertices+=j}};THREE.Mesh.prototype.normalizeUVs=function(){var a,c,f,b,d;a=0;for(c=this.geometry.uvs.length;a<c;a++){d=this.geometry.uvs[a];f=0;for(b=d.length;f<b;f++){if(d[f].u!=1)d[f].u-=Math.floor(d[f].u);if(d[f].v!=1)d[f].v-=Math.floor(d[f].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;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}this.toString=function(){return"THREE.LineBasicMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+
 this.linewidth+"<br/>)"}};
@@ -78,51 +78,51 @@ this.blending+"<br/>)"}};THREE.ParticleCircleMaterial=function(a){this.color=new
 THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c){this.image=a;this.mapping=c!==undefined?c:THREE.UVMapping;this.toString=function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>mapping: "+this.mapping+"<br/>)"}};THREE.UVMapping=0;THREE.ReflectionMap=1;THREE.RefractionMap=2;THREE.Multiply=0;THREE.Mix=1;
 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(p,t){var j=0,U=1,C=p.z+p.w,S=t.z+t.w,E=-p.z+p.w,B=-t.z+t.w;if(C>=0&&S>=0&&E>=0&&B>=0)return true;else if(C<0&&S<0||E<0&&B<0)return false;else{if(C<0)j=Math.max(j,C/(C-S));else if(S<0)U=Math.min(U,C/(C-S));if(E<0)j=Math.max(j,E/(E-B));else if(B<0)U=Math.min(U,E/(E-B));if(U<j)return false;else{p.lerpSelf(t,j);t.lerpSelf(p,1-U);return true}}}var c=null,f,b,d=[],i,n,r=[],e,g,m=[],h,l,q=[],o=new THREE.Vector4,s=new THREE.Matrix4,A=new THREE.Matrix4,J=new THREE.Vector4,
-N=new THREE.Vector4;this.projectScene=function(p,t){var j,U,C,S,E,B,L,w,D,Q,fa,z,M,K;c=[];l=g=n=b=0;t.autoUpdateMatrix&&t.updateMatrix();s.multiply(t.projectionMatrix,t.matrix);E=p.objects;j=0;for(U=E.length;j<U;j++){B=E[j];L=B.matrix;B.autoUpdateMatrix&&B.updateMatrix();if(B instanceof THREE.Mesh){A.multiply(s,L);w=B.geometry.vertices;C=0;for(S=w.length;C<S;C++){D=w[C];Q=D.positionScreen;Q.copy(D.position);A.transform(Q);Q.multiplyScalar(1/Q.w);D.__visible=Q.z>0&&Q.z<1}fa=B.geometry.faces;C=0;for(S=
-fa.length;C<S;C++){z=fa[C];if(z instanceof THREE.Face3){D=w[z.a];Q=w[z.b];M=w[z.c];if(D.__visible&&Q.__visible&&M.__visible)if(B.doubleSided||B.flipSided!=(M.positionScreen.x-D.positionScreen.x)*(Q.positionScreen.y-D.positionScreen.y)-(M.positionScreen.y-D.positionScreen.y)*(Q.positionScreen.x-D.positionScreen.x)<0){f=d[b]=d[b]||new THREE.RenderableFace3;f.v1.positionScreen.copy(D.positionScreen);f.v2.positionScreen.copy(Q.positionScreen);f.v3.positionScreen.copy(M.positionScreen);f.normalWorld.copy(z.normal);
-B.matrixRotation.transform(f.normalWorld);f.centroidWorld.copy(z.centroid);L.transform(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);s.transform(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterial=B.material;f.faceMaterial=z.material;f.overdraw=B.overdraw;f.uvs=B.geometry.uvs[C];f.color=z.color;c.push(f);b++}}else if(z instanceof THREE.Face4){D=w[z.a];Q=w[z.b];M=w[z.c];K=w[z.d];if(D.__visible&&Q.__visible&&M.__visible&&K.__visible)if(B.doubleSided||B.flipSided!=((K.positionScreen.x-
-D.positionScreen.x)*(Q.positionScreen.y-D.positionScreen.y)-(K.positionScreen.y-D.positionScreen.y)*(Q.positionScreen.x-D.positionScreen.x)<0||(Q.positionScreen.x-M.positionScreen.x)*(K.positionScreen.y-M.positionScreen.y)-(Q.positionScreen.y-M.positionScreen.y)*(K.positionScreen.x-M.positionScreen.x)<0)){i=r[n]=r[n]||new THREE.RenderableFace4;i.v1.positionScreen.copy(D.positionScreen);i.v2.positionScreen.copy(Q.positionScreen);i.v3.positionScreen.copy(M.positionScreen);i.v4.positionScreen.copy(K.positionScreen);
-i.normalWorld.copy(z.normal);B.matrixRotation.transform(i.normalWorld);i.centroidWorld.copy(z.centroid);L.transform(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);s.transform(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterial=B.material;i.faceMaterial=z.material;i.overdraw=B.overdraw;i.uvs=B.geometry.uvs[C];i.color=z.color;c.push(i);n++}}}}else if(B instanceof THREE.Line){A.multiply(s,L);w=B.geometry.vertices;D=w[0];D.positionScreen.copy(D.position);A.transform(D.positionScreen);C=1;
-for(S=w.length;C<S;C++){D=w[C];D.positionScreen.copy(D.position);A.transform(D.positionScreen);Q=w[C-1];J.copy(D.positionScreen);N.copy(Q.positionScreen);if(a(J,N)){J.multiplyScalar(1/J.w);N.multiplyScalar(1/N.w);e=m[g]=m[g]||new THREE.RenderableLine;e.v1.positionScreen.copy(J);e.v2.positionScreen.copy(N);e.z=Math.max(J.z,N.z);e.material=B.material;c.push(e);g++}}}else if(B instanceof THREE.Particle){o.set(B.position.x,B.position.y,B.position.z,1);s.transform(o);o.z/=o.w;if(o.z>0&&o.z<1){h=q[l]=q[l]||
-new THREE.RenderableParticle;h.x=o.x/o.w;h.y=o.y/o.w;h.z=o.z;h.rotation=B.rotation.z;h.scale.x=B.scale.x*Math.abs(h.x-(o.x+t.projectionMatrix.n11)/(o.w+t.projectionMatrix.n14));h.scale.y=B.scale.y*Math.abs(h.y-(o.y+t.projectionMatrix.n22)/(o.w+t.projectionMatrix.n24));h.material=B.material;c.push(h);l++}}}c.sort(function(T,x){return x.z-T.z});return c};this.unprojectVector=function(p,t){var j=new THREE.Matrix4;j.multiply(THREE.Matrix4.makeInvert(t.matrix),THREE.Matrix4.makeInvert(t.projectionMatrix));
-j.transform(p);return p}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,f,b,d,i;this.domElement=document.createElement("div");this.setSize=function(n,r){f=n;b=r;d=f/2;i=b/2};this.render=function(n,r){var e,g,m,h,l,q,o,s;a=c.projectScene(n,r);e=0;for(g=a.length;e<g;e++){l=a[e];if(l instanceof THREE.RenderableParticle){o=l.x*d+d;s=l.y*i+i;m=0;for(h=l.material.length;m<h;m++){q=l.material[m];if(q instanceof THREE.ParticleDOMMaterial){q=q.domElement;q.style.left=o+"px";q.style.top=s+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(v,O,H){var I,k,G;lights=v.lights;v=0;for(I=lights.length;v<I;v++){k=lights[v];G=k.color;if(k instanceof THREE.DirectionalLight){k=O.normalWorld.dot(k.position)*k.intensity;if(k>0){H.r+=G.r*k;H.g+=G.g*k;H.b+=G.b*k}}else if(k instanceof THREE.PointLight){Ja.sub(k.position,O.centroidWorld);Ja.normalize();k=O.normalWorld.dot(Ja)*k.intensity;if(k>0){H.r+=G.r*k;H.g+=G.g*k;H.b+=G.b*k}}}}function c(v,O,H,I,k,G){if(k.opacity!=0){n(k.opacity);r(k.blending);M=v.positionScreen.x;
-K=v.positionScreen.y;T=O.positionScreen.x;x=O.positionScreen.y;u=H.positionScreen.x;R=H.positionScreen.y;if(k.map){ea=k.map.image;na=ea.width-1;oa=ea.height-1;ca.u=I.uvs[0].u*na;ca.v=I.uvs[0].v*oa;Z.u=I.uvs[1].u*na;Z.v=I.uvs[1].v*oa;da.u=I.uvs[2].u*na;da.v=I.uvs[2].v*oa;i(ea,M,K,T,x,u,R,ca.u,ca.v,Z.u,Z.v,da.u,da.v)}else if(k instanceof THREE.MeshBasicMaterial)b(M,K,T,x,u,R,k.color,k.wireframe,k.wireframe_linewidth);else if(k instanceof THREE.MeshLambertMaterial){if(Fa){aa.r=ga.r;aa.g=ga.g;aa.b=ga.b;
-a(G,I,aa);V.r=k.color.r*aa.r;V.g=k.color.g*aa.g;V.b=k.color.b*aa.b;V.updateStyleString()}else V.__styleString=k.color.__styleString;b(M,K,T,x,u,R,V,k.wireframe,k.wireframe_linewidth)}else if(k instanceof THREE.MeshDepthMaterial){pa=k.__2near;qa=k.__farPlusNear;ra=k.__farMinusNear;va=~~((1-pa/(qa-v.positionScreen.z*ra))*255);wa=~~((1-pa/(qa-O.positionScreen.z*ra))*255);ma=~~((1-pa/(qa-H.positionScreen.z*ra))*255);ea=h([va,va,va],[wa,wa,wa],[ma,ma,ma],[ma,ma,ma]);ca.u=0;ca.v=0;Z.u=ka;Z.v=0;da.u=0;da.v=
-ka;i(ea,M,K,T,x,u,R,ca.u,ca.v,Z.u,Z.v,da.u,da.v)}else if(k instanceof THREE.MeshNormalMaterial){V.r=l(I.normalWorld.x);V.g=l(I.normalWorld.y);V.b=l(I.normalWorld.z);V.updateStyleString();b(M,K,T,x,u,R,V,k.wireframe,k.wireframe_linewidth)}}}function f(v,O,H,I,k,G,W,y,X){if(y.opacity!=0){n(y.opacity);r(y.blending);M=v.positionScreen.x;K=v.positionScreen.y;T=O.positionScreen.x;x=O.positionScreen.y;u=H.positionScreen.x;R=H.positionScreen.y;ha=I.positionScreen.x;P=I.positionScreen.y;Y=k.positionScreen.x;
-xa=k.positionScreen.y;Ka=G.positionScreen.x;La=G.positionScreen.y;if(y.map){ea=y.map.image;na=ea.width-1;oa=ea.height-1;ca.copy(W.uvs[0]);Z.copy(W.uvs[1]);da.copy(W.uvs[2]);ia.copy(W.uvs[3]);ca.u*=na;ca.v*=oa;Z.u*=na;Z.v*=oa;da.u*=na;da.v*=oa;ia.u*=na;ia.v*=oa;i(ea,M,K,T,x,ha,P,ca.u,ca.v,Z.u,Z.v,ia.u,ia.v);i(ea,Y,xa,u,R,Ka,La,Z.u,Z.v,da.u,da.v,ia.u,ia.v)}else if(y instanceof THREE.MeshBasicMaterial)d(M,K,T,x,u,R,ha,P,y.color,y.wireframe,y.wireframe_linewidth);else if(y instanceof THREE.MeshLambertMaterial){if(Fa){aa.r=
-ga.r;aa.g=ga.g;aa.b=ga.b;a(X,W,aa);V.r=y.color.r*aa.r;V.g=y.color.g*aa.g;V.b=y.color.b*aa.b;V.updateStyleString()}else V.__styleString=y.color.__styleString;d(M,K,T,x,u,R,ha,P,V,y.wireframe,y.wireframe_linewidth)}else if(y instanceof THREE.MeshDepthMaterial){pa=y.__2near;qa=y.__farPlusNear;ra=y.__farMinusNear;va=~~((1-pa/(qa-v.positionScreen.z*ra))*255);wa=~~((1-pa/(qa-O.positionScreen.z*ra))*255);ma=~~((1-pa/(qa-H.positionScreen.z*ra))*255);Ga=~~((1-pa/(qa-I.positionScreen.z*ra))*255);ea=h([va,va,
-va],[wa,wa,wa],[Ga,Ga,Ga],[ma,ma,ma]);ca.u=0;ca.v=0;Z.u=ka;Z.v=0;da.u=ka;da.v=ka;ia.u=0;ia.v=ka;i(ea,M,K,T,x,ha,P,ca.u,ca.v,Z.u,Z.v,ia.u,ia.v);i(ea,Y,xa,u,R,Ka,La,Z.u,Z.v,da.u,da.v,ia.u,ia.v)}else if(y instanceof THREE.MeshNormalMaterial){V.r=l(W.normalWorld.x);V.g=l(W.normalWorld.y);V.b=l(W.normalWorld.z);V.updateStyleString();d(M,K,T,x,u,R,ha,P,V,y.wireframe,y.wireframe_linewidth)}}}function b(v,O,H,I,k,G,W,y,X){j.beginPath();j.moveTo(v,O);j.lineTo(H,I);j.lineTo(k,G);j.lineTo(v,O);j.closePath();
-if(y){e(X);g(W.__styleString);j.stroke();$.inflate(X*2)}else{m(W.__styleString);j.fill()}}function d(v,O,H,I,k,G,W,y,X,F,ba){j.beginPath();j.moveTo(v,O);j.lineTo(H,I);j.lineTo(k,G);j.lineTo(W,y);j.lineTo(v,O);j.closePath();if(F){e(ba);g(X.__styleString);j.stroke();$.inflate(ba*2)}else{m(X.__styleString);j.fill()}}function i(v,O,H,I,k,G,W,y,X,F,ba,la,sa){j.beginPath();j.moveTo(O,H);j.lineTo(I,k);j.lineTo(G,W);j.closePath();I-=O;k-=H;G-=O;W-=H;F-=y;ba-=X;la-=y;sa-=X;var ta=1/(F*sa-la*ba),Ba=(sa*I-ba*
-G)*ta;ba=(sa*k-ba*W)*ta;I=(F*G-la*I)*ta;k=(F*W-la*k)*ta;O=O-Ba*y-I*X;H=H-ba*y-k*X;j.save();j.transform(Ba,ba,I,k,O,H);j.clip();j.drawImage(v,0,0);j.restore()}function n(v){if(U!=v)j.globalAlpha=U=v}function r(v){if(C!=v){switch(v){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}C=v}}function e(v){if(B!=v)j.lineWidth=B=v}function g(v){if(S!=
-v)j.strokeStyle=S=v}function m(v){if(E!=v)j.fillStyle=E=v}function h(v,O,H,I){ja[0]=v[0];ja[1]=v[1];ja[2]=v[2];ja[4]=O[0];ja[5]=O[1];ja[6]=O[2];ja[8]=H[0];ja[9]=H[1];ja[10]=H[2];ja[12]=I[0];ja[13]=I[1];ja[14]=I[2];Ca.putImageData(Ma,0,0);Ha.drawImage(Da,0,0);return Ea}function l(v){return v<0?Math.min((1+v)*0.5,0.5):0.5+Math.min(v*0.5,0.5)}function q(v,O){var H=O.x-v.x,I=O.y-v.y,k=1/Math.sqrt(H*H+I*I);H*=k;I*=k;O.x+=H;O.y+=I;v.x-=H;v.y-=I}var o=null,s=new THREE.Projector,A=document.createElement("canvas"),
-J,N,p,t,j=A.getContext("2d"),U=1,C=0,S=null,E=null,B=1,L,w,D,Q,fa=new THREE.Vertex,z=new THREE.Vertex,M,K,T,x,u,R,ha,P,Y,xa,Ka,La,va,wa,ma,Ga,pa,qa,ra,ea,na,oa,ya=new THREE.Rectangle,ua=new THREE.Rectangle,$=new THREE.Rectangle,Fa=false,V=new THREE.Color(16777215),aa=new THREE.Color(16777215),ga=new THREE.Color(0),za=new THREE.Color(0),Aa=new THREE.Color(0),Qa=Math.PI*2,Ja=new THREE.Vector3,ca=new THREE.UV,Z=new THREE.UV,da=new THREE.UV,ia=new THREE.UV,Da,Ca,Ma,ja,Ea,Ha,ka=16;Da=document.createElement("canvas");
-Da.width=Da.height=2;Ca=Da.getContext("2d");Ca.fillStyle="rgba(0,0,0,1)";Ca.fillRect(0,0,2,2);Ma=Ca.getImageData(0,0,2,2);ja=Ma.data;Ea=document.createElement("canvas");Ea.width=Ea.height=ka;Ha=Ea.getContext("2d");Ha.translate(-ka/2,-ka/2);Ha.scale(ka,ka);ka--;this.domElement=A;this.autoClear=true;this.setSize=function(v,O){J=v;N=O;p=J/2;t=N/2;A.width=J;A.height=N;j.lineJoin="round";j.lineCap="round";ya.set(-p,-t,p,t)};this.clear=function(){if(!ua.isEmpty()){ua.inflate(1);ua.minSelf(ya);j.setTransform(1,
-0,0,-1,p,t);j.clearRect(ua.getX(),ua.getY(),ua.getWidth(),ua.getHeight());ua.empty()}};this.render=function(v,O){var H,I,k,G,W,y,X,F;this.autoClear&&this.clear();o=s.projectScene(v,O);j.setTransform(1,0,0,-1,p,t);if(Fa=v.lights.length>0){W=v.lights;ga.setRGB(0,0,0);za.setRGB(0,0,0);Aa.setRGB(0,0,0);H=0;for(I=W.length;H<I;H++){k=W[H];G=k.color;if(k instanceof THREE.AmbientLight){ga.r+=G.r;ga.g+=G.g;ga.b+=G.b}else if(k instanceof THREE.DirectionalLight){za.r+=G.r;za.g+=G.g;za.b+=G.b}else if(k instanceof
-THREE.PointLight){Aa.r+=G.r;Aa.g+=G.g;Aa.b+=G.b}}}H=0;for(I=o.length;H<I;H++){k=o[H];$.empty();if(k instanceof THREE.RenderableParticle){L=k;L.x*=p;L.y*=t;G=0;for(W=k.material.length;G<W;G++)if(F=k.material[G]){y=L;X=k;F=F;if(F.opacity!=0){n(F.opacity);r(F.blending);var ba=void 0,la=void 0,sa=void 0,ta=void 0,Ba=void 0,Na=void 0,Ia=void 0,Oa=void 0,Pa=void 0;if(F instanceof THREE.ParticleBasicMaterial){Ia=F.bitmap;Oa=Ia.width/2;Pa=Ia.height/2;sa=X.scale.x*p;ta=X.scale.y*t;ba=sa*Oa;la=ta*Pa;Ba=F.offset.x*
-sa;Na=F.offset.y*ta;$.set(y.x+Ba-ba,y.y+Na-la,y.x+Ba+ba,y.y+Na+la);if(ya.instersects($)){j.save();j.translate(y.x,y.y);j.rotate(-X.rotation);j.scale(sa,-ta);j.translate(-Oa+F.offset.x,-Pa-F.offset.y);j.drawImage(Ia,0,0);j.restore()}}else if(F instanceof THREE.ParticleCircleMaterial){if(Fa){aa.r=ga.r+za.r+Aa.r;aa.g=ga.g+za.g+Aa.g;aa.b=ga.b+za.b+Aa.b;V.r=F.color.r*aa.r;V.g=F.color.g*aa.g;V.b=F.color.b*aa.b;V.updateStyleString()}else V.__styleString=F.color.__styleString;ba=X.scale.x*p;la=X.scale.y*
-t;$.set(y.x-ba,y.y-la,y.x+ba,y.y+la);if(ya.instersects($)){m(V.__styleString);j.save();j.translate(y.x,y.y);j.rotate(-X.rotation);j.scale(ba,la);j.beginPath();j.arc(0,0,1,0,Qa,true);j.closePath();j.fill();j.restore()}}}}}else if(k instanceof THREE.RenderableLine){L=k.v1;w=k.v2;L.positionScreen.x*=p;L.positionScreen.y*=t;w.positionScreen.x*=p;w.positionScreen.y*=t;$.addPoint(L.positionScreen.x,L.positionScreen.y);$.addPoint(w.positionScreen.x,w.positionScreen.y);if(!ya.instersects($))continue;G=0;
-for(W=k.material.length;G<W;)if(F=k.material[G++]){y=L;X=w;F=F;if(F.opacity!=0){n(F.opacity);r(F.blending);j.beginPath();j.moveTo(y.positionScreen.x,y.positionScreen.y);j.lineTo(X.positionScreen.x,X.positionScreen.y);j.closePath();if(F instanceof THREE.LineBasicMaterial){V.__styleString=F.color.__styleString;e(F.linewidth);g(V.__styleString);j.stroke();$.inflate(F.linewidth*2)}}}}else if(k instanceof THREE.RenderableFace3){L=k.v1;w=k.v2;D=k.v3;L.positionScreen.x*=p;L.positionScreen.y*=t;w.positionScreen.x*=
-p;w.positionScreen.y*=t;D.positionScreen.x*=p;D.positionScreen.y*=t;if(k.overdraw){q(L.positionScreen,w.positionScreen);q(w.positionScreen,D.positionScreen);q(D.positionScreen,L.positionScreen)}$.addPoint(L.positionScreen.x,L.positionScreen.y);$.addPoint(w.positionScreen.x,w.positionScreen.y);$.addPoint(D.positionScreen.x,D.positionScreen.y);if(!ya.instersects($))continue;G=0;for(W=k.meshMaterial.length;G<W;){F=k.meshMaterial[G++];if(F instanceof THREE.MeshFaceMaterial){y=0;for(X=k.faceMaterial.length;y<
-X;)(F=k.faceMaterial[y++])&&c(L,w,D,k,F,v)}else F&&c(L,w,D,k,F,v)}}else if(k instanceof THREE.RenderableFace4){L=k.v1;w=k.v2;D=k.v3;Q=k.v4;L.positionScreen.x*=p;L.positionScreen.y*=t;w.positionScreen.x*=p;w.positionScreen.y*=t;D.positionScreen.x*=p;D.positionScreen.y*=t;Q.positionScreen.x*=p;Q.positionScreen.y*=t;fa.positionScreen.copy(w.positionScreen);z.positionScreen.copy(Q.positionScreen);if(k.overdraw){q(L.positionScreen,w.positionScreen);q(w.positionScreen,Q.positionScreen);q(Q.positionScreen,
-L.positionScreen)}if(k.overdraw){q(D.positionScreen,fa.positionScreen);q(D.positionScreen,z.positionScreen)}$.addPoint(L.positionScreen.x,L.positionScreen.y);$.addPoint(w.positionScreen.x,w.positionScreen.y);$.addPoint(D.positionScreen.x,D.positionScreen.y);$.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(!ya.instersects($))continue;G=0;for(W=k.meshMaterial.length;G<W;){F=k.meshMaterial[G++];if(F instanceof THREE.MeshFaceMaterial){y=0;for(X=k.faceMaterial.length;y<X;)(F=k.faceMaterial[y++])&&
-f(L,w,D,Q,fa,z,k,F,v)}else F&&f(L,w,D,Q,fa,z,k,F,v)}}ua.addRectangle($)}j.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(z,M,K){var T,x,u,R;T=0;for(x=z.lights.length;T<x;T++){u=z.lights[T];if(u instanceof THREE.DirectionalLight){R=M.normalWorld.dot(u.position)*u.intensity;if(R>0){K.r+=u.color.r*R;K.g+=u.color.g*R;K.b+=u.color.b*R}}else if(u instanceof THREE.PointLight){E.sub(u.position,M.centroidWorld);E.normalize();R=M.normalWorld.dot(E)*u.intensity;if(R>0){K.r+=u.color.r*R;K.g+=u.color.g*R;K.b+=u.color.b*R}}}}function c(z,M,K,T,x,u){w=b(D++);w.setAttribute("d","M "+z.positionScreen.x+
-" "+z.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+"z");if(x instanceof THREE.MeshBasicMaterial)p.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshLambertMaterial)if(N){t.r=j.r;t.g=j.g;t.b=j.b;a(u,T,t);p.r=x.color.r*t.r;p.g=x.color.g*t.g;p.b=x.color.b*t.b;p.updateStyleString()}else p.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshDepthMaterial){S=1-x.__2near/(x.__farPlusNear-T.z*x.__farMinusNear);
-p.setRGB(S,S,S)}else x instanceof THREE.MeshNormalMaterial&&p.setRGB(d(T.normalWorld.x),d(T.normalWorld.y),d(T.normalWorld.z));x.wireframe?w.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+x.wireframe_linewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: round; stroke-linejoin: round"):w.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+x.opacity);r.appendChild(w)}function f(z,M,K,T,x,u,R){w=b(D++);w.setAttribute("d","M "+z.positionScreen.x+" "+
-z.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+" L "+T.positionScreen.x+","+T.positionScreen.y+"z");if(u instanceof THREE.MeshBasicMaterial)p.__styleString=u.color.__styleString;else if(u instanceof THREE.MeshLambertMaterial)if(N){t.r=j.r;t.g=j.g;t.b=j.b;a(R,x,t);p.r=u.color.r*t.r;p.g=u.color.g*t.g;p.b=u.color.b*t.b;p.updateStyleString()}else p.__styleString=u.color.__styleString;else if(u instanceof THREE.MeshDepthMaterial){S=1-
-u.__2near/(u.__farPlusNear-x.z*u.__farMinusNear);p.setRGB(S,S,S)}else u instanceof THREE.MeshNormalMaterial&&p.setRGB(d(x.normalWorld.x),d(x.normalWorld.y),d(x.normalWorld.z));u.wireframe?w.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+u.wireframe_linewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: round; stroke-linejoin: round"):w.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+u.opacity);r.appendChild(w)}function b(z){if(B[z]==null){B[z]=
-document.createElementNS("http://www.w3.org/2000/svg","path");fa==0&&B[z].setAttribute("shape-rendering","crispEdges");return B[z]}return B[z]}function d(z){return z<0?Math.min((1+z)*0.5,0.5):0.5+Math.min(z*0.5,0.5)}var i=null,n=new THREE.Projector,r=document.createElementNS("http://www.w3.org/2000/svg","svg"),e,g,m,h,l,q,o,s,A=new THREE.Rectangle,J=new THREE.Rectangle,N=false,p=new THREE.Color(16777215),t=new THREE.Color(16777215),j=new THREE.Color(0),U=new THREE.Color(0),C=new THREE.Color(0),S,
-E=new THREE.Vector3,B=[],L=[],w,D,Q,fa=1;this.domElement=r;this.autoClear=true;this.setQuality=function(z){switch(z){case "high":fa=1;break;case "low":fa=0}};this.setSize=function(z,M){e=z;g=M;m=e/2;h=g/2;r.setAttribute("viewBox",-m+" "+-h+" "+e+" "+g);r.setAttribute("width",e);r.setAttribute("height",g);A.set(-m,-h,m,h)};this.clear=function(){for(;r.childNodes.length>0;)r.removeChild(r.childNodes[0])};this.render=function(z,M){var K,T,x,u,R,ha,P,Y;this.autoClear&&this.clear();i=n.projectScene(z,
-M);Q=D=0;if(N=z.lights.length>0){P=z.lights;j.setRGB(0,0,0);U.setRGB(0,0,0);C.setRGB(0,0,0);K=0;for(T=P.length;K<T;K++){x=P[K];u=x.color;if(x instanceof THREE.AmbientLight){j.r+=u.r;j.g+=u.g;j.b+=u.b}else if(x instanceof THREE.DirectionalLight){U.r+=u.r;U.g+=u.g;U.b+=u.b}else if(x instanceof THREE.PointLight){C.r+=u.r;C.g+=u.g;C.b+=u.b}}}K=0;for(T=i.length;K<T;K++){P=i[K];J.empty();if(P instanceof THREE.RenderableParticle){l=P;l.x*=m;l.y*=-h;x=0;for(u=P.material.length;x<u;x++)if(Y=P.material[x]){R=
-l;ha=P;Y=Y;var xa=Q++;if(L[xa]==null){L[xa]=document.createElementNS("http://www.w3.org/2000/svg","circle");fa==0&&L[xa].setAttribute("shape-rendering","crispEdges")}w=L[xa];w.setAttribute("cx",R.x);w.setAttribute("cy",R.y);w.setAttribute("r",ha.scale.x*m);if(Y instanceof THREE.ParticleCircleMaterial){if(N){t.r=j.r+U.r+C.r;t.g=j.g+U.g+C.g;t.b=j.b+U.b+C.b;p.r=Y.color.r*t.r;p.g=Y.color.g*t.g;p.b=Y.color.b*t.b;p.updateStyleString()}else p=Y.color;w.setAttribute("style","fill: "+p.__styleString)}r.appendChild(w)}}else if(P instanceof
-THREE.RenderableFace3){l=P.v1;q=P.v2;o=P.v3;l.positionScreen.x*=m;l.positionScreen.y*=-h;q.positionScreen.x*=m;q.positionScreen.y*=-h;o.positionScreen.x*=m;o.positionScreen.y*=-h;J.addPoint(l.positionScreen.x,l.positionScreen.y);J.addPoint(q.positionScreen.x,q.positionScreen.y);J.addPoint(o.positionScreen.x,o.positionScreen.y);if(A.instersects(J)){x=0;for(u=P.meshMaterial.length;x<u;){Y=P.meshMaterial[x++];if(Y instanceof THREE.MeshFaceMaterial){R=0;for(ha=P.faceMaterial.length;R<ha;)(Y=P.faceMaterial[R++])&&
-c(l,q,o,P,Y,z)}else Y&&c(l,q,o,P,Y,z)}}}else if(P instanceof THREE.RenderableFace4){l=P.v1;q=P.v2;o=P.v3;s=P.v4;l.positionScreen.x*=m;l.positionScreen.y*=-h;q.positionScreen.x*=m;q.positionScreen.y*=-h;o.positionScreen.x*=m;o.positionScreen.y*=-h;s.positionScreen.x*=m;s.positionScreen.y*=-h;J.addPoint(l.positionScreen.x,l.positionScreen.y);J.addPoint(q.positionScreen.x,q.positionScreen.y);J.addPoint(o.positionScreen.x,o.positionScreen.y);J.addPoint(s.positionScreen.x,s.positionScreen.y);if(A.instersects(J)){x=
-0;for(u=P.meshMaterial.length;x<u;){Y=P.meshMaterial[x++];if(Y instanceof THREE.MeshFaceMaterial){R=0;for(ha=P.faceMaterial.length;R<ha;)(Y=P.faceMaterial[R++])&&f(l,q,o,s,P,Y,z)}else Y&&f(l,q,o,s,P,Y,z)}}}}}};
-THREE.WebGLRenderer=function(a){function c(e,g){var m;if(e=="fragment")m=b.createShader(b.FRAGMENT_SHADER);else if(e=="vertex")m=b.createShader(b.VERTEX_SHADER);b.shaderSource(m,g);b.compileShader(m);if(!b.getShaderParameter(m,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(m));return null}return m}var f=document.createElement("canvas"),b,d,i=new THREE.Matrix4,n;a=function(e,g){if(e){var m,h,l,q=pointLights=maxDirLights=maxPointLights=0;m=0;for(h=e.lights.length;m<h;m++){l=e.lights[m];l instanceof THREE.DirectionalLight&&
-q++;l instanceof THREE.PointLight&&pointLights++}if(pointLights+q<=g){maxDirLights=q;maxPointLights=pointLights}else{maxDirLights=Math.ceil(g*q/(pointLights+q));maxPointLights=g-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:g-1}}(a,4);this.domElement=f;this.autoClear=true;try{b=f.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);
+THREE.Projector=function(){function a(p,s){var k=0,T=1,K=p.z+p.w,W=s.z+s.w,D=-p.z+p.w,B=-s.z+s.w;if(K>=0&&W>=0&&D>=0&&B>=0)return true;else if(K<0&&W<0||D<0&&B<0)return false;else{if(K<0)k=Math.max(k,K/(K-W));else if(W<0)T=Math.min(T,K/(K-W));if(D<0)k=Math.max(k,D/(D-B));else if(B<0)T=Math.min(T,D/(D-B));if(T<k)return false;else{p.lerpSelf(s,k);s.lerpSelf(p,1-T);return true}}}var c=null,f,b,d=[],j,n,q=[],e,g,m=[],h,o,i=[],r=new THREE.Vector4,w=new THREE.Matrix4,A=new THREE.Matrix4,I=new THREE.Vector4,
+N=new THREE.Vector4;this.projectScene=function(p,s){var k,T,K,W,D,B,L,v,C,Q,fa,z,M,J;c=[];o=g=n=b=0;s.autoUpdateMatrix&&s.updateMatrix();w.multiply(s.projectionMatrix,s.matrix);D=p.objects;k=0;for(T=D.length;k<T;k++){B=D[k];L=B.matrix;B.autoUpdateMatrix&&B.updateMatrix();if(B instanceof THREE.Mesh){A.multiply(w,L);v=B.geometry.vertices;K=0;for(W=v.length;K<W;K++){C=v[K];Q=C.positionScreen;Q.copy(C.position);A.transform(Q);Q.multiplyScalar(1/Q.w);C.__visible=Q.z>0&&Q.z<1}fa=B.geometry.faces;K=0;for(W=
+fa.length;K<W;K++){z=fa[K];if(z instanceof THREE.Face3){C=v[z.a];Q=v[z.b];M=v[z.c];if(C.__visible&&Q.__visible&&M.__visible)if(B.doubleSided||B.flipSided!=(M.positionScreen.x-C.positionScreen.x)*(Q.positionScreen.y-C.positionScreen.y)-(M.positionScreen.y-C.positionScreen.y)*(Q.positionScreen.x-C.positionScreen.x)<0){f=d[b]=d[b]||new THREE.RenderableFace3;f.v1.positionScreen.copy(C.positionScreen);f.v2.positionScreen.copy(Q.positionScreen);f.v3.positionScreen.copy(M.positionScreen);f.normalWorld.copy(z.normal);
+B.matrixRotation.transform(f.normalWorld);f.centroidWorld.copy(z.centroid);L.transform(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);w.transform(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterial=B.material;f.faceMaterial=z.material;f.overdraw=B.overdraw;f.uvs=B.geometry.uvs[K];f.color=z.color;c.push(f);b++}}else if(z instanceof THREE.Face4){C=v[z.a];Q=v[z.b];M=v[z.c];J=v[z.d];if(C.__visible&&Q.__visible&&M.__visible&&J.__visible)if(B.doubleSided||B.flipSided!=((J.positionScreen.x-
+C.positionScreen.x)*(Q.positionScreen.y-C.positionScreen.y)-(J.positionScreen.y-C.positionScreen.y)*(Q.positionScreen.x-C.positionScreen.x)<0||(Q.positionScreen.x-M.positionScreen.x)*(J.positionScreen.y-M.positionScreen.y)-(Q.positionScreen.y-M.positionScreen.y)*(J.positionScreen.x-M.positionScreen.x)<0)){j=q[n]=q[n]||new THREE.RenderableFace4;j.v1.positionScreen.copy(C.positionScreen);j.v2.positionScreen.copy(Q.positionScreen);j.v3.positionScreen.copy(M.positionScreen);j.v4.positionScreen.copy(J.positionScreen);
+j.normalWorld.copy(z.normal);B.matrixRotation.transform(j.normalWorld);j.centroidWorld.copy(z.centroid);L.transform(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);w.transform(j.centroidScreen);j.z=j.centroidScreen.z;j.meshMaterial=B.material;j.faceMaterial=z.material;j.overdraw=B.overdraw;j.uvs=B.geometry.uvs[K];j.color=z.color;c.push(j);n++}}}}else if(B instanceof THREE.Line){A.multiply(w,L);v=B.geometry.vertices;C=v[0];C.positionScreen.copy(C.position);A.transform(C.positionScreen);K=1;
+for(W=v.length;K<W;K++){C=v[K];C.positionScreen.copy(C.position);A.transform(C.positionScreen);Q=v[K-1];I.copy(C.positionScreen);N.copy(Q.positionScreen);if(a(I,N)){I.multiplyScalar(1/I.w);N.multiplyScalar(1/N.w);e=m[g]=m[g]||new THREE.RenderableLine;e.v1.positionScreen.copy(I);e.v2.positionScreen.copy(N);e.z=Math.max(I.z,N.z);e.material=B.material;c.push(e);g++}}}else if(B instanceof THREE.Particle){r.set(B.position.x,B.position.y,B.position.z,1);w.transform(r);r.z/=r.w;if(r.z>0&&r.z<1){h=i[o]=i[o]||
+new THREE.RenderableParticle;h.x=r.x/r.w;h.y=r.y/r.w;h.z=r.z;h.rotation=B.rotation.z;h.scale.x=B.scale.x*Math.abs(h.x-(r.x+s.projectionMatrix.n11)/(r.w+s.projectionMatrix.n14));h.scale.y=B.scale.y*Math.abs(h.y-(r.y+s.projectionMatrix.n22)/(r.w+s.projectionMatrix.n24));h.material=B.material;c.push(h);o++}}}c.sort(function(S,x){return x.z-S.z});return c};this.unprojectVector=function(p,s){var k=new THREE.Matrix4;k.multiply(THREE.Matrix4.makeInvert(s.matrix),THREE.Matrix4.makeInvert(s.projectionMatrix));
+k.transform(p);return p}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,f,b,d,j;this.domElement=document.createElement("div");this.setSize=function(n,q){f=n;b=q;d=f/2;j=b/2};this.render=function(n,q){var e,g,m,h,o,i,r,w;a=c.projectScene(n,q);e=0;for(g=a.length;e<g;e++){o=a[e];if(o instanceof THREE.RenderableParticle){r=o.x*d+d;w=o.y*j+j;m=0;for(h=o.material.length;m<h;m++){i=o.material[m];if(i instanceof THREE.ParticleDOMMaterial){i=i.domElement;i.style.left=r+"px";i.style.top=w+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(u,O,G){var H,l,F;lights=u.lights;u=0;for(H=lights.length;u<H;u++){l=lights[u];F=l.color;if(l instanceof THREE.DirectionalLight){l=O.normalWorld.dot(l.position)*l.intensity;if(l>0){G.r+=F.r*l;G.g+=F.g*l;G.b+=F.b*l}}else if(l instanceof THREE.PointLight){Ja.sub(l.position,O.centroidWorld);Ja.normalize();l=O.normalWorld.dot(Ja)*l.intensity;if(l>0){G.r+=F.r*l;G.g+=F.g*l;G.b+=F.b*l}}}}function c(u,O,G,H,l,F){if(l.opacity!=0){n(l.opacity);q(l.blending);M=u.positionScreen.x;
+J=u.positionScreen.y;S=O.positionScreen.x;x=O.positionScreen.y;t=G.positionScreen.x;R=G.positionScreen.y;if(l.map){ea=l.map.image;na=ea.width-1;oa=ea.height-1;ca.u=H.uvs[0].u*na;ca.v=H.uvs[0].v*oa;Z.u=H.uvs[1].u*na;Z.v=H.uvs[1].v*oa;da.u=H.uvs[2].u*na;da.v=H.uvs[2].v*oa;j(ea,M,J,S,x,t,R,ca.u,ca.v,Z.u,Z.v,da.u,da.v)}else if(l instanceof THREE.MeshBasicMaterial)b(M,J,S,x,t,R,l.color,l.wireframe,l.wireframe_linewidth);else if(l instanceof THREE.MeshLambertMaterial){if(Fa){aa.r=ga.r;aa.g=ga.g;aa.b=ga.b;
+a(F,H,aa);U.r=l.color.r*aa.r;U.g=l.color.g*aa.g;U.b=l.color.b*aa.b;U.updateStyleString()}else U.__styleString=l.color.__styleString;b(M,J,S,x,t,R,U,l.wireframe,l.wireframe_linewidth)}else if(l instanceof THREE.MeshDepthMaterial){pa=l.__2near;qa=l.__farPlusNear;ra=l.__farMinusNear;va=~~((1-pa/(qa-u.positionScreen.z*ra))*255);wa=~~((1-pa/(qa-O.positionScreen.z*ra))*255);ma=~~((1-pa/(qa-G.positionScreen.z*ra))*255);ea=h([va,va,va],[wa,wa,wa],[ma,ma,ma],[ma,ma,ma]);ca.u=0;ca.v=0;Z.u=ka;Z.v=0;da.u=0;da.v=
+ka;j(ea,M,J,S,x,t,R,ca.u,ca.v,Z.u,Z.v,da.u,da.v)}else if(l instanceof THREE.MeshNormalMaterial){U.r=o(H.normalWorld.x);U.g=o(H.normalWorld.y);U.b=o(H.normalWorld.z);U.updateStyleString();b(M,J,S,x,t,R,U,l.wireframe,l.wireframe_linewidth)}}}function f(u,O,G,H,l,F,V,y,X){if(y.opacity!=0){n(y.opacity);q(y.blending);M=u.positionScreen.x;J=u.positionScreen.y;S=O.positionScreen.x;x=O.positionScreen.y;t=G.positionScreen.x;R=G.positionScreen.y;ha=H.positionScreen.x;P=H.positionScreen.y;Y=l.positionScreen.x;
+xa=l.positionScreen.y;Ka=F.positionScreen.x;La=F.positionScreen.y;if(y.map){ea=y.map.image;na=ea.width-1;oa=ea.height-1;ca.copy(V.uvs[0]);Z.copy(V.uvs[1]);da.copy(V.uvs[2]);ia.copy(V.uvs[3]);ca.u*=na;ca.v*=oa;Z.u*=na;Z.v*=oa;da.u*=na;da.v*=oa;ia.u*=na;ia.v*=oa;j(ea,M,J,S,x,ha,P,ca.u,ca.v,Z.u,Z.v,ia.u,ia.v);j(ea,Y,xa,t,R,Ka,La,Z.u,Z.v,da.u,da.v,ia.u,ia.v)}else if(y instanceof THREE.MeshBasicMaterial)d(M,J,S,x,t,R,ha,P,y.color,y.wireframe,y.wireframe_linewidth);else if(y instanceof THREE.MeshLambertMaterial){if(Fa){aa.r=
+ga.r;aa.g=ga.g;aa.b=ga.b;a(X,V,aa);U.r=y.color.r*aa.r;U.g=y.color.g*aa.g;U.b=y.color.b*aa.b;U.updateStyleString()}else U.__styleString=y.color.__styleString;d(M,J,S,x,t,R,ha,P,U,y.wireframe,y.wireframe_linewidth)}else if(y instanceof THREE.MeshDepthMaterial){pa=y.__2near;qa=y.__farPlusNear;ra=y.__farMinusNear;va=~~((1-pa/(qa-u.positionScreen.z*ra))*255);wa=~~((1-pa/(qa-O.positionScreen.z*ra))*255);ma=~~((1-pa/(qa-G.positionScreen.z*ra))*255);Ga=~~((1-pa/(qa-H.positionScreen.z*ra))*255);ea=h([va,va,
+va],[wa,wa,wa],[Ga,Ga,Ga],[ma,ma,ma]);ca.u=0;ca.v=0;Z.u=ka;Z.v=0;da.u=ka;da.v=ka;ia.u=0;ia.v=ka;j(ea,M,J,S,x,ha,P,ca.u,ca.v,Z.u,Z.v,ia.u,ia.v);j(ea,Y,xa,t,R,Ka,La,Z.u,Z.v,da.u,da.v,ia.u,ia.v)}else if(y instanceof THREE.MeshNormalMaterial){U.r=o(V.normalWorld.x);U.g=o(V.normalWorld.y);U.b=o(V.normalWorld.z);U.updateStyleString();d(M,J,S,x,t,R,ha,P,U,y.wireframe,y.wireframe_linewidth)}}}function b(u,O,G,H,l,F,V,y,X){k.beginPath();k.moveTo(u,O);k.lineTo(G,H);k.lineTo(l,F);k.lineTo(u,O);k.closePath();
+if(y){e(X);g(V.__styleString);k.stroke();$.inflate(X*2)}else{m(V.__styleString);k.fill()}}function d(u,O,G,H,l,F,V,y,X,E,ba){k.beginPath();k.moveTo(u,O);k.lineTo(G,H);k.lineTo(l,F);k.lineTo(V,y);k.lineTo(u,O);k.closePath();if(E){e(ba);g(X.__styleString);k.stroke();$.inflate(ba*2)}else{m(X.__styleString);k.fill()}}function j(u,O,G,H,l,F,V,y,X,E,ba,la,sa){k.beginPath();k.moveTo(O,G);k.lineTo(H,l);k.lineTo(F,V);k.closePath();H-=O;l-=G;F-=O;V-=G;E-=y;ba-=X;la-=y;sa-=X;var ta=1/(E*sa-la*ba),Ba=(sa*H-ba*
+F)*ta;ba=(sa*l-ba*V)*ta;H=(E*F-la*H)*ta;l=(E*V-la*l)*ta;O=O-Ba*y-H*X;G=G-ba*y-l*X;k.save();k.transform(Ba,ba,H,l,O,G);k.clip();k.drawImage(u,0,0);k.restore()}function n(u){if(T!=u)k.globalAlpha=T=u}function q(u){if(K!=u){switch(u){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}K=u}}function e(u){if(B!=u)k.lineWidth=B=u}function g(u){if(W!=
+u)k.strokeStyle=W=u}function m(u){if(D!=u)k.fillStyle=D=u}function h(u,O,G,H){ja[0]=u[0];ja[1]=u[1];ja[2]=u[2];ja[4]=O[0];ja[5]=O[1];ja[6]=O[2];ja[8]=G[0];ja[9]=G[1];ja[10]=G[2];ja[12]=H[0];ja[13]=H[1];ja[14]=H[2];Ca.putImageData(Ma,0,0);Ha.drawImage(Da,0,0);return Ea}function o(u){return u<0?Math.min((1+u)*0.5,0.5):0.5+Math.min(u*0.5,0.5)}function i(u,O){var G=O.x-u.x,H=O.y-u.y,l=1/Math.sqrt(G*G+H*H);G*=l;H*=l;O.x+=G;O.y+=H;u.x-=G;u.y-=H}var r=null,w=new THREE.Projector,A=document.createElement("canvas"),
+I,N,p,s,k=A.getContext("2d"),T=1,K=0,W=null,D=null,B=1,L,v,C,Q,fa=new THREE.Vertex,z=new THREE.Vertex,M,J,S,x,t,R,ha,P,Y,xa,Ka,La,va,wa,ma,Ga,pa,qa,ra,ea,na,oa,ya=new THREE.Rectangle,ua=new THREE.Rectangle,$=new THREE.Rectangle,Fa=false,U=new THREE.Color(16777215),aa=new THREE.Color(16777215),ga=new THREE.Color(0),za=new THREE.Color(0),Aa=new THREE.Color(0),Qa=Math.PI*2,Ja=new THREE.Vector3,ca=new THREE.UV,Z=new THREE.UV,da=new THREE.UV,ia=new THREE.UV,Da,Ca,Ma,ja,Ea,Ha,ka=16;Da=document.createElement("canvas");
+Da.width=Da.height=2;Ca=Da.getContext("2d");Ca.fillStyle="rgba(0,0,0,1)";Ca.fillRect(0,0,2,2);Ma=Ca.getImageData(0,0,2,2);ja=Ma.data;Ea=document.createElement("canvas");Ea.width=Ea.height=ka;Ha=Ea.getContext("2d");Ha.translate(-ka/2,-ka/2);Ha.scale(ka,ka);ka--;this.domElement=A;this.autoClear=true;this.setSize=function(u,O){I=u;N=O;p=I/2;s=N/2;A.width=I;A.height=N;k.lineJoin="round";k.lineCap="round";ya.set(-p,-s,p,s)};this.clear=function(){if(!ua.isEmpty()){ua.inflate(1);ua.minSelf(ya);k.setTransform(1,
+0,0,-1,p,s);k.clearRect(ua.getX(),ua.getY(),ua.getWidth(),ua.getHeight());ua.empty()}};this.render=function(u,O){var G,H,l,F,V,y,X,E;this.autoClear&&this.clear();r=w.projectScene(u,O);k.setTransform(1,0,0,-1,p,s);if(Fa=u.lights.length>0){V=u.lights;ga.setRGB(0,0,0);za.setRGB(0,0,0);Aa.setRGB(0,0,0);G=0;for(H=V.length;G<H;G++){l=V[G];F=l.color;if(l instanceof THREE.AmbientLight){ga.r+=F.r;ga.g+=F.g;ga.b+=F.b}else if(l instanceof THREE.DirectionalLight){za.r+=F.r;za.g+=F.g;za.b+=F.b}else if(l instanceof
+THREE.PointLight){Aa.r+=F.r;Aa.g+=F.g;Aa.b+=F.b}}}G=0;for(H=r.length;G<H;G++){l=r[G];$.empty();if(l instanceof THREE.RenderableParticle){L=l;L.x*=p;L.y*=s;F=0;for(V=l.material.length;F<V;F++)if(E=l.material[F]){y=L;X=l;E=E;if(E.opacity!=0){n(E.opacity);q(E.blending);var ba=void 0,la=void 0,sa=void 0,ta=void 0,Ba=void 0,Na=void 0,Ia=void 0,Oa=void 0,Pa=void 0;if(E instanceof THREE.ParticleBasicMaterial){Ia=E.bitmap;Oa=Ia.width/2;Pa=Ia.height/2;sa=X.scale.x*p;ta=X.scale.y*s;ba=sa*Oa;la=ta*Pa;Ba=E.offset.x*
+sa;Na=E.offset.y*ta;$.set(y.x+Ba-ba,y.y+Na-la,y.x+Ba+ba,y.y+Na+la);if(ya.instersects($)){k.save();k.translate(y.x,y.y);k.rotate(-X.rotation);k.scale(sa,-ta);k.translate(-Oa+E.offset.x,-Pa-E.offset.y);k.drawImage(Ia,0,0);k.restore()}}else if(E instanceof THREE.ParticleCircleMaterial){if(Fa){aa.r=ga.r+za.r+Aa.r;aa.g=ga.g+za.g+Aa.g;aa.b=ga.b+za.b+Aa.b;U.r=E.color.r*aa.r;U.g=E.color.g*aa.g;U.b=E.color.b*aa.b;U.updateStyleString()}else U.__styleString=E.color.__styleString;ba=X.scale.x*p;la=X.scale.y*
+s;$.set(y.x-ba,y.y-la,y.x+ba,y.y+la);if(ya.instersects($)){m(U.__styleString);k.save();k.translate(y.x,y.y);k.rotate(-X.rotation);k.scale(ba,la);k.beginPath();k.arc(0,0,1,0,Qa,true);k.closePath();k.fill();k.restore()}}}}}else if(l instanceof THREE.RenderableLine){L=l.v1;v=l.v2;L.positionScreen.x*=p;L.positionScreen.y*=s;v.positionScreen.x*=p;v.positionScreen.y*=s;$.addPoint(L.positionScreen.x,L.positionScreen.y);$.addPoint(v.positionScreen.x,v.positionScreen.y);if(!ya.instersects($))continue;F=0;
+for(V=l.material.length;F<V;)if(E=l.material[F++]){y=L;X=v;E=E;if(E.opacity!=0){n(E.opacity);q(E.blending);k.beginPath();k.moveTo(y.positionScreen.x,y.positionScreen.y);k.lineTo(X.positionScreen.x,X.positionScreen.y);k.closePath();if(E instanceof THREE.LineBasicMaterial){U.__styleString=E.color.__styleString;e(E.linewidth);g(U.__styleString);k.stroke();$.inflate(E.linewidth*2)}}}}else if(l instanceof THREE.RenderableFace3){L=l.v1;v=l.v2;C=l.v3;L.positionScreen.x*=p;L.positionScreen.y*=s;v.positionScreen.x*=
+p;v.positionScreen.y*=s;C.positionScreen.x*=p;C.positionScreen.y*=s;if(l.overdraw){i(L.positionScreen,v.positionScreen);i(v.positionScreen,C.positionScreen);i(C.positionScreen,L.positionScreen)}$.addPoint(L.positionScreen.x,L.positionScreen.y);$.addPoint(v.positionScreen.x,v.positionScreen.y);$.addPoint(C.positionScreen.x,C.positionScreen.y);if(!ya.instersects($))continue;F=0;for(V=l.meshMaterial.length;F<V;){E=l.meshMaterial[F++];if(E instanceof THREE.MeshFaceMaterial){y=0;for(X=l.faceMaterial.length;y<
+X;)(E=l.faceMaterial[y++])&&c(L,v,C,l,E,u)}else E&&c(L,v,C,l,E,u)}}else if(l instanceof THREE.RenderableFace4){L=l.v1;v=l.v2;C=l.v3;Q=l.v4;L.positionScreen.x*=p;L.positionScreen.y*=s;v.positionScreen.x*=p;v.positionScreen.y*=s;C.positionScreen.x*=p;C.positionScreen.y*=s;Q.positionScreen.x*=p;Q.positionScreen.y*=s;fa.positionScreen.copy(v.positionScreen);z.positionScreen.copy(Q.positionScreen);if(l.overdraw){i(L.positionScreen,v.positionScreen);i(v.positionScreen,Q.positionScreen);i(Q.positionScreen,
+L.positionScreen)}if(l.overdraw){i(C.positionScreen,fa.positionScreen);i(C.positionScreen,z.positionScreen)}$.addPoint(L.positionScreen.x,L.positionScreen.y);$.addPoint(v.positionScreen.x,v.positionScreen.y);$.addPoint(C.positionScreen.x,C.positionScreen.y);$.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(!ya.instersects($))continue;F=0;for(V=l.meshMaterial.length;F<V;){E=l.meshMaterial[F++];if(E instanceof THREE.MeshFaceMaterial){y=0;for(X=l.faceMaterial.length;y<X;)(E=l.faceMaterial[y++])&&
+f(L,v,C,Q,fa,z,l,E,u)}else E&&f(L,v,C,Q,fa,z,l,E,u)}}ua.addRectangle($)}k.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(z,M,J){var S,x,t,R;S=0;for(x=z.lights.length;S<x;S++){t=z.lights[S];if(t instanceof THREE.DirectionalLight){R=M.normalWorld.dot(t.position)*t.intensity;if(R>0){J.r+=t.color.r*R;J.g+=t.color.g*R;J.b+=t.color.b*R}}else if(t instanceof THREE.PointLight){D.sub(t.position,M.centroidWorld);D.normalize();R=M.normalWorld.dot(D)*t.intensity;if(R>0){J.r+=t.color.r*R;J.g+=t.color.g*R;J.b+=t.color.b*R}}}}function c(z,M,J,S,x,t){v=b(C++);v.setAttribute("d","M "+z.positionScreen.x+
+" "+z.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+J.positionScreen.x+","+J.positionScreen.y+"z");if(x instanceof THREE.MeshBasicMaterial)p.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshLambertMaterial)if(N){s.r=k.r;s.g=k.g;s.b=k.b;a(t,S,s);p.r=x.color.r*s.r;p.g=x.color.g*s.g;p.b=x.color.b*s.b;p.updateStyleString()}else p.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshDepthMaterial){W=1-x.__2near/(x.__farPlusNear-S.z*x.__farMinusNear);
+p.setRGB(W,W,W)}else x instanceof THREE.MeshNormalMaterial&&p.setRGB(d(S.normalWorld.x),d(S.normalWorld.y),d(S.normalWorld.z));x.wireframe?v.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+x.wireframe_linewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: round; stroke-linejoin: round"):v.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+x.opacity);q.appendChild(v)}function f(z,M,J,S,x,t,R){v=b(C++);v.setAttribute("d","M "+z.positionScreen.x+" "+
+z.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+J.positionScreen.x+","+J.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(t instanceof THREE.MeshBasicMaterial)p.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshLambertMaterial)if(N){s.r=k.r;s.g=k.g;s.b=k.b;a(R,x,s);p.r=t.color.r*s.r;p.g=t.color.g*s.g;p.b=t.color.b*s.b;p.updateStyleString()}else p.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshDepthMaterial){W=1-
+t.__2near/(t.__farPlusNear-x.z*t.__farMinusNear);p.setRGB(W,W,W)}else t instanceof THREE.MeshNormalMaterial&&p.setRGB(d(x.normalWorld.x),d(x.normalWorld.y),d(x.normalWorld.z));t.wireframe?v.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+t.wireframe_linewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: round; stroke-linejoin: round"):v.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+t.opacity);q.appendChild(v)}function b(z){if(B[z]==null){B[z]=
+document.createElementNS("http://www.w3.org/2000/svg","path");fa==0&&B[z].setAttribute("shape-rendering","crispEdges");return B[z]}return B[z]}function d(z){return z<0?Math.min((1+z)*0.5,0.5):0.5+Math.min(z*0.5,0.5)}var j=null,n=new THREE.Projector,q=document.createElementNS("http://www.w3.org/2000/svg","svg"),e,g,m,h,o,i,r,w,A=new THREE.Rectangle,I=new THREE.Rectangle,N=false,p=new THREE.Color(16777215),s=new THREE.Color(16777215),k=new THREE.Color(0),T=new THREE.Color(0),K=new THREE.Color(0),W,
+D=new THREE.Vector3,B=[],L=[],v,C,Q,fa=1;this.domElement=q;this.autoClear=true;this.setQuality=function(z){switch(z){case "high":fa=1;break;case "low":fa=0}};this.setSize=function(z,M){e=z;g=M;m=e/2;h=g/2;q.setAttribute("viewBox",-m+" "+-h+" "+e+" "+g);q.setAttribute("width",e);q.setAttribute("height",g);A.set(-m,-h,m,h)};this.clear=function(){for(;q.childNodes.length>0;)q.removeChild(q.childNodes[0])};this.render=function(z,M){var J,S,x,t,R,ha,P,Y;this.autoClear&&this.clear();j=n.projectScene(z,
+M);Q=C=0;if(N=z.lights.length>0){P=z.lights;k.setRGB(0,0,0);T.setRGB(0,0,0);K.setRGB(0,0,0);J=0;for(S=P.length;J<S;J++){x=P[J];t=x.color;if(x instanceof THREE.AmbientLight){k.r+=t.r;k.g+=t.g;k.b+=t.b}else if(x instanceof THREE.DirectionalLight){T.r+=t.r;T.g+=t.g;T.b+=t.b}else if(x instanceof THREE.PointLight){K.r+=t.r;K.g+=t.g;K.b+=t.b}}}J=0;for(S=j.length;J<S;J++){P=j[J];I.empty();if(P instanceof THREE.RenderableParticle){o=P;o.x*=m;o.y*=-h;x=0;for(t=P.material.length;x<t;x++)if(Y=P.material[x]){R=
+o;ha=P;Y=Y;var xa=Q++;if(L[xa]==null){L[xa]=document.createElementNS("http://www.w3.org/2000/svg","circle");fa==0&&L[xa].setAttribute("shape-rendering","crispEdges")}v=L[xa];v.setAttribute("cx",R.x);v.setAttribute("cy",R.y);v.setAttribute("r",ha.scale.x*m);if(Y instanceof THREE.ParticleCircleMaterial){if(N){s.r=k.r+T.r+K.r;s.g=k.g+T.g+K.g;s.b=k.b+T.b+K.b;p.r=Y.color.r*s.r;p.g=Y.color.g*s.g;p.b=Y.color.b*s.b;p.updateStyleString()}else p=Y.color;v.setAttribute("style","fill: "+p.__styleString)}q.appendChild(v)}}else if(P instanceof
+THREE.RenderableFace3){o=P.v1;i=P.v2;r=P.v3;o.positionScreen.x*=m;o.positionScreen.y*=-h;i.positionScreen.x*=m;i.positionScreen.y*=-h;r.positionScreen.x*=m;r.positionScreen.y*=-h;I.addPoint(o.positionScreen.x,o.positionScreen.y);I.addPoint(i.positionScreen.x,i.positionScreen.y);I.addPoint(r.positionScreen.x,r.positionScreen.y);if(A.instersects(I)){x=0;for(t=P.meshMaterial.length;x<t;){Y=P.meshMaterial[x++];if(Y instanceof THREE.MeshFaceMaterial){R=0;for(ha=P.faceMaterial.length;R<ha;)(Y=P.faceMaterial[R++])&&
+c(o,i,r,P,Y,z)}else Y&&c(o,i,r,P,Y,z)}}}else if(P instanceof THREE.RenderableFace4){o=P.v1;i=P.v2;r=P.v3;w=P.v4;o.positionScreen.x*=m;o.positionScreen.y*=-h;i.positionScreen.x*=m;i.positionScreen.y*=-h;r.positionScreen.x*=m;r.positionScreen.y*=-h;w.positionScreen.x*=m;w.positionScreen.y*=-h;I.addPoint(o.positionScreen.x,o.positionScreen.y);I.addPoint(i.positionScreen.x,i.positionScreen.y);I.addPoint(r.positionScreen.x,r.positionScreen.y);I.addPoint(w.positionScreen.x,w.positionScreen.y);if(A.instersects(I)){x=
+0;for(t=P.meshMaterial.length;x<t;){Y=P.meshMaterial[x++];if(Y instanceof THREE.MeshFaceMaterial){R=0;for(ha=P.faceMaterial.length;R<ha;)(Y=P.faceMaterial[R++])&&f(o,i,r,w,P,Y,z)}else Y&&f(o,i,r,w,P,Y,z)}}}}}};
+THREE.WebGLRenderer=function(a){function c(e,g){var m;if(e=="fragment")m=b.createShader(b.FRAGMENT_SHADER);else if(e=="vertex")m=b.createShader(b.VERTEX_SHADER);b.shaderSource(m,g);b.compileShader(m);if(!b.getShaderParameter(m,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(m));return null}return m}var f=document.createElement("canvas"),b,d,j=new THREE.Matrix4,n;a=function(e,g){if(e){var m,h,o,i=pointLights=maxDirLights=maxPointLights=0;m=0;for(h=e.lights.length;m<h;m++){o=e.lights[m];o instanceof THREE.DirectionalLight&&
+i++;o instanceof THREE.PointLight&&pointLights++}if(pointLights+i<=g){maxDirLights=i;maxPointLights=pointLights}else{maxDirLights=Math.ceil(g*i/(pointLights+i));maxPointLights=g-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:g-1}}(a,4);this.domElement=f;this.autoClear=true;try{b=f.getContext("experimental-webgl",{antialias:true})}catch(q){}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(e,g){d=b.createProgram();b.attachShader(d,c("fragment",["#ifdef GL_ES\nprecision highp float;\n#endif",e?"#define MAX_DIR_LIGHTS "+e:"",g?"#define MAX_POINT_LIGHTS "+g:"","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;",
 e?"uniform mat4 viewMatrix;":"",e?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",g?"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 );",
 g?"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",g?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",g?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",g?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",g?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",g?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",g?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",g?"float pointSpecularWeight = 0.0;":"",g?"if ( pointDotNormalHalf >= 0.0 )":
@@ -138,26 +138,25 @@ b.linkProgram(d);if(!b.getProgramParameter(d,b.LINK_STATUS)){alert("Could not in
 b.getUniformLocation(d,"pointLightPosition")}d.material=b.getUniformLocation(d,"material");d.mColor=b.getUniformLocation(d,"mColor");d.mOpacity=b.getUniformLocation(d,"mOpacity");d.mReflectivity=b.getUniformLocation(d,"mReflectivity");d.mAmbient=b.getUniformLocation(d,"mAmbient");d.mSpecular=b.getUniformLocation(d,"mSpecular");d.mShininess=b.getUniformLocation(d,"mShininess");d.enableMap=b.getUniformLocation(d,"enableMap");b.uniform1i(d.enableMap,0);d.tMap=b.getUniformLocation(d,"tMap");b.uniform1i(d.tMap,
 0);d.enableCubeMap=b.getUniformLocation(d,"enableCubeMap");b.uniform1i(d.enableCubeMap,0);d.tCube=b.getUniformLocation(d,"tCube");b.uniform1i(d.tCube,1);d.mixEnvMap=b.getUniformLocation(d,"mixEnvMap");b.uniform1i(d.mixEnvMap,0);d.mRefractionRatio=b.getUniformLocation(d,"mRefractionRatio");d.useRefract=b.getUniformLocation(d,"useRefract");b.uniform1i(d.useRefract,0);d.m2Near=b.getUniformLocation(d,"m2Near");d.mFarPlusNear=b.getUniformLocation(d,"mFarPlusNear");d.mFarMinusNear=b.getUniformLocation(d,
 "mFarMinusNear");d.position=b.getAttribLocation(d,"position");b.enableVertexAttribArray(d.position);d.normal=b.getAttribLocation(d,"normal");b.enableVertexAttribArray(d.normal);d.uv=b.getAttribLocation(d,"uv");b.enableVertexAttribArray(d.uv);d.viewMatrixArray=new Float32Array(16);d.modelViewMatrixArray=new Float32Array(16);d.projectionMatrixArray=new Float32Array(16)})(a.directional,a.point);this.setSize=function(e,g){f.width=e;f.height=g;b.viewport(0,0,f.width,f.height)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|
-b.DEPTH_BUFFER_BIT)};this.setupLights=function(e){var g,m,h,l,q=[],o=[],s=[];l=[];var A=[];b.uniform1i(d.enableLighting,e.lights.length);g=0;for(m=e.lights.length;g<m;g++){h=e.lights[g];if(h instanceof THREE.AmbientLight)q.push(h);else if(h instanceof THREE.DirectionalLight)s.push(h);else h instanceof THREE.PointLight&&o.push(h)}g=e=h=l=0;for(m=q.length;g<m;g++){e+=q[g].color.r;h+=q[g].color.g;l+=q[g].color.b}b.uniform3f(d.ambientLightColor,e,h,l);l=[];A=[];g=0;for(m=s.length;g<m;g++){h=s[g];l.push(h.color.r*
-h.intensity);l.push(h.color.g*h.intensity);l.push(h.color.b*h.intensity);A.push(h.position.x);A.push(h.position.y);A.push(h.position.z)}if(s.length){b.uniform1i(d.directionalLightNumber,s.length);b.uniform3fv(d.directionalLightDirection,A);b.uniform3fv(d.directionalLightColor,l)}l=[];A=[];g=0;for(m=o.length;g<m;g++){h=o[g];l.push(h.color.r*h.intensity);l.push(h.color.g*h.intensity);l.push(h.color.b*h.intensity);A.push(h.position.x);A.push(h.position.y);A.push(h.position.z)}if(o.length){b.uniform1i(d.pointLightNumber,
-o.length);b.uniform3fv(d.pointLightPosition,A);b.uniform3fv(d.pointLightColor,l)}};this.createBuffers=function(e,g){var m,h,l,q,o,s,A,J,N,p=e.materialFaceGroup[g],t=[],j=[],U=[],C=[],S=[],E=0,B=false;m=0;for(h=e.material.length;m<h;m++){meshMaterial=e.material[m];if(meshMaterial instanceof THREE.MeshFaceMaterial){o=0;for(s=p.material.length;o<s;o++)if(p.material[o]&&p.material[o].shading!=undefined&&p.material[o].shading==THREE.SmoothShading){B=true;break}}else if(meshMaterial&&meshMaterial.shading!=
-undefined&&meshMaterial.shading==THREE.SmoothShading){B=true;break}if(B)break}m=0;for(h=p.faces.length;m<h;m++){l=p.faces[m];q=e.geometry.faces[l];o=q.vertexNormals;s=q.normal;l=e.geometry.uvs[l];if(q instanceof THREE.Face3){A=e.geometry.vertices[q.a].position;J=e.geometry.vertices[q.b].position;N=e.geometry.vertices[q.c].position;U.push(A.x,A.y,A.z);U.push(J.x,J.y,J.z);U.push(N.x,N.y,N.z);if(o.length==3&&B){C.push(o[0].x,o[0].y,o[0].z);C.push(o[1].x,o[1].y,o[1].z);C.push(o[2].x,o[2].y,o[2].z)}else{C.push(s.x,
-s.y,s.z);C.push(s.x,s.y,s.z);C.push(s.x,s.y,s.z)}if(l){S.push(l[0].u,l[0].v);S.push(l[1].u,l[1].v);S.push(l[2].u,l[2].v)}t.push(E,E+1,E+2);j.push(E,E+1);j.push(E,E+2);j.push(E+1,E+2);E+=3}else if(q instanceof THREE.Face4){A=e.geometry.vertices[q.a].position;J=e.geometry.vertices[q.b].position;N=e.geometry.vertices[q.c].position;q=e.geometry.vertices[q.d].position;U.push(A.x,A.y,A.z);U.push(J.x,J.y,J.z);U.push(N.x,N.y,N.z);U.push(q.x,q.y,q.z);if(o.length==4&&B){C.push(o[0].x,o[0].y,o[0].z);C.push(o[1].x,
-o[1].y,o[1].z);C.push(o[2].x,o[2].y,o[2].z);C.push(o[3].x,o[3].y,o[3].z)}else{C.push(s.x,s.y,s.z);C.push(s.x,s.y,s.z);C.push(s.x,s.y,s.z);C.push(s.x,s.y,s.z)}if(l){S.push(l[0].u,l[0].v);S.push(l[1].u,l[1].v);S.push(l[2].u,l[2].v);S.push(l[3].u,l[3].v)}t.push(E,E+1,E+2);t.push(E,E+2,E+3);j.push(E,E+1);j.push(E,E+2);j.push(E,E+3);j.push(E+1,E+2);j.push(E+2,E+3);E+=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(C),b.STATIC_DRAW);p.__webGLUVBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(S),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(j),b.STATIC_DRAW);p.__webGLFaceCount=t.length;p.__webGLLineCount=j.length}};this.renderBuffer=function(e,g){var m,h,l,q,o,s,A,J,N,p;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshBasicMaterial){m=e.color;h=e.opacity;q=e.wireframe;o=e.wireframe_linewidth;A=e.map;J=e.env_map;s=e.combine==THREE.Mix;l=e.reflectivity;p=e.env_map&&e.env_map.mapping==
-THREE.RefractionMap;N=e.refraction_ratio;b.uniform4f(d.mColor,m.r*h,m.g*h,m.b*h,h);b.uniform1i(d.mixEnvMap,s);b.uniform1f(d.mReflectivity,l);b.uniform1i(d.useRefract,p);b.uniform1f(d.mRefractionRatio,N)}if(e instanceof THREE.MeshNormalMaterial){h=e.opacity;b.uniform1f(d.mOpacity,h);b.uniform1i(d.material,4)}else if(e instanceof THREE.MeshDepthMaterial){h=e.opacity;q=e.wireframe;o=e.wireframe_linewidth;b.uniform1f(d.mOpacity,h);b.uniform1f(d.m2Near,e.__2near);b.uniform1f(d.mFarPlusNear,e.__farPlusNear);
-b.uniform1f(d.mFarMinusNear,e.__farMinusNear);b.uniform1i(d.material,3)}else if(e instanceof THREE.MeshPhongMaterial){m=e.ambient;l=e.specular;s=e.shininess;b.uniform4f(d.mAmbient,m.r,m.g,m.b,h);b.uniform4f(d.mSpecular,l.r,l.g,l.b,h);b.uniform1f(d.mShininess,s);b.uniform1i(d.material,2)}else if(e instanceof THREE.MeshLambertMaterial)b.uniform1i(d.material,1);else if(e instanceof THREE.MeshBasicMaterial)b.uniform1i(d.material,0);else if(e instanceof THREE.MeshCubeMaterial){b.uniform1i(d.material,5);
-J=e.env_map}if(A){if(!e.__webGLTexture&&e.map.image.loaded){e.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,e.__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,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);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.__webGLTexture);b.uniform1i(d.tMap,0);b.uniform1i(d.enableMap,1)}else b.uniform1i(d.enableMap,0);if(J){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);b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[0]);b.texImage2D(b.TEXTURE_CUBE_MAP_NEGATIVE_X,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[1]);b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_Y,
-0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[2]);b.texImage2D(b.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[3]);b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_Z,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[4]);b.texImage2D(b.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[5]);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(d.tCube,1)}b.uniform1i(d.enableCubeMap,1)}else b.uniform1i(d.enableCubeMap,0);b.bindBuffer(b.ARRAY_BUFFER,g.__webGLVertexBuffer);b.vertexAttribPointer(d.position,3,b.FLOAT,false,0,0);b.bindBuffer(b.ARRAY_BUFFER,g.__webGLNormalBuffer);b.vertexAttribPointer(d.normal,3,b.FLOAT,false,0,0);if(A){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.enableVertexAttribArray(d.uv);b.vertexAttribPointer(d.uv,2,b.FLOAT,false,0,0)}else b.disableVertexAttribArray(d.uv);
-if(q){b.lineWidth(o);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.drawElements(b.LINES,g.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,g.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(e,g,m){var h,l,q,o,s;q=0;for(o=e.material.length;q<o;q++){h=e.material[q];if(h instanceof THREE.MeshFaceMaterial){h=0;for(l=g.material.length;h<l;h++)if((s=g.material[h])&&s.blending==m){this.setBlending(s.blending);
-this.renderBuffer(s,g)}}else if((s=h)&&s.blending==m){this.setBlending(s.blending);this.renderBuffer(s,g)}}};this.render=function(e,g){var m,h;this.initWebGLObjects(e);this.autoClear&&this.clear();g.autoUpdateMatrix&&g.updateMatrix();b.uniform3f(d.cameraPosition,g.position.x,g.position.y,g.position.z);this.setupLights(e);m=0;for(h=e.__webGLObjects.length;m<h;m++){webGLObject=e.__webGLObjects[m];this.setupMatrices(webGLObject.__object,g);this.renderPass(webGLObject.__object,webGLObject,THREE.NormalBlending)}m=
-0;for(h=e.__webGLObjects.length;m<h;m++){webGLObject=e.__webGLObjects[m];this.setupMatrices(webGLObject.__object,g);this.renderPass(webGLObject.__object,webGLObject,THREE.AdditiveBlending);this.renderPass(webGLObject.__object,webGLObject,THREE.SubtractiveBlending)}};this.initWebGLObjects=function(e){var g,m,h,l,q;if(!e.__webGLObjects)e.__webGLObjects=[];g=0;for(m=e.objects.length;g<m;g++){h=e.objects[g];if(h instanceof THREE.Mesh)for(l in h.materialFaceGroup){q=h.materialFaceGroup[l];if(!q.__webGLVertexBuffer){this.createBuffers(h,
-l);q.__object=h;e.__webGLObjects.push(q)}}}};this.setupMatrices=function(e,g){e.autoUpdateMatrix&&e.updateMatrix();i.multiply(g.matrix,e.matrix);d.viewMatrixArray=new Float32Array(g.matrix.flatten());d.modelViewMatrixArray=new Float32Array(i.flatten());d.projectionMatrixArray=new Float32Array(g.projectionMatrix.flatten());n=THREE.Matrix4.makeInvert3x3(i).transpose();d.normalMatrixArray=new Float32Array(n.m);b.uniformMatrix4fv(d.viewMatrix,false,d.viewMatrixArray);b.uniformMatrix4fv(d.modelViewMatrix,
-false,d.modelViewMatrixArray);b.uniformMatrix4fv(d.projectionMatrix,false,d.projectionMatrixArray);b.uniformMatrix3fv(d.normalMatrix,false,d.normalMatrixArray);b.uniformMatrix4fv(d.objMatrix,false,new Float32Array(e.matrix.flatten()))};this.setBlending=function(e){switch(e){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(e,g){if(e){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="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.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.material=this.color=this.z=null};
+b.DEPTH_BUFFER_BIT)};this.setupLights=function(e){var g,m,h,o,i=[],r=[],w=[];o=[];var A=[];b.uniform1i(d.enableLighting,e.lights.length);g=0;for(m=e.lights.length;g<m;g++){h=e.lights[g];if(h instanceof THREE.AmbientLight)i.push(h);else if(h instanceof THREE.DirectionalLight)w.push(h);else h instanceof THREE.PointLight&&r.push(h)}g=e=h=o=0;for(m=i.length;g<m;g++){e+=i[g].color.r;h+=i[g].color.g;o+=i[g].color.b}b.uniform3f(d.ambientLightColor,e,h,o);o=[];A=[];g=0;for(m=w.length;g<m;g++){h=w[g];o.push(h.color.r*
+h.intensity);o.push(h.color.g*h.intensity);o.push(h.color.b*h.intensity);A.push(h.position.x);A.push(h.position.y);A.push(h.position.z)}if(w.length){b.uniform1i(d.directionalLightNumber,w.length);b.uniform3fv(d.directionalLightDirection,A);b.uniform3fv(d.directionalLightColor,o)}o=[];A=[];g=0;for(m=r.length;g<m;g++){h=r[g];o.push(h.color.r*h.intensity);o.push(h.color.g*h.intensity);o.push(h.color.b*h.intensity);A.push(h.position.x);A.push(h.position.y);A.push(h.position.z)}if(r.length){b.uniform1i(d.pointLightNumber,
+r.length);b.uniform3fv(d.pointLightPosition,A);b.uniform3fv(d.pointLightColor,o)}};this.createBuffers=function(e,g){var m,h,o,i,r,w,A,I,N,p=e.materialFaceGroup[g],s=[],k=[],T=[],K=[],W=[],D=0,B=false;m=0;for(h=e.material.length;m<h;m++){meshMaterial=e.material[m];if(meshMaterial instanceof THREE.MeshFaceMaterial){i=0;for(r=p.material.length;i<r;i++)if(p.material[i]&&p.material[i].shading!=undefined&&p.material[i].shading==THREE.SmoothShading){B=true;break}}else if(meshMaterial&&meshMaterial.shading!=
+undefined&&meshMaterial.shading==THREE.SmoothShading){B=true;break}if(B)break}m=0;for(h=p.faces.length;m<h;m++){o=p.faces[m];i=e.geometry.faces[o];r=i.vertexNormals;w=i.normal;o=e.geometry.uvs[o];if(i instanceof THREE.Face3){A=e.geometry.vertices[i.a].position;I=e.geometry.vertices[i.b].position;N=e.geometry.vertices[i.c].position;T.push(A.x,A.y,A.z);T.push(I.x,I.y,I.z);T.push(N.x,N.y,N.z);if(r.length==3&&B)for(i=0;i<3;i++)K.push(r[i].x,r[i].y,r[i].z);else for(i=0;i<3;i++)K.push(w.x,w.y,w.z);if(o)for(i=
+0;i<3;i++)W.push(o[i].u,o[i].v);s.push(D,D+1,D+2);k.push(D,D+1);k.push(D,D+2);k.push(D+1,D+2);D+=3}else if(i instanceof THREE.Face4){A=e.geometry.vertices[i.a].position;I=e.geometry.vertices[i.b].position;N=e.geometry.vertices[i.c].position;i=e.geometry.vertices[i.d].position;T.push(A.x,A.y,A.z);T.push(I.x,I.y,I.z);T.push(N.x,N.y,N.z);T.push(i.x,i.y,i.z);if(r.length==4&&B)for(i=0;i<4;i++)K.push(r[i].x,r[i].y,r[i].z);else for(i=0;i<4;i++)K.push(w.x,w.y,w.z);if(o)for(i=0;i<4;i++)W.push(o[i].u,o[i].v);
+s.push(D,D+1,D+2);s.push(D,D+2,D+3);k.push(D,D+1);k.push(D,D+2);k.push(D,D+3);k.push(D+1,D+2);k.push(D+2,D+3);D+=4}}if(T.length){p.__webGLVertexBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(T),b.STATIC_DRAW);p.__webGLNormalBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(K),b.STATIC_DRAW);p.__webGLUVBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLUVBuffer);
+b.bufferData(b.ARRAY_BUFFER,new Float32Array(W),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(k),b.STATIC_DRAW);p.__webGLFaceCount=s.length;p.__webGLLineCount=k.length}};this.renderBuffer=function(e,g){var m,h,o,i,r,w,A,I,
+N,p;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshBasicMaterial){m=e.color;h=e.opacity;i=e.wireframe;r=e.wireframe_linewidth;A=e.map;I=e.env_map;w=e.combine==THREE.Mix;o=e.reflectivity;p=e.env_map&&e.env_map.mapping==THREE.RefractionMap;N=e.refraction_ratio;b.uniform4f(d.mColor,m.r*h,m.g*h,m.b*h,h);b.uniform1i(d.mixEnvMap,w);b.uniform1f(d.mReflectivity,o);b.uniform1i(d.useRefract,p);b.uniform1f(d.mRefractionRatio,N)}if(e instanceof THREE.MeshNormalMaterial){h=
+e.opacity;b.uniform1f(d.mOpacity,h);b.uniform1i(d.material,4)}else if(e instanceof THREE.MeshDepthMaterial){h=e.opacity;i=e.wireframe;r=e.wireframe_linewidth;b.uniform1f(d.mOpacity,h);b.uniform1f(d.m2Near,e.__2near);b.uniform1f(d.mFarPlusNear,e.__farPlusNear);b.uniform1f(d.mFarMinusNear,e.__farMinusNear);b.uniform1i(d.material,3)}else if(e instanceof THREE.MeshPhongMaterial){m=e.ambient;o=e.specular;w=e.shininess;b.uniform4f(d.mAmbient,m.r,m.g,m.b,h);b.uniform4f(d.mSpecular,o.r,o.g,o.b,h);b.uniform1f(d.mShininess,
+w);b.uniform1i(d.material,2)}else if(e instanceof THREE.MeshLambertMaterial)b.uniform1i(d.material,1);else if(e instanceof THREE.MeshBasicMaterial)b.uniform1i(d.material,0);else if(e instanceof THREE.MeshCubeMaterial){b.uniform1i(d.material,5);I=e.env_map}if(A){if(!e.__webGLTexture&&e.map.image.loaded){e.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,e.__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,
+b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);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.__webGLTexture);b.uniform1i(d.tMap,0);b.uniform1i(d.enableMap,1)}else b.uniform1i(d.enableMap,0);if(I){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(h=0;h<6;++h)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[h]);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(d.tCube,1)}b.uniform1i(d.enableCubeMap,1)}else b.uniform1i(d.enableCubeMap,0);b.bindBuffer(b.ARRAY_BUFFER,g.__webGLVertexBuffer);b.vertexAttribPointer(d.position,
+3,b.FLOAT,false,0,0);b.bindBuffer(b.ARRAY_BUFFER,g.__webGLNormalBuffer);b.vertexAttribPointer(d.normal,3,b.FLOAT,false,0,0);if(A){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.enableVertexAttribArray(d.uv);b.vertexAttribPointer(d.uv,2,b.FLOAT,false,0,0)}else b.disableVertexAttribArray(d.uv);if(i){b.lineWidth(r);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.drawElements(b.LINES,g.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,
+g.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(e,g,m){var h,o,i,r,w;i=0;for(r=e.material.length;i<r;i++){h=e.material[i];if(h instanceof THREE.MeshFaceMaterial){h=0;for(o=g.material.length;h<o;h++)if((w=g.material[h])&&w.blending==m){this.setBlending(w.blending);this.renderBuffer(w,g)}}else if((w=h)&&w.blending==m){this.setBlending(w.blending);this.renderBuffer(w,g)}}};this.render=function(e,g){var m,h;this.initWebGLObjects(e);this.autoClear&&this.clear();g.autoUpdateMatrix&&g.updateMatrix();
+b.uniform3f(d.cameraPosition,g.position.x,g.position.y,g.position.z);this.setupLights(e);m=0;for(h=e.__webGLObjects.length;m<h;m++){webGLObject=e.__webGLObjects[m];this.setupMatrices(webGLObject.__object,g);this.renderPass(webGLObject.__object,webGLObject,THREE.NormalBlending)}m=0;for(h=e.__webGLObjects.length;m<h;m++){webGLObject=e.__webGLObjects[m];this.setupMatrices(webGLObject.__object,g);this.renderPass(webGLObject.__object,webGLObject,THREE.AdditiveBlending);this.renderPass(webGLObject.__object,
+webGLObject,THREE.SubtractiveBlending)}};this.initWebGLObjects=function(e){var g,m,h,o,i;if(!e.__webGLObjects)e.__webGLObjects=[];g=0;for(m=e.objects.length;g<m;g++){h=e.objects[g];if(h instanceof THREE.Mesh)for(o in h.materialFaceGroup){i=h.materialFaceGroup[o];if(!i.__webGLVertexBuffer){this.createBuffers(h,o);i.__object=h;e.__webGLObjects.push(i)}}}};this.setupMatrices=function(e,g){e.autoUpdateMatrix&&e.updateMatrix();j.multiply(g.matrix,e.matrix);d.viewMatrixArray=new Float32Array(g.matrix.flatten());
+d.modelViewMatrixArray=new Float32Array(j.flatten());d.projectionMatrixArray=new Float32Array(g.projectionMatrix.flatten());n=THREE.Matrix4.makeInvert3x3(j).transpose();d.normalMatrixArray=new Float32Array(n.m);b.uniformMatrix4fv(d.viewMatrix,false,d.viewMatrixArray);b.uniformMatrix4fv(d.modelViewMatrix,false,d.modelViewMatrixArray);b.uniformMatrix4fv(d.projectionMatrix,false,d.projectionMatrixArray);b.uniformMatrix3fv(d.normalMatrix,false,d.normalMatrixArray);b.uniformMatrix4fv(d.objMatrix,false,
+new Float32Array(e.matrix.flatten()))};this.setBlending=function(e){switch(e){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(e,g){if(e){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="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.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.material=this.color=this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.v4=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.material=this.color=this.z=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=this.color=null};
 THREE.RenderableLine=function(){this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.material=this.color=this.z=null};

+ 83 - 84
build/ThreeDebug.js

@@ -11,40 +11,40 @@ distanceToSquared:function(a){var c=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return
 THREE.Vector4.prototype={set:function(a,c,f,b){this.x=a;this.y=c;this.z=f;this.w=b;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,f,b=a.objects,d=[];a=0;for(c=b.length;a<c;a++){f=b[a];if(f instanceof THREE.Mesh)d=d.concat(this.intersectObject(f))}d.sort(function(j,n){return j.distance-n.distance});return d},intersectObject:function(a){function c(A,J,N,p){p=p.clone().subSelf(J);N=N.clone().subSelf(J);var t=A.clone().subSelf(J);A=p.dot(p);J=p.dot(N);p=p.dot(t);var i=N.dot(N);N=N.dot(t);t=1/(A*i-J*J);i=(i*p-J*N)*t;A=(A*N-J*p)*t;return i>0&&A>0&&i+A<1}var f,b,d,j,n,r,e,g,m,h,
-l,q=a.geometry,o=q.vertices,s=[];f=0;for(b=q.faces.length;f<b;f++){d=q.faces[f];h=this.origin.clone();l=this.direction.clone();j=a.matrix.transform(o[d.a].position.clone());n=a.matrix.transform(o[d.b].position.clone());r=a.matrix.transform(o[d.c].position.clone());e=d instanceof THREE.Face4?a.matrix.transform(o[d.d].position.clone()):null;g=a.matrixRotation.transform(d.normal.clone());m=l.dot(g);if(m<0){g=g.dot((new THREE.Vector3).sub(j,h))/m;h=h.addSelf(l.multiplyScalar(g));if(d instanceof THREE.Face3){if(c(h,
-j,n,r)){d={distance:this.origin.distanceTo(h),point:h,face:d,object:a};s.push(d)}}else if(d instanceof THREE.Face4)if(c(h,j,n,e)||c(h,n,r,e)){d={distance:this.origin.distanceTo(h),point:h,face:d,object:a};s.push(d)}}}return s}};
-THREE.Rectangle=function(){function a(){j=b-c;n=d-f}var c,f,b,d,j,n,r=true;this.getX=function(){return c};this.getY=function(){return f};this.getWidth=function(){return j};this.getHeight=function(){return n};this.getLeft=function(){return c};this.getTop=function(){return f};this.getRight=function(){return b};this.getBottom=function(){return d};this.set=function(e,g,m,h){r=false;c=e;f=g;b=m;d=h;a()};this.addPoint=function(e,g){if(r){r=false;c=e;f=g;b=e;d=g}else{c=Math.min(c,e);f=Math.min(f,g);b=Math.max(b,
-e);d=Math.max(d,g)}a()};this.addRectangle=function(e){if(r){r=false;c=e.getLeft();f=e.getTop();b=e.getRight();d=e.getBottom()}else{c=Math.min(c,e.getLeft());f=Math.min(f,e.getTop());b=Math.max(b,e.getRight());d=Math.max(d,e.getBottom())}a()};this.inflate=function(e){c-=e;f-=e;b+=e;d+=e;a()};this.minSelf=function(e){c=Math.max(c,e.getLeft());f=Math.max(f,e.getTop());b=Math.min(b,e.getRight());d=Math.min(d,e.getBottom());a()};this.instersects=function(e){return Math.min(b,e.getRight())-Math.max(c,e.getLeft())>=
-0&&Math.min(d,e.getBottom())-Math.max(f,e.getTop())>=0};this.empty=function(){r=true;d=b=f=c=0;a()};this.isEmpty=function(){return r};this.toString=function(){return"THREE.Rectangle ( left: "+c+", right: "+b+", top: "+f+", bottom: "+d+", width: "+j+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
+THREE.Ray.prototype={intersectScene:function(a){var c,f,b=a.objects,d=[];a=0;for(c=b.length;a<c;a++){f=b[a];if(f instanceof THREE.Mesh)d=d.concat(this.intersectObject(f))}d.sort(function(k,n){return k.distance-n.distance});return d},intersectObject:function(a){function c(A,I,N,p){p=p.clone().subSelf(I);N=N.clone().subSelf(I);var s=A.clone().subSelf(I);A=p.dot(p);I=p.dot(N);p=p.dot(s);var i=N.dot(N);N=N.dot(s);s=1/(A*i-I*I);i=(i*p-I*N)*s;A=(A*N-I*p)*s;return i>0&&A>0&&i+A<1}var f,b,d,k,n,q,e,g,m,h,
+o,j=a.geometry,r=j.vertices,x=[];f=0;for(b=j.faces.length;f<b;f++){d=j.faces[f];h=this.origin.clone();o=this.direction.clone();k=a.matrix.transform(r[d.a].position.clone());n=a.matrix.transform(r[d.b].position.clone());q=a.matrix.transform(r[d.c].position.clone());e=d instanceof THREE.Face4?a.matrix.transform(r[d.d].position.clone()):null;g=a.matrixRotation.transform(d.normal.clone());m=o.dot(g);if(m<0){g=g.dot((new THREE.Vector3).sub(k,h))/m;h=h.addSelf(o.multiplyScalar(g));if(d instanceof THREE.Face3){if(c(h,
+k,n,q)){d={distance:this.origin.distanceTo(h),point:h,face:d,object:a};x.push(d)}}else if(d instanceof THREE.Face4)if(c(h,k,n,e)||c(h,n,q,e)){d={distance:this.origin.distanceTo(h),point:h,face:d,object:a};x.push(d)}}}return x}};
+THREE.Rectangle=function(){function a(){k=b-c;n=d-f}var c,f,b,d,k,n,q=true;this.getX=function(){return c};this.getY=function(){return f};this.getWidth=function(){return k};this.getHeight=function(){return n};this.getLeft=function(){return c};this.getTop=function(){return f};this.getRight=function(){return b};this.getBottom=function(){return d};this.set=function(e,g,m,h){q=false;c=e;f=g;b=m;d=h;a()};this.addPoint=function(e,g){if(q){q=false;c=e;f=g;b=e;d=g}else{c=Math.min(c,e);f=Math.min(f,g);b=Math.max(b,
+e);d=Math.max(d,g)}a()};this.addRectangle=function(e){if(q){q=false;c=e.getLeft();f=e.getTop();b=e.getRight();d=e.getBottom()}else{c=Math.min(c,e.getLeft());f=Math.min(f,e.getTop());b=Math.max(b,e.getRight());d=Math.max(d,e.getBottom())}a()};this.inflate=function(e){c-=e;f-=e;b+=e;d+=e;a()};this.minSelf=function(e){c=Math.max(c,e.getLeft());f=Math.max(f,e.getTop());b=Math.min(b,e.getRight());d=Math.min(d,e.getBottom());a()};this.instersects=function(e){return Math.min(b,e.getRight())-Math.max(c,e.getLeft())>=
+0&&Math.min(d,e.getBottom())-Math.max(f,e.getTop())>=0};this.empty=function(){q=true;d=b=f=c=0;a()};this.isEmpty=function(){return q};this.toString=function(){return"THREE.Rectangle ( left: "+c+", right: "+b+", top: "+f+", bottom: "+d+", width: "+k+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
 THREE.Matrix4=function(){this._x=new THREE.Vector3;this._y=new THREE.Vector3;this._z=new THREE.Vector3};
 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,f){var b=this._x,d=this._y,j=this._z;j.sub(a,c);j.normalize();b.cross(f,j);b.normalize();d.cross(j,b);d.normalize();this.n11=b.x;this.n12=b.y;this.n13=b.z;this.n14=-b.dot(a);this.n21=d.x;this.n22=d.y;this.n23=d.z;this.n24=-d.dot(a);this.n31=j.x;this.n32=j.y;this.n33=j.z;this.n34=-j.dot(a);this.n43=this.n42=this.n41=0;this.n44=1},transform:function(a){var c=a.x,f=a.y,b=a.z,d=a.w?a.w:1;a.x=this.n11*c+this.n12*f+this.n13*b+this.n14*
+a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44},lookAt:function(a,c,f){var b=this._x,d=this._y,k=this._z;k.sub(a,c);k.normalize();b.cross(f,k);b.normalize();d.cross(k,b);d.normalize();this.n11=b.x;this.n12=b.y;this.n13=b.z;this.n14=-b.dot(a);this.n21=d.x;this.n22=d.y;this.n23=d.z;this.n24=-d.dot(a);this.n31=k.x;this.n32=k.y;this.n33=k.z;this.n34=-k.dot(a);this.n43=this.n42=this.n41=0;this.n44=1},transform:function(a){var c=a.x,f=a.y,b=a.z,d=a.w?a.w:1;a.x=this.n11*c+this.n12*f+this.n13*b+this.n14*
 d;a.y=this.n21*c+this.n22*f+this.n23*b+this.n24*d;a.z=this.n31*c+this.n32*f+this.n33*b+this.n34*d;d=this.n41*c+this.n42*f+this.n43*b+this.n44*d;if(a.w)a.w=d;else{a.x/=d;a.y/=d;a.z/=d}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,f=this.n12,b=this.n13,d=this.n14,j=this.n21,n=this.n22,
-r=this.n23,e=this.n24,g=this.n31,m=this.n32,h=this.n33,l=this.n34,q=this.n41,o=this.n42,s=this.n43,A=this.n44;this.n11=c*a.n11+f*a.n21+b*a.n31+d*a.n41;this.n12=c*a.n12+f*a.n22+b*a.n32+d*a.n42;this.n13=c*a.n13+f*a.n23+b*a.n33+d*a.n43;this.n14=c*a.n14+f*a.n24+b*a.n34+d*a.n44;this.n21=j*a.n11+n*a.n21+r*a.n31+e*a.n41;this.n22=j*a.n12+n*a.n22+r*a.n32+e*a.n42;this.n23=j*a.n13+n*a.n23+r*a.n33+e*a.n43;this.n24=j*a.n14+n*a.n24+r*a.n34+e*a.n44;this.n31=g*a.n11+m*a.n21+h*a.n31+l*a.n41;this.n32=g*a.n12+m*a.n22+
-h*a.n32+l*a.n42;this.n33=g*a.n13+m*a.n23+h*a.n33+l*a.n43;this.n34=g*a.n14+m*a.n24+h*a.n34+l*a.n44;this.n41=q*a.n11+o*a.n21+s*a.n31+A*a.n41;this.n42=q*a.n12+o*a.n22+s*a.n32+A*a.n42;this.n43=q*a.n13+o*a.n23+s*a.n33+A*a.n43;this.n44=q*a.n14+o*a.n24+s*a.n34+A*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*
+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,f=this.n12,b=this.n13,d=this.n14,k=this.n21,n=this.n22,
+q=this.n23,e=this.n24,g=this.n31,m=this.n32,h=this.n33,o=this.n34,j=this.n41,r=this.n42,x=this.n43,A=this.n44;this.n11=c*a.n11+f*a.n21+b*a.n31+d*a.n41;this.n12=c*a.n12+f*a.n22+b*a.n32+d*a.n42;this.n13=c*a.n13+f*a.n23+b*a.n33+d*a.n43;this.n14=c*a.n14+f*a.n24+b*a.n34+d*a.n44;this.n21=k*a.n11+n*a.n21+q*a.n31+e*a.n41;this.n22=k*a.n12+n*a.n22+q*a.n32+e*a.n42;this.n23=k*a.n13+n*a.n23+q*a.n33+e*a.n43;this.n24=k*a.n14+n*a.n24+q*a.n34+e*a.n44;this.n31=g*a.n11+m*a.n21+h*a.n31+o*a.n41;this.n32=g*a.n12+m*a.n22+
+h*a.n32+o*a.n42;this.n33=g*a.n13+m*a.n23+h*a.n33+o*a.n43;this.n34=g*a.n14+m*a.n24+h*a.n34+o*a.n44;this.n41=j*a.n11+r*a.n21+x*a.n31+A*a.n41;this.n42=j*a.n12+r*a.n22+x*a.n32+A*a.n42;this.n43=j*a.n13+r*a.n23+x*a.n33+A*a.n43;this.n44=j*a.n14+r*a.n24+x*a.n34+A*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,f,b){var d=c[f];c[f]=c[b];c[b]=d}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,f){var b=new THREE.Matrix4;b.n14=a;b.n24=c;b.n34=f;return b};THREE.Matrix4.scaleMatrix=function(a,c,f){var b=new THREE.Matrix4;b.n11=a;b.n22=c;b.n33=f;return b};
 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 f=new THREE.Matrix4,b=Math.cos(c),d=Math.sin(c),j=1-b,n=a.x,r=a.y,e=a.z;f.n11=j*n*n+b;f.n12=j*n*r-d*e;f.n13=j*n*e+d*r;f.n21=j*n*r+d*e;f.n22=j*r*r+b;f.n23=j*r*e-d*n;f.n31=j*n*e-d*r;f.n32=j*r*e+d*n;f.n33=j*e*e+b;return f};
+THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var f=new THREE.Matrix4,b=Math.cos(c),d=Math.sin(c),k=1-b,n=a.x,q=a.y,e=a.z;f.n11=k*n*n+b;f.n12=k*n*q-d*e;f.n13=k*n*e+d*q;f.n21=k*n*q+d*e;f.n22=k*q*q+b;f.n23=k*q*e-d*n;f.n31=k*n*e-d*q;f.n32=k*q*e+d*n;f.n33=k*e*e+b;return f};
 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 f=c[10]*c[5]-c[6]*c[9],b=-c[10]*c[1]+c[2]*c[9],d=c[6]*c[1]-c[2]*c[5],j=-c[10]*c[4]+c[6]*c[8],n=c[10]*c[0]-c[2]*c[8],r=-c[6]*c[0]+c[2]*c[4],e=c[9]*c[4]-c[5]*c[8],g=-c[9]*c[0]+c[1]*c[8],m=c[5]*c[0]-c[1]*c[4];c=c[0]*f+c[1]*j+c[2]*e;if(c==0)throw"matrix not invertible";c=1/c;a.m[0]=c*f;a.m[1]=c*b;a.m[2]=c*d;a.m[3]=c*j;a.m[4]=c*n;a.m[5]=c*r;a.m[6]=c*e;a.m[7]=c*g;a.m[8]=c*m;return a};
-THREE.Matrix4.makeFrustum=function(a,c,f,b,d,j){var n,r,e;n=new THREE.Matrix4;r=2*d/(c-a);e=2*d/(b-f);a=(c+a)/(c-a);f=(b+f)/(b-f);b=-(j+d)/(j-d);d=-2*j*d/(j-d);n.n11=r;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=e;n.n23=f;n.n24=0;n.n31=0;n.n32=0;n.n33=b;n.n34=d;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,c,f,b){var d;a=f*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*c,a*c,d,a,f,b)};
-THREE.Matrix4.makeOrtho=function(a,c,f,b,d,j){var n,r,e,g;n=new THREE.Matrix4;r=c-a;e=f-b;g=j-d;a=(c+a)/r;f=(f+b)/e;d=(j+d)/g;n.n11=2/r;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/e;n.n23=0;n.n24=-f;n.n31=0;n.n32=0;n.n33=-2/g;n.n34=-d;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=new THREE.Matrix3;var f=c[10]*c[5]-c[6]*c[9],b=-c[10]*c[1]+c[2]*c[9],d=c[6]*c[1]-c[2]*c[5],k=-c[10]*c[4]+c[6]*c[8],n=c[10]*c[0]-c[2]*c[8],q=-c[6]*c[0]+c[2]*c[4],e=c[9]*c[4]-c[5]*c[8],g=-c[9]*c[0]+c[1]*c[8],m=c[5]*c[0]-c[1]*c[4];c=c[0]*f+c[1]*k+c[2]*e;if(c==0)throw"matrix not invertible";c=1/c;a.m[0]=c*f;a.m[1]=c*b;a.m[2]=c*d;a.m[3]=c*k;a.m[4]=c*n;a.m[5]=c*q;a.m[6]=c*e;a.m[7]=c*g;a.m[8]=c*m;return a};
+THREE.Matrix4.makeFrustum=function(a,c,f,b,d,k){var n,q,e;n=new THREE.Matrix4;q=2*d/(c-a);e=2*d/(b-f);a=(c+a)/(c-a);f=(b+f)/(b-f);b=-(k+d)/(k-d);d=-2*k*d/(k-d);n.n11=q;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=e;n.n23=f;n.n24=0;n.n31=0;n.n32=0;n.n33=b;n.n34=d;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,c,f,b){var d;a=f*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*c,a*c,d,a,f,b)};
+THREE.Matrix4.makeOrtho=function(a,c,f,b,d,k){var n,q,e,g;n=new THREE.Matrix4;q=c-a;e=f-b;g=k-d;a=(c+a)/q;f=(f+b)/e;d=(k+d)/g;n.n11=2/q;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/e;n.n23=0;n.n24=-f;n.n31=0;n.n32=0;n.n33=-2/g;n.n34=-d;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};
 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,f,b,d){this.a=a;this.b=c;this.c=f;this.centroid=new THREE.Vector3;this.normal=b instanceof THREE.Vector3?b:new THREE.Vector3;this.vertexNormals=b instanceof Array?b:[];this.material=d instanceof Array?d:[d]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,c,f,b,d,j){this.a=a;this.b=c;this.c=f;this.d=b;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.material=j instanceof Array?j:[j]};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.Face4=function(a,c,f,b,d,k){this.a=a;this.b=c;this.c=f;this.d=b;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.material=k instanceof Array?k:[k]};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,f;a=0;for(c=this.faces.length;a<c;a++){f=this.faces[a];f.centroid.set(0,0,0);if(f instanceof THREE.Face3){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);f.centroid.divideScalar(3)}else if(f instanceof THREE.Face4){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);
-f.centroid.addSelf(this.vertices[f.d].position);f.centroid.divideScalar(4)}}},computeNormals:function(a){var c,f,b,d,j,n,r=new THREE.Vector3,e=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){j=this.vertices[b];j.normal.set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){j=this.faces[b];if(a&&j.vertexNormals.length){r.set(0,0,0);c=0;for(f=j.normal.length;c<f;c++)r.addSelf(j.vertexNormals[c]);r.divideScalar(3)}else{c=this.vertices[j.a];f=this.vertices[j.b];n=this.vertices[j.c];r.sub(n.position,
-f.position);e.sub(c.position,f.position);r.crossSelf(e)}r.isZero()||r.normalize();j.normal.copy(r)}},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>
+f.centroid.addSelf(this.vertices[f.d].position);f.centroid.divideScalar(4)}}},computeNormals:function(a){var c,f,b,d,k,n,q=new THREE.Vector3,e=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){k=this.vertices[b];k.normal.set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){k=this.faces[b];if(a&&k.vertexNormals.length){q.set(0,0,0);c=0;for(f=k.normal.length;c<f;c++)q.addSelf(k.vertexNormals[c]);q.divideScalar(3)}else{c=this.vertices[k.a];f=this.vertices[k.b];n=this.vertices[k.c];q.sub(n.position,
+f.position);e.sub(c.position,f.position);q.crossSelf(e)}q.isZero()||q.normalize();k.normal.copy(q)}},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,f,b){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,f,b);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(-16777216|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;
@@ -53,8 +53,8 @@ THREE.Object3D=function(){this.position=new THREE.Vector3;this.rotation=new THRE
 this.matrixRotation.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.matrixRotation.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.matrixScale=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);this.matrix.multiplySelf(this.matrixRotation);this.matrix.multiplySelf(this.matrixScale)}};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,f){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();f&&this.normalizeUVs();this.geometry.computeBoundingBox()};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;
-THREE.Mesh.prototype.sortFacesByMaterial=function(){function a(m){var h=[];c=0;for(f=m.length;c<f;c++)m[c]==undefined?h.push("undefined"):h.push(m[c].toString());return h.join("_")}var c,f,b,d,j,n,r,e,g={};b=0;for(d=this.geometry.faces.length;b<d;b++){j=this.geometry.faces[b];n=j.material;r=a(n);if(g[r]==undefined)g[r]={hash:r,counter:0};e=g[r].hash+"_"+g[r].counter;if(this.materialFaceGroup[e]==undefined)this.materialFaceGroup[e]={faces:[],material:n,vertices:0};j=j instanceof THREE.Face3?3:4;if(this.materialFaceGroup[e].vertices+
-j>65535){g[r].counter+=1;e=g[r].hash+"_"+g[r].counter;if(this.materialFaceGroup[e]==undefined)this.materialFaceGroup[e]={faces:[],material:n,vertices:0}}this.materialFaceGroup[e].faces.push(b);this.materialFaceGroup[e].vertices+=j}};THREE.Mesh.prototype.normalizeUVs=function(){var a,c,f,b,d;a=0;for(c=this.geometry.uvs.length;a<c;a++){d=this.geometry.uvs[a];f=0;for(b=d.length;f<b;f++){if(d[f].u!=1)d[f].u-=Math.floor(d[f].u);if(d[f].v!=1)d[f].v-=Math.floor(d[f].v)}}};THREE.FlatShading=0;
+THREE.Mesh.prototype.sortFacesByMaterial=function(){function a(m){var h=[];c=0;for(f=m.length;c<f;c++)m[c]==undefined?h.push("undefined"):h.push(m[c].toString());return h.join("_")}var c,f,b,d,k,n,q,e,g={};b=0;for(d=this.geometry.faces.length;b<d;b++){k=this.geometry.faces[b];n=k.material;q=a(n);if(g[q]==undefined)g[q]={hash:q,counter:0};e=g[q].hash+"_"+g[q].counter;if(this.materialFaceGroup[e]==undefined)this.materialFaceGroup[e]={faces:[],material:n,vertices:0};k=k instanceof THREE.Face3?3:4;if(this.materialFaceGroup[e].vertices+
+k>65535){g[q].counter+=1;e=g[q].hash+"_"+g[q].counter;if(this.materialFaceGroup[e]==undefined)this.materialFaceGroup[e]={faces:[],material:n,vertices:0}}this.materialFaceGroup[e].faces.push(b);this.materialFaceGroup[e].vertices+=k}};THREE.Mesh.prototype.normalizeUVs=function(){var a,c,f,b,d;a=0;for(c=this.geometry.uvs.length;a<c;a++){d=this.geometry.uvs[a];f=0;for(b=d.length;f<b;f++){if(d[f].u!=1)d[f].u-=Math.floor(d[f].u);if(d[f].v!=1)d[f].v-=Math.floor(d[f].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;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}this.toString=function(){return"THREE.LineBasicMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+
 this.linewidth+"<br/>)"}};
@@ -78,51 +78,51 @@ this.blending+"<br/>)"}};THREE.ParticleCircleMaterial=function(a){this.color=new
 THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c){this.image=a;this.mapping=c!==undefined?c:THREE.UVMapping;this.toString=function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>mapping: "+this.mapping+"<br/>)"}};THREE.UVMapping=0;THREE.ReflectionMap=1;THREE.RefractionMap=2;THREE.Multiply=0;THREE.Mix=1;
 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(p,t){var i=0,U=1,C=p.z+p.w,S=t.z+t.w,E=-p.z+p.w,B=-t.z+t.w;if(C>=0&&S>=0&&E>=0&&B>=0)return true;else if(C<0&&S<0||E<0&&B<0)return false;else{if(C<0)i=Math.max(i,C/(C-S));else if(S<0)U=Math.min(U,C/(C-S));if(E<0)i=Math.max(i,E/(E-B));else if(B<0)U=Math.min(U,E/(E-B));if(U<i)return false;else{p.lerpSelf(t,i);t.lerpSelf(p,1-U);return true}}}var c=null,f,b,d=[],j,n,r=[],e,g,m=[],h,l,q=[],o=new THREE.Vector4,s=new THREE.Matrix4,A=new THREE.Matrix4,J=new THREE.Vector4,
-N=new THREE.Vector4;this.projectScene=function(p,t){var i,U,C,S,E,B,L,x,D,Q,fa,z,M,K;c=[];l=g=n=b=0;t.autoUpdateMatrix&&t.updateMatrix();s.multiply(t.projectionMatrix,t.matrix);E=p.objects;i=0;for(U=E.length;i<U;i++){B=E[i];L=B.matrix;B.autoUpdateMatrix&&B.updateMatrix();if(B instanceof THREE.Mesh){A.multiply(s,L);x=B.geometry.vertices;C=0;for(S=x.length;C<S;C++){D=x[C];Q=D.positionScreen;Q.copy(D.position);A.transform(Q);Q.multiplyScalar(1/Q.w);D.__visible=Q.z>0&&Q.z<1}fa=B.geometry.faces;C=0;for(S=
-fa.length;C<S;C++){z=fa[C];if(z instanceof THREE.Face3){D=x[z.a];Q=x[z.b];M=x[z.c];if(D.__visible&&Q.__visible&&M.__visible)if(B.doubleSided||B.flipSided!=(M.positionScreen.x-D.positionScreen.x)*(Q.positionScreen.y-D.positionScreen.y)-(M.positionScreen.y-D.positionScreen.y)*(Q.positionScreen.x-D.positionScreen.x)<0){f=d[b]=d[b]||new THREE.RenderableFace3;f.v1.positionScreen.copy(D.positionScreen);f.v2.positionScreen.copy(Q.positionScreen);f.v3.positionScreen.copy(M.positionScreen);f.normalWorld.copy(z.normal);
-B.matrixRotation.transform(f.normalWorld);f.centroidWorld.copy(z.centroid);L.transform(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);s.transform(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterial=B.material;f.faceMaterial=z.material;f.overdraw=B.overdraw;f.uvs=B.geometry.uvs[C];f.color=z.color;c.push(f);b++}}else if(z instanceof THREE.Face4){D=x[z.a];Q=x[z.b];M=x[z.c];K=x[z.d];if(D.__visible&&Q.__visible&&M.__visible&&K.__visible)if(B.doubleSided||B.flipSided!=((K.positionScreen.x-
-D.positionScreen.x)*(Q.positionScreen.y-D.positionScreen.y)-(K.positionScreen.y-D.positionScreen.y)*(Q.positionScreen.x-D.positionScreen.x)<0||(Q.positionScreen.x-M.positionScreen.x)*(K.positionScreen.y-M.positionScreen.y)-(Q.positionScreen.y-M.positionScreen.y)*(K.positionScreen.x-M.positionScreen.x)<0)){j=r[n]=r[n]||new THREE.RenderableFace4;j.v1.positionScreen.copy(D.positionScreen);j.v2.positionScreen.copy(Q.positionScreen);j.v3.positionScreen.copy(M.positionScreen);j.v4.positionScreen.copy(K.positionScreen);
-j.normalWorld.copy(z.normal);B.matrixRotation.transform(j.normalWorld);j.centroidWorld.copy(z.centroid);L.transform(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);s.transform(j.centroidScreen);j.z=j.centroidScreen.z;j.meshMaterial=B.material;j.faceMaterial=z.material;j.overdraw=B.overdraw;j.uvs=B.geometry.uvs[C];j.color=z.color;c.push(j);n++}}}}else if(B instanceof THREE.Line){A.multiply(s,L);x=B.geometry.vertices;D=x[0];D.positionScreen.copy(D.position);A.transform(D.positionScreen);C=1;
-for(S=x.length;C<S;C++){D=x[C];D.positionScreen.copy(D.position);A.transform(D.positionScreen);Q=x[C-1];J.copy(D.positionScreen);N.copy(Q.positionScreen);if(a(J,N)){J.multiplyScalar(1/J.w);N.multiplyScalar(1/N.w);e=m[g]=m[g]||new THREE.RenderableLine;e.v1.positionScreen.copy(J);e.v2.positionScreen.copy(N);e.z=Math.max(J.z,N.z);e.material=B.material;c.push(e);g++}}}else if(B instanceof THREE.Particle){o.set(B.position.x,B.position.y,B.position.z,1);s.transform(o);o.z/=o.w;if(o.z>0&&o.z<1){h=q[l]=q[l]||
-new THREE.RenderableParticle;h.x=o.x/o.w;h.y=o.y/o.w;h.z=o.z;h.rotation=B.rotation.z;h.scale.x=B.scale.x*Math.abs(h.x-(o.x+t.projectionMatrix.n11)/(o.w+t.projectionMatrix.n14));h.scale.y=B.scale.y*Math.abs(h.y-(o.y+t.projectionMatrix.n22)/(o.w+t.projectionMatrix.n24));h.material=B.material;c.push(h);l++}}}c.sort(function(T,y){return y.z-T.z});return c};this.unprojectVector=function(p,t){var i=new THREE.Matrix4;i.multiply(THREE.Matrix4.makeInvert(t.matrix),THREE.Matrix4.makeInvert(t.projectionMatrix));
+THREE.Projector=function(){function a(p,s){var i=0,T=1,K=p.z+p.w,W=s.z+s.w,D=-p.z+p.w,B=-s.z+s.w;if(K>=0&&W>=0&&D>=0&&B>=0)return true;else if(K<0&&W<0||D<0&&B<0)return false;else{if(K<0)i=Math.max(i,K/(K-W));else if(W<0)T=Math.min(T,K/(K-W));if(D<0)i=Math.max(i,D/(D-B));else if(B<0)T=Math.min(T,D/(D-B));if(T<i)return false;else{p.lerpSelf(s,i);s.lerpSelf(p,1-T);return true}}}var c=null,f,b,d=[],k,n,q=[],e,g,m=[],h,o,j=[],r=new THREE.Vector4,x=new THREE.Matrix4,A=new THREE.Matrix4,I=new THREE.Vector4,
+N=new THREE.Vector4;this.projectScene=function(p,s){var i,T,K,W,D,B,L,w,C,Q,fa,z,M,J;c=[];o=g=n=b=0;s.autoUpdateMatrix&&s.updateMatrix();x.multiply(s.projectionMatrix,s.matrix);D=p.objects;i=0;for(T=D.length;i<T;i++){B=D[i];L=B.matrix;B.autoUpdateMatrix&&B.updateMatrix();if(B instanceof THREE.Mesh){A.multiply(x,L);w=B.geometry.vertices;K=0;for(W=w.length;K<W;K++){C=w[K];Q=C.positionScreen;Q.copy(C.position);A.transform(Q);Q.multiplyScalar(1/Q.w);C.__visible=Q.z>0&&Q.z<1}fa=B.geometry.faces;K=0;for(W=
+fa.length;K<W;K++){z=fa[K];if(z instanceof THREE.Face3){C=w[z.a];Q=w[z.b];M=w[z.c];if(C.__visible&&Q.__visible&&M.__visible)if(B.doubleSided||B.flipSided!=(M.positionScreen.x-C.positionScreen.x)*(Q.positionScreen.y-C.positionScreen.y)-(M.positionScreen.y-C.positionScreen.y)*(Q.positionScreen.x-C.positionScreen.x)<0){f=d[b]=d[b]||new THREE.RenderableFace3;f.v1.positionScreen.copy(C.positionScreen);f.v2.positionScreen.copy(Q.positionScreen);f.v3.positionScreen.copy(M.positionScreen);f.normalWorld.copy(z.normal);
+B.matrixRotation.transform(f.normalWorld);f.centroidWorld.copy(z.centroid);L.transform(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);x.transform(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterial=B.material;f.faceMaterial=z.material;f.overdraw=B.overdraw;f.uvs=B.geometry.uvs[K];f.color=z.color;c.push(f);b++}}else if(z instanceof THREE.Face4){C=w[z.a];Q=w[z.b];M=w[z.c];J=w[z.d];if(C.__visible&&Q.__visible&&M.__visible&&J.__visible)if(B.doubleSided||B.flipSided!=((J.positionScreen.x-
+C.positionScreen.x)*(Q.positionScreen.y-C.positionScreen.y)-(J.positionScreen.y-C.positionScreen.y)*(Q.positionScreen.x-C.positionScreen.x)<0||(Q.positionScreen.x-M.positionScreen.x)*(J.positionScreen.y-M.positionScreen.y)-(Q.positionScreen.y-M.positionScreen.y)*(J.positionScreen.x-M.positionScreen.x)<0)){k=q[n]=q[n]||new THREE.RenderableFace4;k.v1.positionScreen.copy(C.positionScreen);k.v2.positionScreen.copy(Q.positionScreen);k.v3.positionScreen.copy(M.positionScreen);k.v4.positionScreen.copy(J.positionScreen);
+k.normalWorld.copy(z.normal);B.matrixRotation.transform(k.normalWorld);k.centroidWorld.copy(z.centroid);L.transform(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);x.transform(k.centroidScreen);k.z=k.centroidScreen.z;k.meshMaterial=B.material;k.faceMaterial=z.material;k.overdraw=B.overdraw;k.uvs=B.geometry.uvs[K];k.color=z.color;c.push(k);n++}}}}else if(B instanceof THREE.Line){A.multiply(x,L);w=B.geometry.vertices;C=w[0];C.positionScreen.copy(C.position);A.transform(C.positionScreen);K=1;
+for(W=w.length;K<W;K++){C=w[K];C.positionScreen.copy(C.position);A.transform(C.positionScreen);Q=w[K-1];I.copy(C.positionScreen);N.copy(Q.positionScreen);if(a(I,N)){I.multiplyScalar(1/I.w);N.multiplyScalar(1/N.w);e=m[g]=m[g]||new THREE.RenderableLine;e.v1.positionScreen.copy(I);e.v2.positionScreen.copy(N);e.z=Math.max(I.z,N.z);e.material=B.material;c.push(e);g++}}}else if(B instanceof THREE.Particle){r.set(B.position.x,B.position.y,B.position.z,1);x.transform(r);r.z/=r.w;if(r.z>0&&r.z<1){h=j[o]=j[o]||
+new THREE.RenderableParticle;h.x=r.x/r.w;h.y=r.y/r.w;h.z=r.z;h.rotation=B.rotation.z;h.scale.x=B.scale.x*Math.abs(h.x-(r.x+s.projectionMatrix.n11)/(r.w+s.projectionMatrix.n14));h.scale.y=B.scale.y*Math.abs(h.y-(r.y+s.projectionMatrix.n22)/(r.w+s.projectionMatrix.n24));h.material=B.material;c.push(h);o++}}}c.sort(function(S,y){return y.z-S.z});return c};this.unprojectVector=function(p,s){var i=new THREE.Matrix4;i.multiply(THREE.Matrix4.makeInvert(s.matrix),THREE.Matrix4.makeInvert(s.projectionMatrix));
 i.transform(p);return p}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,f,b,d,j;this.domElement=document.createElement("div");this.setSize=function(n,r){f=n;b=r;d=f/2;j=b/2};this.render=function(n,r){var e,g,m,h,l,q,o,s;a=c.projectScene(n,r);e=0;for(g=a.length;e<g;e++){l=a[e];if(l instanceof THREE.RenderableParticle){o=l.x*d+d;s=l.y*j+j;m=0;for(h=l.material.length;m<h;m++){q=l.material[m];if(q instanceof THREE.ParticleDOMMaterial){q=q.domElement;q.style.left=o+"px";q.style.top=s+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(w,O,H){var I,k,G;lights=w.lights;w=0;for(I=lights.length;w<I;w++){k=lights[w];G=k.color;if(k instanceof THREE.DirectionalLight){k=O.normalWorld.dot(k.position)*k.intensity;if(k>0){H.r+=G.r*k;H.g+=G.g*k;H.b+=G.b*k}}else if(k instanceof THREE.PointLight){Ja.sub(k.position,O.centroidWorld);Ja.normalize();k=O.normalWorld.dot(Ja)*k.intensity;if(k>0){H.r+=G.r*k;H.g+=G.g*k;H.b+=G.b*k}}}}function c(w,O,H,I,k,G){if(k.opacity!=0){n(k.opacity);r(k.blending);M=w.positionScreen.x;
-K=w.positionScreen.y;T=O.positionScreen.x;y=O.positionScreen.y;v=H.positionScreen.x;R=H.positionScreen.y;if(k.map){ea=k.map.image;pa=ea.width-1;qa=ea.height-1;ca.u=I.uvs[0].u*pa;ca.v=I.uvs[0].v*qa;Z.u=I.uvs[1].u*pa;Z.v=I.uvs[1].v*qa;da.u=I.uvs[2].u*pa;da.v=I.uvs[2].v*qa;j(ea,M,K,T,y,v,R,ca.u,ca.v,Z.u,Z.v,da.u,da.v)}else if(k instanceof THREE.MeshBasicMaterial)b(M,K,T,y,v,R,k.color,k.wireframe,k.wireframe_linewidth);else if(k instanceof THREE.MeshLambertMaterial){if(Fa){aa.r=ga.r;aa.g=ga.g;aa.b=ga.b;
-a(G,I,aa);V.r=k.color.r*aa.r;V.g=k.color.g*aa.g;V.b=k.color.b*aa.b;V.updateStyleString()}else V.__styleString=k.color.__styleString;b(M,K,T,y,v,R,V,k.wireframe,k.wireframe_linewidth)}else if(k instanceof THREE.MeshDepthMaterial){ra=k.__2near;sa=k.__farPlusNear;ta=k.__farMinusNear;wa=~~((1-ra/(sa-w.positionScreen.z*ta))*255);xa=~~((1-ra/(sa-O.positionScreen.z*ta))*255);na=~~((1-ra/(sa-H.positionScreen.z*ta))*255);ea=h([wa,wa,wa],[xa,xa,xa],[na,na,na],[na,na,na]);ca.u=0;ca.v=0;Z.u=la;Z.v=0;da.u=0;da.v=
-la;j(ea,M,K,T,y,v,R,ca.u,ca.v,Z.u,Z.v,da.u,da.v)}else if(k instanceof THREE.MeshNormalMaterial){V.r=l(I.normalWorld.x);V.g=l(I.normalWorld.y);V.b=l(I.normalWorld.z);V.updateStyleString();b(M,K,T,y,v,R,V,k.wireframe,k.wireframe_linewidth)}}}function f(w,O,H,I,k,G,W,u,X){if(u.opacity!=0){n(u.opacity);r(u.blending);M=w.positionScreen.x;K=w.positionScreen.y;T=O.positionScreen.x;y=O.positionScreen.y;v=H.positionScreen.x;R=H.positionScreen.y;ha=I.positionScreen.x;P=I.positionScreen.y;Y=k.positionScreen.x;
-ya=k.positionScreen.y;Ka=G.positionScreen.x;La=G.positionScreen.y;if(u.map){ea=u.map.image;pa=ea.width-1;qa=ea.height-1;ca.copy(W.uvs[0]);Z.copy(W.uvs[1]);da.copy(W.uvs[2]);ia.copy(W.uvs[3]);ca.u*=pa;ca.v*=qa;Z.u*=pa;Z.v*=qa;da.u*=pa;da.v*=qa;ia.u*=pa;ia.v*=qa;j(ea,M,K,T,y,ha,P,ca.u,ca.v,Z.u,Z.v,ia.u,ia.v);j(ea,Y,ya,v,R,Ka,La,Z.u,Z.v,da.u,da.v,ia.u,ia.v)}else if(u instanceof THREE.MeshBasicMaterial)d(M,K,T,y,v,R,ha,P,u.color,u.wireframe,u.wireframe_linewidth);else if(u instanceof THREE.MeshLambertMaterial){if(Fa){aa.r=
-ga.r;aa.g=ga.g;aa.b=ga.b;a(X,W,aa);V.r=u.color.r*aa.r;V.g=u.color.g*aa.g;V.b=u.color.b*aa.b;V.updateStyleString()}else V.__styleString=u.color.__styleString;d(M,K,T,y,v,R,ha,P,V,u.wireframe,u.wireframe_linewidth)}else if(u instanceof THREE.MeshDepthMaterial){ra=u.__2near;sa=u.__farPlusNear;ta=u.__farMinusNear;wa=~~((1-ra/(sa-w.positionScreen.z*ta))*255);xa=~~((1-ra/(sa-O.positionScreen.z*ta))*255);na=~~((1-ra/(sa-H.positionScreen.z*ta))*255);Ga=~~((1-ra/(sa-I.positionScreen.z*ta))*255);ea=h([wa,wa,
-wa],[xa,xa,xa],[Ga,Ga,Ga],[na,na,na]);ca.u=0;ca.v=0;Z.u=la;Z.v=0;da.u=la;da.v=la;ia.u=0;ia.v=la;j(ea,M,K,T,y,ha,P,ca.u,ca.v,Z.u,Z.v,ia.u,ia.v);j(ea,Y,ya,v,R,Ka,La,Z.u,Z.v,da.u,da.v,ia.u,ia.v)}else if(u instanceof THREE.MeshNormalMaterial){V.r=l(W.normalWorld.x);V.g=l(W.normalWorld.y);V.b=l(W.normalWorld.z);V.updateStyleString();d(M,K,T,y,v,R,ha,P,V,u.wireframe,u.wireframe_linewidth)}}}function b(w,O,H,I,k,G,W,u,X){i.beginPath();i.moveTo(w,O);i.lineTo(H,I);i.lineTo(k,G);i.lineTo(w,O);i.closePath();
-if(u){e(X);g(W.__styleString);i.stroke();$.inflate(X*2)}else{m(W.__styleString);i.fill()}}function d(w,O,H,I,k,G,W,u,X,F,ba){i.beginPath();i.moveTo(w,O);i.lineTo(H,I);i.lineTo(k,G);i.lineTo(W,u);i.lineTo(w,O);i.closePath();if(F){e(ba);g(X.__styleString);i.stroke();$.inflate(ba*2)}else{m(X.__styleString);i.fill()}}function j(w,O,H,I,k,G,W,u,X,F,ba,ma,ua){i.beginPath();i.moveTo(O,H);i.lineTo(I,k);i.lineTo(G,W);i.closePath();I-=O;k-=H;G-=O;W-=H;F-=u;ba-=X;ma-=u;ua-=X;var va=1/(F*ua-ma*ba),Ba=(ua*I-ba*
-G)*va;ba=(ua*k-ba*W)*va;I=(F*G-ma*I)*va;k=(F*W-ma*k)*va;O=O-Ba*u-I*X;H=H-ba*u-k*X;i.save();i.transform(Ba,ba,I,k,O,H);i.clip();i.drawImage(w,0,0);i.restore()}function n(w){if(U!=w)i.globalAlpha=U=w}function r(w){if(C!=w){switch(w){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}C=w}}function e(w){if(B!=w)i.lineWidth=B=w}function g(w){if(S!=
-w)i.strokeStyle=S=w}function m(w){if(E!=w)i.fillStyle=E=w}function h(w,O,H,I){ja[0]=w[0];ja[1]=w[1];ja[2]=w[2];ja[4]=O[0];ja[5]=O[1];ja[6]=O[2];ja[8]=H[0];ja[9]=H[1];ja[10]=H[2];ja[12]=I[0];ja[13]=I[1];ja[14]=I[2];Ca.putImageData(Ma,0,0);Ha.drawImage(Da,0,0);return Ea}function l(w){return w<0?Math.min((1+w)*0.5,0.5):0.5+Math.min(w*0.5,0.5)}function q(w,O){var H=O.x-w.x,I=O.y-w.y,k=1/Math.sqrt(H*H+I*I);H*=k;I*=k;O.x+=H;O.y+=I;w.x-=H;w.y-=I}var o=null,s=new THREE.Projector,A=document.createElement("canvas"),
-J,N,p,t,i=A.getContext("2d"),U=1,C=0,S=null,E=null,B=1,L,x,D,Q,fa=new THREE.Vertex,z=new THREE.Vertex,M,K,T,y,v,R,ha,P,Y,ya,Ka,La,wa,xa,na,Ga,ra,sa,ta,ea,pa,qa,oa=new THREE.Rectangle,ka=new THREE.Rectangle,$=new THREE.Rectangle,Fa=false,V=new THREE.Color(16777215),aa=new THREE.Color(16777215),ga=new THREE.Color(0),za=new THREE.Color(0),Aa=new THREE.Color(0),Qa=Math.PI*2,Ja=new THREE.Vector3,ca=new THREE.UV,Z=new THREE.UV,da=new THREE.UV,ia=new THREE.UV,Da,Ca,Ma,ja,Ea,Ha,la=16;Da=document.createElement("canvas");
-Da.width=Da.height=2;Ca=Da.getContext("2d");Ca.fillStyle="rgba(0,0,0,1)";Ca.fillRect(0,0,2,2);Ma=Ca.getImageData(0,0,2,2);ja=Ma.data;Ea=document.createElement("canvas");Ea.width=Ea.height=la;Ha=Ea.getContext("2d");Ha.translate(-la/2,-la/2);Ha.scale(la,la);la--;this.domElement=A;this.autoClear=true;this.setSize=function(w,O){J=w;N=O;p=J/2;t=N/2;A.width=J;A.height=N;i.lineJoin="round";i.lineCap="round";oa.set(-p,-t,p,t)};this.clear=function(){if(!ka.isEmpty()){ka.inflate(1);ka.minSelf(oa);i.setTransform(1,
-0,0,-1,p,t);i.clearRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight());ka.empty()}};this.render=function(w,O){var H,I,k,G,W,u,X,F;this.autoClear&&this.clear();o=s.projectScene(w,O);i.setTransform(1,0,0,-1,p,t);i.fillStyle="rgba(0, 255, 255, 0.5)";i.fillRect(oa.getX(),oa.getY(),oa.getWidth(),oa.getHeight());if(Fa=w.lights.length>0){W=w.lights;ga.setRGB(0,0,0);za.setRGB(0,0,0);Aa.setRGB(0,0,0);H=0;for(I=W.length;H<I;H++){k=W[H];G=k.color;if(k instanceof THREE.AmbientLight){ga.r+=G.r;ga.g+=G.g;ga.b+=
-G.b}else if(k instanceof THREE.DirectionalLight){za.r+=G.r;za.g+=G.g;za.b+=G.b}else if(k instanceof THREE.PointLight){Aa.r+=G.r;Aa.g+=G.g;Aa.b+=G.b}}}H=0;for(I=o.length;H<I;H++){k=o[H];$.empty();if(k instanceof THREE.RenderableParticle){L=k;L.x*=p;L.y*=t;G=0;for(W=k.material.length;G<W;G++)if(F=k.material[G]){u=L;X=k;F=F;if(F.opacity!=0){n(F.opacity);r(F.blending);var ba=void 0,ma=void 0,ua=void 0,va=void 0,Ba=void 0,Na=void 0,Ia=void 0,Oa=void 0,Pa=void 0;if(F instanceof THREE.ParticleBasicMaterial){Ia=
-F.bitmap;Oa=Ia.width/2;Pa=Ia.height/2;ua=X.scale.x*p;va=X.scale.y*t;ba=ua*Oa;ma=va*Pa;Ba=F.offset.x*ua;Na=F.offset.y*va;$.set(u.x+Ba-ba,u.y+Na-ma,u.x+Ba+ba,u.y+Na+ma);if(oa.instersects($)){i.save();i.translate(u.x,u.y);i.rotate(-X.rotation);i.scale(ua,-va);i.translate(-Oa+F.offset.x,-Pa-F.offset.y);i.drawImage(Ia,0,0);i.restore();i.beginPath();i.moveTo(u.x-10,u.y);i.lineTo(u.x+10,u.y);i.moveTo(u.x,u.y-10);i.lineTo(u.x,u.y+10);i.closePath();i.strokeStyle="rgb(255,255,0)";i.stroke()}}else if(F instanceof
-THREE.ParticleCircleMaterial){if(Fa){aa.r=ga.r+za.r+Aa.r;aa.g=ga.g+za.g+Aa.g;aa.b=ga.b+za.b+Aa.b;V.r=F.color.r*aa.r;V.g=F.color.g*aa.g;V.b=F.color.b*aa.b;V.updateStyleString()}else V.__styleString=F.color.__styleString;ba=X.scale.x*p;ma=X.scale.y*t;$.set(u.x-ba,u.y-ma,u.x+ba,u.y+ma);if(oa.instersects($)){m(V.__styleString);i.save();i.translate(u.x,u.y);i.rotate(-X.rotation);i.scale(ba,ma);i.beginPath();i.arc(0,0,1,0,Qa,true);i.closePath();i.fill();i.restore()}}}}}else if(k instanceof THREE.RenderableLine){L=
-k.v1;x=k.v2;L.positionScreen.x*=p;L.positionScreen.y*=t;x.positionScreen.x*=p;x.positionScreen.y*=t;$.addPoint(L.positionScreen.x,L.positionScreen.y);$.addPoint(x.positionScreen.x,x.positionScreen.y);if(!oa.instersects($))continue;G=0;for(W=k.material.length;G<W;)if(F=k.material[G++]){u=L;X=x;F=F;if(F.opacity!=0){n(F.opacity);r(F.blending);i.beginPath();i.moveTo(u.positionScreen.x,u.positionScreen.y);i.lineTo(X.positionScreen.x,X.positionScreen.y);i.closePath();if(F instanceof THREE.LineBasicMaterial){V.__styleString=
-F.color.__styleString;e(F.linewidth);g(V.__styleString);i.stroke();$.inflate(F.linewidth*2)}}}}else if(k instanceof THREE.RenderableFace3){L=k.v1;x=k.v2;D=k.v3;L.positionScreen.x*=p;L.positionScreen.y*=t;x.positionScreen.x*=p;x.positionScreen.y*=t;D.positionScreen.x*=p;D.positionScreen.y*=t;if(k.overdraw){q(L.positionScreen,x.positionScreen);q(x.positionScreen,D.positionScreen);q(D.positionScreen,L.positionScreen)}$.addPoint(L.positionScreen.x,L.positionScreen.y);$.addPoint(x.positionScreen.x,x.positionScreen.y);
-$.addPoint(D.positionScreen.x,D.positionScreen.y);if(!oa.instersects($))continue;G=0;for(W=k.meshMaterial.length;G<W;){F=k.meshMaterial[G++];if(F instanceof THREE.MeshFaceMaterial){u=0;for(X=k.faceMaterial.length;u<X;)(F=k.faceMaterial[u++])&&c(L,x,D,k,F,w)}else F&&c(L,x,D,k,F,w)}}else if(k instanceof THREE.RenderableFace4){L=k.v1;x=k.v2;D=k.v3;Q=k.v4;L.positionScreen.x*=p;L.positionScreen.y*=t;x.positionScreen.x*=p;x.positionScreen.y*=t;D.positionScreen.x*=p;D.positionScreen.y*=t;Q.positionScreen.x*=
-p;Q.positionScreen.y*=t;fa.positionScreen.copy(x.positionScreen);z.positionScreen.copy(Q.positionScreen);if(k.overdraw){q(L.positionScreen,x.positionScreen);q(x.positionScreen,Q.positionScreen);q(Q.positionScreen,L.positionScreen)}if(k.overdraw){q(D.positionScreen,fa.positionScreen);q(D.positionScreen,z.positionScreen)}$.addPoint(L.positionScreen.x,L.positionScreen.y);$.addPoint(x.positionScreen.x,x.positionScreen.y);$.addPoint(D.positionScreen.x,D.positionScreen.y);$.addPoint(Q.positionScreen.x,
-Q.positionScreen.y);if(!oa.instersects($))continue;G=0;for(W=k.meshMaterial.length;G<W;){F=k.meshMaterial[G++];if(F instanceof THREE.MeshFaceMaterial){u=0;for(X=k.faceMaterial.length;u<X;)(F=k.faceMaterial[u++])&&f(L,x,D,Q,fa,z,k,F,w)}else F&&f(L,x,D,Q,fa,z,k,F,w)}}ka.addRectangle($)}i.lineWidth=1;i.strokeStyle="rgba( 255, 0, 0, 0.5 )";i.strokeRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight());i.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(z,M,K){var T,y,v,R;T=0;for(y=z.lights.length;T<y;T++){v=z.lights[T];if(v instanceof THREE.DirectionalLight){R=M.normalWorld.dot(v.position)*v.intensity;if(R>0){K.r+=v.color.r*R;K.g+=v.color.g*R;K.b+=v.color.b*R}}else if(v instanceof THREE.PointLight){E.sub(v.position,M.centroidWorld);E.normalize();R=M.normalWorld.dot(E)*v.intensity;if(R>0){K.r+=v.color.r*R;K.g+=v.color.g*R;K.b+=v.color.b*R}}}}function c(z,M,K,T,y,v){x=b(D++);x.setAttribute("d","M "+z.positionScreen.x+
-" "+z.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)p.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(N){t.r=i.r;t.g=i.g;t.b=i.b;a(v,T,t);p.r=y.color.r*t.r;p.g=y.color.g*t.g;p.b=y.color.b*t.b;p.updateStyleString()}else p.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshDepthMaterial){S=1-y.__2near/(y.__farPlusNear-T.z*y.__farMinusNear);
-p.setRGB(S,S,S)}else y instanceof THREE.MeshNormalMaterial&&p.setRGB(d(T.normalWorld.x),d(T.normalWorld.y),d(T.normalWorld.z));y.wireframe?x.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+y.wireframe_linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: round; stroke-linejoin: round"):x.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+y.opacity);r.appendChild(x)}function f(z,M,K,T,y,v,R){x=b(D++);x.setAttribute("d","M "+z.positionScreen.x+" "+
-z.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+" L "+T.positionScreen.x+","+T.positionScreen.y+"z");if(v instanceof THREE.MeshBasicMaterial)p.__styleString=v.color.__styleString;else if(v instanceof THREE.MeshLambertMaterial)if(N){t.r=i.r;t.g=i.g;t.b=i.b;a(R,y,t);p.r=v.color.r*t.r;p.g=v.color.g*t.g;p.b=v.color.b*t.b;p.updateStyleString()}else p.__styleString=v.color.__styleString;else if(v instanceof THREE.MeshDepthMaterial){S=1-
-v.__2near/(v.__farPlusNear-y.z*v.__farMinusNear);p.setRGB(S,S,S)}else v instanceof THREE.MeshNormalMaterial&&p.setRGB(d(y.normalWorld.x),d(y.normalWorld.y),d(y.normalWorld.z));v.wireframe?x.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+v.wireframe_linewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: round; stroke-linejoin: round"):x.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+v.opacity);r.appendChild(x)}function b(z){if(B[z]==null){B[z]=
-document.createElementNS("http://www.w3.org/2000/svg","path");fa==0&&B[z].setAttribute("shape-rendering","crispEdges");return B[z]}return B[z]}function d(z){return z<0?Math.min((1+z)*0.5,0.5):0.5+Math.min(z*0.5,0.5)}var j=null,n=new THREE.Projector,r=document.createElementNS("http://www.w3.org/2000/svg","svg"),e,g,m,h,l,q,o,s,A=new THREE.Rectangle,J=new THREE.Rectangle,N=false,p=new THREE.Color(16777215),t=new THREE.Color(16777215),i=new THREE.Color(0),U=new THREE.Color(0),C=new THREE.Color(0),S,
-E=new THREE.Vector3,B=[],L=[],x,D,Q,fa=1;this.domElement=r;this.autoClear=true;this.setQuality=function(z){switch(z){case "high":fa=1;break;case "low":fa=0}};this.setSize=function(z,M){e=z;g=M;m=e/2;h=g/2;r.setAttribute("viewBox",-m+" "+-h+" "+e+" "+g);r.setAttribute("width",e);r.setAttribute("height",g);A.set(-m,-h,m,h)};this.clear=function(){for(;r.childNodes.length>0;)r.removeChild(r.childNodes[0])};this.render=function(z,M){var K,T,y,v,R,ha,P,Y;this.autoClear&&this.clear();j=n.projectScene(z,
-M);Q=D=0;if(N=z.lights.length>0){P=z.lights;i.setRGB(0,0,0);U.setRGB(0,0,0);C.setRGB(0,0,0);K=0;for(T=P.length;K<T;K++){y=P[K];v=y.color;if(y instanceof THREE.AmbientLight){i.r+=v.r;i.g+=v.g;i.b+=v.b}else if(y instanceof THREE.DirectionalLight){U.r+=v.r;U.g+=v.g;U.b+=v.b}else if(y instanceof THREE.PointLight){C.r+=v.r;C.g+=v.g;C.b+=v.b}}}K=0;for(T=j.length;K<T;K++){P=j[K];J.empty();if(P instanceof THREE.RenderableParticle){l=P;l.x*=m;l.y*=-h;y=0;for(v=P.material.length;y<v;y++)if(Y=P.material[y]){R=
-l;ha=P;Y=Y;var ya=Q++;if(L[ya]==null){L[ya]=document.createElementNS("http://www.w3.org/2000/svg","circle");fa==0&&L[ya].setAttribute("shape-rendering","crispEdges")}x=L[ya];x.setAttribute("cx",R.x);x.setAttribute("cy",R.y);x.setAttribute("r",ha.scale.x*m);if(Y instanceof THREE.ParticleCircleMaterial){if(N){t.r=i.r+U.r+C.r;t.g=i.g+U.g+C.g;t.b=i.b+U.b+C.b;p.r=Y.color.r*t.r;p.g=Y.color.g*t.g;p.b=Y.color.b*t.b;p.updateStyleString()}else p=Y.color;x.setAttribute("style","fill: "+p.__styleString)}r.appendChild(x)}}else if(P instanceof
-THREE.RenderableFace3){l=P.v1;q=P.v2;o=P.v3;l.positionScreen.x*=m;l.positionScreen.y*=-h;q.positionScreen.x*=m;q.positionScreen.y*=-h;o.positionScreen.x*=m;o.positionScreen.y*=-h;J.addPoint(l.positionScreen.x,l.positionScreen.y);J.addPoint(q.positionScreen.x,q.positionScreen.y);J.addPoint(o.positionScreen.x,o.positionScreen.y);if(A.instersects(J)){y=0;for(v=P.meshMaterial.length;y<v;){Y=P.meshMaterial[y++];if(Y instanceof THREE.MeshFaceMaterial){R=0;for(ha=P.faceMaterial.length;R<ha;)(Y=P.faceMaterial[R++])&&
-c(l,q,o,P,Y,z)}else Y&&c(l,q,o,P,Y,z)}}}else if(P instanceof THREE.RenderableFace4){l=P.v1;q=P.v2;o=P.v3;s=P.v4;l.positionScreen.x*=m;l.positionScreen.y*=-h;q.positionScreen.x*=m;q.positionScreen.y*=-h;o.positionScreen.x*=m;o.positionScreen.y*=-h;s.positionScreen.x*=m;s.positionScreen.y*=-h;J.addPoint(l.positionScreen.x,l.positionScreen.y);J.addPoint(q.positionScreen.x,q.positionScreen.y);J.addPoint(o.positionScreen.x,o.positionScreen.y);J.addPoint(s.positionScreen.x,s.positionScreen.y);if(A.instersects(J)){y=
-0;for(v=P.meshMaterial.length;y<v;){Y=P.meshMaterial[y++];if(Y instanceof THREE.MeshFaceMaterial){R=0;for(ha=P.faceMaterial.length;R<ha;)(Y=P.faceMaterial[R++])&&f(l,q,o,s,P,Y,z)}else Y&&f(l,q,o,s,P,Y,z)}}}}}};
-THREE.WebGLRenderer=function(a){function c(e,g){var m;if(e=="fragment")m=b.createShader(b.FRAGMENT_SHADER);else if(e=="vertex")m=b.createShader(b.VERTEX_SHADER);b.shaderSource(m,g);b.compileShader(m);if(!b.getShaderParameter(m,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(m));return null}return m}var f=document.createElement("canvas"),b,d,j=new THREE.Matrix4,n;a=function(e,g){if(e){var m,h,l,q=pointLights=maxDirLights=maxPointLights=0;m=0;for(h=e.lights.length;m<h;m++){l=e.lights[m];l instanceof THREE.DirectionalLight&&
-q++;l instanceof THREE.PointLight&&pointLights++}if(pointLights+q<=g){maxDirLights=q;maxPointLights=pointLights}else{maxDirLights=Math.ceil(g*q/(pointLights+q));maxPointLights=g-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:g-1}}(a,4);this.domElement=f;this.autoClear=true;try{b=f.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);
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,f,b,d,k;this.domElement=document.createElement("div");this.setSize=function(n,q){f=n;b=q;d=f/2;k=b/2};this.render=function(n,q){var e,g,m,h,o,j,r,x;a=c.projectScene(n,q);e=0;for(g=a.length;e<g;e++){o=a[e];if(o instanceof THREE.RenderableParticle){r=o.x*d+d;x=o.y*k+k;m=0;for(h=o.material.length;m<h;m++){j=o.material[m];if(j instanceof THREE.ParticleDOMMaterial){j=j.domElement;j.style.left=r+"px";j.style.top=x+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(v,O,G){var H,l,F;lights=v.lights;v=0;for(H=lights.length;v<H;v++){l=lights[v];F=l.color;if(l instanceof THREE.DirectionalLight){l=O.normalWorld.dot(l.position)*l.intensity;if(l>0){G.r+=F.r*l;G.g+=F.g*l;G.b+=F.b*l}}else if(l instanceof THREE.PointLight){Ja.sub(l.position,O.centroidWorld);Ja.normalize();l=O.normalWorld.dot(Ja)*l.intensity;if(l>0){G.r+=F.r*l;G.g+=F.g*l;G.b+=F.b*l}}}}function c(v,O,G,H,l,F){if(l.opacity!=0){n(l.opacity);q(l.blending);M=v.positionScreen.x;
+J=v.positionScreen.y;S=O.positionScreen.x;y=O.positionScreen.y;u=G.positionScreen.x;R=G.positionScreen.y;if(l.map){ea=l.map.image;pa=ea.width-1;qa=ea.height-1;ca.u=H.uvs[0].u*pa;ca.v=H.uvs[0].v*qa;Z.u=H.uvs[1].u*pa;Z.v=H.uvs[1].v*qa;da.u=H.uvs[2].u*pa;da.v=H.uvs[2].v*qa;k(ea,M,J,S,y,u,R,ca.u,ca.v,Z.u,Z.v,da.u,da.v)}else if(l instanceof THREE.MeshBasicMaterial)b(M,J,S,y,u,R,l.color,l.wireframe,l.wireframe_linewidth);else if(l instanceof THREE.MeshLambertMaterial){if(Fa){aa.r=ga.r;aa.g=ga.g;aa.b=ga.b;
+a(F,H,aa);U.r=l.color.r*aa.r;U.g=l.color.g*aa.g;U.b=l.color.b*aa.b;U.updateStyleString()}else U.__styleString=l.color.__styleString;b(M,J,S,y,u,R,U,l.wireframe,l.wireframe_linewidth)}else if(l instanceof THREE.MeshDepthMaterial){ra=l.__2near;sa=l.__farPlusNear;ta=l.__farMinusNear;wa=~~((1-ra/(sa-v.positionScreen.z*ta))*255);xa=~~((1-ra/(sa-O.positionScreen.z*ta))*255);na=~~((1-ra/(sa-G.positionScreen.z*ta))*255);ea=h([wa,wa,wa],[xa,xa,xa],[na,na,na],[na,na,na]);ca.u=0;ca.v=0;Z.u=la;Z.v=0;da.u=0;da.v=
+la;k(ea,M,J,S,y,u,R,ca.u,ca.v,Z.u,Z.v,da.u,da.v)}else if(l instanceof THREE.MeshNormalMaterial){U.r=o(H.normalWorld.x);U.g=o(H.normalWorld.y);U.b=o(H.normalWorld.z);U.updateStyleString();b(M,J,S,y,u,R,U,l.wireframe,l.wireframe_linewidth)}}}function f(v,O,G,H,l,F,V,t,X){if(t.opacity!=0){n(t.opacity);q(t.blending);M=v.positionScreen.x;J=v.positionScreen.y;S=O.positionScreen.x;y=O.positionScreen.y;u=G.positionScreen.x;R=G.positionScreen.y;ha=H.positionScreen.x;P=H.positionScreen.y;Y=l.positionScreen.x;
+ya=l.positionScreen.y;Ka=F.positionScreen.x;La=F.positionScreen.y;if(t.map){ea=t.map.image;pa=ea.width-1;qa=ea.height-1;ca.copy(V.uvs[0]);Z.copy(V.uvs[1]);da.copy(V.uvs[2]);ia.copy(V.uvs[3]);ca.u*=pa;ca.v*=qa;Z.u*=pa;Z.v*=qa;da.u*=pa;da.v*=qa;ia.u*=pa;ia.v*=qa;k(ea,M,J,S,y,ha,P,ca.u,ca.v,Z.u,Z.v,ia.u,ia.v);k(ea,Y,ya,u,R,Ka,La,Z.u,Z.v,da.u,da.v,ia.u,ia.v)}else if(t instanceof THREE.MeshBasicMaterial)d(M,J,S,y,u,R,ha,P,t.color,t.wireframe,t.wireframe_linewidth);else if(t instanceof THREE.MeshLambertMaterial){if(Fa){aa.r=
+ga.r;aa.g=ga.g;aa.b=ga.b;a(X,V,aa);U.r=t.color.r*aa.r;U.g=t.color.g*aa.g;U.b=t.color.b*aa.b;U.updateStyleString()}else U.__styleString=t.color.__styleString;d(M,J,S,y,u,R,ha,P,U,t.wireframe,t.wireframe_linewidth)}else if(t instanceof THREE.MeshDepthMaterial){ra=t.__2near;sa=t.__farPlusNear;ta=t.__farMinusNear;wa=~~((1-ra/(sa-v.positionScreen.z*ta))*255);xa=~~((1-ra/(sa-O.positionScreen.z*ta))*255);na=~~((1-ra/(sa-G.positionScreen.z*ta))*255);Ga=~~((1-ra/(sa-H.positionScreen.z*ta))*255);ea=h([wa,wa,
+wa],[xa,xa,xa],[Ga,Ga,Ga],[na,na,na]);ca.u=0;ca.v=0;Z.u=la;Z.v=0;da.u=la;da.v=la;ia.u=0;ia.v=la;k(ea,M,J,S,y,ha,P,ca.u,ca.v,Z.u,Z.v,ia.u,ia.v);k(ea,Y,ya,u,R,Ka,La,Z.u,Z.v,da.u,da.v,ia.u,ia.v)}else if(t instanceof THREE.MeshNormalMaterial){U.r=o(V.normalWorld.x);U.g=o(V.normalWorld.y);U.b=o(V.normalWorld.z);U.updateStyleString();d(M,J,S,y,u,R,ha,P,U,t.wireframe,t.wireframe_linewidth)}}}function b(v,O,G,H,l,F,V,t,X){i.beginPath();i.moveTo(v,O);i.lineTo(G,H);i.lineTo(l,F);i.lineTo(v,O);i.closePath();
+if(t){e(X);g(V.__styleString);i.stroke();$.inflate(X*2)}else{m(V.__styleString);i.fill()}}function d(v,O,G,H,l,F,V,t,X,E,ba){i.beginPath();i.moveTo(v,O);i.lineTo(G,H);i.lineTo(l,F);i.lineTo(V,t);i.lineTo(v,O);i.closePath();if(E){e(ba);g(X.__styleString);i.stroke();$.inflate(ba*2)}else{m(X.__styleString);i.fill()}}function k(v,O,G,H,l,F,V,t,X,E,ba,ma,ua){i.beginPath();i.moveTo(O,G);i.lineTo(H,l);i.lineTo(F,V);i.closePath();H-=O;l-=G;F-=O;V-=G;E-=t;ba-=X;ma-=t;ua-=X;var va=1/(E*ua-ma*ba),Ba=(ua*H-ba*
+F)*va;ba=(ua*l-ba*V)*va;H=(E*F-ma*H)*va;l=(E*V-ma*l)*va;O=O-Ba*t-H*X;G=G-ba*t-l*X;i.save();i.transform(Ba,ba,H,l,O,G);i.clip();i.drawImage(v,0,0);i.restore()}function n(v){if(T!=v)i.globalAlpha=T=v}function q(v){if(K!=v){switch(v){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}K=v}}function e(v){if(B!=v)i.lineWidth=B=v}function g(v){if(W!=
+v)i.strokeStyle=W=v}function m(v){if(D!=v)i.fillStyle=D=v}function h(v,O,G,H){ja[0]=v[0];ja[1]=v[1];ja[2]=v[2];ja[4]=O[0];ja[5]=O[1];ja[6]=O[2];ja[8]=G[0];ja[9]=G[1];ja[10]=G[2];ja[12]=H[0];ja[13]=H[1];ja[14]=H[2];Ca.putImageData(Ma,0,0);Ha.drawImage(Da,0,0);return Ea}function o(v){return v<0?Math.min((1+v)*0.5,0.5):0.5+Math.min(v*0.5,0.5)}function j(v,O){var G=O.x-v.x,H=O.y-v.y,l=1/Math.sqrt(G*G+H*H);G*=l;H*=l;O.x+=G;O.y+=H;v.x-=G;v.y-=H}var r=null,x=new THREE.Projector,A=document.createElement("canvas"),
+I,N,p,s,i=A.getContext("2d"),T=1,K=0,W=null,D=null,B=1,L,w,C,Q,fa=new THREE.Vertex,z=new THREE.Vertex,M,J,S,y,u,R,ha,P,Y,ya,Ka,La,wa,xa,na,Ga,ra,sa,ta,ea,pa,qa,oa=new THREE.Rectangle,ka=new THREE.Rectangle,$=new THREE.Rectangle,Fa=false,U=new THREE.Color(16777215),aa=new THREE.Color(16777215),ga=new THREE.Color(0),za=new THREE.Color(0),Aa=new THREE.Color(0),Qa=Math.PI*2,Ja=new THREE.Vector3,ca=new THREE.UV,Z=new THREE.UV,da=new THREE.UV,ia=new THREE.UV,Da,Ca,Ma,ja,Ea,Ha,la=16;Da=document.createElement("canvas");
+Da.width=Da.height=2;Ca=Da.getContext("2d");Ca.fillStyle="rgba(0,0,0,1)";Ca.fillRect(0,0,2,2);Ma=Ca.getImageData(0,0,2,2);ja=Ma.data;Ea=document.createElement("canvas");Ea.width=Ea.height=la;Ha=Ea.getContext("2d");Ha.translate(-la/2,-la/2);Ha.scale(la,la);la--;this.domElement=A;this.autoClear=true;this.setSize=function(v,O){I=v;N=O;p=I/2;s=N/2;A.width=I;A.height=N;i.lineJoin="round";i.lineCap="round";oa.set(-p,-s,p,s)};this.clear=function(){if(!ka.isEmpty()){ka.inflate(1);ka.minSelf(oa);i.setTransform(1,
+0,0,-1,p,s);i.clearRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight());ka.empty()}};this.render=function(v,O){var G,H,l,F,V,t,X,E;this.autoClear&&this.clear();r=x.projectScene(v,O);i.setTransform(1,0,0,-1,p,s);i.fillStyle="rgba(0, 255, 255, 0.5)";i.fillRect(oa.getX(),oa.getY(),oa.getWidth(),oa.getHeight());if(Fa=v.lights.length>0){V=v.lights;ga.setRGB(0,0,0);za.setRGB(0,0,0);Aa.setRGB(0,0,0);G=0;for(H=V.length;G<H;G++){l=V[G];F=l.color;if(l instanceof THREE.AmbientLight){ga.r+=F.r;ga.g+=F.g;ga.b+=
+F.b}else if(l instanceof THREE.DirectionalLight){za.r+=F.r;za.g+=F.g;za.b+=F.b}else if(l instanceof THREE.PointLight){Aa.r+=F.r;Aa.g+=F.g;Aa.b+=F.b}}}G=0;for(H=r.length;G<H;G++){l=r[G];$.empty();if(l instanceof THREE.RenderableParticle){L=l;L.x*=p;L.y*=s;F=0;for(V=l.material.length;F<V;F++)if(E=l.material[F]){t=L;X=l;E=E;if(E.opacity!=0){n(E.opacity);q(E.blending);var ba=void 0,ma=void 0,ua=void 0,va=void 0,Ba=void 0,Na=void 0,Ia=void 0,Oa=void 0,Pa=void 0;if(E instanceof THREE.ParticleBasicMaterial){Ia=
+E.bitmap;Oa=Ia.width/2;Pa=Ia.height/2;ua=X.scale.x*p;va=X.scale.y*s;ba=ua*Oa;ma=va*Pa;Ba=E.offset.x*ua;Na=E.offset.y*va;$.set(t.x+Ba-ba,t.y+Na-ma,t.x+Ba+ba,t.y+Na+ma);if(oa.instersects($)){i.save();i.translate(t.x,t.y);i.rotate(-X.rotation);i.scale(ua,-va);i.translate(-Oa+E.offset.x,-Pa-E.offset.y);i.drawImage(Ia,0,0);i.restore();i.beginPath();i.moveTo(t.x-10,t.y);i.lineTo(t.x+10,t.y);i.moveTo(t.x,t.y-10);i.lineTo(t.x,t.y+10);i.closePath();i.strokeStyle="rgb(255,255,0)";i.stroke()}}else if(E instanceof
+THREE.ParticleCircleMaterial){if(Fa){aa.r=ga.r+za.r+Aa.r;aa.g=ga.g+za.g+Aa.g;aa.b=ga.b+za.b+Aa.b;U.r=E.color.r*aa.r;U.g=E.color.g*aa.g;U.b=E.color.b*aa.b;U.updateStyleString()}else U.__styleString=E.color.__styleString;ba=X.scale.x*p;ma=X.scale.y*s;$.set(t.x-ba,t.y-ma,t.x+ba,t.y+ma);if(oa.instersects($)){m(U.__styleString);i.save();i.translate(t.x,t.y);i.rotate(-X.rotation);i.scale(ba,ma);i.beginPath();i.arc(0,0,1,0,Qa,true);i.closePath();i.fill();i.restore()}}}}}else if(l instanceof THREE.RenderableLine){L=
+l.v1;w=l.v2;L.positionScreen.x*=p;L.positionScreen.y*=s;w.positionScreen.x*=p;w.positionScreen.y*=s;$.addPoint(L.positionScreen.x,L.positionScreen.y);$.addPoint(w.positionScreen.x,w.positionScreen.y);if(!oa.instersects($))continue;F=0;for(V=l.material.length;F<V;)if(E=l.material[F++]){t=L;X=w;E=E;if(E.opacity!=0){n(E.opacity);q(E.blending);i.beginPath();i.moveTo(t.positionScreen.x,t.positionScreen.y);i.lineTo(X.positionScreen.x,X.positionScreen.y);i.closePath();if(E instanceof THREE.LineBasicMaterial){U.__styleString=
+E.color.__styleString;e(E.linewidth);g(U.__styleString);i.stroke();$.inflate(E.linewidth*2)}}}}else if(l instanceof THREE.RenderableFace3){L=l.v1;w=l.v2;C=l.v3;L.positionScreen.x*=p;L.positionScreen.y*=s;w.positionScreen.x*=p;w.positionScreen.y*=s;C.positionScreen.x*=p;C.positionScreen.y*=s;if(l.overdraw){j(L.positionScreen,w.positionScreen);j(w.positionScreen,C.positionScreen);j(C.positionScreen,L.positionScreen)}$.addPoint(L.positionScreen.x,L.positionScreen.y);$.addPoint(w.positionScreen.x,w.positionScreen.y);
+$.addPoint(C.positionScreen.x,C.positionScreen.y);if(!oa.instersects($))continue;F=0;for(V=l.meshMaterial.length;F<V;){E=l.meshMaterial[F++];if(E instanceof THREE.MeshFaceMaterial){t=0;for(X=l.faceMaterial.length;t<X;)(E=l.faceMaterial[t++])&&c(L,w,C,l,E,v)}else E&&c(L,w,C,l,E,v)}}else if(l instanceof THREE.RenderableFace4){L=l.v1;w=l.v2;C=l.v3;Q=l.v4;L.positionScreen.x*=p;L.positionScreen.y*=s;w.positionScreen.x*=p;w.positionScreen.y*=s;C.positionScreen.x*=p;C.positionScreen.y*=s;Q.positionScreen.x*=
+p;Q.positionScreen.y*=s;fa.positionScreen.copy(w.positionScreen);z.positionScreen.copy(Q.positionScreen);if(l.overdraw){j(L.positionScreen,w.positionScreen);j(w.positionScreen,Q.positionScreen);j(Q.positionScreen,L.positionScreen)}if(l.overdraw){j(C.positionScreen,fa.positionScreen);j(C.positionScreen,z.positionScreen)}$.addPoint(L.positionScreen.x,L.positionScreen.y);$.addPoint(w.positionScreen.x,w.positionScreen.y);$.addPoint(C.positionScreen.x,C.positionScreen.y);$.addPoint(Q.positionScreen.x,
+Q.positionScreen.y);if(!oa.instersects($))continue;F=0;for(V=l.meshMaterial.length;F<V;){E=l.meshMaterial[F++];if(E instanceof THREE.MeshFaceMaterial){t=0;for(X=l.faceMaterial.length;t<X;)(E=l.faceMaterial[t++])&&f(L,w,C,Q,fa,z,l,E,v)}else E&&f(L,w,C,Q,fa,z,l,E,v)}}ka.addRectangle($)}i.lineWidth=1;i.strokeStyle="rgba( 255, 0, 0, 0.5 )";i.strokeRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight());i.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(z,M,J){var S,y,u,R;S=0;for(y=z.lights.length;S<y;S++){u=z.lights[S];if(u instanceof THREE.DirectionalLight){R=M.normalWorld.dot(u.position)*u.intensity;if(R>0){J.r+=u.color.r*R;J.g+=u.color.g*R;J.b+=u.color.b*R}}else if(u instanceof THREE.PointLight){D.sub(u.position,M.centroidWorld);D.normalize();R=M.normalWorld.dot(D)*u.intensity;if(R>0){J.r+=u.color.r*R;J.g+=u.color.g*R;J.b+=u.color.b*R}}}}function c(z,M,J,S,y,u){w=b(C++);w.setAttribute("d","M "+z.positionScreen.x+
+" "+z.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+J.positionScreen.x+","+J.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)p.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(N){s.r=i.r;s.g=i.g;s.b=i.b;a(u,S,s);p.r=y.color.r*s.r;p.g=y.color.g*s.g;p.b=y.color.b*s.b;p.updateStyleString()}else p.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshDepthMaterial){W=1-y.__2near/(y.__farPlusNear-S.z*y.__farMinusNear);
+p.setRGB(W,W,W)}else y instanceof THREE.MeshNormalMaterial&&p.setRGB(d(S.normalWorld.x),d(S.normalWorld.y),d(S.normalWorld.z));y.wireframe?w.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+y.wireframe_linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: round; stroke-linejoin: round"):w.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+y.opacity);q.appendChild(w)}function f(z,M,J,S,y,u,R){w=b(C++);w.setAttribute("d","M "+z.positionScreen.x+" "+
+z.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+J.positionScreen.x+","+J.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(u instanceof THREE.MeshBasicMaterial)p.__styleString=u.color.__styleString;else if(u instanceof THREE.MeshLambertMaterial)if(N){s.r=i.r;s.g=i.g;s.b=i.b;a(R,y,s);p.r=u.color.r*s.r;p.g=u.color.g*s.g;p.b=u.color.b*s.b;p.updateStyleString()}else p.__styleString=u.color.__styleString;else if(u instanceof THREE.MeshDepthMaterial){W=1-
+u.__2near/(u.__farPlusNear-y.z*u.__farMinusNear);p.setRGB(W,W,W)}else u instanceof THREE.MeshNormalMaterial&&p.setRGB(d(y.normalWorld.x),d(y.normalWorld.y),d(y.normalWorld.z));u.wireframe?w.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+u.wireframe_linewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: round; stroke-linejoin: round"):w.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+u.opacity);q.appendChild(w)}function b(z){if(B[z]==null){B[z]=
+document.createElementNS("http://www.w3.org/2000/svg","path");fa==0&&B[z].setAttribute("shape-rendering","crispEdges");return B[z]}return B[z]}function d(z){return z<0?Math.min((1+z)*0.5,0.5):0.5+Math.min(z*0.5,0.5)}var k=null,n=new THREE.Projector,q=document.createElementNS("http://www.w3.org/2000/svg","svg"),e,g,m,h,o,j,r,x,A=new THREE.Rectangle,I=new THREE.Rectangle,N=false,p=new THREE.Color(16777215),s=new THREE.Color(16777215),i=new THREE.Color(0),T=new THREE.Color(0),K=new THREE.Color(0),W,
+D=new THREE.Vector3,B=[],L=[],w,C,Q,fa=1;this.domElement=q;this.autoClear=true;this.setQuality=function(z){switch(z){case "high":fa=1;break;case "low":fa=0}};this.setSize=function(z,M){e=z;g=M;m=e/2;h=g/2;q.setAttribute("viewBox",-m+" "+-h+" "+e+" "+g);q.setAttribute("width",e);q.setAttribute("height",g);A.set(-m,-h,m,h)};this.clear=function(){for(;q.childNodes.length>0;)q.removeChild(q.childNodes[0])};this.render=function(z,M){var J,S,y,u,R,ha,P,Y;this.autoClear&&this.clear();k=n.projectScene(z,
+M);Q=C=0;if(N=z.lights.length>0){P=z.lights;i.setRGB(0,0,0);T.setRGB(0,0,0);K.setRGB(0,0,0);J=0;for(S=P.length;J<S;J++){y=P[J];u=y.color;if(y instanceof THREE.AmbientLight){i.r+=u.r;i.g+=u.g;i.b+=u.b}else if(y instanceof THREE.DirectionalLight){T.r+=u.r;T.g+=u.g;T.b+=u.b}else if(y instanceof THREE.PointLight){K.r+=u.r;K.g+=u.g;K.b+=u.b}}}J=0;for(S=k.length;J<S;J++){P=k[J];I.empty();if(P instanceof THREE.RenderableParticle){o=P;o.x*=m;o.y*=-h;y=0;for(u=P.material.length;y<u;y++)if(Y=P.material[y]){R=
+o;ha=P;Y=Y;var ya=Q++;if(L[ya]==null){L[ya]=document.createElementNS("http://www.w3.org/2000/svg","circle");fa==0&&L[ya].setAttribute("shape-rendering","crispEdges")}w=L[ya];w.setAttribute("cx",R.x);w.setAttribute("cy",R.y);w.setAttribute("r",ha.scale.x*m);if(Y instanceof THREE.ParticleCircleMaterial){if(N){s.r=i.r+T.r+K.r;s.g=i.g+T.g+K.g;s.b=i.b+T.b+K.b;p.r=Y.color.r*s.r;p.g=Y.color.g*s.g;p.b=Y.color.b*s.b;p.updateStyleString()}else p=Y.color;w.setAttribute("style","fill: "+p.__styleString)}q.appendChild(w)}}else if(P instanceof
+THREE.RenderableFace3){o=P.v1;j=P.v2;r=P.v3;o.positionScreen.x*=m;o.positionScreen.y*=-h;j.positionScreen.x*=m;j.positionScreen.y*=-h;r.positionScreen.x*=m;r.positionScreen.y*=-h;I.addPoint(o.positionScreen.x,o.positionScreen.y);I.addPoint(j.positionScreen.x,j.positionScreen.y);I.addPoint(r.positionScreen.x,r.positionScreen.y);if(A.instersects(I)){y=0;for(u=P.meshMaterial.length;y<u;){Y=P.meshMaterial[y++];if(Y instanceof THREE.MeshFaceMaterial){R=0;for(ha=P.faceMaterial.length;R<ha;)(Y=P.faceMaterial[R++])&&
+c(o,j,r,P,Y,z)}else Y&&c(o,j,r,P,Y,z)}}}else if(P instanceof THREE.RenderableFace4){o=P.v1;j=P.v2;r=P.v3;x=P.v4;o.positionScreen.x*=m;o.positionScreen.y*=-h;j.positionScreen.x*=m;j.positionScreen.y*=-h;r.positionScreen.x*=m;r.positionScreen.y*=-h;x.positionScreen.x*=m;x.positionScreen.y*=-h;I.addPoint(o.positionScreen.x,o.positionScreen.y);I.addPoint(j.positionScreen.x,j.positionScreen.y);I.addPoint(r.positionScreen.x,r.positionScreen.y);I.addPoint(x.positionScreen.x,x.positionScreen.y);if(A.instersects(I)){y=
+0;for(u=P.meshMaterial.length;y<u;){Y=P.meshMaterial[y++];if(Y instanceof THREE.MeshFaceMaterial){R=0;for(ha=P.faceMaterial.length;R<ha;)(Y=P.faceMaterial[R++])&&f(o,j,r,x,P,Y,z)}else Y&&f(o,j,r,x,P,Y,z)}}}}}};
+THREE.WebGLRenderer=function(a){function c(e,g){var m;if(e=="fragment")m=b.createShader(b.FRAGMENT_SHADER);else if(e=="vertex")m=b.createShader(b.VERTEX_SHADER);b.shaderSource(m,g);b.compileShader(m);if(!b.getShaderParameter(m,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(m));return null}return m}var f=document.createElement("canvas"),b,d,k=new THREE.Matrix4,n;a=function(e,g){if(e){var m,h,o,j=pointLights=maxDirLights=maxPointLights=0;m=0;for(h=e.lights.length;m<h;m++){o=e.lights[m];o instanceof THREE.DirectionalLight&&
+j++;o instanceof THREE.PointLight&&pointLights++}if(pointLights+j<=g){maxDirLights=j;maxPointLights=pointLights}else{maxDirLights=Math.ceil(g*j/(pointLights+j));maxPointLights=g-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:g-1}}(a,4);this.domElement=f;this.autoClear=true;try{b=f.getContext("experimental-webgl",{antialias:true})}catch(q){}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(e,g){d=b.createProgram();b.attachShader(d,c("fragment",["#ifdef GL_ES\nprecision highp float;\n#endif",e?"#define MAX_DIR_LIGHTS "+e:"",g?"#define MAX_POINT_LIGHTS "+g:"","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;",
 e?"uniform mat4 viewMatrix;":"",e?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",g?"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 );",
 g?"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",g?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",g?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",g?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",g?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",g?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",g?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",g?"float pointSpecularWeight = 0.0;":"",g?"if ( pointDotNormalHalf >= 0.0 )":
@@ -138,26 +138,25 @@ b.linkProgram(d);if(!b.getProgramParameter(d,b.LINK_STATUS)){alert("Could not in
 b.getUniformLocation(d,"pointLightPosition")}d.material=b.getUniformLocation(d,"material");d.mColor=b.getUniformLocation(d,"mColor");d.mOpacity=b.getUniformLocation(d,"mOpacity");d.mReflectivity=b.getUniformLocation(d,"mReflectivity");d.mAmbient=b.getUniformLocation(d,"mAmbient");d.mSpecular=b.getUniformLocation(d,"mSpecular");d.mShininess=b.getUniformLocation(d,"mShininess");d.enableMap=b.getUniformLocation(d,"enableMap");b.uniform1i(d.enableMap,0);d.tMap=b.getUniformLocation(d,"tMap");b.uniform1i(d.tMap,
 0);d.enableCubeMap=b.getUniformLocation(d,"enableCubeMap");b.uniform1i(d.enableCubeMap,0);d.tCube=b.getUniformLocation(d,"tCube");b.uniform1i(d.tCube,1);d.mixEnvMap=b.getUniformLocation(d,"mixEnvMap");b.uniform1i(d.mixEnvMap,0);d.mRefractionRatio=b.getUniformLocation(d,"mRefractionRatio");d.useRefract=b.getUniformLocation(d,"useRefract");b.uniform1i(d.useRefract,0);d.m2Near=b.getUniformLocation(d,"m2Near");d.mFarPlusNear=b.getUniformLocation(d,"mFarPlusNear");d.mFarMinusNear=b.getUniformLocation(d,
 "mFarMinusNear");d.position=b.getAttribLocation(d,"position");b.enableVertexAttribArray(d.position);d.normal=b.getAttribLocation(d,"normal");b.enableVertexAttribArray(d.normal);d.uv=b.getAttribLocation(d,"uv");b.enableVertexAttribArray(d.uv);d.viewMatrixArray=new Float32Array(16);d.modelViewMatrixArray=new Float32Array(16);d.projectionMatrixArray=new Float32Array(16)})(a.directional,a.point);this.setSize=function(e,g){f.width=e;f.height=g;b.viewport(0,0,f.width,f.height)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|
-b.DEPTH_BUFFER_BIT)};this.setupLights=function(e){var g,m,h,l,q=[],o=[],s=[];l=[];var A=[];b.uniform1i(d.enableLighting,e.lights.length);g=0;for(m=e.lights.length;g<m;g++){h=e.lights[g];if(h instanceof THREE.AmbientLight)q.push(h);else if(h instanceof THREE.DirectionalLight)s.push(h);else h instanceof THREE.PointLight&&o.push(h)}g=e=h=l=0;for(m=q.length;g<m;g++){e+=q[g].color.r;h+=q[g].color.g;l+=q[g].color.b}b.uniform3f(d.ambientLightColor,e,h,l);l=[];A=[];g=0;for(m=s.length;g<m;g++){h=s[g];l.push(h.color.r*
-h.intensity);l.push(h.color.g*h.intensity);l.push(h.color.b*h.intensity);A.push(h.position.x);A.push(h.position.y);A.push(h.position.z)}if(s.length){b.uniform1i(d.directionalLightNumber,s.length);b.uniform3fv(d.directionalLightDirection,A);b.uniform3fv(d.directionalLightColor,l)}l=[];A=[];g=0;for(m=o.length;g<m;g++){h=o[g];l.push(h.color.r*h.intensity);l.push(h.color.g*h.intensity);l.push(h.color.b*h.intensity);A.push(h.position.x);A.push(h.position.y);A.push(h.position.z)}if(o.length){b.uniform1i(d.pointLightNumber,
-o.length);b.uniform3fv(d.pointLightPosition,A);b.uniform3fv(d.pointLightColor,l)}};this.createBuffers=function(e,g){var m,h,l,q,o,s,A,J,N,p=e.materialFaceGroup[g],t=[],i=[],U=[],C=[],S=[],E=0,B=false;m=0;for(h=e.material.length;m<h;m++){meshMaterial=e.material[m];if(meshMaterial instanceof THREE.MeshFaceMaterial){o=0;for(s=p.material.length;o<s;o++)if(p.material[o]&&p.material[o].shading!=undefined&&p.material[o].shading==THREE.SmoothShading){B=true;break}}else if(meshMaterial&&meshMaterial.shading!=
-undefined&&meshMaterial.shading==THREE.SmoothShading){B=true;break}if(B)break}m=0;for(h=p.faces.length;m<h;m++){l=p.faces[m];q=e.geometry.faces[l];o=q.vertexNormals;s=q.normal;l=e.geometry.uvs[l];if(q instanceof THREE.Face3){A=e.geometry.vertices[q.a].position;J=e.geometry.vertices[q.b].position;N=e.geometry.vertices[q.c].position;U.push(A.x,A.y,A.z);U.push(J.x,J.y,J.z);U.push(N.x,N.y,N.z);if(o.length==3&&B){C.push(o[0].x,o[0].y,o[0].z);C.push(o[1].x,o[1].y,o[1].z);C.push(o[2].x,o[2].y,o[2].z)}else{C.push(s.x,
-s.y,s.z);C.push(s.x,s.y,s.z);C.push(s.x,s.y,s.z)}if(l){S.push(l[0].u,l[0].v);S.push(l[1].u,l[1].v);S.push(l[2].u,l[2].v)}t.push(E,E+1,E+2);i.push(E,E+1);i.push(E,E+2);i.push(E+1,E+2);E+=3}else if(q instanceof THREE.Face4){A=e.geometry.vertices[q.a].position;J=e.geometry.vertices[q.b].position;N=e.geometry.vertices[q.c].position;q=e.geometry.vertices[q.d].position;U.push(A.x,A.y,A.z);U.push(J.x,J.y,J.z);U.push(N.x,N.y,N.z);U.push(q.x,q.y,q.z);if(o.length==4&&B){C.push(o[0].x,o[0].y,o[0].z);C.push(o[1].x,
-o[1].y,o[1].z);C.push(o[2].x,o[2].y,o[2].z);C.push(o[3].x,o[3].y,o[3].z)}else{C.push(s.x,s.y,s.z);C.push(s.x,s.y,s.z);C.push(s.x,s.y,s.z);C.push(s.x,s.y,s.z)}if(l){S.push(l[0].u,l[0].v);S.push(l[1].u,l[1].v);S.push(l[2].u,l[2].v);S.push(l[3].u,l[3].v)}t.push(E,E+1,E+2);t.push(E,E+2,E+3);i.push(E,E+1);i.push(E,E+2);i.push(E,E+3);i.push(E+1,E+2);i.push(E+2,E+3);E+=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(C),b.STATIC_DRAW);p.__webGLUVBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(S),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(i),b.STATIC_DRAW);p.__webGLFaceCount=t.length;p.__webGLLineCount=i.length}};this.renderBuffer=function(e,g){var m,h,l,q,o,s,A,J,N,p;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshBasicMaterial){m=e.color;h=e.opacity;q=e.wireframe;o=e.wireframe_linewidth;A=e.map;J=e.env_map;s=e.combine==THREE.Mix;l=e.reflectivity;p=e.env_map&&e.env_map.mapping==
-THREE.RefractionMap;N=e.refraction_ratio;b.uniform4f(d.mColor,m.r*h,m.g*h,m.b*h,h);b.uniform1i(d.mixEnvMap,s);b.uniform1f(d.mReflectivity,l);b.uniform1i(d.useRefract,p);b.uniform1f(d.mRefractionRatio,N)}if(e instanceof THREE.MeshNormalMaterial){h=e.opacity;b.uniform1f(d.mOpacity,h);b.uniform1i(d.material,4)}else if(e instanceof THREE.MeshDepthMaterial){h=e.opacity;q=e.wireframe;o=e.wireframe_linewidth;b.uniform1f(d.mOpacity,h);b.uniform1f(d.m2Near,e.__2near);b.uniform1f(d.mFarPlusNear,e.__farPlusNear);
-b.uniform1f(d.mFarMinusNear,e.__farMinusNear);b.uniform1i(d.material,3)}else if(e instanceof THREE.MeshPhongMaterial){m=e.ambient;l=e.specular;s=e.shininess;b.uniform4f(d.mAmbient,m.r,m.g,m.b,h);b.uniform4f(d.mSpecular,l.r,l.g,l.b,h);b.uniform1f(d.mShininess,s);b.uniform1i(d.material,2)}else if(e instanceof THREE.MeshLambertMaterial)b.uniform1i(d.material,1);else if(e instanceof THREE.MeshBasicMaterial)b.uniform1i(d.material,0);else if(e instanceof THREE.MeshCubeMaterial){b.uniform1i(d.material,5);
-J=e.env_map}if(A){if(!e.__webGLTexture&&e.map.image.loaded){e.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,e.__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,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);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.__webGLTexture);b.uniform1i(d.tMap,0);b.uniform1i(d.enableMap,1)}else b.uniform1i(d.enableMap,0);if(J){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);b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[0]);b.texImage2D(b.TEXTURE_CUBE_MAP_NEGATIVE_X,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[1]);b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_Y,
-0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[2]);b.texImage2D(b.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[3]);b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_Z,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[4]);b.texImage2D(b.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[5]);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(d.tCube,1)}b.uniform1i(d.enableCubeMap,1)}else b.uniform1i(d.enableCubeMap,0);b.bindBuffer(b.ARRAY_BUFFER,g.__webGLVertexBuffer);b.vertexAttribPointer(d.position,3,b.FLOAT,false,0,0);b.bindBuffer(b.ARRAY_BUFFER,g.__webGLNormalBuffer);b.vertexAttribPointer(d.normal,3,b.FLOAT,false,0,0);if(A){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.enableVertexAttribArray(d.uv);b.vertexAttribPointer(d.uv,2,b.FLOAT,false,0,0)}else b.disableVertexAttribArray(d.uv);
-if(q){b.lineWidth(o);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.drawElements(b.LINES,g.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,g.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(e,g,m){var h,l,q,o,s;q=0;for(o=e.material.length;q<o;q++){h=e.material[q];if(h instanceof THREE.MeshFaceMaterial){h=0;for(l=g.material.length;h<l;h++)if((s=g.material[h])&&s.blending==m){this.setBlending(s.blending);
-this.renderBuffer(s,g)}}else if((s=h)&&s.blending==m){this.setBlending(s.blending);this.renderBuffer(s,g)}}};this.render=function(e,g){var m,h;this.initWebGLObjects(e);this.autoClear&&this.clear();g.autoUpdateMatrix&&g.updateMatrix();b.uniform3f(d.cameraPosition,g.position.x,g.position.y,g.position.z);this.setupLights(e);m=0;for(h=e.__webGLObjects.length;m<h;m++){webGLObject=e.__webGLObjects[m];this.setupMatrices(webGLObject.__object,g);this.renderPass(webGLObject.__object,webGLObject,THREE.NormalBlending)}m=
-0;for(h=e.__webGLObjects.length;m<h;m++){webGLObject=e.__webGLObjects[m];this.setupMatrices(webGLObject.__object,g);this.renderPass(webGLObject.__object,webGLObject,THREE.AdditiveBlending);this.renderPass(webGLObject.__object,webGLObject,THREE.SubtractiveBlending)}};this.initWebGLObjects=function(e){var g,m,h,l,q;if(!e.__webGLObjects)e.__webGLObjects=[];g=0;for(m=e.objects.length;g<m;g++){h=e.objects[g];if(h instanceof THREE.Mesh)for(l in h.materialFaceGroup){q=h.materialFaceGroup[l];if(!q.__webGLVertexBuffer){this.createBuffers(h,
-l);q.__object=h;e.__webGLObjects.push(q)}}}};this.setupMatrices=function(e,g){e.autoUpdateMatrix&&e.updateMatrix();j.multiply(g.matrix,e.matrix);d.viewMatrixArray=new Float32Array(g.matrix.flatten());d.modelViewMatrixArray=new Float32Array(j.flatten());d.projectionMatrixArray=new Float32Array(g.projectionMatrix.flatten());n=THREE.Matrix4.makeInvert3x3(j).transpose();d.normalMatrixArray=new Float32Array(n.m);b.uniformMatrix4fv(d.viewMatrix,false,d.viewMatrixArray);b.uniformMatrix4fv(d.modelViewMatrix,
-false,d.modelViewMatrixArray);b.uniformMatrix4fv(d.projectionMatrix,false,d.projectionMatrixArray);b.uniformMatrix3fv(d.normalMatrix,false,d.normalMatrixArray);b.uniformMatrix4fv(d.objMatrix,false,new Float32Array(e.matrix.flatten()))};this.setBlending=function(e){switch(e){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(e,g){if(e){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="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.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.material=this.color=this.z=null};
+b.DEPTH_BUFFER_BIT)};this.setupLights=function(e){var g,m,h,o,j=[],r=[],x=[];o=[];var A=[];b.uniform1i(d.enableLighting,e.lights.length);g=0;for(m=e.lights.length;g<m;g++){h=e.lights[g];if(h instanceof THREE.AmbientLight)j.push(h);else if(h instanceof THREE.DirectionalLight)x.push(h);else h instanceof THREE.PointLight&&r.push(h)}g=e=h=o=0;for(m=j.length;g<m;g++){e+=j[g].color.r;h+=j[g].color.g;o+=j[g].color.b}b.uniform3f(d.ambientLightColor,e,h,o);o=[];A=[];g=0;for(m=x.length;g<m;g++){h=x[g];o.push(h.color.r*
+h.intensity);o.push(h.color.g*h.intensity);o.push(h.color.b*h.intensity);A.push(h.position.x);A.push(h.position.y);A.push(h.position.z)}if(x.length){b.uniform1i(d.directionalLightNumber,x.length);b.uniform3fv(d.directionalLightDirection,A);b.uniform3fv(d.directionalLightColor,o)}o=[];A=[];g=0;for(m=r.length;g<m;g++){h=r[g];o.push(h.color.r*h.intensity);o.push(h.color.g*h.intensity);o.push(h.color.b*h.intensity);A.push(h.position.x);A.push(h.position.y);A.push(h.position.z)}if(r.length){b.uniform1i(d.pointLightNumber,
+r.length);b.uniform3fv(d.pointLightPosition,A);b.uniform3fv(d.pointLightColor,o)}};this.createBuffers=function(e,g){var m,h,o,j,r,x,A,I,N,p=e.materialFaceGroup[g],s=[],i=[],T=[],K=[],W=[],D=0,B=false;m=0;for(h=e.material.length;m<h;m++){meshMaterial=e.material[m];if(meshMaterial instanceof THREE.MeshFaceMaterial){j=0;for(r=p.material.length;j<r;j++)if(p.material[j]&&p.material[j].shading!=undefined&&p.material[j].shading==THREE.SmoothShading){B=true;break}}else if(meshMaterial&&meshMaterial.shading!=
+undefined&&meshMaterial.shading==THREE.SmoothShading){B=true;break}if(B)break}m=0;for(h=p.faces.length;m<h;m++){o=p.faces[m];j=e.geometry.faces[o];r=j.vertexNormals;x=j.normal;o=e.geometry.uvs[o];if(j instanceof THREE.Face3){A=e.geometry.vertices[j.a].position;I=e.geometry.vertices[j.b].position;N=e.geometry.vertices[j.c].position;T.push(A.x,A.y,A.z);T.push(I.x,I.y,I.z);T.push(N.x,N.y,N.z);if(r.length==3&&B)for(j=0;j<3;j++)K.push(r[j].x,r[j].y,r[j].z);else for(j=0;j<3;j++)K.push(x.x,x.y,x.z);if(o)for(j=
+0;j<3;j++)W.push(o[j].u,o[j].v);s.push(D,D+1,D+2);i.push(D,D+1);i.push(D,D+2);i.push(D+1,D+2);D+=3}else if(j instanceof THREE.Face4){A=e.geometry.vertices[j.a].position;I=e.geometry.vertices[j.b].position;N=e.geometry.vertices[j.c].position;j=e.geometry.vertices[j.d].position;T.push(A.x,A.y,A.z);T.push(I.x,I.y,I.z);T.push(N.x,N.y,N.z);T.push(j.x,j.y,j.z);if(r.length==4&&B)for(j=0;j<4;j++)K.push(r[j].x,r[j].y,r[j].z);else for(j=0;j<4;j++)K.push(x.x,x.y,x.z);if(o)for(j=0;j<4;j++)W.push(o[j].u,o[j].v);
+s.push(D,D+1,D+2);s.push(D,D+2,D+3);i.push(D,D+1);i.push(D,D+2);i.push(D,D+3);i.push(D+1,D+2);i.push(D+2,D+3);D+=4}}if(T.length){p.__webGLVertexBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(T),b.STATIC_DRAW);p.__webGLNormalBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(K),b.STATIC_DRAW);p.__webGLUVBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,p.__webGLUVBuffer);
+b.bufferData(b.ARRAY_BUFFER,new Float32Array(W),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(i),b.STATIC_DRAW);p.__webGLFaceCount=s.length;p.__webGLLineCount=i.length}};this.renderBuffer=function(e,g){var m,h,o,j,r,x,A,I,
+N,p;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshBasicMaterial){m=e.color;h=e.opacity;j=e.wireframe;r=e.wireframe_linewidth;A=e.map;I=e.env_map;x=e.combine==THREE.Mix;o=e.reflectivity;p=e.env_map&&e.env_map.mapping==THREE.RefractionMap;N=e.refraction_ratio;b.uniform4f(d.mColor,m.r*h,m.g*h,m.b*h,h);b.uniform1i(d.mixEnvMap,x);b.uniform1f(d.mReflectivity,o);b.uniform1i(d.useRefract,p);b.uniform1f(d.mRefractionRatio,N)}if(e instanceof THREE.MeshNormalMaterial){h=
+e.opacity;b.uniform1f(d.mOpacity,h);b.uniform1i(d.material,4)}else if(e instanceof THREE.MeshDepthMaterial){h=e.opacity;j=e.wireframe;r=e.wireframe_linewidth;b.uniform1f(d.mOpacity,h);b.uniform1f(d.m2Near,e.__2near);b.uniform1f(d.mFarPlusNear,e.__farPlusNear);b.uniform1f(d.mFarMinusNear,e.__farMinusNear);b.uniform1i(d.material,3)}else if(e instanceof THREE.MeshPhongMaterial){m=e.ambient;o=e.specular;x=e.shininess;b.uniform4f(d.mAmbient,m.r,m.g,m.b,h);b.uniform4f(d.mSpecular,o.r,o.g,o.b,h);b.uniform1f(d.mShininess,
+x);b.uniform1i(d.material,2)}else if(e instanceof THREE.MeshLambertMaterial)b.uniform1i(d.material,1);else if(e instanceof THREE.MeshBasicMaterial)b.uniform1i(d.material,0);else if(e instanceof THREE.MeshCubeMaterial){b.uniform1i(d.material,5);I=e.env_map}if(A){if(!e.__webGLTexture&&e.map.image.loaded){e.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,e.__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,
+b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);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.__webGLTexture);b.uniform1i(d.tMap,0);b.uniform1i(d.enableMap,1)}else b.uniform1i(d.enableMap,0);if(I){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(h=0;h<6;++h)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.env_map.image[h]);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(d.tCube,1)}b.uniform1i(d.enableCubeMap,1)}else b.uniform1i(d.enableCubeMap,0);b.bindBuffer(b.ARRAY_BUFFER,g.__webGLVertexBuffer);b.vertexAttribPointer(d.position,
+3,b.FLOAT,false,0,0);b.bindBuffer(b.ARRAY_BUFFER,g.__webGLNormalBuffer);b.vertexAttribPointer(d.normal,3,b.FLOAT,false,0,0);if(A){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.enableVertexAttribArray(d.uv);b.vertexAttribPointer(d.uv,2,b.FLOAT,false,0,0)}else b.disableVertexAttribArray(d.uv);if(j){b.lineWidth(r);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.drawElements(b.LINES,g.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,
+g.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(e,g,m){var h,o,j,r,x;j=0;for(r=e.material.length;j<r;j++){h=e.material[j];if(h instanceof THREE.MeshFaceMaterial){h=0;for(o=g.material.length;h<o;h++)if((x=g.material[h])&&x.blending==m){this.setBlending(x.blending);this.renderBuffer(x,g)}}else if((x=h)&&x.blending==m){this.setBlending(x.blending);this.renderBuffer(x,g)}}};this.render=function(e,g){var m,h;this.initWebGLObjects(e);this.autoClear&&this.clear();g.autoUpdateMatrix&&g.updateMatrix();
+b.uniform3f(d.cameraPosition,g.position.x,g.position.y,g.position.z);this.setupLights(e);m=0;for(h=e.__webGLObjects.length;m<h;m++){webGLObject=e.__webGLObjects[m];this.setupMatrices(webGLObject.__object,g);this.renderPass(webGLObject.__object,webGLObject,THREE.NormalBlending)}m=0;for(h=e.__webGLObjects.length;m<h;m++){webGLObject=e.__webGLObjects[m];this.setupMatrices(webGLObject.__object,g);this.renderPass(webGLObject.__object,webGLObject,THREE.AdditiveBlending);this.renderPass(webGLObject.__object,
+webGLObject,THREE.SubtractiveBlending)}};this.initWebGLObjects=function(e){var g,m,h,o,j;if(!e.__webGLObjects)e.__webGLObjects=[];g=0;for(m=e.objects.length;g<m;g++){h=e.objects[g];if(h instanceof THREE.Mesh)for(o in h.materialFaceGroup){j=h.materialFaceGroup[o];if(!j.__webGLVertexBuffer){this.createBuffers(h,o);j.__object=h;e.__webGLObjects.push(j)}}}};this.setupMatrices=function(e,g){e.autoUpdateMatrix&&e.updateMatrix();k.multiply(g.matrix,e.matrix);d.viewMatrixArray=new Float32Array(g.matrix.flatten());
+d.modelViewMatrixArray=new Float32Array(k.flatten());d.projectionMatrixArray=new Float32Array(g.projectionMatrix.flatten());n=THREE.Matrix4.makeInvert3x3(k).transpose();d.normalMatrixArray=new Float32Array(n.m);b.uniformMatrix4fv(d.viewMatrix,false,d.viewMatrixArray);b.uniformMatrix4fv(d.modelViewMatrix,false,d.modelViewMatrixArray);b.uniformMatrix4fv(d.projectionMatrix,false,d.projectionMatrixArray);b.uniformMatrix3fv(d.normalMatrix,false,d.normalMatrixArray);b.uniformMatrix4fv(d.objMatrix,false,
+new Float32Array(e.matrix.flatten()))};this.setBlending=function(e){switch(e){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(e,g){if(e){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="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.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.material=this.color=this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.v4=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.material=this.color=this.z=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=this.color=null};
 THREE.RenderableLine=function(){this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.material=this.color=this.z=null};

+ 7 - 7
examples/geometry_vr.html

@@ -69,12 +69,12 @@
 				context.fillRect( 0, 0, texture_placeholder.width, texture_placeholder.height );
 
 				var materials = [];
-				materials.push( [ loadTexture( 'textures/skymap_px.jpg' ), wireframe ] ); // right
-				materials.push( [ loadTexture( 'textures/skymap_nx.jpg' ), wireframe ] ); // left
-				materials.push( [ loadTexture( 'textures/skymap_py.jpg' ), wireframe ] ); // top
-				materials.push( [ loadTexture( 'textures/skymap_ny.jpg' ), wireframe ] ); // bottom
-				materials.push( [ loadTexture( 'textures/skymap_pz.jpg' ), wireframe ] ); // back
-				materials.push( [ loadTexture( 'textures/skymap_nz.jpg' ), wireframe ] ); // front
+				materials.push( [ loadTexture( 'textures/cube/skybox/px.jpg' ), wireframe ] ); // right
+				materials.push( [ loadTexture( 'textures/cube/skybox/nx.jpg' ), wireframe ] ); // left
+				materials.push( [ loadTexture( 'textures/cube/skybox/py.jpg' ), wireframe ] ); // top
+				materials.push( [ loadTexture( 'textures/cube/skybox/ny.jpg' ), wireframe ] ); // bottom
+				materials.push( [ loadTexture( 'textures/cube/skybox/pz.jpg' ), wireframe ] ); // back
+				materials.push( [ loadTexture( 'textures/cube/skybox/nz.jpg' ), wireframe ] ); // front
 
 				mesh = new THREE.Mesh( new Cube( 300, 300, 300, 7, 7, materials, true ), new THREE.MeshFaceMaterial() );
 				mesh.overdraw = true;
@@ -198,7 +198,7 @@
 
 				lat = Math.max( - 85, Math.min( 85, lat ) );
 				phi = ( 90 - lat ) * Math.PI / 180;
-				theta = ( lon + 180 ) * Math.PI / 180;
+				theta = lon * Math.PI / 180;
 
 				camera.target.position.x = 500 * Math.sin( phi ) * Math.cos( theta );
 				camera.target.position.y = 500 * Math.cos( phi );

+ 8 - 7
examples/materials_cubemap.html

@@ -94,15 +94,16 @@
 				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
 				scene.addObject(lightMesh);
 
-				// material samples
-				var r = "textures/cube/SwedishRoyalCastle/";
-
-				var urls = [ r + "px.jpg", r + "nx.jpg", 
-							 r + "py.jpg", r + "ny.jpg", 
-							 r + "pz.jpg", r + "nz.jpg" ];
+				var path = "textures/cube/SwedishRoyalCastle/";
+				var format = '.jpg';
+				var urls = [
+						path + 'px' + format, path + 'nx' + format,
+						path + 'py' + format, path + 'ny' + format,
+						path + 'pz' + format, path + 'nz' + format
+					];
 
 				var images = ImageUtils.loadArray( urls );
-				
+
 				var reflectionCube = new THREE.TextureCube( images );
 				var refractionCube = new THREE.TextureCube( images, THREE.RefractionMap );
 				

+ 11 - 5
examples/materials_cubemap_sky.html → examples/materials_cubemap_balls_reflection.html

@@ -30,7 +30,7 @@
 	</head>
 
 	<body>
-		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl cube reflection demo. skybox by <a href="http://www.zfight.com/" target="_blank">Jochum Skoglund</a></div>
+		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl cube reflection demo. skybox by <a href="http://ict.debevec.org/~debevec/" target="_blank">Paul Debevec</a></div>
 
 		<script type="text/javascript" src="../build/Three.js"></script> 
 
@@ -91,15 +91,21 @@
 
 					// Merging spheres in a single geometry
 					GeometryUtils.merge( geometry, sphere );
+
 				}
 
-				var r = "textures/skymap_";
-				var urls = [ r + "px.jpg", r + "nx.jpg", 
-					 r + "py.jpg", r + "ny.jpg", 
-					 r + "nz.jpg", r + "pz.jpg" ];
+				var path = "textures/cube/pisa/";
+				var format = '.png';
+				var urls = [
+						path + 'px' + format, path + 'nx' + format,
+						path + 'py' + format, path + 'ny' + format,
+						path + 'pz' + format, path + 'nz' + format
+					];
 
 				var images = ImageUtils.loadArray( urls );
 				var textureCube = new THREE.TextureCube( images );
+				// var textureCube = new THREE.TextureCube( images, THREE.RefractionMap );
+
 				var material = new THREE.MeshBasicMaterial( { color: 0xffffff, env_map: textureCube } );
 
 				var mesh = new THREE.Mesh( geometry, material );

+ 7 - 4
examples/materials_cubemap_sky_refraction.html → examples/materials_cubemap_balls_refraction.html

@@ -93,10 +93,13 @@
 					GeometryUtils.merge( geometry, sphere );
 				}
 
-				var r = "textures/skymap_";
-				var urls = [ r + "px.jpg", r + "nx.jpg", 
-					 r + "py.jpg", r + "ny.jpg", 
-					 r + "nz.jpg", r + "pz.jpg" ];
+				var path = "textures/cube/skybox/";
+				var format = '.jpg';
+				var urls = [
+						path + 'px' + format, path + 'nx' + format,
+						path + 'py' + format, path + 'ny' + format,
+						path + 'pz' + format, path + 'nz' + format
+					];
 
 				var images = ImageUtils.loadArray( urls );
 				var textureCube = new THREE.TextureCube( images, THREE.RefractionMap );

BIN
examples/textures/cube/pisa/nx.png


BIN
examples/textures/cube/pisa/ny.png


BIN
examples/textures/cube/pisa/nz.png


BIN
examples/textures/cube/pisa/px.png


BIN
examples/textures/cube/pisa/py.png


BIN
examples/textures/cube/pisa/pz.png


+ 0 - 0
examples/textures/skymap_nx.jpg → examples/textures/cube/skybox/nx.jpg


+ 0 - 0
examples/textures/skymap_ny.jpg → examples/textures/cube/skybox/ny.jpg


+ 0 - 0
examples/textures/skymap_pz.jpg → examples/textures/cube/skybox/nz.jpg


+ 0 - 0
examples/textures/skymap_px.jpg → examples/textures/cube/skybox/px.jpg


+ 0 - 0
examples/textures/skymap_py.jpg → examples/textures/cube/skybox/py.jpg


+ 0 - 0
examples/textures/skymap_nz.jpg → examples/textures/cube/skybox/pz.jpg


BIN
examples/textures/cube/skybox_test/nx.jpg


BIN
examples/textures/cube/skybox_test/ny.jpg


BIN
examples/textures/cube/skybox_test/nz.jpg


BIN
examples/textures/cube/skybox_test/px.jpg


BIN
examples/textures/cube/skybox_test/py.jpg


BIN
examples/textures/cube/skybox_test/pz.jpg


+ 6 - 6
src/extras/primitives/Cube.js

@@ -37,12 +37,12 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
 
 	}
 
-	buildPlane( 'z', 'y', - 1 * flip, - 1, depth, height, width_half, this.materials[ 0 ] ); // right
-	buildPlane( 'z', 'y',   1 * flip, - 1, depth, height, - width_half, this.materials[ 1 ] ); // left
-	buildPlane( 'x', 'z', - 1 * flip, - 1, width, depth, height_half, this.materials[ 2 ] ); // top
-	buildPlane( 'x', 'z', - 1 * flip,   1, width, depth, - height_half, this.materials[ 3 ] ); // bottom
-	buildPlane( 'x', 'y',   1 * flip, - 1, width, height, depth_half, this.materials[ 4 ] ); // back
-	buildPlane( 'x', 'y', - 1 * flip, - 1, width, height, - depth_half, this.materials[ 5 ] ); // front
+	buildPlane( 'z', 'y',   1 * flip, - 1, depth, height, - width_half, this.materials[ 0 ] ); // px
+	buildPlane( 'z', 'y', - 1 * flip, - 1, depth, height, width_half, this.materials[ 1 ] ); // nx
+	buildPlane( 'x', 'z',   1 * flip,   1, width, depth, height_half, this.materials[ 2 ] ); // py
+	buildPlane( 'x', 'z',   1 * flip, - 1, width, depth, - height_half, this.materials[ 3 ] ); // ny
+	buildPlane( 'x', 'y',   1 * flip, - 1, width, height, depth_half, this.materials[ 4 ] ); // pz
+	buildPlane( 'x', 'y', - 1 * flip, - 1, width, height, - depth_half, this.materials[ 5 ] ); // nz
 
 	mergeVertices();
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 246 - 241
src/renderers/WebGLRenderer.js


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است