Browse Source

Merged zz85's Shape / Path / Curve / ExtrudeGeometry updates.

Renamed StraightCurve => LineCurve.
Some white space and comments cleanup.
alteredq 14 years ago
parent
commit
0cefeed567

+ 387 - 366
build/Three.js

@@ -1,7 +1,7 @@
 // Three.js r42 - http://github.com/mrdoob/three.js
 // Three.js r42 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)};
 var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)};
-THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,k,h,m,n;if(e==0)f=g=k=0;else switch(h=Math.floor(b*6),m=b*6-h,b=e*(1-c),n=e*(1-c*m),c=e*(1-c*(1-m)),h){case 1:f=n;g=e;k=b;break;case 2:f=b;g=e;k=c;break;case 3:f=b;g=n;k=e;break;case 4:f=c;g=b;k=e;break;case 5:f=e;g=b;k=n;break;case 6:case 0:f=e,g=c,k=b}this.setRGB(f,
-g,k)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
+THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,h,j,m,n;if(e==0)f=g=h=0;else switch(j=Math.floor(b*6),m=b*6-j,b=e*(1-c),n=e*(1-c*m),c=e*(1-c*(1-m)),j){case 1:f=n;g=e;h=b;break;case 2:f=b;g=e;h=c;break;case 3:f=b;g=n;h=e;break;case 4:f=c;g=b;h=e;break;case 5:f=e;g=b;h=n;break;case 6:case 0:f=e,g=c,h=b}this.setRGB(f,
+g,h)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
 THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b?
 THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b?
 (this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
 (this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
 unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.set(b||0,c||0,e||0)};
 unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.set(b||0,c||0,e||0)};
@@ -14,67 +14,67 @@ THREE.Vector4.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w
 b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
 b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
 setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f,c=c.matrixWorld.getPosition();f=c.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),c=c.clone().subSelf(e),
 THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f,c=c.matrixWorld.getPosition();f=c.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),c=c.clone().subSelf(e),
-g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,k,h,m,n,p,o,t,u,v,x=b.geometry,
-B=x.vertices,A=[],f=0;for(g=x.faces.length;f<g;f++)if(k=x.faces[f],u=this.origin.clone(),v=this.direction.clone(),p=b.matrixWorld,h=p.multiplyVector3(B[k.a].position.clone()),m=p.multiplyVector3(B[k.b].position.clone()),n=p.multiplyVector3(B[k.c].position.clone()),p=k instanceof THREE.Face4?p.multiplyVector3(B[k.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),t=v.dot(o),b.doubleSided||(b.flipSided?t>0:t<0))if(o=o.dot((new THREE.Vector3).sub(h,u))/t,u=u.addSelf(v.multiplyScalar(o)),
-k instanceof THREE.Face3)e(u,h,m,n)&&(k={distance:this.origin.distanceTo(u),point:u,face:k,object:b},A.push(k));else if(k instanceof THREE.Face4&&(e(u,h,m,p)||e(u,m,n,p)))k={distance:this.origin.distanceTo(u),point:u,face:k,object:b},A.push(k);return A}else return[]}};
-THREE.Rectangle=function(){function b(){k=f-c;h=g-e}var c,e,f,g,k,h,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,k,o,t){m=!1;c=h;e=k;f=o;g=t;b()};this.addPoint=function(h,k){m?(m=!1,c=h,e=k,f=h,g=k):(c=c<h?c:h,e=e<k?e:k,f=f>h?f:h,g=g>k?g:k);b()};this.add3Points=
-function(h,k,o,t,u,v){m?(m=!1,c=h<o?h<u?h:u:o<u?o:u,e=k<t?k<v?k:v:t<v?t:v,f=h>o?h>u?h:u:o>u?o:u,g=k>t?k>v?k:v:t>v?t:v):(c=h<o?h<u?h<c?h:c:u<c?u:c:o<u?o<c?o:c:u<c?u:c,e=k<t?k<v?k<e?k:e:v<e?v:e:t<v?t<e?t:e:v<e?v:e,f=h>o?h>u?h>f?h:f:u>f?u:f:o>u?o>f?o:f:u>f?u:f,g=k>t?k>v?k>g?k:g:v>g?v:g:t>v?t>g?t:g:v>g?v:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
+g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,h,j,m,n,p,o,u,v,w,x=b.geometry,
+y=x.vertices,D=[],f=0;for(g=x.faces.length;f<g;f++)if(h=x.faces[f],v=this.origin.clone(),w=this.direction.clone(),p=b.matrixWorld,j=p.multiplyVector3(y[h.a].position.clone()),m=p.multiplyVector3(y[h.b].position.clone()),n=p.multiplyVector3(y[h.c].position.clone()),p=h instanceof THREE.Face4?p.multiplyVector3(y[h.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),u=w.dot(o),b.doubleSided||(b.flipSided?u>0:u<0))if(o=o.dot((new THREE.Vector3).sub(j,v))/u,v=v.addSelf(w.multiplyScalar(o)),
+h instanceof THREE.Face3)e(v,j,m,n)&&(h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},D.push(h));else if(h instanceof THREE.Face4&&(e(v,j,m,p)||e(v,m,n,p)))h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},D.push(h);return D}else return[]}};
+THREE.Rectangle=function(){function b(){h=f-c;j=g-e}var c,e,f,g,h,j,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,j,o,u){m=!1;c=h;e=j;f=o;g=u;b()};this.addPoint=function(h,j){m?(m=!1,c=h,e=j,f=h,g=j):(c=c<h?c:h,e=e<j?e:j,f=f>h?f:h,g=g>j?g:j);b()};this.add3Points=
+function(h,j,o,u,v,w){m?(m=!1,c=h<o?h<v?h:v:o<v?o:v,e=j<u?j<w?j:w:u<w?u:w,f=h>o?h>v?h:v:o>v?o:v,g=j>u?j>w?j:w:u>w?u:w):(c=h<o?h<v?h<c?h:c:v<c?v:c:o<v?o<c?o:c:v<c?v:c,e=j<u?j<w?j<e?j:e:w<e?w:e:u<w?u<e?u:e:w<e?w:e,f=h>o?h>v?h>f?h:f:v>f?v:f:o>v?o>f?o:f:v>f?v:f,g=j>u?j>w?j>g?j:g:w>g?w:g:u>w?u>g?u:g:w>g?w:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
 h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
 h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,k,h,m,n,p,o,t,u,v,x,B){this.set(b||1,c||0,e||0,f||0,g||0,k||1,h||0,m||0,n||0,p||0,o||1,t||0,u||0,v||0,x||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,c,e,f,g,k,h,m,n,p,o,t,u,v,x,B){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=k;this.n23=h;this.n24=m;this.n31=n;this.n32=p;this.n33=o;this.n34=t;this.n41=u;this.n42=v;this.n43=x;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=THREE.Matrix4.__v1,
-g=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());g.cross(k,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=k.x;this.n21=f.y;this.n22=g.y;this.n23=k.y;this.n31=f.z;this.n32=g.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
+THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,h,j,m,n,p,o,u,v,w,x,y){this.set(b||1,c||0,e||0,f||0,g||0,h||1,j||0,m||0,n||0,p||0,o||1,u||0,v||0,w||0,x||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,c,e,f,g,h,j,m,n,p,o,u,v,w,x,y){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=m;this.n31=n;this.n32=p;this.n33=o;this.n34=u;this.n41=v;this.n42=w;this.n43=x;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=THREE.Matrix4.__v1,
+g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(e,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(e,h).normalize());g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
 f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize();
 f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize();
-return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,k=b.n14,h=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,u=b.n33,v=b.n34,x=b.n41,B=b.n42,A=b.n43,y=b.n44,F=c.n11,w=c.n12,H=c.n13,E=c.n14,D=c.n21,S=c.n22,
-J=c.n23,G=c.n24,U=c.n31,W=c.n32,M=c.n33,X=c.n34,T=c.n41,R=c.n42,j=c.n43,fa=c.n44;this.n11=e*F+f*D+g*U+k*T;this.n12=e*w+f*S+g*W+k*R;this.n13=e*H+f*J+g*M+k*j;this.n14=e*E+f*G+g*X+k*fa;this.n21=h*F+m*D+n*U+p*T;this.n22=h*w+m*S+n*W+p*R;this.n23=h*H+m*J+n*M+p*j;this.n24=h*E+m*G+n*X+p*fa;this.n31=o*F+t*D+u*U+v*T;this.n32=o*w+t*S+u*W+v*R;this.n33=o*H+t*J+u*M+v*j;this.n34=o*E+t*G+u*X+v*fa;this.n41=x*F+B*D+A*U+y*T;this.n42=x*w+B*S+A*W+y*R;this.n43=x*H+B*J+A*M+y*j;this.n44=x*E+B*G+A*X+y*fa;return this},multiplyToArray:function(b,
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,u=b.n32,v=b.n33,w=b.n34,x=b.n41,y=b.n42,D=b.n43,A=b.n44,H=c.n11,C=c.n12,E=c.n13,I=c.n14,J=c.n21,S=c.n22,
+R=c.n23,N=c.n24,F=c.n31,W=c.n32,K=c.n33,X=c.n34,Q=c.n41,U=c.n42,k=c.n43,ia=c.n44;this.n11=e*H+f*J+g*F+h*Q;this.n12=e*C+f*S+g*W+h*U;this.n13=e*E+f*R+g*K+h*k;this.n14=e*I+f*N+g*X+h*ia;this.n21=j*H+m*J+n*F+p*Q;this.n22=j*C+m*S+n*W+p*U;this.n23=j*E+m*R+n*K+p*k;this.n24=j*I+m*N+n*X+p*ia;this.n31=o*H+u*J+v*F+w*Q;this.n32=o*C+u*S+v*W+w*U;this.n33=o*E+u*R+v*K+w*k;this.n34=o*I+u*N+v*X+w*ia;this.n41=x*H+y*J+D*F+A*Q;this.n42=x*C+y*S+D*W+A*U;this.n43=x*E+y*R+D*K+A*k;this.n44=x*I+y*N+D*X+A*ia;return this},multiplyToArray:function(b,
 c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=
 c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=
-b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,k=this.n22,h=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,t=this.n34,u=this.n41,v=this.n42,x=this.n43,B=this.n44;return f*h*p*u-e*m*p*u-f*k*o*u+c*m*o*u+e*k*t*u-c*h*t*u-f*h*n*v+e*m*n*v+f*g*o*v-b*m*o*v-e*g*t*v+b*h*t*v+f*k*n*x-c*m*n*x-f*g*p*x+b*m*p*x+c*g*t*x-b*k*t*x-e*k*n*B+c*h*n*B+e*g*p*B-b*h*p*B-c*g*o*B+b*k*o*B},transpose:function(){var b;b=this.n21;this.n21=
+b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,u=this.n34,v=this.n41,w=this.n42,x=this.n43,y=this.n44;return f*j*p*v-e*m*p*v-f*h*o*v+c*m*o*v+e*h*u*v-c*j*u*v-f*j*n*w+e*m*n*w+f*g*o*w-b*m*o*w-e*g*u*w+b*j*u*w+f*h*n*x-c*m*n*x-f*g*p*x+b*m*p*x+c*g*u*x-b*h*u*x-e*h*n*y+c*j*n*y+e*g*p*y-b*j*p*y-c*g*o*y+b*h*o*y},transpose:function(){var b;b=this.n21;this.n21=
 this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=
 this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=
 this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=
 this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=
 this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,
 this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,
 c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,
 c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,
-c){var e=Math.cos(c),f=Math.sin(c),g=1-e,k=b.x,h=b.y,m=b.z,n=g*k,p=g*h;this.set(n*k+e,n*h-f*m,n*m+f*h,0,n*h+f*m,p*h+e,p*m-f*k,0,n*m-f*h,p*m+f*k,g*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);
-return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,k=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var n=h*m,p=h*g,o=f*m,t=f*g;this.n11=n+t*e;this.n12=
-o*e-p;this.n13=k*f;this.n21=k*g;this.n22=k*m;this.n23=-e;this.n31=p*e-o;this.n32=t+n*e;this.n33=k*h;break;case "ZXY":n=h*m;p=h*g;o=f*m;t=f*g;this.n11=n-t*e;this.n12=-k*g;this.n13=o+p*e;this.n21=p+o*e;this.n22=k*m;this.n23=t-n*e;this.n31=-k*f;this.n32=e;this.n33=k*h;break;case "ZYX":n=k*m;p=k*g;o=e*m;t=e*g;this.n11=h*m;this.n12=o*f-p;this.n13=n*f+t;this.n21=h*g;this.n22=t*f+n;this.n23=p*f-o;this.n31=-f;this.n32=e*h;this.n33=k*h;break;case "YZX":n=k*h;p=k*f;o=e*h;t=e*f;this.n11=h*m;this.n12=t-n*g;this.n13=
-o*g+p;this.n21=g;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*g+o;this.n33=n-t*g;break;case "XZY":n=k*h;p=k*f;o=e*h;t=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=n*g+t;this.n22=k*m;this.n23=p*g-o;this.n31=o*g-p;this.n32=e*m;this.n33=t*g+n;break;default:n=k*m,p=k*g,o=e*m,t=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=p+o*f,this.n22=n-t*f,this.n23=-e*h,this.n31=t-n*f,this.n32=o+p*f,this.n33=k*h}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,k=c+c,
-h=e+e,m=f+f,b=c*k,n=c*h;c*=m;var p=e*h;e*=m;f*=m;k*=g;h*=g;g*=m;this.n11=1-(p+f);this.n12=n-g;this.n13=c+h;this.n21=n+g;this.n22=1-(b+f);this.n23=e-k;this.n31=c-h;this.n32=e+k;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,
+c){var e=Math.cos(c),f=Math.sin(c),g=1-e,h=b.x,j=b.y,m=b.z,n=g*h,p=g*j;this.set(n*h+e,n*j-f*m,n*m+f*j,0,n*j+f*m,p*j+e,p*m-f*h,0,n*m-f*j,p*m+f*h,g*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);
+return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,h=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var n=j*m,p=j*g,o=f*m,u=f*g;this.n11=n+u*e;this.n12=
+o*e-p;this.n13=h*f;this.n21=h*g;this.n22=h*m;this.n23=-e;this.n31=p*e-o;this.n32=u+n*e;this.n33=h*j;break;case "ZXY":n=j*m;p=j*g;o=f*m;u=f*g;this.n11=n-u*e;this.n12=-h*g;this.n13=o+p*e;this.n21=p+o*e;this.n22=h*m;this.n23=u-n*e;this.n31=-h*f;this.n32=e;this.n33=h*j;break;case "ZYX":n=h*m;p=h*g;o=e*m;u=e*g;this.n11=j*m;this.n12=o*f-p;this.n13=n*f+u;this.n21=j*g;this.n22=u*f+n;this.n23=p*f-o;this.n31=-f;this.n32=e*j;this.n33=h*j;break;case "YZX":n=h*j;p=h*f;o=e*j;u=e*f;this.n11=j*m;this.n12=u-n*g;this.n13=
+o*g+p;this.n21=g;this.n22=h*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*g+o;this.n33=n-u*g;break;case "XZY":n=h*j;p=h*f;o=e*j;u=e*f;this.n11=j*m;this.n12=-g;this.n13=f*m;this.n21=n*g+u;this.n22=h*m;this.n23=p*g-o;this.n31=o*g-p;this.n32=e*m;this.n33=u*g+n;break;default:n=h*m,p=h*g,o=e*m,u=e*g,this.n11=j*m,this.n12=-j*g,this.n13=f,this.n21=p+o*f,this.n22=n-u*f,this.n23=-e*j,this.n31=u-n*f,this.n32=o+p*f,this.n33=h*j}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,h=c+c,
+j=e+e,m=f+f,b=c*h,n=c*j;c*=m;var p=e*j;e*=m;f*=m;h*=g;j*=g;g*=m;this.n11=1-(p+f);this.n12=n-g;this.n13=c+j;this.n21=n+g;this.n22=1-(b+f);this.n23=e-h;this.n31=c-j;this.n32=e+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,
 c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
 c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,k=b.n14,h=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,u=b.n33,v=b.n34,x=b.n41,B=b.n42,A=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*v*B-p*u*B+p*t*A-m*v*A-n*t*y+m*u*y;c.n12=k*u*B-g*v*B-k*t*A+f*v*A+g*t*y-f*u*y;c.n13=g*p*B-k*n*B+k*m*A-f*p*A-g*m*y+f*n*y;c.n14=k*n*t-g*p*t-k*m*u+f*p*u+g*m*v-f*n*v;c.n21=p*u*x-n*v*x-p*o*A+h*v*A+n*o*y-h*u*y;c.n22=g*v*x-k*u*x+k*o*A-e*v*A-g*o*y+e*u*y;c.n23=k*n*x-g*p*x-k*h*A+e*p*A+g*h*y-e*n*y;c.n24=
-g*p*o-k*n*o+k*h*u-e*p*u-g*h*v+e*n*v;c.n31=m*v*x-p*t*x+p*o*B-h*v*B-m*o*y+h*t*y;c.n32=k*t*x-f*v*x-k*o*B+e*v*B+f*o*y-e*t*y;c.n33=g*p*x-k*m*x+k*h*B-e*p*B-f*h*y+e*m*y;c.n34=k*m*o-f*p*o-k*h*t+e*p*t+f*h*v-e*m*v;c.n41=n*t*x-m*u*x-n*o*B+h*u*B+m*o*A-h*t*A;c.n42=f*u*x-g*t*x+g*o*B-e*u*B-f*o*A+e*t*A;c.n43=g*m*x-f*n*x-g*h*B+e*n*B+f*h*A-e*m*A;c.n44=f*n*o-g*m*o+g*h*t-e*n*t-f*h*u+e*m*u;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*k;e[3]=b*h;e[4]=b*m;e[5]=b*n;e[6]=b*p;e[7]=b*o;e[8]=b*t;return c};
-THREE.Matrix4.makeFrustum=function(b,c,e,f,g,k){var h;h=new THREE.Matrix4;h.n11=2*g/(c-b);h.n12=0;h.n13=(c+b)/(c-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(k+g)/(k-g);h.n34=-2*k*g/(k-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
-THREE.Matrix4.makeOrtho=function(b,c,e,f,g,k){var h,m,n,p;h=new THREE.Matrix4;m=c-b;n=e-f;p=k-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);h.n21=0;h.n22=2/n;h.n23=0;h.n24=-((e+f)/n);h.n31=0;h.n32=0;h.n33=-2/p;h.n34=-((k+g)/p);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,u=b.n32,v=b.n33,w=b.n34,x=b.n41,y=b.n42,D=b.n43,A=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*w*y-p*v*y+p*u*D-m*w*D-n*u*A+m*v*A;c.n12=h*v*y-g*w*y-h*u*D+f*w*D+g*u*A-f*v*A;c.n13=g*p*y-h*n*y+h*m*D-f*p*D-g*m*A+f*n*A;c.n14=h*n*u-g*p*u-h*m*v+f*p*v+g*m*w-f*n*w;c.n21=p*v*x-n*w*x-p*o*D+j*w*D+n*o*A-j*v*A;c.n22=g*w*x-h*v*x+h*o*D-e*w*D-g*o*A+e*v*A;c.n23=h*n*x-g*p*x-h*j*D+e*p*D+g*j*A-e*n*A;c.n24=
+g*p*o-h*n*o+h*j*v-e*p*v-g*j*w+e*n*w;c.n31=m*w*x-p*u*x+p*o*y-j*w*y-m*o*A+j*u*A;c.n32=h*u*x-f*w*x-h*o*y+e*w*y+f*o*A-e*u*A;c.n33=g*p*x-h*m*x+h*j*y-e*p*y-f*j*A+e*m*A;c.n34=h*m*o-f*p*o-h*j*u+e*p*u+f*j*w-e*m*w;c.n41=n*u*x-m*v*x-n*o*y+j*v*y+m*o*D-j*u*D;c.n42=f*v*x-g*u*x+g*o*y-e*v*y-f*o*D+e*u*D;c.n43=g*m*x-f*n*x-g*j*y+e*n*y+f*j*D-e*m*D;c.n44=f*n*o-g*m*o+g*j*u-e*n*u-f*j*v+e*m*v;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*h;e[3]=b*j;e[4]=b*m;e[5]=b*n;e[6]=b*p;e[7]=b*o;e[8]=b*u;return c};
+THREE.Matrix4.makeFrustum=function(b,c,e,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*g/(f-e);j.n23=(f+e)/(f-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
+THREE.Matrix4.makeOrtho=function(b,c,e,f,g,h){var j,m,n,p;j=new THREE.Matrix4;m=c-b;n=e-f;p=h-g;j.n11=2/m;j.n12=0;j.n13=0;j.n14=-((c+b)/m);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((e+f)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
 THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
 this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
 this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
 THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
 -1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,g;e=0;for(f=this.children.length;e<f;e++){g=this.children[e];if(g.name===b)return g;if(c&&(g=g.getChildByName(b,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);
 -1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,g;e=0;for(f=this.children.length;e<f;e++){g=this.children[e];if(g.name===b)return g;if(c&&(g=g.getChildByName(b,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
 this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
 this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
-THREE.Quaternion.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),k=Math.cos(e),e=Math.sin(e),h=b*c,m=f*g;this.w=h*k-m*e;this.x=h*e+m*k;this.y=f*c*k+b*g*e;this.z=b*g*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
+THREE.Quaternion.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),h=Math.cos(e),e=Math.sin(e),j=b*c,m=f*g;this.w=j*h-m*e;this.x=j*e+m*h;this.y=f*c*h+b*g*e;this.z=b*g*h-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
 f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
 f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
-multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,k=b.x,h=b.y,m=b.z,b=b.w;this.x=c*b+g*k+e*m-f*h;this.y=e*b+g*h+f*k-c*m;this.z=f*b+g*m+c*h-e*k;this.w=g*b-c*k-e*h-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,k=this.x,h=this.y,m=this.z,n=this.w,p=n*e+h*g-m*f,o=
-n*f+m*e-k*g,t=n*g+k*f-h*e,e=-k*e-h*f-m*g;c.x=p*n+e*-k+o*-m-t*-h;c.y=o*n+e*-h+t*-k-p*-m;c.z=t*n+e*-m+p*-h-o*-k;return c}};
-THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*k)/h;f=Math.sin(f*k)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
-THREE.Face3=function(b,c,e,f,g,k){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};
-THREE.Face4=function(b,c,e,f,g,k,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
+multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,h=b.x,j=b.y,m=b.z,b=b.w;this.x=c*b+g*h+e*m-f*j;this.y=e*b+g*j+f*h-c*m;this.z=f*b+g*m+c*j-e*h;this.w=g*b-c*h-e*j-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,h=this.x,j=this.y,m=this.z,n=this.w,p=n*e+j*g-m*f,o=
+n*f+m*e-h*g,u=n*g+h*f-j*e,e=-h*e-j*f-m*g;c.x=p*n+e*-h+o*-m-u*-j;c.y=o*n+e*-j+u*-h-p*-m;c.z=u*n+e*-m+p*-j-o*-h;return c}};
+THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Face3=function(b,c,e,f,g,h){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
+THREE.Face4=function(b,c,e,f,g,h,j){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
 THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
 THREE.Geometry.prototype={computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
-e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,k,h,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){k=this.faces[f];if(b&&k.vertexNormals.length){m.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)m.addSelf(k.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],h=this.vertices[k.c],m.sub(h.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
-m.normalize();k.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
+e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,h,j,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){m.set(0,0,0);c=0;for(e=h.vertexNormals.length;c<e;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[h.a],e=this.vertices[h.b],j=this.vertices[h.c],m.sub(j.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
+m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,j,g,k){m=b.vertices[e].position;n=b.vertices[c].position;p=b.vertices[f].position;o=h[j];t=h[g];u=h[k];v=n.x-m.x;x=p.x-m.x;B=n.y-m.y;A=p.y-m.y;y=n.z-m.z;F=p.z-m.z;w=t.u-o.u;H=u.u-o.u;E=t.v-o.v;D=u.v-o.v;S=1/(w*D-H*E);W.set((D*v-E*x)*
-S,(D*B-E*A)*S,(D*y-E*F)*S);M.set((w*x-H*v)*S,(w*A-H*B)*S,(w*F-H*y)*S);G[e].addSelf(W);G[c].addSelf(W);G[f].addSelf(W);U[e].addSelf(M);U[c].addSelf(M);U[f].addSelf(M)}var c,e,f,g,k,h,m,n,p,o,t,u,v,x,B,A,y,F,w,H,E,D,S,J,G=[],U=[],W=new THREE.Vector3,M=new THREE.Vector3,X=new THREE.Vector3,T=new THREE.Vector3,R=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)G[c]=new THREE.Vector3,U[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],h=this.faceVertexUvs[0][c],k instanceof
-THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var j=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)R.copy(k.vertexNormals[f]),g=k[j[f]],J=G[g],X.copy(J),X.subSelf(R.multiplyScalar(R.dot(J))).normalize(),T.cross(k.vertexNormals[f],J),g=T.dot(U[g]),g=g<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(X.x,X.y,X.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,g,h,k){m=b.vertices[e].position;n=b.vertices[c].position;p=b.vertices[f].position;o=j[g];u=j[h];v=j[k];w=n.x-m.x;x=p.x-m.x;y=n.y-m.y;D=p.y-m.y;A=n.z-m.z;H=p.z-m.z;C=u.u-o.u;E=v.u-o.u;I=u.v-o.v;J=v.v-o.v;S=1/(C*J-E*I);W.set((J*w-I*x)*
+S,(J*y-I*D)*S,(J*A-I*H)*S);K.set((C*x-E*w)*S,(C*D-E*y)*S,(C*H-E*A)*S);N[e].addSelf(W);N[c].addSelf(W);N[f].addSelf(W);F[e].addSelf(K);F[c].addSelf(K);F[f].addSelf(K)}var c,e,f,g,h,j,m,n,p,o,u,v,w,x,y,D,A,H,C,E,I,J,S,R,N=[],F=[],W=new THREE.Vector3,K=new THREE.Vector3,X=new THREE.Vector3,Q=new THREE.Vector3,U=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)N[c]=new THREE.Vector3,F[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)h=this.faces[c],j=this.faceVertexUvs[0][c],h instanceof
+THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var k=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)U.copy(h.vertexNormals[f]),g=h[k[f]],R=N[g],X.copy(R),X.subSelf(U.multiplyScalar(U.dot(R))).normalize(),Q.cross(h.vertexNormals[f],R),g=Q.dot(F[g]),g=g<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(X.x,X.y,X.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
-void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,k,h,m={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.a,h.c),c(m,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),c(m,g,e),g=b(h.a,h.b),c(m,g,e),g=b(h.a,h.d),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.c,h.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];k=h.vertexIndices[1];
-h.faceIndices=m[b(g,k)].array;for(g=0;g<h.faceIndices.length;g++)k=h.faceIndices[g],h.faces.push(this.faces[k])}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function c(b,e,c,f,g,h,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*h+b*g+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,k,h,m,n,p,o,t,u;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;k=Math.floor(g);h=g-k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>this.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;p=this.points[e[0]];o=this.points[e[1]];
-t=this.points[e[2]];u=this.points[e[3]];m=h*h;n=h*m;f.x=c(p.x,o.x,t.x,u.x,h,m,n);f.y=c(p.y,o.y,t.y,u.y,h,m,n);f.z=c(p.z,o.z,t.z,u.z,h,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,g=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);c=this.points.length*b;g.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
-m+=h.distanceTo(g),g.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(k[e]=m,f=e);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,g,h,k,m=[],n=new THREE.Vector3,p=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=p.chunks[e]-p.chunks[e-1];k=Math.ceil(b*c/p.total);g=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<k-1;c++)f=g+c*(1/k)*(h-g),position=this.getPoint(f),m.push(n.copy(position).clone());
+void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,h,j,m={};e=0;for(f=this.faces.length;e<f;e++)j=this.faces[e],j instanceof THREE.Face3?(g=b(j.a,j.b),c(m,g,e),g=b(j.b,j.c),c(m,g,e),g=b(j.a,j.c),c(m,g,e)):j instanceof THREE.Face4&&(g=b(j.b,j.d),c(m,g,e),g=b(j.a,j.b),c(m,g,e),g=b(j.a,j.d),c(m,g,e),g=b(j.b,j.c),c(m,g,e),g=b(j.c,j.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){j=this.edges[e];g=j.vertexIndices[0];h=j.vertexIndices[1];
+j.faceIndices=m[b(g,h)].array;for(g=0;g<j.faceIndices.length;g++)h=j.faceIndices[g],j.faces.push(this.faces[h])}}};THREE.GeometryIdCounter=0;
+THREE.Spline=function(b){function c(b,e,c,f,g,h,j){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*j+(-3*(e-c)-2*b-f)*h+b*g+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,h,j,m,n,p,o,u,v;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;h=Math.floor(g);j=g-h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>this.points.length-2?h:h+1;e[3]=h>this.points.length-3?h:h+2;p=this.points[e[0]];o=this.points[e[1]];
+u=this.points[e[2]];v=this.points[e[3]];m=j*j;n=j*m;f.x=c(p.x,o.x,u.x,v.x,j,m,n);f.y=c(p.y,o.y,u.y,v.y,j,m,n);f.z=c(p.z,o.z,u.z,v.z,j,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,g=new THREE.Vector3,h=new THREE.Vector3,j=[],m=0;j[0]=0;b||(b=100);c=this.points.length*b;g.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
+m+=h.distanceTo(g),g.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(j[e]=m,f=e);j[j.length]=m;return{chunks:j,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,g,h,j,m=[],n=new THREE.Vector3,p=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=p.chunks[e]-p.chunks[e-1];j=Math.ceil(b*c/p.total);g=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<j-1;c++)f=g+c*(1/j)*(h-g),position=this.getPoint(f),m.push(n.copy(position).clone());
 m.push(n.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 m.push(n.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
-THREE.Camera.prototype.setViewOffset=function(b,c,e,f,g,k){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=g;this.height=k;this.updateProjectionMatrix()};
+THREE.Camera.prototype.setViewOffset=function(b,c,e,f,g,h){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=g;this.height=h;this.updateProjectionMatrix()};
 THREE.Camera.prototype.update=function(b,c,e){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
 THREE.Camera.prototype.update=function(b,c,e){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
 !1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
 !1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=e||0;this.castShadow=f!==void 0?f:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=e||0};
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=e||0;this.castShadow=f!==void 0?f:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=e||0};
@@ -103,7 +103,7 @@ void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wiref
 THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
 THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
 THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==void 0?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
 THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==void 0?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
-THREE.Texture=function(b,c,e,f,g,k){this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=k!==void 0?k:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
+THREE.Texture=function(b,c,e,f,g,h){this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
 THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
 THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
@@ -113,23 +113,23 @@ e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THR
 THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<g;f++)this.children[f].update(this.skinMatrix,
 THREE.Bone.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<g;f++)this.children[f].update(this.skinMatrix,
 c,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
 c,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
-THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,g,k,h,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)g=this.geometry.bones[e],k=g.pos,h=g.rotq,m=g.scl,f=this.addBone(),f.name=g.name,f.position.set(k[0],k[1],k[2]),f.quaternion.set(h[0],h[1],h[2],h[3]),f.useQuaternion=!0,m!==void 0?f.scale.set(m[0],m[1],m[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)g=this.geometry.bones[e],
+THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,g,h,j,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)g=this.geometry.bones[e],h=g.pos,j=g.rotq,m=g.scl,f=this.addBone(),f.name=g.name,f.position.set(h[0],h[1],h[2]),f.quaternion.set(j[0],j[1],j[2],j[3]),f.useQuaternion=!0,m!==void 0?f.scale.set(m[0],m[1],m[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)g=this.geometry.bones[e],
 f=this.bones[e],g.parent===-1?this.addChild(f):this.bones[g.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
 f=this.bones[e],g.parent===-1?this.addChild(f):this.bones[g.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
 THREE.SkinnedMesh.prototype.update=function(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 THREE.SkinnedMesh.prototype.update=function(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,g=this.geometry.skinIndices[b].x,k=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
-e.y,e.z);this.geometry.skinVerticesA.push(c[g].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[k].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,g=this.geometry.skinIndices[b].x,h=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
+e.y,e.z);this.geometry.skinVerticesA.push(c[g].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
 THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),e=0;e<this.LODs.length;e++)if(c<this.LODs[e].visibleAtDistance)break;this.LODs.splice(e,0,{visibleAtDistance:c,object3D:b});this.addChild(b)};
 THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),e=0;e<this.LODs.length;e++)if(c<this.LODs[e].visibleAtDistance)break;this.LODs.splice(e,0,{visibleAtDistance:c,object3D:b});this.addChild(b)};
 THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
 THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
 this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,k,h,m,n,p,o,t,u,v,x=new THREE.Geometry;x.vertices=this.geometry.vertices;f=x.faces=this.geometry.faces;var B=x.egdes=this.geometry.edges,A=x.edgeFaces=[];g=0;var y=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],y.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
-e.normal;b=0;for(c=B.length;b<c;b++)m=B[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],k=m.faceIndices[1],h=m.vertexIndices[0],m=m.vertexIndices[1],e.a===h?(n="a",o=y[g]+0):e.b===h?(n="b",o=y[g]+1):e.c===h?(n="c",o=y[g]+2):e.d===h&&(n="d",o=y[g]+3),e.a===m?(n+="a",t=y[g]+0):e.b===m?(n+="b",t=y[g]+1):e.c===m?(n+="c",t=y[g]+2):e.d===m&&(n+="d",t=y[g]+3),f.a===h?(p="a",u=y[k]+0):f.b===h?(p="b",u=y[k]+1):f.c===h?(p="c",u=y[k]+2):f.d===h&&(p="d",u=y[k]+3),f.a===m?(p+="a",v=y[k]+0):f.b===m?(p+="b",v=y[k]+
-1):f.c===m?(p+="c",v=y[k]+2):f.d===m&&(p+="d",v=y[k]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?o>t&&(e=o,o=t,t=e):o<t&&(e=o,o=t,t=e),p==="ac"||p==="ad"||p==="ca"||p==="da"?u>v&&(e=u,u=v,v=e):u<v&&(e=u,u=v,v=e),e=new THREE.Face4(o,t,u,v),e.normal.set(1,0,0),A.push(e);this.geometry=x}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,k=g.length,h,m,n,p,o,t=["a","b","c","d"];for(n=0;n<k;n++){m=c.length;h=g[n];h instanceof THREE.Face4?(p=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(p=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(h.normal);e.push(m);
-for(m=0;m<p;m++)o=b[h[t[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(k=0;k<g.length-1;k++){b=e[k];for(h=k+1;h<g.length;h++)m=e[h],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,k,h,m,n,p,o,t,u,v,x,B,A=0,y=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(x=0;x<f;x++){k=c[y[x]];m=b[k];for(B=0;B<g;B++)if(h=e[y[B]],n=b[h],Math.abs(m.position.x-n.position.x)<1.0E-4&&Math.abs(m.position.y-n.position.y)<1.0E-4&&Math.abs(m.position.z-n.position.z)<1.0E-4&&(A++,A===1&&(p=m,o=n,t=k,u=h,v=y[x]),A===2))return v+=y[x],v==="ad"||v==="ac"?{faces:[c,e],vertices:[p,o,n,m],indices:[t,u,
-h,k],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,n,o],indices:[t,k,h,u],vertexTypes:[1,1,2,2],extrudable:!0}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,h,j,m,n,p,o,u,v,w,x=new THREE.Geometry;x.vertices=this.geometry.vertices;f=x.faces=this.geometry.faces;var y=x.egdes=this.geometry.edges,D=x.edgeFaces=[];g=0;var A=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],A.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
+e.normal;b=0;for(c=y.length;b<c;b++)m=y[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],h=m.faceIndices[1],j=m.vertexIndices[0],m=m.vertexIndices[1],e.a===j?(n="a",o=A[g]+0):e.b===j?(n="b",o=A[g]+1):e.c===j?(n="c",o=A[g]+2):e.d===j&&(n="d",o=A[g]+3),e.a===m?(n+="a",u=A[g]+0):e.b===m?(n+="b",u=A[g]+1):e.c===m?(n+="c",u=A[g]+2):e.d===m&&(n+="d",u=A[g]+3),f.a===j?(p="a",v=A[h]+0):f.b===j?(p="b",v=A[h]+1):f.c===j?(p="c",v=A[h]+2):f.d===j&&(p="d",v=A[h]+3),f.a===m?(p+="a",w=A[h]+0):f.b===m?(p+="b",w=A[h]+
+1):f.c===m?(p+="c",w=A[h]+2):f.d===m&&(p+="d",w=A[h]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?o>u&&(e=o,o=u,u=e):o<u&&(e=o,o=u,u=e),p==="ac"||p==="ad"||p==="ca"||p==="da"?v>w&&(e=v,v=w,w=e):v<w&&(e=v,v=w,w=e),e=new THREE.Face4(o,u,v,w),e.normal.set(1,0,0),D.push(e);this.geometry=x}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,h=g.length,j,m,n,p,o,u=["a","b","c","d"];for(n=0;n<h;n++){m=c.length;j=g[n];j instanceof THREE.Face4?(p=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(p=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(j.normal);e.push(m);
+for(m=0;m<p;m++)o=b[j[u[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(h=0;h<g.length-1;h++){b=e[h];for(j=h+1;j<g.length;j++)m=e[j],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,h,j,m,n,p,o,u,v,w,x,y,D=0,A=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(x=0;x<f;x++){h=c[A[x]];m=b[h];for(y=0;y<g;y++)if(j=e[A[y]],n=b[j],Math.abs(m.position.x-n.position.x)<1.0E-4&&Math.abs(m.position.y-n.position.y)<1.0E-4&&Math.abs(m.position.z-n.position.z)<1.0E-4&&(D++,D===1&&(p=m,o=n,u=h,v=j,w=A[x]),D===2))return w+=A[x],w==="ad"||w==="ac"?{faces:[c,e],vertices:[p,o,n,m],indices:[u,v,
+j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,n,o],indices:[u,h,j,v],vertexTypes:[1,1,2,2],extrudable:!0}}};
 THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
 THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
 this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
 this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
 THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
 THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
@@ -138,56 +138,56 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
 THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
 THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
 THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-THREE.Projector=function(){function b(){var b=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,g=b.z+b.w,j=e.z+e.w,h=-b.z+b.w,k=-e.z+e.w;return g>=0&&j>=0&&h>=0&&k>=0?!0:g<0&&j<0||h<0&&k<0?!1:(g<0?c=Math.max(c,g/(g-j)):j<0&&(f=Math.min(f,g/(g-j))),h<0?c=Math.max(c,h/(h-k)):k<0&&(f=Math.min(f,h/(h-k))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,k=[],h,m,n=[],p,o,t=[],u,v=[],x,B,A=[],y,F,w=[],H=new THREE.Vector4,E=new THREE.Vector4,
-D=new THREE.Matrix4,S=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,U=new THREE.Vector4;this.projectVector=function(b,e){D.multiply(e.projectionMatrix,e.matrixWorldInverse);D.multiplyVector3(b);return b};this.unprojectVector=function(b,e){D.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));D.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],m,n,j;g=0;n=
-b.objects;b=0;for(m=n.length;b<m;b++){j=n[b];var p;if(!(p=!j.visible))if(p=j instanceof THREE.Mesh){a:{p=void 0;for(var o=j.matrixWorld,t=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),u=0;u<6;u++)if(p=J[u].x*o.n14+J[u].y*o.n24+J[u].z*o.n34+J[u].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=k[g]=k[g]||new THREE.RenderableObject,g++,f=p,H.copy(j.position),D.multiplyVector3(H),f.object=j,f.z=H.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,k){var H=[],
-R=g.near,j=g.far,fa,P,da,ca,Y,ea,ga,la,pa,N,ia,Z,ma,$,I,V,oa;F=B=u=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);D.multiply(g.projectionMatrix,g.matrixWorldInverse);J[0].set(D.n41-D.n11,D.n42-D.n12,D.n43-D.n13,D.n44-D.n14);J[1].set(D.n41+D.n11,D.n42+D.n12,D.n43+D.n13,D.n44+D.n14);J[2].set(D.n41+D.n21,D.n42+D.n22,D.n43+D.n23,D.n44+D.n24);J[3].set(D.n41-D.n21,D.n42-D.n22,D.n43-D.n23,D.n44-D.n24);J[4].set(D.n41-D.n31,D.n42-D.n32,D.n43-D.n33,D.n44-D.n34);J[5].set(D.n41+D.n31,D.n42+
-D.n32,D.n43+D.n33,D.n44+D.n34);for(fa=0;fa<6;fa++)pa=J[fa],pa.divideScalar(Math.sqrt(pa.x*pa.x+pa.y*pa.y+pa.z*pa.z));pa=this.projectObjects(f,g,!0);f=0;for(fa=pa.length;f<fa;f++)if(N=pa[f].object,N.visible)if(ia=N.matrixWorld,Z=N.matrixRotationWorld,ma=N.materials,$=N.overdraw,m=0,N instanceof THREE.Mesh){I=N.geometry;ca=I.vertices;V=I.faces;I=I.faceVertexUvs;P=0;for(da=ca.length;P<da;P++)h=b(),h.positionWorld.copy(ca[P].position),ia.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
-D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>R&&h.positionScreen.z<j;ca=0;for(P=V.length;ca<P;ca++){da=V[ca];if(da instanceof THREE.Face3)if(Y=n[da.a],ea=n[da.b],ga=n[da.c],Y.visible&&ea.visible&&ga.visible&&(N.doubleSided||N.flipSided!=(ga.positionScreen.x-Y.positionScreen.x)*(ea.positionScreen.y-Y.positionScreen.y)-(ga.positionScreen.y-Y.positionScreen.y)*(ea.positionScreen.x-Y.positionScreen.x)<0))la=
-t[o]=t[o]||new THREE.RenderableFace3,o++,p=la,p.v1.copy(Y),p.v2.copy(ea),p.v3.copy(ga);else continue;else if(da instanceof THREE.Face4)if(Y=n[da.a],ea=n[da.b],ga=n[da.c],la=n[da.d],Y.visible&&ea.visible&&ga.visible&&la.visible&&(N.doubleSided||N.flipSided!=((la.positionScreen.x-Y.positionScreen.x)*(ea.positionScreen.y-Y.positionScreen.y)-(la.positionScreen.y-Y.positionScreen.y)*(ea.positionScreen.x-Y.positionScreen.x)<0||(ea.positionScreen.x-ga.positionScreen.x)*(la.positionScreen.y-ga.positionScreen.y)-
-(ea.positionScreen.y-ga.positionScreen.y)*(la.positionScreen.x-ga.positionScreen.x)<0)))oa=v[u]=v[u]||new THREE.RenderableFace4,u++,p=oa,p.v1.copy(Y),p.v2.copy(ea),p.v3.copy(ga),p.v4.copy(la);else continue;p.normalWorld.copy(da.normal);Z.multiplyVector3(p.normalWorld);p.centroidWorld.copy(da.centroid);ia.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);D.multiplyVector3(p.centroidScreen);ga=da.vertexNormals;Y=0;for(ea=ga.length;Y<ea;Y++)la=p.vertexNormalsWorld[Y],la.copy(ga[Y]),
-Z.multiplyVector3(la);Y=0;for(ea=I.length;Y<ea;Y++)if(oa=I[Y][ca]){ga=0;for(la=oa.length;ga<la;ga++)p.uvs[Y][ga]=oa[ga]}p.meshMaterials=ma;p.faceMaterials=da.materials;p.overdraw=$;p.z=p.centroidScreen.z;H.push(p)}}else if(N instanceof THREE.Line){S.multiply(D,ia);ca=N.geometry.vertices;Y=b();Y.positionScreen.copy(ca[0].position);S.multiplyVector4(Y.positionScreen);P=1;for(da=ca.length;P<da;P++)if(Y=b(),Y.positionScreen.copy(ca[P].position),S.multiplyVector4(Y.positionScreen),ea=n[m-2],G.copy(Y.positionScreen),
-U.copy(ea.positionScreen),e(G,U))G.multiplyScalar(1/G.w),U.multiplyScalar(1/U.w),ia=A[B]=A[B]||new THREE.RenderableLine,B++,x=ia,x.v1.positionScreen.copy(G),x.v2.positionScreen.copy(U),x.z=Math.max(G.z,U.z),x.materials=N.materials,H.push(x)}else if(N instanceof THREE.Particle&&(E.set(N.matrixWorld.n14,N.matrixWorld.n24,N.matrixWorld.n34,1),D.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))ia=w[F]=w[F]||new THREE.RenderableParticle,F++,y=ia,y.x=E.x/E.w,y.y=E.y/E.w,y.z=E.z,y.rotation=N.rotation.z,y.scale.x=
-N.scale.x*Math.abs(y.x-(E.x+g.projectionMatrix.n11)/(E.w+g.projectionMatrix.n14)),y.scale.y=N.scale.y*Math.abs(y.y-(E.y+g.projectionMatrix.n22)/(E.w+g.projectionMatrix.n24)),y.materials=N.materials,H.push(y);k&&H.sort(c);return H}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;k=f/2};this.render=function(e,f){var n,p,o,t,u,v,x,B;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(u=b[n],u instanceof THREE.RenderableParticle){x=u.x*g+g;B=u.y*k+k;o=0;for(t=u.material.length;o<t;o++)if(v=u.material[o],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=x+"px",v.style.top=B+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(y!=b)x.globalAlpha=y=b}function e(b){if(F!=b){switch(b){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}F=b}}function f(b){if(w!=b.hex)w=b.hex,x.strokeStyle="#"+k(w.toString(16))}function g(b){if(H!=b.hex)H=b.hex,x.fillStyle="#"+k(H.toString(16))}function k(b){for(;b.length<6;)b="0"+b;return b}
-var h=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,t,u,v,x=p.getContext("2d"),B=new THREE.Color(0),A=0,y=1,F=0,w=null,H=null,E=null,D=null,S=null,J,G,U,W,M=new THREE.RenderableVertex,X=new THREE.RenderableVertex,T,R,j,fa,P,da,ca,Y,ea,ga,la,pa,N=new THREE.Color(0),ia=new THREE.Color(0),Z=new THREE.Color(0),ma=new THREE.Color(0),$=new THREE.Color(0),I,V,oa,ha,na,wa,Aa,va,ya,Ma,sa=new THREE.Rectangle,ra=new THREE.Rectangle,qa=new THREE.Rectangle,
-Ba=!1,aa=new THREE.Color,L=new THREE.Color,ua=new THREE.Color,Q=new THREE.Color,ka=new THREE.Vector3,ja,Pa,Va,xa,Qa,Ra,b=16;ja=document.createElement("canvas");ja.width=ja.height=2;Pa=ja.getContext("2d");Pa.fillStyle="rgba(0,0,0,1)";Pa.fillRect(0,0,2,2);Va=Pa.getImageData(0,0,2,2);xa=Va.data;Qa=document.createElement("canvas");Qa.width=Qa.height=b;Ra=Qa.getContext("2d");Ra.translate(-b/2,-b/2);Ra.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
-faces:0};this.setSize=function(b,e){o=b;t=e;u=o/2;v=t/2;p.width=o;p.height=t;sa.set(-u,-v,u,v);ra.set(-u,-v,u,v);y=1;F=0;S=D=E=H=w=null};this.setClearColor=function(b,e){B=b;A=e;ra.set(-u,-v,u,v)};this.setClearColorHex=function(b,e){B.setHex(b);A=e;ra.set(-u,-v,u,v)};this.clear=function(){x.setTransform(1,0,0,-1,u,v);if(!ra.isEmpty())ra.inflate(1),ra.minSelf(sa),B.hex==0&&A==0?x.clearRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight()):(e(THREE.NormalBlending),c(1),x.fillStyle="rgba("+Math.floor(B.r*
-255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*255)+","+A+")",x.fillRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight())),ra.empty()};this.render=function(b,k){function p(b){var e,c,f,g=b.lights;L.setRGB(0,0,0);ua.setRGB(0,0,0);Q.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(L.r+=f.r,L.g+=f.g,L.b+=f.b):c instanceof THREE.DirectionalLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):c instanceof THREE.PointLight&&(Q.r+=f.r,Q.g+=f.g,Q.b+=f.b)}function o(b,e,c,f){var g,
-j,h,k,m=b.lights,b=0;for(g=m.length;b<g;b++)j=m[b],h=j.color,j instanceof THREE.DirectionalLight?(k=c.dot(j.position),k<=0||(k*=j.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)):j instanceof THREE.PointLight&&(k=c.dot(ka.sub(j.position,e).normalize()),k<=0||(k*=j.distance==0?1:1-Math.min(e.distanceTo(j.position)/j.distance,1),k!=0&&(k*=j.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)))}function t(b,j,h){c(h.opacity);e(h.blending);var k,m,p,n,o,ja;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)n=
-h.map.image,o=n.width>>1,ja=n.height>>1,h=j.scale.x*u,p=j.scale.y*v,k=h*o,m=p*ja,qa.set(b.x-k,b.y-m,b.x+k,b.y+m),sa.instersects(qa)&&(x.save(),x.translate(b.x,b.y),x.rotate(-j.rotation),x.scale(h,-p),x.translate(-o,-ja),x.drawImage(n,0,0),x.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*u,m=j.scale.y*v,qa.set(b.x-k,b.y-m,b.x+k,b.y+m),sa.instersects(qa)&&(f(h.color),g(h.color),x.save(),x.translate(b.x,b.y),x.rotate(-j.rotation),x.scale(k,m),h.program(x),x.restore()))}function y(b,
-g,j,h){c(h.opacity);e(h.blending);x.beginPath();x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(g.positionScreen.x,g.positionScreen.y);x.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(E!=b)x.lineWidth=E=b;b=h.linecap;if(D!=b)x.lineCap=D=b;b=h.linejoin;if(S!=b)x.lineJoin=S=b;f(h.color);x.stroke();qa.inflate(h.linewidth*2)}}function A(b,f,g,m,p,n,ja,t,u){h.data.vertices+=3;h.data.faces++;c(t.opacity);e(t.blending);T=b.positionScreen.x;R=b.positionScreen.y;j=f.positionScreen.x;
-fa=f.positionScreen.y;P=g.positionScreen.x;da=g.positionScreen.y;B(T,R,j,fa,P,da);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(ha=ja.uvs[0],Ca(T,R,j,fa,P,da,t.map.image,ha[m].u,ha[m].v,ha[p].u,ha[p].v,ha[n].u,ha[n].v));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=k.matrixWorldInverse,ka.copy(ja.vertexNormalsWorld[0]),na=(ka.x*b.n11+ka.y*b.n12+ka.z*b.n13)*0.5+0.5,wa=-(ka.x*b.n21+ka.y*b.n22+ka.z*b.n23)*0.5+0.5,ka.copy(ja.vertexNormalsWorld[1]),
-Aa=(ka.x*b.n11+ka.y*b.n12+ka.z*b.n13)*0.5+0.5,va=-(ka.x*b.n21+ka.y*b.n22+ka.z*b.n23)*0.5+0.5,ka.copy(ja.vertexNormalsWorld[2]),ya=(ka.x*b.n11+ka.y*b.n12+ka.z*b.n13)*0.5+0.5,Ma=-(ka.x*b.n21+ka.y*b.n22+ka.z*b.n23)*0.5+0.5,Ca(T,R,j,fa,P,da,t.envMap.image,na,wa,Aa,va,ya,Ma)}else t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(ha=ja.uvs[0],Ca(T,
-R,j,fa,P,da,t.map.image,ha[m].u,ha[m].v,ha[p].u,ha[p].v,ha[n].u,ha[n].v)),e(THREE.SubtractiveBlending)),Ba?!t.wireframe&&t.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==3?(ia.r=Z.r=ma.r=L.r,ia.g=Z.g=ma.g=L.g,ia.b=Z.b=ma.b=L.b,o(u,ja.v1.positionWorld,ja.vertexNormalsWorld[0],ia),o(u,ja.v2.positionWorld,ja.vertexNormalsWorld[1],Z),o(u,ja.v3.positionWorld,ja.vertexNormalsWorld[2],ma),$.r=(Z.r+ma.r)*0.5,$.g=(Z.g+ma.g)*0.5,$.b=(Z.b+ma.b)*0.5,oa=Sa(ia,Z,ma,$),Ca(T,R,j,fa,P,da,oa,0,0,1,0,0,
-1)):(aa.r=L.r,aa.g=L.g,aa.b=L.b,o(u,ja.centroidWorld,ja.normalWorld,aa),N.r=Math.max(0,Math.min(t.color.r*aa.r,1)),N.g=Math.max(0,Math.min(t.color.g*aa.g,1)),N.b=Math.max(0,Math.min(t.color.b*aa.b,1)),N.updateHex(),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N)):t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshDepthMaterial)I=k.near,V=k.far,ia.r=ia.g=ia.b=1-Ia(b.positionScreen.z,I,V),Z.r=
-Z.g=Z.b=1-Ia(f.positionScreen.z,I,V),ma.r=ma.g=ma.b=1-Ia(g.positionScreen.z,I,V),$.r=(Z.r+ma.r)*0.5,$.g=(Z.g+ma.g)*0.5,$.b=(Z.b+ma.b)*0.5,oa=Sa(ia,Z,ma,$),Ca(T,R,j,fa,P,da,oa,0,0,1,0,0,1);else if(t instanceof THREE.MeshNormalMaterial)N.r=Na(ja.normalWorld.x),N.g=Na(ja.normalWorld.y),N.b=Na(ja.normalWorld.z),N.updateHex(),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N)}function w(b,f,g,m,p,n,ja,t,u){h.data.vertices+=4;h.data.faces++;c(t.opacity);e(t.blending);if(t.map||
-t.envMap)A(b,f,m,0,1,3,ja,t,u),A(p,g,n,1,2,3,ja,t,u);else if(T=b.positionScreen.x,R=b.positionScreen.y,j=f.positionScreen.x,fa=f.positionScreen.y,P=g.positionScreen.x,da=g.positionScreen.y,ca=m.positionScreen.x,Y=m.positionScreen.y,ea=p.positionScreen.x,ga=p.positionScreen.y,la=n.positionScreen.x,pa=n.positionScreen.y,t instanceof THREE.MeshBasicMaterial)F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshLambertMaterial)Ba?
-!t.wireframe&&t.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==4?(ia.r=Z.r=ma.r=$.r=L.r,ia.g=Z.g=ma.g=$.g=L.g,ia.b=Z.b=ma.b=$.b=L.b,o(u,ja.v1.positionWorld,ja.vertexNormalsWorld[0],ia),o(u,ja.v2.positionWorld,ja.vertexNormalsWorld[1],Z),o(u,ja.v4.positionWorld,ja.vertexNormalsWorld[3],ma),o(u,ja.v3.positionWorld,ja.vertexNormalsWorld[2],$),oa=Sa(ia,Z,ma,$),B(T,R,j,fa,ca,Y),Ca(T,R,j,fa,ca,Y,oa,0,0,1,0,0,1),B(ea,ga,P,da,la,pa),Ca(ea,ga,P,da,la,pa,oa,1,0,1,1,0,1)):(aa.r=L.r,aa.g=L.g,aa.b=
-L.b,o(u,ja.centroidWorld,ja.normalWorld,aa),N.r=Math.max(0,Math.min(t.color.r*aa.r,1)),N.g=Math.max(0,Math.min(t.color.g*aa.g,1)),N.b=Math.max(0,Math.min(t.color.b*aa.b,1)),N.updateHex(),F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N)):(F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color));else if(t instanceof THREE.MeshNormalMaterial)N.r=Na(ja.normalWorld.x),N.g=Na(ja.normalWorld.y),
-N.b=Na(ja.normalWorld.z),N.updateHex(),F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N);else if(t instanceof THREE.MeshDepthMaterial)I=k.near,V=k.far,ia.r=ia.g=ia.b=1-Ia(b.positionScreen.z,I,V),Z.r=Z.g=Z.b=1-Ia(f.positionScreen.z,I,V),ma.r=ma.g=ma.b=1-Ia(m.positionScreen.z,I,V),$.r=$.g=$.b=1-Ia(g.positionScreen.z,I,V),oa=Sa(ia,Z,ma,$),B(T,R,j,fa,ca,Y),Ca(T,R,j,fa,ca,Y,oa,0,0,1,0,0,1),B(ea,ga,P,da,la,pa),Ca(ea,ga,P,da,la,pa,oa,1,0,1,1,0,1)}function B(b,
-e,c,f,g,j){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,j);x.lineTo(b,e);x.closePath()}function F(b,e,c,f,g,j,h,k){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,j);x.lineTo(h,k);x.lineTo(b,e);x.closePath()}function H(b,e,c,g){if(E!=e)x.lineWidth=E=e;if(D!=c)x.lineCap=D=c;if(S!=g)x.lineJoin=S=g;f(b);x.stroke();qa.inflate(e*2)}function Ea(b){g(b);x.fill()}function Ca(b,e,c,f,g,j,h,k,m,t,p,n,ja){var o,u;o=h.width-1;u=h.height-1;k*=o;m*=u;t*=o;p*=u;n*=o;ja*=u;c-=b;f-=e;g-=b;j-=e;t-=k;p-=
-m;n-=k;ja-=m;o=t*ja-n*p;if(!((o<0?-o:o)<1))u=1/o,o=(ja*c-p*g)*u,p=(ja*f-p*j)*u,c=(t*g-n*c)*u,f=(t*j-n*f)*u,b=b-o*k-c*m,e=e-p*k-f*m,x.save(),x.transform(o,p,c,f,b,e),x.clip(),x.drawImage(h,0,0),x.restore()}function Sa(b,e,c,f){var g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),t=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),n=~~(f.g*255),f=~~(f.b*255);xa[0]=g<0?0:g>255?255:g;xa[1]=j<0?0:j>255?255:j;xa[2]=b<0?0:b>255?255:b;xa[4]=h<0?0:h>255?255:h;xa[5]=k<
-0?0:k>255?255:k;xa[6]=e<0?0:e>255?255:e;xa[8]=m<0?0:m>255?255:m;xa[9]=t<0?0:t>255?255:t;xa[10]=c<0?0:c>255?255:c;xa[12]=p<0?0:p>255?255:p;xa[13]=n<0?0:n>255?255:n;xa[14]=f<0?0:f>255?255:f;Pa.putImageData(Va,0,0);Ra.drawImage(ja,0,0);return Qa}function Ia(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Fa(b,e){var c=e.x-b.x,f=e.y-b.y,g=c*c+f*f;g!=0&&(g=1/Math.sqrt(g),c*=g,f*=g,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ta,C,K,z,Ga,Oa,Ua,ta;this.autoClear?this.clear():
-x.setTransform(1,0,0,-1,u,v);h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,k,this.sortElements);(Ba=b.lights.length>0)&&p(b);Ta=0;for(C=m.length;Ta<C;Ta++){K=m[Ta];qa.empty();if(K instanceof THREE.RenderableParticle){J=K;J.x*=u;J.y*=v;z=0;for(Ga=K.materials.length;z<Ga;)ta=K.materials[z++],ta.opacity!=0&&t(J,K,ta,b)}else if(K instanceof THREE.RenderableLine){if(J=K.v1,G=K.v2,J.positionScreen.x*=u,J.positionScreen.y*=v,G.positionScreen.x*=u,G.positionScreen.y*=v,qa.addPoint(J.positionScreen.x,
-J.positionScreen.y),qa.addPoint(G.positionScreen.x,G.positionScreen.y),sa.instersects(qa)){z=0;for(Ga=K.materials.length;z<Ga;)ta=K.materials[z++],ta.opacity!=0&&y(J,G,K,ta,b)}}else if(K instanceof THREE.RenderableFace3){if(J=K.v1,G=K.v2,U=K.v3,J.positionScreen.x*=u,J.positionScreen.y*=v,G.positionScreen.x*=u,G.positionScreen.y*=v,U.positionScreen.x*=u,U.positionScreen.y*=v,K.overdraw&&(Fa(J.positionScreen,G.positionScreen),Fa(G.positionScreen,U.positionScreen),Fa(U.positionScreen,J.positionScreen)),
-qa.add3Points(J.positionScreen.x,J.positionScreen.y,G.positionScreen.x,G.positionScreen.y,U.positionScreen.x,U.positionScreen.y),sa.instersects(qa)){z=0;for(Ga=K.meshMaterials.length;z<Ga;)if(ta=K.meshMaterials[z++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=K.faceMaterials.length;Oa<Ua;)(ta=K.faceMaterials[Oa++])&&ta.opacity!=0&&A(J,G,U,0,1,2,K,ta,b)}else ta.opacity!=0&&A(J,G,U,0,1,2,K,ta,b)}}else if(K instanceof THREE.RenderableFace4&&(J=K.v1,G=K.v2,U=K.v3,W=K.v4,J.positionScreen.x*=u,J.positionScreen.y*=
-v,G.positionScreen.x*=u,G.positionScreen.y*=v,U.positionScreen.x*=u,U.positionScreen.y*=v,W.positionScreen.x*=u,W.positionScreen.y*=v,M.positionScreen.copy(G.positionScreen),X.positionScreen.copy(W.positionScreen),K.overdraw&&(Fa(J.positionScreen,G.positionScreen),Fa(G.positionScreen,W.positionScreen),Fa(W.positionScreen,J.positionScreen),Fa(U.positionScreen,M.positionScreen),Fa(U.positionScreen,X.positionScreen)),qa.addPoint(J.positionScreen.x,J.positionScreen.y),qa.addPoint(G.positionScreen.x,G.positionScreen.y),
-qa.addPoint(U.positionScreen.x,U.positionScreen.y),qa.addPoint(W.positionScreen.x,W.positionScreen.y),sa.instersects(qa))){z=0;for(Ga=K.meshMaterials.length;z<Ga;)if(ta=K.meshMaterials[z++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=K.faceMaterials.length;Oa<Ua;)(ta=K.faceMaterials[Oa++])&&ta.opacity!=0&&w(J,G,U,W,M,X,K,ta,b)}else ta.opacity!=0&&w(J,G,U,W,M,X,K,ta,b)}ra.addRectangle(qa)}x.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,e,c){var f,g,j,h;f=0;for(g=b.lights.length;f<g;f++)j=b.lights[f],j instanceof THREE.DirectionalLight?(h=e.normalWorld.dot(j.position)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h)):j instanceof THREE.PointLight&&(W.sub(j.position,e.centroidWorld),W.normalize(),h=e.normalWorld.dot(W)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h))}function c(e,c,j,m,t,n){h.data.vertices+=3;h.data.faces++;T=f(R++);T.setAttribute("d",
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?E.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?H?(D.r=S.r,D.g=S.g,D.b=S.b,b(n,m,D),E.r=Math.max(0,Math.min(t.color.r*D.r,1)),E.g=Math.max(0,Math.min(t.color.g*D.g,1)),E.b=Math.max(0,Math.min(t.color.b*D.b,1)),E.updateHex()):E.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(U=1-t.__2near/(t.__farPlusNear-
-m.z*t.__farMinusNear),E.setRGB(U,U,U)):t instanceof THREE.MeshNormalMaterial&&E.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));t.wireframe?T.setAttribute("style","fill: none; stroke: #"+k(E.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):T.setAttribute("style","fill: #"+k(E.hex.toString(16))+"; fill-opacity: "+t.opacity);p.appendChild(T)}function e(e,c,j,m,
-t,n,o){h.data.vertices+=4;h.data.faces++;T=f(R++);T.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?E.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?H?(D.r=S.r,D.g=S.g,D.b=S.b,b(o,t,D),E.r=Math.max(0,Math.min(n.color.r*D.r,1)),E.g=Math.max(0,Math.min(n.color.g*D.g,1)),E.b=Math.max(0,Math.min(n.color.b*
-D.b,1)),E.updateHex()):E.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(U=1-n.__2near/(n.__farPlusNear-t.z*n.__farMinusNear),E.setRGB(U,U,U)):n instanceof THREE.MeshNormalMaterial&&E.setRGB(g(t.normalWorld.x),g(t.normalWorld.y),g(t.normalWorld.z));n.wireframe?T.setAttribute("style","fill: none; stroke: #"+k(E.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):T.setAttribute("style",
-"fill: #"+k(E.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(T)}function f(b){M[b]==null&&(M[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),fa==0&&M[b].setAttribute("shape-rendering","crispEdges"));return M[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function k(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,u,v,x,B,A,y,F=new THREE.Rectangle,w=new THREE.Rectangle,
-H=!1,E=new THREE.Color(16777215),D=new THREE.Color(16777215),S=new THREE.Color(0),J=new THREE.Color(0),G=new THREE.Color(0),U,W=new THREE.Vector3,M=[],X=[],T,R,j,fa=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":fa=1;break;case "low":fa=0}};this.setSize=function(b,e){o=b;t=e;u=o/2;v=t/2;p.setAttribute("viewBox",-u+" "+-v+" "+o+" "+t);p.setAttribute("width",o);p.setAttribute("height",t);F.set(-u,
--v,u,v)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,f){var g,t,o,E,D,U,N,M;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,f,this.sortElements);j=R=0;if(H=b.lights.length>0){N=b.lights;S.setRGB(0,0,0);J.setRGB(0,0,0);G.setRGB(0,0,0);g=0;for(t=N.length;g<t;g++)o=N[g],E=o.color,o instanceof THREE.AmbientLight?(S.r+=E.r,S.g+=E.g,S.b+=E.b):o instanceof THREE.DirectionalLight?(J.r+=E.r,J.g+=E.g,J.b+=E.b):o instanceof
-THREE.PointLight&&(G.r+=E.r,G.g+=E.g,G.b+=E.b)}g=0;for(t=m.length;g<t;g++)if(N=m[g],w.empty(),N instanceof THREE.RenderableParticle){x=N;x.x*=u;x.y*=-v;o=0;for(E=N.materials.length;o<E;)o++}else if(N instanceof THREE.RenderableLine){if(x=N.v1,B=N.v2,x.positionScreen.x*=u,x.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,w.addPoint(x.positionScreen.x,x.positionScreen.y),w.addPoint(B.positionScreen.x,B.positionScreen.y),F.instersects(w)){o=0;for(E=N.materials.length;o<E;)if((M=N.materials[o++])&&
-M.opacity!=0){D=x;U=B;var W=j++;X[W]==null&&(X[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),fa==0&&X[W].setAttribute("shape-rendering","crispEdges"));T=X[W];T.setAttribute("x1",D.positionScreen.x);T.setAttribute("y1",D.positionScreen.y);T.setAttribute("x2",U.positionScreen.x);T.setAttribute("y2",U.positionScreen.y);M instanceof THREE.LineBasicMaterial&&(T.setAttribute("style","fill: none; stroke: ##"+k(M.color.hex.toString(16))+"; stroke-width: "+M.linewidth+"; stroke-opacity: "+
-M.opacity+"; stroke-linecap: "+M.linecap+"; stroke-linejoin: "+M.linejoin),p.appendChild(T))}}}else if(N instanceof THREE.RenderableFace3){if(x=N.v1,B=N.v2,A=N.v3,x.positionScreen.x*=u,x.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,A.positionScreen.x*=u,A.positionScreen.y*=-v,w.addPoint(x.positionScreen.x,x.positionScreen.y),w.addPoint(B.positionScreen.x,B.positionScreen.y),w.addPoint(A.positionScreen.x,A.positionScreen.y),F.instersects(w)){o=0;for(E=N.meshMaterials.length;o<
-E;)if(M=N.meshMaterials[o++],M instanceof THREE.MeshFaceMaterial){D=0;for(U=N.faceMaterials.length;D<U;)(M=N.faceMaterials[D++])&&M.opacity!=0&&c(x,B,A,N,M,b)}else M&&M.opacity!=0&&c(x,B,A,N,M,b)}}else if(N instanceof THREE.RenderableFace4&&(x=N.v1,B=N.v2,A=N.v3,y=N.v4,x.positionScreen.x*=u,x.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,A.positionScreen.x*=u,A.positionScreen.y*=-v,y.positionScreen.x*=u,y.positionScreen.y*=-v,w.addPoint(x.positionScreen.x,x.positionScreen.y),w.addPoint(B.positionScreen.x,
-B.positionScreen.y),w.addPoint(A.positionScreen.x,A.positionScreen.y),w.addPoint(y.positionScreen.x,y.positionScreen.y),F.instersects(w))){o=0;for(E=N.meshMaterials.length;o<E;)if(M=N.meshMaterials[o++],M instanceof THREE.MeshFaceMaterial){D=0;for(U=N.faceMaterials.length;D<U;)(M=N.faceMaterials[D++])&&M.opacity!=0&&e(x,B,A,y,N,M,b)}else M&&M.opacity!=0&&e(x,B,A,y,N,M,b)}}};
+THREE.Projector=function(){function b(){var b=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,g=b.z+b.w,h=e.z+e.w,j=-b.z+b.w,m=-e.z+e.w;return g>=0&&h>=0&&j>=0&&m>=0?!0:g<0&&h<0||j<0&&m<0?!1:(g<0?c=Math.max(c,g/(g-h)):h<0&&(f=Math.min(f,g/(g-h))),j<0?c=Math.max(c,j/(j-m)):m<0&&(f=Math.min(f,j/(j-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,h=[],j,m,n=[],p,o,u=[],v,w=[],x,y,D=[],A,H,C=[],E=new THREE.Vector4,I=new THREE.Vector4,
+J=new THREE.Matrix4,S=new THREE.Matrix4,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,F=new THREE.Vector4;this.projectVector=function(b,e){J.multiply(e.projectionMatrix,e.matrixWorldInverse);J.multiplyVector3(b);return b};this.unprojectVector=function(b,e){J.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));J.multiplyVector3(b);return b};this.projectObjects=function(b,e,j){var e=[],m,n,k;g=0;n=
+b.objects;b=0;for(m=n.length;b<m;b++){k=n[b];var p;if(!(p=!k.visible))if(p=k instanceof THREE.Mesh){a:{p=void 0;for(var o=k.matrixWorld,u=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),v=0;v<6;v++)if(p=R[v].x*o.n14+R[v].y*o.n24+R[v].z*o.n34+R[v].w,p<=u){p=!1;break a}p=!0}p=!p}if(!p)p=h[g]=h[g]||new THREE.RenderableObject,g++,f=p,E.copy(k.position),J.multiplyVector3(E),f.object=k,f.z=E.z,e.push(f)}j&&e.sort(c);return e};this.projectScene=function(f,g,h){var E=[],
+U=g.near,k=g.far,ia,L,ga,fa,$,ha,ja,ma,ra,T,ka,ca,oa,da,Y,Z,pa;H=y=v=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);J.multiply(g.projectionMatrix,g.matrixWorldInverse);R[0].set(J.n41-J.n11,J.n42-J.n12,J.n43-J.n13,J.n44-J.n14);R[1].set(J.n41+J.n11,J.n42+J.n12,J.n43+J.n13,J.n44+J.n14);R[2].set(J.n41+J.n21,J.n42+J.n22,J.n43+J.n23,J.n44+J.n24);R[3].set(J.n41-J.n21,J.n42-J.n22,J.n43-J.n23,J.n44-J.n24);R[4].set(J.n41-J.n31,J.n42-J.n32,J.n43-J.n33,J.n44-J.n34);R[5].set(J.n41+J.n31,J.n42+
+J.n32,J.n43+J.n33,J.n44+J.n34);for(ia=0;ia<6;ia++)ra=R[ia],ra.divideScalar(Math.sqrt(ra.x*ra.x+ra.y*ra.y+ra.z*ra.z));ra=this.projectObjects(f,g,!0);f=0;for(ia=ra.length;f<ia;f++)if(T=ra[f].object,T.visible)if(ka=T.matrixWorld,ca=T.matrixRotationWorld,oa=T.materials,da=T.overdraw,m=0,T instanceof THREE.Mesh){Y=T.geometry;fa=Y.vertices;Z=Y.faces;Y=Y.faceVertexUvs;L=0;for(ga=fa.length;L<ga;L++)j=b(),j.positionWorld.copy(fa[L].position),ka.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),
+J.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>U&&j.positionScreen.z<k;fa=0;for(L=Z.length;fa<L;fa++){ga=Z[fa];if(ga instanceof THREE.Face3)if($=n[ga.a],ha=n[ga.b],ja=n[ga.c],$.visible&&ha.visible&&ja.visible&&(T.doubleSided||T.flipSided!=(ja.positionScreen.x-$.positionScreen.x)*(ha.positionScreen.y-$.positionScreen.y)-(ja.positionScreen.y-$.positionScreen.y)*(ha.positionScreen.x-$.positionScreen.x)<0))ma=
+u[o]=u[o]||new THREE.RenderableFace3,o++,p=ma,p.v1.copy($),p.v2.copy(ha),p.v3.copy(ja);else continue;else if(ga instanceof THREE.Face4)if($=n[ga.a],ha=n[ga.b],ja=n[ga.c],ma=n[ga.d],$.visible&&ha.visible&&ja.visible&&ma.visible&&(T.doubleSided||T.flipSided!=((ma.positionScreen.x-$.positionScreen.x)*(ha.positionScreen.y-$.positionScreen.y)-(ma.positionScreen.y-$.positionScreen.y)*(ha.positionScreen.x-$.positionScreen.x)<0||(ha.positionScreen.x-ja.positionScreen.x)*(ma.positionScreen.y-ja.positionScreen.y)-
+(ha.positionScreen.y-ja.positionScreen.y)*(ma.positionScreen.x-ja.positionScreen.x)<0)))pa=w[v]=w[v]||new THREE.RenderableFace4,v++,p=pa,p.v1.copy($),p.v2.copy(ha),p.v3.copy(ja),p.v4.copy(ma);else continue;p.normalWorld.copy(ga.normal);ca.multiplyVector3(p.normalWorld);p.centroidWorld.copy(ga.centroid);ka.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);J.multiplyVector3(p.centroidScreen);ja=ga.vertexNormals;$=0;for(ha=ja.length;$<ha;$++)ma=p.vertexNormalsWorld[$],ma.copy(ja[$]),
+ca.multiplyVector3(ma);$=0;for(ha=Y.length;$<ha;$++)if(pa=Y[$][fa]){ja=0;for(ma=pa.length;ja<ma;ja++)p.uvs[$][ja]=pa[ja]}p.meshMaterials=oa;p.faceMaterials=ga.materials;p.overdraw=da;p.z=p.centroidScreen.z;E.push(p)}}else if(T instanceof THREE.Line){S.multiply(J,ka);fa=T.geometry.vertices;$=b();$.positionScreen.copy(fa[0].position);S.multiplyVector4($.positionScreen);L=1;for(ga=fa.length;L<ga;L++)if($=b(),$.positionScreen.copy(fa[L].position),S.multiplyVector4($.positionScreen),ha=n[m-2],N.copy($.positionScreen),
+F.copy(ha.positionScreen),e(N,F))N.multiplyScalar(1/N.w),F.multiplyScalar(1/F.w),ka=D[y]=D[y]||new THREE.RenderableLine,y++,x=ka,x.v1.positionScreen.copy(N),x.v2.positionScreen.copy(F),x.z=Math.max(N.z,F.z),x.materials=T.materials,E.push(x)}else if(T instanceof THREE.Particle&&(I.set(T.matrixWorld.n14,T.matrixWorld.n24,T.matrixWorld.n34,1),J.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))ka=C[H]=C[H]||new THREE.RenderableParticle,H++,A=ka,A.x=I.x/I.w,A.y=I.y/I.w,A.z=I.z,A.rotation=T.rotation.z,A.scale.x=
+T.scale.x*Math.abs(A.x-(I.x+g.projectionMatrix.n11)/(I.w+g.projectionMatrix.n14)),A.scale.y=T.scale.y*Math.abs(A.y-(I.y+g.projectionMatrix.n22)/(I.w+g.projectionMatrix.n24)),A.materials=T.materials,E.push(A);h&&E.sort(c);return E}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,h;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;h=f/2};this.render=function(e,f){var n,p,o,u,v,w,x,y;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(v=b[n],v instanceof THREE.RenderableParticle){x=v.x*g+g;y=v.y*h+h;o=0;for(u=v.material.length;o<u;o++)if(w=v.material[o],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=x+"px",w.style.top=y+"px"}}};
+THREE.CanvasRenderer=function(b){function c(b){if(A!=b)x.globalAlpha=A=b}function e(b){if(H!=b){switch(b){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}H=b}}function f(b){if(C!=b.hex)C=b.hex,x.strokeStyle="#"+h(C.toString(16))}function g(b){if(E!=b.hex)E=b.hex,x.fillStyle="#"+h(E.toString(16))}function h(b){for(;b.length<6;)b="0"+b;return b}
+var j=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,u,v,w,x=p.getContext("2d"),y=new THREE.Color(0),D=0,A=1,H=0,C=null,E=null,I=null,J=null,S=null,R,N,F,W,K=new THREE.RenderableVertex,X=new THREE.RenderableVertex,Q,U,k,ia,L,ga,fa,$,ha,ja,ma,ra,T=new THREE.Color(0),ka=new THREE.Color(0),ca=new THREE.Color(0),oa=new THREE.Color(0),da=new THREE.Color(0),Y,Z,pa,na,qa,ya,Ca,xa,Aa,Oa,ua=new THREE.Rectangle,ta=new THREE.Rectangle,sa=new THREE.Rectangle,
+Da=!1,ea=new THREE.Color,O=new THREE.Color,wa=new THREE.Color,V=new THREE.Color,la=new THREE.Vector3,aa,Ra,Xa,za,Sa,Ta,b=16;aa=document.createElement("canvas");aa.width=aa.height=2;Ra=aa.getContext("2d");Ra.fillStyle="rgba(0,0,0,1)";Ra.fillRect(0,0,2,2);Xa=Ra.getImageData(0,0,2,2);za=Xa.data;Sa=document.createElement("canvas");Sa.width=Sa.height=b;Ta=Sa.getContext("2d");Ta.translate(-b/2,-b/2);Ta.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
+faces:0};this.setSize=function(b,e){o=b;u=e;v=o/2;w=u/2;p.width=o;p.height=u;ua.set(-v,-w,v,w);ta.set(-v,-w,v,w);A=1;H=0;S=J=I=E=C=null};this.setClearColor=function(b,e){y=b;D=e;ta.set(-v,-w,v,w)};this.setClearColorHex=function(b,e){y.setHex(b);D=e;ta.set(-v,-w,v,w)};this.clear=function(){x.setTransform(1,0,0,-1,v,w);if(!ta.isEmpty())ta.inflate(1),ta.minSelf(ua),y.hex==0&&D==0?x.clearRect(ta.getX(),ta.getY(),ta.getWidth(),ta.getHeight()):(e(THREE.NormalBlending),c(1),x.fillStyle="rgba("+Math.floor(y.r*
+255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+D+")",x.fillRect(ta.getX(),ta.getY(),ta.getWidth(),ta.getHeight())),ta.empty()};this.render=function(b,h){function p(b){var e,c,f,g=b.lights;O.setRGB(0,0,0);wa.setRGB(0,0,0);V.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(O.r+=f.r,O.g+=f.g,O.b+=f.b):c instanceof THREE.DirectionalLight?(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b):c instanceof THREE.PointLight&&(V.r+=f.r,V.g+=f.g,V.b+=f.b)}function o(b,e,c,f){var g,
+h,k,j,m=b.lights,b=0;for(g=m.length;b<g;b++)h=m[b],k=h.color,h instanceof THREE.DirectionalLight?(j=c.dot(h.position),j<=0||(j*=h.intensity,f.r+=k.r*j,f.g+=k.g*j,f.b+=k.b*j)):h instanceof THREE.PointLight&&(j=c.dot(la.sub(h.position,e).normalize()),j<=0||(j*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),j!=0&&(j*=h.intensity,f.r+=k.r*j,f.g+=k.g*j,f.b+=k.b*j)))}function u(b,h,k){c(k.opacity);e(k.blending);var j,m,p,n,o,aa;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)n=
+k.map.image,o=n.width>>1,aa=n.height>>1,k=h.scale.x*v,p=h.scale.y*w,j=k*o,m=p*aa,sa.set(b.x-j,b.y-m,b.x+j,b.y+m),ua.instersects(sa)&&(x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(k,-p),x.translate(-o,-aa),x.drawImage(n,0,0),x.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*v,m=h.scale.y*w,sa.set(b.x-j,b.y-m,b.x+j,b.y+m),ua.instersects(sa)&&(f(k.color),g(k.color),x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(j,m),k.program(x),x.restore()))}function A(b,
+g,h,k){c(k.opacity);e(k.blending);x.beginPath();x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(g.positionScreen.x,g.positionScreen.y);x.closePath();if(k instanceof THREE.LineBasicMaterial){b=k.linewidth;if(I!=b)x.lineWidth=I=b;b=k.linecap;if(J!=b)x.lineCap=J=b;b=k.linejoin;if(S!=b)x.lineJoin=S=b;f(k.color);x.stroke();sa.inflate(k.linewidth*2)}}function D(b,f,g,m,p,n,aa,u,v){j.data.vertices+=3;j.data.faces++;c(u.opacity);e(u.blending);Q=b.positionScreen.x;U=b.positionScreen.y;k=f.positionScreen.x;
+ia=f.positionScreen.y;L=g.positionScreen.x;ga=g.positionScreen.y;C(Q,U,k,ia,L,ga);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(na=aa.uvs[0],Ea(Q,U,k,ia,L,ga,u.map.image,na[m].u,na[m].v,na[p].u,na[p].v,na[n].u,na[n].v));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,la.copy(aa.vertexNormalsWorld[0]),qa=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,ya=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,la.copy(aa.vertexNormalsWorld[1]),
+Ca=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,xa=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,la.copy(aa.vertexNormalsWorld[2]),Aa=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,Oa=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,Ea(Q,U,k,ia,L,ga,u.envMap.image,qa,ya,Ca,xa,Aa,Oa)}else u.wireframe?E(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ga(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof THREE.UVMapping&&(na=aa.uvs[0],Ea(Q,
+U,k,ia,L,ga,u.map.image,na[m].u,na[m].v,na[p].u,na[p].v,na[n].u,na[n].v)),e(THREE.SubtractiveBlending)),Da?!u.wireframe&&u.shading==THREE.SmoothShading&&aa.vertexNormalsWorld.length==3?(ka.r=ca.r=oa.r=O.r,ka.g=ca.g=oa.g=O.g,ka.b=ca.b=oa.b=O.b,o(v,aa.v1.positionWorld,aa.vertexNormalsWorld[0],ka),o(v,aa.v2.positionWorld,aa.vertexNormalsWorld[1],ca),o(v,aa.v3.positionWorld,aa.vertexNormalsWorld[2],oa),da.r=(ca.r+oa.r)*0.5,da.g=(ca.g+oa.g)*0.5,da.b=(ca.b+oa.b)*0.5,pa=Ua(ka,ca,oa,da),Ea(Q,U,k,ia,L,ga,
+pa,0,0,1,0,0,1)):(ea.r=O.r,ea.g=O.g,ea.b=O.b,o(v,aa.centroidWorld,aa.normalWorld,ea),T.r=Math.max(0,Math.min(u.color.r*ea.r,1)),T.g=Math.max(0,Math.min(u.color.g*ea.g,1)),T.b=Math.max(0,Math.min(u.color.b*ea.b,1)),T.updateHex(),u.wireframe?E(T,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ga(T)):u.wireframe?E(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ga(u.color);else if(u instanceof THREE.MeshDepthMaterial)Y=h.near,Z=h.far,ka.r=ka.g=ka.b=1-Ka(b.positionScreen.z,
+Y,Z),ca.r=ca.g=ca.b=1-Ka(f.positionScreen.z,Y,Z),oa.r=oa.g=oa.b=1-Ka(g.positionScreen.z,Y,Z),da.r=(ca.r+oa.r)*0.5,da.g=(ca.g+oa.g)*0.5,da.b=(ca.b+oa.b)*0.5,pa=Ua(ka,ca,oa,da),Ea(Q,U,k,ia,L,ga,pa,0,0,1,0,0,1);else if(u instanceof THREE.MeshNormalMaterial)T.r=Pa(aa.normalWorld.x),T.g=Pa(aa.normalWorld.y),T.b=Pa(aa.normalWorld.z),T.updateHex(),u.wireframe?E(T,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ga(T)}function y(b,f,g,m,p,n,u,aa,v){j.data.vertices+=4;j.data.faces++;c(aa.opacity);
+e(aa.blending);if(aa.map||aa.envMap)D(b,f,m,0,1,3,u,aa,v),D(p,g,n,1,2,3,u,aa,v);else if(Q=b.positionScreen.x,U=b.positionScreen.y,k=f.positionScreen.x,ia=f.positionScreen.y,L=g.positionScreen.x,ga=g.positionScreen.y,fa=m.positionScreen.x,$=m.positionScreen.y,ha=p.positionScreen.x,ja=p.positionScreen.y,ma=n.positionScreen.x,ra=n.positionScreen.y,aa instanceof THREE.MeshBasicMaterial)H(Q,U,k,ia,L,ga,fa,$),aa.wireframe?E(aa.color,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(aa.color);
+else if(aa instanceof THREE.MeshLambertMaterial)Da?!aa.wireframe&&aa.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==4?(ka.r=ca.r=oa.r=da.r=O.r,ka.g=ca.g=oa.g=da.g=O.g,ka.b=ca.b=oa.b=da.b=O.b,o(v,u.v1.positionWorld,u.vertexNormalsWorld[0],ka),o(v,u.v2.positionWorld,u.vertexNormalsWorld[1],ca),o(v,u.v4.positionWorld,u.vertexNormalsWorld[3],oa),o(v,u.v3.positionWorld,u.vertexNormalsWorld[2],da),pa=Ua(ka,ca,oa,da),C(Q,U,k,ia,fa,$),Ea(Q,U,k,ia,fa,$,pa,0,0,1,0,0,1),C(ha,ja,L,ga,ma,ra),Ea(ha,
+ja,L,ga,ma,ra,pa,1,0,1,1,0,1)):(ea.r=O.r,ea.g=O.g,ea.b=O.b,o(v,u.centroidWorld,u.normalWorld,ea),T.r=Math.max(0,Math.min(aa.color.r*ea.r,1)),T.g=Math.max(0,Math.min(aa.color.g*ea.g,1)),T.b=Math.max(0,Math.min(aa.color.b*ea.b,1)),T.updateHex(),H(Q,U,k,ia,L,ga,fa,$),aa.wireframe?E(T,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(T)):(H(Q,U,k,ia,L,ga,fa,$),aa.wireframe?E(aa.color,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(aa.color));else if(aa instanceof THREE.MeshNormalMaterial)T.r=
+Pa(u.normalWorld.x),T.g=Pa(u.normalWorld.y),T.b=Pa(u.normalWorld.z),T.updateHex(),H(Q,U,k,ia,L,ga,fa,$),aa.wireframe?E(T,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(T);else if(aa instanceof THREE.MeshDepthMaterial)Y=h.near,Z=h.far,ka.r=ka.g=ka.b=1-Ka(b.positionScreen.z,Y,Z),ca.r=ca.g=ca.b=1-Ka(f.positionScreen.z,Y,Z),oa.r=oa.g=oa.b=1-Ka(m.positionScreen.z,Y,Z),da.r=da.g=da.b=1-Ka(g.positionScreen.z,Y,Z),pa=Ua(ka,ca,oa,da),C(Q,U,k,ia,fa,$),Ea(Q,U,k,ia,fa,$,pa,0,0,1,0,0,1),C(ha,
+ja,L,ga,ma,ra),Ea(ha,ja,L,ga,ma,ra,pa,1,0,1,1,0,1)}function C(b,e,c,f,g,h){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,h);x.lineTo(b,e);x.closePath()}function H(b,e,c,f,g,h,k,j){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,h);x.lineTo(k,j);x.lineTo(b,e);x.closePath()}function E(b,e,c,g){if(I!=e)x.lineWidth=I=e;if(J!=c)x.lineCap=J=c;if(S!=g)x.lineJoin=S=g;f(b);x.stroke();sa.inflate(e*2)}function Ga(b){g(b);x.fill()}function Ea(b,e,c,f,g,h,k,j,m,p,n,aa,u){var o,v;o=k.width-1;v=k.height-
+1;j*=o;m*=v;p*=o;n*=v;aa*=o;u*=v;c-=b;f-=e;g-=b;h-=e;p-=j;n-=m;aa-=j;u-=m;o=p*u-aa*n;if(!((o<0?-o:o)<1))v=1/o,o=(u*c-n*g)*v,n=(u*f-n*h)*v,c=(p*g-aa*c)*v,f=(p*h-aa*f)*v,b=b-o*j-c*m,e=e-n*j-f*m,x.save(),x.transform(o,n,c,f,b,e),x.clip(),x.drawImage(k,0,0),x.restore()}function Ua(b,e,c,f){var g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(e.r*255),j=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),n=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);za[0]=g<0?0:g>255?255:g;za[1]=h<0?0:h>255?
+255:h;za[2]=b<0?0:b>255?255:b;za[4]=k<0?0:k>255?255:k;za[5]=j<0?0:j>255?255:j;za[6]=e<0?0:e>255?255:e;za[8]=m<0?0:m>255?255:m;za[9]=p<0?0:p>255?255:p;za[10]=c<0?0:c>255?255:c;za[12]=n<0?0:n>255?255:n;za[13]=u<0?0:u>255?255:u;za[14]=f<0?0:f>255?255:f;Ra.putImageData(Xa,0,0);Ta.drawImage(aa,0,0);return Sa}function Ka(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Pa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ha(b,e){var c=e.x-b.x,f=e.y-b.y,g=c*c+f*f;g!=0&&(g=1/Math.sqrt(g),c*=g,f*=g,e.x+=c,e.y+=
+f,b.x-=c,b.y-=f)}var Va,G,M,B,Ia,Qa,Wa,va;this.autoClear?this.clear():x.setTransform(1,0,0,-1,v,w);j.data.vertices=0;j.data.faces=0;m=n.projectScene(b,h,this.sortElements);(Da=b.lights.length>0)&&p(b);Va=0;for(G=m.length;Va<G;Va++){M=m[Va];sa.empty();if(M instanceof THREE.RenderableParticle){R=M;R.x*=v;R.y*=w;B=0;for(Ia=M.materials.length;B<Ia;)va=M.materials[B++],va.opacity!=0&&u(R,M,va,b)}else if(M instanceof THREE.RenderableLine){if(R=M.v1,N=M.v2,R.positionScreen.x*=v,R.positionScreen.y*=w,N.positionScreen.x*=
+v,N.positionScreen.y*=w,sa.addPoint(R.positionScreen.x,R.positionScreen.y),sa.addPoint(N.positionScreen.x,N.positionScreen.y),ua.instersects(sa)){B=0;for(Ia=M.materials.length;B<Ia;)va=M.materials[B++],va.opacity!=0&&A(R,N,M,va,b)}}else if(M instanceof THREE.RenderableFace3){if(R=M.v1,N=M.v2,F=M.v3,R.positionScreen.x*=v,R.positionScreen.y*=w,N.positionScreen.x*=v,N.positionScreen.y*=w,F.positionScreen.x*=v,F.positionScreen.y*=w,M.overdraw&&(Ha(R.positionScreen,N.positionScreen),Ha(N.positionScreen,
+F.positionScreen),Ha(F.positionScreen,R.positionScreen)),sa.add3Points(R.positionScreen.x,R.positionScreen.y,N.positionScreen.x,N.positionScreen.y,F.positionScreen.x,F.positionScreen.y),ua.instersects(sa)){B=0;for(Ia=M.meshMaterials.length;B<Ia;)if(va=M.meshMaterials[B++],va instanceof THREE.MeshFaceMaterial){Qa=0;for(Wa=M.faceMaterials.length;Qa<Wa;)(va=M.faceMaterials[Qa++])&&va.opacity!=0&&D(R,N,F,0,1,2,M,va,b)}else va.opacity!=0&&D(R,N,F,0,1,2,M,va,b)}}else if(M instanceof THREE.RenderableFace4&&
+(R=M.v1,N=M.v2,F=M.v3,W=M.v4,R.positionScreen.x*=v,R.positionScreen.y*=w,N.positionScreen.x*=v,N.positionScreen.y*=w,F.positionScreen.x*=v,F.positionScreen.y*=w,W.positionScreen.x*=v,W.positionScreen.y*=w,K.positionScreen.copy(N.positionScreen),X.positionScreen.copy(W.positionScreen),M.overdraw&&(Ha(R.positionScreen,N.positionScreen),Ha(N.positionScreen,W.positionScreen),Ha(W.positionScreen,R.positionScreen),Ha(F.positionScreen,K.positionScreen),Ha(F.positionScreen,X.positionScreen)),sa.addPoint(R.positionScreen.x,
+R.positionScreen.y),sa.addPoint(N.positionScreen.x,N.positionScreen.y),sa.addPoint(F.positionScreen.x,F.positionScreen.y),sa.addPoint(W.positionScreen.x,W.positionScreen.y),ua.instersects(sa))){B=0;for(Ia=M.meshMaterials.length;B<Ia;)if(va=M.meshMaterials[B++],va instanceof THREE.MeshFaceMaterial){Qa=0;for(Wa=M.faceMaterials.length;Qa<Wa;)(va=M.faceMaterials[Qa++])&&va.opacity!=0&&y(R,N,F,W,K,X,M,va,b)}else va.opacity!=0&&y(R,N,F,W,K,X,M,va,b)}ta.addRectangle(sa)}x.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,e,c){var f,g,h,k;f=0;for(g=b.lights.length;f<g;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(k=e.normalWorld.dot(h.position)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k)):h instanceof THREE.PointLight&&(W.sub(h.position,e.centroidWorld),W.normalize(),k=e.normalWorld.dot(W)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k))}function c(e,c,k,m,n,u){j.data.vertices+=3;j.data.faces++;Q=f(U++);Q.setAttribute("d",
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?I.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?E?(J.r=S.r,J.g=S.g,J.b=S.b,b(u,m,J),I.r=Math.max(0,Math.min(n.color.r*J.r,1)),I.g=Math.max(0,Math.min(n.color.g*J.g,1)),I.b=Math.max(0,Math.min(n.color.b*J.b,1)),I.updateHex()):I.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(F=1-n.__2near/(n.__farPlusNear-
+m.z*n.__farMinusNear),I.setRGB(F,F,F)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?Q.setAttribute("style","fill: none; stroke: #"+h(I.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):Q.setAttribute("style","fill: #"+h(I.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(Q)}function e(e,c,k,m,
+n,u,o){j.data.vertices+=4;j.data.faces++;Q=f(U++);Q.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?I.hex=u.color.hex:u instanceof THREE.MeshLambertMaterial?E?(J.r=S.r,J.g=S.g,J.b=S.b,b(o,n,J),I.r=Math.max(0,Math.min(u.color.r*J.r,1)),I.g=Math.max(0,Math.min(u.color.g*J.g,1)),I.b=Math.max(0,Math.min(u.color.b*
+J.b,1)),I.updateHex()):I.hex=u.color.hex:u instanceof THREE.MeshDepthMaterial?(F=1-u.__2near/(u.__farPlusNear-n.z*u.__farMinusNear),I.setRGB(F,F,F)):u instanceof THREE.MeshNormalMaterial&&I.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));u.wireframe?Q.setAttribute("style","fill: none; stroke: #"+h(I.hex.toString(16))+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):Q.setAttribute("style",
+"fill: #"+h(I.hex.toString(16))+"; fill-opacity: "+u.opacity);p.appendChild(Q)}function f(b){K[b]==null&&(K[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),ia==0&&K[b].setAttribute("shape-rendering","crispEdges"));return K[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function h(b){for(;b.length<6;)b="0"+b;return b}var j=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,u,v,w,x,y,D,A,H=new THREE.Rectangle,C=new THREE.Rectangle,
+E=!1,I=new THREE.Color(16777215),J=new THREE.Color(16777215),S=new THREE.Color(0),R=new THREE.Color(0),N=new THREE.Color(0),F,W=new THREE.Vector3,K=[],X=[],Q,U,k,ia=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":ia=1;break;case "low":ia=0}};this.setSize=function(b,e){o=b;u=e;v=o/2;w=u/2;p.setAttribute("viewBox",-v+" "+-w+" "+o+" "+u);p.setAttribute("width",o);p.setAttribute("height",u);H.set(-v,
+-w,v,w)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,f){var g,u,o,I,J,F,T,K;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;m=n.projectScene(b,f,this.sortElements);k=U=0;if(E=b.lights.length>0){T=b.lights;S.setRGB(0,0,0);R.setRGB(0,0,0);N.setRGB(0,0,0);g=0;for(u=T.length;g<u;g++)o=T[g],I=o.color,o instanceof THREE.AmbientLight?(S.r+=I.r,S.g+=I.g,S.b+=I.b):o instanceof THREE.DirectionalLight?(R.r+=I.r,R.g+=I.g,R.b+=I.b):o instanceof
+THREE.PointLight&&(N.r+=I.r,N.g+=I.g,N.b+=I.b)}g=0;for(u=m.length;g<u;g++)if(T=m[g],C.empty(),T instanceof THREE.RenderableParticle){x=T;x.x*=v;x.y*=-w;o=0;for(I=T.materials.length;o<I;)o++}else if(T instanceof THREE.RenderableLine){if(x=T.v1,y=T.v2,x.positionScreen.x*=v,x.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),H.instersects(C)){o=0;for(I=T.materials.length;o<I;)if((K=T.materials[o++])&&
+K.opacity!=0){J=x;F=y;var W=k++;X[W]==null&&(X[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),ia==0&&X[W].setAttribute("shape-rendering","crispEdges"));Q=X[W];Q.setAttribute("x1",J.positionScreen.x);Q.setAttribute("y1",J.positionScreen.y);Q.setAttribute("x2",F.positionScreen.x);Q.setAttribute("y2",F.positionScreen.y);K instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: ##"+h(K.color.hex.toString(16))+"; stroke-width: "+K.linewidth+"; stroke-opacity: "+
+K.opacity+"; stroke-linecap: "+K.linecap+"; stroke-linejoin: "+K.linejoin),p.appendChild(Q))}}}else if(T instanceof THREE.RenderableFace3){if(x=T.v1,y=T.v2,D=T.v3,x.positionScreen.x*=v,x.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,D.positionScreen.x*=v,D.positionScreen.y*=-w,C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),C.addPoint(D.positionScreen.x,D.positionScreen.y),H.instersects(C)){o=0;for(I=T.meshMaterials.length;o<
+I;)if(K=T.meshMaterials[o++],K instanceof THREE.MeshFaceMaterial){J=0;for(F=T.faceMaterials.length;J<F;)(K=T.faceMaterials[J++])&&K.opacity!=0&&c(x,y,D,T,K,b)}else K&&K.opacity!=0&&c(x,y,D,T,K,b)}}else if(T instanceof THREE.RenderableFace4&&(x=T.v1,y=T.v2,D=T.v3,A=T.v4,x.positionScreen.x*=v,x.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,D.positionScreen.x*=v,D.positionScreen.y*=-w,A.positionScreen.x*=v,A.positionScreen.y*=-w,C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(y.positionScreen.x,
+y.positionScreen.y),C.addPoint(D.positionScreen.x,D.positionScreen.y),C.addPoint(A.positionScreen.x,A.positionScreen.y),H.instersects(C))){o=0;for(I=T.meshMaterials.length;o<I;)if(K=T.meshMaterials[o++],K instanceof THREE.MeshFaceMaterial){J=0;for(F=T.faceMaterials.length;J<F;)(K=T.faceMaterials[J++])&&K.opacity!=0&&e(x,y,D,A,T,K,b)}else K&&K.opacity!=0&&e(x,y,D,A,T,K,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -218,134 +218,134 @@ THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderC
 THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,
 THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,
 THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,
 THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,
 "}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
 "}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function c(b,e,c){var f,g,h,k=b.vertices,m=k.length,t=b.colors,n=t.length,p=b.__vertexArray,o=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,x=b.__dirtyColors,y=b.__webglCustomAttributes,A,w;if(y)for(A in y)y[A].offset=0;if(c.sortParticles){oa.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=k[f].position,wa.copy(g),oa.multiplyVector3(wa),u[f]=[wa.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=k[u[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;
-for(f=0;f<n;f++)h=f*3,color=t[u[f][1]],o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b;if(y)for(A in y){f=y[A];t=f.value.length;for(h=0;h<t;h++){index=u[h][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")w=f.value[index];f.size===2?(f.array[n]=w.x,f.array[n+1]=w.y):f.size===3?f.type==="c"?(f.array[n]=w.r,f.array[n+1]=w.g,f.array[n+2]=w.b):(f.array[n]=w.x,f.array[n+1]=w.y,f.array[n+2]=w.z):(f.array[n]=
-w.x,f.array[n+1]=w.y,f.array[n+2]=w.z,f.array[n+3]=w.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)g=k[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(x)for(f=0;f<n;f++)color=t[f],h=f*3,o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b;if(y)for(A in y)if(f=y[A],f.__original.needsUpdate){t=f.value.length;for(h=0;h<t;h++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")w=f.value[h];f.size===2?(f.array[n]=
-w.x,f.array[n+1]=w.y):f.size===3?f.type==="c"?(f.array[n]=w.r,f.array[n+1]=w.g,f.array[n+2]=w.b):(f.array[n]=w.x,f.array[n+1]=w.y,f.array[n+2]=w.z):(f.array[n]=w.x,f.array[n+1]=w.y,f.array[n+2]=w.z,f.array[n+3]=w.w)}f.offset+=f.size}}}if(v||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,p,e);if(x||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,o,e);if(y)for(A in y)if(f=y[A],f.__original.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,
-f.buffer),j.bufferData(j.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||R.initMaterial(f,e,c,g);var h=f.program,k=h.uniforms,m=f.uniforms;h!=P&&(j.useProgram(h),P=h);j.uniformMatrix4fv(k.projectionMatrix,!1,ha);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,
-m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,t,p=0,o=0,u=0,v,x,y,A,w=Aa,B=w.directional.colors,F=w.directional.positions,E=w.point.colors,D=w.point.positions,I=w.point.distances,H=0,C=0,c=t=A=0;for(n=e.length;c<n;c++)if(t=e[c],v=t.color,x=t.position,y=t.intensity,A=t.distance,t instanceof THREE.AmbientLight)p+=v.r,o+=v.g,u+=v.b;else if(t instanceof THREE.DirectionalLight)A=
-H*3,B[A]=v.r*y,B[A+1]=v.g*y,B[A+2]=v.b*y,F[A]=x.x,F[A+1]=x.y,F[A+2]=x.z,H+=1;else if(t instanceof THREE.PointLight)t=C*3,E[t]=v.r*y,E[t+1]=v.g*y,E[t+2]=v.b*y,D[t]=x.x,D[t+1]=x.y,D[t+2]=x.z,I[C]=A,C+=1;for(c=H*3;c<B.length;c++)B[c]=0;for(c=C*3;c<E.length;c++)E[c]=0;w.point.length=C;w.directional.length=H;w.ambient[0]=p;w.ambient[1]=o;w.ambient[2]=u;c=Aa;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,g,h,j=b.vertices,m=j.length,n=b.colors,u=n.length,p=b.__vertexArray,o=b.__colorArray,v=b.__sortArray,w=b.__dirtyVertices,x=b.__dirtyColors,A=b.__webglCustomAttributes,D,y;if(A)for(D in A)A[D].offset=0;if(c.sortParticles){pa.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=j[f].position,ya.copy(g),pa.multiplyVector3(ya),v[f]=[ya.z,f];v.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=j[v[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;
+for(f=0;f<u;f++)h=f*3,color=n[v[f][1]],o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b;if(A)for(D in A){f=A[D];n=f.value.length;for(h=0;h<n;h++){index=v[h][1];u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[u]=y.x,f.array[u+1]=y.y):f.size===3?f.type==="c"?(f.array[u]=y.r,f.array[u+1]=y.g,f.array[u+2]=y.b):(f.array[u]=y.x,f.array[u+1]=y.y,f.array[u+2]=y.z):(f.array[u]=
+y.x,f.array[u+1]=y.y,f.array[u+2]=y.z,f.array[u+3]=y.w)}f.offset+=f.size}}}else{if(w)for(f=0;f<m;f++)g=j[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(x)for(f=0;f<u;f++)color=n[f],h=f*3,o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b;if(A)for(D in A)if(f=A[D],f.__original.needsUpdate){n=f.value.length;for(h=0;h<n;h++){u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[h];f.size===2?(f.array[u]=
+y.x,f.array[u+1]=y.y):f.size===3?f.type==="c"?(f.array[u]=y.r,f.array[u+1]=y.g,f.array[u+2]=y.b):(f.array[u]=y.x,f.array[u+1]=y.y,f.array[u+2]=y.z):(f.array[u]=y.x,f.array[u+1]=y.y,f.array[u+2]=y.z,f.array[u+3]=y.w)}f.offset+=f.size}}}if(w||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,p,e);if(x||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,o,e);if(A)for(D in A)if(f=A[D],f.__original.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
+f.buffer),k.bufferData(k.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||U.initMaterial(f,e,c,g);var h=f.program,j=h.uniforms,m=f.uniforms;h!=L&&(k.useProgram(h),L=h);k.uniformMatrix4fv(j.projectionMatrix,!1,na);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,
+m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var u,n,p=0,o=0,v=0,w,x,A,y,D=Ca,C=D.directional.colors,I=D.directional.positions,H=D.point.colors,J=D.point.positions,E=D.point.distances,Y=0,G=0,c=n=y=0;for(u=e.length;c<u;c++)if(n=e[c],w=n.color,x=n.position,A=n.intensity,y=n.distance,n instanceof THREE.AmbientLight)p+=w.r,o+=w.g,v+=w.b;else if(n instanceof THREE.DirectionalLight)y=
+Y*3,C[y]=w.r*A,C[y+1]=w.g*A,C[y+2]=w.b*A,I[y]=x.x,I[y+1]=x.y,I[y+2]=x.z,Y+=1;else if(n instanceof THREE.PointLight)n=G*3,H[n]=w.r*A,H[n+1]=w.g*A,H[n+2]=w.b*A,J[n]=x.x,J[n+1]=x.y,J[n+2]=x.z,E[G]=y,G+=1;for(c=Y*3;c<C.length;c++)C[c]=0;for(c=G*3;c<H.length;c++)H[c]=0;D.point.length=G;D.directional.length=Y;D.ambient[0]=p;D.ambient[1]=o;D.ambient[2]=v;c=Ca;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;
 m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=
 m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=
-f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=va.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=
-f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var K in m)if(o=h.uniforms[K])if(n=m[K],p=n.type,c=n.value,p=="i")j.uniform1i(o,c);else if(p=="f")j.uniform1f(o,c);else if(p=="fv1")j.uniform1fv(o,c);else if(p=="fv")j.uniform3fv(o,c);else if(p=="v2")j.uniform2f(o,c.x,c.y);else if(p=="v3")j.uniform3f(o,
-c.x,c.y,c.z);else if(p=="v4")j.uniform4f(o,c.x,c.y,c.z,c.w);else if(p=="c")j.uniform3f(o,c.r,c.g,c.b);else if(p=="t"&&(j.uniform1i(o,c),n=n.texture))if(n.image instanceof Array&&n.image.length==6){if(n.image.length==6){if(n.needsUpdate){if(n.__webglInit){j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(p=0;p<6;++p)j.texSubImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,j.RGBA,j.UNSIGNED_BYTE,n.image[p])}else{n.image.__webglTextureCube=j.createTexture();j.bindTexture(j.TEXTURE_CUBE_MAP,
-n.image.__webglTextureCube);for(p=0;p<6;++p)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,n.image[p]);n.__webglInit=!0}G(j.TEXTURE_CUBE_MAP,n,n.image[0]);j.bindTexture(j.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}j.activeTexture(j.TEXTURE0+c);j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else U(n,c);j.uniformMatrix4fv(k.modelViewMatrix,!1,g._modelViewMatrixArray);j.uniformMatrix3fv(k.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
-f instanceof THREE.MeshPhongMaterial||f.envMap)&&k.cameraPosition!==null&&j.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&k.objectMatrix!==null&&j.uniformMatrix4fv(k.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&k.viewMatrix!==null&&j.uniformMatrix4fv(k.viewMatrix,!1,na);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=
-m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,j.uniform3fv(k.directionalLightDirection,b),j.uniformMatrix4fv(k.objectMatrix,!1,g._objectMatrixArray),j.uniformMatrix4fv(k.viewMatrix,!1,na);f.skinning&&(j.uniformMatrix4fv(k.cameraInverseMatrix,!1,na),j.uniformMatrix4fv(k.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,k){if(g.opacity!=0){var m,b=e(b,c,f,g,k).attributes;if(!g.morphTargets&&b.position>=0)j.bindBuffer(j.ARRAY_BUFFER,
-h.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0);else{c=g.program.attributes;k.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,n=k.morphTargetForcedOrder,t=k.morphTargetInfluences;f<g.numSupportedMorphTargets&&
-f<n.length;)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[n[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=t[n[f]],f++;else{var n=[],p=-1,o=0,t=k.morphTargetInfluences,u,v=t.length,f=0;for(k.morphTargetBase!==-1&&(n[k.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(u=0;u<v;u++)!n[u]&&t[u]>p&&(o=u,p=t[o]);j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=
-p;n[o]=1;p=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(g.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[m],c.size,j.FLOAT,!1,0,0));b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,
-h.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,
-0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,
-h.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));k instanceof THREE.Mesh?(g.wireframe?(j.lineWidth(g.wireframeLinewidth),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.drawElements(j.LINES,h.__webglLineCount,j.UNSIGNED_SHORT,0)):(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.drawElements(j.TRIANGLES,h.__webglFaceCount,j.UNSIGNED_SHORT,0)),R.data.vertices+=h.__webglFaceCount,R.data.faces+=h.__webglFaceCount/3,R.data.drawCalls++):k instanceof
-THREE.Line?(k=k.type==THREE.LineStrip?j.LINE_STRIP:j.LINES,j.lineWidth(g.linewidth),j.drawArrays(k,0,h.__webglLineCount),R.data.drawCalls++):k instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,h.__webglParticleCount),R.data.drawCalls++):k instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,h.__webglVertexCount),R.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=j.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=j.createBuffer();b.hasPos&&
-(j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,b.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(e.attributes.position),j.vertexAttribPointer(e.attributes.position,3,j.FLOAT,!1,0,0));if(b.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,g,h,k,m,n,t,p,o,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],g=c[u+1],h=c[u+2],k=c[u+3],n=c[u+4],p=c[u+5],m=c[u+6],t=c[u+7],o=c[u+8],f=(f+k+m)/3,g=(g+n+t)/3,h=(h+p+o)/3,c[u]=
-f,c[u+1]=g,c[u+2]=h,c[u+3]=f,c[u+4]=g,c[u+5]=h,c[u+6]=f,c[u+7]=g,c[u+8]=h}j.bufferData(j.ARRAY_BUFFER,b.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(e.attributes.normal);j.vertexAttribPointer(e.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,b.count);b.count=0}function k(b){if(Y!=b.doubleSided)b.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),Y=b.doubleSided;if(ea!=b.flipSided)b.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ea=b.flipSided}function h(b){la!=b&&(b?
-j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),la=b)}function m(b,e,c){pa!=b&&(b?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),pa=b);if(b&&(N!=e||ia!=c))j.polygonOffset(e,c),N=e,ia=c}function n(b){V[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);V[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);V[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);V[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);V[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);
-V[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=V[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function p(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=V[f].x*e.n14+V[f].y*e.n24+V[f].z*e.n34+V[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function t(b){var e,c,f=b.object,g=b.opaque,h=b.transparent;h.count=0;b=g.count=0;for(e=f.materials.length;b<
-e;b++)c=f.materials[b],c.transparent?o(h,c):o(g,c)}function u(b){var e,c,f,g,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(e=h.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(g=j.materials[e])&&(g.transparent?o(m,g):o(k,g))}else(g=e)&&(g.transparent?o(m,g):o(k,g))}function v(b,e){return e.z-b.z}function x(b){j.enable(j.POLYGON_OFFSET_FILL);j.polygonOffset(0.1,1);j.enable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);
-j.depthMask(!1);j.colorMask(!1,!1,!1,!1);j.stencilFunc(j.ALWAYS,1,255);j.stencilOpSeparate(j.BACK,j.KEEP,j.INCR,j.KEEP);j.stencilOpSeparate(j.FRONT,j.KEEP,j.DECR,j.KEEP);var e,c=b.lights.length,f,g=b.lights,h=[],k,m,n,t,p,o=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){h[0]=-f.position.x;h[1]=-f.position.y;h[2]=-f.position.z;for(p=0;p<o;p++)f=b.__webglShadowVolumes[p].object,k=b.__webglShadowVolumes[p].buffer,m=f.materials[0],m.program||
-R.initMaterial(m,g,void 0,f),m=m.program,n=m.uniforms,t=m.attributes,P!==m&&(j.useProgram(m),P=m,j.uniformMatrix4fv(n.projectionMatrix,!1,ha),j.uniformMatrix4fv(n.viewMatrix,!1,na),j.uniform3fv(n.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),j.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),j.bindBuffer(j.ARRAY_BUFFER,k.__webglVertexBuffer),j.vertexAttribPointer(t.position,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,k.__webglNormalBuffer),j.vertexAttribPointer(t.normal,
-3,j.FLOAT,!1,0,0),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),j.cullFace(j.FRONT),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0),j.cullFace(j.BACK),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0)}j.disable(j.POLYGON_OFFSET_FILL);j.colorMask(!0,!0,!0,!0);j.stencilFunc(j.NOTEQUAL,0,255);j.stencilOp(j.KEEP,j.KEEP,j.KEEP);j.disable(j.DEPTH_TEST);la=ga=-1;P=aa.program;j.useProgram(aa.program);j.uniformMatrix4fv(aa.projectionLocation,!1,ha);j.uniform1f(aa.darknessLocation,
-aa.darkness);j.bindBuffer(j.ARRAY_BUFFER,aa.vertexBuffer);j.vertexAttribPointer(aa.vertexLocation,3,j.FLOAT,!1,0,0);j.enableVertexAttribArray(aa.vertexLocation);j.blendFunc(j.ONE,j.ONE_MINUS_SRC_ALPHA);j.blendEquation(j.FUNC_ADD);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,aa.elementBuffer);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.disable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(ca)}function B(b,e){var c,f,g;c=Q.attributes;var h=Q.uniforms,k=I/$,m,n=[],t=$*0.5,p=I*0.5,o=!0;j.useProgram(Q.program);
-P=Q.program;la=ga=-1;ka||(j.enableVertexAttribArray(Q.attributes.position),j.enableVertexAttribArray(Q.attributes.uv),ka=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,Q.vertexBuffer);j.vertexAttribPointer(c.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);j.uniformMatrix4fv(h.projectionMatrix,!1,ha);j.activeTexture(j.TEXTURE0);j.uniform1i(h.map,0);c=0;for(f=b.__webglSprites.length;c<
-f;c++)g=b.__webglSprites[c],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(v);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(j.uniform1i(h.useScreenCoordinates,1),j.uniform3f(h.screenPosition,(g.position.x-t)/t,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):
-(j.uniform1i(h.useScreenCoordinates,0),j.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),j.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),m=g.map.image.width/(g.scaleByViewport?I:1),n[0]=m*k*g.scale.x,n[1]=m*g.scale.y,j.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),j.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),j.uniform2f(h.alignment,g.alignment.x,g.alignment.y),j.uniform1f(h.opacity,g.opacity),j.uniform1f(h.rotation,g.rotation),j.uniform2fv(h.scale,n),g.mergeWith3D&&
-!o?(j.enable(j.DEPTH_TEST),o=!0):!g.mergeWith3D&&o&&(j.disable(j.DEPTH_TEST),o=!1),J(g.blending),U(g.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ca)}function A(b,e){var c,f,g=b.__webglLensFlares.length,h,k,m,n=new THREE.Vector3,t=I/$,p=$*0.5,o=I*0.5,u=16/I,v=[u*t,u],x=[1,1,0],y=[1,1],A=L.uniforms;c=L.attributes;j.useProgram(L.program);P=L.program;la=ga=-1;ua||(j.enableVertexAttribArray(L.attributes.vertex),j.enableVertexAttribArray(L.attributes.uv),
-ua=!0);j.uniform1i(A.occlusionMap,0);j.uniform1i(A.map,1);j.bindBuffer(j.ARRAY_BUFFER,L.vertexBuffer);j.vertexAttribPointer(c.vertex,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,L.elementBuffer);j.disable(j.CULL_FACE);j.depthMask(!1);j.activeTexture(j.TEXTURE0);j.bindTexture(j.TEXTURE_2D,L.occlusionTexture);j.activeTexture(j.TEXTURE1);for(f=0;f<g;f++)if(c=b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),
-e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),x[0]=n.x,x[1]=n.y,x[2]=n.z,y[0]=x[0]*p+p,y[1]=x[1]*o+o,L.hasVertexTexture||y[0]>0&&y[0]<$&&y[1]>0&&y[1]<I){j.bindTexture(j.TEXTURE_2D,L.tempTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGB,y[0]-8,y[1]-8,16,16,0);j.uniform1i(A.renderType,0);j.uniform2fv(A.scale,v);j.uniform3fv(A.screenPosition,x);j.disable(j.BLEND);j.enable(j.DEPTH_TEST);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.bindTexture(j.TEXTURE_2D,L.occlusionTexture);
-j.copyTexImage2D(j.TEXTURE_2D,0,j.RGBA,y[0]-8,y[1]-8,16,16,0);j.uniform1i(A.renderType,1);j.disable(j.DEPTH_TEST);j.bindTexture(j.TEXTURE_2D,L.tempTexture);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);c.positionScreen.x=x[0];c.positionScreen.y=x[1];c.positionScreen.z=x[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();j.uniform1i(A.renderType,2);j.enable(j.BLEND);h=0;for(k=c.lensFlares.length;h<k;h++)if(m=c.lensFlares[h],m.opacity>0.0010&&m.scale>0.0010)x[0]=m.x,x[1]=m.y,
-x[2]=m.z,u=m.size*m.scale/I,v[0]=u*t,v[1]=u,j.uniform3fv(A.screenPosition,x),j.uniform2fv(A.scale,v),j.uniform1f(A.rotation,m.rotation),j.uniform1f(A.opacity,m.opacity),J(m.blending),U(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ca)}function y(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function F(b){var e,c,f,g;g=b.__materials;b=0;for(c=g.length;b<c;b++)if(f=g[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function w(b){var e,c,f,g;g=b.__materials;b=0;for(c=g.length;b<c;b++)if(f=g[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function H(b){var e,f,g,h;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(g=f.geometryGroups[e],h=F(g),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||
-f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||h){h=g;var k=b,m=j.DYNAMIC_DRAW;if(h.__inittedArrays){var n=void 0,t=void 0,p=void 0,o=void 0,u=p=void 0,v=void 0,x=void 0,y=void 0,A=void 0,B=void 0,E=void 0,D=void 0,H=void 0,I=void 0,V=void 0,J=void 0,G=void 0,C=o=y=o=x=v=void 0,K=void 0,z=K=C=v=void 0,M=void 0,P=z=K=C=p=p=u=y=o=z=K=C=M=z=K=C=M=z=K=C=void 0,L=0,N=0,U=0,oa=0,S=0,Q=0,ha=0,T=0,Y=0,O=0,R=0,K=C=0,W=h.__vertexArray,aa=h.__uvArray,fa=h.__uv2Array,da=h.__normalArray,X=h.__tangentArray,
-ca=h.__colorArray,na=h.__skinVertexAArray,ea=h.__skinVertexBArray,Z=h.__skinIndexArray,$=h.__skinWeightArray,ma=h.__morphTargetsArrays,ia=h.__webglCustomAttributes,z=void 0,ga=h.__faceArray,la=h.__lineArray,pa=h.__needsSmoothNormals,B=h.__vertexColorType,A=h.__uvType,E=h.__normalType,ka=k.geometry,wa=ka.__dirtyVertices,ra=ka.__dirtyElements,qa=ka.__dirtyUvs,sa=ka.__dirtyNormals,Aa=ka.__dirtyTangents,va=ka.__dirtyColors,ya=ka.__dirtyMorphTargets,ua=ka.vertices,Ba=h.faces,Ma=ka.faces,Wa=ka.faceVertexUvs[0],
-Xa=ka.faceVertexUvs[1],Ja=ka.skinVerticesA,Ka=ka.skinVerticesB,La=ka.skinIndices,Da=ka.skinWeights,Ha=k instanceof THREE.ShadowVolume?ka.edgeFaces:void 0,za=ka.morphTargets;if(ia)for(P in ia)ia[P].offset=0,ia[P].offsetSrc=0;n=0;for(t=Ba.length;n<t;n++)if(p=Ba[n],o=Ma[p],Wa&&(D=Wa[p]),Xa&&(H=Xa[p]),p=o.vertexNormals,u=o.normal,v=o.vertexColors,x=o.color,y=o.vertexTangents,o instanceof THREE.Face3){if(wa)I=ua[o.a].position,V=ua[o.b].position,J=ua[o.c].position,W[N]=I.x,W[N+1]=I.y,W[N+2]=I.z,W[N+3]=
-V.x,W[N+4]=V.y,W[N+5]=V.z,W[N+6]=J.x,W[N+7]=J.y,W[N+8]=J.z,N+=9;if(ia)for(P in ia)if(z=ia[P],z.__original.needsUpdate)C=z.offset,K=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[C+0]=z.value[o.a],z.array[C+1]=z.value[o.b],z.array[C+2]=z.value[o.c]):z.boundTo==="faces"?(z.array[C+0]=z.value[K],z.array[C+1]=z.value[K],z.array[C+2]=z.value[K],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[C+0]=z.value[K+0],z.array[C+1]=z.value[K+1],z.array[C+2]=z.value[K+2],z.offsetSrc+=
-3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(I=z.value[o.a],V=z.value[o.b],J=z.value[o.c]):z.boundTo==="faces"?(I=z.value[K],V=z.value[K],J=z.value[K],z.offsetSrc++):z.boundTo==="faceVertices"&&(I=z.value[K+0],V=z.value[K+1],J=z.value[K+2],z.offsetSrc+=3),z.size===2?(z.array[C+0]=I.x,z.array[C+1]=I.y,z.array[C+2]=V.x,z.array[C+3]=V.y,z.array[C+4]=J.x,z.array[C+5]=J.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[C+0]=I.r,z.array[C+1]=I.g,z.array[C+2]=I.b,z.array[C+3]=V.r,z.array[C+
-4]=V.g,z.array[C+5]=V.b,z.array[C+6]=J.r,z.array[C+7]=J.g,z.array[C+8]=J.b):(z.array[C+0]=I.x,z.array[C+1]=I.y,z.array[C+2]=I.z,z.array[C+3]=V.x,z.array[C+4]=V.y,z.array[C+5]=V.z,z.array[C+6]=J.x,z.array[C+7]=J.y,z.array[C+8]=J.z),z.offset+=9):(z.array[C+0]=I.x,z.array[C+1]=I.y,z.array[C+2]=I.z,z.array[C+3]=I.w,z.array[C+4]=V.x,z.array[C+5]=V.y,z.array[C+6]=V.z,z.array[C+7]=V.w,z.array[C+8]=J.x,z.array[C+9]=J.y,z.array[C+10]=J.z,z.array[C+11]=J.w,z.offset+=12));if(ya){C=0;for(K=za.length;C<K;C++)I=
-za[C].vertices[o.a].position,V=za[C].vertices[o.b].position,J=za[C].vertices[o.c].position,z=ma[C],z[R+0]=I.x,z[R+1]=I.y,z[R+2]=I.z,z[R+3]=V.x,z[R+4]=V.y,z[R+5]=V.z,z[R+6]=J.x,z[R+7]=J.y,z[R+8]=J.z;R+=9}if(Da.length)C=Da[o.a],K=Da[o.b],z=Da[o.c],$[O]=C.x,$[O+1]=C.y,$[O+2]=C.z,$[O+3]=C.w,$[O+4]=K.x,$[O+5]=K.y,$[O+6]=K.z,$[O+7]=K.w,$[O+8]=z.x,$[O+9]=z.y,$[O+10]=z.z,$[O+11]=z.w,C=La[o.a],K=La[o.b],z=La[o.c],Z[O]=C.x,Z[O+1]=C.y,Z[O+2]=C.z,Z[O+3]=C.w,Z[O+4]=K.x,Z[O+5]=K.y,Z[O+6]=K.z,Z[O+7]=K.w,Z[O+8]=
-z.x,Z[O+9]=z.y,Z[O+10]=z.z,Z[O+11]=z.w,C=Ja[o.a],K=Ja[o.b],z=Ja[o.c],na[O]=C.x,na[O+1]=C.y,na[O+2]=C.z,na[O+3]=1,na[O+4]=K.x,na[O+5]=K.y,na[O+6]=K.z,na[O+7]=1,na[O+8]=z.x,na[O+9]=z.y,na[O+10]=z.z,na[O+11]=1,C=Ka[o.a],K=Ka[o.b],z=Ka[o.c],ea[O]=C.x,ea[O+1]=C.y,ea[O+2]=C.z,ea[O+3]=1,ea[O+4]=K.x,ea[O+5]=K.y,ea[O+6]=K.z,ea[O+7]=1,ea[O+8]=z.x,ea[O+9]=z.y,ea[O+10]=z.z,ea[O+11]=1,O+=12;if(va&&B)v.length==3&&B==THREE.VertexColors?(o=v[0],C=v[1],K=v[2]):K=C=o=x,ca[Y]=o.r,ca[Y+1]=o.g,ca[Y+2]=o.b,ca[Y+3]=C.r,
-ca[Y+4]=C.g,ca[Y+5]=C.b,ca[Y+6]=K.r,ca[Y+7]=K.g,ca[Y+8]=K.b,Y+=9;if(Aa&&ka.hasTangents)v=y[0],x=y[1],o=y[2],X[ha]=v.x,X[ha+1]=v.y,X[ha+2]=v.z,X[ha+3]=v.w,X[ha+4]=x.x,X[ha+5]=x.y,X[ha+6]=x.z,X[ha+7]=x.w,X[ha+8]=o.x,X[ha+9]=o.y,X[ha+10]=o.z,X[ha+11]=o.w,ha+=12;if(sa&&E)if(p.length==3&&pa)for(y=0;y<3;y++)u=p[y],da[Q]=u.x,da[Q+1]=u.y,da[Q+2]=u.z,Q+=3;else for(y=0;y<3;y++)da[Q]=u.x,da[Q+1]=u.y,da[Q+2]=u.z,Q+=3;if(qa&&D!==void 0&&A)for(y=0;y<3;y++)p=D[y],aa[U]=p.u,aa[U+1]=p.v,U+=2;if(qa&&H!==void 0&&A)for(y=
-0;y<3;y++)p=H[y],fa[oa]=p.u,fa[oa+1]=p.v,oa+=2;ra&&(ga[S]=L,ga[S+1]=L+1,ga[S+2]=L+2,S+=3,la[T]=L,la[T+1]=L+1,la[T+2]=L,la[T+3]=L+2,la[T+4]=L+1,la[T+5]=L+2,T+=6,L+=3)}else if(o instanceof THREE.Face4){if(wa)I=ua[o.a].position,V=ua[o.b].position,J=ua[o.c].position,G=ua[o.d].position,W[N]=I.x,W[N+1]=I.y,W[N+2]=I.z,W[N+3]=V.x,W[N+4]=V.y,W[N+5]=V.z,W[N+6]=J.x,W[N+7]=J.y,W[N+8]=J.z,W[N+9]=G.x,W[N+10]=G.y,W[N+11]=G.z,N+=12;if(ia)for(P in ia)if(z=ia[P],z.__original.needsUpdate)C=z.offset,K=z.offsetSrc,z.size===
-1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[C+0]=z.value[o.a],z.array[C+1]=z.value[o.b],z.array[C+2]=z.value[o.c],z.array[C+3]=z.value[o.d]):z.boundTo==="faces"?(z.array[C+0]=z.value[K],z.array[C+1]=z.value[K],z.array[C+2]=z.value[K],z.array[C+3]=z.value[K],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[C+0]=z.value[K+0],z.array[C+1]=z.value[K+1],z.array[C+2]=z.value[K+2],z.array[C+3]=z.value[K+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(I=z.value[o.a],
-V=z.value[o.b],J=z.value[o.c],G=z.value[o.d]):z.boundTo==="faces"?(I=z.value[K],V=z.value[K],J=z.value[K],G=z.value[K],z.offsetSrc++):z.boundTo==="faceVertices"&&(I=z.value[K+0],V=z.value[K+1],J=z.value[K+2],G=z.value[K+3],z.offsetSrc+=4),z.size===2?(z.array[C+0]=I.x,z.array[C+1]=I.y,z.array[C+2]=V.x,z.array[C+3]=V.y,z.array[C+4]=J.x,z.array[C+5]=J.y,z.array[C+6]=G.x,z.array[C+7]=G.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[C+0]=I.r,z.array[C+1]=I.g,z.array[C+2]=I.b,z.array[C+3]=V.r,z.array[C+
-4]=V.g,z.array[C+5]=V.b,z.array[C+6]=J.r,z.array[C+7]=J.g,z.array[C+8]=J.b,z.array[C+9]=G.r,z.array[C+10]=G.g,z.array[C+11]=G.b):(z.array[C+0]=I.x,z.array[C+1]=I.y,z.array[C+2]=I.z,z.array[C+3]=V.x,z.array[C+4]=V.y,z.array[C+5]=V.z,z.array[C+6]=J.x,z.array[C+7]=J.y,z.array[C+8]=J.z,z.array[C+9]=G.x,z.array[C+10]=G.y,z.array[C+11]=G.z),z.offset+=12):(z.array[C+0]=I.x,z.array[C+1]=I.y,z.array[C+2]=I.z,z.array[C+3]=I.w,z.array[C+4]=V.x,z.array[C+5]=V.y,z.array[C+6]=V.z,z.array[C+7]=V.w,z.array[C+8]=
-J.x,z.array[C+9]=J.y,z.array[C+10]=J.z,z.array[C+11]=J.w,z.array[C+12]=G.x,z.array[C+13]=G.y,z.array[C+14]=G.z,z.array[C+15]=G.w,z.offset+=16));if(ya){C=0;for(K=za.length;C<K;C++)I=za[C].vertices[o.a].position,V=za[C].vertices[o.b].position,J=za[C].vertices[o.c].position,G=za[C].vertices[o.d].position,z=ma[C],z[R+0]=I.x,z[R+1]=I.y,z[R+2]=I.z,z[R+3]=V.x,z[R+4]=V.y,z[R+5]=V.z,z[R+6]=J.x,z[R+7]=J.y,z[R+8]=J.z,z[R+9]=G.x,z[R+10]=G.y,z[R+11]=G.z;R+=12}if(Da.length)C=Da[o.a],K=Da[o.b],z=Da[o.c],M=Da[o.d],
-$[O]=C.x,$[O+1]=C.y,$[O+2]=C.z,$[O+3]=C.w,$[O+4]=K.x,$[O+5]=K.y,$[O+6]=K.z,$[O+7]=K.w,$[O+8]=z.x,$[O+9]=z.y,$[O+10]=z.z,$[O+11]=z.w,$[O+12]=M.x,$[O+13]=M.y,$[O+14]=M.z,$[O+15]=M.w,C=La[o.a],K=La[o.b],z=La[o.c],M=La[o.d],Z[O]=C.x,Z[O+1]=C.y,Z[O+2]=C.z,Z[O+3]=C.w,Z[O+4]=K.x,Z[O+5]=K.y,Z[O+6]=K.z,Z[O+7]=K.w,Z[O+8]=z.x,Z[O+9]=z.y,Z[O+10]=z.z,Z[O+11]=z.w,Z[O+12]=M.x,Z[O+13]=M.y,Z[O+14]=M.z,Z[O+15]=M.w,C=Ja[o.a],K=Ja[o.b],z=Ja[o.c],M=Ja[o.d],na[O]=C.x,na[O+1]=C.y,na[O+2]=C.z,na[O+3]=1,na[O+4]=K.x,na[O+
-5]=K.y,na[O+6]=K.z,na[O+7]=1,na[O+8]=z.x,na[O+9]=z.y,na[O+10]=z.z,na[O+11]=1,na[O+12]=M.x,na[O+13]=M.y,na[O+14]=M.z,na[O+15]=1,C=Ka[o.a],K=Ka[o.b],z=Ka[o.c],o=Ka[o.d],ea[O]=C.x,ea[O+1]=C.y,ea[O+2]=C.z,ea[O+3]=1,ea[O+4]=K.x,ea[O+5]=K.y,ea[O+6]=K.z,ea[O+7]=1,ea[O+8]=z.x,ea[O+9]=z.y,ea[O+10]=z.z,ea[O+11]=1,ea[O+12]=o.x,ea[O+13]=o.y,ea[O+14]=o.z,ea[O+15]=1,O+=16;if(va&&B)v.length==4&&B==THREE.VertexColors?(o=v[0],C=v[1],K=v[2],v=v[3]):v=K=C=o=x,ca[Y]=o.r,ca[Y+1]=o.g,ca[Y+2]=o.b,ca[Y+3]=C.r,ca[Y+4]=C.g,
-ca[Y+5]=C.b,ca[Y+6]=K.r,ca[Y+7]=K.g,ca[Y+8]=K.b,ca[Y+9]=v.r,ca[Y+10]=v.g,ca[Y+11]=v.b,Y+=12;if(Aa&&ka.hasTangents)v=y[0],x=y[1],o=y[2],y=y[3],X[ha]=v.x,X[ha+1]=v.y,X[ha+2]=v.z,X[ha+3]=v.w,X[ha+4]=x.x,X[ha+5]=x.y,X[ha+6]=x.z,X[ha+7]=x.w,X[ha+8]=o.x,X[ha+9]=o.y,X[ha+10]=o.z,X[ha+11]=o.w,X[ha+12]=y.x,X[ha+13]=y.y,X[ha+14]=y.z,X[ha+15]=y.w,ha+=16;if(sa&&E)if(p.length==4&&pa)for(y=0;y<4;y++)u=p[y],da[Q]=u.x,da[Q+1]=u.y,da[Q+2]=u.z,Q+=3;else for(y=0;y<4;y++)da[Q]=u.x,da[Q+1]=u.y,da[Q+2]=u.z,Q+=3;if(qa&&
-D!==void 0&&A)for(y=0;y<4;y++)p=D[y],aa[U]=p.u,aa[U+1]=p.v,U+=2;if(qa&&H!==void 0&&A)for(y=0;y<4;y++)p=H[y],fa[oa]=p.u,fa[oa+1]=p.v,oa+=2;ra&&(ga[S]=L,ga[S+1]=L+1,ga[S+2]=L+3,ga[S+3]=L+1,ga[S+4]=L+2,ga[S+5]=L+3,S+=6,la[T]=L,la[T+1]=L+1,la[T+2]=L,la[T+3]=L+3,la[T+4]=L+1,la[T+5]=L+2,la[T+6]=L+2,la[T+7]=L+3,T+=8,L+=4)}if(Ha){n=0;for(t=Ha.length;n<t;n++)ga[S]=Ha[n].a,ga[S+1]=Ha[n].b,ga[S+2]=Ha[n].c,ga[S+3]=Ha[n].a,ga[S+4]=Ha[n].c,ga[S+5]=Ha[n].d,S+=6}wa&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),
-j.bufferData(j.ARRAY_BUFFER,W,m));if(ia)for(P in ia)z=ia[P],z.__original.needsUpdate&&(j.bindBuffer(j.ARRAY_BUFFER,z.buffer),j.bufferData(j.ARRAY_BUFFER,z.array,m));if(ya){C=0;for(K=za.length;C<K;C++)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[C]),j.bufferData(j.ARRAY_BUFFER,ma[C],m)}va&&Y>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,ca,m));sa&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,da,m));Aa&&ka.hasTangents&&
-(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,X,m));qa&&U>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,aa,m));qa&&oa>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,fa,m));ra&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ga,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,la,m));O>0&&(j.bindBuffer(j.ARRAY_BUFFER,
-h.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,na,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,ea,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,$,m));k.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,
-delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;w(g)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=j.DYNAMIC_DRAW;A=b.vertices;h=b.colors;B=A.length;k=h.length;E=b.__vertexArray;m=b.__colorArray;D=b.__dirtyColors;if(b.__dirtyVertices){for(n=
-0;n<B;n++)t=A[n].position,g=n*3,E[g]=t.x,E[g+1]=t.y,E[g+2]=t.z;j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,E,e)}if(D){for(n=0;n<k;n++)color=h[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=j.DYNAMIC_DRAW;A=b.vertices;h=b.colors;B=A.length;k=h.length;
-E=b.__vertexArray;m=b.__colorArray;D=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<B;n++)t=A[n].position,g=n*3,E[g]=t.x,E[g+1]=t.y,E[g+2]=t.z;j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,E,e)}if(D){for(n=0;n<k;n++)color=h[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,h=F(f),(f.__dirtyVertices||
-f.__dirtyColors||b.sortParticles||h)&&c(f,j.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,w(f)}function E(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function D(b){function e(b){var g=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,f,g,h,j,k,m,n,o={},t=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(h=b.faces.length;g<h;g++)j=b.faces[g],k=j.materials,m=e(k),o[m]==void 0&&(o[m]={hash:m,
-counter:0}),n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:t}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(o[m].counter+=1,n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:t})),b.geometryGroups[n].faces.push(g),b.geometryGroups[n].vertices+=j}function S(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],
-count:0}})}function J(b){if(b!=ga){switch(b){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}ga=b}}function G(b,e,c){(c.width&
-c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,T(e.wrapS)),j.texParameteri(b,j.TEXTURE_WRAP_T,T(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,T(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,T(e.minFilter)),j.generateMipmap(b)):(j.texParameteri(b,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_MAG_FILTER,X(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,X(e.minFilter)))}function U(b,e){if(b.needsUpdate)b.__webglInit?
-(j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image)):(b.__webglTexture=j.createTexture(),j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image),b.__webglInit=!0),G(j.TEXTURE_2D,b,b.image),j.bindTexture(j.TEXTURE_2D,null),b.needsUpdate=!1;j.activeTexture(j.TEXTURE0+e);j.bindTexture(j.TEXTURE_2D,b.__webglTexture)}function W(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
-!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=j.createFramebuffer();b.__webglRenderbuffer=j.createRenderbuffer();b.__webglTexture=j.createTexture();j.bindTexture(j.TEXTURE_2D,b.__webglTexture);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,T(b.wrapS));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,T(b.wrapT));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,T(b.magFilter));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,T(b.minFilter));j.texImage2D(j.TEXTURE_2D,0,T(b.format),
-b.width,b.height,0,T(b.format),T(b.type),null);j.bindRenderbuffer(j.RENDERBUFFER,b.__webglRenderbuffer);j.bindFramebuffer(j.FRAMEBUFFER,b.__webglFramebuffer);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
-j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height);j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=$,b=I);e!=da&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(Z,ma,c,b),da=e)}function M(b,e){var c;b=="fragment"?c=j.createShader(j.FRAGMENT_SHADER):
-b=="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,e);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(e),null;return c}function X(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function T(b){switch(b){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;
-case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;
-case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var R=this,j,fa=[],P=null,da=null,ca=!0,Y=null,ea=null,ga=null,la=null,pa=null,N=null,ia=null,Z=0,ma=0,$=0,I=0,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],oa=new THREE.Matrix4,ha=new Float32Array(16),na=new Float32Array(16),wa=new THREE.Vector4,Aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ya=b.stencil!==void 0?b.stencil:!0,Ma=b.antialias!==void 0?b.antialias:!1,sa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ra=b.clearAlpha!==
-void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=va;this.sortObjects=this.autoClear=!0;try{if(!(j=va.getContext("experimental-webgl",{antialias:Ma,stencil:ya})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(qa){console.error(qa)}j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);
-j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(sa.r,sa.g,sa.b,ra);this.context=j;var Ba=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ya){var aa={};aa.vertices=new Float32Array(12);aa.faces=new Uint16Array(6);aa.darkness=0.5;aa.vertices[0]=-20;aa.vertices[1]=-20;aa.vertices[2]=-1;aa.vertices[3]=20;aa.vertices[4]=-20;aa.vertices[5]=-1;aa.vertices[6]=20;
-aa.vertices[7]=20;aa.vertices[8]=-1;aa.vertices[9]=-20;aa.vertices[10]=20;aa.vertices[11]=-1;aa.faces[0]=0;aa.faces[1]=1;aa.faces[2]=2;aa.faces[3]=0;aa.faces[4]=2;aa.faces[5]=3;aa.vertexBuffer=j.createBuffer();aa.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,aa.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,aa.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,aa.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,aa.faces,j.STATIC_DRAW);aa.program=j.createProgram();j.attachShader(aa.program,
-M("fragment",THREE.ShaderLib.shadowPost.fragmentShader));j.attachShader(aa.program,M("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(aa.program);aa.vertexLocation=j.getAttribLocation(aa.program,"position");aa.projectionLocation=j.getUniformLocation(aa.program,"projectionMatrix");aa.darknessLocation=j.getUniformLocation(aa.program,"darkness")}var L={};L.vertices=new Float32Array(16);L.faces=new Uint16Array(6);b=0;L.vertices[b++]=-1;L.vertices[b++]=-1;L.vertices[b++]=0;L.vertices[b++]=
-0;L.vertices[b++]=1;L.vertices[b++]=-1;L.vertices[b++]=1;L.vertices[b++]=0;L.vertices[b++]=1;L.vertices[b++]=1;L.vertices[b++]=1;L.vertices[b++]=1;L.vertices[b++]=-1;L.vertices[b++]=1;L.vertices[b++]=0;L.vertices[b++]=1;b=0;L.faces[b++]=0;L.faces[b++]=1;L.faces[b++]=2;L.faces[b++]=0;L.faces[b++]=2;L.faces[b++]=3;L.vertexBuffer=j.createBuffer();L.elementBuffer=j.createBuffer();L.tempTexture=j.createTexture();L.occlusionTexture=j.createTexture();j.bindBuffer(j.ARRAY_BUFFER,L.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,
-L.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,L.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,L.faces,j.STATIC_DRAW);j.bindTexture(j.TEXTURE_2D,L.tempTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGB,16,16,0,j.RGB,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.bindTexture(j.TEXTURE_2D,
-L.occlusionTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGBA,16,16,0,j.RGBA,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(L.hasVertexTexture=!1,L.program=j.createProgram(),j.attachShader(L.program,M("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),
-j.attachShader(L.program,M("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(L.hasVertexTexture=!0,L.program=j.createProgram(),j.attachShader(L.program,M("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),j.attachShader(L.program,M("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));j.linkProgram(L.program);L.attributes={};L.uniforms={};L.attributes.vertex=j.getAttribLocation(L.program,"position");L.attributes.uv=j.getAttribLocation(L.program,"UV");L.uniforms.renderType=
-j.getUniformLocation(L.program,"renderType");L.uniforms.map=j.getUniformLocation(L.program,"map");L.uniforms.occlusionMap=j.getUniformLocation(L.program,"occlusionMap");L.uniforms.opacity=j.getUniformLocation(L.program,"opacity");L.uniforms.scale=j.getUniformLocation(L.program,"scale");L.uniforms.rotation=j.getUniformLocation(L.program,"rotation");L.uniforms.screenPosition=j.getUniformLocation(L.program,"screenPosition");var ua=!1,Q={};Q.vertices=new Float32Array(16);Q.faces=new Uint16Array(6);b=
-0;Q.vertices[b++]=-1;Q.vertices[b++]=-1;Q.vertices[b++]=0;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=-1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=0;Q.vertices[b++]=-1;Q.vertices[b++]=1;Q.vertices[b++]=0;b=Q.vertices[b++]=0;Q.faces[b++]=0;Q.faces[b++]=1;Q.faces[b++]=2;Q.faces[b++]=0;Q.faces[b++]=2;Q.faces[b++]=3;Q.vertexBuffer=j.createBuffer();Q.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,Q.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,
-Q.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Q.faces,j.STATIC_DRAW);Q.program=j.createProgram();j.attachShader(Q.program,M("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(Q.program,M("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(Q.program);Q.attributes={};Q.uniforms={};Q.attributes.position=j.getAttribLocation(Q.program,"position");Q.attributes.uv=j.getAttribLocation(Q.program,"uv");Q.uniforms.uvOffset=
-j.getUniformLocation(Q.program,"uvOffset");Q.uniforms.uvScale=j.getUniformLocation(Q.program,"uvScale");Q.uniforms.rotation=j.getUniformLocation(Q.program,"rotation");Q.uniforms.scale=j.getUniformLocation(Q.program,"scale");Q.uniforms.alignment=j.getUniformLocation(Q.program,"alignment");Q.uniforms.map=j.getUniformLocation(Q.program,"map");Q.uniforms.opacity=j.getUniformLocation(Q.program,"opacity");Q.uniforms.useScreenCoordinates=j.getUniformLocation(Q.program,"useScreenCoordinates");Q.uniforms.affectedByDistance=
-j.getUniformLocation(Q.program,"affectedByDistance");Q.uniforms.screenPosition=j.getUniformLocation(Q.program,"screenPosition");Q.uniforms.modelViewMatrix=j.getUniformLocation(Q.program,"modelViewMatrix");Q.uniforms.projectionMatrix=j.getUniformLocation(Q.program,"projectionMatrix");var ka=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){Z=b;ma=e;$=c;I=f;j.viewport(Z,ma,$,I)};this.setScissor=function(b,e,c,f){j.scissor(b,
-e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ca=b;j.depthMask(b)};this.setClearColorHex=function(b,e){sa.setHex(b);ra=e;j.clearColor(sa.r,sa.g,sa.b,ra)};this.setClearColor=function(b,e){sa.copy(b);ra=e;j.clearColor(sa.r,sa.g,sa.b,ra)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){aa.darkness=b};this.getContext=function(){return j};
-this.initMaterial=function(b,e,c,f){var g,h,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?k="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=
-THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,o,t;n=t=m=0;for(o=e.length;n<o;n++)h=e[n],h instanceof THREE.DirectionalLight&&t++,h instanceof THREE.PointLight&&m++;m+t<=4?e=t:(e=Math.ceil(4*t/(m+t)),m=4-e);h={directional:e,point:m};t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var p;a:{n=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,
-fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:t},u;h=[];k?h.push(k):(h.push(n),h.push(o));for(u in c)h.push(u),h.push(c[u]);k=h.join();u=0;for(h=fa.length;u<h;u++)if(fa[u].code==k){p=fa[u].program;break a}u=j.createProgram();h=[Ba?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+
+f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=xa.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=
+f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var M in m)if(o=h.uniforms[M])if(u=m[M],p=u.type,c=u.value,p=="i")k.uniform1i(o,c);else if(p=="f")k.uniform1f(o,c);else if(p=="fv1")k.uniform1fv(o,c);else if(p=="fv")k.uniform3fv(o,c);else if(p=="v2")k.uniform2f(o,c.x,c.y);else if(p=="v3")k.uniform3f(o,
+c.x,c.y,c.z);else if(p=="v4")k.uniform4f(o,c.x,c.y,c.z,c.w);else if(p=="c")k.uniform3f(o,c.r,c.g,c.b);else if(p=="t"&&(k.uniform1i(o,c),u=u.texture))if(u.image instanceof Array&&u.image.length==6){if(u.image.length==6){if(u.needsUpdate){if(u.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,u.image.__webglTextureCube);for(p=0;p<6;++p)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,k.RGBA,k.UNSIGNED_BYTE,u.image[p])}else{u.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,
+u.image.__webglTextureCube);for(p=0;p<6;++p)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,u.image[p]);u.__webglInit=!0}N(k.TEXTURE_CUBE_MAP,u,u.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);u.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,u.image.__webglTextureCube)}}else F(u,c);k.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray);k.uniformMatrix3fv(j.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
+f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&k.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&j.objectMatrix!==null&&k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&k.uniformMatrix4fv(j.viewMatrix,!1,qa);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=
+m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,k.uniform3fv(j.directionalLightDirection,b),k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray),k.uniformMatrix4fv(j.viewMatrix,!1,qa);f.skinning&&(k.uniformMatrix4fv(j.cameraInverseMatrix,!1,qa),k.uniformMatrix4fv(j.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,j){if(g.opacity!=0){var m,b=e(b,c,f,g,j).attributes;if(!g.morphTargets&&b.position>=0)k.bindBuffer(k.ARRAY_BUFFER,
+h.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else{c=g.program.attributes;j.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,u=j.morphTargetForcedOrder,n=j.morphTargetInfluences;f<g.numSupportedMorphTargets&&
+f<u.length;)k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u[f]]),k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=n[u[f]],f++;else{var u=[],p=-1,o=0,n=j.morphTargetInfluences,v,w=n.length,f=0;for(j.morphTargetBase!==-1&&(u[j.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(v=0;v<w;v++)!u[v]&&n[v]>p&&(o=v,p=n[o]);k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o]);k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=
+p;u[o]=1;p=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(g.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[m],c.size,k.FLOAT,!1,0,0));b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglColorBuffer),k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,
+h.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):k.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,
+0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,
+h.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));j instanceof THREE.Mesh?(g.wireframe?(k.lineWidth(g.wireframeLinewidth),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),k.drawElements(k.LINES,h.__webglLineCount,k.UNSIGNED_SHORT,0)):(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),k.drawElements(k.TRIANGLES,h.__webglFaceCount,k.UNSIGNED_SHORT,0)),U.data.vertices+=h.__webglFaceCount,U.data.faces+=h.__webglFaceCount/3,U.data.drawCalls++):j instanceof
+THREE.Line?(j=j.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(g.linewidth),k.drawArrays(j,0,h.__webglLineCount),U.data.drawCalls++):j instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,h.__webglParticleCount),U.data.drawCalls++):j instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,h.__webglVertexCount),U.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=k.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=k.createBuffer();b.hasPos&&
+(k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,b.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(e.attributes.position),k.vertexAttribPointer(e.attributes.position,3,k.FLOAT,!1,0,0));if(b.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,j,m,u,n,p,o,v,w=b.count*3;for(v=0;v<w;v+=9)c=b.normalArray,f=c[v],h=c[v+1],g=c[v+2],j=c[v+3],u=c[v+4],p=c[v+5],m=c[v+6],n=c[v+7],o=c[v+8],f=(f+j+m)/3,h=(h+u+n)/3,g=(g+p+o)/3,c[v]=
+f,c[v+1]=h,c[v+2]=g,c[v+3]=f,c[v+4]=h,c[v+5]=g,c[v+6]=f,c[v+7]=h,c[v+8]=g}k.bufferData(k.ARRAY_BUFFER,b.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(e.attributes.normal);k.vertexAttribPointer(e.attributes.normal,3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,b.count);b.count=0}function h(b){if($!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),$=b.doubleSided;if(ha!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),ha=b.flipSided}function j(b){ma!=b&&(b?
+k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),ma=b)}function m(b,e,c){ra!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),ra=b);if(b&&(T!=e||ka!=c))k.polygonOffset(e,c),T=e,ka=c}function n(b){Z[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);Z[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);Z[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);Z[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);Z[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);
+Z[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=Z[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function p(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=Z[f].x*e.n14+Z[f].y*e.n24+Z[f].z*e.n34+Z[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function u(b){var e,c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=h.count=0;for(e=f.materials.length;b<
+e;b++)c=f.materials[b],c.transparent?o(g,c):o(h,c)}function v(b){var e,c,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(h=j.materials[e])&&(h.transparent?o(m,h):o(k,h))}else(h=e)&&(h.transparent?o(m,h):o(k,h))}function w(b,e){return e.z-b.z}function x(b){k.enable(k.POLYGON_OFFSET_FILL);k.polygonOffset(0.1,1);k.enable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);
+k.depthMask(!1);k.colorMask(!1,!1,!1,!1);k.stencilFunc(k.ALWAYS,1,255);k.stencilOpSeparate(k.BACK,k.KEEP,k.INCR,k.KEEP);k.stencilOpSeparate(k.FRONT,k.KEEP,k.DECR,k.KEEP);var e,c=b.lights.length,f,h=b.lights,g=[],j,m,u,n,p,o=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;g[1]=-f.position.y;g[2]=-f.position.z;for(p=0;p<o;p++)f=b.__webglShadowVolumes[p].object,j=b.__webglShadowVolumes[p].buffer,m=f.materials[0],m.program||
+U.initMaterial(m,h,void 0,f),m=m.program,u=m.uniforms,n=m.attributes,L!==m&&(k.useProgram(m),L=m,k.uniformMatrix4fv(u.projectionMatrix,!1,na),k.uniformMatrix4fv(u.viewMatrix,!1,qa),k.uniform3fv(u.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(u.objectMatrix,!1,f._objectMatrixArray),k.bindBuffer(k.ARRAY_BUFFER,j.__webglVertexBuffer),k.vertexAttribPointer(n.position,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglNormalBuffer),k.vertexAttribPointer(n.normal,
+3,k.FLOAT,!1,0,0),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),k.cullFace(k.FRONT),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0),k.cullFace(k.BACK),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0)}k.disable(k.POLYGON_OFFSET_FILL);k.colorMask(!0,!0,!0,!0);k.stencilFunc(k.NOTEQUAL,0,255);k.stencilOp(k.KEEP,k.KEEP,k.KEEP);k.disable(k.DEPTH_TEST);ma=ja=-1;L=ea.program;k.useProgram(ea.program);k.uniformMatrix4fv(ea.projectionLocation,!1,na);k.uniform1f(ea.darknessLocation,
+ea.darkness);k.bindBuffer(k.ARRAY_BUFFER,ea.vertexBuffer);k.vertexAttribPointer(ea.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray(ea.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ea.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.disable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(fa)}function y(b,e){var c,f,h;c=V.attributes;var g=V.uniforms,j=Y/da,m,u=[],n=da*0.5,p=Y*0.5,o=!0;k.useProgram(V.program);
+L=V.program;ma=ja=-1;la||(k.enableVertexAttribArray(V.attributes.position),k.enableVertexAttribArray(V.attributes.uv),la=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,V.vertexBuffer);k.vertexAttribPointer(c.position,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,V.elementBuffer);k.uniformMatrix4fv(g.projectionMatrix,!1,na);k.activeTexture(k.TEXTURE0);k.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<
+f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(w);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(k.uniform1i(g.useScreenCoordinates,1),k.uniform3f(g.screenPosition,(h.position.x-n)/n,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):
+(k.uniform1i(g.useScreenCoordinates,0),k.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),k.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?Y:1),u[0]=m*j*h.scale.x,u[1]=m*h.scale.y,k.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),k.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),k.uniform2f(g.alignment,h.alignment.x,h.alignment.y),k.uniform1f(g.opacity,h.opacity),k.uniform1f(g.rotation,h.rotation),k.uniform2fv(g.scale,u),h.mergeWith3D&&
+!o?(k.enable(k.DEPTH_TEST),o=!0):!h.mergeWith3D&&o&&(k.disable(k.DEPTH_TEST),o=!1),R(h.blending),F(h.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(fa)}function D(b,e){var c,f,h=b.__webglLensFlares.length,g,j,m,u=new THREE.Vector3,n=Y/da,p=da*0.5,o=Y*0.5,v=16/Y,w=[v*n,v],x=[1,1,0],A=[1,1],y=O.uniforms;c=O.attributes;k.useProgram(O.program);L=O.program;ma=ja=-1;wa||(k.enableVertexAttribArray(O.attributes.vertex),k.enableVertexAttribArray(O.attributes.uv),
+wa=!0);k.uniform1i(y.occlusionMap,0);k.uniform1i(y.map,1);k.bindBuffer(k.ARRAY_BUFFER,O.vertexBuffer);k.vertexAttribPointer(c.vertex,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,O.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);k.bindTexture(k.TEXTURE_2D,O.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f=0;f<h;f++)if(c=b.__webglLensFlares[f].object,u.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),
+e.matrixWorldInverse.multiplyVector3(u),e.projectionMatrix.multiplyVector3(u),x[0]=u.x,x[1]=u.y,x[2]=u.z,A[0]=x[0]*p+p,A[1]=x[1]*o+o,O.hasVertexTexture||A[0]>0&&A[0]<da&&A[1]>0&&A[1]<Y){k.bindTexture(k.TEXTURE_2D,O.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,A[0]-8,A[1]-8,16,16,0);k.uniform1i(y.renderType,0);k.uniform2fv(y.scale,w);k.uniform3fv(y.screenPosition,x);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,O.occlusionTexture);
+k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,A[0]-8,A[1]-8,16,16,0);k.uniform1i(y.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,O.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=x[0];c.positionScreen.y=x[1];c.positionScreen.z=x[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();k.uniform1i(y.renderType,2);k.enable(k.BLEND);g=0;for(j=c.lensFlares.length;g<j;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)x[0]=m.x,x[1]=m.y,
+x[2]=m.z,v=m.size*m.scale/Y,w[0]=v*n,w[1]=v,k.uniform3fv(y.screenPosition,x),k.uniform2fv(y.scale,w),k.uniform1f(y.rotation,m.rotation),k.uniform1f(y.opacity,m.opacity),R(m.blending),F(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(fa)}function A(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function H(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function C(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function E(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(h=f.geometryGroups[e],g=H(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||
+f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var j=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var u=void 0,n=void 0,p=void 0,o=void 0,v=p=void 0,w=void 0,x=void 0,A=void 0,y=void 0,D=void 0,I=void 0,J=void 0,Y=void 0,E=void 0,F=void 0,Z=void 0,N=void 0,G=o=A=o=x=w=void 0,M=void 0,B=M=G=w=void 0,K=void 0,R=B=M=G=p=p=v=A=o=B=M=G=K=B=M=G=K=B=M=G=void 0,L=0,O=0,T=0,W=0,pa=0,S=0,Q=0,V=0,na=0,P=0,U=0,M=G=0,$=g.__vertexArray,ea=g.__uvArray,ia=g.__uv2Array,ga=g.__normalArray,X=g.__tangentArray,
+fa=g.__colorArray,qa=g.__skinVertexAArray,ha=g.__skinVertexBArray,ca=g.__skinIndexArray,da=g.__skinWeightArray,oa=g.__morphTargetsArrays,ka=g.__webglCustomAttributes,B=void 0,ja=g.__faceArray,ma=g.__lineArray,ra=g.__needsSmoothNormals,D=g.__vertexColorType,y=g.__uvType,I=g.__normalType,la=j.geometry,ya=la.__dirtyVertices,ta=la.__dirtyElements,sa=la.__dirtyUvs,ua=la.__dirtyNormals,Ca=la.__dirtyTangents,xa=la.__dirtyColors,Aa=la.__dirtyMorphTargets,wa=la.vertices,Da=g.faces,Oa=la.faces,Ya=la.faceVertexUvs[0],
+Za=la.faceVertexUvs[1],La=la.skinVerticesA,Ma=la.skinVerticesB,Na=la.skinIndices,Fa=la.skinWeights,Ja=j instanceof THREE.ShadowVolume?la.edgeFaces:void 0,Ba=la.morphTargets;if(ka)for(R in ka)ka[R].offset=0,ka[R].offsetSrc=0;u=0;for(n=Da.length;u<n;u++)if(p=Da[u],o=Oa[p],Ya&&(J=Ya[p]),Za&&(Y=Za[p]),p=o.vertexNormals,v=o.normal,w=o.vertexColors,x=o.color,A=o.vertexTangents,o instanceof THREE.Face3){if(ya)E=wa[o.a].position,F=wa[o.b].position,Z=wa[o.c].position,$[O]=E.x,$[O+1]=E.y,$[O+2]=E.z,$[O+3]=
+F.x,$[O+4]=F.y,$[O+5]=F.z,$[O+6]=Z.x,$[O+7]=Z.y,$[O+8]=Z.z,O+=9;if(ka)for(R in ka)if(B=ka[R],B.__original.needsUpdate)G=B.offset,M=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[G+0]=B.value[o.a],B.array[G+1]=B.value[o.b],B.array[G+2]=B.value[o.c]):B.boundTo==="faces"?(B.array[G+0]=B.value[M],B.array[G+1]=B.value[M],B.array[G+2]=B.value[M],B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[G+0]=B.value[M+0],B.array[G+1]=B.value[M+1],B.array[G+2]=B.value[M+2],B.offsetSrc+=
+3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(E=B.value[o.a],F=B.value[o.b],Z=B.value[o.c]):B.boundTo==="faces"?(E=B.value[M],F=B.value[M],Z=B.value[M],B.offsetSrc++):B.boundTo==="faceVertices"&&(E=B.value[M+0],F=B.value[M+1],Z=B.value[M+2],B.offsetSrc+=3),B.size===2?(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=F.x,B.array[G+3]=F.y,B.array[G+4]=Z.x,B.array[G+5]=Z.y,B.offset+=6):B.size===3?(B.type==="c"?(B.array[G+0]=E.r,B.array[G+1]=E.g,B.array[G+2]=E.b,B.array[G+3]=F.r,B.array[G+
+4]=F.g,B.array[G+5]=F.b,B.array[G+6]=Z.r,B.array[G+7]=Z.g,B.array[G+8]=Z.b):(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=E.z,B.array[G+3]=F.x,B.array[G+4]=F.y,B.array[G+5]=F.z,B.array[G+6]=Z.x,B.array[G+7]=Z.y,B.array[G+8]=Z.z),B.offset+=9):(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=E.z,B.array[G+3]=E.w,B.array[G+4]=F.x,B.array[G+5]=F.y,B.array[G+6]=F.z,B.array[G+7]=F.w,B.array[G+8]=Z.x,B.array[G+9]=Z.y,B.array[G+10]=Z.z,B.array[G+11]=Z.w,B.offset+=12));if(Aa){G=0;for(M=Ba.length;G<M;G++)E=
+Ba[G].vertices[o.a].position,F=Ba[G].vertices[o.b].position,Z=Ba[G].vertices[o.c].position,B=oa[G],B[U+0]=E.x,B[U+1]=E.y,B[U+2]=E.z,B[U+3]=F.x,B[U+4]=F.y,B[U+5]=F.z,B[U+6]=Z.x,B[U+7]=Z.y,B[U+8]=Z.z;U+=9}if(Fa.length)G=Fa[o.a],M=Fa[o.b],B=Fa[o.c],da[P]=G.x,da[P+1]=G.y,da[P+2]=G.z,da[P+3]=G.w,da[P+4]=M.x,da[P+5]=M.y,da[P+6]=M.z,da[P+7]=M.w,da[P+8]=B.x,da[P+9]=B.y,da[P+10]=B.z,da[P+11]=B.w,G=Na[o.a],M=Na[o.b],B=Na[o.c],ca[P]=G.x,ca[P+1]=G.y,ca[P+2]=G.z,ca[P+3]=G.w,ca[P+4]=M.x,ca[P+5]=M.y,ca[P+6]=M.z,
+ca[P+7]=M.w,ca[P+8]=B.x,ca[P+9]=B.y,ca[P+10]=B.z,ca[P+11]=B.w,G=La[o.a],M=La[o.b],B=La[o.c],qa[P]=G.x,qa[P+1]=G.y,qa[P+2]=G.z,qa[P+3]=1,qa[P+4]=M.x,qa[P+5]=M.y,qa[P+6]=M.z,qa[P+7]=1,qa[P+8]=B.x,qa[P+9]=B.y,qa[P+10]=B.z,qa[P+11]=1,G=Ma[o.a],M=Ma[o.b],B=Ma[o.c],ha[P]=G.x,ha[P+1]=G.y,ha[P+2]=G.z,ha[P+3]=1,ha[P+4]=M.x,ha[P+5]=M.y,ha[P+6]=M.z,ha[P+7]=1,ha[P+8]=B.x,ha[P+9]=B.y,ha[P+10]=B.z,ha[P+11]=1,P+=12;if(xa&&D)w.length==3&&D==THREE.VertexColors?(o=w[0],G=w[1],M=w[2]):M=G=o=x,fa[na]=o.r,fa[na+1]=o.g,
+fa[na+2]=o.b,fa[na+3]=G.r,fa[na+4]=G.g,fa[na+5]=G.b,fa[na+6]=M.r,fa[na+7]=M.g,fa[na+8]=M.b,na+=9;if(Ca&&la.hasTangents)w=A[0],x=A[1],o=A[2],X[Q]=w.x,X[Q+1]=w.y,X[Q+2]=w.z,X[Q+3]=w.w,X[Q+4]=x.x,X[Q+5]=x.y,X[Q+6]=x.z,X[Q+7]=x.w,X[Q+8]=o.x,X[Q+9]=o.y,X[Q+10]=o.z,X[Q+11]=o.w,Q+=12;if(ua&&I)if(p.length==3&&ra)for(A=0;A<3;A++)v=p[A],ga[S]=v.x,ga[S+1]=v.y,ga[S+2]=v.z,S+=3;else for(A=0;A<3;A++)ga[S]=v.x,ga[S+1]=v.y,ga[S+2]=v.z,S+=3;if(sa&&J!==void 0&&y)for(A=0;A<3;A++)p=J[A],ea[T]=p.u,ea[T+1]=p.v,T+=2;if(sa&&
+Y!==void 0&&y)for(A=0;A<3;A++)p=Y[A],ia[W]=p.u,ia[W+1]=p.v,W+=2;ta&&(ja[pa]=L,ja[pa+1]=L+1,ja[pa+2]=L+2,pa+=3,ma[V]=L,ma[V+1]=L+1,ma[V+2]=L,ma[V+3]=L+2,ma[V+4]=L+1,ma[V+5]=L+2,V+=6,L+=3)}else if(o instanceof THREE.Face4){if(ya)E=wa[o.a].position,F=wa[o.b].position,Z=wa[o.c].position,N=wa[o.d].position,$[O]=E.x,$[O+1]=E.y,$[O+2]=E.z,$[O+3]=F.x,$[O+4]=F.y,$[O+5]=F.z,$[O+6]=Z.x,$[O+7]=Z.y,$[O+8]=Z.z,$[O+9]=N.x,$[O+10]=N.y,$[O+11]=N.z,O+=12;if(ka)for(R in ka)if(B=ka[R],B.__original.needsUpdate)G=B.offset,
+M=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[G+0]=B.value[o.a],B.array[G+1]=B.value[o.b],B.array[G+2]=B.value[o.c],B.array[G+3]=B.value[o.d]):B.boundTo==="faces"?(B.array[G+0]=B.value[M],B.array[G+1]=B.value[M],B.array[G+2]=B.value[M],B.array[G+3]=B.value[M],B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[G+0]=B.value[M+0],B.array[G+1]=B.value[M+1],B.array[G+2]=B.value[M+2],B.array[G+3]=B.value[M+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo===
+"vertices"?(E=B.value[o.a],F=B.value[o.b],Z=B.value[o.c],N=B.value[o.d]):B.boundTo==="faces"?(E=B.value[M],F=B.value[M],Z=B.value[M],N=B.value[M],B.offsetSrc++):B.boundTo==="faceVertices"&&(E=B.value[M+0],F=B.value[M+1],Z=B.value[M+2],N=B.value[M+3],B.offsetSrc+=4),B.size===2?(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=F.x,B.array[G+3]=F.y,B.array[G+4]=Z.x,B.array[G+5]=Z.y,B.array[G+6]=N.x,B.array[G+7]=N.y,B.offset+=8):B.size===3?(B.type==="c"?(B.array[G+0]=E.r,B.array[G+1]=E.g,B.array[G+2]=E.b,
+B.array[G+3]=F.r,B.array[G+4]=F.g,B.array[G+5]=F.b,B.array[G+6]=Z.r,B.array[G+7]=Z.g,B.array[G+8]=Z.b,B.array[G+9]=N.r,B.array[G+10]=N.g,B.array[G+11]=N.b):(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=E.z,B.array[G+3]=F.x,B.array[G+4]=F.y,B.array[G+5]=F.z,B.array[G+6]=Z.x,B.array[G+7]=Z.y,B.array[G+8]=Z.z,B.array[G+9]=N.x,B.array[G+10]=N.y,B.array[G+11]=N.z),B.offset+=12):(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=E.z,B.array[G+3]=E.w,B.array[G+4]=F.x,B.array[G+5]=F.y,B.array[G+6]=F.z,B.array[G+
+7]=F.w,B.array[G+8]=Z.x,B.array[G+9]=Z.y,B.array[G+10]=Z.z,B.array[G+11]=Z.w,B.array[G+12]=N.x,B.array[G+13]=N.y,B.array[G+14]=N.z,B.array[G+15]=N.w,B.offset+=16));if(Aa){G=0;for(M=Ba.length;G<M;G++)E=Ba[G].vertices[o.a].position,F=Ba[G].vertices[o.b].position,Z=Ba[G].vertices[o.c].position,N=Ba[G].vertices[o.d].position,B=oa[G],B[U+0]=E.x,B[U+1]=E.y,B[U+2]=E.z,B[U+3]=F.x,B[U+4]=F.y,B[U+5]=F.z,B[U+6]=Z.x,B[U+7]=Z.y,B[U+8]=Z.z,B[U+9]=N.x,B[U+10]=N.y,B[U+11]=N.z;U+=12}if(Fa.length)G=Fa[o.a],M=Fa[o.b],
+B=Fa[o.c],K=Fa[o.d],da[P]=G.x,da[P+1]=G.y,da[P+2]=G.z,da[P+3]=G.w,da[P+4]=M.x,da[P+5]=M.y,da[P+6]=M.z,da[P+7]=M.w,da[P+8]=B.x,da[P+9]=B.y,da[P+10]=B.z,da[P+11]=B.w,da[P+12]=K.x,da[P+13]=K.y,da[P+14]=K.z,da[P+15]=K.w,G=Na[o.a],M=Na[o.b],B=Na[o.c],K=Na[o.d],ca[P]=G.x,ca[P+1]=G.y,ca[P+2]=G.z,ca[P+3]=G.w,ca[P+4]=M.x,ca[P+5]=M.y,ca[P+6]=M.z,ca[P+7]=M.w,ca[P+8]=B.x,ca[P+9]=B.y,ca[P+10]=B.z,ca[P+11]=B.w,ca[P+12]=K.x,ca[P+13]=K.y,ca[P+14]=K.z,ca[P+15]=K.w,G=La[o.a],M=La[o.b],B=La[o.c],K=La[o.d],qa[P]=G.x,
+qa[P+1]=G.y,qa[P+2]=G.z,qa[P+3]=1,qa[P+4]=M.x,qa[P+5]=M.y,qa[P+6]=M.z,qa[P+7]=1,qa[P+8]=B.x,qa[P+9]=B.y,qa[P+10]=B.z,qa[P+11]=1,qa[P+12]=K.x,qa[P+13]=K.y,qa[P+14]=K.z,qa[P+15]=1,G=Ma[o.a],M=Ma[o.b],B=Ma[o.c],o=Ma[o.d],ha[P]=G.x,ha[P+1]=G.y,ha[P+2]=G.z,ha[P+3]=1,ha[P+4]=M.x,ha[P+5]=M.y,ha[P+6]=M.z,ha[P+7]=1,ha[P+8]=B.x,ha[P+9]=B.y,ha[P+10]=B.z,ha[P+11]=1,ha[P+12]=o.x,ha[P+13]=o.y,ha[P+14]=o.z,ha[P+15]=1,P+=16;if(xa&&D)w.length==4&&D==THREE.VertexColors?(o=w[0],G=w[1],M=w[2],w=w[3]):w=M=G=o=x,fa[na]=
+o.r,fa[na+1]=o.g,fa[na+2]=o.b,fa[na+3]=G.r,fa[na+4]=G.g,fa[na+5]=G.b,fa[na+6]=M.r,fa[na+7]=M.g,fa[na+8]=M.b,fa[na+9]=w.r,fa[na+10]=w.g,fa[na+11]=w.b,na+=12;if(Ca&&la.hasTangents)w=A[0],x=A[1],o=A[2],A=A[3],X[Q]=w.x,X[Q+1]=w.y,X[Q+2]=w.z,X[Q+3]=w.w,X[Q+4]=x.x,X[Q+5]=x.y,X[Q+6]=x.z,X[Q+7]=x.w,X[Q+8]=o.x,X[Q+9]=o.y,X[Q+10]=o.z,X[Q+11]=o.w,X[Q+12]=A.x,X[Q+13]=A.y,X[Q+14]=A.z,X[Q+15]=A.w,Q+=16;if(ua&&I)if(p.length==4&&ra)for(A=0;A<4;A++)v=p[A],ga[S]=v.x,ga[S+1]=v.y,ga[S+2]=v.z,S+=3;else for(A=0;A<4;A++)ga[S]=
+v.x,ga[S+1]=v.y,ga[S+2]=v.z,S+=3;if(sa&&J!==void 0&&y)for(A=0;A<4;A++)p=J[A],ea[T]=p.u,ea[T+1]=p.v,T+=2;if(sa&&Y!==void 0&&y)for(A=0;A<4;A++)p=Y[A],ia[W]=p.u,ia[W+1]=p.v,W+=2;ta&&(ja[pa]=L,ja[pa+1]=L+1,ja[pa+2]=L+3,ja[pa+3]=L+1,ja[pa+4]=L+2,ja[pa+5]=L+3,pa+=6,ma[V]=L,ma[V+1]=L+1,ma[V+2]=L,ma[V+3]=L+3,ma[V+4]=L+1,ma[V+5]=L+2,ma[V+6]=L+2,ma[V+7]=L+3,V+=8,L+=4)}if(Ja){u=0;for(n=Ja.length;u<n;u++)ja[pa]=Ja[u].a,ja[pa+1]=Ja[u].b,ja[pa+2]=Ja[u].c,ja[pa+3]=Ja[u].a,ja[pa+4]=Ja[u].c,ja[pa+5]=Ja[u].d,pa+=6}ya&&
+(k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,$,m));if(ka)for(R in ka)B=ka[R],B.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,B.buffer),k.bufferData(k.ARRAY_BUFFER,B.array,m));if(Aa){G=0;for(M=Ba.length;G<M;G++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[G]),k.bufferData(k.ARRAY_BUFFER,oa[G],m)}xa&&na>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m));ua&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),
+k.bufferData(k.ARRAY_BUFFER,ga,m));Ca&&la.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,X,m));sa&&T>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,ea,m));sa&&W>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,ia,m));ta&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ja,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,
+ma,m));P>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,qa,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,ha,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,da,m));j.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,
+delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;C(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;y=b.vertices;g=b.colors;D=y.length;j=g.length;I=b.__vertexArray;m=b.__colorArray;
+J=b.__dirtyColors;if(b.__dirtyVertices){for(u=0;u<D;u++)n=y[u].position,h=u*3,I[h]=n.x,I[h+1]=n.y,I[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,I,e)}if(J){for(u=0;u<j;u++)color=g[u],h=u*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;
+y=b.vertices;g=b.colors;D=y.length;j=g.length;I=b.__vertexArray;m=b.__colorArray;J=b.__dirtyColors;if(b.__dirtyVertices){for(u=0;u<D;u++)n=y[u].position,h=u*3,I[h]=n.x,I[h+1]=n.y,I[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,I,e)}if(J){for(u=0;u<j;u++)color=g[u],h=u*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=
+b.geometry,g=H(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||g)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,C(f)}function I(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function J(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,u,o={},n=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,
+m=e(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),u=o[m].hash+"_"+o[m].counter,b.geometryGroups[u]==void 0&&(b.geometryGroups[u]={faces:[],materials:k,vertices:0,numMorphTargets:n}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[u].vertices+j>65535&&(o[m].counter+=1,u=o[m].hash+"_"+o[m].counter,b.geometryGroups[u]==void 0&&(b.geometryGroups[u]={faces:[],materials:k,vertices:0,numMorphTargets:n})),b.geometryGroups[u].faces.push(h),b.geometryGroups[u].vertices+=j}function S(b,e,c){b.push({buffer:e,object:c,
+opaque:{list:[],count:0},transparent:{list:[],count:0}})}function R(b){if(b!=ja){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}ja=
+b}}function N(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,Q(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,Q(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,Q(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,Q(e.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_MAG_FILTER,X(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,X(e.minFilter)))}
+function F(b,e){if(b.needsUpdate)b.__webglInit?(k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image)):(b.__webglTexture=k.createTexture(),k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image),b.__webglInit=!0),N(k.TEXTURE_2D,b,b.image),k.bindTexture(k.TEXTURE_2D,null),b.needsUpdate=!1;k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function W(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===
+void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,Q(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,Q(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,Q(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,Q(b.minFilter));k.texImage2D(k.TEXTURE_2D,
+0,Q(b.format),b.width,b.height,0,Q(b.format),Q(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,
+k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=da,b=Y);e!=ga&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ca,oa,c,b),ga=e)}function K(b,e){var c;b=="fragment"?c=k.createShader(k.FRAGMENT_SHADER):
+b=="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,e);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(e),null;return c}function X(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}function Q(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;
+case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;
+case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}var U=this,k,ia=[],L=null,ga=null,fa=!0,$=null,ha=null,ja=null,ma=null,ra=null,T=null,ka=null,ca=0,oa=0,da=0,Y=0,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],pa=new THREE.Matrix4,na=new Float32Array(16),qa=new Float32Array(16),ya=new THREE.Vector4,Ca={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},xa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0?b.stencil:!0,Oa=b.antialias!==void 0?b.antialias:!1,ua=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ta=b.clearAlpha!==
+void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClear=!0;try{if(!(k=xa.getContext("experimental-webgl",{antialias:Oa,stencil:Aa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(sa){console.error(sa)}k.clearColor(0,0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);
+k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(ua.r,ua.g,ua.b,ta);this.context=k;var Da=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Aa){var ea={};ea.vertices=new Float32Array(12);ea.faces=new Uint16Array(6);ea.darkness=0.5;ea.vertices[0]=-20;ea.vertices[1]=-20;ea.vertices[2]=-1;ea.vertices[3]=20;ea.vertices[4]=-20;ea.vertices[5]=-1;ea.vertices[6]=20;
+ea.vertices[7]=20;ea.vertices[8]=-1;ea.vertices[9]=-20;ea.vertices[10]=20;ea.vertices[11]=-1;ea.faces[0]=0;ea.faces[1]=1;ea.faces[2]=2;ea.faces[3]=0;ea.faces[4]=2;ea.faces[5]=3;ea.vertexBuffer=k.createBuffer();ea.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,ea.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,ea.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ea.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,ea.faces,k.STATIC_DRAW);ea.program=k.createProgram();k.attachShader(ea.program,
+K("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(ea.program,K("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(ea.program);ea.vertexLocation=k.getAttribLocation(ea.program,"position");ea.projectionLocation=k.getUniformLocation(ea.program,"projectionMatrix");ea.darknessLocation=k.getUniformLocation(ea.program,"darkness")}var O={};O.vertices=new Float32Array(16);O.faces=new Uint16Array(6);b=0;O.vertices[b++]=-1;O.vertices[b++]=-1;O.vertices[b++]=0;O.vertices[b++]=
+0;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;b=0;O.faces[b++]=0;O.faces[b++]=1;O.faces[b++]=2;O.faces[b++]=0;O.faces[b++]=2;O.faces[b++]=3;O.vertexBuffer=k.createBuffer();O.elementBuffer=k.createBuffer();O.tempTexture=k.createTexture();O.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,O.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
+O.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,O.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,O.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,O.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.bindTexture(k.TEXTURE_2D,
+O.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(O.hasVertexTexture=!1,O.program=k.createProgram(),k.attachShader(O.program,K("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),
+k.attachShader(O.program,K("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(O.hasVertexTexture=!0,O.program=k.createProgram(),k.attachShader(O.program,K("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(O.program,K("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(O.program);O.attributes={};O.uniforms={};O.attributes.vertex=k.getAttribLocation(O.program,"position");O.attributes.uv=k.getAttribLocation(O.program,"UV");O.uniforms.renderType=
+k.getUniformLocation(O.program,"renderType");O.uniforms.map=k.getUniformLocation(O.program,"map");O.uniforms.occlusionMap=k.getUniformLocation(O.program,"occlusionMap");O.uniforms.opacity=k.getUniformLocation(O.program,"opacity");O.uniforms.scale=k.getUniformLocation(O.program,"scale");O.uniforms.rotation=k.getUniformLocation(O.program,"rotation");O.uniforms.screenPosition=k.getUniformLocation(O.program,"screenPosition");var wa=!1,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);b=
+0;V.vertices[b++]=-1;V.vertices[b++]=-1;V.vertices[b++]=0;V.vertices[b++]=1;V.vertices[b++]=1;V.vertices[b++]=-1;V.vertices[b++]=1;V.vertices[b++]=1;V.vertices[b++]=1;V.vertices[b++]=1;V.vertices[b++]=1;V.vertices[b++]=0;V.vertices[b++]=-1;V.vertices[b++]=1;V.vertices[b++]=0;b=V.vertices[b++]=0;V.faces[b++]=0;V.faces[b++]=1;V.faces[b++]=2;V.faces[b++]=0;V.faces[b++]=2;V.faces[b++]=3;V.vertexBuffer=k.createBuffer();V.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,V.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
+V.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,V.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,V.faces,k.STATIC_DRAW);V.program=k.createProgram();k.attachShader(V.program,K("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(V.program,K("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(V.program);V.attributes={};V.uniforms={};V.attributes.position=k.getAttribLocation(V.program,"position");V.attributes.uv=k.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=
+k.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=k.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=k.getUniformLocation(V.program,"rotation");V.uniforms.scale=k.getUniformLocation(V.program,"scale");V.uniforms.alignment=k.getUniformLocation(V.program,"alignment");V.uniforms.map=k.getUniformLocation(V.program,"map");V.uniforms.opacity=k.getUniformLocation(V.program,"opacity");V.uniforms.useScreenCoordinates=k.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=
+k.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=k.getUniformLocation(V.program,"screenPosition");V.uniforms.modelViewMatrix=k.getUniformLocation(V.program,"modelViewMatrix");V.uniforms.projectionMatrix=k.getUniformLocation(V.program,"projectionMatrix");var la=!1;this.setSize=function(b,e){xa.width=b;xa.height=e;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(b,e,c,f){ca=b;oa=e;da=c;Y=f;k.viewport(ca,oa,da,Y)};this.setScissor=function(b,e,c,f){k.scissor(b,
+e,c,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){fa=b;k.depthMask(b)};this.setClearColorHex=function(b,e){ua.setHex(b);ta=e;k.clearColor(ua.r,ua.g,ua.b,ta)};this.setClearColor=function(b,e){ua.copy(b);ta=e;k.clearColor(ua.r,ua.g,ua.b,ta)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){ea.darkness=b};this.getContext=function(){return k};
+this.initMaterial=function(b,e,c,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var m=THREE.ShaderLib[j];b.uniforms=
+THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var u,o,n;u=n=m=0;for(o=e.length;u<o;u++)g=e[u],g instanceof THREE.DirectionalLight&&n++,g instanceof THREE.PointLight&&m++;m+n<=4?e=n:(e=Math.ceil(4*n/(m+n)),m=4-e);g={directional:e,point:m};n=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)n=f.bones.length;var p;a:{u=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,
+fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:n},v;g=[];j?g.push(j):(g.push(u),g.push(o));for(v in c)g.push(v),g.push(c[v]);j=g.join();v=0;for(g=ia.length;v<g;v++)if(ia[v].code==j){p=ia[v].program;break a}v=k.createProgram();g=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+
 c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-t=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(u,M("fragment",t+n));j.attachShader(u,M("vertex",h+o));j.linkProgram(u);
-j.getProgramParameter(u,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(u,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");u.uniforms={};u.attributes={};var v;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)n.push(v);v=n;m=0;for(n=v.length;m<n;m++)o=v[m],u.uniforms[o]=j.getUniformLocation(u,o);n=["position","normal",
-"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)n.push("morphTarget"+v);for(p in e)n.push(p);p=n;v=0;for(e=p.length;v<e;v++)c=p[v],u.attributes[c]=j.getAttribLocation(u,c);fa.push({program:u,code:k});p=u}b.program=p;p=b.program.attributes;p.position>=0&&j.enableVertexAttribArray(p.position);p.color>=0&&j.enableVertexAttribArray(p.color);p.normal>=0&&j.enableVertexAttribArray(p.normal);p.tangent>=0&&j.enableVertexAttribArray(p.tangent);
-b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(j.enableVertexAttribArray(p.skinVertexA),j.enableVertexAttribArray(p.skinVertexB),j.enableVertexAttribArray(p.skinIndex),j.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&j.enableVertexAttribArray(p[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(j.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(j.enableVertexAttribArray(p.morphTarget1),
-b.numSupportedMorphTargets++);p.morphTarget2>=0&&(j.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(j.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(j.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(j.enableVertexAttribArray(p.morphTarget5),b.numSupportedMorphTargets++);p.morphTarget6>=0&&(j.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=
-0&&(j.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,w){var I,E,F,D,V,H,G,L,M=b.lights,N=b.fog;R.data.vertices=0;R.data.faces=0;R.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(na);c.projectionMatrix.flattenToArray(ha);oa.multiply(c.projectionMatrix,
-c.matrixWorldInverse);n(oa);this.initWebGLObjects(b);W(o);(this.autoClear||w)&&this.clear();V=b.__webglObjects.length;for(w=0;w<V;w++)if(I=b.__webglObjects[w],G=I.object,G.visible)if(!(G instanceof THREE.Mesh)||p(G)){if(G.matrixWorld.flattenToArray(G._objectMatrixArray),y(G,c),u(I),I.render=!0,this.sortObjects)I.object.renderDepth?I.z=I.object.renderDepth:(wa.copy(G.position),oa.multiplyVector3(wa),I.z=wa.z)}else I.render=!1;else I.render=!1;this.sortObjects&&b.__webglObjects.sort(v);H=b.__webglObjectsImmediate.length;
-for(w=0;w<H;w++)I=b.__webglObjectsImmediate[w],G=I.object,G.visible&&(G.matrixAutoUpdate&&G.matrixWorld.flattenToArray(G._objectMatrixArray),y(G,c),t(I));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(w=0;w<V;w++)if(I=b.__webglObjects[w],I.render)G=I.object,L=I.buffer,k(G),f(c,M,N,b.overrideMaterial,L,G);for(w=0;w<H;w++)I=b.__webglObjectsImmediate[w],G=I.object,G.visible&&(k(G),E=e(c,M,N,b.overrideMaterial,G),G.render(function(e){g(e,E,b.overrideMaterial.shading)}))}else{J(THREE.NormalBlending);
-for(w=0;w<V;w++)if(I=b.__webglObjects[w],I.render){G=I.object;L=I.buffer;F=I.opaque;k(G);for(I=0;I<F.count;I++)D=F.list[I],h(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,M,N,D,L,G)}for(w=0;w<H;w++)if(I=b.__webglObjectsImmediate[w],G=I.object,G.visible){F=I.opaque;k(G);for(I=0;I<F.count;I++)D=F.list[I],h(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),E=e(c,M,N,D,G),G.render(function(b){g(b,E,D.shading)})}for(w=0;w<V;w++)if(I=b.__webglObjects[w],
-I.render){G=I.object;L=I.buffer;F=I.transparent;k(G);for(I=0;I<F.count;I++)D=F.list[I],J(D.blending),h(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,M,N,D,L,G)}for(w=0;w<H;w++)if(I=b.__webglObjectsImmediate[w],G=I.object,G.visible){F=I.transparent;k(G);for(I=0;I<F.count;I++)D=F.list[I],J(D.blending),h(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),E=e(c,M,N,D,G),G.render(function(b){g(b,E,D.shading)})}}b.__webglSprites.length&&B(b,c);ya&&
-b.__webglShadowVolumes.length&&b.lights.length&&x(b);b.__webglLensFlares.length&&A(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(j.bindTexture(j.TEXTURE_2D,o.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
-c=b,f=void 0,g=void 0,h=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(f in g=e.geometry,g.geometryGroups==void 0&&D(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var k=h;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();
-k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){var m=void 0,n=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(n=k.numMorphTargets;m<
-n;m++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}for(var k=h,m=e,o=void 0,p=void 0,t=void 0,u=t=void 0,v=void 0,x=void 0,y=x=n=0,w=t=p=void 0,A=w=p=o=void 0,t=void 0,u=m.geometry,v=u.faces,w=k.faces,o=0,p=w.length;o<p;o++)t=w[o],t=v[t],t instanceof THREE.Face3?(n+=3,x+=1,y+=3):t instanceof THREE.Face4&&(n+=4,x+=2,y+=4);for(var o=k,p=m,I=w=v=void 0,B=void 0,I=void 0,t=[],v=0,w=p.materials.length;v<w;v++)if(I=p.materials[v],I instanceof THREE.MeshFaceMaterial){I=0;for(l=o.materials.length;I<
-l;I++)(B=o.materials[I])&&t.push(B)}else(B=I)&&t.push(B);o=t;k.__materials=o;a:{v=p=void 0;w=o.length;for(p=0;p<w;p++)if(v=o[p],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{w=v=void 0;t=o.length;for(v=0;v<t;v++)if(w=o[v],!(w instanceof THREE.MeshBasicMaterial&&!w.envMap||w instanceof THREE.MeshDepthMaterial)){w=w&&w.shading!=void 0&&w.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}w=!1}a:{t=v=void 0;I=o.length;for(v=0;v<I;v++)if(t=o[v],
-t.vertexColors){t=t.vertexColors;break a}t=!1}k.__vertexArray=new Float32Array(n*3);if(w)k.__normalArray=new Float32Array(n*3);if(u.hasTangents)k.__tangentArray=new Float32Array(n*4);if(t)k.__colorArray=new Float32Array(n*3);if(p){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(n*4),
-k.__skinVertexBArray=new Float32Array(n*4),k.__skinIndexArray=new Float32Array(n*4),k.__skinWeightArray=new Float32Array(n*4);k.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(y*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(n*3))}k.__needsSmoothNormals=w==THREE.SmoothShading;k.__uvType=p;k.__vertexColorType=t;k.__normalType=w;k.__webglFaceCount=
-x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=y*2;u=0;for(v=o.length;u<v;u++)if(p=o[u],p.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in p.attributes){t=p.attributes[a];w={};for(A in t)w[A]=t[A];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,x=1,w.type==="v2"?x=2:w.type==="v3"?x=3:w.type==="v4"?x=4:w.type==="c"&&(x=3),w.size=x,w.array=new Float32Array(n*x),w.buffer=j.createBuffer(),w.buffer.belongsToAttribute=
-a,t.needsUpdate=!0,w.__original=t;k.__webglCustomAttributes[a]=w}}k.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?S(c.__webglShadowVolumes,h,e):S(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)S(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),
-f.__webglColorBuffer=j.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;S(c.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=
-!0,g.__dirtyColors=!0;S(c.__webglObjects,g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer){f=g;f.__webglVertexBuffer=j.createBuffer();f.__webglColorBuffer=j.createBuffer();f=g;h=e;k=f.vertices.length;f.__vertexArray=new Float32Array(k*3);f.__colorArray=new Float32Array(k*3);f.__sortArray=[];f.__webglParticleCount=k;f.__materials=h.materials;A=n=m=void 0;m=0;for(n=h.materials.length;m<n;m++)if(A=h.materials[m],A.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes=
-{};for(a in A.attributes){originalAttribute=A.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=j.createBuffer(),attribute.buffer.belongsToAttribute=
+n=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(v,K("fragment",n+u));k.attachShader(v,K("vertex",g+o));k.linkProgram(v);
+k.getProgramParameter(v,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(v,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");v.uniforms={};v.attributes={};var w;u=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m)u.push(w);w=u;m=0;for(u=w.length;m<u;m++)o=w[m],v.uniforms[o]=k.getUniformLocation(v,o);u=["position","normal",
+"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)u.push("morphTarget"+w);for(p in e)u.push(p);p=u;w=0;for(e=p.length;w<e;w++)c=p[w],v.attributes[c]=k.getAttribLocation(v,c);ia.push({program:v,code:j});p=v}b.program=p;p=b.program.attributes;p.position>=0&&k.enableVertexAttribArray(p.position);p.color>=0&&k.enableVertexAttribArray(p.color);p.normal>=0&&k.enableVertexAttribArray(p.normal);p.tangent>=0&&k.enableVertexAttribArray(p.tangent);
+b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(k.enableVertexAttribArray(p.skinVertexA),k.enableVertexAttribArray(p.skinVertexB),k.enableVertexAttribArray(p.skinIndex),k.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&k.enableVertexAttribArray(p[h]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(k.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(k.enableVertexAttribArray(p.morphTarget1),
+b.numSupportedMorphTargets++);p.morphTarget2>=0&&(k.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(k.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(k.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(k.enableVertexAttribArray(p.morphTarget5),b.numSupportedMorphTargets++);p.morphTarget6>=0&&(k.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=
+0&&(k.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(h=this.maxMorphTargets;b<h;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,C){var E,I,F,H,J,Z,Y,N,L=b.lights,K=b.fog;U.data.vertices=0;U.data.faces=0;U.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(qa);c.projectionMatrix.flattenToArray(na);pa.multiply(c.projectionMatrix,
+c.matrixWorldInverse);n(pa);this.initWebGLObjects(b);W(o);(this.autoClear||C)&&this.clear();J=b.__webglObjects.length;for(C=0;C<J;C++)if(E=b.__webglObjects[C],Y=E.object,Y.visible)if(!(Y instanceof THREE.Mesh)||p(Y)){if(Y.matrixWorld.flattenToArray(Y._objectMatrixArray),A(Y,c),v(E),E.render=!0,this.sortObjects)E.object.renderDepth?E.z=E.object.renderDepth:(ya.copy(Y.position),pa.multiplyVector3(ya),E.z=ya.z)}else E.render=!1;else E.render=!1;this.sortObjects&&b.__webglObjects.sort(w);Z=b.__webglObjectsImmediate.length;
+for(C=0;C<Z;C++)E=b.__webglObjectsImmediate[C],Y=E.object,Y.visible&&(Y.matrixAutoUpdate&&Y.matrixWorld.flattenToArray(Y._objectMatrixArray),A(Y,c),u(E));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);R(b.overrideMaterial.blending);for(C=0;C<J;C++)if(E=b.__webglObjects[C],E.render)Y=E.object,N=E.buffer,h(Y),f(c,L,K,b.overrideMaterial,N,Y);for(C=0;C<Z;C++)E=b.__webglObjectsImmediate[C],Y=E.object,Y.visible&&(h(Y),I=e(c,L,K,b.overrideMaterial,Y),Y.render(function(e){g(e,I,b.overrideMaterial.shading)}))}else{R(THREE.NormalBlending);
+for(C=0;C<J;C++)if(E=b.__webglObjects[C],E.render){Y=E.object;N=E.buffer;F=E.opaque;h(Y);for(E=0;E<F.count;E++)H=F.list[E],j(H.depthTest),m(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,L,K,H,N,Y)}for(C=0;C<Z;C++)if(E=b.__webglObjectsImmediate[C],Y=E.object,Y.visible){F=E.opaque;h(Y);for(E=0;E<F.count;E++)H=F.list[E],j(H.depthTest),m(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),I=e(c,L,K,H,Y),Y.render(function(b){g(b,I,H.shading)})}for(C=0;C<J;C++)if(E=b.__webglObjects[C],
+E.render){Y=E.object;N=E.buffer;F=E.transparent;h(Y);for(E=0;E<F.count;E++)H=F.list[E],R(H.blending),j(H.depthTest),m(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,L,K,H,N,Y)}for(C=0;C<Z;C++)if(E=b.__webglObjectsImmediate[C],Y=E.object,Y.visible){F=E.transparent;h(Y);for(E=0;E<F.count;E++)H=F.list[E],R(H.blending),j(H.depthTest),m(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),I=e(c,L,K,H,Y),Y.render(function(b){g(b,I,H.shading)})}}b.__webglSprites.length&&y(b,c);Aa&&
+b.__webglShadowVolumes.length&&b.lights.length&&x(b);b.__webglLensFlares.length&&D(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,o.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
+c=b,f=void 0,g=void 0,h=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(f in g=e.geometry,g.geometryGroups==void 0&&J(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var j=h;j.__webglVertexBuffer=k.createBuffer();j.__webglNormalBuffer=k.createBuffer();
+j.__webglTangentBuffer=k.createBuffer();j.__webglColorBuffer=k.createBuffer();j.__webglUVBuffer=k.createBuffer();j.__webglUV2Buffer=k.createBuffer();j.__webglSkinVertexABuffer=k.createBuffer();j.__webglSkinVertexBBuffer=k.createBuffer();j.__webglSkinIndicesBuffer=k.createBuffer();j.__webglSkinWeightsBuffer=k.createBuffer();j.__webglFaceBuffer=k.createBuffer();j.__webglLineBuffer=k.createBuffer();if(j.numMorphTargets){var m=void 0,u=void 0;j.__webglMorphTargetsBuffers=[];m=0;for(u=j.numMorphTargets;m<
+u;m++)j.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var j=h,m=e,o=void 0,p=void 0,n=void 0,v=n=void 0,w=void 0,x=void 0,A=x=u=0,y=n=p=void 0,D=y=p=o=void 0,n=void 0,v=m.geometry,w=v.faces,y=j.faces,o=0,p=y.length;o<p;o++)n=y[o],n=w[n],n instanceof THREE.Face3?(u+=3,x+=1,A+=3):n instanceof THREE.Face4&&(u+=4,x+=2,A+=4);for(var o=j,p=m,C=y=w=void 0,H=void 0,C=void 0,n=[],w=0,y=p.materials.length;w<y;w++)if(C=p.materials[w],C instanceof THREE.MeshFaceMaterial){C=0;for(l=o.materials.length;C<
+l;C++)(H=o.materials[C])&&n.push(H)}else(H=C)&&n.push(H);o=n;j.__materials=o;a:{w=p=void 0;y=o.length;for(p=0;p<y;p++)if(w=o[p],w.map||w.lightMap||w instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{y=w=void 0;n=o.length;for(w=0;w<n;w++)if(y=o[w],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{n=w=void 0;C=o.length;for(w=0;w<C;w++)if(n=o[w],
+n.vertexColors){n=n.vertexColors;break a}n=!1}j.__vertexArray=new Float32Array(u*3);if(y)j.__normalArray=new Float32Array(u*3);if(v.hasTangents)j.__tangentArray=new Float32Array(u*4);if(n)j.__colorArray=new Float32Array(u*3);if(p){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)j.__uvArray=new Float32Array(u*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(u*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(u*4),
+j.__skinVertexBArray=new Float32Array(u*4),j.__skinIndexArray=new Float32Array(u*4),j.__skinWeightArray=new Float32Array(u*4);j.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(A*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];v=0;for(w=j.numMorphTargets;v<w;v++)j.__morphTargetsArrays.push(new Float32Array(u*3))}j.__needsSmoothNormals=y==THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=n;j.__normalType=y;j.__webglFaceCount=
+x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);j.__webglLineCount=A*2;v=0;for(w=o.length;v<w;v++)if(p=o[v],p.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in p.attributes){n=p.attributes[a];y={};for(D in n)y[D]=n[D];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,x=1,y.type==="v2"?x=2:y.type==="v3"?x=3:y.type==="v4"?x=4:y.type==="c"&&(x=3),y.size=x,y.array=new Float32Array(u*x),y.buffer=k.createBuffer(),y.buffer.belongsToAttribute=
+a,n.needsUpdate=!0,y.__original=n;j.__webglCustomAttributes[a]=y}}j.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?S(c.__webglShadowVolumes,h,e):S(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)S(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),
+f.__webglColorBuffer=k.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;S(c.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=
+!0,g.__dirtyColors=!0;S(c.__webglObjects,g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer){f=g;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=g;h=e;j=f.vertices.length;f.__vertexArray=new Float32Array(j*3);f.__colorArray=new Float32Array(j*3);f.__sortArray=[];f.__webglParticleCount=j;f.__materials=h.materials;D=u=m=void 0;m=0;for(u=h.materials.length;m<u;m++)if(D=h.materials[m],D.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes=
+{};for(a in D.attributes){originalAttribute=D.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(j*size),attribute.buffer=k.createBuffer(),attribute.buffer.belongsToAttribute=
 a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=!0;g.__dirtyColors=!0}S(c.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;if(c instanceof
 a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=!0;g.__dirtyColors=!0}S(c.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;if(c instanceof
-THREE.ShadowVolume)E(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)E(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof THREE.LensFlare?E(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&E(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)H(b.__webglObjects[e].object,
-b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)H(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)H(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),b=="back"?j.cullFace(j.BACK):b=="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.supportsVertexTextures=function(){return Ba}};
+THREE.ShadowVolume)I(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)I(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof THREE.LensFlare?I(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&I(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)E(b.__webglObjects[e].object,
+b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)E(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)E(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),b=="back"?k.cullFace(k.BACK):b=="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.supportsVertexTextures=function(){return Da}};
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
-THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,k=Math.max(Math.max(e,f),g),h=Math.min(Math.min(e,f),g);if(h==k)h=e=0;else{var m=k-h,h=m/k,e=e==k?(f-g)/m:f==k?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=h;c.v=k;return c},
+THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,h=Math.max(Math.max(e,f),g),j=Math.min(Math.min(e,f),g);if(j==h)j=e=0;else{var m=h-j,j=m/h,e=e==h?(f-g)/m:f==h?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=j;c.v=h;return c},
 clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
 clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,k=b.vertices,h=g.vertices,m=b.faces,n=g.faces,p=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,t=h.length;o<t;o++){var u=new THREE.Vertex(h[o].position.clone());e&&c.matrix.multiplyVector3(u.position);k.push(u)}o=0;for(t=n.length;o<t;o++){var h=n[o],v,x,B=h.vertexNormals,u=h.vertexColors;h instanceof THREE.Face3?v=new THREE.Face3(h.a+f,h.b+f,h.c+
-f):h instanceof THREE.Face4&&(v=new THREE.Face4(h.a+f,h.b+f,h.c+f,h.d+f));v.normal.copy(h.normal);e=0;for(k=B.length;e<k;e++)x=B[e],v.vertexNormals.push(x.clone());v.color.copy(h.color);e=0;for(k=u.length;e<k;e++)x=u[e],v.vertexColors.push(x.clone());v.materials=h.materials.slice();v.centroid.copy(h.centroid);m.push(v)}o=0;for(t=g.length;o<t;o++){f=g[o];m=[];e=0;for(k=f.length;e<k;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}}};
-THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],k=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)k.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return k}};
+THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,h=b.vertices,j=g.vertices,m=b.faces,n=g.faces,p=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,u=j.length;o<u;o++){var v=new THREE.Vertex(j[o].position.clone());e&&c.matrix.multiplyVector3(v.position);h.push(v)}o=0;for(u=n.length;o<u;o++){var j=n[o],w,x,y=j.vertexNormals,v=j.vertexColors;j instanceof THREE.Face3?w=new THREE.Face3(j.a+f,j.b+f,j.c+
+f):j instanceof THREE.Face4&&(w=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));w.normal.copy(j.normal);e=0;for(h=y.length;e<h;e++)x=y[e],w.vertexNormals.push(x.clone());w.color.copy(j.color);e=0;for(h=v.length;e<h;e++)x=v[e],w.vertexColors.push(x.clone());w.materials=j.materials.slice();w.centroid.copy(j.centroid);m.push(w)}o=0;for(u=g.length;o<u;o++){f=g[o];m=[];e=0;for(h=f.length;e<h;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}}};
+THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return h}};
 THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
 THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
@@ -356,23 +356,23 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,g,k=2*Math.ceil(b*3)+1;k>25&&(k=25);g=(k-1)*0.5;e=Array(k);for(c=f=0;c<k;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<k;++c)e[c]/=f;return e}};
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;e=Array(h);for(c=f=0;c<h;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<h;++c)e[c]/=f;return e}};
 THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
 THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
 0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var m=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){m={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++){var p=b.hierarchy[e].keys[f].morphTargets[n];m[p]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var o=
 0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var m=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){m={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++){var p=b.hierarchy[e].keys[f].morphTargets[n];m[p]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var o=
 {};for(p in m){for(n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++)if(b.hierarchy[e].keys[f].morphTargets[n]===p){o[p]=b.hierarchy[e].keys[f].morphTargetsInfluences[n];break}n===b.hierarchy[e].keys[f].morphTargets.length&&(o[p]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=o}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
 {};for(p in m){for(n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++)if(b.hierarchy[e].keys[f].morphTargets[n]===p){o[p]=b.hierarchy[e].keys[f].morphTargetsInfluences[n];break}n===b.hierarchy[e].keys[f].morphTargets.length&&(o[p]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=o}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
 b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
 b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
 2;return e}();THREE.Animation=function(b,c,e,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
 2;return e}();THREE.Animation=function(b,c,e,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,g;for(e=0;e<f;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
 THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,g;for(e=0;e<f;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
-THREE.Bone?g.skinMatrix:g.matrix;var k=g.animationCache.prevKey;g=g.animationCache.nextKey;k.pos=this.data.hierarchy[e].keys[0];k.rot=this.data.hierarchy[e].keys[0];k.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[e].keys[0];h.rot=this.data.hierarchy[e].keys[0];h.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,k,h,m,n,p,o=this.data.JIT.hierarchy,t,u;this.currentTime+=b*this.timeScale;u=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,x=this.hierarchy.length;v<x;v++)if(b=this.hierarchy[v],n=b.animationCache,this.JITCompile&&o[v][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[v][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=o[v][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var B=0;B<3;B++){e=c[B];h=n.prevKey[e];m=n.nextKey[e];if(m.time<=u){if(t<u)if(this.loop){h=this.data.hierarchy[v].keys[0];for(m=this.getNextKeyWith(e,v,1);m.time<t;)h=m,m=this.getNextKeyWith(e,v,m.index+1)}else{this.stop();return}else{do h=m,m=this.getNextKeyWith(e,v,m.index+1);while(m.time<
-t)}n.prevKey[e]=h;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-h.time)/(m.time-h.time);g=h[e];k=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",v,h.index-1).pos,this.points[1]=g,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",v,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
-"rot")THREE.Quaternion.slerp(g,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f}}if(this.JITCompile&&o[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)o[v][p]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,k,h,m,n,p;g=(b.length-1)*c;k=Math.floor(g);g-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];m=b[e[1]];n=b[e[2]];p=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(k[0],m[0],n[0],p[0],g,e,h);f[1]=this.interpolate(k[1],m[1],n[1],p[1],g,e,h);f[2]=this.interpolate(k[2],m[2],n[2],p[2],g,e,h);return f};
-THREE.Animation.prototype.interpolate=function(b,c,e,f,g,k,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*k+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,h,j,m,n,p,o=this.data.JIT.hierarchy,u,v;this.currentTime+=b*this.timeScale;v=this.currentTime;u=this.currentTime%=this.data.length;p=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,x=this.hierarchy.length;w<x;w++)if(b=this.hierarchy[w],n=b.animationCache,this.JITCompile&&o[w][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[w][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+!1):(b.matrix=o[w][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var y=0;y<3;y++){e=c[y];j=n.prevKey[e];m=n.nextKey[e];if(m.time<=v){if(u<v)if(this.loop){j=this.data.hierarchy[w].keys[0];for(m=this.getNextKeyWith(e,w,1);m.time<u;)j=m,m=this.getNextKeyWith(e,w,m.index+1)}else{this.stop();return}else{do j=m,m=this.getNextKeyWith(e,w,m.index+1);while(m.time<
+u)}n.prevKey[e]=j;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-j.time)/(m.time-j.time);g=j[e];h=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+w),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",w,j.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",w,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
+"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f}}if(this.JITCompile&&o[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(w=0;w<this.hierarchy.length;w++)o[w][p]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,h,j,m,n,p;g=(b.length-1)*c;h=Math.floor(g);g-=h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>b.length-2?h:h+1;e[3]=h>b.length-3?h:h+2;h=b[e[0]];m=b[e[1]];n=b[e[2]];p=b[e[3]];e=g*g;j=g*e;f[0]=this.interpolate(h[0],m[0],n[0],p[0],g,e,j);f[1]=this.interpolate(h[1],m[1],n[1],p[1],g,e,j);f[2]=this.interpolate(h[2],m[2],n[2],p[2],g,e,j);return f};
+THREE.Animation.prototype.interpolate=function(b,c,e,f,g,h,j){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*j+(-3*(c-e)-2*b-f)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
 THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
 THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
 b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
 b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
@@ -384,157 +384,178 @@ this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this
 (this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),
 (this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),
 !1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;
 !1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;
 THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
 THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
-THREE.PathCamera=function(b){function c(b,e,c,f){var g={name:c,fps:0.6,length:f,hierarchy:[]},h,k=e.getControlPointsArray(),m=e.getLength(),n=k.length,F=0;h=n-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:k[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<n-1;h++)F=f*m.chunks[h]/m.total,e.keys[h]={time:F,pos:k[h]};g.hierarchy[0]=e;THREE.AnimationHandler.add(g);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
-f,g=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),g.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return g}function f(b,c){var f=e(c,10),g=e(c,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,h);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);g=new THREE.SphereGeometry(1,
-16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,h),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
+THREE.PathCamera=function(b){function c(b,e,c,f){var g={name:c,fps:0.6,length:f,hierarchy:[]},h,j=e.getControlPointsArray(),m=e.getLength(),n=j.length,H=0;h=n-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<n-1;h++)H=f*m.chunks[h]/m.total,e.keys[h]={time:H,pos:j[h]};g.hierarchy[0]=e;THREE.AnimationHandler.add(g);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
+f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
+16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,g),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
 void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
 void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
-window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,k=Math.PI/180;this.update=function(b,e,c){var f,h;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var m=h[1]-h[0];this.phi=
-TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/m)*m+h[0];f=this.horizontalAngleMap.srcRange;h=this.horizontalAngleMap.dstRange;m=h[1]-h[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/m)*m+h[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.mouseX=
-b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),h=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),n=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(n,h);b.position.set(0,10,0);this.animation=
+window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(b,e,c){var f,j;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;j=this.verticalAngleMap.dstRange;var m=j[1]-j[0];this.phi=
+TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(j[1]-j[0])/(f[1]-f[0])+j[0]-j[0])/m)*m+j[0];f=this.horizontalAngleMap.srcRange;j=this.horizontalAngleMap.dstRange;m=j[1]-j[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(j[1]-j[0])/(f[1]-f[0])+j[0]-j[0])/m)*m+j[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.mouseX=
+b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),j=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),n=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(n,j);b.position.set(0,10,0);this.animation=
 c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove),
 c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove),
 !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
 !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
 THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
 THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
 b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
 b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
 this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
-case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),g=c.size[0]/2,k=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY-
-c.offset[1]-k)/k;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*
+case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),g=c.size[0]/2,h=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY-
+c.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*
 this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||
 this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,t=0,u=0,v=0,x=0,B=window.innerWidth/2,A=window.innerHeight/2;this.update=
-function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*v),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*t);this.translateY(b*u);n&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
-else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);k.set(0,1,0);g.cross(k,h).normalize();k.cross(h,g).normalize();this.matrix.n11=g.x;this.matrix.n12=k.x;this.matrix.n13=h.x;this.matrix.n21=g.y;this.matrix.n22=k.y;this.matrix.n23=h.y;this.matrix.n31=g.z;this.matrix.n32=k.z;this.matrix.n33=h.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
+THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,u=0,v=0,w=0,x=0,y=window.innerWidth/2,D=window.innerHeight/2;this.update=
+function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*w),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*u);this.translateY(b*v);n&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();j.copy(this.forward);h.set(0,1,0);g.cross(h,j).normalize();h.cross(j,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=j.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=j.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=j.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
-this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){k.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);k.multiplyScalar(b);this.forward.addSelf(k);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(b){v=(b.clientX-B)/window.innerWidth;x=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:t=-1;break;
-case 40:case 83:o=-1;break;case 39:case 68:t=1;break;case 81:n=!0;p=1;break;case 69:n=!0;p=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:t=0;break;case 40:case 83:o=0;break;case 39:case 68:t=0;break;case 81:n=!1;break;case 69:n=!1;break;case 82:u=0;break;case 70:u=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(b);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+function(b){w=(b.clientX-y)/window.innerWidth;x=(b.clientY-D)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:u=-1;break;
+case 40:case 83:o=-1;break;case 39:case 68:u=1;break;case 81:n=!0;p=1;break;case 69:n=!0;p=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:u=0;break;case 40:case 83:o=0;break;case 39:case 68:u=0;break;case 81:n=!1;break;case 69:n=!1;break;case 82:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
-THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
-!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,p=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
-this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,c){var e=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),f=e.length();f>1?e.normalize():e.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(g).setLength(e.x));f.addSelf(g.setLength(e.z));return f};
-this.rotateCamera=function(){var b=Math.acos(k.dot(h)/k.length()/h.length());if(b){var c=(new THREE.Vector3).cross(k,h).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(h);this.staticMoving?k=h:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var b=1+(n.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};
-this.panCamera=function(){var b=o.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var c=g.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?p=o:p.addSelf(b.sub(o,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
-g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(b,c,e){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,b,c,e)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-c(this,function(b){e&&(k=h=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=n=this.getMouseOnScreen(b.clientX,b.clientY),p=o=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
-b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?k=h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=n=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=o=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
+THREE.TrackballCamera=function(b){function c(b,e){return function(){e.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
+!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,p=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-
+this.screen.offsetLeft)/this.radius*0.5,(e-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var c=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-e)/this.radius,0),f=c.length();f>1?c.normalize():c.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(g).setLength(c.x));f.addSelf(g.setLength(c.z));return f};
+this.rotateCamera=function(){var b=Math.acos(h.dot(j)/h.length()/j.length());if(b){var e=(new THREE.Vector3).cross(h,j).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(g);c.multiplyVector3(this.up);c.multiplyVector3(j);this.staticMoving?h=j:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(h))}};this.zoomCamera=function(){var b=1+(n.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};
+this.panCamera=function(){var b=o.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var e=g.clone().crossSelf(this.up).setLength(b.x);e.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(e);this.target.position.addSelf(e);this.staticMoving?p=o:p.addSelf(b.sub(o,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
+g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(b,e,c){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,b,e,c)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+c(this,function(b){e&&(h=j=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=n=this.getMouseOnScreen(b.clientX,b.clientY),p=o=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?j=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
+b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?h=j=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=n=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=o=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
-THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;THREE.Path=function(b){this.actions=[];b&&this.fromPoints(b)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru"};THREE.Path.prototype.fromPoints=function(b){var c=0,e=b.length;this.moveTo(b[0].x,b[0].y);for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};
-THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};THREE.Path.prototype.lineTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};THREE.Path.prototype.quadraticCurveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:b})};
-THREE.Path.prototype.bezierCurveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:b})};THREE.Path.prototype.splineThru=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
-THREE.Path.prototype.getPoints=function(b){var b=b||12,c=[],e,f,g,k,h,m,n,p,o,t,u,v,x;e=0;for(f=this.actions.length;e<f;e++)switch(g=this.actions[e],k=g.action,g=g.args,k){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=g[2];h=g[3];p=g[0];o=g[1];c.length>0?(u=c[c.length-1],t=u.x,u=u.y):(u=this.actions[e-1].args,t=u[u.length-2],u=u[u.length-1]);for(g=1;g<=b;g++)v=g/b,x=THREE.FontUtils.b2(v,t,p,k),v=THREE.FontUtils.b2(v,u,o,h),c.push(new THREE.Vector2(x,
-v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=g[4];h=g[5];p=g[0];o=g[1];m=g[2];n=g[3];c.length>0?(u=c[c.length-1],t=u.x,u=u.y):(u=this.actions[e-1].args,t=u[u.length-2],u=u[u.length-1]);for(g=1;g<=b;g++)v=g/b,x=THREE.FontUtils.b3(v,t,p,m,k),v=THREE.FontUtils.b3(v,u,o,n,h),c.push(new THREE.Vector2(x,v));break;case THREE.PathActions.CSPLINE_THRU:u=this.actions[e-1].args;m=new THREE.Vector2(u[u.length-2],u[u.length-1]);k=g[0];h=b*k.length;k.unshift(m);m=new Spline2;for(g=0;g<h;g++)c.push(m.get2DPoint(k,
-g/h))}return c};var Spline2=function(){function b(b,c,e,f,g){var b=(e-b)*0.5,f=(f-c)*0.5,k=g*g;return(2*c-2*e+b+f)*g*k+(-3*c+3*e-2*b-f)*k+b*g+c}var c=[],e,f,g,k;this.get2DPoint=function(h,m){e=new THREE.Vector2;f=(h.length-1)*m;g=Math.floor(f);k=f-g;c[0]=g==0?g:g-1;c[1]=g;c[2]=g>h.length-2?g:g+1;c[3]=g>h.length-3?g:g+2;e.x=b(h[c[0]].x,h[c[1]].x,h[c[2]].x,h[c[3]].x,k);e.y=b(h[c[0]].y,h[c[1]].y,h[c[2]].y,h[c[3]].y,k);return e}};
-THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var k,h,m;h=0;for(m=b.length;h<m;h++){k=b[h];if(k.x>c)c=k.x;else if(k.x<f)f=k.x;if(k.y>e)e=k.y;else if(k.y<e)g=k.y}return{minX:f,minY:g,maxX:c,maxY:e}};
-THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,g,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";f=this.getPoints();
-b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.triangulate=function(){var b=this.getPoints();THREE.FontUtils.Triangulate.area(b)>0&&(b=b.reverse());return THREE.FontUtils.Triangulate(b,!0)};
-THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
-THREE.CubeGeometry=function(b,c,e,f,g,k,h,m,n){function p(b,c,e,h,m,n,p,t){var u,v,x=f||1,B=g||1,M=m/2,X=n/2,T=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",B=k||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",x=k||1;var R=x+1,j=B+1;m/=x;var fa=n/B;for(v=0;v<j;v++)for(n=0;n<R;n++){var P=new THREE.Vector3;P[b]=(n*m-M)*e;P[c]=(v*fa-X)*h;P[u]=p;o.vertices.push(new THREE.Vertex(P))}for(v=0;v<B;v++)for(n=0;n<x;n++)o.faces.push(new THREE.Face4(n+R*
-v+T,n+R*(v+1)+T,n+1+R*(v+1)+T,n+1+R*v+T,null,null,t)),o.faceVertexUvs[0].push([new THREE.UV(n/x,v/B),new THREE.UV(n/x,(v+1)/B),new THREE.UV((n+1)/x,(v+1)/B),new THREE.UV((n+1)/x,v/B)])}THREE.Geometry.call(this);var o=this,t=b/2,u=c/2,v=e/2,m=m?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var B in n)this.sides[B]!=void 0&&(this.sides[B]=
-n[B]);this.sides.px&&p("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,u,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-u,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-v,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=o.vertices.length;e<f;e++){for(var g=o.vertices[e],h=!1,k=0,m=b.length;k<m;k++){var n=b[k];if(g.position.x==n.position.x&&
-g.position.y==n.position.y&&g.position.z==n.position.z){c[e]=k;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=o.faces.length;e<f;e++)g=o.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(b,c,e,f,g,k){function h(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,n,p=Math.PI*2,o=f/2;for(n=0;n<b;n++)h(Math.sin(p*n/b)*c,Math.cos(p*n/b)*c,-o);for(n=0;n<b;n++)h(Math.sin(p*n/b)*e,Math.cos(p*n/b)*e,o);for(n=0;n<b;n++)m.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(e>0){h(0,0,-o-(k||0));for(n=b;n<b+b/2;n++)m.faces.push(new THREE.Face4(2*b,(2*n-2*b)%b,(2*n-2*b+1)%b,(2*n-2*b+2)%b))}if(c>0){h(0,0,o+
-(g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],k=this.vertices[e.b],o=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(k.position.x,k.position.y)/p,0.5+k.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
-f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/p,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
-THREE.ExtrudeGeometry=function(b,c){function e(b,c,e){v.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function f(b,c,e){B?v.faces.push(new THREE.Face3(e,c,b)):v.faces.push(new THREE.Face3(b,c,e))}function g(b,c,e,f){B?v.faces.push(new THREE.Face4(f,e,c,b)):v.faces.push(new THREE.Face4(b,c,e,f))}var k=c.amount!==void 0?c.amount:100,h=c.bezelThickness!==void 0?c.bezelThickness:10,m=c.bezelEnabled!==void 0?c.bezelEnabled:!1,n=c.steps!==void 0?c.steps:1,p=c.path!==void 0?c.path:null,o,t=!1;
-if(p)o=p.getPoints(),n=o.length,t=!0;THREE.Geometry.call(this);var p=b.getPoints(),u=b.triangulate(),v=this,x=[],B=THREE.FontUtils.Triangulate.area(p)>0,A,y,F=p.length,w,H=u.length,E=x.length;for(A=0;A<F;A++)y=p[A],e(y.x,y.y,0);for(w=1;w<=n;w++)for(A=0;A<F;A++)y=p[A],t?e(y.x,y.y+o[w-1].y,o[w-1].x):e(y.x,y.y,k/n*w);if(m){for(A=0;A<E;A++)w=x[A],e(w.x,w.y,h);for(A=0;A<E;A++)w=x[A],e(w.x,w.y,k-h)}for(A=0;A<H;A++)w=u[A],f(w[2],w[1],w[0]);for(A=0;A<H;A++)w=u[A],f(w[0]+F*n,w[1]+F*n,w[2]+F*n);for(A=p.length;--A>=
-0;){k=A;h=A-1;h<0&&(h=p.length-1);for(w=0;w<n;w++)u=F*w,H=F*(w+1),g(k+u,h+u,h+H,k+H)}this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,k=new THREE.Geometry,h;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
--b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(b=0;b<this.subdivisions;b++){h=new THREE.Geometry;for(var m in k.faces){var n=f(k.faces[m].a,k.faces[m].b),p=f(k.faces[m].b,k.faces[m].c),o=f(k.faces[m].c,k.faces[m].a);e(k.faces[m].a,n,o,h);e(k.faces[m].b,p,n,h);
-e(k.faces[m].c,o,p,h);e(n,p,o,h)}k.faces=h.faces}g.faces=k.faces;delete k;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],k=[],h=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<e.length;m++)n<this.angle?(e[m]=h.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=k;n==0&&(k=f);
+THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(b){return this.getPoint(this.getUtoTmapping(b))};THREE.Curve.prototype.getPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPoint(c/b));return e};
+THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPointAt(c/b));return e};THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheLengths&&this.cacheLengths.length==b)return this.cacheLengths;var c=[],e,f=this.getPoint(0),g,h=0;for(g=1;g<=b;g++)e=this.getPoint(g/b),h+=e.distanceTo(f),c.push(h),f=e;return this.cacheLengths=c};
+THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,g=e.length,h;for(h=c?c:b*e[g-1];f<g;){if(e[f]>h)break;f++}return f/g};THREE.LineCurve=function(b,c,e,f){this.x1=b;this.y1=c;this.x2=e;this.y2=f};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){return new THREE.Vector2(this.x1+(this.x2-this.x1)*b,this.y1+(this.y2-this.y1)*b)};
+THREE.QuadraticBezierCurve=function(b,c,e,f,g,h){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=h};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.FontUtils.b2(b,this.x0,this.x1,this.x2);b=THREE.FontUtils.b2(b,this.y0,this.y1,this.y2);return new THREE.Vector2(c,b)};
+THREE.QuadraticBezierCurve.prototype.getNormalVector=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.x0,this.x1,this.x2);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.y0,this.y1,this.y2);return(new THREE.Vector2(-b,c)).unit()};THREE.CubicBezierCurve=function(b,c,e,f,g,h,j,m){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=h;this.x3=j;this.y3=m};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
+THREE.CubicBezierCurve.prototype.getPoint=function(b){var c;c=THREE.FontUtils.b3(b,this.x0,this.x1,this.x2,this.x3);b=THREE.FontUtils.b3(b,this.y0,this.y1,this.y2,this.y3);return new THREE.Vector2(c,b)};THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
+THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,g;g=(f.length-1)*b;b=Math.floor(g);g-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,g);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,g);return c};THREE.ArcCurve=function(b,c,e,f,g,h){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=g;this.aClockwise=h};
+THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(b){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(b=1-b);b=this.aStartAngle+b*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(b),this.aY+this.aRadius*Math.sin(b))};
+THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentSpline:function(){},interpolate:function(b,c,e,f,g){var b=(e-b)*0.5,f=(f-c)*0.5,h=g*g;return(2*c-2*e+b+f)*g*h+(-3*c+3*e-2*b-f)*h+b*g+c}};THREE.Path=function(b){this.actions=[];this.curves=[];b&&this.fromPoints(b)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};
+THREE.Path.prototype.fromPoints=function(b){this.moveTo(b[0].x,b[0].y);var c,e=b.length;for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};
+THREE.Path.prototype.lineTo=function(b,c){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.LineCurve(f[f.length-2],f[f.length-1],b,c);this.curves.push(f);this.actions.push({action:THREE.PathActions.LINE_TO,args:e,curve:f})};
+THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args,h=new THREE.QuadraticBezierCurve(h[h.length-2],h[h.length-1],b,c,e,f);this.curves.push(h);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g,curve:h})};
+THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,g,h){var j=Array.prototype.slice.call(arguments),m=this.actions[this.actions.length-1].args,m=new THREE.CubicBezierCurve(m[m.length-2],m[m.length-1],b,c,e,f,g,h);this.curves.push(m);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:j,curve:m})};
+THREE.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,e=[new THREE.Vector2(e[e.length-2],e[e.length-1])],e=e.concat(b),e=new THREE.SplineCurve(e);this.curves.push(e);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c,curve:e})};
+THREE.Path.prototype.arc=function(b,c,e,f,g,h){var j=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,g,h));this.actions.push({action:THREE.PathActions.ARC,args:j})};THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var c=[],e=0;e<b;e++)c.push(this.getPoint(e/b));return c};
+THREE.Path.prototype.getPoints=function(b){var b=b||12,c=[],e,f,g,h,j,m,n,p,o,u,v,w,x;e=0;for(f=this.actions.length;e<f;e++)switch(g=this.actions[e],h=g.action,g=g.args,h){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:j=g[2];m=g[3];o=g[0];u=g[1];c.length>0?(h=c[c.length-1],v=h.x,w=h.y):(h=this.actions[e-1].args,v=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)x=h/b,g=THREE.FontUtils.b2(x,v,o,j),x=THREE.FontUtils.b2(x,w,u,m),c.push(new THREE.Vector2(g,
+x));break;case THREE.PathActions.BEZIER_CURVE_TO:j=g[4];m=g[5];o=g[0];u=g[1];n=g[2];p=g[3];c.length>0?(h=c[c.length-1],v=h.x,w=h.y):(h=this.actions[e-1].args,v=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)x=h/b,g=THREE.FontUtils.b3(x,v,o,n,j),x=THREE.FontUtils.b3(x,w,u,p,m),c.push(new THREE.Vector2(g,x));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];x=b*g[0].length;h=h.concat(g[0]);g=new THREE.SplineCurve(h);for(h=1;h<=x;h++)c.push(g.getPointAt(h/
+x));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;j=g[0];m=g[1];n=g[2];o=g[3];x=g[4];u=!!g[5];p=h[h.length-2];v=h[h.length-1];h.length==0&&(p=v=0);w=x-o;var y=b*2;for(h=1;h<=y;h++)x=h/y,u||(x=1-x),x=o+x*w,g=p+j+n*Math.cos(x),x=v+m+n*Math.sin(x),c.push(new THREE.Vector2(g,x))}return c};
+THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var h,j,m;j=0;for(m=b.length;j<m;j++){h=b[j];if(h.x>c)c=h.x;else if(h.x<f)f=h.x;if(h.y>e)e=h.y;else if(h.y<e)g=h.y}return{minX:f,minY:g,maxX:c,maxY:e}};THREE.Path.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.sums,b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};
+THREE.Path.prototype.getLength=function(){var b=[],c=0,e,f=this.curves.length;for(e=0;e<f;e++)c+=this.curves[e].getLength(),b.push(c);this.sums=b;return c};
+THREE.Path.prototype.createPathGeometry=function(b,c){var e=this.getPoints(b),f,g=new THREE.Object3D;c||(c=new THREE.LineBasicMaterial({color:0,opacity:0.7}));for(var h=1;h<e.length;h++)f=new THREE.Geometry,f.vertices.push(new THREE.Vertex(new THREE.Vector3(e[h-1].x,e[h-1].y,0))),f.vertices.push(new THREE.Vertex(new THREE.Vector3(e[h].x,e[h].y,0))),f=new THREE.Line(f,c),g.addChild(f);return g};
+THREE.Path.prototype.transform=function(b){b=new THREE.Path;b.moveTo(0,0);b.quadraticCurveTo(100,20,140,80);console.log(b.cacheArcLengths());var c=this.getMinAndMax(),e=this.getPoints(),f,g,h,j,m,n;f=0;for(g=e.length;f<g;f++)h=e[f],j=h.x,m=h.y,n=j/c.maxX,j=b.getPoint(n),m=b.getNormalVector(n).multiplyScalar(m),h.x=j.x+m.x,h.y=j.y+m.y;return e};
+THREE.Path.prototype.nltransform=function(b,c,e,f,g,h){var j=this.getPoints(),m,n,p,o,u;m=0;for(n=j.length;m<n;m++)p=j[m],o=p.x,u=p.y,p.x=b*o+c*u+e,p.y=f*u+g*o+h;return j};
+THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,g,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";f=this.transform(0.866,
+-0.866,0,0.5,0.5,-50);b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
+THREE.Shape.prototype.getHoles=function(b){var b=b?"getSpacedPoints":"getPoints",c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c][b]();return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this[b?"getSpacedPoints":"getPoints"](),holes:this.getHoles(b)}};
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),g,h,j,m,n,p,o,u,v,w,x=[];for(n=0;n<c.length;n++){p=c[n];f=f.concat(p);h=Number.POSITIVE_INFINITY;for(g=0;g<p.length;g++){v=p[g];w=[];for(u=0;u<e.length;u++)o=e[u],o=v.distanceTo(o),w.push(o),o<h&&(h=o,j=g,m=u)}g=m-1>=0?m-1:e.length-1;h=j-1>=0?j-1:p.length-1;var y=[p[j],e[m],e[g]];u=THREE.FontUtils.Triangulate.area(y);var D=[p[j],p[h],e[m]];v=THREE.FontUtils.Triangulate.area(D);w=m;o=j;m+=1;j+=-1;m<0&&(m+=e.length);m%=e.length;
+j<0&&(j+=p.length);j%=p.length;g=m-1>=0?m-1:e.length-1;h=j-1>=0?j-1:p.length-1;y=[p[j],e[m],e[g]];y=THREE.FontUtils.Triangulate.area(y);D=[p[j],p[h],e[m]];D=THREE.FontUtils.Triangulate.area(D);u+v>y+D&&(m=w,j=o,m<0&&(m+=e.length),m%=e.length,j<0&&(j+=p.length),j%=p.length,g=m-1>=0?m-1:e.length-1,h=j-1>=0?j-1:p.length-1);u=e.slice(0,m);v=e.slice(m);w=p.slice(j);o=p.slice(0,j);h=[p[j],p[h],e[m]];x.push([p[j],e[m],e[g]]);x.push(h);e=u.concat(w).concat(o).concat(v)}return{shape:e,isolatedPts:x,allpoints:f}},
+triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),h,j,m,n;for(h=0;h<e.length;h++){n=e[h];for(j=0;j<3;j++)for(m=0;m<f.length;m++)f[m].equals(n[j])&&(n[j]=m)}for(h=0;h<g.length;h++){n=g[h];for(j=0;j<3;j++)for(m=0;m<f.length;m++)f[m].equals(n[j])&&(n[j]=m)}return e.concat(g)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0}};
+THREE.CubeGeometry=function(b,c,e,f,g,h,j,m,n){function p(b,e,c,j,m,n,p,u){var v,w,x=f||1,y=g||1,K=m/2,X=n/2,Q=o.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",y=h||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",x=h||1;var U=x+1,k=y+1;m/=x;var ia=n/y;for(w=0;w<k;w++)for(n=0;n<U;n++){var L=new THREE.Vector3;L[b]=(n*m-K)*c;L[e]=(w*ia-X)*j;L[v]=p;o.vertices.push(new THREE.Vertex(L))}for(w=0;w<y;w++)for(n=0;n<x;n++)o.faces.push(new THREE.Face4(n+U*
+w+Q,n+U*(w+1)+Q,n+1+U*(w+1)+Q,n+1+U*w+Q,null,null,u)),o.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var o=this,u=b/2,v=c/2,w=e/2,m=m?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var y in n)this.sides[y]!=void 0&&(this.sides[y]=
+n[y]);this.sides.px&&p("z","y",1*m,-1,e,c,-u,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,u,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,w,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-w,this.materials[5]);(function(){for(var b=[],e=[],c=0,f=o.vertices.length;c<f;c++){for(var h=o.vertices[c],g=!1,j=0,m=b.length;j<m;j++){var n=b[j];if(h.position.x==n.position.x&&
+h.position.y==n.position.y&&h.position.z==n.position.z){e[c]=j;g=!0;break}}if(!g)e[c]=b.length,b.push(new THREE.Vertex(h.position.clone()))}c=0;for(f=o.faces.length;c<f;c++)h=o.faces[c],h.a=e[h.a],h.b=e[h.b],h.c=e[h.c],h.d=e[h.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(b,c,e,f,g,h){function j(b,e,c){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}THREE.Geometry.call(this);var m=this,n,p=Math.PI*2,o=f/2;for(n=0;n<b;n++)j(Math.sin(p*n/b)*c,Math.cos(p*n/b)*c,-o);for(n=0;n<b;n++)j(Math.sin(p*n/b)*e,Math.cos(p*n/b)*e,o);for(n=0;n<b;n++)m.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(e>0){j(0,0,-o-(h||0));for(n=b;n<b+b/2;n++)m.faces.push(new THREE.Face4(2*b,(2*n-2*b)%b,(2*n-2*b+1)%b,(2*n-2*b+2)%b))}if(c>0){j(0,0,o+
+(g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],h=this.vertices[e.b],o=this.vertices[e.c],u=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
+f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/p,0.5+u.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.ExtrudeGeometry=function(b,c){function e(b,e,c,f){vectorFromCentroid=b.clone().subSelf(e);adj=c/vectorFromCentroid.length();f?adj+=1:adj=1-adj;return vectorFromCentroid.multiplyScalar(adj).addSelf(e)}function f(b){for(F=b.length;--F>=0;){Q=F;U=F-1;U<0&&(U=b.length-1);for(var e=0;e<u+o*2;e++){var c=K*e,f=K*(e+1);H.faces.push(new THREE.Face4(k+Q+c,k+U+c,k+U+f,k+Q+f))}}}function g(b,e,c){H.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function h(b,e,c){H.faces.push(new THREE.Face3(b,
+e,c))}var j=c.amount!==void 0?c.amount:100,m=c.bevelThickness!==void 0?c.bevelThickness:8,n=c.bevelSize!==void 0?c.bevelSize:m,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.bevelSegments!==void 0?c.bevelSegments:3;p||(o=0);var u=c.steps!==void 0?c.steps:1,v=c.path!==void 0?c.path:null,w,x=!1;if(v)w=v.getPoints(),u=w.length,x=!0;THREE.Geometry.call(this);var y,D,A,H=this,v=b.extractAllPoints(!1),C=v.shape,v=v.holes,E=!THREE.Shape.Utils.isClockWise(C);if(E){C=C.reverse();D=0;for(A=v.length;D<A;D++)y=
+v[D],THREE.Shape.Utils.isClockWise(y)&&(v[D]=y.reverse());E=!1}var E=THREE.Shape.Utils.triangulateShape(C,v),I=C;D=0;for(A=v.length;D<A;D++)y=v[D],C=C.concat(y);var J,S=new THREE.Vector2,R,N,F=0;for(il=I.length;F<il;F++)S.addSelf(I[F]);R=S.divideScalar(I.length);N=[];D=0;for(A=v.length;D<A;D++){S=new THREE.Vector2;y=v[D];F=0;for(il=y.length;F<il;F++)S.addSelf(y[F]);N[D]=S.divideScalar(y.length)}var F,W,K=C.length,S=E.length,X;for(J=o;J>0;J--){t=J/o;z=m*t;X=n*(1-Math.sin((1-t)*Math.PI/2));F=0;for(il=
+I.length;F<il;F++)W=e(I[F],R,X,!1),g(W.x,W.y,-z);D=0;for(A=v.length;D<A;D++){y=v[D];F=0;for(il=y.length;F<il;F++)W=e(y[F],N[D],X,!0),g(W.x,W.y,-z)}}for(F=0;F<K;F++)W=C[F],x?g(W.x,W.y+w[0].y,w[0].x):g(W.x,W.y,0);for(y=1;y<=u;y++)for(F=0;F<K;F++)W=C[F],x?g(W.x,W.y+w[y-1].y,w[y-1].x):g(W.x,W.y,j/u*y);for(J=1;J<=o;J++){t=J/o;z=m*t;X=n*(1-Math.sin((1-t)*Math.PI/2));F=0;for(il=I.length;F<il;F++)W=e(I[F],R,X,!1),g(W.x,W.y,j+z);D=0;for(A=v.length;D<A;D++){y=v[D];F=0;for(il=y.length;F<il;F++)W=e(y[F],N[D],
+X,!0),x?g(W.x,W.y+w[u-1].y,w[u-1].x+z):g(W.x,W.y,j+z)}}if(p){m=K*0;for(F=0;F<S;F++)j=E[F],h(j[2]+m,j[1]+m,j[0]+m);m=K*(u+o*2);for(F=0;F<S;F++)j=E[F],h(j[0]+m,j[1]+m,j[2]+m)}else{for(F=0;F<S;F++)j=E[F],h(j[2],j[1],j[0]);for(F=0;F<S;F++)j=E[F],h(j[0]+K*u,j[1]+K*u,j[2]+K*u)}var Q,U,k=0;f(I);k+=I.length;D=0;for(A=v.length;D<A;D++)y=v[D],f(y),k+=y.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+THREE.IcosahedronGeometry=function(b){function c(b,e,c){var f=Math.sqrt(b*b+e*e+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
+-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,h);e(0,5,1,h);e(0,1,7,h);e(0,7,10,h);e(0,10,11,h);e(1,5,9,h);e(5,11,4,h);e(11,10,2,h);e(10,7,6,h);e(7,1,8,h);e(3,9,4,h);e(3,4,2,h);e(3,2,6,h);e(3,6,8,h);e(3,8,9,h);e(4,9,5,h);e(2,4,11,h);e(6,2,10,h);e(8,6,7,h);e(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var m in h.faces){var n=f(h.faces[m].a,h.faces[m].b),p=f(h.faces[m].b,h.faces[m].c),o=f(h.faces[m].c,h.faces[m].a);e(h.faces[m].a,n,o,j);e(h.faces[m].b,p,n,j);
+e(h.faces[m].c,o,p,j);e(n,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<e.length;m++)n<this.angle?(e[m]=j.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=h;n==0&&(h=f);
 for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,m/b.length),new THREE.UV(1-n/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,m/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,m/b.length),new THREE.UV(1-n/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,m/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,k=b/2,h=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var p=c/f;for(g=0;g<n;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-k,-(g*p-h),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,h=b/2,j=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var p=c/f;for(g=0;g<n;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,k=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e<h+1;e++){f=e/h;var m=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<k;f++){var t=2*f/k,u=n*Math.sin(t*g),t=n*Math.cos(t*g);(e==0||e==h)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,u)))-1);p.push(o)}c.push(p)}for(var v,x,B,g=c.length,e=0;e<g;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){p=f==k-1;h=c[e][p?0:f+1];m=c[e][p?k-1:f];n=c[e-1][p?
-k-1:f];p=c[e-1][p?0:f+1];u=e/(g-1);v=(e-1)/(g-1);x=(f+1)/k;var t=f/k,o=new THREE.UV(1-x,u),u=new THREE.UV(1-t,u),t=new THREE.UV(1-t,v),A=new THREE.UV(1-x,v);e<c.length-1&&(v=this.vertices[h].position.clone(),x=this.vertices[m].position.clone(),B=this.vertices[n].position.clone(),v.normalize(),x.normalize(),B.normalize(),this.faces.push(new THREE.Face3(h,m,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)])),this.faceVertexUvs[0].push([o,u,t]));e>1&&(v=
-this.vertices[h].position.clone(),x=this.vertices[n].position.clone(),B=this.vertices[p].position.clone(),v.normalize(),x.normalize(),B.normalize(),this.faces.push(new THREE.Face3(h,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)])),this.faceVertexUvs[0].push([o,t,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,h=Math.max(3,c||8),j=Math.max(2,e||6),c=[],e=0;e<j+1;e++){f=e/j;var m=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var u=2*f/h,v=n*Math.sin(u*g),u=n*Math.cos(u*g);(e==0||e==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,m,v)))-1);p.push(o)}c.push(p)}for(var w,x,y,g=c.length,e=0;e<g;e++)if(h=c[e].length,e>0)for(f=0;f<h;f++){p=f==h-1;j=c[e][p?0:f+1];m=c[e][p?h-1:f];n=c[e-1][p?
+h-1:f];p=c[e-1][p?0:f+1];v=e/(g-1);w=(e-1)/(g-1);x=(f+1)/h;var u=f/h,o=new THREE.UV(1-x,v),v=new THREE.UV(1-u,v),u=new THREE.UV(1-u,w),D=new THREE.UV(1-x,w);e<c.length-1&&(w=this.vertices[j].position.clone(),x=this.vertices[m].position.clone(),y=this.vertices[n].position.clone(),w.normalize(),x.normalize(),y.normalize(),this.faces.push(new THREE.Face3(j,m,n,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([o,v,u]));e>1&&(w=
+this.vertices[j].position.clone(),x=this.vertices[n].position.clone(),y=this.vertices[p].position.clone(),w.normalize(),x.normalize(),y.normalize(),this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([o,u,D]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
-THREE.TextGeometry.prototype.set=function(b,c){function e(b,c,e){x.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function f(b,c,e,f){x.faces.push(new THREE.Face4(b,c,e,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,k=c.curveSegments!==void 0?c.curveSegments:4,h=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",n=c.style!==void 0?c.style:"normal",p=c.bezelThickness!==void 0?c.bezelThickness:10,o=c.bezelSize!==void 0?c.bezelSize:8,t=c.bezelEnabled!==
-void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=k;THREE.FontUtils.face=h;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bezelSize=o;var m=THREE.FontUtils.drawText(b),k=m.points,u=m.faces,h=m.contour,v=m.bezel,x=this;x.vertices=[];x.faces=[];for(var B,n=k.length,A=u.length,o=v.length,m=0;m<n;m++)B=k[m],e(B.x,B.y,0);for(m=0;m<n;m++)B=k[m],e(B.x,B.y,g);if(t){for(m=0;m<o;m++)B=v[m],e(B.x,B.y,p);for(m=0;m<o;m++)B=v[m],e(B.x,B.y,g-p)}for(m=
-0;m<A;m++)g=u[m],x.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<A;m++)g=u[m],x.faces.push(new THREE.Face3(g[0]+n,g[1]+n,g[2]+n));var y;if(t)for(m=v.length;--m>0;){if(y){if(y.equals(h[m])){y=null;continue}}else y=h[m];p=n*2+m;u=p-1;f(p,u,u+o,p+o);for(t=0;t<n;t++)if(k[t].equals(h[m]))break;for(g=0;g<n;g++)if(k[g].equals(h[m-1]))break;f(t,g,u,p);f(p+o,u+o,g+n,t+n)}else for(m=h.length;--m>0;){if(y){if(y.equals(h[m])){y=null;continue}}else y=h[m];for(t=0;t<n;t++)if(k[t].equals(h[m]))break;for(g=
-0;g<n;g++)if(k[g].equals(h[m-1]))break;f(t,g,g+n,t+n)}this.computeCentroids();this.computeFaceNormals()};
+THREE.TextGeometry.prototype.set=function(b,c){function e(b,e,c){x.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function f(b,e,c,f){x.faces.push(new THREE.Face4(b,e,c,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,h=c.curveSegments!==void 0?c.curveSegments:4,j=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",n=c.style!==void 0?c.style:"normal",p=c.bezelThickness!==void 0?c.bezelThickness:10,o=c.bezelSize!==void 0?c.bezelSize:8,u=c.bezelEnabled!==
+void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=j;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bezelSize=o;var m=THREE.FontUtils.drawText(b),h=m.points,v=m.faces,j=m.contour,w=m.bezel,x=this;x.vertices=[];x.faces=[];for(var y,n=h.length,D=v.length,o=w.length,m=0;m<n;m++)y=h[m],e(y.x,y.y,0);for(m=0;m<n;m++)y=h[m],e(y.x,y.y,g);if(u){for(m=0;m<o;m++)y=w[m],e(y.x,y.y,p);for(m=0;m<o;m++)y=w[m],e(y.x,y.y,g-p)}for(m=
+0;m<D;m++)g=v[m],x.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<D;m++)g=v[m],x.faces.push(new THREE.Face3(g[0]+n,g[1]+n,g[2]+n));var A;if(u)for(m=w.length;--m>0;){if(A){if(A.equals(j[m])){A=null;continue}}else A=j[m];p=n*2+m;v=p-1;f(p,v,v+o,p+o);for(u=0;u<n;u++)if(h[u].equals(j[m]))break;for(g=0;g<n;g++)if(h[g].equals(j[m-1]))break;f(u,g,v,p);f(p+o,v+o,g+n,u+n)}else for(m=j.length;--m>0;){if(A){if(A.equals(j[m])){A=null;continue}}else A=j[m];for(u=0;u<n;u++)if(h[u].equals(j[m]))break;for(g=
+0;g<n;g++)if(h[g].equals(j[m-1]))break;f(u,g,g+n,u+n)}this.computeCentroids();this.computeFaceNormals()};
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b,c){if(b.length<3)return console.log("not valid polygon"),
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b,c){if(b.length<3)return console.log("not valid polygon"),
-{points:b,faces:[]};for(var e,f,g,k,h,m=[],n=0;n<c.length;n++){h=c[n];k=[];for(e=0;e<h.length;e++)f=h[e],k.push(f.x+","+f.y);var p;e=k.slice(1).indexOf(k[0]);var o=this.Triangulate.area(h.slice(0,e+1))<0;f=[];for(e=-1;e<k.length;){p=e+1;e=k[p];e=k.slice(p+1).indexOf(e)+p;if(e<=p)break;var t=h.slice(p,e+1);o?this.Triangulate.area(t)<0?(p>0&&m.push({shape:g,holes:f}),g=t,f=[]):f.push(t):this.Triangulate.area(t)<0?(m.push({shape:t,holes:f}),f=[]):f.push(t);e++}o&&m.push({shape:g,holes:f})}var u,v,x,
-B,A,y;k=[];for(h=0;h<m.length;h++){n=m[h];g=n.shape;f=n.holes;for(p=0;p<f.length;p++){o=f[p];x=Number.POSITIVE_INFINITY;for(t=0;t<o.length;t++){A=o[t];for(e=0;e<g.length;e++)B=g[e],B=A.distanceTo(B),B<x&&(x=B,u=t,v=e)}e=v-1>=0?v-1:g.length-1;var t=u-1>=0?u-1:o.length-1,F=[];F.push(o[u]);F.push(g[v]);F.push(g[e]);x=this.Triangulate.area(F);var w=[];w.push(o[u]);w.push(o[t]);w.push(g[v]);A=this.Triangulate.area(w);B=v;y=u;v+=1;u+=-1;v<0&&(v+=g.length);v%=g.length;u<0&&(u+=o.length);u%=g.length;e=v-
-1>=0?v-1:g.length-1;t=u-1>=0?u-1:o.length-1;F=[];F.push(o[u]);F.push(g[v]);F.push(g[e]);F=this.Triangulate.area(F);w=[];w.push(o[u]);w.push(o[t]);w.push(g[v]);w=this.Triangulate.area(w);x+A>F+w&&(v=B,u=y,v<0&&(v+=g.length),v%=g.length,u<0&&(u+=o.length),u%=g.length,e=v-1>=0?v-1:g.length-1,t=u-1>=0?u-1:o.length-1);x=g.slice(0,v);A=g.slice(v);B=o.slice(u);y=o.slice(0,u);k.push(o[u]);k.push(g[v]);k.push(g[e]);k.push(o[u]);k.push(o[t]);k.push(g[v]);g=x.concat(B).concat(y).concat(A)}n.shape=g}u=[];v=[];
-for(h=p=0;h<m.length;h++){n=m[h];g=n.shape;u=u.concat(g);o=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<o.length;f++)n=o[f],n[0]+=p,n[1]+=p,n[2]+=p;v=v.concat(o);p+=g.length}var H;for(f=0;f<k.length/3;f++){n=[];for(m=0;m<3;m++){h=!1;for(g=0;g<u.length&&!h;g++)H=f*3+m,u[g].equals(k[H])&&(n.push(g),h=!0);h||(u.push(k[H]),n.push(u.length-1),console.log("not found"))}v.push(n)}return{points:u,faces:v}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),k=this.size/g.resolution,h=0;f=String(b).split("");
-for(var m=f.length,n=[],b=0;b<m;b++){var p=this.extractGlyphPoints(f[b],g,k,h);h+=p.offset;c.push(p.points);e=e.concat(p.points);n.push(p.path)}b=h/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];k=[];f=[];for(var h=[],m=new THREE.Vector2,o,b=e.length;--b>=0;){if(o){if(o.equals(e[b])){o=null;n=this.Triangulate.area(f)>0;h.push(n);k.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else o=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=0;--b>=0;)n=e[b],
-m=k[f],n=n.clone().subSelf(m),p=this.bezelSize/n.length(),h[f]?p+=1:p=1-p,p=n.multiplyScalar(p).addSelf(m),g.unshift(p),o?o.equals(e[b])&&(o=null,f++):o=e[b];c.bezel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,
-c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f){var g=[],k=new THREE.Path,h,m,n,p,o,t,u,v,x,B,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));n=c.length;for(b=0;b<n;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;g.push(new THREE.Vector2(m,p));k.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;g.push(new THREE.Vector2(m,
-p));k.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;u=c[b++]*e+f;v=c[b++]*e;k.quadraticCurveTo(u,v,m,p);if(h=g[g.length-1]){o=h.x;t=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var y=h/divisions,F=THREE.FontUtils.b2(y,o,u,m),y=THREE.FontUtils.b2(y,t,v,p);g.push(new THREE.Vector2(F,y))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,u=c[b++]*e+f,v=c[b++]*-e,x=c[b++]*e+f,B=c[b++]*-e,k.quadraticCurveTo(m,p,u,v,x,B),h=g[g.length-1]){o=h.x;t=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)y=
-h/divisions,F=THREE.FontUtils.b3(y,o,u,x,m),y=THREE.FontUtils.b3(y,t,v,B,p),g.push(new THREE.Vector2(F,y))}}}k.debug(document.getElementById("boo"));console.log(k);return{offset:A.ha*e,points:g,path:k}}}};
-(function(b){var c=function(b){for(var c=b.length,g=0,k=c-1,h=0;h<c;k=h++)g+=b[k].x*b[h].y-b[h].x*b[k].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var k=[],h=[],m=[],n,p,o;if(c(b)>0)for(p=0;p<g;p++)h[p]=p;else for(p=0;p<g;p++)h[p]=g-1-p;var t=2*g;for(p=g-1;g>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return k}n=p;g<=n&&(n=0);p=n+1;g<=p&&(p=0);o=p+1;g<=o&&(o=0);var u;a:{u=b;var v=n,x=p,B=o,A=g,y=h,F=void 0,w=void 0,H=void 0,
-E=void 0,D=void 0,S=void 0,J=void 0,G=void 0,U=void 0,w=u[y[v]].x,H=u[y[v]].y,E=u[y[x]].x,D=u[y[x]].y,S=u[y[B]].x,J=u[y[B]].y;if(1.0E-10>(E-w)*(J-H)-(D-H)*(S-w))u=!1;else{for(F=0;F<A;F++)if(!(F==v||F==x||F==B)){var G=u[y[F]].x,U=u[y[F]].y,W=void 0,M=void 0,X=void 0,T=void 0,R=void 0,j=void 0,fa=void 0,P=void 0,da=void 0,ca=void 0,Y=void 0,ea=void 0,W=X=R=void 0,W=S-E,M=J-D,X=w-S,T=H-J,R=E-w,j=D-H,fa=G-w,P=U-H,da=G-E,ca=U-D,Y=G-S,ea=U-J,W=W*ca-M*da,R=R*P-j*fa,X=X*ea-T*Y;if(W>=0&&X>=0&&R>=0){u=!1;break a}}u=
-!0}}if(u){t=h[n];u=h[p];v=h[o];k.push(b[t]);k.push(b[u]);k.push(b[v]);m.push([h[n],h[p],h[o]]);n=p;for(o=p+1;o<g;n++,o++)h[n]=h[o];g--;t=2*g}}if(f)return m;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+{points:b,faces:[]};for(var e,f,g,h,j,m=[],n=0;n<c.length;n++){j=c[n];h=[];for(e=0;e<j.length;e++)f=j[e],h.push(f.x+","+f.y);var p;e=h.slice(1).indexOf(h[0]);var o=this.Triangulate.area(j.slice(0,e+1))<0;f=[];for(e=-1;e<h.length;){p=e+1;e=h[p];e=h.slice(p+1).indexOf(e)+p;if(e<=p)break;var u=j.slice(p,e+1);o?this.Triangulate.area(u)<0?(p>0&&m.push({shape:g,holes:f}),g=u,f=[]):f.push(u):this.Triangulate.area(u)<0?(m.push({shape:u,holes:f}),f=[]):f.push(u);e++}o&&m.push({shape:g,holes:f})}var v,w,x,
+y,D,A;h=[];for(j=0;j<m.length;j++){n=m[j];g=n.shape;f=n.holes;for(p=0;p<f.length;p++){o=f[p];x=Number.POSITIVE_INFINITY;for(u=0;u<o.length;u++){D=o[u];for(e=0;e<g.length;e++)y=g[e],y=D.distanceTo(y),y<x&&(x=y,v=u,w=e)}e=w-1>=0?w-1:g.length-1;var u=v-1>=0?v-1:o.length-1,H=[];H.push(o[v]);H.push(g[w]);H.push(g[e]);x=this.Triangulate.area(H);var C=[];C.push(o[v]);C.push(o[u]);C.push(g[w]);D=this.Triangulate.area(C);y=w;A=v;w+=1;v+=-1;w<0&&(w+=g.length);w%=g.length;v<0&&(v+=o.length);v%=g.length;e=w-
+1>=0?w-1:g.length-1;u=v-1>=0?v-1:o.length-1;H=[];H.push(o[v]);H.push(g[w]);H.push(g[e]);H=this.Triangulate.area(H);C=[];C.push(o[v]);C.push(o[u]);C.push(g[w]);C=this.Triangulate.area(C);x+D>H+C&&(w=y,v=A,w<0&&(w+=g.length),w%=g.length,v<0&&(v+=o.length),v%=g.length,e=w-1>=0?w-1:g.length-1,u=v-1>=0?v-1:o.length-1);x=g.slice(0,w);D=g.slice(w);y=o.slice(v);A=o.slice(0,v);h.push(o[v]);h.push(g[w]);h.push(g[e]);h.push(o[v]);h.push(o[u]);h.push(g[w]);g=x.concat(y).concat(A).concat(D)}n.shape=g}v=[];w=[];
+for(j=p=0;j<m.length;j++){n=m[j];g=n.shape;v=v.concat(g);o=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<o.length;f++)n=o[f],n[0]+=p,n[1]+=p,n[2]+=p;w=w.concat(o);p+=g.length}var E;for(f=0;f<h.length/3;f++){n=[];for(m=0;m<3;m++){j=!1;for(g=0;g<v.length&&!j;g++)E=f*3+m,v[g].equals(h[E])&&(n.push(g),j=!0);j||(v.push(h[E]),n.push(v.length-1),console.log("not found"))}w.push(n)}return{points:v,faces:w}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),h=this.size/g.resolution,j=0;f=String(b).split("");
+for(var m=f.length,n=new THREE.Path,b=0;b<m;b++){var p=this.extractGlyphPoints(f[b],g,h,j,n);j+=p.offset;c.push(p.points);e=e.concat(p.points)}console.log(n);b=j/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];h=[];f=[];for(var j=[],m=new THREE.Vector2,o,b=e.length;--b>=0;){if(o){if(o.equals(e[b])){o=null;n=this.Triangulate.area(f)>0;j.push(n);h.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else o=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=
+0;--b>=0;)n=e[b],m=h[f],n=n.clone().subSelf(m),p=this.bezelSize/n.length(),j[f]?p+=1:p=1-p,p=n.multiplyScalar(p).addSelf(m),g.unshift(p),o?o.equals(e[b])&&(o=null,f++):o=e[b];c.bezel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*
+(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f,g){var h=[],j,m,n,p,o,u,v,w,x,y,D=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(D){if(D.o){c=D._cachedOutline||(D._cachedOutline=D.o.split(" "));n=c.length;for(b=0;b<n;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;h.push(new THREE.Vector2(m,p));g.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;h.push(new THREE.Vector2(m,
+p));g.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;v=c[b++]*e+f;w=c[b++]*e;g.quadraticCurveTo(v,w,m,p);if(j=h[h.length-1]){o=j.x;u=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++){var A=j/divisions,H=THREE.FontUtils.b2(A,o,v,m),A=THREE.FontUtils.b2(A,u,w,p);h.push(new THREE.Vector2(H,A))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,v=c[b++]*e+f,w=c[b++]*-e,x=c[b++]*e+f,y=c[b++]*-e,g.bezierCurveTo(m,p,v,w,x,y),j=h[h.length-1]){o=j.x;u=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++)A=
+j/divisions,H=THREE.FontUtils.b3(A,o,v,x,m),A=THREE.FontUtils.b3(A,u,w,y,p),h.push(new THREE.Vector2(H,A))}}}return{offset:D.ha*e,points:h,path:g}}}};
+(function(b){var c=function(b){for(var c=b.length,g=0,h=c-1,j=0;j<c;h=j++)g+=b[h].x*b[j].y-b[j].x*b[h].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var h=[],j=[],m=[],n,p,o;if(c(b)>0)for(p=0;p<g;p++)j[p]=p;else for(p=0;p<g;p++)j[p]=g-1-p;var u=2*g;for(p=g-1;g>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return h}n=p;g<=n&&(n=0);p=n+1;g<=p&&(p=0);o=p+1;g<=o&&(o=0);var v;a:{v=b;var w=n,x=p,y=o,D=g,A=j,H=void 0,C=void 0,E=void 0,
+I=void 0,J=void 0,S=void 0,R=void 0,N=void 0,F=void 0,C=v[A[w]].x,E=v[A[w]].y,I=v[A[x]].x,J=v[A[x]].y,S=v[A[y]].x,R=v[A[y]].y;if(1.0E-10>(I-C)*(R-E)-(J-E)*(S-C))v=!1;else{for(H=0;H<D;H++)if(!(H==w||H==x||H==y)){var N=v[A[H]].x,F=v[A[H]].y,W=void 0,K=void 0,X=void 0,Q=void 0,U=void 0,k=void 0,ia=void 0,L=void 0,ga=void 0,fa=void 0,$=void 0,ha=void 0,W=X=U=void 0,W=S-I,K=R-J,X=C-S,Q=E-R,U=I-C,k=J-E,ia=N-C,L=F-E,ga=N-I,fa=F-J,$=N-S,ha=F-R,W=W*fa-K*ga,U=U*L-k*ia,X=X*ha-Q*$;if(W>=0&&X>=0&&U>=0){v=!1;break a}}v=
+!0}}if(v){h.push([b[j[n]],b[j[p]],b[j[o]]]);m.push([j[n],j[p],j[o]]);n=p;for(o=p+1;o<g;n++,o++)j[n]=j[o];g--;u=2*g}}if(f)return m;return h};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
 THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
-1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,k=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,k,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[k][0],b[k][1]),new THREE.UV(b[h][0],b[h][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
+1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,j=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
 THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(b,c,e,f,g,k,h){function m(b,c,e,f,g,h){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(g*(2+e)*0.5*Math.cos(b),g*(2+e)*Math.sin(b)*0.5,h*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=k||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;k=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
-this.segmentsT;++c){var n=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=m(n,h,this.q,this.p,this.radius,this.heightScale),n=m(n+0.01,h,this.q,this.p,this.radius,this.heightScale);e.x=n.x-g.x;e.y=n.y-g.y;e.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();n=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=n*f.x+h*k.x;g.y+=n*f.y+h*k.y;g.z+=n*f.z+h*k.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
-g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,k=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],h=new THREE.UV(b/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,k));this.faceVertexUvs[0].push([h,n,p,o])}this.computeCentroids();
+THREE.TorusKnotGeometry=function(b,c,e,f,g,h,j){function m(b,e,c,f,h,g){e=c/f*b;c=Math.cos(e);return new THREE.Vector3(h*(2+c)*0.5*Math.cos(b),h*(2+c)*Math.sin(b)*0.5,g*h*Math.sin(e)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
+this.segmentsT;++c){var n=b/this.segmentsR*2*this.p*Math.PI,j=c/this.segmentsT*2*Math.PI,g=m(n,j,this.q,this.p,this.radius,this.heightScale),n=m(n+0.01,j,this.q,this.p,this.radius,this.heightScale);e.x=n.x-g.x;e.y=n.y-g.y;e.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;h.cross(e,f);f.cross(h,e);h.normalize();f.normalize();n=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=n*f.x+j*h.x;g.y+=n*f.y+j*h.y;g.z+=n*f.z+j*h.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
+g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][h],h=this.grid[b][h],j=new THREE.UV(b/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,h));this.faceVertexUvs[0].push([j,n,p,o])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
 THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
 this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
 this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
-new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,g,h,k,m){var n=document.createElement("canvas");b[e]=new THREE.Texture(n);b[e].sourceFile=g;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(h[1]!=
-1)b[e].wrapT=THREE.RepeatWrapping}k&&b[e].offset.set(k[0],k[1]);if(m){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[m[0]]!==void 0)b[e].wrapS=h[m[0]];if(h[m[1]]!==void 0)b[e].wrapT=h[m[1]]}f(b[e],c+"/"+g)}function k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,m,n;m="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
-if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==void 0)h.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.colorDiffuse)h.color=k(b.colorDiffuse);
-else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=k(b.colorSpecular);if(b.colorAmbient)h.ambient=k(b.colorAmbient);if(b.transparency)h.opacity=b.transparency;if(b.specularCoef)h.shininess=b.specularCoef;b.mapDiffuse&&c&&g(h,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(h,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(h,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
-b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(p.uniforms),t=h.color;m=h.specular;n=h.ambient;var u=h.shininess;o.tNormal.texture=h.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(h.map)o.tDiffuse.texture=h.map,o.enableDiffuse.value=!0;if(h.specularMap)o.tSpecular.texture=h.specularMap,o.enableSpecular.value=!0;if(h.lightMap)o.tAO.texture=
-h.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(t);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(n);o.uShininess.value=u;if(h.opacity)o.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:o,lights:!0,fog:!0})}else h=new THREE[m](h);return h}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
+new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,h,g,j,m){var n=document.createElement("canvas");b[e]=new THREE.Texture(n);b[e].sourceFile=h;if(g){b[e].repeat.set(g[0],g[1]);if(g[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(g[1]!=
+1)b[e].wrapT=THREE.RepeatWrapping}j&&b[e].offset.set(j[0],j[1]);if(m){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[m[0]]!==void 0)b[e].wrapS=g[m[0]];if(g[m[1]]!==void 0)b[e].wrapT=g[m[1]]}f(b[e],c+"/"+h)}function h(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var j,m,n;m="MeshLambertMaterial";j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
+if(b.blending)if(b.blending=="Additive")j.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")j.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")j.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)j.transparent=b.transparent;if(b.depthTest!==void 0)j.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(b.vertexColors)j.vertexColors=THREE.VertexColors;if(b.colorDiffuse)j.color=h(b.colorDiffuse);
+else if(b.DbgColor)j.color=b.DbgColor;if(b.colorSpecular)j.specular=h(b.colorSpecular);if(b.colorAmbient)j.ambient=h(b.colorAmbient);if(b.transparency)j.opacity=b.transparency;if(b.specularCoef)j.shininess=b.specularCoef;b.mapDiffuse&&c&&g(j,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(j,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(j,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
+b.mapSpecular&&c&&g(j,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(p.uniforms),u=j.color;m=j.specular;n=j.ambient;var v=j.shininess;o.tNormal.texture=j.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(j.map)o.tDiffuse.texture=j.map,o.enableDiffuse.value=!0;if(j.specularMap)o.tSpecular.texture=j.specularMap,o.enableSpecular.value=!0;if(j.lightMap)o.tAO.texture=
+j.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(u);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(n);o.uShininess.value=v;if(j.opacity)o.uOpacity.value=j.opacity;j=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:o,lights:!0,fog:!0})}else j=new THREE[m](j);return j}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
 THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
 THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,n,p,o,t,u,v,x,B,A,y,F,w,H=b.faces;t=b.vertices;var E=b.normals,D=b.colors,S=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&S++;for(e=0;e<S;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];p=0;for(o=t.length;p<o;)u=new THREE.Vertex,u.position.x=t[p++]*c,u.position.y=
-t[p++]*c,u.position.z=t[p++]*c,f.vertices.push(u);p=0;for(o=H.length;p<o;){c=H[p++];t=c&1;n=c&2;e=c&4;g=c&8;v=c&16;u=c&32;B=c&64;c&=128;t?(A=new THREE.Face4,A.a=H[p++],A.b=H[p++],A.c=H[p++],A.d=H[p++],t=4):(A=new THREE.Face3,A.a=H[p++],A.b=H[p++],A.c=H[p++],t=3);if(n)n=H[p++],A.materials=f.materials[n];n=f.faces.length;if(e)for(e=0;e<S;e++)y=b.uvs[e],x=H[p++],w=y[x*2],x=y[x*2+1],f.faceUvs[e][n]=new THREE.UV(w,x);if(g)for(e=0;e<S;e++){y=b.uvs[e];F=[];for(g=0;g<t;g++)x=H[p++],w=y[x*2],x=y[x*2+1],F[g]=
-new THREE.UV(w,x);f.faceVertexUvs[e][n]=F}if(v)v=H[p++]*3,g=new THREE.Vector3,g.x=E[v++],g.y=E[v++],g.z=E[v],A.normal=g;if(u)for(e=0;e<t;e++)v=H[p++]*3,g=new THREE.Vector3,g.x=E[v++],g.y=E[v++],g.z=E[v],A.vertexNormals.push(g);if(B)u=H[p++],u=new THREE.Color(D[u]),A.color=u;if(c)for(e=0;e<t;e++)u=H[p++],u=new THREE.Color(D[u]),A.vertexColors.push(u);f.faces.push(A)}}})(g);(function(){var c,e,g,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
-n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,p,o,t,u,v,x;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];v=f.morphTargets[e].vertices;x=b.morphTargets[e].vertices;n=0;for(p=x.length;n<p;n+=3)o=x[n]*c,t=x[n+1]*
-c,u=x[n+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(o,t,u)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(n=o.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(o[c],o[c+1],o[c+2]),p.push(t)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,g,n,p,o,u,v,w,x,y,D,A,H,C,E=b.faces;u=b.vertices;var I=b.normals,J=b.colors,S=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&S++;for(c=0;c<S;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];p=0;for(o=u.length;p<o;)v=new THREE.Vertex,v.position.x=u[p++]*e,v.position.y=
+u[p++]*e,v.position.z=u[p++]*e,f.vertices.push(v);p=0;for(o=E.length;p<o;){e=E[p++];u=e&1;n=e&2;c=e&4;g=e&8;w=e&16;v=e&32;y=e&64;e&=128;u?(D=new THREE.Face4,D.a=E[p++],D.b=E[p++],D.c=E[p++],D.d=E[p++],u=4):(D=new THREE.Face3,D.a=E[p++],D.b=E[p++],D.c=E[p++],u=3);if(n)n=E[p++],D.materials=f.materials[n];n=f.faces.length;if(c)for(c=0;c<S;c++)A=b.uvs[c],x=E[p++],C=A[x*2],x=A[x*2+1],f.faceUvs[c][n]=new THREE.UV(C,x);if(g)for(c=0;c<S;c++){A=b.uvs[c];H=[];for(g=0;g<u;g++)x=E[p++],C=A[x*2],x=A[x*2+1],H[g]=
+new THREE.UV(C,x);f.faceVertexUvs[c][n]=H}if(w)w=E[p++]*3,g=new THREE.Vector3,g.x=I[w++],g.y=I[w++],g.z=I[w],D.normal=g;if(v)for(c=0;c<u;c++)w=E[p++]*3,g=new THREE.Vector3,g.x=I[w++],g.y=I[w++],g.z=I[w],D.vertexNormals.push(g);if(y)v=E[p++],v=new THREE.Color(J[v]),D.color=v;if(e)for(c=0;c<u;c++)v=E[p++],v=new THREE.Color(J[v]),D.vertexColors.push(v);f.faces.push(D)}}})(g);(function(){var c,e,g,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
+n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,p,o,u,v,w,x;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];w=f.morphTargets[e].vertices;x=b.morphTargets[e].vertices;n=0;for(p=x.length;n<p;n+=3)o=x[n]*c,u=x[n+1]*
+c,v=x[n+2]*c,w.push(new THREE.Vertex(new THREE.Vector3(o,u,v)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(n=o.length;c<n;c+=3)u=new THREE.Color(16755200),u.setRGB(o[c],o[c+1],o[c+2]),p.push(u)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
 f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),k=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,k)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
-c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,k){var h=new XMLHttpRequest,m=f+"/"+b,n=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+h.status+"]"):h.readyState==3?k&&(n==0&&(n=h.getResponseHeader("Content-Length")),k({total:n,loaded:h.responseText.length})):h.readyState==2&&(n=h.getResponseHeader("Content-Length"))};h.open("GET",m,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
-h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=o(b,c),f=o(b,c+1),h=o(b,c+2);return(o(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function p(b,c){var e=o(b,c);return e>127?e-256:e}function o(b,
-c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+D);h=g(b,c+S);c=n(b,c+J);THREE.BinaryLoader.prototype.f3(y,e,f,h,c)}function u(c){var e,f,h,j,k,o;e=g(b,c);f=g(b,c+D);h=g(b,c+S);j=n(b,c+J);k=g(b,c+G);o=g(b,c+U);c=g(b,c+W);THREE.BinaryLoader.prototype.f3n(y,H,e,f,h,j,k,o,c)}function v(c){var e,f,h,j;e=g(b,c);f=g(b,c+M);h=g(b,c+X);j=g(b,c+T);c=n(b,c+R);THREE.BinaryLoader.prototype.f4(y,e,f,h,j,c)}function x(c){var e,f,h,k,o,p,t,u;e=g(b,c);f=g(b,c+M);h=g(b,c+X);k=g(b,c+T);o=n(b,
-c+R);p=g(b,c+j);t=g(b,c+fa);u=g(b,c+P);c=g(b,c+da);THREE.BinaryLoader.prototype.f4n(y,H,e,f,h,k,o,p,t,u,c)}function B(c){var e,f;e=g(b,c);f=g(b,c+ca);c=g(b,c+Y);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],E[e*2],E[e*2+1],E[f*2],E[f*2+1],E[c*2],E[c*2+1])}function A(c){var e,f,h;e=g(b,c);f=g(b,c+ea);h=g(b,c+ga);c=g(b,c+la);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],E[e*2],E[e*2+1],E[f*2],E[f*2+1],E[h*2],E[h*2+1],E[c*2],E[c*2+1])}var y=this,F=0,w,H=[],E=[],D,S,J,G,U,W,M,X,T,R,j,fa,P,
-da,ca,Y,ea,ga,la,pa,N,ia,Z,ma,$;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);w={signature:b.substr(F,8),header_bytes:o(b,F+8),vertex_coordinate_bytes:o(b,F+9),normal_coordinate_bytes:o(b,F+10),uv_coordinate_bytes:o(b,F+11),vertex_index_bytes:o(b,F+12),normal_index_bytes:o(b,F+13),uv_index_bytes:o(b,F+14),material_index_bytes:o(b,F+15),nvertices:g(b,F+16),nnormals:g(b,F+16+4),nuvs:g(b,F+16+8),ntri_flat:g(b,F+16+12),ntri_smooth:g(b,F+16+16),ntri_flat_uv:g(b,F+16+20),ntri_smooth_uv:g(b,
-F+16+24),nquad_flat:g(b,F+16+28),nquad_smooth:g(b,F+16+32),nquad_flat_uv:g(b,F+16+36),nquad_smooth_uv:g(b,F+16+40)};F+=w.header_bytes;D=w.vertex_index_bytes;S=w.vertex_index_bytes*2;J=w.vertex_index_bytes*3;G=w.vertex_index_bytes*3+w.material_index_bytes;U=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;W=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;M=w.vertex_index_bytes;X=w.vertex_index_bytes*2;T=w.vertex_index_bytes*3;R=w.vertex_index_bytes*4;j=w.vertex_index_bytes*
-4+w.material_index_bytes;fa=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;da=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;ca=w.uv_index_bytes;Y=w.uv_index_bytes*2;ea=w.uv_index_bytes;ga=w.uv_index_bytes*2;la=w.uv_index_bytes*3;c=w.vertex_index_bytes*3+w.material_index_bytes;$=w.vertex_index_bytes*4+w.material_index_bytes;pa=w.ntri_flat*c;N=w.ntri_smooth*(c+w.normal_index_bytes*3);ia=
-w.ntri_flat_uv*(c+w.uv_index_bytes*3);Z=w.ntri_smooth_uv*(c+w.normal_index_bytes*3+w.uv_index_bytes*3);ma=w.nquad_flat*$;c=w.nquad_smooth*($+w.normal_index_bytes*4);$=w.nquad_flat_uv*($+w.uv_index_bytes*4);F+=function(c){for(var f,g,j,k=w.vertex_coordinate_bytes*3,m=c+w.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+w.vertex_coordinate_bytes),j=e(b,c+w.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,f,g,j);return w.nvertices*k}(F);F+=function(c){for(var e,f,g,h=w.normal_coordinate_bytes*3,j=c+
-w.nnormals*h;c<j;c+=h)e=p(b,c),f=p(b,c+w.normal_coordinate_bytes),g=p(b,c+w.normal_coordinate_bytes*2),H.push(e/127,f/127,g/127);return w.nnormals*h}(F);F+=function(c){for(var f,g,j=w.uv_coordinate_bytes*2,k=c+w.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+w.uv_coordinate_bytes),E.push(f,g);return w.nuvs*j}(F);pa=F+pa;N=pa+N;ia=N+ia;Z=ia+Z;ma=Z+ma;c=ma+c;$=c+$;(function(b){var c,e=w.vertex_index_bytes*3+w.material_index_bytes,f=e+w.uv_index_bytes*3,g=b+w.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),B(c+e);return g-b})(N);
-(function(b){var c,e=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,f=e+w.uv_index_bytes*3,g=b+w.ntri_smooth_uv*f;for(c=b;c<g;c+=f)u(c),B(c+e);return g-b})(ia);(function(b){var c,e=w.vertex_index_bytes*4+w.material_index_bytes,f=e+w.uv_index_bytes*4,g=b+w.nquad_flat_uv*f;for(c=b;c<g;c+=f)v(c),A(c+e);return g-b})(c);(function(b){var c,e=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,f=e+w.uv_index_bytes*4,g=b+w.nquad_smooth_uv*f;for(c=b;c<g;c+=f)x(c),A(c+
-e);return g-b})($);(function(b){var c,e=w.vertex_index_bytes*3+w.material_index_bytes,f=b+w.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(F);(function(b){var c,e=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,f=b+w.ntri_smooth*e;for(c=b;c<f;c+=e)u(c);return f-b})(pa);(function(b){var c,e=w.vertex_index_bytes*4+w.material_index_bytes,f=b+w.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(Z);(function(b){var c,e=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
-4,f=b+w.nquad_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(ma);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,k){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[k]))},
-f3n:function(b,c,e,f,g,k,h,m,n){var k=b.materials[k],p=c[m*3],o=c[m*3+1],m=c[m*3+2],t=c[n*3],u=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(t,u,n)],null,k))},f4n:function(b,c,e,f,g,k,h,m,n,p,o){var h=b.materials[h],t=c[n*3],u=c[n*3+1],n=c[n*3+2],v=c[p*3],x=c[p*3+1],p=c[p*3+2],B=c[o*3],A=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,k,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,
-u,n),new THREE.Vector3(v,x,p),new THREE.Vector3(B,A,o)],null,h))},uv3:function(b,c,e,f,g,k,h){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(k,h));b.push(m)},uv4:function(b,c,e,f,g,k,h,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,g));p.push(new THREE.UV(k,h));p.push(new THREE.UV(m,n));b.push(p)}};
+THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,h)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
+c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,h){var j=new XMLHttpRequest,m=f+"/"+b,n=0;j.onreadystatechange=function(){j.readyState==4?j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+j.status+"]"):j.readyState==3?h&&(n==0&&(n=j.getResponseHeader("Content-Length")),h({total:n,loaded:j.responseText.length})):j.readyState==2&&(n=j.getResponseHeader("Content-Length"))};j.open("GET",m,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=o(b,c),f=o(b,c+1),h=o(b,c+2);return(o(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function p(b,c){var e=o(b,c);return e>127?e-256:e}function o(b,
+c){return b.charCodeAt(c)&255}function u(c){var e,f,h;e=g(b,c);f=g(b,c+J);h=g(b,c+S);c=n(b,c+R);THREE.BinaryLoader.prototype.f3(A,e,f,h,c)}function v(c){var e,f,h,j,k,o;e=g(b,c);f=g(b,c+J);h=g(b,c+S);j=n(b,c+R);k=g(b,c+N);o=g(b,c+F);c=g(b,c+W);THREE.BinaryLoader.prototype.f3n(A,E,e,f,h,j,k,o,c)}function w(c){var e,f,h,j;e=g(b,c);f=g(b,c+K);h=g(b,c+X);j=g(b,c+Q);c=n(b,c+U);THREE.BinaryLoader.prototype.f4(A,e,f,h,j,c)}function x(c){var e,f,h,j,o,p,u,v;e=g(b,c);f=g(b,c+K);h=g(b,c+X);j=g(b,c+Q);o=n(b,
+c+U);p=g(b,c+k);u=g(b,c+ia);v=g(b,c+L);c=g(b,c+ga);THREE.BinaryLoader.prototype.f4n(A,E,e,f,h,j,o,p,u,v,c)}function y(c){var e,f;e=g(b,c);f=g(b,c+fa);c=g(b,c+$);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],I[e*2],I[e*2+1],I[f*2],I[f*2+1],I[c*2],I[c*2+1])}function D(c){var e,f,h;e=g(b,c);f=g(b,c+ha);h=g(b,c+ja);c=g(b,c+ma);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],I[e*2],I[e*2+1],I[f*2],I[f*2+1],I[h*2],I[h*2+1],I[c*2],I[c*2+1])}var A=this,H=0,C,E=[],I=[],J,S,R,N,F,W,K,X,Q,U,k,ia,L,
+ga,fa,$,ha,ja,ma,ra,T,ka,ca,oa,da;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,f,c);C={signature:b.substr(H,8),header_bytes:o(b,H+8),vertex_coordinate_bytes:o(b,H+9),normal_coordinate_bytes:o(b,H+10),uv_coordinate_bytes:o(b,H+11),vertex_index_bytes:o(b,H+12),normal_index_bytes:o(b,H+13),uv_index_bytes:o(b,H+14),material_index_bytes:o(b,H+15),nvertices:g(b,H+16),nnormals:g(b,H+16+4),nuvs:g(b,H+16+8),ntri_flat:g(b,H+16+12),ntri_smooth:g(b,H+16+16),ntri_flat_uv:g(b,H+16+20),ntri_smooth_uv:g(b,
+H+16+24),nquad_flat:g(b,H+16+28),nquad_smooth:g(b,H+16+32),nquad_flat_uv:g(b,H+16+36),nquad_smooth_uv:g(b,H+16+40)};H+=C.header_bytes;J=C.vertex_index_bytes;S=C.vertex_index_bytes*2;R=C.vertex_index_bytes*3;N=C.vertex_index_bytes*3+C.material_index_bytes;F=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;W=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;K=C.vertex_index_bytes;X=C.vertex_index_bytes*2;Q=C.vertex_index_bytes*3;U=C.vertex_index_bytes*4;k=C.vertex_index_bytes*
+4+C.material_index_bytes;ia=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;L=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ga=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;fa=C.uv_index_bytes;$=C.uv_index_bytes*2;ha=C.uv_index_bytes;ja=C.uv_index_bytes*2;ma=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;da=C.vertex_index_bytes*4+C.material_index_bytes;ra=C.ntri_flat*c;T=C.ntri_smooth*(c+C.normal_index_bytes*3);ka=
+C.ntri_flat_uv*(c+C.uv_index_bytes*3);ca=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);oa=C.nquad_flat*da;c=C.nquad_smooth*(da+C.normal_index_bytes*4);da=C.nquad_flat_uv*(da+C.uv_index_bytes*4);H+=function(c){for(var f,g,h,k=C.vertex_coordinate_bytes*3,m=c+C.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+C.vertex_coordinate_bytes),h=e(b,c+C.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(A,f,g,h);return C.nvertices*k}(H);H+=function(c){for(var e,f,g,h=C.normal_coordinate_bytes*3,
+j=c+C.nnormals*h;c<j;c+=h)e=p(b,c),f=p(b,c+C.normal_coordinate_bytes),g=p(b,c+C.normal_coordinate_bytes*2),E.push(e/127,f/127,g/127);return C.nnormals*h}(H);H+=function(c){for(var f,g,h=C.uv_coordinate_bytes*2,k=c+C.nuvs*h;c<k;c+=h)f=e(b,c),g=e(b,c+C.uv_coordinate_bytes),I.push(f,g);return C.nuvs*h}(H);ra=H+ra;T=ra+T;ka=T+ka;ca=ka+ca;oa=ca+oa;c=oa+c;da=c+da;(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=e+C.uv_index_bytes*3,g=b+C.ntri_flat_uv*f;for(c=b;c<g;c+=f)u(c),y(c+e);return g-
+b})(T);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=e+C.uv_index_bytes*3,g=b+C.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),y(c+e);return g-b})(ka);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=e+C.uv_index_bytes*4,g=b+C.nquad_flat_uv*f;for(c=b;c<g;c+=f)w(c),D(c+e);return g-b})(c);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,f=e+C.uv_index_bytes*4,g=b+C.nquad_smooth_uv*f;for(c=b;c<g;c+=f)x(c),
+D(c+e);return g-b})(da);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=b+C.ntri_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(H);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=b+C.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(ra);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=b+C.nquad_flat*e;for(c=b;c<f;c+=e)w(c);return f-b})(ca);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
+4,f=b+C.nquad_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(oa);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,h){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[h]))},
+f3n:function(b,c,e,f,g,h,j,m,n){var h=b.materials[h],p=c[m*3],o=c[m*3+1],m=c[m*3+2],u=c[n*3],v=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(u,v,n)],null,h))},f4n:function(b,c,e,f,g,h,j,m,n,p,o){var j=b.materials[j],u=c[n*3],v=c[n*3+1],n=c[n*3+2],w=c[p*3],x=c[p*3+1],p=c[p*3+2],y=c[o*3],D=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,h,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(u,
+v,n),new THREE.Vector3(w,x,p),new THREE.Vector3(y,D,o)],null,j))},uv3:function(b,c,e,f,g,h,j){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(h,j));b.push(m)},uv4:function(b,c,e,f,g,h,j,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,j));p.push(new THREE.UV(m,n));b.push(p)}};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(v in M.objects)if(!P.objects[v])if(F=M.objects[v],F.geometry!==void 0){if(D=P.geometries[F.geometry]){var b=!1;U=[];for(ca=0;ca<F.materials.length;ca++)U[ca]=P.materials[F.materials[ca]],b=U[ca]instanceof THREE.MeshShaderMaterial;b&&D.computeTangents();w=F.position;r=
-F.rotation;q=F.quaternion;s=F.scale;q=0;U.length==0&&(U[0]=new THREE.MeshFaceMaterial);U.length>1&&(U=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(D,U);object.name=v;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;P.scene.addObject(object);P.objects[v]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(b));
-if(F.castsShadow)b=new THREE.ShadowVolume(D),P.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},P.triggers[object.name]=b)}}else w=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=F.visible!==void 0?F.visible:!1,P.scene.addObject(object),P.objects[v]=object,P.empties[v]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},P.triggers[object.name]=b)}function n(b){return function(c){P.geometries[b]=c;m();T-=1;e.onLoadComplete();o()}}function p(b){return function(c){P.geometries[b]=c}}function o(){e.callbackProgress({totalModels:j,totalTextures:fa,loadedModels:j-T,loadedTextures:fa-R},P);e.onLoadProgress();T==0&&R==0&&c(P)}
-var t,u,v,x,B,A,y,F,w,H,E,D,S,J,G,U,W,M,X,T,R,j,fa,P;M=b.data;G=new THREE.BinaryLoader;X=new THREE.JSONLoader;R=T=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in M.objects)if(F=M.objects[v],F.meshCollider){b=!0;break}if(b)P.scene.collisions=new THREE.CollisionSystem;if(M.transform){b=M.transform.position;H=M.transform.rotation;var da=M.transform.scale;b&&P.scene.position.set(b[0],b[1],b[2]);H&&P.scene.rotation.set(H[0],
-H[1],H[2]);da&&P.scene.scale.set(da[0],da[1],da[2]);(b||H||da)&&P.scene.updateMatrix()}b=function(){R-=1;o();e.onLoadComplete()};for(B in M.cameras){H=M.cameras[B];if(H.type=="perspective")S=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")S=new THREE.Camera,S.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);w=H.position;H=H.target;S.position.set(w[0],w[1],w[2]);S.target.position.set(H[0],H[1],H[2]);P.cameras[B]=S}for(x in M.lights)B=M.lights[x],
-S=B.color!==void 0?B.color:16777215,H=B.intensity!==void 0?B.intensity:1,B.type=="directional"?(w=B.direction,W=new THREE.DirectionalLight(S,H),W.position.set(w[0],w[1],w[2]),W.position.normalize()):B.type=="point"?(w=B.position,d=B.distance,W=new THREE.PointLight(S,H,d),W.position.set(w[0],w[1],w[2])):B.type=="ambient"&&(W=new THREE.AmbientLight(S)),P.scene.addLight(W),P.lights[x]=W;for(A in M.fogs)x=M.fogs[A],x.type=="linear"?J=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(J=new THREE.FogExp2(0,
-x.density)),H=x.color,J.color.setRGB(H[0],H[1],H[2]),P.fogs[A]=J;if(P.cameras&&M.defaults.camera)P.currentCamera=P.cameras[M.defaults.camera];if(P.fogs&&M.defaults.fog)P.scene.fog=P.fogs[M.defaults.fog];H=M.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(H[0],H[1],H[2]);P.bgColorAlpha=M.defaults.bgalpha;for(t in M.geometries)if(A=M.geometries[t],A.type=="bin_mesh"||A.type=="ascii_mesh")T+=1,e.onLoadStart();j=T;for(t in M.geometries)A=M.geometries[t],A.type=="cube"?(D=new THREE.CubeGeometry(A.width,
-A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),P.geometries[t]=D):A.type=="plane"?(D=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),P.geometries[t]=D):A.type=="sphere"?(D=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),P.geometries[t]=D):A.type=="cylinder"?(D=new THREE.CylinderGeometry(A.numSegs,A.topRad,A.botRad,A.height,A.topOffset,A.botOffset),P.geometries[t]=D):A.type=="torus"?(D=new THREE.TorusGeometry(A.radius,
-A.tube,A.segmentsR,A.segmentsT),P.geometries[t]=D):A.type=="icosahedron"?(D=new THREE.IcosahedronGeometry(A.subdivisions),P.geometries[t]=D):A.type=="bin_mesh"?G.load({model:f(A.url,M.urlBaseType),callback:n(t)}):A.type=="ascii_mesh"?X.load({model:f(A.url,M.urlBaseType),callback:n(t)}):A.type=="embedded_mesh"&&(A=M.embeds[A.id])&&X.createModel(A,p(t),"");for(y in M.textures)if(t=M.textures[y],t.url instanceof Array){R+=t.url.length;for(G=0;G<t.url.length;G++)e.onLoadStart()}else R+=1,e.onLoadStart();
-fa=R;for(y in M.textures){t=M.textures[y];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){G=[];for(var ca=0;ca<t.url.length;ca++)G[ca]=f(t.url[ca],M.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,t.mapping,b)}else{G=THREE.ImageUtils.loadTexture(f(t.url,M.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)G.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)G.magFilter=THREE[t.magFilter];if(t.repeat){G.repeat.set(t.repeat[0],
-t.repeat[1]);if(t.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}t.offset&&G.offset.set(t.offset[0],t.offset[1]);if(t.wrap){X={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(X[t.wrap[0]]!==void 0)G.wrapS=X[t.wrap[0]];if(X[t.wrap[1]]!==void 0)G.wrapT=X[t.wrap[1]]}}P.textures[y]=G}for(u in M.materials){y=M.materials[u];for(E in y.parameters)if(E=="envMap"||E=="map"||E=="lightMap")y.parameters[E]=P.textures[y.parameters[E]];else if(E=="shading")y.parameters[E]=
-y.parameters[E]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(E=="blending")y.parameters[E]=THREE[y.parameters[E]]?THREE[y.parameters[E]]:THREE.NormalBlending;else if(E=="combine")y.parameters[E]=y.parameters[E]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(E=="vertexColors")if(y.parameters[E]=="face")y.parameters[E]=THREE.FaceColors;else if(y.parameters[E])y.parameters[E]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
-!0;if(y.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);G=y.parameters.color;X=y.parameters.specular;A=y.parameters.ambient;J=y.parameters.shininess;b.tNormal.texture=P.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)b.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)b.tDiffuse.texture=y.parameters.map,b.enableDiffuse.value=!0;if(y.parameters.lightMap)b.tAO.texture=y.parameters.lightMap,b.enableAO.value=!0;if(y.parameters.specularMap)b.tSpecular.texture=
-P.textures[y.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(G);b.uSpecularColor.value.setHex(X);b.uAmbientColor.value.setHex(A);b.uShininess.value=J;if(y.parameters.opacity)b.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);P.materials[u]=y}m();e.callbackSync(P)}}};
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(w in K.objects)if(!L.objects[w])if(H=K.objects[w],H.geometry!==void 0){if(J=L.geometries[H.geometry]){var b=!1;F=[];for(fa=0;fa<H.materials.length;fa++)F[fa]=L.materials[H.materials[fa]],b=F[fa]instanceof THREE.MeshShaderMaterial;b&&J.computeTangents();C=H.position;r=
+H.rotation;q=H.quaternion;s=H.scale;q=0;F.length==0&&(F[0]=new THREE.MeshFaceMaterial);F.length>1&&(F=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(J,F);object.name=w;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=H.visible;L.scene.addObject(object);L.objects[w]=object;H.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),L.scene.collisions.colliders.push(b));
+if(H.castsShadow)b=new THREE.ShadowVolume(J),L.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},L.triggers[object.name]=b)}}else C=H.position,r=H.rotation,q=H.quaternion,s=H.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=H.visible!==void 0?H.visible:!1,L.scene.addObject(object),L.objects[w]=object,L.empties[w]=object,H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},L.triggers[object.name]=b)}function n(b){return function(c){L.geometries[b]=c;m();Q-=1;e.onLoadComplete();o()}}function p(b){return function(c){L.geometries[b]=c}}function o(){e.callbackProgress({totalModels:k,totalTextures:ia,loadedModels:k-Q,loadedTextures:ia-U},L);e.onLoadProgress();Q==0&&U==0&&c(L)}
+var u,v,w,x,y,D,A,H,C,E,I,J,S,R,N,F,W,K,X,Q,U,k,ia,L;K=b.data;N=new THREE.BinaryLoader;X=new THREE.JSONLoader;U=Q=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in K.objects)if(H=K.objects[w],H.meshCollider){b=!0;break}if(b)L.scene.collisions=new THREE.CollisionSystem;if(K.transform){b=K.transform.position;E=K.transform.rotation;var ga=K.transform.scale;b&&L.scene.position.set(b[0],b[1],b[2]);E&&L.scene.rotation.set(E[0],
+E[1],E[2]);ga&&L.scene.scale.set(ga[0],ga[1],ga[2]);(b||E||ga)&&L.scene.updateMatrix()}b=function(){U-=1;o();e.onLoadComplete()};for(y in K.cameras){E=K.cameras[y];if(E.type=="perspective")S=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")S=new THREE.Camera,S.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);C=E.position;E=E.target;S.position.set(C[0],C[1],C[2]);S.target.position.set(E[0],E[1],E[2]);L.cameras[y]=S}for(x in K.lights)y=K.lights[x],
+S=y.color!==void 0?y.color:16777215,E=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(C=y.direction,W=new THREE.DirectionalLight(S,E),W.position.set(C[0],C[1],C[2]),W.position.normalize()):y.type=="point"?(C=y.position,d=y.distance,W=new THREE.PointLight(S,E,d),W.position.set(C[0],C[1],C[2])):y.type=="ambient"&&(W=new THREE.AmbientLight(S)),L.scene.addLight(W),L.lights[x]=W;for(D in K.fogs)x=K.fogs[D],x.type=="linear"?R=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(R=new THREE.FogExp2(0,
+x.density)),E=x.color,R.color.setRGB(E[0],E[1],E[2]),L.fogs[D]=R;if(L.cameras&&K.defaults.camera)L.currentCamera=L.cameras[K.defaults.camera];if(L.fogs&&K.defaults.fog)L.scene.fog=L.fogs[K.defaults.fog];E=K.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(E[0],E[1],E[2]);L.bgColorAlpha=K.defaults.bgalpha;for(u in K.geometries)if(D=K.geometries[u],D.type=="bin_mesh"||D.type=="ascii_mesh")Q+=1,e.onLoadStart();k=Q;for(u in K.geometries)D=K.geometries[u],D.type=="cube"?(J=new THREE.CubeGeometry(D.width,
+D.height,D.depth,D.segmentsWidth,D.segmentsHeight,D.segmentsDepth,null,D.flipped,D.sides),L.geometries[u]=J):D.type=="plane"?(J=new THREE.PlaneGeometry(D.width,D.height,D.segmentsWidth,D.segmentsHeight),L.geometries[u]=J):D.type=="sphere"?(J=new THREE.SphereGeometry(D.radius,D.segmentsWidth,D.segmentsHeight),L.geometries[u]=J):D.type=="cylinder"?(J=new THREE.CylinderGeometry(D.numSegs,D.topRad,D.botRad,D.height,D.topOffset,D.botOffset),L.geometries[u]=J):D.type=="torus"?(J=new THREE.TorusGeometry(D.radius,
+D.tube,D.segmentsR,D.segmentsT),L.geometries[u]=J):D.type=="icosahedron"?(J=new THREE.IcosahedronGeometry(D.subdivisions),L.geometries[u]=J):D.type=="bin_mesh"?N.load({model:f(D.url,K.urlBaseType),callback:n(u)}):D.type=="ascii_mesh"?X.load({model:f(D.url,K.urlBaseType),callback:n(u)}):D.type=="embedded_mesh"&&(D=K.embeds[D.id])&&X.createModel(D,p(u),"");for(A in K.textures)if(u=K.textures[A],u.url instanceof Array){U+=u.url.length;for(N=0;N<u.url.length;N++)e.onLoadStart()}else U+=1,e.onLoadStart();
+ia=U;for(A in K.textures){u=K.textures[A];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){N=[];for(var fa=0;fa<u.url.length;fa++)N[fa]=f(u.url[fa],K.urlBaseType);N=THREE.ImageUtils.loadTextureCube(N,u.mapping,b)}else{N=THREE.ImageUtils.loadTexture(f(u.url,K.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)N.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)N.magFilter=THREE[u.magFilter];if(u.repeat){N.repeat.set(u.repeat[0],
+u.repeat[1]);if(u.repeat[0]!=1)N.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)N.wrapT=THREE.RepeatWrapping}u.offset&&N.offset.set(u.offset[0],u.offset[1]);if(u.wrap){X={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(X[u.wrap[0]]!==void 0)N.wrapS=X[u.wrap[0]];if(X[u.wrap[1]]!==void 0)N.wrapT=X[u.wrap[1]]}}L.textures[A]=N}for(v in K.materials){A=K.materials[v];for(I in A.parameters)if(I=="envMap"||I=="map"||I=="lightMap")A.parameters[I]=L.textures[A.parameters[I]];else if(I=="shading")A.parameters[I]=
+A.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")A.parameters[I]=THREE[A.parameters[I]]?THREE[A.parameters[I]]:THREE.NormalBlending;else if(I=="combine")A.parameters[I]=A.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(I=="vertexColors")if(A.parameters[I]=="face")A.parameters[I]=THREE.FaceColors;else if(A.parameters[I])A.parameters[I]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=
+!0;if(A.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);N=A.parameters.color;X=A.parameters.specular;D=A.parameters.ambient;R=A.parameters.shininess;b.tNormal.texture=L.textures[A.parameters.normalMap];if(A.parameters.normalMapFactor)b.uNormalScale.value=A.parameters.normalMapFactor;if(A.parameters.map)b.tDiffuse.texture=A.parameters.map,b.enableDiffuse.value=!0;if(A.parameters.lightMap)b.tAO.texture=A.parameters.lightMap,b.enableAO.value=!0;if(A.parameters.specularMap)b.tSpecular.texture=
+L.textures[A.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(N);b.uSpecularColor.value.setHex(X);b.uAmbientColor.value.setHex(D);b.uShininess.value=R;if(A.parameters.opacity)b.uOpacity.value=A.parameters.opacity;A=new THREE.MeshShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);L.materials[v]=A}m();e.callbackSync(L)}}};
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,k,h,m,n,p,o,t){h=(h-o)/(t-o);o=this.normal_cache;c[k]=m+h*this.delta;c[k+1]=n;c[k+2]=p;g[k]=this.lerp(o[b],o[b+3],h);g[k+1]=this.lerp(o[b+1],o[b+4],h);g[k+2]=this.lerp(o[b+2],o[b+5],h)};this.VIntY=function(b,c,g,k,h,m,n,p,o,t){h=(h-o)/(t-o);o=this.normal_cache;c[k]=m;c[k+1]=n+h*this.delta;c[k+
-2]=p;c=b+this.yd*3;g[k]=this.lerp(o[b],o[c],h);g[k+1]=this.lerp(o[b+1],o[c+1],h);g[k+2]=this.lerp(o[b+2],o[c+2],h)};this.VIntZ=function(b,c,g,k,h,m,n,p,o,t){h=(h-o)/(t-o);o=this.normal_cache;c[k]=m;c[k+1]=n;c[k+2]=p+h*this.delta;c=b+this.zd*3;g[k]=this.lerp(o[b],o[c],h);g[k+1]=this.lerp(o[b+1],o[c+1],h);g[k+2]=this.lerp(o[b+2],o[c+2],h)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,k,h,m){var n=k+1,p=k+this.yd,o=k+this.zd,t=n+this.yd,u=n+this.zd,v=k+this.yd+this.zd,x=n+this.yd+this.zd,B=0,A=this.field[k],y=this.field[n],F=this.field[p],w=this.field[t],H=this.field[o],E=this.field[u],D=this.field[v],S=this.field[x];A<h&&(B|=1);y<h&&(B|=2);F<h&&(B|=8);w<h&&(B|=4);H<h&&(B|=16);E<h&&(B|=32);D<h&&(B|=128);S<h&&(B|=64);var J=THREE.edgeTable[B];if(J==0)return 0;var G=this.delta,
-U=b+G,W=c+G,G=g+G;J&1&&(this.compNorm(k),this.compNorm(n),this.VIntX(k*3,this.vlist,this.nlist,0,h,b,c,g,A,y));J&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,h,U,c,g,y,w));J&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,h,b,W,g,F,w));J&8&&(this.compNorm(k),this.compNorm(p),this.VIntY(k*3,this.vlist,this.nlist,9,h,b,c,g,A,F));J&16&&(this.compNorm(o),this.compNorm(u),this.VIntX(o*3,this.vlist,this.nlist,12,h,b,c,G,H,E));J&32&&(this.compNorm(u),
-this.compNorm(x),this.VIntY(u*3,this.vlist,this.nlist,15,h,U,c,G,E,S));J&64&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,18,h,b,W,G,D,S));J&128&&(this.compNorm(o),this.compNorm(v),this.VIntY(o*3,this.vlist,this.nlist,21,h,b,c,G,H,D));J&256&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,24,h,b,c,g,A,H));J&512&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*3,this.vlist,this.nlist,27,h,U,c,g,y,E));J&1024&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*
-3,this.vlist,this.nlist,30,h,U,W,g,w,S));J&2048&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,33,h,b,W,g,F,D));B<<=4;for(h=k=0;THREE.triTable[B+h]!=-1;)b=B+h,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),h+=3,k++;return k};this.posnormtriv=function(b,c,g,k,h,m){var n=this.count*3;this.positionArray[n]=b[g];this.positionArray[n+1]=b[g+1];this.positionArray[n+2]=b[g+2];this.positionArray[n+3]=b[k];this.positionArray[n+
-4]=b[k+1];this.positionArray[n+5]=b[k+2];this.positionArray[n+6]=b[h];this.positionArray[n+7]=b[h+1];this.positionArray[n+8]=b[h+2];this.normalArray[n]=c[g];this.normalArray[n+1]=c[g+1];this.normalArray[n+2]=c[g+2];this.normalArray[n+3]=c[k];this.normalArray[n+4]=c[k+1];this.normalArray[n+5]=c[k+2];this.normalArray[n+6]=c[h];this.normalArray[n+7]=c[h+1];this.normalArray[n+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,k,h){var m=this.size*Math.sqrt(k/h),n=g*this.size,p=c*this.size,o=b*this.size,t=Math.floor(n-m);t<1&&(t=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var u=Math.floor(p-m);u<1&&(u=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var v=Math.floor(o-m);v<1&&(v=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
-1);for(var x,B,A,y,F,w;t<n;t++){o=this.size2*t;B=t/this.size-g;F=B*B;for(B=u;B<p;B++){A=o+this.size*B;x=B/this.size-c;w=x*x;for(x=v;x<m;x++)y=x/this.size-b,y=k/(1.0E-6+y*y+w+F)-h,y>0&&(this.field[A+x]+=y)}}};this.addPlaneX=function(b,c){var g,k,h,m,n,p=this.size,o=this.yd,t=this.zd,u=this.field,v=p*Math.sqrt(b/c);v>p&&(v=p);for(g=0;g<v;g++)if(k=g/p,k*=k,m=b/(1.0E-4+k)-c,m>0)for(k=0;k<p;k++){n=g+k*o;for(h=0;h<p;h++)u[t*h+n]+=m}};this.addPlaneY=function(b,c){var g,k,h,m,n,p,o=this.size,t=this.yd,u=
-this.zd,v=this.field,x=o*Math.sqrt(b/c);x>o&&(x=o);for(k=0;k<x;k++)if(g=k/o,g*=g,m=b/(1.0E-4+g)-c,m>0){n=k*t;for(g=0;g<o;g++){p=n+g;for(h=0;h<o;h++)v[u*h+p]+=m}}};this.addPlaneZ=function(b,c){var g,k,h,m,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(g=h/size,g*=g,m=b/(1.0E-4+g)-c,m>0){n=zd*h;for(k=0;k<size;k++){p=n+k*yd;for(g=0;g<size;g++)field[p+g]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
-3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,k,h,m,n,p,o,t,u=this.size-2;for(h=1;h<u;h++){t=this.size2*h;p=(h-this.halfsize)/this.halfsize;for(k=1;k<u;k++){o=t+this.size*k;n=(k-this.halfsize)/this.halfsize;for(g=1;g<u;g++)m=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(m,n,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(k){var h,m,n,p,o,t,u,v;for(h=0;h<k.count;h++)u=h*3,o=u+1,v=u+2,m=k.positionArray[u],
-n=k.positionArray[o],p=k.positionArray[v],t=new THREE.Vector3(m,n,p),m=k.normalArray[u],n=k.normalArray[o],p=k.normalArray[v],u=new THREE.Vector3(m,n,p),u.normalize(),o=new THREE.Vertex(t),c.vertices.push(o),g.push(u);nfaces=k.count/3;for(h=0;h<nfaces;h++)u=(b+h)*3,o=u+1,v=u+2,t=g[u],m=g[o],n=g[v],u=new THREE.Face3(u,o,v,[t,m,n]),c.faces.push(u);b+=nfaces;k.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,h,j,m,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;c[h]=m+j*this.delta;c[h+1]=n;c[h+2]=p;g[h]=this.lerp(o[b],o[b+3],j);g[h+1]=this.lerp(o[b+1],o[b+4],j);g[h+2]=this.lerp(o[b+2],o[b+5],j)};this.VIntY=function(b,c,g,h,j,m,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;c[h]=m;c[h+1]=n+j*this.delta;c[h+
+2]=p;c=b+this.yd*3;g[h]=this.lerp(o[b],o[c],j);g[h+1]=this.lerp(o[b+1],o[c+1],j);g[h+2]=this.lerp(o[b+2],o[c+2],j)};this.VIntZ=function(b,c,g,h,j,m,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;c[h]=m;c[h+1]=n;c[h+2]=p+j*this.delta;c=b+this.zd*3;g[h]=this.lerp(o[b],o[c],j);g[h+1]=this.lerp(o[b+1],o[c+1],j);g[h+2]=this.lerp(o[b+2],o[c+2],j)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,h,j,m){var n=h+1,p=h+this.yd,o=h+this.zd,u=n+this.yd,v=n+this.zd,w=h+this.yd+this.zd,x=n+this.yd+this.zd,y=0,D=this.field[h],A=this.field[n],H=this.field[p],C=this.field[u],E=this.field[o],I=this.field[v],J=this.field[w],S=this.field[x];D<j&&(y|=1);A<j&&(y|=2);H<j&&(y|=8);C<j&&(y|=4);E<j&&(y|=16);I<j&&(y|=32);J<j&&(y|=128);S<j&&(y|=64);var R=THREE.edgeTable[y];if(R==0)return 0;var N=this.delta,
+F=b+N,W=c+N,N=g+N;R&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,j,b,c,g,D,A));R&2&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,3,j,F,c,g,A,C));R&4&&(this.compNorm(p),this.compNorm(u),this.VIntX(p*3,this.vlist,this.nlist,6,j,b,W,g,H,C));R&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,j,b,c,g,D,H));R&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,j,b,c,N,E,I));R&32&&(this.compNorm(v),
+this.compNorm(x),this.VIntY(v*3,this.vlist,this.nlist,15,j,F,c,N,I,S));R&64&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,18,j,b,W,N,J,S));R&128&&(this.compNorm(o),this.compNorm(w),this.VIntY(o*3,this.vlist,this.nlist,21,j,b,c,N,E,J));R&256&&(this.compNorm(h),this.compNorm(o),this.VIntZ(h*3,this.vlist,this.nlist,24,j,b,c,g,D,E));R&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,j,F,c,g,A,I));R&1024&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*
+3,this.vlist,this.nlist,30,j,F,W,g,C,S));R&2048&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,33,j,b,W,g,H,J));y<<=4;for(j=h=0;THREE.triTable[y+j]!=-1;)b=y+j,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),j+=3,h++;return h};this.posnormtriv=function(b,c,g,h,j,m){var n=this.count*3;this.positionArray[n]=b[g];this.positionArray[n+1]=b[g+1];this.positionArray[n+2]=b[g+2];this.positionArray[n+3]=b[h];this.positionArray[n+
+4]=b[h+1];this.positionArray[n+5]=b[h+2];this.positionArray[n+6]=b[j];this.positionArray[n+7]=b[j+1];this.positionArray[n+8]=b[j+2];this.normalArray[n]=c[g];this.normalArray[n+1]=c[g+1];this.normalArray[n+2]=c[g+2];this.normalArray[n+3]=c[h];this.normalArray[n+4]=c[h+1];this.normalArray[n+5]=c[h+2];this.normalArray[n+6]=c[j];this.normalArray[n+7]=c[j+1];this.normalArray[n+8]=c[j+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
+this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,h,j){var m=this.size*Math.sqrt(h/j),n=g*this.size,p=c*this.size,o=b*this.size,u=Math.floor(n-m);u<1&&(u=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var v=Math.floor(p-m);v<1&&(v=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var w=Math.floor(o-m);w<1&&(w=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
+1);for(var x,y,D,A,H,C;u<n;u++){o=this.size2*u;y=u/this.size-g;H=y*y;for(y=v;y<p;y++){D=o+this.size*y;x=y/this.size-c;C=x*x;for(x=w;x<m;x++)A=x/this.size-b,A=h/(1.0E-6+A*A+C+H)-j,A>0&&(this.field[D+x]+=A)}}};this.addPlaneX=function(b,c){var g,h,j,m,n,p=this.size,o=this.yd,u=this.zd,v=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(g=0;g<w;g++)if(h=g/p,h*=h,m=b/(1.0E-4+h)-c,m>0)for(h=0;h<p;h++){n=g+h*o;for(j=0;j<p;j++)v[u*j+n]+=m}};this.addPlaneY=function(b,c){var g,h,j,m,n,p,o=this.size,u=this.yd,v=
+this.zd,w=this.field,x=o*Math.sqrt(b/c);x>o&&(x=o);for(h=0;h<x;h++)if(g=h/o,g*=g,m=b/(1.0E-4+g)-c,m>0){n=h*u;for(g=0;g<o;g++){p=n+g;for(j=0;j<o;j++)w[v*j+p]+=m}}};this.addPlaneZ=function(b,c){var g,h,j,m,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(j=0;j<dist;j++)if(g=j/size,g*=g,m=b/(1.0E-4+g)-c,m>0){n=zd*j;for(h=0;h<size;h++){p=n+h*yd;for(g=0;g<size;g++)field[p+g]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
+3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,h,j,m,n,p,o,u,v=this.size-2;for(j=1;j<v;j++){u=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<v;h++){o=u+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<v;g++)m=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(m,n,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(h){var j,m,n,p,o,u,v,w;for(j=0;j<h.count;j++)v=j*3,o=v+1,w=v+2,m=h.positionArray[v],
+n=h.positionArray[o],p=h.positionArray[w],u=new THREE.Vector3(m,n,p),m=h.normalArray[v],n=h.normalArray[o],p=h.normalArray[w],v=new THREE.Vector3(m,n,p),v.normalize(),o=new THREE.Vertex(u),c.vertices.push(o),g.push(v);nfaces=h.count/3;for(j=0;j<nfaces;j++)v=(b+j)*3,o=v+1,w=v+2,u=g[v],m=g[o],n=g[w],v=new THREE.Face3(v,o,w,[u,m,n]),c.faces.push(v);b+=nfaces;h.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -563,23 +584,23 @@ THREE.Trident=function(b){function c(c){return new THREE.Mesh(new THREE.Cylinder
 this.scale=new THREE.Vector3(b.scale,b.scale,b.scale);this.addChild(e(new THREE.Vector3(b.length,0,0),b.xAxisColor));this.addChild(e(new THREE.Vector3(0,b.length,0),b.yAxisColor));this.addChild(e(new THREE.Vector3(0,0,b.length),b.zAxisColor));if(b.showArrows)g=c(b.xAxisColor),g.rotation.y=-f,g.position.x=b.length,this.addChild(g),g=c(b.yAxisColor),g.rotation.x=f,g.position.y=b.length,this.addChild(g),g=c(b.zAxisColor),g.rotation.y=Math.PI,g.position.z=b.length,this.addChild(g)};
 this.scale=new THREE.Vector3(b.scale,b.scale,b.scale);this.addChild(e(new THREE.Vector3(b.length,0,0),b.xAxisColor));this.addChild(e(new THREE.Vector3(0,b.length,0),b.yAxisColor));this.addChild(e(new THREE.Vector3(0,0,b.length),b.zAxisColor));if(b.showArrows)g=c(b.xAxisColor),g.rotation.y=-f,g.position.x=b.length,this.addChild(g),g=c(b.yAxisColor),g.rotation.x=f,g.position.y=b.length,this.addChild(g),g=c(b.zAxisColor),g.rotation.y=Math.PI,g.position.z=b.length,this.addChild(g)};
 THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c};THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
 THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c};THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
 THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};
 THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};
-THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,g,k=0;c=0;for(e=this.colliders.length;c<e;c++)if(g=this.colliders[c],f=this.rayCast(b,g),f<Number.MAX_VALUE)g.distance=f,f>k?this.hits.push(g):this.hits.unshift(g),k=f;return this.hits};
+THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,g,h=0;c=0;for(e=this.colliders.length;c<e;c++)if(g=this.colliders[c],f=this.rayCast(b,g),f<Number.MAX_VALUE)g.distance=f,f>h?this.hits.push(g):this.hits.unshift(g),h=f;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
 THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
 THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,k=0;k<c.numFaces;k++){var h=c.mesh.geometry.faces[k],m=c.mesh.geometry.vertices[h.a].position,n=c.mesh.geometry.vertices[h.b].position,p=c.mesh.geometry.vertices[h.c].position,o=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(e,m,n,p,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-h instanceof THREE.Face4&&(h=this.rayTriangle(e,m,n,o,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(e,n,p,o,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
-THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,k,h){var m=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;k.set(0,0,0);m.sub(e,c);n.sub(f,e);k.cross(m,n);m=k.dot(b.direction);if(!(m<0))if(h.doubleSided||h.flipSided)k.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;h=k.dot(c)-k.dot(b.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=m*g))return Number.MAX_VALUE;h/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(h);m.addSelf(b.origin);Math.abs(k.x)>
-Math.abs(k.y)?Math.abs(k.x)>Math.abs(k.z)?(b=m.y-c.y,k=e.y-c.y,g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,k=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(k.y)>Math.abs(k.z)?(b=m.x-c.x,k=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,k=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=k*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=k*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h};
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var j=c.mesh.geometry.faces[h],m=c.mesh.geometry.vertices[j.a].position,n=c.mesh.geometry.vertices[j.b].position,p=c.mesh.geometry.vertices[j.c].position,o=j instanceof THREE.Face4?c.mesh.geometry.vertices[j.d].position:null;j instanceof THREE.Face3?(j=this.rayTriangle(e,m,n,p,f,this.collisionNormal,c.mesh),j<f&&(f=j,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+j instanceof THREE.Face4&&(j=this.rayTriangle(e,m,n,o,f,this.collisionNormal,c.mesh),j<f&&(f=j,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),j=this.rayTriangle(e,n,p,o,f,this.collisionNormal,c.mesh),j<f&&(f=j,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,h,j){var m=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;h.set(0,0,0);m.sub(e,c);n.sub(f,e);h.cross(m,n);m=h.dot(b.direction);if(!(m<0))if(j.doubleSided||j.flipSided)h.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;j=h.dot(c)-h.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=m*g))return Number.MAX_VALUE;j/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(j);m.addSelf(b.origin);Math.abs(h.x)>
+Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(b=m.y-c.y,h=e.y-c.y,g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=h*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=h*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return j};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,k=0,h=0,m=0,n=0,p=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,p=!1,h=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,h=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,p=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
-p=!1,m=1);e.origin.z<c.min.z?(k=c.min.z-e.origin.z,k/=e.direction.z,p=!1,n=-1):e.origin.z>c.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,p=!1,n=1);if(p)return-1;p=0;g>f&&(p=1,f=g);k>f&&(p=2,f=k);switch(p){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
-f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,h=0,j=0,m=0,n=0,p=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,p=!1,j=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,j=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,p=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
+p=!1,m=1);e.origin.z<c.min.z?(h=c.min.z-e.origin.z,h/=e.direction.z,p=!1,n=-1):e.origin.z>c.max.z&&(h=c.max.z-e.origin.z,h/=e.direction.z,p=!1,n=1);if(p)return-1;p=0;g>f&&(p=1,f=g);h>f&&(p=2,f=h);switch(p){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(j,0,0);break;case 1:j=e.origin.x+e.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
+f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:j=e.origin.x+e.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,k=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,n,p,o;g.useTarget=k.useTarget=!1;g.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z=
-2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:u}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;u.width=b;u.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||p!==e.near||o!==e.fov){n=e.aspect;p=e.near;o=e.fov;var y=e.projectionMatrix.clone(),F=125/30*0.5,w=F*p/125,H=p*Math.tan(o*Math.PI/360),E;h.n14=F;m.n14=-F;F=-H*n+w;E=H*n+w;y.n11=2*p/(E-F);y.n13=(E+F)/(E-F);g.projectionMatrix=y.clone();F=-H*n-w;E=H*n-w;y.n11=2*p/(E-F);
-y.n13=(E+F)/(E-F);k.projectionMatrix=y.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=p;g.far=e.far;f.call(c,b,g,t,!0);k.matrix=e.matrixWorld.clone().multiplySelf(h);k.update(null,!0);k.position.copy(e.position);k.near=p;k.far=e.far;f.call(c,b,k,u,!0);f.call(c,x,v)}};
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,k,h=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;k=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far;
-h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);m.projectionMatrix=h.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,k);f.call(c,b,h);this.setViewport(g,0,g,k);f.call(c,b,m,!1)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,h=new THREE.Camera,j=new THREE.Matrix4,m=new THREE.Matrix4,n,p,o;g.useTarget=h.useTarget=!1;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.Camera(53,1,1,1E4);w.position.z=
+2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
+var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||p!==e.near||o!==e.fov){n=e.aspect;p=e.near;o=e.fov;var A=e.projectionMatrix.clone(),H=125/30*0.5,C=H*p/125,E=p*Math.tan(o*Math.PI/360),I;j.n14=H;m.n14=-H;H=-E*n+C;I=E*n+C;A.n11=2*p/(I-H);A.n13=(I+H)/(I-H);g.projectionMatrix=A.clone();H=-E*n-C;I=E*n-C;A.n11=2*p/(I-H);
+A.n13=(I+H)/(I-H);h.projectionMatrix=A.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=p;g.far=e.far;f.call(c,b,g,u,!0);h.matrix=e.matrixWorld.clone().multiplySelf(j);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,v,!0);f.call(c,x,w)}};
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,h,j=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;h=f};this.render=function(b,e){this.clear();j.fov=e.fov;j.aspect=0.5*e.aspect;j.near=e.near;j.far=e.far;
+j.updateProjectionMatrix();j.position.copy(e.position);j.target.position.copy(e.target.position);j.translateX(c.separation);m.projectionMatrix=j.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,h);f.call(c,b,j);this.setViewport(g,0,g,h);f.call(c,b,m,!1)}};

+ 209 - 188
build/custom/ThreeExtras.js

@@ -1,10 +1,10 @@
 // ThreeExtras.js r42 - http://github.com/mrdoob/three.js
 // ThreeExtras.js r42 - http://github.com/mrdoob/three.js
-THREE.ColorUtils={adjustHSV:function(a,b,c,g){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.ColorUtils.clamp(e.h+b,0,1);e.s=THREE.ColorUtils.clamp(e.s+c,0,1);e.v=THREE.ColorUtils.clamp(e.v+g,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,g=a.g,e=a.b,h=Math.max(Math.max(c,g),e),f=Math.min(Math.min(c,g),e);if(f==h)f=c=0;else{var j=h-f,f=j/h,c=c==h?(g-e)/j:g==h?2+(e-c)/j:4+(c-g)/j;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=h;return b},
-clamp:function(a,b,c){return a<b?b:a>c?c:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,g=a.vertices.length,e=c?b.geometry:b,h=a.vertices,f=e.vertices,j=a.faces,k=e.faces,l=a.faceVertexUvs[0],e=e.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var m=0,o=f.length;m<o;m++){var n=new THREE.Vertex(f[m].position.clone());c&&b.matrix.multiplyVector3(n.position);h.push(n)}m=0;for(o=k.length;m<o;m++){var f=k[m],t,v,y=f.vertexNormals,n=f.vertexColors;f instanceof THREE.Face3?t=new THREE.Face3(f.a+g,f.b+g,f.c+
-g):f instanceof THREE.Face4&&(t=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));t.normal.copy(f.normal);c=0;for(h=y.length;c<h;c++)v=y[c],t.vertexNormals.push(v.clone());t.color.copy(f.color);c=0;for(h=n.length;c<h;c++)v=n[c],t.vertexColors.push(v.clone());t.materials=f.materials.slice();t.centroid.copy(f.centroid);j.push(t)}m=0;for(o=e.length;m<o;m++){g=e[m];j=[];c=0;for(h=g.length;c<h;c++)j.push(new THREE.UV(g[c].u,g[c].v));l.push(j)}}};
-THREE.ImageUtils={loadTexture:function(a,b,c){var g=new Image,e=new THREE.Texture(g,b);g.onload=function(){e.needsUpdate=!0;c&&c(this)};g.crossOrigin="";g.src=a;return e},loadTextureCube:function(a,b,c){var g,e=[],h=new THREE.Texture(e,b),b=e.loadCount=0;for(g=a.length;b<g;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount==6)h.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return h}};
-THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,g,e=a.children.length;for(g=0;g<e;g++)c=a.children[g],b(c),THREE.SceneUtils.traverseHierarchy(c,b)}};
+THREE.ColorUtils={adjustHSV:function(a,c,b,f){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.ColorUtils.clamp(e.h+c,0,1);e.s=THREE.ColorUtils.clamp(e.s+b,0,1);e.v=THREE.ColorUtils.clamp(e.v+f,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,c){var b=a.r,f=a.g,e=a.b,g=Math.max(Math.max(b,f),e),h=Math.min(Math.min(b,f),e);if(h==g)h=b=0;else{var j=g-h,h=j/g,b=b==g?(f-e)/j:f==g?2+(e-b)/j:4+(b-f)/j;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=h;c.v=g;return c},
+clamp:function(a,c,b){return a<c?c:a>b?b:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
+THREE.GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,f=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,l=a.faceVertexUvs[0],e=e.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var m=0,n=h.length;m<n;m++){var o=new THREE.Vertex(h[m].position.clone());b&&c.matrix.multiplyVector3(o.position);g.push(o)}m=0;for(n=k.length;m<n;m++){var h=k[m],p,v,w=h.vertexNormals,o=h.vertexColors;h instanceof THREE.Face3?p=new THREE.Face3(h.a+f,h.b+f,h.c+
+f):h instanceof THREE.Face4&&(p=new THREE.Face4(h.a+f,h.b+f,h.c+f,h.d+f));p.normal.copy(h.normal);b=0;for(g=w.length;b<g;b++)v=w[b],p.vertexNormals.push(v.clone());p.color.copy(h.color);b=0;for(g=o.length;b<g;b++)v=o[b],p.vertexColors.push(v.clone());p.materials=h.materials.slice();p.centroid.copy(h.centroid);j.push(p)}m=0;for(n=e.length;m<n;m++){f=e[m];j=[];b=0;for(g=f.length;b<g;b++)j.push(new THREE.UV(f[b].u,f[b].v));l.push(j)}}};
+THREE.ImageUtils={loadTexture:function(a,c,b){var f=new Image,e=new THREE.Texture(f,c);f.onload=function(){e.needsUpdate=!0;b&&b(this)};f.crossOrigin="";f.src=a;return e},loadTextureCube:function(a,c,b){var f,e=[],g=new THREE.Texture(e,c),c=e.loadCount=0;for(f=a.length;c<f;++c)e[c]=new Image,e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)},e[c].crossOrigin="",e[c].src=a[c];return g}};
+THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,f,e=a.children.length;for(f=0;f<e;f++)b=a.children[f],c(b),THREE.SceneUtils.traverseHierarchy(b,c)}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
 value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30},uOpacity:{type:"f",value:1}}]),fragmentShader:["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;",
 value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30},uOpacity:{type:"f",value:1}}]),fragmentShader:["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;",
@@ -14,184 +14,205 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,g,e,h=2*Math.ceil(a*3)+1;h>25&&(h=25);e=(h-1)*0.5;c=Array(h);for(b=g=0;b<h;++b)c[b]=Math.exp(-((b-e)*(b-e))/(2*a*a)),g+=c[b];for(b=0;b<h;++b)c[b]/=g;return c}};
-THREE.AnimationHandler=function(){var a=[],b={},c={update:function(c){for(var b=0;b<a.length;b++)a[b].update(c)},addToUpdate:function(c){a.indexOf(c)===-1&&a.push(c)},removeFromUpdate:function(c){c=a.indexOf(c);c!==-1&&a.splice(c,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var f=0;f<a.hierarchy[c].keys.length;f++){if(a.hierarchy[c].keys[f].time<
-0)a.hierarchy[c].keys[f].time=0;if(a.hierarchy[c].keys[f].rot!==void 0&&!(a.hierarchy[c].keys[f].rot instanceof THREE.Quaternion)){var g=a.hierarchy[c].keys[f].rot;a.hierarchy[c].keys[f].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){g={};for(f=0;f<a.hierarchy[c].keys.length;f++)for(var k=0;k<a.hierarchy[c].keys[f].morphTargets.length;k++){var l=a.hierarchy[c].keys[f].morphTargets[k];g[l]=-1}a.hierarchy[c].usedMorphTargets=g;for(f=0;f<a.hierarchy[c].keys.length;f++){var m=
-{};for(l in g){for(k=0;k<a.hierarchy[c].keys[f].morphTargets.length;k++)if(a.hierarchy[c].keys[f].morphTargets[k]===l){m[l]=a.hierarchy[c].keys[f].morphTargetsInfluences[k];break}k===a.hierarchy[c].keys[f].morphTargets.length&&(m[l]=0)}a.hierarchy[c].keys[f].morphTargetsInfluences=m}}for(f=1;f<a.hierarchy[c].keys.length;f++)a.hierarchy[c].keys[f].time===a.hierarchy[c].keys[f-1].time&&(a.hierarchy[c].keys.splice(f,1),f--);for(f=1;f<a.hierarchy[c].keys.length;f++)a.hierarchy[c].keys[f].index=f}f=parseInt(a.length*
-a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(f));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var c=[];if(a instanceof THREE.SkinnedMesh)for(var b=0;b<a.bones.length;b++)c.push(a.bones[b]);else g(a,c);return c}},g=function(a,c){c.push(a);for(var b=0;b<a.children.length;b++)g(a.children[b],c)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
-2;return c}();THREE.Animation=function(a,b,c,g){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=g!==void 0?g:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,g=this.hierarchy.length,e;for(c=0;c<g;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===void 0)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
-THREE.Bone?e.skinMatrix:e.matrix;var h=e.animationCache.prevKey;e=e.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,f,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=f=0;c<g;++c)b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a)),f+=b[c];for(c=0;c<g;++c)b[c]/=f;return b}};
+THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var f=0;f<a.hierarchy[b].keys.length;f++){if(a.hierarchy[b].keys[f].time<
+0)a.hierarchy[b].keys[f].time=0;if(a.hierarchy[b].keys[f].rot!==void 0&&!(a.hierarchy[b].keys[f].rot instanceof THREE.Quaternion)){var j=a.hierarchy[b].keys[f].rot;a.hierarchy[b].keys[f].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){j={};for(f=0;f<a.hierarchy[b].keys.length;f++)for(var k=0;k<a.hierarchy[b].keys[f].morphTargets.length;k++){var l=a.hierarchy[b].keys[f].morphTargets[k];j[l]=-1}a.hierarchy[b].usedMorphTargets=j;for(f=0;f<a.hierarchy[b].keys.length;f++){var m=
+{};for(l in j){for(k=0;k<a.hierarchy[b].keys[f].morphTargets.length;k++)if(a.hierarchy[b].keys[f].morphTargets[k]===l){m[l]=a.hierarchy[b].keys[f].morphTargetsInfluences[k];break}k===a.hierarchy[b].keys[f].morphTargets.length&&(m[l]=0)}a.hierarchy[b].keys[f].morphTargetsInfluences=m}}for(f=1;f<a.hierarchy[b].keys.length;f++)a.hierarchy[b].keys[f].time===a.hierarchy[b].keys[f-1].time&&(a.hierarchy[b].keys.splice(f,1),f--);for(f=1;f<a.hierarchy[b].keys.length;f++)a.hierarchy[b].keys[f].index=f}f=parseInt(a.length*
+a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(f));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else f(a,b);return b}},f=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)f(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
+2;return b}();THREE.Animation=function(a,c,b,f){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,f=this.hierarchy.length,e;for(b=0;b<f;b++){e=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===void 0)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
+THREE.Bone?e.skinMatrix:e.matrix;var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,g,e,h,f,j,k,l,m=this.data.JIT.hierarchy,o,n;this.currentTime+=a*this.timeScale;n=this.currentTime;o=this.currentTime%=this.data.length;l=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,v=this.hierarchy.length;t<v;t++)if(a=this.hierarchy[t],k=a.animationCache,this.JITCompile&&m[t][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[t][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=m[t][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var y=0;y<3;y++){c=b[y];f=k.prevKey[c];j=k.nextKey[c];if(j.time<=n){if(o<n)if(this.loop){f=this.data.hierarchy[t].keys[0];for(j=this.getNextKeyWith(c,t,1);j.time<o;)f=j,j=this.getNextKeyWith(c,t,j.index+1)}else{this.stop();return}else{do f=j,j=this.getNextKeyWith(c,t,j.index+1);while(j.time<
-o)}k.prevKey[c]=f;k.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;g=(o-f.time)/(j.time-f.time);e=f[c];h=j[c];if(g<0||g>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+g+" on bone "+t),g=g<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(h[0]-e[0])*g,c.y=e[1]+(h[1]-e[1])*g,c.z=e[2]+(h[2]-e[2])*g;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",t,f.index-1).pos,this.points[1]=e,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",t,j.index+1).pos,g=g*0.33+0.33,e=this.interpolateCatmullRom(this.points,g),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)g=this.interpolateCatmullRom(this.points,g*1.01),this.target.set(g[0],g[1],g[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),g=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,g,0)}else if(c===
-"rot")THREE.Quaternion.slerp(e,h,a.quaternion,g);else if(c==="scl")c=a.scale,c.x=e[0]+(h[0]-e[0])*g,c.y=e[1]+(h[1]-e[1])*g,c.z=e[2]+(h[2]-e[2])*g}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;t<this.hierarchy.length;t++)m[t][l]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],g=[],e,h,f,j,k,l;e=(a.length-1)*b;h=Math.floor(e);e-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];j=a[c[1]];k=a[c[2]];l=a[c[3]];c=e*e;f=e*c;g[0]=this.interpolate(h[0],j[0],k[0],l[0],e,c,f);g[1]=this.interpolate(h[1],j[1],k[1],l[1],e,c,f);g[2]=this.interpolate(h[2],j[2],k[2],l[2],e,c,f);return g};
-THREE.Animation.prototype.interpolate=function(a,b,c,g,e,h,f){a=(c-a)*0.5;g=(g-b)*0.5;return(2*(b-c)+a+g)*f+(-3*(b-c)-2*a-g)*h+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var g=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<g.length-1?c:g.length-1:c%=g.length;c<g.length;c++)if(g[c][a]!==void 0)return g[c];return this.data.hierarchy[b].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var g=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+g.length;c>=0;c--)if(g[c][a]!==void 0)return g[c];return this.data.hierarchy[b].keys[g.length-1]};
-THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,f,e,g,h,j,k,l,m=this.data.JIT.hierarchy,n,o;this.currentTime+=a*this.timeScale;o=this.currentTime;n=this.currentTime%=this.data.length;l=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,v=this.hierarchy.length;p<v;p++)if(a=this.hierarchy[p],k=a.animationCache,this.JITCompile&&m[p][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[p][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=m[p][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var w=0;w<3;w++){b=c[w];h=k.prevKey[b];j=k.nextKey[b];if(j.time<=o){if(n<o)if(this.loop){h=this.data.hierarchy[p].keys[0];for(j=this.getNextKeyWith(b,p,1);j.time<n;)h=j,j=this.getNextKeyWith(b,p,j.index+1)}else{this.stop();return}else{do h=j,j=this.getNextKeyWith(b,p,j.index+1);while(j.time<
+n)}k.prevKey[b]=h;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;f=(n-h.time)/(j.time-h.time);e=h[b];g=j[b];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+p),f=f<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=e[0]+(g[0]-e[0])*f,b.y=e[1]+(g[1]-e[1])*f,b.z=e[2]+(g[2]-e[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",p,h.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",p,j.index+1).pos,f=f*0.33+0.33,e=this.interpolateCatmullRom(this.points,f),b.x=e[0],b.y=e[1],b.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,f,0)}else if(b===
+"rot")THREE.Quaternion.slerp(e,g,a.quaternion,f);else if(b==="scl")b=a.scale,b.x=e[0]+(g[0]-e[0])*f,b.y=e[1]+(g[1]-e[1])*f,b.z=e[2]+(g[2]-e[2])*f}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;p<this.hierarchy.length;p++)m[p][l]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],f=[],e,g,h,j,k,l;e=(a.length-1)*c;g=Math.floor(e);e-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];k=a[b[2]];l=a[b[3]];b=e*e;h=e*b;f[0]=this.interpolate(g[0],j[0],k[0],l[0],e,b,h);f[1]=this.interpolate(g[1],j[1],k[1],l[1],e,b,h);f[2]=this.interpolate(g[2],j[2],k[2],l[2],e,b,h);return f};
+THREE.Animation.prototype.interpolate=function(a,c,b,f,e,g,h){a=(b-a)*0.5;f=(f-c)*0.5;return(2*(c-b)+a+f)*h+(-3*(c-b)-2*a-f)*g+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<f.length-1?b:f.length-1:b%=f.length;b<f.length;b++)if(f[b][a]!==void 0)return f[b];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var f=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+f.length;b>=0;b--)if(f[b][a]!==void 0)return f[b];return this.data.hierarchy[c].keys[f.length-1]};
+THREE.FirstPersonCamera=function(a){function c(a,c){return function(){c.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
 a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!==
 a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!==
 void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(a){a.preventDefault();
 void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(a){a.preventDefault();
 a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.mouseX=a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=
 a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.mouseX=a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=
 !0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){var a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;if(!this.freeze){this.autoSpeedFactor=
 !0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){var a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;if(!this.freeze){this.autoSpeedFactor=
-this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var b=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.translateZ(b);this.moveLeft&&this.translateX(-b);this.moveRight&&this.translateX(b);b=this.tdiff*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&
-(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target.position,e=this.position;a.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=e.y+100*Math.cos(this.phi);a.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=
-(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;a=this.target.position;e=this.position;a.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=e.y+100*Math.cos(this.phi);a.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),
-!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;
-THREE.FirstPersonCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};
-THREE.PathCamera=function(a){function b(a,c,b,f){var g={name:b,fps:0.6,length:f,hierarchy:[]},e,h=c.getControlPointsArray(),j=c.getLength(),k=h.length,x=0;e=k-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[e]={time:f,pos:h[e],rot:[0,0,0,1],scl:[1,1,1]};for(e=1;e<k-1;e++)x=f*j.chunks[e]/j.total,c.keys[e]={time:x,pos:h[e]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
-f,e=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)f=b/(a.points.length*c),f=a.getPoint(f),e.vertices[b]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return e}function g(a,b){var f=c(b,10),e=c(b,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(e,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);e=new THREE.SphereGeometry(1,
-16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)f=new THREE.Mesh(e,g),f.position.copy(b.points[i]),f.updateMatrix(),a.addChild(f)}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
+this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var c=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.translateZ(c);this.moveLeft&&this.translateX(-c);this.moveRight&&this.translateX(c);c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&
+(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target.position,e=this.position;a.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=e.y+100*Math.cos(this.phi);a.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=
+(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;a=this.target.position;e=this.position;a.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=e.y+100*Math.cos(this.phi);a.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),
+!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;
+THREE.FirstPersonCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
+THREE.PathCamera=function(a){function c(a,b,c,f){var g={name:c,fps:0.6,length:f,hierarchy:[]},e,h=b.getControlPointsArray(),j=b.getLength(),k=h.length,A=0;e=k-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[e]={time:f,pos:h[e],rot:[0,0,0,1],scl:[1,1,1]};for(e=1;e<k-1;e++)A=f*j.chunks[e]/j.total,b.keys[e]={time:A,pos:h[e]};g.hierarchy[0]=b;THREE.AnimationHandler.add(g);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(a,b){var c,
+f,g=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)f=c/(a.points.length*b),f=a.getPoint(f),g.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return g}function f(a,c){var f=b(c,10),g=b(c,10),e=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,e);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);g=new THREE.SphereGeometry(1,
+16,8);e=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,e),f.position.copy(c.points[i]),f.updateMatrix(),a.addChild(f)}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==
 void 0)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==void 0)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==void 0)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==void 0)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
 void 0)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==void 0)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==void 0)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==void 0)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
-window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,h=Math.PI/180;this.update=function(a,c,b){var f,g;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;f=this.phi%e;this.phi=f>=0?f:f+e;f=this.verticalAngleMap.srcRange;g=this.verticalAngleMap.dstRange;var j=g[1]-g[0];this.phi=
-TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(g[1]-g[0])/(f[1]-f[0])+g[0]-g[0])/j)*j+g[0];f=this.horizontalAngleMap.srcRange;g=this.horizontalAngleMap.dstRange;j=g[1]-g[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(g[1]-g[0])/(f[1]-f[0])+g[0]-g[0])/j)*j+g[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,c,b)};this.onMouseMove=function(a){this.mouseX=
-a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),f=new THREE.MeshLambertMaterial({color:65280}),j=new THREE.CubeGeometry(10,10,20),k=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,f);a.position.set(0,10,0);this.animation=
-b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=b(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&g(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,c){return function(){c.apply(a,arguments)}}(this,this.onMouseMove),
+window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,g=Math.PI/180;this.update=function(a,b,c){var f,h;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;f=this.phi%e;this.phi=f>=0?f:f+e;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var j=h[1]-h[0];this.phi=
+TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/j)*j+h[0];f=this.horizontalAngleMap.srcRange;h=this.horizontalAngleMap.dstRange;j=h[1]-h[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/j)*j+h[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,b,c)};this.onMouseMove=function(a){this.mouseX=
+a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),h=new THREE.MeshLambertMaterial({color:65280}),j=new THREE.CubeGeometry(10,10,20),k=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,h);a.position.set(0,10,0);this.animation=
+c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,b){return function(){b.apply(a,arguments)}}(this,this.onMouseMove),
 !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
 !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
+THREE.FlyCamera=function(a){function c(a,c){return function(){c.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
 a.autoForward;if(a.domElement!==void 0)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=
 a.autoForward;if(a.domElement!==void 0)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
 this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
-case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),e=b.size[0]/2,h=b.size[1]/2;this.moveState.yawLeft=-(a.clientX-b.offset[0]-e)/e;this.moveState.pitchDown=(a.clientY-
-b.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,b=this.tdiff*
-this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVector.y*a);this.translateZ(this.moveVector.z*a);this.tmpQuaternion.set(this.rotationVector.x*b,this.rotationVector.y*b,this.rotationVector.z*b,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var a=this.moveState.forward||
+case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),e=c.size[0]/2,g=c.size[1]/2;this.moveState.yawLeft=-(a.clientX-c.offset[0]-e)/e;this.moveState.pitchDown=(a.clientY-
+c.offset[1]-g)/g;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,c=this.tdiff*
+this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVector.y*a);this.translateZ(this.moveVector.z*a);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var a=this.moveState.forward||
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
-document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,this.mouseup),!1);window.addEventListener("keydown",b(this,this.keydown),!1);window.addEventListener("keyup",b(this,
+document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(a,b,c,g){THREE.Camera.call(this,a,b,c,g);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var e=new THREE.Vector3,h=new THREE.Vector3,f=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,o=0,n=0,t=0,v=0,y=window.innerWidth/2,u=window.innerHeight/2;this.update=
-function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*t),this.rotateVertically(a*v));a=this.delta*this.movementSpeed;this.translateZ(a*(m>0||this.autoForward&&!(m<0)?1:m));this.translateX(a*o);this.translateY(a*n);k&&(this.roll+=this.rollSpeed*this.delta*l);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
-else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);h.set(0,1,0);e.cross(h,f).normalize();h.cross(f,e).normalize();this.matrix.n11=e.x;this.matrix.n12=h.x;this.matrix.n13=f.x;this.matrix.n21=e.y;this.matrix.n22=h.y;this.matrix.n23=f.y;this.matrix.n31=e.z;this.matrix.n32=h.z;this.matrix.n33=f.z;j.identity();j.n11=Math.cos(this.roll);j.n12=-Math.sin(this.roll);j.n21=Math.sin(this.roll);j.n22=Math.cos(this.roll);this.matrix.multiplySelf(j);
+THREE.RollCamera=function(a,c,b,f){THREE.Camera.call(this,a,c,b,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,n=0,o=0,p=0,v=0,w=window.innerWidth/2,x=window.innerHeight/2;this.update=
+function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*p),this.rotateVertically(a*v));a=this.delta*this.movementSpeed;this.translateZ(a*(m>0||this.autoForward&&!(m<0)?1:m));this.translateX(a*n);this.translateY(a*o);k&&(this.roll+=this.rollSpeed*this.delta*l);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);g.set(0,1,0);e.cross(g,h).normalize();g.cross(h,e).normalize();this.matrix.n11=e.x;this.matrix.n12=g.x;this.matrix.n13=h.x;this.matrix.n21=e.y;this.matrix.n22=g.y;this.matrix.n23=h.y;this.matrix.n31=e.z;this.matrix.n32=g.z;this.matrix.n33=h.z;j.identity();j.n11=Math.cos(this.roll);j.n12=-Math.sin(this.roll);j.n21=Math.sin(this.roll);j.n22=Math.cos(this.roll);this.matrix.multiplySelf(j);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(a){this.position.x+=this.matrix.n11*a;this.position.y+=this.matrix.n21*a;this.position.z+=this.matrix.n31*a};this.translateY=function(a){this.position.x+=this.matrix.n12*a;this.position.y+=this.matrix.n22*a;this.position.z+=this.matrix.n32*a};this.translateZ=function(a){this.position.x-=this.matrix.n13*a;this.position.y-=
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(a){this.position.x+=this.matrix.n11*a;this.position.y+=this.matrix.n21*a;this.position.z+=this.matrix.n31*a};this.translateY=function(a){this.position.x+=this.matrix.n12*a;this.position.y+=this.matrix.n22*a;this.position.z+=this.matrix.n32*a};this.translateZ=function(a){this.position.x-=this.matrix.n13*a;this.position.y-=
-this.matrix.n23*a;this.position.z-=this.matrix.n33*a};this.rotateHorizontally=function(a){e.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);e.multiplyScalar(a);this.forward.subSelf(e);this.forward.normalize()};this.rotateVertically=function(a){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(a);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(a){t=(a.clientX-y)/window.innerWidth;v=(a.clientY-u)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=1;break;case 2:m=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=0;break;case 2:m=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:m=1;break;case 37:case 65:o=-1;break;
-case 40:case 83:m=-1;break;case 39:case 68:o=1;break;case 81:k=!0;l=1;break;case 69:k=!0;l=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:m=0;break;case 37:case 65:o=0;break;case 40:case 83:m=0;break;case 39:case 68:o=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:n=0;break;case 70:n=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+this.matrix.n23*a;this.position.z-=this.matrix.n33*a};this.rotateHorizontally=function(a){e.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);e.multiplyScalar(a);this.forward.subSelf(e);this.forward.normalize()};this.rotateVertically=function(a){g.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);g.multiplyScalar(a);this.forward.addSelf(g);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+function(a){p=(a.clientX-w)/window.innerWidth;v=(a.clientY-x)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=1;break;case 2:m=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=0;break;case 2:m=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:m=1;break;case 37:case 65:n=-1;break;
+case 40:case 83:m=-1;break;case 39:case 68:n=1;break;case 81:k=!0;l=1;break;case 69:k=!0;l=-1;break;case 82:o=1;break;case 70:o=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:m=0;break;case 37:case 65:n=0;break;case 40:case 83:m=0;break;case 39:case 68:n=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:o=0;break;case 70:o=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
-THREE.TrackballCamera=function(a){function b(a,c){return function(){c.apply(a,arguments)}}a=a||{};THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.domElement=a.domElement||document;this.screen=a.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=a.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=a.rotateSpeed||1;this.zoomSpeed=a.zoomSpeed||1.2;this.panSpeed=a.panSpeed||0.3;this.noZoom=a.noZoom||!1;this.noPan=a.noPan||
-!1;this.staticMoving=a.staticMoving||!1;this.dynamicDampingFactor=a.dynamicDampingFactor||0.2;this.minDistance=a.minDistance||0;this.maxDistance=a.maxDistance||Infinity;this.keys=a.keys||[65,83,68];this.useTarget=!0;var c=!1,g=this.STATE.NONE,e=new THREE.Vector3,h=new THREE.Vector3,f=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,l=new THREE.Vector2,m=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-
-this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var b=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),f=b.length();f>1?b.normalize():b.z=Math.sqrt(1-f*f);e=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(b.y);f.addSelf(this.up.clone().crossSelf(e).setLength(b.x));f.addSelf(e.setLength(b.z));return f};
-this.rotateCamera=function(){var a=Math.acos(h.dot(f)/h.length()/f.length());if(a){var c=(new THREE.Vector3).cross(h,f).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,-a);b.multiplyVector3(e);b.multiplyVector3(this.up);b.multiplyVector3(f);this.staticMoving?h=f:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*this.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),this.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};
-this.panCamera=function(){var a=m.clone().subSelf(l);if(a.lengthSq()){a.multiplyScalar(e.length()*this.panSpeed);var c=e.clone().crossSelf(this.up).setLength(a.x);c.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?l=m:l.addSelf(a.sub(m,l).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
-e.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,e.setLength(this.minDistance))};this.update=function(a,c,b){e=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,e);this.checkDistances();this.supr.update.call(this,a,c,b)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-b(this,function(a){c&&(h=f=this.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=this.getMouseOnScreen(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),c=!1);g!==this.STATE.NONE&&(g===this.STATE.ROTATE?f=this.getMouseProjectionOnBall(a.clientX,a.clientY):g===this.STATE.ZOOM&&!this.noZoom?k=this.getMouseOnScreen(a.clientX,a.clientY):g===this.STATE.PAN&&!this.noPan&&(m=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();
-a.stopPropagation();if(g===this.STATE.NONE)g=a.button,g===this.STATE.ROTATE?h=f=this.getMouseProjectionOnBall(a.clientX,a.clientY):g===this.STATE.ZOOM&&!this.noZoom?j=k=this.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=m=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();g=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(g===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])g=
-this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)g=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)g=this.STATE.PAN;g!==this.STATE.NONE&&(c=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(g!==this.STATE.NONE)g=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
-THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;THREE.Path=function(a){this.actions=[];a&&this.fromPoints(a)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru"};THREE.Path.prototype.fromPoints=function(a){var b=0,c=a.length;this.moveTo(a[0].x,a[0].y);for(b=1;b<c;b++)this.lineTo(a[b].x,a[b].y)};
-THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};THREE.Path.prototype.lineTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.LINE_TO,args:a})};THREE.Path.prototype.quadraticCurveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:a})};
-THREE.Path.prototype.bezierCurveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:a})};THREE.Path.prototype.splineThru=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:a})};
-THREE.Path.prototype.getPoints=function(a){var a=a||12,b=[],c,g,e,h,f,j,k,l,m,o,n,t,v;c=0;for(g=this.actions.length;c<g;c++)switch(e=this.actions[c],h=e.action,e=e.args,h){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];f=e[3];l=e[0];m=e[1];b.length>0?(n=b[b.length-1],o=n.x,n=n.y):(n=this.actions[c-1].args,o=n[n.length-2],n=n[n.length-1]);for(e=1;e<=a;e++)t=e/a,v=THREE.FontUtils.b2(t,o,l,h),t=THREE.FontUtils.b2(t,n,m,f),b.push(new THREE.Vector2(v,
-t));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];f=e[5];l=e[0];m=e[1];j=e[2];k=e[3];b.length>0?(n=b[b.length-1],o=n.x,n=n.y):(n=this.actions[c-1].args,o=n[n.length-2],n=n[n.length-1]);for(e=1;e<=a;e++)t=e/a,v=THREE.FontUtils.b3(t,o,l,j,h),t=THREE.FontUtils.b3(t,n,m,k,f),b.push(new THREE.Vector2(v,t));break;case THREE.PathActions.CSPLINE_THRU:n=this.actions[c-1].args;j=new THREE.Vector2(n[n.length-2],n[n.length-1]);h=e[0];f=a*h.length;h.unshift(j);j=new Spline2;for(e=0;e<f;e++)b.push(j.get2DPoint(h,
-e/f))}return b};var Spline2=function(){function a(a,c,b,e,g){var a=(b-a)*0.5,e=(e-c)*0.5,h=g*g;return(2*c-2*b+a+e)*g*h+(-3*c+3*b-2*a-e)*h+a*g+c}var b=[],c,g,e,h;this.get2DPoint=function(f,j){c=new THREE.Vector2;g=(f.length-1)*j;e=Math.floor(g);h=g-e;b[0]=e==0?e:e-1;b[1]=e;b[2]=e>f.length-2?e:e+1;b[3]=e>f.length-3?e:e+2;c.x=a(f[b[0]].x,f[b[1]].x,f[b[2]].x,f[b[3]].x,h);c.y=a(f[b[0]].y,f[b[1]].y,f[b[2]].y,f[b[3]].y,h);return c}};
-THREE.Path.prototype.getMinAndMax=function(){var a=this.getPoints(),b,c,g,e;b=c=Number.NEGATIVE_INFINITY;g=e=Number.POSITIVE_INFINITY;var h,f,j;f=0;for(j=a.length;f<j;f++){h=a[f];if(h.x>b)b=h.x;else if(h.x<g)g=h.x;if(h.y>c)c=h.y;else if(h.y<c)e=h.y}return{minX:g,minY:e,maxX:b,maxY:c}};
-THREE.Path.prototype.debug=function(a){var b=this.getMinAndMax();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,g,e,a=0;for(c=this.actions.length;a<c;a++)g=this.actions[a],e=g.args,g=g.action,g!=THREE.PathActions.CSPLINE_THRU&&b[g].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";g=this.getPoints();
-a=0;for(c=g.length;a<c;a++)e=g[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.triangulate=function(){var a=this.getPoints();THREE.FontUtils.Triangulate.area(a)>0&&(a=a.reverse());return THREE.FontUtils.Triangulate(a,!0)};
-THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
-THREE.CubeGeometry=function(a,b,c,g,e,h,f,j,k){function l(a,c,b,f,j,k,l,o){var t,n,v=g||1,y=e||1,C=j/2,J=k/2,L=m.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")t="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")t="y",y=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")t="x",v=h||1;var H=v+1,N=y+1;j/=v;var O=k/y;for(n=0;n<N;n++)for(k=0;k<H;k++){var B=new THREE.Vector3;B[a]=(k*j-C)*b;B[c]=(n*O-J)*f;B[t]=l;m.vertices.push(new THREE.Vertex(B))}for(n=0;n<y;n++)for(k=0;k<v;k++)m.faces.push(new THREE.Face4(k+H*n+
-L,k+H*(n+1)+L,k+1+H*(n+1)+L,k+1+H*n+L,null,null,o)),m.faceVertexUvs[0].push([new THREE.UV(k/v,n/y),new THREE.UV(k/v,(n+1)/y),new THREE.UV((k+1)/v,(n+1)/y),new THREE.UV((k+1)/v,n/y)])}THREE.Geometry.call(this);var m=this,o=a/2,n=b/2,t=c/2,j=j?-1:1;if(f!==void 0)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var y in k)this.sides[y]!=void 0&&(this.sides[y]=
-k[y]);this.sides.px&&l("z","y",1*j,-1,c,b,-o,this.materials[0]);this.sides.nx&&l("z","y",-1*j,-1,c,b,o,this.materials[1]);this.sides.py&&l("x","z",1*j,1,a,c,n,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,c,-n,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,b,t,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,b,-t,this.materials[5]);(function(){for(var a=[],c=[],b=0,f=m.vertices.length;b<f;b++){for(var e=m.vertices[b],g=!1,h=0,j=a.length;h<j;h++){var k=a[h];if(e.position.x==k.position.x&&
-e.position.y==k.position.y&&e.position.z==k.position.z){c[b]=h;g=!0;break}}if(!g)c[b]=a.length,a.push(new THREE.Vertex(e.position.clone()))}b=0;for(f=m.faces.length;b<f;b++)e=m.faces[b],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e.d=c[e.d];m.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,g,e,h){function f(a,c,b){j.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}THREE.Geometry.call(this);var j=this,k,l=Math.PI*2,m=g/2;for(k=0;k<a;k++)f(Math.sin(l*k/a)*b,Math.cos(l*k/a)*b,-m);for(k=0;k<a;k++)f(Math.sin(l*k/a)*c,Math.cos(l*k/a)*c,m);for(k=0;k<a;k++)j.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(c>0){f(0,0,-m-(h||0));for(k=a;k<a+a/2;k++)j.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(b>0){f(0,0,m+
-(e||0));for(k=a+a/2;k<2*a;k++)j.faces.push(new THREE.Face4(2*a+1,(2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a))}k=0;for(a=this.faces.length;k<a;k++){var b=[],c=this.faces[k],e=this.vertices[c.a],h=this.vertices[c.b],m=this.vertices[c.c],o=this.vertices[c.d];b.push(new THREE.UV(0.5+Math.atan2(e.position.x,e.position.y)/l,0.5+e.position.z/g));b.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/l,0.5+h.position.z/g));b.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/
-g));c instanceof THREE.Face4&&b.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/l,0.5+o.position.z/g));this.faceVertexUvs[0].push(b)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
-THREE.ExtrudeGeometry=function(a,b){function c(a,c,b){t.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function g(a,c,b){y?t.faces.push(new THREE.Face3(b,c,a)):t.faces.push(new THREE.Face3(a,c,b))}function e(a,c,b,f){y?t.faces.push(new THREE.Face4(f,b,c,a)):t.faces.push(new THREE.Face4(a,c,b,f))}var h=b.amount!==void 0?b.amount:100,f=b.bezelThickness!==void 0?b.bezelThickness:10,j=b.bezelEnabled!==void 0?b.bezelEnabled:!1,k=b.steps!==void 0?b.steps:1,l=b.path!==void 0?b.path:null,m,o=!1;
-if(l)m=l.getPoints(),k=m.length,o=!0;THREE.Geometry.call(this);var l=a.getPoints(),n=a.triangulate(),t=this,v=[],y=THREE.FontUtils.Triangulate.area(l)>0,u,w,x=l.length,p,z=n.length,A=v.length;for(u=0;u<x;u++)w=l[u],c(w.x,w.y,0);for(p=1;p<=k;p++)for(u=0;u<x;u++)w=l[u],o?c(w.x,w.y+m[p-1].y,m[p-1].x):c(w.x,w.y,h/k*p);if(j){for(u=0;u<A;u++)p=v[u],c(p.x,p.y,f);for(u=0;u<A;u++)p=v[u],c(p.x,p.y,h-f)}for(u=0;u<z;u++)p=n[u],g(p[2],p[1],p[0]);for(u=0;u<z;u++)p=n[u],g(p[0]+x*k,p[1]+x*k,p[2]+x*k);for(u=l.length;--u>=
-0;){h=u;f=u-1;f<0&&(f=l.length-1);for(p=0;p<k;p++)n=x*p,z=x*(p+1),e(h+n,f+n,f+z,h+z)}this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.IcosahedronGeometry=function(a){function b(a,c,b){var f=Math.sqrt(a*a+c*c+b*b);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/f,c/f,b/f)))-1}function c(a,c,b,f){f.faces.push(new THREE.Face3(a,c,b))}function g(a,c){var f=e.vertices[a].position,g=e.vertices[c].position;return b((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2)}var e=this,h=new THREE.Geometry,f;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
--a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(a=0;a<this.subdivisions;a++){f=new THREE.Geometry;for(var j in h.faces){var k=g(h.faces[j].a,h.faces[j].b),l=g(h.faces[j].b,h.faces[j].c),m=g(h.faces[j].c,h.faces[j].a);c(h.faces[j].a,k,m,f);c(h.faces[j].b,l,k,f);
-c(h.faces[j].c,m,l,f);c(k,l,m,f)}h.faces=f.faces}e.faces=h.faces;delete h;delete f;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],g=[],e=[],h=[],f=(new THREE.Matrix4).setRotationZ(b),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),c[j]=a[j].clone(),g[j]=this.vertices.length-1;for(var k=0;k<=this.angle+0.0010;k+=b){for(j=0;j<c.length;j++)k<this.angle?(c[j]=f.multiplyVector3(c[j].clone()),this.vertices.push(new THREE.Vertex(c[j])),e[j]=this.vertices.length-1):e=h;k==0&&(h=g);
-for(j=0;j<g.length-1;j++)this.faces.push(new THREE.Face4(e[j],e[j+1],g[j+1],g[j])),this.faceVertexUvs[0].push([new THREE.UV(1-k/this.angle,j/a.length),new THREE.UV(1-k/this.angle,(j+1)/a.length),new THREE.UV(1-(k-b)/this.angle,(j+1)/a.length),new THREE.UV(1-(k-b)/this.angle,j/a.length)]);g=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(a,b,c,g){THREE.Geometry.call(this);var e,h=a/2,f=b/2,c=c||1,g=g||1,j=c+1,k=g+1;a/=c;var l=b/g;for(e=0;e<k;e++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(e*l-f),0)));for(e=0;e<g;e++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+j*e,b+j*(e+1),b+1+j*(e+1),b+1+j*e)),this.faceVertexUvs[0].push([new THREE.UV(b/c,e/g),new THREE.UV(b/c,(e+1)/g),new THREE.UV((b+1)/c,(e+1)/g),new THREE.UV((b+1)/c,e/g)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.TrackballCamera=function(a){function c(a,b){return function(){b.apply(a,arguments)}}a=a||{};THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.domElement=a.domElement||document;this.screen=a.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=a.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=a.rotateSpeed||1;this.zoomSpeed=a.zoomSpeed||1.2;this.panSpeed=a.panSpeed||0.3;this.noZoom=a.noZoom||!1;this.noPan=a.noPan||
+!1;this.staticMoving=a.staticMoving||!1;this.dynamicDampingFactor=a.dynamicDampingFactor||0.2;this.minDistance=a.minDistance||0;this.maxDistance=a.maxDistance||Infinity;this.keys=a.keys||[65,83,68];this.useTarget=!0;var b=!1,f=this.STATE.NONE,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,l=new THREE.Vector2,m=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-
+this.screen.offsetLeft)/this.radius*0.5,(b-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var c=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-b)/this.radius,0),f=c.length();f>1?c.normalize():c.z=Math.sqrt(1-f*f);e=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(e).setLength(c.x));f.addSelf(e.setLength(c.z));return f};
+this.rotateCamera=function(){var a=Math.acos(g.dot(h)/g.length()/h.length());if(a){var b=(new THREE.Vector3).cross(g,h).normalize(),c=new THREE.Quaternion;a*=this.rotateSpeed;c.setFromAxisAngle(b,-a);c.multiplyVector3(e);c.multiplyVector3(this.up);c.multiplyVector3(h);this.staticMoving?g=h:(c.setFromAxisAngle(b,a*(this.dynamicDampingFactor-1)),c.multiplyVector3(g))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*this.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),this.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};
+this.panCamera=function(){var a=m.clone().subSelf(l);if(a.lengthSq()){a.multiplyScalar(e.length()*this.panSpeed);var b=e.clone().crossSelf(this.up).setLength(a.x);b.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(b);this.target.position.addSelf(b);this.staticMoving?l=m:l.addSelf(a.sub(m,l).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
+e.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,e.setLength(this.minDistance))};this.update=function(a,b,c){e=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,e);this.checkDistances();this.supr.update.call(this,a,b,c)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+c(this,function(a){b&&(g=h=this.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=this.getMouseOnScreen(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),b=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?h=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?k=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(m=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(a){a.preventDefault();
+a.stopPropagation();if(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?g=h=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?j=k=this.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=m=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(a){a.preventDefault();a.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(a){if(f===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])f=
+this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(b=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
+THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};
+THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b};THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheLengths&&this.cacheLengths.length==a)return this.cacheLengths;var c=[],b,f=this.getPoint(0),e,g=0;for(e=1;e<=a;e++)b=this.getPoint(e/a),g+=b.distanceTo(f),c.push(g),f=b;return this.cacheLengths=c};
+THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),f=0,e=b.length,g;for(g=c?c:a*b[e-1];f<e;){if(b[f]>g)break;f++}return f/e};THREE.LineCurve=function(a,c,b,f){this.x1=a;this.y1=c;this.x2=b;this.y2=f};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){return new THREE.Vector2(this.x1+(this.x2-this.x1)*a,this.y1+(this.y2-this.y1)*a)};
+THREE.QuadraticBezierCurve=function(a,c,b,f,e,g){this.x0=a;this.y0=c;this.x1=b;this.y1=f;this.x2=e;this.y2=g};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.FontUtils.b2(a,this.x0,this.x1,this.x2);a=THREE.FontUtils.b2(a,this.y0,this.y1,this.y2);return new THREE.Vector2(c,a)};
+THREE.QuadraticBezierCurve.prototype.getNormalVector=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.x0,this.x1,this.x2);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.y0,this.y1,this.y2);return(new THREE.Vector2(-a,c)).unit()};THREE.CubicBezierCurve=function(a,c,b,f,e,g,h,j){this.x0=a;this.y0=c;this.x1=b;this.y1=f;this.x2=e;this.y2=g;this.x3=h;this.y3=j};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
+THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.FontUtils.b3(a,this.x0,this.x1,this.x2,this.x3);a=THREE.FontUtils.b3(a,this.y0,this.y1,this.y2,this.y3);return new THREE.Vector2(c,a)};THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
+THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],f=this.points,e;e=(f.length-1)*a;a=Math.floor(e);e-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>f.length-2?a:a+1;b[3]=a>f.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(f[b[0]].x,f[b[1]].x,f[b[2]].x,f[b[3]].x,e);c.y=THREE.Curve.Utils.interpolate(f[b[0]].y,f[b[1]].y,f[b[2]].y,f[b[3]].y,e);return c};THREE.ArcCurve=function(a,c,b,f,e,g){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=f;this.aEndAngle=e;this.aClockwise=g};
+THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
+THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,f){return 2*(1-a)*(b-c)+2*a*(f-b)},tangentSpline:function(){},interpolate:function(a,c,b,f,e){var a=(b-a)*0.5,f=(f-c)*0.5,g=e*e;return(2*c-2*b+a+f)*e*g+(-3*c+3*b-2*a-f)*g+a*e+c}};THREE.Path=function(a){this.actions=[];this.curves=[];a&&this.fromPoints(a)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};
+THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var c,b=a.length;for(c=1;c<b;c++)this.lineTo(a[c].x,a[c].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
+THREE.Path.prototype.lineTo=function(a,c){var b=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.LineCurve(f[f.length-2],f[f.length-1],a,c);this.curves.push(f);this.actions.push({action:THREE.PathActions.LINE_TO,args:b,curve:f})};
+THREE.Path.prototype.quadraticCurveTo=function(a,c,b,f){var e=Array.prototype.slice.call(arguments),g=this.actions[this.actions.length-1].args,g=new THREE.QuadraticBezierCurve(g[g.length-2],g[g.length-1],a,c,b,f);this.curves.push(g);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e,curve:g})};
+THREE.Path.prototype.bezierCurveTo=function(a,c,b,f,e,g){var h=Array.prototype.slice.call(arguments),j=this.actions[this.actions.length-1].args,j=new THREE.CubicBezierCurve(j[j.length-2],j[j.length-1],a,c,b,f,e,g);this.curves.push(j);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:h,curve:j})};
+THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])],b=b.concat(a),b=new THREE.SplineCurve(b);this.curves.push(b);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c,curve:b})};
+THREE.Path.prototype.arc=function(a,c,b,f,e,g){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,f,e,g));this.actions.push({action:THREE.PathActions.ARC,args:h})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
+THREE.Path.prototype.getPoints=function(a){var a=a||12,c=[],b,f,e,g,h,j,k,l,m,n,o,p,v;b=0;for(f=this.actions.length;b<f;b++)switch(e=this.actions[b],g=e.action,e=e.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];j=e[3];m=e[0];n=e[1];c.length>0?(g=c[c.length-1],o=g.x,p=g.y):(g=this.actions[b-1].args,o=g[g.length-2],p=g[g.length-1]);for(g=1;g<=a;g++)v=g/a,e=THREE.FontUtils.b2(v,o,m,h),v=THREE.FontUtils.b2(v,p,n,j),c.push(new THREE.Vector2(e,
+v));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];j=e[5];m=e[0];n=e[1];k=e[2];l=e[3];c.length>0?(g=c[c.length-1],o=g.x,p=g.y):(g=this.actions[b-1].args,o=g[g.length-2],p=g[g.length-1]);for(g=1;g<=a;g++)v=g/a,e=THREE.FontUtils.b3(v,o,m,k,h),v=THREE.FontUtils.b3(v,p,n,l,j),c.push(new THREE.Vector2(e,v));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[b-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];v=a*e[0].length;g=g.concat(e[0]);e=new THREE.SplineCurve(g);for(g=1;g<=v;g++)c.push(e.getPointAt(g/
+v));break;case THREE.PathActions.ARC:g=this.actions[b-1].args;h=e[0];j=e[1];k=e[2];m=e[3];v=e[4];n=!!e[5];l=g[g.length-2];o=g[g.length-1];g.length==0&&(l=o=0);p=v-m;var w=a*2;for(g=1;g<=w;g++)v=g/w,n||(v=1-v),v=m+v*p,e=l+h+k*Math.cos(v),v=o+j+k*Math.sin(v),c.push(new THREE.Vector2(e,v))}return c};
+THREE.Path.prototype.getMinAndMax=function(){var a=this.getPoints(),c,b,f,e;c=b=Number.NEGATIVE_INFINITY;f=e=Number.POSITIVE_INFINITY;var g,h,j;h=0;for(j=a.length;h<j;h++){g=a[h];if(g.x>c)c=g.x;else if(g.x<f)f=g.x;if(g.y>b)b=g.y;else if(g.y<b)e=g.y}return{minX:f,minY:e,maxX:c,maxY:b}};THREE.Path.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.sums,a=0;a<b.length;){if(b[a]>=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};
+THREE.Path.prototype.getLength=function(){var a=[],c=0,b,f=this.curves.length;for(b=0;b<f;b++)c+=this.curves[b].getLength(),a.push(c);this.sums=a;return c};
+THREE.Path.prototype.createPathGeometry=function(a,c){var b=this.getPoints(a),f,e=new THREE.Object3D;c||(c=new THREE.LineBasicMaterial({color:0,opacity:0.7}));for(var g=1;g<b.length;g++)f=new THREE.Geometry,f.vertices.push(new THREE.Vertex(new THREE.Vector3(b[g-1].x,b[g-1].y,0))),f.vertices.push(new THREE.Vertex(new THREE.Vector3(b[g].x,b[g].y,0))),f=new THREE.Line(f,c),e.addChild(f);return e};
+THREE.Path.prototype.transform=function(a){a=new THREE.Path;a.moveTo(0,0);a.quadraticCurveTo(100,20,140,80);console.log(a.cacheArcLengths());var c=this.getMinAndMax(),b=this.getPoints(),f,e,g,h,j,k;f=0;for(e=b.length;f<e;f++)g=b[f],h=g.x,j=g.y,k=h/c.maxX,h=a.getPoint(k),j=a.getNormalVector(k).multiplyScalar(j),g.x=h.x+j.x,g.y=h.y+j.y;return b};
+THREE.Path.prototype.nltransform=function(a,c,b,f,e,g){var h=this.getPoints(),j,k,l,m,n;j=0;for(k=h.length;j<k;j++)l=h[j],m=l.x,n=l.y,l.x=a*m+c*n+b,l.y=f*n+e*m+g;return h};
+THREE.Path.prototype.debug=function(a){var c=this.getMinAndMax();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,f,e,a=0;for(b=this.actions.length;a<b;a++)f=this.actions[a],e=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,e);c.stroke();c.closePath();c.strokeStyle="red";f=this.transform(0.866,
+-0.866,0,0.5,0.5,-50);a=0;for(b=f.length;a<b;a++)e=f[a],c.beginPath(),c.arc(e.x,e.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
+THREE.Shape.prototype.getHoles=function(a){var a=a?"getSpacedPoints":"getPoints",c,b=this.holes.length,f=[];for(c=0;c<b;c++)f[c]=this.holes[c][a]();return f};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this[a?"getSpacedPoints":"getPoints"](),holes:this.getHoles(a)}};
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),f=b.concat(),e,g,h,j,k,l,m,n,o,p,v=[];for(k=0;k<c.length;k++){l=c[k];f=f.concat(l);g=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){o=l[e];p=[];for(n=0;n<b.length;n++)m=b[n],m=o.distanceTo(m),p.push(m),m<g&&(g=m,h=e,j=n)}e=j-1>=0?j-1:b.length-1;g=h-1>=0?h-1:l.length-1;var w=[l[h],b[j],b[e]];n=THREE.FontUtils.Triangulate.area(w);var x=[l[h],l[g],b[j]];o=THREE.FontUtils.Triangulate.area(x);p=j;m=h;j+=1;h+=-1;j<0&&(j+=b.length);j%=b.length;
+h<0&&(h+=l.length);h%=l.length;e=j-1>=0?j-1:b.length-1;g=h-1>=0?h-1:l.length-1;w=[l[h],b[j],b[e]];w=THREE.FontUtils.Triangulate.area(w);x=[l[h],l[g],b[j]];x=THREE.FontUtils.Triangulate.area(x);n+o>w+x&&(j=p,h=m,j<0&&(j+=b.length),j%=b.length,h<0&&(h+=l.length),h%=l.length,e=j-1>=0?j-1:b.length-1,g=h-1>=0?h-1:l.length-1);n=b.slice(0,j);o=b.slice(j);p=l.slice(h);m=l.slice(0,h);g=[l[h],l[g],b[j]];v.push([l[h],b[j],b[e]]);v.push(g);b=n.concat(p).concat(m).concat(o)}return{shape:b,isolatedPts:v,allpoints:f}},
+triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),f=b.allpoints,e=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),g,h,j,k;for(g=0;g<b.length;g++){k=b[g];for(h=0;h<3;h++)for(j=0;j<f.length;j++)f[j].equals(k[h])&&(k[h]=j)}for(g=0;g<e.length;g++){k=e[g];for(h=0;h<3;h++)for(j=0;j<f.length;j++)f[j].equals(k[h])&&(k[h]=j)}return b.concat(e)},isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0}};
+THREE.CubeGeometry=function(a,c,b,f,e,g,h,j,k){function l(a,b,c,h,j,k,l,n){var p,o,v=f||1,w=e||1,F=j/2,L=k/2,N=m.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")p="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")p="y",w=g||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")p="x",v=g||1;var M=v+1,O=w+1;j/=v;var Q=k/w;for(o=0;o<O;o++)for(k=0;k<M;k++){var E=new THREE.Vector3;E[a]=(k*j-F)*c;E[b]=(o*Q-L)*h;E[p]=l;m.vertices.push(new THREE.Vertex(E))}for(o=0;o<w;o++)for(k=0;k<v;k++)m.faces.push(new THREE.Face4(k+M*o+
+N,k+M*(o+1)+N,k+1+M*(o+1)+N,k+1+M*o+N,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(k/v,o/w),new THREE.UV(k/v,(o+1)/w),new THREE.UV((k+1)/v,(o+1)/w),new THREE.UV((k+1)/v,o/w)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,p=b/2,j=j?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var w in k)this.sides[w]!=void 0&&(this.sides[w]=
+k[w]);this.sides.px&&l("z","y",1*j,-1,b,c,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*j,-1,b,c,n,this.materials[1]);this.sides.py&&l("x","z",1*j,1,a,b,o,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,b,-o,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,c,p,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,c,-p,this.materials[5]);(function(){for(var a=[],b=[],c=0,f=m.vertices.length;c<f;c++){for(var g=m.vertices[c],e=!1,h=0,j=a.length;h<j;h++){var k=a[h];if(g.position.x==k.position.x&&
+g.position.y==k.position.y&&g.position.z==k.position.z){b[c]=h;e=!0;break}}if(!e)b[c]=a.length,a.push(new THREE.Vertex(g.position.clone()))}c=0;for(f=m.faces.length;c<f;c++)g=m.faces[c],g.a=b[g.a],g.b=b[g.b],g.c=b[g.c],g.d=b[g.d];m.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,f,e,g){function h(a,b,c){j.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}THREE.Geometry.call(this);var j=this,k,l=Math.PI*2,m=f/2;for(k=0;k<a;k++)h(Math.sin(l*k/a)*c,Math.cos(l*k/a)*c,-m);for(k=0;k<a;k++)h(Math.sin(l*k/a)*b,Math.cos(l*k/a)*b,m);for(k=0;k<a;k++)j.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(b>0){h(0,0,-m-(g||0));for(k=a;k<a+a/2;k++)j.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(c>0){h(0,0,m+
+(e||0));for(k=a+a/2;k<2*a;k++)j.faces.push(new THREE.Face4(2*a+1,(2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a))}k=0;for(a=this.faces.length;k<a;k++){var c=[],b=this.faces[k],e=this.vertices[b.a],g=this.vertices[b.b],m=this.vertices[b.c],n=this.vertices[b.d];c.push(new THREE.UV(0.5+Math.atan2(e.position.x,e.position.y)/l,0.5+e.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/l,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/
+f));b instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/l,0.5+n.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.ExtrudeGeometry=function(a,c){function b(a,b,c,f){vectorFromCentroid=a.clone().subSelf(b);adj=c/vectorFromCentroid.length();f?adj+=1:adj=1-adj;return vectorFromCentroid.multiplyScalar(adj).addSelf(b)}function f(a){for(D=a.length;--D>=0;){N=D;M=D-1;M<0&&(M=a.length-1);for(var b=0;b<n+m*2;b++){var c=F*b,f=F*(b+1);A.faces.push(new THREE.Face4(O+N+c,O+M+c,O+M+f,O+N+f))}}}function e(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){A.faces.push(new THREE.Face3(a,
+b,c))}var h=c.amount!==void 0?c.amount:100,j=c.bevelThickness!==void 0?c.bevelThickness:8,k=c.bevelSize!==void 0?c.bevelSize:j,l=c.bevelEnabled!==void 0?c.bevelEnabled:!0,m=c.bevelSegments!==void 0?c.bevelSegments:3;l||(m=0);var n=c.steps!==void 0?c.steps:1,o=c.path!==void 0?c.path:null,p,v=!1;if(o)p=o.getPoints(),n=p.length,v=!0;THREE.Geometry.call(this);var w,x,y,A=this,o=a.extractAllPoints(!1),u=o.shape,o=o.holes,B=!THREE.Shape.Utils.isClockWise(u);if(B){u=u.reverse();x=0;for(y=o.length;x<y;x++)w=
+o[x],THREE.Shape.Utils.isClockWise(w)&&(o[x]=w.reverse());B=!1}var B=THREE.Shape.Utils.triangulateShape(u,o),C=u;x=0;for(y=o.length;x<y;x++)w=o[x],u=u.concat(w);var H,J=new THREE.Vector2,K,I,D=0;for(il=C.length;D<il;D++)J.addSelf(C[D]);K=J.divideScalar(C.length);I=[];x=0;for(y=o.length;x<y;x++){J=new THREE.Vector2;w=o[x];D=0;for(il=w.length;D<il;D++)J.addSelf(w[D]);I[x]=J.divideScalar(w.length)}var D,G,F=u.length,J=B.length,L;for(H=m;H>0;H--){t=H/m;z=j*t;L=k*(1-Math.sin((1-t)*Math.PI/2));D=0;for(il=
+C.length;D<il;D++)G=b(C[D],K,L,!1),e(G.x,G.y,-z);x=0;for(y=o.length;x<y;x++){w=o[x];D=0;for(il=w.length;D<il;D++)G=b(w[D],I[x],L,!0),e(G.x,G.y,-z)}}for(D=0;D<F;D++)G=u[D],v?e(G.x,G.y+p[0].y,p[0].x):e(G.x,G.y,0);for(w=1;w<=n;w++)for(D=0;D<F;D++)G=u[D],v?e(G.x,G.y+p[w-1].y,p[w-1].x):e(G.x,G.y,h/n*w);for(H=1;H<=m;H++){t=H/m;z=j*t;L=k*(1-Math.sin((1-t)*Math.PI/2));D=0;for(il=C.length;D<il;D++)G=b(C[D],K,L,!1),e(G.x,G.y,h+z);x=0;for(y=o.length;x<y;x++){w=o[x];D=0;for(il=w.length;D<il;D++)G=b(w[D],I[x],
+L,!0),v?e(G.x,G.y+p[n-1].y,p[n-1].x+z):e(G.x,G.y,h+z)}}if(l){j=F*0;for(D=0;D<J;D++)h=B[D],g(h[2]+j,h[1]+j,h[0]+j);j=F*(n+m*2);for(D=0;D<J;D++)h=B[D],g(h[0]+j,h[1]+j,h[2]+j)}else{for(D=0;D<J;D++)h=B[D],g(h[2],h[1],h[0]);for(D=0;D<J;D++)h=B[D],g(h[0]+F*n,h[1]+F*n,h[2]+F*n)}var N,M,O=0;f(C);O+=C.length;x=0;for(y=o.length;x<y;x++)w=o[x],f(w),O+=w.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+THREE.IcosahedronGeometry=function(a){function c(a,b,c){var f=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/f,b/f,c/f)))-1}function b(a,b,c,f){f.faces.push(new THREE.Face3(a,b,c))}function f(a,b){var f=e.vertices[a].position,g=e.vertices[b].position;return c((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
+-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=f(g.faces[j].a,g.faces[j].b),l=f(g.faces[j].b,g.faces[j].c),m=f(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,k,m,h);b(g.faces[j].b,l,k,h);
+b(g.faces[j].c,m,l,h);b(k,l,m,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],f=[],e=[],g=[],h=(new THREE.Matrix4).setRotationZ(c),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),b[j]=a[j].clone(),f[j]=this.vertices.length-1;for(var k=0;k<=this.angle+0.0010;k+=c){for(j=0;j<b.length;j++)k<this.angle?(b[j]=h.multiplyVector3(b[j].clone()),this.vertices.push(new THREE.Vertex(b[j])),e[j]=this.vertices.length-1):e=g;k==0&&(g=f);
+for(j=0;j<f.length-1;j++)this.faces.push(new THREE.Face4(e[j],e[j+1],f[j+1],f[j])),this.faceVertexUvs[0].push([new THREE.UV(1-k/this.angle,j/a.length),new THREE.UV(1-k/this.angle,(j+1)/a.length),new THREE.UV(1-(k-c)/this.angle,(j+1)/a.length),new THREE.UV(1-(k-c)/this.angle,j/a.length)]);f=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
+THREE.PlaneGeometry=function(a,c,b,f){THREE.Geometry.call(this);var e,g=a/2,h=c/2,b=b||1,f=f||1,j=b+1,k=f+1;a/=b;var l=c/f;for(e=0;e<k;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*l-h),0)));for(e=0;e<f;e++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e)),this.faceVertexUvs[0].push([new THREE.UV(c/b,e/f),new THREE.UV(c/b,(e+1)/f),new THREE.UV((c+1)/b,(e+1)/f),new THREE.UV((c+1)/b,e/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,g,e=Math.PI,h=Math.max(3,b||8),f=Math.max(2,c||6),b=[],c=0;c<f+1;c++){g=c/f;var j=a*Math.cos(g*e),k=a*Math.sin(g*e),l=[],m=0;for(g=0;g<h;g++){var o=2*g/h,n=k*Math.sin(o*e),o=k*Math.cos(o*e);(c==0||c==f)&&g>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,j,n)))-1);l.push(m)}b.push(l)}for(var t,v,y,e=b.length,c=0;c<e;c++)if(h=b[c].length,c>0)for(g=0;g<h;g++){l=g==h-1;f=b[c][l?0:g+1];j=b[c][l?h-1:g];k=b[c-1][l?
-h-1:g];l=b[c-1][l?0:g+1];n=c/(e-1);t=(c-1)/(e-1);v=(g+1)/h;var o=g/h,m=new THREE.UV(1-v,n),n=new THREE.UV(1-o,n),o=new THREE.UV(1-o,t),u=new THREE.UV(1-v,t);c<b.length-1&&(t=this.vertices[f].position.clone(),v=this.vertices[j].position.clone(),y=this.vertices[k].position.clone(),t.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(f,j,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([m,n,o]));c>1&&(t=
-this.vertices[f].position.clone(),v=this.vertices[k].position.clone(),y=this.vertices[l].position.clone(),t.normalize(),v.normalize(),y.normalize(),this.faces.push(new THREE.Face3(f,k,l,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([m,o,u]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
-THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(a,b){THREE.Geometry.call(this);this.parameters=b||{};this.set(a)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
-THREE.TextGeometry.prototype.set=function(a,b){function c(a,c,b){v.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function g(a,c,b,f){v.faces.push(new THREE.Face4(a,c,b,f))}this.text=a;var b=b||this.parameters,e=b.height!==void 0?b.height:50,h=b.curveSegments!==void 0?b.curveSegments:4,f=b.font!==void 0?b.font:"helvetiker",j=b.weight!==void 0?b.weight:"normal",k=b.style!==void 0?b.style:"normal",l=b.bezelThickness!==void 0?b.bezelThickness:10,m=b.bezelSize!==void 0?b.bezelSize:8,o=b.bezelEnabled!==
-void 0?b.bezelEnabled:!1;THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=f;THREE.FontUtils.weight=j;THREE.FontUtils.style=k;THREE.FontUtils.bezelSize=m;var j=THREE.FontUtils.drawText(a),h=j.points,n=j.faces,f=j.contour,t=j.bezel,v=this;v.vertices=[];v.faces=[];for(var y,k=h.length,u=n.length,m=t.length,j=0;j<k;j++)y=h[j],c(y.x,y.y,0);for(j=0;j<k;j++)y=h[j],c(y.x,y.y,e);if(o){for(j=0;j<m;j++)y=t[j],c(y.x,y.y,l);for(j=0;j<m;j++)y=t[j],c(y.x,y.y,e-l)}for(j=
-0;j<u;j++)e=n[j],v.faces.push(new THREE.Face3(e[2],e[1],e[0]));for(j=0;j<u;j++)e=n[j],v.faces.push(new THREE.Face3(e[0]+k,e[1]+k,e[2]+k));var w;if(o)for(j=t.length;--j>0;){if(w){if(w.equals(f[j])){w=null;continue}}else w=f[j];l=k*2+j;n=l-1;g(l,n,n+m,l+m);for(o=0;o<k;o++)if(h[o].equals(f[j]))break;for(e=0;e<k;e++)if(h[e].equals(f[j-1]))break;g(o,e,n,l);g(l+m,n+m,e+k,o+k)}else for(j=f.length;--j>0;){if(w){if(w.equals(f[j])){w=null;continue}}else w=f[j];for(o=0;o<k;o++)if(h[o].equals(f[j]))break;for(e=
-0;e<k;e++)if(h[e].equals(f[j-1]))break;g(o,e,e+k,o+k)}this.computeCentroids();this.computeFaceNormals()};
-THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},extractPoints:function(a,b){if(a.length<3)return console.log("not valid polygon"),
-{points:a,faces:[]};for(var c,g,e,h,f,j=[],k=0;k<b.length;k++){f=b[k];h=[];for(c=0;c<f.length;c++)g=f[c],h.push(g.x+","+g.y);var l;c=h.slice(1).indexOf(h[0]);var m=this.Triangulate.area(f.slice(0,c+1))<0;g=[];for(c=-1;c<h.length;){l=c+1;c=h[l];c=h.slice(l+1).indexOf(c)+l;if(c<=l)break;var o=f.slice(l,c+1);m?this.Triangulate.area(o)<0?(l>0&&j.push({shape:e,holes:g}),e=o,g=[]):g.push(o):this.Triangulate.area(o)<0?(j.push({shape:o,holes:g}),g=[]):g.push(o);c++}m&&j.push({shape:e,holes:g})}var n,t,v,
-y,u,w;h=[];for(f=0;f<j.length;f++){k=j[f];e=k.shape;g=k.holes;for(l=0;l<g.length;l++){m=g[l];v=Number.POSITIVE_INFINITY;for(o=0;o<m.length;o++){u=m[o];for(c=0;c<e.length;c++)y=e[c],y=u.distanceTo(y),y<v&&(v=y,n=o,t=c)}c=t-1>=0?t-1:e.length-1;var o=n-1>=0?n-1:m.length-1,x=[];x.push(m[n]);x.push(e[t]);x.push(e[c]);v=this.Triangulate.area(x);var p=[];p.push(m[n]);p.push(m[o]);p.push(e[t]);u=this.Triangulate.area(p);y=t;w=n;t+=1;n+=-1;t<0&&(t+=e.length);t%=e.length;n<0&&(n+=m.length);n%=e.length;c=t-
-1>=0?t-1:e.length-1;o=n-1>=0?n-1:m.length-1;x=[];x.push(m[n]);x.push(e[t]);x.push(e[c]);x=this.Triangulate.area(x);p=[];p.push(m[n]);p.push(m[o]);p.push(e[t]);p=this.Triangulate.area(p);v+u>x+p&&(t=y,n=w,t<0&&(t+=e.length),t%=e.length,n<0&&(n+=m.length),n%=e.length,c=t-1>=0?t-1:e.length-1,o=n-1>=0?n-1:m.length-1);v=e.slice(0,t);u=e.slice(t);y=m.slice(n);w=m.slice(0,n);h.push(m[n]);h.push(e[t]);h.push(e[c]);h.push(m[n]);h.push(m[o]);h.push(e[t]);e=v.concat(y).concat(w).concat(u)}k.shape=e}n=[];t=[];
-for(f=l=0;f<j.length;f++){k=j[f];e=k.shape;n=n.concat(e);m=THREE.FontUtils.Triangulate(e,!0);for(g=0;g<m.length;g++)k=m[g],k[0]+=l,k[1]+=l,k[2]+=l;t=t.concat(m);l+=e.length}var z;for(g=0;g<h.length/3;g++){k=[];for(j=0;j<3;j++){f=!1;for(e=0;e<n.length&&!f;e++)z=g*3+j,n[e].equals(h[z])&&(k.push(e),f=!0);f||(n.push(h[z]),k.push(n.length-1),console.log("not found"))}t.push(k)}return{points:n,faces:t}},drawText:function(a){var b=[],c=[],g,e=this.getFace(),h=this.size/e.resolution,f=0;g=String(a).split("");
-for(var j=g.length,k=[],a=0;a<j;a++){var l=this.extractGlyphPoints(g[a],e,h,f);f+=l.offset;b.push(l.points);c=c.concat(l.points);k.push(l.path)}a=f/2;for(g=0;g<c.length;g++)c[g].x-=a;b=this.extractPoints(c,b);b.contour=c;e=[];h=[];g=[];for(var f=[],j=new THREE.Vector2,m,a=c.length;--a>=0;){if(m){if(m.equals(c[a])){m=null;k=this.Triangulate.area(g)>0;f.push(k);h.push(j.divideScalar(g.length));g=[];j=new THREE.Vector2;continue}}else m=c[a];j.addSelf(c[a]);g.push(c[a])}a=c.length;for(g=0;--a>=0;)k=c[a],
-j=h[g],k=k.clone().subSelf(j),l=this.bezelSize/k.length(),f[g]?l+=1:l=1-l,l=k.multiplyScalar(l).addSelf(j),e.unshift(l),m?m.equals(c[a])&&(m=null,g++):m=c[a];b.bezel=e;return b},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,g){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,g)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,
-b){return a*a*a*b},b3:function(a,b,c,g,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,g)+this.b3p3(a,e)},extractGlyphPoints:function(a,b,c,g){var e=[],h=new THREE.Path,f,j,k,l,m,o,n,t,v,y,u=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=b.length;for(a=0;a<k;)switch(j=b[a++],j){case "m":j=b[a++]*c+g;l=b[a++]*c;e.push(new THREE.Vector2(j,l));h.moveTo(j,l);break;case "l":j=b[a++]*c+g;l=b[a++]*c;e.push(new THREE.Vector2(j,
-l));h.lineTo(j,l);break;case "q":j=b[a++]*c+g;l=b[a++]*c;n=b[a++]*c+g;t=b[a++]*c;h.quadraticCurveTo(n,t,j,l);if(f=e[e.length-1]){m=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var w=f/divisions,x=THREE.FontUtils.b2(w,m,n,j),w=THREE.FontUtils.b2(w,o,t,l);e.push(new THREE.Vector2(x,w))}}break;case "b":if(j=b[a++]*c+g,l=b[a++]*c,n=b[a++]*c+g,t=b[a++]*-c,v=b[a++]*c+g,y=b[a++]*-c,h.quadraticCurveTo(j,l,n,t,v,y),f=e[e.length-1]){m=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)w=
-f/divisions,x=THREE.FontUtils.b3(w,m,n,v,j),w=THREE.FontUtils.b3(w,o,t,y,l),e.push(new THREE.Vector2(x,w))}}}h.debug(document.getElementById("boo"));console.log(h);return{offset:u.ha*c,points:e,path:h}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,h=b-1,f=0;f<b;h=f++)e+=a[h].x*a[f].y-a[f].x*a[h].y;return e*0.5};a.Triangulate=function(a,g){var e=a.length;if(e<3)return null;var h=[],f=[],j=[],k,l,m;if(b(a)>0)for(l=0;l<e;l++)f[l]=l;else for(l=0;l<e;l++)f[l]=e-1-l;var o=2*e;for(l=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(g)return j;return h}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);m=l+1;e<=m&&(m=0);var n;a:{n=a;var t=k,v=l,y=m,u=e,w=f,x=void 0,p=void 0,z=void 0,
-A=void 0,E=void 0,F=void 0,G=void 0,D=void 0,K=void 0,p=n[w[t]].x,z=n[w[t]].y,A=n[w[v]].x,E=n[w[v]].y,F=n[w[y]].x,G=n[w[y]].y;if(1.0E-10>(A-p)*(G-z)-(E-z)*(F-p))n=!1;else{for(x=0;x<u;x++)if(!(x==t||x==v||x==y)){var D=n[w[x]].x,K=n[w[x]].y,I=void 0,C=void 0,J=void 0,L=void 0,H=void 0,N=void 0,O=void 0,B=void 0,P=void 0,M=void 0,R=void 0,S=void 0,I=J=H=void 0,I=F-A,C=G-E,J=p-F,L=z-G,H=A-p,N=E-z,O=D-p,B=K-z,P=D-A,M=K-E,R=D-F,S=K-G,I=I*M-C*P,H=H*B-N*O,J=J*S-L*R;if(I>=0&&J>=0&&H>=0){n=!1;break a}}n=!0}}if(n){o=
-f[k];n=f[l];t=f[m];h.push(a[o]);h.push(a[n]);h.push(a[t]);j.push([f[k],f[l],f[m]]);k=l;for(m=l+1;m<e;k++,m++)f[k]=f[m];e--;o=2*e}}if(g)return j;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
-THREE.TorusGeometry=function(a,b,c,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=g||6;a=[];for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){var g=c/this.segmentsT*2*Math.PI,e=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(g),(this.radius+this.tube*Math.cos(e))*Math.sin(g),this.tube*Math.sin(e))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
-1;c<=this.segmentsT;++c){var g=(this.segmentsT+1)*b+c,e=(this.segmentsT+1)*b+c-1,h=(this.segmentsT+1)*(b-1)+c-1,f=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(g,e,h,f));this.faceVertexUvs[0].push([new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[f][0],a[f][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,f,e=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6),c=[],b=0;b<h+1;b++){f=b/h;var j=a*Math.cos(f*e),k=a*Math.sin(f*e),l=[],m=0;for(f=0;f<g;f++){var n=2*f/g,o=k*Math.sin(n*e),n=k*Math.cos(n*e);(b==0||b==h)&&f>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,o)))-1);l.push(m)}c.push(l)}for(var p,v,w,e=c.length,b=0;b<e;b++)if(g=c[b].length,b>0)for(f=0;f<g;f++){l=f==g-1;h=c[b][l?0:f+1];j=c[b][l?g-1:f];k=c[b-1][l?
+g-1:f];l=c[b-1][l?0:f+1];o=b/(e-1);p=(b-1)/(e-1);v=(f+1)/g;var n=f/g,m=new THREE.UV(1-v,o),o=new THREE.UV(1-n,o),n=new THREE.UV(1-n,p),x=new THREE.UV(1-v,p);b<c.length-1&&(p=this.vertices[h].position.clone(),v=this.vertices[j].position.clone(),w=this.vertices[k].position.clone(),p.normalize(),v.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([m,o,n]));b>1&&(p=
+this.vertices[h].position.clone(),v=this.vertices[k].position.clone(),w=this.vertices[l].position.clone(),p.normalize(),v.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,k,l,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([m,n,x]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(a,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(a)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
+THREE.TextGeometry.prototype.set=function(a,c){function b(a,b,c){v.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c,f){v.faces.push(new THREE.Face4(a,b,c,f))}this.text=a;var c=c||this.parameters,e=c.height!==void 0?c.height:50,g=c.curveSegments!==void 0?c.curveSegments:4,h=c.font!==void 0?c.font:"helvetiker",j=c.weight!==void 0?c.weight:"normal",k=c.style!==void 0?c.style:"normal",l=c.bezelThickness!==void 0?c.bezelThickness:10,m=c.bezelSize!==void 0?c.bezelSize:8,n=c.bezelEnabled!==
+void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=g;THREE.FontUtils.face=h;THREE.FontUtils.weight=j;THREE.FontUtils.style=k;THREE.FontUtils.bezelSize=m;var j=THREE.FontUtils.drawText(a),g=j.points,o=j.faces,h=j.contour,p=j.bezel,v=this;v.vertices=[];v.faces=[];for(var w,k=g.length,x=o.length,m=p.length,j=0;j<k;j++)w=g[j],b(w.x,w.y,0);for(j=0;j<k;j++)w=g[j],b(w.x,w.y,e);if(n){for(j=0;j<m;j++)w=p[j],b(w.x,w.y,l);for(j=0;j<m;j++)w=p[j],b(w.x,w.y,e-l)}for(j=
+0;j<x;j++)e=o[j],v.faces.push(new THREE.Face3(e[2],e[1],e[0]));for(j=0;j<x;j++)e=o[j],v.faces.push(new THREE.Face3(e[0]+k,e[1]+k,e[2]+k));var y;if(n)for(j=p.length;--j>0;){if(y){if(y.equals(h[j])){y=null;continue}}else y=h[j];l=k*2+j;o=l-1;f(l,o,o+m,l+m);for(n=0;n<k;n++)if(g[n].equals(h[j]))break;for(e=0;e<k;e++)if(g[e].equals(h[j-1]))break;f(n,e,o,l);f(l+m,o+m,e+k,n+k)}else for(j=h.length;--j>0;){if(y){if(y.equals(h[j])){y=null;continue}}else y=h[j];for(n=0;n<k;n++)if(g[n].equals(h[j]))break;for(e=
+0;e<k;e++)if(g[e].equals(h[j-1]))break;f(n,e,e+k,n+k)}this.computeCentroids();this.computeFaceNormals()};
+THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},extractPoints:function(a,c){if(a.length<3)return console.log("not valid polygon"),
+{points:a,faces:[]};for(var b,f,e,g,h,j=[],k=0;k<c.length;k++){h=c[k];g=[];for(b=0;b<h.length;b++)f=h[b],g.push(f.x+","+f.y);var l;b=g.slice(1).indexOf(g[0]);var m=this.Triangulate.area(h.slice(0,b+1))<0;f=[];for(b=-1;b<g.length;){l=b+1;b=g[l];b=g.slice(l+1).indexOf(b)+l;if(b<=l)break;var n=h.slice(l,b+1);m?this.Triangulate.area(n)<0?(l>0&&j.push({shape:e,holes:f}),e=n,f=[]):f.push(n):this.Triangulate.area(n)<0?(j.push({shape:n,holes:f}),f=[]):f.push(n);b++}m&&j.push({shape:e,holes:f})}var o,p,v,
+w,x,y;g=[];for(h=0;h<j.length;h++){k=j[h];e=k.shape;f=k.holes;for(l=0;l<f.length;l++){m=f[l];v=Number.POSITIVE_INFINITY;for(n=0;n<m.length;n++){x=m[n];for(b=0;b<e.length;b++)w=e[b],w=x.distanceTo(w),w<v&&(v=w,o=n,p=b)}b=p-1>=0?p-1:e.length-1;var n=o-1>=0?o-1:m.length-1,A=[];A.push(m[o]);A.push(e[p]);A.push(e[b]);v=this.Triangulate.area(A);var u=[];u.push(m[o]);u.push(m[n]);u.push(e[p]);x=this.Triangulate.area(u);w=p;y=o;p+=1;o+=-1;p<0&&(p+=e.length);p%=e.length;o<0&&(o+=m.length);o%=e.length;b=p-
+1>=0?p-1:e.length-1;n=o-1>=0?o-1:m.length-1;A=[];A.push(m[o]);A.push(e[p]);A.push(e[b]);A=this.Triangulate.area(A);u=[];u.push(m[o]);u.push(m[n]);u.push(e[p]);u=this.Triangulate.area(u);v+x>A+u&&(p=w,o=y,p<0&&(p+=e.length),p%=e.length,o<0&&(o+=m.length),o%=e.length,b=p-1>=0?p-1:e.length-1,n=o-1>=0?o-1:m.length-1);v=e.slice(0,p);x=e.slice(p);w=m.slice(o);y=m.slice(0,o);g.push(m[o]);g.push(e[p]);g.push(e[b]);g.push(m[o]);g.push(m[n]);g.push(e[p]);e=v.concat(w).concat(y).concat(x)}k.shape=e}o=[];p=[];
+for(h=l=0;h<j.length;h++){k=j[h];e=k.shape;o=o.concat(e);m=THREE.FontUtils.Triangulate(e,!0);for(f=0;f<m.length;f++)k=m[f],k[0]+=l,k[1]+=l,k[2]+=l;p=p.concat(m);l+=e.length}var B;for(f=0;f<g.length/3;f++){k=[];for(j=0;j<3;j++){h=!1;for(e=0;e<o.length&&!h;e++)B=f*3+j,o[e].equals(g[B])&&(k.push(e),h=!0);h||(o.push(g[B]),k.push(o.length-1),console.log("not found"))}p.push(k)}return{points:o,faces:p}},drawText:function(a){var c=[],b=[],f,e=this.getFace(),g=this.size/e.resolution,h=0;f=String(a).split("");
+for(var j=f.length,k=new THREE.Path,a=0;a<j;a++){var l=this.extractGlyphPoints(f[a],e,g,h,k);h+=l.offset;c.push(l.points);b=b.concat(l.points)}console.log(k);a=h/2;for(f=0;f<b.length;f++)b[f].x-=a;c=this.extractPoints(b,c);c.contour=b;e=[];g=[];f=[];for(var h=[],j=new THREE.Vector2,m,a=b.length;--a>=0;){if(m){if(m.equals(b[a])){m=null;k=this.Triangulate.area(f)>0;h.push(k);g.push(j.divideScalar(f.length));f=[];j=new THREE.Vector2;continue}}else m=b[a];j.addSelf(b[a]);f.push(b[a])}a=b.length;for(f=
+0;--a>=0;)k=b[a],j=g[f],k=k.clone().subSelf(j),l=this.bezelSize/k.length(),h[f]?l+=1:l=1-l,l=k.multiplyScalar(l).addSelf(j),e.unshift(l),m?m.equals(b[a])&&(m=null,f++):m=b[a];c.bezel=e;return c},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,f){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,f)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*
+(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,f,e){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,f)+this.b3p3(a,e)},extractGlyphPoints:function(a,c,b,f,e){var g=[],h,j,k,l,m,n,o,p,v,w,x=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(x){if(x.o){c=x._cachedOutline||(x._cachedOutline=x.o.split(" "));k=c.length;for(a=0;a<k;)switch(j=c[a++],j){case "m":j=c[a++]*b+f;l=c[a++]*b;g.push(new THREE.Vector2(j,l));e.moveTo(j,l);break;case "l":j=c[a++]*b+f;l=c[a++]*b;g.push(new THREE.Vector2(j,
+l));e.lineTo(j,l);break;case "q":j=c[a++]*b+f;l=c[a++]*b;o=c[a++]*b+f;p=c[a++]*b;e.quadraticCurveTo(o,p,j,l);if(h=g[g.length-1]){m=h.x;n=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var y=h/divisions,A=THREE.FontUtils.b2(y,m,o,j),y=THREE.FontUtils.b2(y,n,p,l);g.push(new THREE.Vector2(A,y))}}break;case "b":if(j=c[a++]*b+f,l=c[a++]*b,o=c[a++]*b+f,p=c[a++]*-b,v=c[a++]*b+f,w=c[a++]*-b,e.bezierCurveTo(j,l,o,p,v,w),h=g[g.length-1]){m=h.x;n=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)y=
+h/divisions,A=THREE.FontUtils.b3(y,m,o,v,j),y=THREE.FontUtils.b3(y,n,p,w,l),g.push(new THREE.Vector2(A,y))}}}return{offset:x.ha*b,points:g,path:e}}}};
+(function(a){var c=function(a){for(var c=a.length,e=0,g=c-1,h=0;h<c;g=h++)e+=a[g].x*a[h].y-a[h].x*a[g].y;return e*0.5};a.Triangulate=function(a,f){var e=a.length;if(e<3)return null;var g=[],h=[],j=[],k,l,m;if(c(a)>0)for(l=0;l<e;l++)h[l]=l;else for(l=0;l<e;l++)h[l]=e-1-l;var n=2*e;for(l=e-1;e>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return j;return g}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);m=l+1;e<=m&&(m=0);var o;a:{o=a;var p=k,v=l,w=m,x=e,y=h,A=void 0,u=void 0,B=void 0,
+C=void 0,H=void 0,J=void 0,K=void 0,I=void 0,D=void 0,u=o[y[p]].x,B=o[y[p]].y,C=o[y[v]].x,H=o[y[v]].y,J=o[y[w]].x,K=o[y[w]].y;if(1.0E-10>(C-u)*(K-B)-(H-B)*(J-u))o=!1;else{for(A=0;A<x;A++)if(!(A==p||A==v||A==w)){var I=o[y[A]].x,D=o[y[A]].y,G=void 0,F=void 0,L=void 0,N=void 0,M=void 0,O=void 0,Q=void 0,E=void 0,R=void 0,P=void 0,T=void 0,U=void 0,G=L=M=void 0,G=J-C,F=K-H,L=u-J,N=B-K,M=C-u,O=H-B,Q=I-u,E=D-B,R=I-C,P=D-H,T=I-J,U=D-K,G=G*P-F*R,M=M*E-O*Q,L=L*U-N*T;if(G>=0&&L>=0&&M>=0){o=!1;break a}}o=!0}}if(o){g.push([a[h[k]],
+a[h[l]],a[h[m]]]);j.push([h[k],h[l],h[m]]);k=l;for(m=l+1;m<e;k++,m++)h[k]=h[m];e--;n=2*e}}if(f)return j;return g};a.Triangulate.area=c;return a})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+THREE.TorusGeometry=function(a,c,b,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=f||6;a=[];for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){var f=b/this.segmentsT*2*Math.PI,e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(f),(this.radius+this.tube*Math.cos(e))*Math.sin(f),this.tube*Math.sin(e))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
+1;b<=this.segmentsT;++b){var f=(this.segmentsT+1)*c+b,e=(this.segmentsT+1)*c+b-1,g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(f,e,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
 THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(a,b,c,g,e,h,f){function j(a,c,b,f,e,g){c=b/f*a;b=Math.cos(c);return new THREE.Vector3(e*(2+b)*0.5*Math.cos(a),e*(2+b)*Math.sin(a)*0.5,g*e*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=g||8;this.p=e||2;this.q=h||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;g=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
-this.segmentsT;++b){var k=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=j(k,f,this.q,this.p,this.radius,this.heightScale),k=j(k+0.01,f,this.q,this.p,this.radius,this.heightScale);c.x=k.x-e.x;c.y=k.y-e.y;c.z=k.z-e.z;g.x=k.x+e.x;g.y=k.y+e.y;g.z=k.z+e.z;h.cross(c,g);g.cross(h,c);h.normalize();g.normalize();k=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=k*g.x+f*h.x;e.y+=k*g.y+f*h.y;e.z+=k*g.z+f*h.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
-e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var g=(a+1)%this.segmentsR,h=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[g][b],g=this.grid[g][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),m=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,g,h));this.faceVertexUvs[0].push([f,k,l,m])}this.computeCentroids();
+THREE.TorusKnotGeometry=function(a,c,b,f,e,g,h){function j(a,b,c,f,g,e){b=c/f*a;c=Math.cos(b);return new THREE.Vector3(g*(2+c)*0.5*Math.cos(a),g*(2+c)*Math.sin(a)*0.5,e*g*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=f||8;this.p=e||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;f=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
+this.segmentsT;++c){var k=a/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,e=j(k,h,this.q,this.p,this.radius,this.heightScale),k=j(k+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=k.x-e.x;b.y=k.y-e.y;b.z=k.z-e.z;f.x=k.x+e.x;f.y=k.y+e.y;f.z=k.z+e.z;g.cross(b,f);f.cross(g,b);g.normalize();f.normalize();k=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);e.x+=k*f.x+h*g.x;e.y+=k*f.y+h*g.y;e.z+=k*f.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
+e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var f=(a+1)%this.segmentsR,g=(c+1)%this.segmentsT,e=this.grid[a][c],b=this.grid[f][c],f=this.grid[f][g],g=this.grid[a][g],h=new THREE.UV(a/this.segmentsR,c/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),m=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,b,f,g));this.faceVertexUvs[0].push([h,k,l,m])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
-THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
-this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,b,c){a.materials=[];for(var g=0;g<b.length;++g)a.materials[g]=[THREE.Loader.prototype.createMaterial(b[g],c)]},hasNormals:function(a){var b,c,g=a.materials.length;for(c=0;c<g;c++)if(b=a.materials[c][0],b instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a}function g(a,b){var f=
-new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=!0};f.src=b}function e(a,c,f,e,h,j){var k=document.createElement("canvas");a[c]=new THREE.Texture(k);a[c].sourceFile=f;if(e){a[c].repeat.set(e[0],e[1]);if(e[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(e[1]!=
-1)a[c].wrapT=THREE.RepeatWrapping}h&&a[c].offset.set(h[0],h[1]);if(j){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[j[0]]!==void 0)a[c].wrapS=e[j[0]];if(e[j[1]]!==void 0)a[c].wrapT=e[j[1]]}g(a[c],b+"/"+f)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,j,k;j="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?j="MeshPhongMaterial":a.shading=="Basic"&&(j="MeshBasicMaterial"));
-if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=h(a.colorDiffuse);
-else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=h(a.colorSpecular);if(a.colorAmbient)f.ambient=h(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&e(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,m=THREE.UniformsUtils.clone(l.uniforms),o=f.color;j=f.specular;k=f.ambient;var n=f.shininess;m.tNormal.texture=f.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(f.map)m.tDiffuse.texture=f.map,m.enableDiffuse.value=!0;if(f.specularMap)m.tSpecular.texture=f.specularMap,m.enableSpecular.value=!0;if(f.lightMap)m.tAO.texture=
-f.lightMap,m.enableAO.value=!0;m.uDiffuseColor.value.setHex(o);m.uSpecularColor.value.setHex(j);m.uAmbientColor.value.setHex(k);m.uShininess.value=n;if(f.opacity)m.uOpacity.value=f.opacity;f=new THREE.MeshShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:m,lights:!0,fog:!0})}else f=new THREE[j](f);return f}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
-THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var b=this,c=a.model,g=a.callback,e=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,g,e);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var g=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.init_materials(g,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,e,k,l,m,o,n,t,v,y,u,w,x,p,z=a.faces;o=a.vertices;var A=a.normals,E=a.colors,F=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&F++;for(b=0;b<F;b++)g.faceUvs[b]=[],g.faceVertexUvs[b]=[];l=0;for(m=o.length;l<m;)n=new THREE.Vertex,n.position.x=o[l++]*c,n.position.y=
-o[l++]*c,n.position.z=o[l++]*c,g.vertices.push(n);l=0;for(m=z.length;l<m;){c=z[l++];o=c&1;k=c&2;b=c&4;e=c&8;t=c&16;n=c&32;y=c&64;c&=128;o?(u=new THREE.Face4,u.a=z[l++],u.b=z[l++],u.c=z[l++],u.d=z[l++],o=4):(u=new THREE.Face3,u.a=z[l++],u.b=z[l++],u.c=z[l++],o=3);if(k)k=z[l++],u.materials=g.materials[k];k=g.faces.length;if(b)for(b=0;b<F;b++)w=a.uvs[b],v=z[l++],p=w[v*2],v=w[v*2+1],g.faceUvs[b][k]=new THREE.UV(p,v);if(e)for(b=0;b<F;b++){w=a.uvs[b];x=[];for(e=0;e<o;e++)v=z[l++],p=w[v*2],v=w[v*2+1],x[e]=
-new THREE.UV(p,v);g.faceVertexUvs[b][k]=x}if(t)t=z[l++]*3,e=new THREE.Vector3,e.x=A[t++],e.y=A[t++],e.z=A[t],u.normal=e;if(n)for(b=0;b<o;b++)t=z[l++]*3,e=new THREE.Vector3,e.x=A[t++],e.y=A[t++],e.z=A[t],u.vertexNormals.push(e);if(y)n=z[l++],n=new THREE.Color(E[n]),u.color=n;if(c)for(b=0;b<o;b++)n=z[l++],n=new THREE.Color(E[n]),u.vertexColors.push(n);g.faces.push(u)}}})(e);(function(){var c,b,e,k;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)e=a.skinWeights[c],k=a.skinWeights[c+1],g.skinWeights.push(new THREE.Vector4(e,
-k,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)e=a.skinIndices[c],k=a.skinIndices[c+1],g.skinIndices.push(new THREE.Vector4(e,k,0,0))}g.bones=a.bones;g.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,e,k,l,m,o,n,t,v;b=0;for(e=a.morphTargets.length;b<e;b++){g.morphTargets[b]={};g.morphTargets[b].name=a.morphTargets[b].name;g.morphTargets[b].vertices=[];t=g.morphTargets[b].vertices;v=a.morphTargets[b].vertices;k=0;for(l=v.length;k<l;k+=3)m=v[k]*c,o=v[k+1]*
-c,n=v[k+2]*c,t.push(new THREE.Vertex(new THREE.Vector3(m,o,n)))}}if(a.morphColors!==void 0){b=0;for(e=a.morphColors.length;b<e;b++){g.morphColors[b]={};g.morphColors[b].name=a.morphColors[b].name;g.morphColors[b].colors=[];l=g.morphColors[b].colors;m=a.morphColors[b].colors;c=0;for(k=m.length;c<k;c+=3)o=new THREE.Color(16755200),o.setRGB(m[c],m[c+1],m[c+2]),l.push(o)}}})(e);(function(){if(a.edges!==void 0){var c,b,e;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],e=a.edges[c+1],g.edges.push(new THREE.Edge(g.vertices[b],
-g.vertices[e],b,e))}})();g.computeCentroids();g.computeFaceNormals();this.hasNormals(g)&&g.computeTangents();b(g)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype={load:function(a){var b=a.model,c=a.callback,g=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b),a=(new Date).getTime(),b=new Worker(b),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,c,e,g,h)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
-b.postMessage(a)},loadAjaxBuffers:function(a,b,c,g,e,h){var f=new XMLHttpRequest,j=g+"/"+a,k=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,c,e,b):alert("Couldn't load ["+j+"] ["+f.status+"]"):f.readyState==3?h&&(k==0&&(k=f.getResponseHeader("Content-Length")),h({total:k,loaded:f.responseText.length})):f.readyState==2&&(k=f.getResponseHeader("Content-Length"))};f.open("GET",j,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
-f.setRequestHeader("Content-Type","text/plain");f.send(null)},createBinModel:function(a,b,c,g){var e=function(c){function b(a,c){var e=m(a,c),g=m(a,c+1),f=m(a,c+2),h=m(a,c+3),j=(h<<1&255|f>>7)-127;e|=(f&127)<<16|g<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function e(a,c){var b=m(a,c),g=m(a,c+1),f=m(a,c+2);return(m(a,c+3)<<24)+(f<<16)+(g<<8)+b}function k(a,c){var b=m(a,c);return(m(a,c+1)<<8)+b}function l(a,c){var b=m(a,c);return b>127?b-256:b}function m(a,
-c){return a.charCodeAt(c)&255}function o(c){var b,g,f;b=e(a,c);g=e(a,c+E);f=e(a,c+F);c=k(a,c+G);THREE.BinaryLoader.prototype.f3(w,b,g,f,c)}function n(c){var b,g,f,h,l,m;b=e(a,c);g=e(a,c+E);f=e(a,c+F);h=k(a,c+G);l=e(a,c+D);m=e(a,c+K);c=e(a,c+I);THREE.BinaryLoader.prototype.f3n(w,z,b,g,f,h,l,m,c)}function t(c){var b,g,f,h;b=e(a,c);g=e(a,c+C);f=e(a,c+J);h=e(a,c+L);c=k(a,c+H);THREE.BinaryLoader.prototype.f4(w,b,g,f,h,c)}function v(c){var b,g,f,h,l,m,n,o;b=e(a,c);g=e(a,c+C);f=e(a,c+J);h=e(a,c+L);l=k(a,
-c+H);m=e(a,c+N);n=e(a,c+O);o=e(a,c+B);c=e(a,c+P);THREE.BinaryLoader.prototype.f4n(w,z,b,g,f,h,l,m,n,o,c)}function y(c){var b,g;b=e(a,c);g=e(a,c+M);c=e(a,c+R);THREE.BinaryLoader.prototype.uv3(w.faceVertexUvs[0],A[b*2],A[b*2+1],A[g*2],A[g*2+1],A[c*2],A[c*2+1])}function u(c){var b,g,f;b=e(a,c);g=e(a,c+S);f=e(a,c+Y);c=e(a,c+Z);THREE.BinaryLoader.prototype.uv4(w.faceVertexUvs[0],A[b*2],A[b*2+1],A[g*2],A[g*2+1],A[f*2],A[f*2+1],A[c*2],A[c*2+1])}var w=this,x=0,p,z=[],A=[],E,F,G,D,K,I,C,J,L,H,N,O,B,P,M,R,
-S,Y,Z,T,U,V,W,X,Q;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,g,c);p={signature:a.substr(x,8),header_bytes:m(a,x+8),vertex_coordinate_bytes:m(a,x+9),normal_coordinate_bytes:m(a,x+10),uv_coordinate_bytes:m(a,x+11),vertex_index_bytes:m(a,x+12),normal_index_bytes:m(a,x+13),uv_index_bytes:m(a,x+14),material_index_bytes:m(a,x+15),nvertices:e(a,x+16),nnormals:e(a,x+16+4),nuvs:e(a,x+16+8),ntri_flat:e(a,x+16+12),ntri_smooth:e(a,x+16+16),ntri_flat_uv:e(a,x+16+20),ntri_smooth_uv:e(a,x+
-16+24),nquad_flat:e(a,x+16+28),nquad_smooth:e(a,x+16+32),nquad_flat_uv:e(a,x+16+36),nquad_smooth_uv:e(a,x+16+40)};x+=p.header_bytes;E=p.vertex_index_bytes;F=p.vertex_index_bytes*2;G=p.vertex_index_bytes*3;D=p.vertex_index_bytes*3+p.material_index_bytes;K=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes;I=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*2;C=p.vertex_index_bytes;J=p.vertex_index_bytes*2;L=p.vertex_index_bytes*3;H=p.vertex_index_bytes*4;N=p.vertex_index_bytes*
-4+p.material_index_bytes;O=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes;B=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*2;P=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*3;M=p.uv_index_bytes;R=p.uv_index_bytes*2;S=p.uv_index_bytes;Y=p.uv_index_bytes*2;Z=p.uv_index_bytes*3;c=p.vertex_index_bytes*3+p.material_index_bytes;Q=p.vertex_index_bytes*4+p.material_index_bytes;T=p.ntri_flat*c;U=p.ntri_smooth*(c+p.normal_index_bytes*3);V=p.ntri_flat_uv*
-(c+p.uv_index_bytes*3);W=p.ntri_smooth_uv*(c+p.normal_index_bytes*3+p.uv_index_bytes*3);X=p.nquad_flat*Q;c=p.nquad_smooth*(Q+p.normal_index_bytes*4);Q=p.nquad_flat_uv*(Q+p.uv_index_bytes*4);x+=function(c){for(var e,g,h,j=p.vertex_coordinate_bytes*3,k=c+p.nvertices*j;c<k;c+=j)e=b(a,c),g=b(a,c+p.vertex_coordinate_bytes),h=b(a,c+p.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(w,e,g,h);return p.nvertices*j}(x);x+=function(c){for(var b,e,g,f=p.normal_coordinate_bytes*3,h=c+p.nnormals*f;c<h;c+=
-f)b=l(a,c),e=l(a,c+p.normal_coordinate_bytes),g=l(a,c+p.normal_coordinate_bytes*2),z.push(b/127,e/127,g/127);return p.nnormals*f}(x);x+=function(c){for(var e,g,h=p.uv_coordinate_bytes*2,j=c+p.nuvs*h;c<j;c+=h)e=b(a,c),g=b(a,c+p.uv_coordinate_bytes),A.push(e,g);return p.nuvs*h}(x);T=x+T;U=T+U;V=U+V;W=V+W;X=W+X;c=X+c;Q=c+Q;(function(a){var c,b=p.vertex_index_bytes*3+p.material_index_bytes,e=b+p.uv_index_bytes*3,g=a+p.ntri_flat_uv*e;for(c=a;c<g;c+=e)o(c),y(c+b);return g-a})(U);(function(a){var c,b=p.vertex_index_bytes*
-3+p.material_index_bytes+p.normal_index_bytes*3,e=b+p.uv_index_bytes*3,g=a+p.ntri_smooth_uv*e;for(c=a;c<g;c+=e)n(c),y(c+b);return g-a})(V);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes,e=b+p.uv_index_bytes*4,g=a+p.nquad_flat_uv*e;for(c=a;c<g;c+=e)t(c),u(c+b);return g-a})(c);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,e=b+p.uv_index_bytes*4,g=a+p.nquad_smooth_uv*e;for(c=a;c<g;c+=e)v(c),u(c+b);return g-a})(Q);(function(a){var c,b=p.vertex_index_bytes*
-3+p.material_index_bytes,e=a+p.ntri_flat*b;for(c=a;c<e;c+=b)o(c);return e-a})(x);(function(a){var c,b=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*3,e=a+p.ntri_smooth*b;for(c=a;c<e;c+=b)n(c);return e-a})(T);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes,e=a+p.nquad_flat*b;for(c=a;c<e;c+=b)t(c);return e-a})(W);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,e=a+p.nquad_smooth*b;for(c=a;c<e;c+=b)v(c);return e-a})(X);
-this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))},v:function(a,b,c,g){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,g)))},f3:function(a,b,c,g,e){a.faces.push(new THREE.Face3(b,c,g,null,null,a.materials[e]))},f4:function(a,b,c,g,e,h){a.faces.push(new THREE.Face4(b,c,g,e,null,null,a.materials[h]))},f3n:function(a,b,c,g,e,h,f,j,k){var h=a.materials[h],l=b[j*
-3],m=b[j*3+1],j=b[j*3+2],o=b[k*3],n=b[k*3+1],k=b[k*3+2];a.faces.push(new THREE.Face3(c,g,e,[new THREE.Vector3(b[f*3],b[f*3+1],b[f*3+2]),new THREE.Vector3(l,m,j),new THREE.Vector3(o,n,k)],null,h))},f4n:function(a,b,c,g,e,h,f,j,k,l,m){var f=a.materials[f],o=b[k*3],n=b[k*3+1],k=b[k*3+2],t=b[l*3],v=b[l*3+1],l=b[l*3+2],y=b[m*3],u=b[m*3+1],m=b[m*3+2];a.faces.push(new THREE.Face4(c,g,e,h,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(t,v,l),new THREE.Vector3(y,u,
-m)],null,f))},uv3:function(a,b,c,g,e,h,f){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(g,e));j.push(new THREE.UV(h,f));a.push(j)},uv4:function(a,b,c,g,e,h,f,j,k){var l=[];l.push(new THREE.UV(b,c));l.push(new THREE.UV(g,e));l.push(new THREE.UV(h,f));l.push(new THREE.UV(j,k));a.push(l)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,b){var c=this,g=new Worker(a);g.postMessage(0);var e=THREE.Loader.prototype.extractUrlbase(a);g.onmessage=function(a){function g(a,c){return c=="relativeToHTML"?a:e+"/"+a}function j(){for(t in C.objects)if(!B.objects[t])if(x=C.objects[t],x.geometry!==void 0){if(E=B.geometries[x.geometry]){var a=!1;K=[];for(M=0;M<x.materials.length;M++)K[M]=B.materials[x.materials[M]],a=K[M]instanceof THREE.MeshShaderMaterial;a&&E.computeTangents();p=x.position;r=x.rotation;
-q=x.quaternion;s=x.scale;q=0;K.length==0&&(K[0]=new THREE.MeshFaceMaterial);K.length>1&&(K=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(E,K);object.name=t;object.position.set(p[0],p[1],p[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;B.scene.addObject(object);B.objects[t]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),B.scene.collisions.colliders.push(a));
-if(x.castsShadow)a=new THREE.ShadowVolume(E),B.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},B.triggers[object.name]=a)}}else p=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(p[0],p[1],p[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=x.visible!==void 0?x.visible:!1,B.scene.addObject(object),B.objects[t]=object,B.empties[t]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},B.triggers[object.name]=a)}function k(a){return function(b){B.geometries[a]=b;j();L-=1;c.onLoadComplete();m()}}function l(a){return function(c){B.geometries[a]=c}}function m(){c.callbackProgress({totalModels:N,totalTextures:O,loadedModels:N-L,loadedTextures:O-H},B);c.onLoadProgress();L==0&&H==0&&b(B)}var o,
-n,t,v,y,u,w,x,p,z,A,E,F,G,D,K,I,C,J,L,H,N,O,B;C=a.data;D=new THREE.BinaryLoader;J=new THREE.JSONLoader;H=L=0;B={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(t in C.objects)if(x=C.objects[t],x.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(C.transform){a=C.transform.position;z=C.transform.rotation;var P=C.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);z&&B.scene.rotation.set(z[0],
-z[1],z[2]);P&&B.scene.scale.set(P[0],P[1],P[2]);(a||z||P)&&B.scene.updateMatrix()}a=function(){H-=1;m();c.onLoadComplete()};for(y in C.cameras){z=C.cameras[y];if(z.type=="perspective")F=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho")F=new THREE.Camera,F.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far);p=z.position;z=z.target;F.position.set(p[0],p[1],p[2]);F.target.position.set(z[0],z[1],z[2]);B.cameras[y]=F}for(v in C.lights)y=C.lights[v],
-F=y.color!==void 0?y.color:16777215,z=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(p=y.direction,I=new THREE.DirectionalLight(F,z),I.position.set(p[0],p[1],p[2]),I.position.normalize()):y.type=="point"?(p=y.position,d=y.distance,I=new THREE.PointLight(F,z,d),I.position.set(p[0],p[1],p[2])):y.type=="ambient"&&(I=new THREE.AmbientLight(F)),B.scene.addLight(I),B.lights[v]=I;for(u in C.fogs)v=C.fogs[u],v.type=="linear"?G=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(G=new THREE.FogExp2(0,
-v.density)),z=v.color,G.color.setRGB(z[0],z[1],z[2]),B.fogs[u]=G;if(B.cameras&&C.defaults.camera)B.currentCamera=B.cameras[C.defaults.camera];if(B.fogs&&C.defaults.fog)B.scene.fog=B.fogs[C.defaults.fog];z=C.defaults.bgcolor;B.bgColor=new THREE.Color;B.bgColor.setRGB(z[0],z[1],z[2]);B.bgColorAlpha=C.defaults.bgalpha;for(o in C.geometries)if(u=C.geometries[o],u.type=="bin_mesh"||u.type=="ascii_mesh")L+=1,c.onLoadStart();N=L;for(o in C.geometries)u=C.geometries[o],u.type=="cube"?(E=new THREE.CubeGeometry(u.width,
-u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),B.geometries[o]=E):u.type=="plane"?(E=new THREE.PlaneGeometry(u.width,u.height,u.segmentsWidth,u.segmentsHeight),B.geometries[o]=E):u.type=="sphere"?(E=new THREE.SphereGeometry(u.radius,u.segmentsWidth,u.segmentsHeight),B.geometries[o]=E):u.type=="cylinder"?(E=new THREE.CylinderGeometry(u.numSegs,u.topRad,u.botRad,u.height,u.topOffset,u.botOffset),B.geometries[o]=E):u.type=="torus"?(E=new THREE.TorusGeometry(u.radius,
-u.tube,u.segmentsR,u.segmentsT),B.geometries[o]=E):u.type=="icosahedron"?(E=new THREE.IcosahedronGeometry(u.subdivisions),B.geometries[o]=E):u.type=="bin_mesh"?D.load({model:g(u.url,C.urlBaseType),callback:k(o)}):u.type=="ascii_mesh"?J.load({model:g(u.url,C.urlBaseType),callback:k(o)}):u.type=="embedded_mesh"&&(u=C.embeds[u.id])&&J.createModel(u,l(o),"");for(w in C.textures)if(o=C.textures[w],o.url instanceof Array){H+=o.url.length;for(D=0;D<o.url.length;D++)c.onLoadStart()}else H+=1,c.onLoadStart();
-O=H;for(w in C.textures){o=C.textures[w];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){D=[];for(var M=0;M<o.url.length;M++)D[M]=g(o.url[M],C.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,o.mapping,a)}else{D=THREE.ImageUtils.loadTexture(g(o.url,C.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)D.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)D.magFilter=THREE[o.magFilter];if(o.repeat){D.repeat.set(o.repeat[0],o.repeat[1]);
-if(o.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}o.offset&&D.offset.set(o.offset[0],o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)D.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)D.wrapT=J[o.wrap[1]]}}B.textures[w]=D}for(n in C.materials){w=C.materials[n];for(A in w.parameters)if(A=="envMap"||A=="map"||A=="lightMap")w.parameters[A]=B.textures[w.parameters[A]];else if(A=="shading")w.parameters[A]=
-w.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")w.parameters[A]=THREE[w.parameters[A]]?THREE[w.parameters[A]]:THREE.NormalBlending;else if(A=="combine")w.parameters[A]=w.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(A=="vertexColors")if(w.parameters[A]=="face")w.parameters[A]=THREE.FaceColors;else if(w.parameters[A])w.parameters[A]=THREE.VertexColors;if(w.parameters.opacity!==void 0&&w.parameters.opacity<1)w.parameters.transparent=
-!0;if(w.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);D=w.parameters.color;J=w.parameters.specular;u=w.parameters.ambient;G=w.parameters.shininess;a.tNormal.texture=B.textures[w.parameters.normalMap];if(w.parameters.normalMapFactor)a.uNormalScale.value=w.parameters.normalMapFactor;if(w.parameters.map)a.tDiffuse.texture=w.parameters.map,a.enableDiffuse.value=!0;if(w.parameters.lightMap)a.tAO.texture=w.parameters.lightMap,a.enableAO.value=!0;if(w.parameters.specularMap)a.tSpecular.texture=
-B.textures[w.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(u);a.uShininess.value=G;if(w.parameters.opacity)a.uOpacity.value=w.parameters.opacity;w=new THREE.MeshShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else w=new THREE[w.type](w.parameters);B.materials[n]=w}j();c.callbackSync(B)}}};
-THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,h,f,j,k,l,m,o){f=(f-m)/(o-m);m=this.normal_cache;b[h]=j+f*this.delta;b[h+1]=k;b[h+2]=l;e[h]=this.lerp(m[a],m[a+3],f);e[h+1]=this.lerp(m[a+1],m[a+4],f);e[h+2]=this.lerp(m[a+2],m[a+5],f)};this.VIntY=function(a,b,e,h,f,j,k,l,m,o){f=(f-m)/(o-m);m=this.normal_cache;b[h]=j;b[h+1]=k+f*this.delta;b[h+
-2]=l;b=a+this.yd*3;e[h]=this.lerp(m[a],m[b],f);e[h+1]=this.lerp(m[a+1],m[b+1],f);e[h+2]=this.lerp(m[a+2],m[b+2],f)};this.VIntZ=function(a,b,e,h,f,j,k,l,m,o){f=(f-m)/(o-m);m=this.normal_cache;b[h]=j;b[h+1]=k;b[h+2]=l+f*this.delta;b=a+this.zd*3;e[h]=this.lerp(m[a],m[b],f);e[h+1]=this.lerp(m[a+1],m[b+1],f);e[h+2]=this.lerp(m[a+2],m[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
-this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,h,f,j){var k=h+1,l=h+this.yd,m=h+this.zd,o=k+this.yd,n=k+this.zd,t=h+this.yd+this.zd,v=k+this.yd+this.zd,y=0,u=this.field[h],w=this.field[k],x=this.field[l],p=this.field[o],z=this.field[m],A=this.field[n],E=this.field[t],F=this.field[v];u<f&&(y|=1);w<f&&(y|=2);x<f&&(y|=8);p<f&&(y|=4);z<f&&(y|=16);A<f&&(y|=32);E<f&&(y|=128);F<f&&(y|=64);var G=THREE.edgeTable[y];if(G==0)return 0;var D=this.delta,
-K=a+D,I=b+D,D=e+D;G&1&&(this.compNorm(h),this.compNorm(k),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,b,e,u,w));G&2&&(this.compNorm(k),this.compNorm(o),this.VIntY(k*3,this.vlist,this.nlist,3,f,K,b,e,w,p));G&4&&(this.compNorm(l),this.compNorm(o),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,I,e,x,p));G&8&&(this.compNorm(h),this.compNorm(l),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,b,e,u,x));G&16&&(this.compNorm(m),this.compNorm(n),this.VIntX(m*3,this.vlist,this.nlist,12,f,a,b,D,z,A));G&32&&(this.compNorm(n),
-this.compNorm(v),this.VIntY(n*3,this.vlist,this.nlist,15,f,K,b,D,A,F));G&64&&(this.compNorm(t),this.compNorm(v),this.VIntX(t*3,this.vlist,this.nlist,18,f,a,I,D,E,F));G&128&&(this.compNorm(m),this.compNorm(t),this.VIntY(m*3,this.vlist,this.nlist,21,f,a,b,D,z,E));G&256&&(this.compNorm(h),this.compNorm(m),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,b,e,u,z));G&512&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,27,f,K,b,e,w,A));G&1024&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*
-3,this.vlist,this.nlist,30,f,K,I,e,p,F));G&2048&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,I,e,x,E));y<<=4;for(f=h=0;THREE.triTable[y+f]!=-1;)a=y+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],j),f+=3,h++;return h};this.posnormtriv=function(a,b,e,h,f,j){var k=this.count*3;this.positionArray[k]=a[e];this.positionArray[k+1]=a[e+1];this.positionArray[k+2]=a[e+2];this.positionArray[k+3]=a[h];this.positionArray[k+
-4]=a[h+1];this.positionArray[k+5]=a[h+2];this.positionArray[k+6]=a[f];this.positionArray[k+7]=a[f+1];this.positionArray[k+8]=a[f+2];this.normalArray[k]=b[e];this.normalArray[k+1]=b[e+1];this.normalArray[k+2]=b[e+2];this.normalArray[k+3]=b[h];this.normalArray[k+4]=b[h+1];this.normalArray[k+5]=b[h+2];this.normalArray[k+6]=b[f];this.normalArray[k+7]=b[f+1];this.normalArray[k+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,h,f){var j=this.size*Math.sqrt(h/f),k=e*this.size,l=b*this.size,m=a*this.size,o=Math.floor(k-j);o<1&&(o=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var n=Math.floor(l-j);n<1&&(n=1);l=Math.floor(l+j);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-j);t<1&&(t=1);j=Math.floor(m+j);j>this.size-1&&(j=this.size-
-1);for(var v,y,u,w,x,p;o<k;o++){m=this.size2*o;y=o/this.size-e;x=y*y;for(y=n;y<l;y++){u=m+this.size*y;v=y/this.size-b;p=v*v;for(v=t;v<j;v++)w=v/this.size-a,w=h/(1.0E-6+w*w+p+x)-f,w>0&&(this.field[u+v]+=w)}}};this.addPlaneX=function(a,b){var e,h,f,j,k,l=this.size,m=this.yd,o=this.zd,n=this.field,t=l*Math.sqrt(a/b);t>l&&(t=l);for(e=0;e<t;e++)if(h=e/l,h*=h,j=a/(1.0E-4+h)-b,j>0)for(h=0;h<l;h++){k=e+h*m;for(f=0;f<l;f++)n[o*f+k]+=j}};this.addPlaneY=function(a,b){var e,h,f,j,k,l,m=this.size,o=this.yd,n=
-this.zd,t=this.field,v=m*Math.sqrt(a/b);v>m&&(v=m);for(h=0;h<v;h++)if(e=h/m,e*=e,j=a/(1.0E-4+e)-b,j>0){k=h*o;for(e=0;e<m;e++){l=k+e;for(f=0;f<m;f++)t[n*f+l]+=j}}};this.addPlaneZ=function(a,b){var e,h,f,j,k,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(f=0;f<dist;f++)if(e=f/size,e*=e,j=a/(1.0E-4+e)-b,j>0){k=zd*f;for(h=0;h<size;h++){l=k+h*yd;for(e=0;e<size;e++)field[l+e]+=j}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
-3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,e,h,f,j,k,l,m,o,n=this.size-2;for(f=1;f<n;f++){o=this.size2*f;l=(f-this.halfsize)/this.halfsize;for(h=1;h<n;h++){m=o+this.size*h;k=(h-this.halfsize)/this.halfsize;for(e=1;e<n;e++)j=(e-this.halfsize)/this.halfsize,b=m+e,this.polygonize(j,k,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(h){var f,j,k,l,m,o,n,t;for(f=0;f<h.count;f++)n=f*3,m=n+1,t=n+2,j=h.positionArray[n],
-k=h.positionArray[m],l=h.positionArray[t],o=new THREE.Vector3(j,k,l),j=h.normalArray[n],k=h.normalArray[m],l=h.normalArray[t],n=new THREE.Vector3(j,k,l),n.normalize(),m=new THREE.Vertex(o),b.vertices.push(m),e.push(n);nfaces=h.count/3;for(f=0;f<nfaces;f++)n=(a+f)*3,m=n+1,t=n+2,o=e[n],j=e[m],k=e[t],n=new THREE.Face3(n,m,t,[o,j,k]),b.faces.push(n);a+=nfaces;h.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
+this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var f=0;f<c.length;++f)a.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],b)]},hasNormals:function(a){var c,b,f=a.materials.length;for(b=0;b<f;b++)if(c=a.materials[b][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a}function f(a,c){var f=
+new Image;f.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,c,f)}else a.image=this;a.needsUpdate=!0};f.src=c}function e(a,b,g,e,h,j){var k=document.createElement("canvas");a[b]=new THREE.Texture(k);a[b].sourceFile=g;if(e){a[b].repeat.set(e[0],e[1]);if(e[0]!=1)a[b].wrapS=THREE.RepeatWrapping;if(e[1]!=
+1)a[b].wrapT=THREE.RepeatWrapping}h&&a[b].offset.set(h[0],h[1]);if(j){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[j[0]]!==void 0)a[b].wrapS=e[j[0]];if(e[j[1]]!==void 0)a[b].wrapT=e[j[1]]}f(a[b],c+"/"+g)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h,j,k;j="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?j="MeshPhongMaterial":a.shading=="Basic"&&(j="MeshBasicMaterial"));
+if(a.blending)if(a.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)h.transparent=a.transparent;if(a.depthTest!==void 0)h.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(a.vertexColors)h.vertexColors=THREE.VertexColors;if(a.colorDiffuse)h.color=g(a.colorDiffuse);
+else if(a.DbgColor)h.color=a.DbgColor;if(a.colorSpecular)h.specular=g(a.colorSpecular);if(a.colorAmbient)h.ambient=g(a.colorAmbient);if(a.transparency)h.opacity=a.transparency;if(a.specularCoef)h.shininess=a.specularCoef;a.mapDiffuse&&c&&e(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&e(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&e(h,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
+a.mapSpecular&&c&&e(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,m=THREE.UniformsUtils.clone(l.uniforms),n=h.color;j=h.specular;k=h.ambient;var o=h.shininess;m.tNormal.texture=h.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(h.map)m.tDiffuse.texture=h.map,m.enableDiffuse.value=!0;if(h.specularMap)m.tSpecular.texture=h.specularMap,m.enableSpecular.value=!0;if(h.lightMap)m.tAO.texture=
+h.lightMap,m.enableAO.value=!0;m.uDiffuseColor.value.setHex(n);m.uSpecularColor.value.setHex(j);m.uAmbientColor.value.setHex(k);m.uShininess.value=o;if(h.opacity)m.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:m,lights:!0,fog:!0})}else h=new THREE[j](h);return h}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
+THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var c=this,b=a.model,f=a.callback,e=a.texture_path?a.texture_path:this.extractUrlbase(b),a=new Worker(b);a.onmessage=function(a){c.createModel(a.data,f,e);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var f=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.init_materials(f,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,e,k,l,m,n,o,p,v,w,x,y,A,u,B=a.faces;n=a.vertices;var C=a.normals,H=a.colors,J=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&J++;for(c=0;c<J;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];l=0;for(m=n.length;l<m;)o=new THREE.Vertex,o.position.x=n[l++]*b,o.position.y=
+n[l++]*b,o.position.z=n[l++]*b,f.vertices.push(o);l=0;for(m=B.length;l<m;){b=B[l++];n=b&1;k=b&2;c=b&4;e=b&8;p=b&16;o=b&32;w=b&64;b&=128;n?(x=new THREE.Face4,x.a=B[l++],x.b=B[l++],x.c=B[l++],x.d=B[l++],n=4):(x=new THREE.Face3,x.a=B[l++],x.b=B[l++],x.c=B[l++],n=3);if(k)k=B[l++],x.materials=f.materials[k];k=f.faces.length;if(c)for(c=0;c<J;c++)y=a.uvs[c],v=B[l++],u=y[v*2],v=y[v*2+1],f.faceUvs[c][k]=new THREE.UV(u,v);if(e)for(c=0;c<J;c++){y=a.uvs[c];A=[];for(e=0;e<n;e++)v=B[l++],u=y[v*2],v=y[v*2+1],A[e]=
+new THREE.UV(u,v);f.faceVertexUvs[c][k]=A}if(p)p=B[l++]*3,e=new THREE.Vector3,e.x=C[p++],e.y=C[p++],e.z=C[p],x.normal=e;if(o)for(c=0;c<n;c++)p=B[l++]*3,e=new THREE.Vector3,e.x=C[p++],e.y=C[p++],e.z=C[p],x.vertexNormals.push(e);if(w)o=B[l++],o=new THREE.Color(H[o]),x.color=o;if(b)for(c=0;c<n;c++)o=B[l++],o=new THREE.Color(H[o]),x.vertexColors.push(o);f.faces.push(x)}}})(e);(function(){var b,c,e,k;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)e=a.skinWeights[b],k=a.skinWeights[b+1],f.skinWeights.push(new THREE.Vector4(e,
+k,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],k=a.skinIndices[b+1],f.skinIndices.push(new THREE.Vector4(e,k,0,0))}f.bones=a.bones;f.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,k,l,m,n,o,p,v;c=0;for(e=a.morphTargets.length;c<e;c++){f.morphTargets[c]={};f.morphTargets[c].name=a.morphTargets[c].name;f.morphTargets[c].vertices=[];p=f.morphTargets[c].vertices;v=a.morphTargets[c].vertices;k=0;for(l=v.length;k<l;k+=3)m=v[k]*b,n=v[k+1]*
+b,o=v[k+2]*b,p.push(new THREE.Vertex(new THREE.Vector3(m,n,o)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){f.morphColors[c]={};f.morphColors[c].name=a.morphColors[c].name;f.morphColors[c].colors=[];l=f.morphColors[c].colors;m=a.morphColors[c].colors;b=0;for(k=m.length;b<k;b+=3)n=new THREE.Color(16755200),n.setRGB(m[b],m[b+1],m[b+2]),l.push(n)}}})(e);(function(){if(a.edges!==void 0){var b,c,e;for(b=0;b<a.edges.length;b+=2)c=a.edges[b],e=a.edges[b+1],f.edges.push(new THREE.Edge(f.vertices[c],
+f.vertices[e],c,e))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,f=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c),a=(new Date).getTime(),c=new Worker(c),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,b,e,f,g)};c.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
+c.postMessage(a)},loadAjaxBuffers:function(a,c,b,f,e,g){var h=new XMLHttpRequest,j=f+"/"+a,k=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+h.status+"]"):h.readyState==3?g&&(k==0&&(k=h.getResponseHeader("Content-Length")),g({total:k,loaded:h.responseText.length})):h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
+h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,f){var e=function(b){function c(a,b){var f=m(a,b),e=m(a,b+1),g=m(a,b+2),h=m(a,b+3),j=(h<<1&255|g>>7)-127;f|=(g&127)<<16|e<<8;if(f==0&&j==-127)return 0;return(1-2*(h>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,j)}function e(a,b){var c=m(a,b),f=m(a,b+1),g=m(a,b+2);return(m(a,b+3)<<24)+(g<<16)+(f<<8)+c}function k(a,b){var c=m(a,b);return(m(a,b+1)<<8)+c}function l(a,b){var c=m(a,b);return c>127?c-256:c}function m(a,
+b){return a.charCodeAt(b)&255}function n(b){var c,f,g;c=e(a,b);f=e(a,b+H);g=e(a,b+J);b=k(a,b+K);THREE.BinaryLoader.prototype.f3(y,c,f,g,b)}function o(b){var c,f,g,h,l,m;c=e(a,b);f=e(a,b+H);g=e(a,b+J);h=k(a,b+K);l=e(a,b+I);m=e(a,b+D);b=e(a,b+G);THREE.BinaryLoader.prototype.f3n(y,B,c,f,g,h,l,m,b)}function p(b){var c,f,g,h;c=e(a,b);f=e(a,b+F);g=e(a,b+L);h=e(a,b+N);b=k(a,b+M);THREE.BinaryLoader.prototype.f4(y,c,f,g,h,b)}function v(b){var c,f,g,h,l,m,n,o;c=e(a,b);f=e(a,b+F);g=e(a,b+L);h=e(a,b+N);l=k(a,
+b+M);m=e(a,b+O);n=e(a,b+Q);o=e(a,b+E);b=e(a,b+R);THREE.BinaryLoader.prototype.f4n(y,B,c,f,g,h,l,m,n,o,b)}function w(b){var c,f;c=e(a,b);f=e(a,b+P);b=e(a,b+T);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],C[c*2],C[c*2+1],C[f*2],C[f*2+1],C[b*2],C[b*2+1])}function x(b){var c,f,g;c=e(a,b);f=e(a,b+U);g=e(a,b+$);b=e(a,b+aa);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],C[c*2],C[c*2+1],C[f*2],C[f*2+1],C[g*2],C[g*2+1],C[b*2],C[b*2+1])}var y=this,A=0,u,B=[],C=[],H,J,K,I,D,G,F,L,N,M,O,Q,E,R,P,T,
+U,$,aa,V,W,X,Y,Z,S;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,b);u={signature:a.substr(A,8),header_bytes:m(a,A+8),vertex_coordinate_bytes:m(a,A+9),normal_coordinate_bytes:m(a,A+10),uv_coordinate_bytes:m(a,A+11),vertex_index_bytes:m(a,A+12),normal_index_bytes:m(a,A+13),uv_index_bytes:m(a,A+14),material_index_bytes:m(a,A+15),nvertices:e(a,A+16),nnormals:e(a,A+16+4),nuvs:e(a,A+16+8),ntri_flat:e(a,A+16+12),ntri_smooth:e(a,A+16+16),ntri_flat_uv:e(a,A+16+20),ntri_smooth_uv:e(a,
+A+16+24),nquad_flat:e(a,A+16+28),nquad_smooth:e(a,A+16+32),nquad_flat_uv:e(a,A+16+36),nquad_smooth_uv:e(a,A+16+40)};A+=u.header_bytes;H=u.vertex_index_bytes;J=u.vertex_index_bytes*2;K=u.vertex_index_bytes*3;I=u.vertex_index_bytes*3+u.material_index_bytes;D=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes;G=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*2;F=u.vertex_index_bytes;L=u.vertex_index_bytes*2;N=u.vertex_index_bytes*3;M=u.vertex_index_bytes*4;O=u.vertex_index_bytes*
+4+u.material_index_bytes;Q=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes;E=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*2;R=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*3;P=u.uv_index_bytes;T=u.uv_index_bytes*2;U=u.uv_index_bytes;$=u.uv_index_bytes*2;aa=u.uv_index_bytes*3;b=u.vertex_index_bytes*3+u.material_index_bytes;S=u.vertex_index_bytes*4+u.material_index_bytes;V=u.ntri_flat*b;W=u.ntri_smooth*(b+u.normal_index_bytes*3);X=u.ntri_flat_uv*
+(b+u.uv_index_bytes*3);Y=u.ntri_smooth_uv*(b+u.normal_index_bytes*3+u.uv_index_bytes*3);Z=u.nquad_flat*S;b=u.nquad_smooth*(S+u.normal_index_bytes*4);S=u.nquad_flat_uv*(S+u.uv_index_bytes*4);A+=function(b){for(var f,e,g,j=u.vertex_coordinate_bytes*3,k=b+u.nvertices*j;b<k;b+=j)f=c(a,b),e=c(a,b+u.vertex_coordinate_bytes),g=c(a,b+u.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,f,e,g);return u.nvertices*j}(A);A+=function(b){for(var c,f,e,g=u.normal_coordinate_bytes*3,h=b+u.nnormals*g;b<h;b+=
+g)c=l(a,b),f=l(a,b+u.normal_coordinate_bytes),e=l(a,b+u.normal_coordinate_bytes*2),B.push(c/127,f/127,e/127);return u.nnormals*g}(A);A+=function(b){for(var f,e,g=u.uv_coordinate_bytes*2,j=b+u.nuvs*g;b<j;b+=g)f=c(a,b),e=c(a,b+u.uv_coordinate_bytes),C.push(f,e);return u.nuvs*g}(A);V=A+V;W=V+W;X=W+X;Y=X+Y;Z=Y+Z;b=Z+b;S=b+S;(function(a){var b,c=u.vertex_index_bytes*3+u.material_index_bytes,f=c+u.uv_index_bytes*3,e=a+u.ntri_flat_uv*f;for(b=a;b<e;b+=f)n(b),w(b+c);return e-a})(W);(function(a){var b,c=u.vertex_index_bytes*
+3+u.material_index_bytes+u.normal_index_bytes*3,f=c+u.uv_index_bytes*3,e=a+u.ntri_smooth_uv*f;for(b=a;b<e;b+=f)o(b),w(b+c);return e-a})(X);(function(a){var b,c=u.vertex_index_bytes*4+u.material_index_bytes,f=c+u.uv_index_bytes*4,e=a+u.nquad_flat_uv*f;for(b=a;b<e;b+=f)p(b),x(b+c);return e-a})(b);(function(a){var b,c=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*4,f=c+u.uv_index_bytes*4,e=a+u.nquad_smooth_uv*f;for(b=a;b<e;b+=f)v(b),x(b+c);return e-a})(S);(function(a){var b,c=u.vertex_index_bytes*
+3+u.material_index_bytes,f=a+u.ntri_flat*c;for(b=a;b<f;b+=c)n(b);return f-a})(A);(function(a){var b,c=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*3,f=a+u.ntri_smooth*c;for(b=a;b<f;b+=c)o(b);return f-a})(V);(function(a){var b,c=u.vertex_index_bytes*4+u.material_index_bytes,f=a+u.nquad_flat*c;for(b=a;b<f;b+=c)p(b);return f-a})(Y);(function(a){var b,c=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*4,f=a+u.nquad_smooth*c;for(b=a;b<f;b+=c)v(b);return f-a})(Z);
+this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},v:function(a,c,b,f){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,f)))},f3:function(a,c,b,f,e){a.faces.push(new THREE.Face3(c,b,f,null,null,a.materials[e]))},f4:function(a,c,b,f,e,g){a.faces.push(new THREE.Face4(c,b,f,e,null,null,a.materials[g]))},f3n:function(a,c,b,f,e,g,h,j,k){var g=a.materials[g],l=c[j*
+3],m=c[j*3+1],j=c[j*3+2],n=c[k*3],o=c[k*3+1],k=c[k*3+2];a.faces.push(new THREE.Face3(b,f,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(l,m,j),new THREE.Vector3(n,o,k)],null,g))},f4n:function(a,c,b,f,e,g,h,j,k,l,m){var h=a.materials[h],n=c[k*3],o=c[k*3+1],k=c[k*3+2],p=c[l*3],v=c[l*3+1],l=c[l*3+2],w=c[m*3],x=c[m*3+1],m=c[m*3+2];a.faces.push(new THREE.Face4(b,f,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,v,l),new THREE.Vector3(w,x,
+m)],null,h))},uv3:function(a,c,b,f,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(f,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,f,e,g,h,j,k){var l=[];l.push(new THREE.UV(c,b));l.push(new THREE.UV(f,e));l.push(new THREE.UV(g,h));l.push(new THREE.UV(j,k));a.push(l)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,f=new Worker(a);f.postMessage(0);var e=THREE.Loader.prototype.extractUrlbase(a);f.onmessage=function(a){function f(a,b){return b=="relativeToHTML"?a:e+"/"+a}function j(){for(p in F.objects)if(!E.objects[p])if(A=F.objects[p],A.geometry!==void 0){if(H=E.geometries[A.geometry]){var a=!1;D=[];for(P=0;P<A.materials.length;P++)D[P]=E.materials[A.materials[P]],a=D[P]instanceof THREE.MeshShaderMaterial;a&&H.computeTangents();u=A.position;r=A.rotation;
+q=A.quaternion;s=A.scale;q=0;D.length==0&&(D[0]=new THREE.MeshFaceMaterial);D.length>1&&(D=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(H,D);object.name=p;object.position.set(u[0],u[1],u[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;E.scene.addObject(object);E.objects[p]=object;A.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),E.scene.collisions.colliders.push(a));
+if(A.castsShadow)a=new THREE.ShadowVolume(H),E.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;A.trigger&&A.trigger.toLowerCase()!="none"&&(a={type:A.trigger,object:A},E.triggers[object.name]=a)}}else u=A.position,r=A.rotation,q=A.quaternion,s=A.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(u[0],u[1],u[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=A.visible!==void 0?A.visible:!1,E.scene.addObject(object),E.objects[p]=object,E.empties[p]=object,A.trigger&&A.trigger.toLowerCase()!="none"&&(a={type:A.trigger,object:A},E.triggers[object.name]=a)}function k(a){return function(c){E.geometries[a]=c;j();N-=1;b.onLoadComplete();m()}}function l(a){return function(b){E.geometries[a]=b}}function m(){b.callbackProgress({totalModels:O,totalTextures:Q,loadedModels:O-N,loadedTextures:Q-M},E);b.onLoadProgress();N==0&&M==0&&c(E)}var n,
+o,p,v,w,x,y,A,u,B,C,H,J,K,I,D,G,F,L,N,M,O,Q,E;F=a.data;I=new THREE.BinaryLoader;L=new THREE.JSONLoader;M=N=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in F.objects)if(A=F.objects[p],A.meshCollider){a=!0;break}if(a)E.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;B=F.transform.rotation;var R=F.transform.scale;a&&E.scene.position.set(a[0],a[1],a[2]);B&&E.scene.rotation.set(B[0],
+B[1],B[2]);R&&E.scene.scale.set(R[0],R[1],R[2]);(a||B||R)&&E.scene.updateMatrix()}a=function(){M-=1;m();b.onLoadComplete()};for(w in F.cameras){B=F.cameras[w];if(B.type=="perspective")J=new THREE.Camera(B.fov,B.aspect,B.near,B.far);else if(B.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(B.left,B.right,B.top,B.bottom,B.near,B.far);u=B.position;B=B.target;J.position.set(u[0],u[1],u[2]);J.target.position.set(B[0],B[1],B[2]);E.cameras[w]=J}for(v in F.lights)w=F.lights[v],
+J=w.color!==void 0?w.color:16777215,B=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(u=w.direction,G=new THREE.DirectionalLight(J,B),G.position.set(u[0],u[1],u[2]),G.position.normalize()):w.type=="point"?(u=w.position,d=w.distance,G=new THREE.PointLight(J,B,d),G.position.set(u[0],u[1],u[2])):w.type=="ambient"&&(G=new THREE.AmbientLight(J)),E.scene.addLight(G),E.lights[v]=G;for(x in F.fogs)v=F.fogs[x],v.type=="linear"?K=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(K=new THREE.FogExp2(0,
+v.density)),B=v.color,K.color.setRGB(B[0],B[1],B[2]),E.fogs[x]=K;if(E.cameras&&F.defaults.camera)E.currentCamera=E.cameras[F.defaults.camera];if(E.fogs&&F.defaults.fog)E.scene.fog=E.fogs[F.defaults.fog];B=F.defaults.bgcolor;E.bgColor=new THREE.Color;E.bgColor.setRGB(B[0],B[1],B[2]);E.bgColorAlpha=F.defaults.bgalpha;for(n in F.geometries)if(x=F.geometries[n],x.type=="bin_mesh"||x.type=="ascii_mesh")N+=1,b.onLoadStart();O=N;for(n in F.geometries)x=F.geometries[n],x.type=="cube"?(H=new THREE.CubeGeometry(x.width,
+x.height,x.depth,x.segmentsWidth,x.segmentsHeight,x.segmentsDepth,null,x.flipped,x.sides),E.geometries[n]=H):x.type=="plane"?(H=new THREE.PlaneGeometry(x.width,x.height,x.segmentsWidth,x.segmentsHeight),E.geometries[n]=H):x.type=="sphere"?(H=new THREE.SphereGeometry(x.radius,x.segmentsWidth,x.segmentsHeight),E.geometries[n]=H):x.type=="cylinder"?(H=new THREE.CylinderGeometry(x.numSegs,x.topRad,x.botRad,x.height,x.topOffset,x.botOffset),E.geometries[n]=H):x.type=="torus"?(H=new THREE.TorusGeometry(x.radius,
+x.tube,x.segmentsR,x.segmentsT),E.geometries[n]=H):x.type=="icosahedron"?(H=new THREE.IcosahedronGeometry(x.subdivisions),E.geometries[n]=H):x.type=="bin_mesh"?I.load({model:f(x.url,F.urlBaseType),callback:k(n)}):x.type=="ascii_mesh"?L.load({model:f(x.url,F.urlBaseType),callback:k(n)}):x.type=="embedded_mesh"&&(x=F.embeds[x.id])&&L.createModel(x,l(n),"");for(y in F.textures)if(n=F.textures[y],n.url instanceof Array){M+=n.url.length;for(I=0;I<n.url.length;I++)b.onLoadStart()}else M+=1,b.onLoadStart();
+Q=M;for(y in F.textures){n=F.textures[y];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){I=[];for(var P=0;P<n.url.length;P++)I[P]=f(n.url[P],F.urlBaseType);I=THREE.ImageUtils.loadTextureCube(I,n.mapping,a)}else{I=THREE.ImageUtils.loadTexture(f(n.url,F.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)I.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)I.magFilter=THREE[n.magFilter];if(n.repeat){I.repeat.set(n.repeat[0],n.repeat[1]);
+if(n.repeat[0]!=1)I.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)I.wrapT=THREE.RepeatWrapping}n.offset&&I.offset.set(n.offset[0],n.offset[1]);if(n.wrap){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(L[n.wrap[0]]!==void 0)I.wrapS=L[n.wrap[0]];if(L[n.wrap[1]]!==void 0)I.wrapT=L[n.wrap[1]]}}E.textures[y]=I}for(o in F.materials){y=F.materials[o];for(C in y.parameters)if(C=="envMap"||C=="map"||C=="lightMap")y.parameters[C]=E.textures[y.parameters[C]];else if(C=="shading")y.parameters[C]=
+y.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C=="blending")y.parameters[C]=THREE[y.parameters[C]]?THREE[y.parameters[C]]:THREE.NormalBlending;else if(C=="combine")y.parameters[C]=y.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(y.parameters[C]=="face")y.parameters[C]=THREE.FaceColors;else if(y.parameters[C])y.parameters[C]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
+!0;if(y.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);I=y.parameters.color;L=y.parameters.specular;x=y.parameters.ambient;K=y.parameters.shininess;a.tNormal.texture=E.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=
+E.textures[y.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(I);a.uSpecularColor.value.setHex(L);a.uAmbientColor.value.setHex(x);a.uShininess.value=K;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);E.materials[o]=y}j();b.callbackSync(E)}}};
+THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,e){return a+(c-a)*e};this.VIntX=function(a,c,e,g,h,j,k,l,m,n){h=(h-m)/(n-m);m=this.normal_cache;c[g]=j+h*this.delta;c[g+1]=k;c[g+2]=l;e[g]=this.lerp(m[a],m[a+3],h);e[g+1]=this.lerp(m[a+1],m[a+4],h);e[g+2]=this.lerp(m[a+2],m[a+5],h)};this.VIntY=function(a,c,e,g,h,j,k,l,m,n){h=(h-m)/(n-m);m=this.normal_cache;c[g]=j;c[g+1]=k+h*this.delta;c[g+
+2]=l;c=a+this.yd*3;e[g]=this.lerp(m[a],m[c],h);e[g+1]=this.lerp(m[a+1],m[c+1],h);e[g+2]=this.lerp(m[a+2],m[c+2],h)};this.VIntZ=function(a,c,e,g,h,j,k,l,m,n){h=(h-m)/(n-m);m=this.normal_cache;c[g]=j;c[g+1]=k;c[g+2]=l+h*this.delta;c=a+this.zd*3;e[g]=this.lerp(m[a],m[c],h);e[g+1]=this.lerp(m[a+1],m[c+1],h);e[g+2]=this.lerp(m[a+2],m[c+2],h)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-this.field[a+
+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,e,g,h,j){var k=g+1,l=g+this.yd,m=g+this.zd,n=k+this.yd,o=k+this.zd,p=g+this.yd+this.zd,v=k+this.yd+this.zd,w=0,x=this.field[g],y=this.field[k],A=this.field[l],u=this.field[n],B=this.field[m],C=this.field[o],H=this.field[p],J=this.field[v];x<h&&(w|=1);y<h&&(w|=2);A<h&&(w|=8);u<h&&(w|=4);B<h&&(w|=16);C<h&&(w|=32);H<h&&(w|=128);J<h&&(w|=64);var K=THREE.edgeTable[w];if(K==0)return 0;var I=this.delta,
+D=a+I,G=c+I,I=e+I;K&1&&(this.compNorm(g),this.compNorm(k),this.VIntX(g*3,this.vlist,this.nlist,0,h,a,c,e,x,y));K&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,3,h,D,c,e,y,u));K&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,h,a,G,e,A,u));K&8&&(this.compNorm(g),this.compNorm(l),this.VIntY(g*3,this.vlist,this.nlist,9,h,a,c,e,x,A));K&16&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,12,h,a,c,I,B,C));K&32&&(this.compNorm(o),
+this.compNorm(v),this.VIntY(o*3,this.vlist,this.nlist,15,h,D,c,I,C,J));K&64&&(this.compNorm(p),this.compNorm(v),this.VIntX(p*3,this.vlist,this.nlist,18,h,a,G,I,H,J));K&128&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,21,h,a,c,I,B,H));K&256&&(this.compNorm(g),this.compNorm(m),this.VIntZ(g*3,this.vlist,this.nlist,24,h,a,c,e,x,B));K&512&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,27,h,D,c,e,y,C));K&1024&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*
+3,this.vlist,this.nlist,30,h,D,G,e,u,J));K&2048&&(this.compNorm(l),this.compNorm(p),this.VIntZ(l*3,this.vlist,this.nlist,33,h,a,G,e,A,H));w<<=4;for(h=g=0;THREE.triTable[w+h]!=-1;)a=w+h,c=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[e],j),h+=3,g++;return g};this.posnormtriv=function(a,c,e,g,h,j){var k=this.count*3;this.positionArray[k]=a[e];this.positionArray[k+1]=a[e+1];this.positionArray[k+2]=a[e+2];this.positionArray[k+3]=a[g];this.positionArray[k+
+4]=a[g+1];this.positionArray[k+5]=a[g+2];this.positionArray[k+6]=a[h];this.positionArray[k+7]=a[h+1];this.positionArray[k+8]=a[h+2];this.normalArray[k]=c[e];this.normalArray[k+1]=c[e+1];this.normalArray[k+2]=c[e+2];this.normalArray[k+3]=c[g];this.normalArray[k+4]=c[g+1];this.normalArray[k+5]=c[g+2];this.normalArray[k+6]=c[h];this.normalArray[k+7]=c[h+1];this.normalArray[k+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=function(){this.count=0;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,e,g,h){var j=this.size*Math.sqrt(g/h),k=e*this.size,l=c*this.size,m=a*this.size,n=Math.floor(k-j);n<1&&(n=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var o=Math.floor(l-j);o<1&&(o=1);l=Math.floor(l+j);l>this.size-1&&(l=this.size-1);var p=Math.floor(m-j);p<1&&(p=1);j=Math.floor(m+j);j>this.size-1&&(j=this.size-
+1);for(var v,w,x,y,A,u;n<k;n++){m=this.size2*n;w=n/this.size-e;A=w*w;for(w=o;w<l;w++){x=m+this.size*w;v=w/this.size-c;u=v*v;for(v=p;v<j;v++)y=v/this.size-a,y=g/(1.0E-6+y*y+u+A)-h,y>0&&(this.field[x+v]+=y)}}};this.addPlaneX=function(a,c){var e,g,h,j,k,l=this.size,m=this.yd,n=this.zd,o=this.field,p=l*Math.sqrt(a/c);p>l&&(p=l);for(e=0;e<p;e++)if(g=e/l,g*=g,j=a/(1.0E-4+g)-c,j>0)for(g=0;g<l;g++){k=e+g*m;for(h=0;h<l;h++)o[n*h+k]+=j}};this.addPlaneY=function(a,c){var e,g,h,j,k,l,m=this.size,n=this.yd,o=
+this.zd,p=this.field,v=m*Math.sqrt(a/c);v>m&&(v=m);for(g=0;g<v;g++)if(e=g/m,e*=e,j=a/(1.0E-4+e)-c,j>0){k=g*n;for(e=0;e<m;e++){l=k+e;for(h=0;h<m;h++)p[o*h+l]+=j}}};this.addPlaneZ=function(a,c){var e,g,h,j,k,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(e=h/size,e*=e,j=a/(1.0E-4+e)-c,j>0){k=zd*h;for(g=0;g<size;g++){l=k+g*yd;for(e=0;e<size;e++)field[l+e]+=j}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
+3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,e,g,h,j,k,l,m,n,o=this.size-2;for(h=1;h<o;h++){n=this.size2*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<o;g++){m=n+this.size*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<o;e++)j=(e-this.halfsize)/this.halfsize,c=m+e,this.polygonize(j,k,l,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,e=[];this.render(function(g){var h,j,k,l,m,n,o,p;for(h=0;h<g.count;h++)o=h*3,m=o+1,p=o+2,j=g.positionArray[o],
+k=g.positionArray[m],l=g.positionArray[p],n=new THREE.Vector3(j,k,l),j=g.normalArray[o],k=g.normalArray[m],l=g.normalArray[p],o=new THREE.Vector3(j,k,l),o.normalize(),m=new THREE.Vertex(n),c.vertices.push(m),e.push(o);nfaces=g.count/3;for(h=0;h<nfaces;h++)o=(a+h)*3,m=o+1,p=o+2,n=e[o],j=e[m],k=e[p],o=new THREE.Face3(o,m,p,[n,j,k]),c.faces.push(o);a+=nfaces;g.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -216,27 +237,27 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
-THREE.Trident=function(a){function b(b){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,a.length/20,a.length/5),new THREE.MeshBasicMaterial({color:b}))}function c(a,b){var c=new THREE.Geometry;c.vertices=[new THREE.Vertex,new THREE.Vertex(a)];return new THREE.Line(c,new THREE.LineBasicMaterial({color:b}))}THREE.Object3D.call(this);var g=Math.PI/2,e,a=a||THREE.Trident.defaultParams;if(a!==THREE.Trident.defaultParams)for(e in THREE.Trident.defaultParams)a.hasOwnProperty(e)||(a[e]=THREE.Trident.defaultParams[e]);
-this.scale=new THREE.Vector3(a.scale,a.scale,a.scale);this.addChild(c(new THREE.Vector3(a.length,0,0),a.xAxisColor));this.addChild(c(new THREE.Vector3(0,a.length,0),a.yAxisColor));this.addChild(c(new THREE.Vector3(0,0,a.length),a.zAxisColor));if(a.showArrows)e=b(a.xAxisColor),e.rotation.y=-g,e.position.x=a.length,this.addChild(e),e=b(a.yAxisColor),e.rotation.x=g,e.position.y=a.length,this.addChild(e),e=b(a.zAxisColor),e.rotation.y=Math.PI,e.position.z=a.length,this.addChild(e)};
-THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(a,b){this.point=a;this.normal=b};THREE.SphereCollider=function(a,b){this.center=a;this.radius=b;this.radiusSq=b*b};THREE.BoxCollider=function(a,b){this.min=a;this.max=b;this.dynamic=!0;this.normal=new THREE.Vector3};
-THREE.MeshCollider=function(a,b){this.mesh=a;this.box=b;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){this.colliders=this.colliders.concat(a.colliders);this.hits=this.hits.concat(a.hits)};
-THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var b,c,g,e,h=0;b=0;for(c=this.colliders.length;b<c;b++)if(e=this.colliders[b],g=this.rayCast(a,e),g<Number.MAX_VALUE)e.distance=g,g>h?this.hits.push(e):this.hits.unshift(e),h=g;return this.hits};
-THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var g=this.rayMesh(a,b[c]);if(g.dist<Number.MAX_VALUE){b[c].distance=g.dist;b[c].faceIndex=g.faceIndex;break}c++}if(c>b.length)return null;return b[c]};
-THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),g=Number.MAX_VALUE,e,h=0;h<b.numFaces;h++){var f=b.mesh.geometry.faces[h],j=b.mesh.geometry.vertices[f.a].position,k=b.mesh.geometry.vertices[f.b].position,l=b.mesh.geometry.vertices[f.c].position,m=f instanceof THREE.Face4?b.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(c,j,k,l,g,this.collisionNormal,b.mesh),f<g&&(g=f,e=h,b.normal.copy(this.collisionNormal),b.normal.normalize())):
-f instanceof THREE.Face4&&(f=this.rayTriangle(c,j,k,m,g,this.collisionNormal,b.mesh),f<g&&(g=f,e=h,b.normal.copy(this.collisionNormal),b.normal.normalize()),f=this.rayTriangle(c,k,l,m,g,this.collisionNormal,b.mesh),f<g&&(g=f,e=h,b.normal.copy(this.collisionNormal),b.normal.normalize()))}return{dist:g,faceIndex:e}};
-THREE.CollisionSystem.prototype.rayTriangle=function(a,b,c,g,e,h,f){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;h.set(0,0,0);j.sub(c,b);k.sub(g,c);h.cross(j,k);j=h.dot(a.direction);if(!(j<0))if(f.doubleSided||f.flipSided)h.multiplyScalar(-1),j*=-1;else return Number.MAX_VALUE;f=h.dot(b)-h.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=j*e))return Number.MAX_VALUE;f/=j;j=THREE.CollisionSystem.__v3;j.copy(a.direction);j.multiplyScalar(f);j.addSelf(a.origin);Math.abs(h.x)>
-Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=j.y-b.y,h=c.y-b.y,e=g.y-b.y,j=j.z-b.z,c=c.z-b.z,g=g.z-b.z):(a=j.x-b.x,h=c.x-b.x,e=g.x-b.x,j=j.y-b.y,c=c.y-b.y,g=g.y-b.y):Math.abs(h.y)>Math.abs(h.z)?(a=j.x-b.x,h=c.x-b.x,e=g.x-b.x,j=j.z-b.z,c=c.z-b.z,g=g.z-b.z):(a=j.x-b.x,h=c.x-b.x,e=g.x-b.x,j=j.y-b.y,c=c.y-b.y,g=g.y-b.y);b=h*g-c*e;if(b==0)return Number.MAX_VALUE;b=1/b;g=(a*g-j*e)*b;if(!(g>=0))return Number.MAX_VALUE;b*=h*j-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-g-b>=0))return Number.MAX_VALUE;return f};
-THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var g=THREE.CollisionSystem.__r;g.origin.copy(a.origin);g.direction.copy(a.direction);c.multiplyVector3(g.origin);c.rotateAxis(g.direction);g.direction.normalize();return g};
-THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var g=0,e=0,h=0,f=0,j=0,k=0,l=!0;c.origin.x<b.min.x?(g=b.min.x-c.origin.x,g/=c.direction.x,l=!1,f=-1):c.origin.x>b.max.x&&(g=b.max.x-c.origin.x,g/=c.direction.x,l=!1,f=1);c.origin.y<b.min.y?(e=b.min.y-c.origin.y,e/=c.direction.y,l=!1,j=-1):c.origin.y>b.max.y&&(e=b.max.y-c.origin.y,e/=c.direction.y,
-l=!1,j=1);c.origin.z<b.min.z?(h=b.min.z-c.origin.z,h/=c.direction.z,l=!1,k=-1):c.origin.z>b.max.z&&(h=b.max.z-c.origin.z,h/=c.direction.z,l=!1,k=1);if(l)return-1;l=0;e>g&&(l=1,g=e);h>g&&(l=2,g=h);switch(l){case 0:j=c.origin.y+c.direction.y*g;if(j<b.min.y||j>b.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*g;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(f,0,0);break;case 1:f=c.origin.x+c.direction.x*g;if(f<b.min.x||f>b.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
-g;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(0,j,0);break;case 2:f=c.origin.x+c.direction.x*g;if(f<b.min.x||f>b.max.x)return Number.MAX_VALUE;j=c.origin.y+c.direction.y*g;if(j<b.min.y||j>b.max.y)return Number.MAX_VALUE;b.normal.set(0,0,k)}return g};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),g=b.point.dot(b.normal);if(c<0)c=(g-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
-THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq<b.radiusSq)return-1;var g=c.dot(a.direction.clone());if(g<=0)return Number.MAX_VALUE;c=b.radiusSq-(c.lengthSq()-g*g);if(c>=0)return Math.abs(g)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
-THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b};
+THREE.Trident=function(a){function c(c){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,a.length/20,a.length/5),new THREE.MeshBasicMaterial({color:c}))}function b(a,c){var b=new THREE.Geometry;b.vertices=[new THREE.Vertex,new THREE.Vertex(a)];return new THREE.Line(b,new THREE.LineBasicMaterial({color:c}))}THREE.Object3D.call(this);var f=Math.PI/2,e,a=a||THREE.Trident.defaultParams;if(a!==THREE.Trident.defaultParams)for(e in THREE.Trident.defaultParams)a.hasOwnProperty(e)||(a[e]=THREE.Trident.defaultParams[e]);
+this.scale=new THREE.Vector3(a.scale,a.scale,a.scale);this.addChild(b(new THREE.Vector3(a.length,0,0),a.xAxisColor));this.addChild(b(new THREE.Vector3(0,a.length,0),a.yAxisColor));this.addChild(b(new THREE.Vector3(0,0,a.length),a.zAxisColor));if(a.showArrows)e=c(a.xAxisColor),e.rotation.y=-f,e.position.x=a.length,this.addChild(e),e=c(a.yAxisColor),e.rotation.x=f,e.position.y=a.length,this.addChild(e),e=c(a.zAxisColor),e.rotation.y=Math.PI,e.position.z=a.length,this.addChild(e)};
+THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
+THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){this.colliders=this.colliders.concat(a.colliders);this.hits=this.hits.concat(a.hits)};
+THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,f,e,g=0;c=0;for(b=this.colliders.length;c<b;c++)if(e=this.colliders[c],f=this.rayCast(a,e),f<Number.MAX_VALUE)e.distance=f,f>g?this.hits.push(e):this.hits.unshift(e),g=f;return this.hits};
+THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var f=this.rayMesh(a,c[b]);if(f.dist<Number.MAX_VALUE){c[b].distance=f.dist;c[b].faceIndex=f.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
+THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),f=Number.MAX_VALUE,e,g=0;g<c.numFaces;g++){var h=c.mesh.geometry.faces[g],j=c.mesh.geometry.vertices[h.a].position,k=c.mesh.geometry.vertices[h.b].position,l=c.mesh.geometry.vertices[h.c].position,m=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(b,j,k,l,f,this.collisionNormal,c.mesh),h<f&&(f=h,e=g,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+h instanceof THREE.Face4&&(h=this.rayTriangle(b,j,k,m,f,this.collisionNormal,c.mesh),h<f&&(f=h,e=g,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(b,k,l,m,f,this.collisionNormal,c.mesh),h<f&&(f=h,e=g,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:e}};
+THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,f,e,g,h){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;g.set(0,0,0);j.sub(b,c);k.sub(f,b);g.cross(j,k);j=g.dot(a.direction);if(!(j<0))if(h.doubleSided||h.flipSided)g.multiplyScalar(-1),j*=-1;else return Number.MAX_VALUE;h=g.dot(c)-g.dot(a.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=j*e))return Number.MAX_VALUE;h/=j;j=THREE.CollisionSystem.__v3;j.copy(a.direction);j.multiplyScalar(h);j.addSelf(a.origin);Math.abs(g.x)>
+Math.abs(g.y)?Math.abs(g.x)>Math.abs(g.z)?(a=j.y-c.y,g=b.y-c.y,e=f.y-c.y,j=j.z-c.z,b=b.z-c.z,f=f.z-c.z):(a=j.x-c.x,g=b.x-c.x,e=f.x-c.x,j=j.y-c.y,b=b.y-c.y,f=f.y-c.y):Math.abs(g.y)>Math.abs(g.z)?(a=j.x-c.x,g=b.x-c.x,e=f.x-c.x,j=j.z-c.z,b=b.z-c.z,f=f.z-c.z):(a=j.x-c.x,g=b.x-c.x,e=f.x-c.x,j=j.y-c.y,b=b.y-c.y,f=f.y-c.y);c=g*f-b*e;if(c==0)return Number.MAX_VALUE;c=1/c;f=(a*f-j*e)*c;if(!(f>=0))return Number.MAX_VALUE;c*=g*j-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h};
+THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,b);var f=THREE.CollisionSystem.__r;f.origin.copy(a.origin);f.direction.copy(a.direction);b.multiplyVector3(f.origin);b.rotateAxis(f.direction);f.direction.normalize();return f};
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var f=0,e=0,g=0,h=0,j=0,k=0,l=!0;b.origin.x<c.min.x?(f=c.min.x-b.origin.x,f/=b.direction.x,l=!1,h=-1):b.origin.x>c.max.x&&(f=c.max.x-b.origin.x,f/=b.direction.x,l=!1,h=1);b.origin.y<c.min.y?(e=c.min.y-b.origin.y,e/=b.direction.y,l=!1,j=-1):b.origin.y>c.max.y&&(e=c.max.y-b.origin.y,e/=b.direction.y,
+l=!1,j=1);b.origin.z<c.min.z?(g=c.min.z-b.origin.z,g/=b.direction.z,l=!1,k=-1):b.origin.z>c.max.z&&(g=c.max.z-b.origin.z,g/=b.direction.z,l=!1,k=1);if(l)return-1;l=0;e>f&&(l=1,f=e);g>f&&(l=2,f=g);switch(l){case 0:j=b.origin.y+b.direction.y*f;if(j<c.min.y||j>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*f;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=b.origin.x+b.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
+f;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,j,0);break;case 2:h=b.origin.x+b.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;j=b.origin.y+b.direction.y*f;if(j<c.min.y||j>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,k)}return f};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),f=c.point.dot(c.normal);if(b<0)b=(f-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var f=b.dot(a.direction.clone());if(f<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-f*f);if(b>=0)return Math.abs(f)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
+THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,g=this.render,e=new THREE.Camera,h=new THREE.Camera,f=new THREE.Matrix4,j=new THREE.Matrix4,k,l,m;e.useTarget=h.useTarget=!1;e.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.Camera(53,1,1,1E4);t.position.z=
-2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var v=new THREE.Scene;v.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);o.width=a;o.height=e;n.width=a;n.height=e};this.render=function(a,c){c.update(null,!0);if(k!==c.aspect||l!==c.near||m!==c.fov){k=c.aspect;l=c.near;m=c.fov;var w=c.projectionMatrix.clone(),x=125/30*0.5,p=x*l/125,z=l*Math.tan(m*Math.PI/360),A;f.n14=x;j.n14=-x;x=-z*k+p;A=z*k+p;w.n11=2*l/(A-x);w.n13=(A+x)/(A-x);e.projectionMatrix=w.clone();x=-z*k-p;A=z*k-p;w.n11=2*l/(A-x);
-w.n13=(A+x)/(A-x);h.projectionMatrix=w.clone()}e.matrix=c.matrixWorld.clone().multiplySelf(j);e.update(null,!0);e.position.copy(c.position);e.near=l;e.far=c.far;g.call(b,a,e,o,!0);h.matrix=c.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(c.position);h.near=l;h.far=c.far;g.call(b,a,h,n,!0);g.call(b,v,t)}};
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,g=this.render,e,h,f=new THREE.Camera,j=new THREE.Camera;b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,f){c.call(b,a,f);e=a/2;h=f};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=c.far;
-f.updateProjectionMatrix();f.position.copy(c.position);f.target.position.copy(c.target.position);f.translateX(b.separation);j.projectionMatrix=f.projectionMatrix;j.position.copy(c.position);j.target.position.copy(c.target.position);j.translateX(-b.separation);this.setViewport(0,0,e,h);g.call(b,a,f);this.setViewport(e,0,e,h);g.call(b,a,j,!1)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var c=this,b=this.setSize,f=this.render,e=new THREE.Camera,g=new THREE.Camera,h=new THREE.Matrix4,j=new THREE.Matrix4,k,l,m;e.useTarget=g.useTarget=!1;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.Camera(53,1,1,1E4);p.position.z=
+2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
+var v=new THREE.Scene;v.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);n.width=a;n.height=e;o.width=a;o.height=e};this.render=function(a,b){b.update(null,!0);if(k!==b.aspect||l!==b.near||m!==b.fov){k=b.aspect;l=b.near;m=b.fov;var y=b.projectionMatrix.clone(),A=125/30*0.5,u=A*l/125,B=l*Math.tan(m*Math.PI/360),C;h.n14=A;j.n14=-A;A=-B*k+u;C=B*k+u;y.n11=2*l/(C-A);y.n13=(C+A)/(C-A);e.projectionMatrix=y.clone();A=-B*k-u;C=B*k-u;y.n11=2*l/(C-A);
+y.n13=(C+A)/(C-A);g.projectionMatrix=y.clone()}e.matrix=b.matrixWorld.clone().multiplySelf(j);e.update(null,!0);e.position.copy(b.position);e.near=l;e.far=b.far;f.call(c,a,e,n,!0);g.matrix=b.matrixWorld.clone().multiplySelf(h);g.update(null,!0);g.position.copy(b.position);g.near=l;g.far=b.far;f.call(c,a,g,o,!0);f.call(c,v,p)}};
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,f=this.render,e,g,h=new THREE.Camera,j=new THREE.Camera;c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,f){b.call(c,a,f);e=a/2;g=f};this.render=function(a,b){this.clear();h.fov=b.fov;h.aspect=0.5*b.aspect;h.near=b.near;h.far=b.far;
+h.updateProjectionMatrix();h.position.copy(b.position);h.target.position.copy(b.target.position);h.translateX(c.separation);j.projectionMatrix=h.projectionMatrix;j.position.copy(b.position);j.target.position.copy(b.target.position);j.translateX(-c.separation);this.setViewport(0,0,e,g);f.call(c,a,h);this.setViewport(e,0,e,g);f.call(c,a,j,!1)}};

+ 18 - 3
examples/canvas_geometry_shape.html

@@ -76,7 +76,7 @@
 
 
 				}
 				}
 
 
-				var extrudeSettings = {	amount: 20 };
+				var extrudeSettings = {	amount: 20,  bevelEnabled: true, bevelSegments: 2, steps: 2 }; //amount: 40, steps: 2 
 
 
 				// California
 				// California
 
 
@@ -210,6 +210,18 @@
 				fishShape.quadraticCurveTo( x + 50, y - 80, x, y );
 				fishShape.quadraticCurveTo( x + 50, y - 80, x, y );
 
 
 				var fish3d = fishShape.extrude( extrudeSettings );
 				var fish3d = fishShape.extrude( extrudeSettings );
+				
+				// Arc Circle
+				var arcShape = new THREE.Shape();
+				arcShape.moveTo( 0, 0);
+				arcShape.arc(10,10, 40, 0, Math.PI*2,false);
+				
+				var holePath = new THREE.Path();
+				holePath.moveTo( 0, 0);
+				holePath.arc(10, 10, 10, 0, Math.PI*2, true);
+				arcShape.holes.push(holePath);
+				
+				var arc3d = arcShape.extrude( extrudeSettings );
 
 
 				// Spline shape + Path Extrusion
 				// Spline shape + Path Extrusion
 
 
@@ -227,11 +239,13 @@
 
 
 				var extrudePath = new THREE.Path();
 				var extrudePath = new THREE.Path();
 
 
+				extrudePath.moveTo(0,0);
 				extrudePath.lineTo( 10, 10 );
 				extrudePath.lineTo( 10, 10 );
 				extrudePath.quadraticCurveTo( 80, 60, 160, 10 );
 				extrudePath.quadraticCurveTo( 80, 60, 160, 10 );
 				extrudePath.quadraticCurveTo( 240, -40, 320, 10 );
 				extrudePath.quadraticCurveTo( 240, -40, 320, 10 );
 
 
 				extrudeSettings.path = extrudePath;
 				extrudeSettings.path = extrudePath;
+				extrudeSettings.bevelEnabled = false;
 
 
 				var splineShape3d = splineShape.extrude( extrudeSettings );
 				var splineShape3d = splineShape.extrude( extrudeSettings );
 
 
@@ -240,9 +254,10 @@
 				addGeometry( roundedRect3d, 0x005500, -150,  150, 0,     0, 0, 0, 1 );
 				addGeometry( roundedRect3d, 0x005500, -150,  150, 0,     0, 0, 0, 1 );
 				addGeometry( square3d, 		0x0055ff,  150,  100, 0,     0, 0, 0, 1 );
 				addGeometry( square3d, 		0x0055ff,  150,  100, 0,     0, 0, 0, 1 );
 				addGeometry( heart3d, 		0xff1100,    0,  100, 0,   3.14, 0, 0, 1 );
 				addGeometry( heart3d, 		0xff1100,    0,  100, 0,   3.14, 0, 0, 1 );
-				addGeometry( circle3d, 		0x00ff11,  150,    0, 0,     0, 0, 0, 1 );
+				addGeometry( circle3d, 		0x00ff11,  120,  250, 0,     0, 0, 0, 1 );
 				addGeometry( fish3d, 		0x222222,  -50,  200, 0,     0, 0, 0, 1 );
 				addGeometry( fish3d, 		0x222222,  -50,  200, 0,     0, 0, 0, 1 );
-				addGeometry( splineShape3d, 0x888888,  -50,  -100, -50,     0, 0, 0, 0.2 );
+				addGeometry( splineShape3d, 		0x888888,  -50,  -100, -50,     0, 0, 0, 0.2 );
+				addGeometry( arc3d, 		0xbb4422,  150,    0, 0,     0, 0, 0, 1 );
 
 
 				renderer = new THREE.CanvasRenderer();
 				renderer = new THREE.CanvasRenderer();
                 renderer.setSize( window.innerWidth, window.innerHeight );
                 renderer.setSize( window.innerWidth, window.innerHeight );

+ 404 - 0
src/extras/geometries/Curve.js

@@ -0,0 +1,404 @@
+/**
+ * @author zz85 / http://www.lab4games.net/zz85/blog
+ * Extensible curve object
+ *
+ * This file contains following classes:
+ *
+ * THREE.Curve
+ * THREE.LineCurve
+ * THREE.QuadraticBezierCurve
+ * THREE.CubicBezierCurve
+ * THREE.SplineCurve
+ * THREE.ArcCurve
+ *
+ **/
+
+/**************************************************************
+ *	Abstract Curve base class
+ **************************************************************/
+
+THREE.Curve = function() {
+
+};
+
+// Virtual base class method to overwrite and implement in subclasses
+//	- t [0 .. 1]
+
+THREE.Curve.prototype.getPoint = function ( t ) {
+
+	console.log( "Warning, getPoint() not implemented!" );
+	return null;
+
+};
+
+// Get point at relative position in curve according to arc length
+// - u [0 .. 1]
+
+THREE.Curve.prototype.getPointAt = function ( u ) {
+
+	var t = this.getUtoTmapping( u );
+	return this.getPoint( t );
+
+};
+
+// Get sequence of points using getPoint( t )
+
+THREE.Curve.prototype.getPoints = function ( divisions ) {
+
+	if ( !divisions ) divisions = 5;
+
+	var d, pts = [];
+
+	for ( d = 0; d <= divisions; d ++ ) {
+
+		pts.push( this.getPoint( d / divisions ) );
+
+	};
+
+	return pts;
+
+};
+
+// Get sequence of points using getPointAt( u )
+
+THREE.Curve.prototype.getSpacedPoints = function ( divisions ) {
+
+	if ( !divisions ) divisions = 5;
+
+	var d, pts = [];
+
+	for ( d = 0; d <= divisions; d ++ ) {
+
+		pts.push( this.getPointAt( d / divisions ) );
+
+	};
+
+	return pts;
+
+};
+
+// Get total curve length
+
+THREE.Curve.prototype.getLength = function () {
+
+	var lengths = this.getLengths();
+	return lengths[ lengths.length - 1 ];
+
+};
+
+// Get list of cumulative segment lengths
+
+THREE.Curve.prototype.getLengths = function( divisions ) {
+
+	if ( !divisions ) divisions = 200;
+
+	if ( this.cacheLengths && ( this.cacheLengths.length == divisions ) ) {
+
+		//console.log( "cached", this.cacheLengths );
+		return this.cacheLengths;
+
+	}
+
+	var cache = [];
+	var current, last = this.getPoint( 0 );
+	var p, sum = 0;
+
+	for ( p = 1; p <= divisions; p++ ) {
+
+		current = this.getPoint ( p / divisions );
+		sum += current.distanceTo( last );
+		cache.push( sum );
+		last = current;
+
+	}
+
+	this.cacheLengths = cache;
+	return cache; // { sums: cache, sum:sum }; Sum is in the last element.
+
+};
+
+// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance
+
+THREE.Curve.prototype.getUtoTmapping = function( u, distance ) {
+
+	var lengths = this.getLengths();
+	var i = 0, il = lengths.length;
+
+	var distanceForU;
+
+	if ( distance ) {
+
+		distanceForU = distance;
+
+	} else {
+
+		distanceForU = u * lengths[ il - 1 ];
+
+	}
+
+	// TODO Should do binary search + sub division + interpolation when needed
+
+	while ( i < il ) {
+
+		if ( lengths[ i ] > distanceForU ) break;
+
+		i++;
+
+	}
+
+	var t = i / il;
+	return t;
+
+};
+
+
+/**************************************************************
+ *	Line
+ **************************************************************/
+
+THREE.LineCurve = function ( x1, y1, x2, y2 ) {
+
+	this.x1 = x1;
+	this.y1 = y1;
+
+	this.x2 = x2;
+	this.y2 = y2;
+
+};
+
+THREE.LineCurve.prototype = new THREE.Curve();
+THREE.LineCurve.prototype.constructor = THREE.LineCurve;
+
+THREE.LineCurve.prototype.getPoint = function ( t ) {
+
+	var dx = this.x2 - this.x1;
+	var dy = this.y2 - this.y1;
+
+	var tx = this.x1 + dx * t;
+	var ty = this.y1 + dy * t;
+
+	return new THREE.Vector2( tx, ty );
+
+};
+
+/**************************************************************
+ *	Quadratic Bezier curve
+ **************************************************************/
+
+THREE.QuadraticBezierCurve = function ( x0, y0, x1, y1, x2, y2 ) {
+
+	this.x0 = x0;
+	this.y0 = y0;
+
+	this.x1 = x1;
+	this.y1 = y1;
+
+	this.x2 = x2;
+	this.y2 = y2;
+
+};
+
+THREE.QuadraticBezierCurve.prototype = new THREE.Curve();
+THREE.QuadraticBezierCurve.prototype.constructor = THREE.QuadraticBezierCurve;
+
+
+THREE.QuadraticBezierCurve.prototype.getPoint = function ( t ) {
+
+	var tx, ty;
+
+	tx = THREE.FontUtils.b2( t, this.x0, this.x1, this.x2 );
+	ty = THREE.FontUtils.b2( t, this.y0, this.y1, this.y2 );
+
+	return new THREE.Vector2( tx, ty );
+
+};
+
+
+THREE.QuadraticBezierCurve.prototype.getNormalVector = function( t ) {
+
+	// iterate sub segments
+	// 	get lengths for sub segments
+	// 	if segment is bezier
+	//		perform subdivisions or perform integrals
+
+	var x0, y0, x1, y1, x2, y2;
+
+	x0 = this.actions[ 0 ].args[ 0 ];
+	y0 = this.actions[ 0 ].args[ 1 ];
+
+	x1 = this.actions[ 1 ].args[ 0 ];
+	y1 = this.actions[ 1 ].args[ 1 ];
+
+	x2 = this.actions[ 1 ].args[ 2 ];
+	y2 = this.actions[ 1 ].args[ 3 ];
+
+	var tx, ty;
+
+	tx = THREE.Curve.Utils.tangentQuadraticBezier( t, this.x0, this.x1, this.x2 );
+	ty = THREE.Curve.Utils.tangentQuadraticBezier( t, this.y0, this.y1, this.y2 );
+
+	// return normal unit vector
+	return new THREE.Vector2( -ty , tx ).unit();
+
+};
+
+
+/**************************************************************
+ *	Cubic Bezier curve
+ **************************************************************/
+
+THREE.CubicBezierCurve = function ( x0, y0, x1, y1, x2, y2, x3, y3 ) {
+
+	this.x0 = x0;
+	this.y0 = y0;
+
+	this.x1 = x1;
+	this.y1 = y1;
+
+	this.x2 = x2;
+	this.y2 = y2;
+
+	this.x3 = x3;
+	this.y3 = y3;
+
+};
+
+THREE.CubicBezierCurve.prototype = new THREE.Curve();
+THREE.CubicBezierCurve.prototype.constructor = THREE.CubicBezierCurve;
+
+THREE.CubicBezierCurve.prototype.getPoint = function ( t ) {
+
+	var tx, ty;
+
+	tx = THREE.FontUtils.b3( t, this.x0, this.x1, this.x2, this.x3 );
+	ty = THREE.FontUtils.b3( t, this.y0, this.y1, this.y2, this.y3 );
+
+	return new THREE.Vector2( tx, ty );
+
+};
+
+/**************************************************************
+ *	Spline curve
+ **************************************************************/
+
+THREE.SplineCurve = function ( points ) {
+
+	this.points = points;
+
+};
+
+THREE.SplineCurve.prototype = new THREE.Curve();
+THREE.SplineCurve.prototype.constructor = THREE.SplineCurve;
+
+THREE.SplineCurve.prototype.getPoint = function ( t ) {
+
+	var v = new THREE.Vector2();
+	var c = [];
+	var points = this.points, point, intPoint, weight;
+	point = ( points.length - 1 ) * t;
+
+	intPoint = Math.floor( point );
+	weight = point - intPoint;
+
+	c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1;
+	c[ 1 ] = intPoint;
+	c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1;
+	c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2;
+
+	v.x = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].x, points[ c[ 1 ] ].x, points[ c[ 2 ] ].x, points[ c[ 3 ] ].x, weight );
+	v.y = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].y, points[ c[ 1 ] ].y, points[ c[ 2 ] ].y, points[ c[ 3 ] ].y, weight );
+
+	return v;
+
+};
+
+/**************************************************************
+ *	Arc curve
+ **************************************************************/
+
+THREE.ArcCurve = function ( aX, aY, aRadius,
+							aStartAngle, aEndAngle, aClockwise ) {
+	this.aX = aX;
+	this.aY = aY;
+
+	this.aRadius = aRadius;
+
+	this.aStartAngle = aStartAngle;
+	this.aEndAngle = aEndAngle;
+
+	this.aClockwise = aClockwise;
+
+};
+
+THREE.ArcCurve.prototype = new THREE.Curve();
+THREE.ArcCurve.prototype.constructor = THREE.ArcCurve;
+
+THREE.ArcCurve.prototype.getPoint = function ( t ) {
+
+	var deltaAngle = this.aEndAngle - this.aStartAngle;
+
+	if ( !this.aClockwise ) {
+
+		t = 1 - t;
+
+	}
+
+	var angle = this.aStartAngle + t * deltaAngle;
+
+	var tx = this.aX + this.aRadius * Math.cos( angle );
+	var ty = this.aY + this.aRadius * Math.sin( angle );
+
+	return new THREE.Vector2( tx, ty );
+
+};
+
+/**************************************************************
+ *	Utils
+ **************************************************************/
+
+THREE.Curve.Utils = {
+
+	tangentQuadraticBezier: function ( t, p0, p1, p2 ) {
+
+		return 2 * ( 1 - t ) * ( p1 - p0 ) + 2 * t * ( p2 - p1 );
+
+	},
+
+	tangentSpline: function ( t, p0, p1, p2, p3 ) {
+
+		// To check if my formulas are correct
+
+		var h00 = 6 * t * t - 6 * t; 	// derived from 2t^3 − 3t^2 + 1
+		var h10 = 3 * t * t - 4 * t + 1; // t^3 − 2t^2 + t
+		var h01 = -6 * t * t + 6 * t; 	// − 2t3 + 3t2
+		var h11 = 3 * t * t - 2 * t;	// t3 − t2
+
+	},
+
+	// Catmull-Rom
+
+	interpolate: function( p0, p1, p2, p3, t ) {
+
+		var v0 = ( p2 - p0 ) * 0.5;
+		var v1 = ( p3 - p1 ) * 0.5;
+		var t2 = t * t;
+		var t3 = t * t2;
+		return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;
+
+	}
+
+};
+
+
+
+
+/*
+getPoint DONE
+getLength DONE
+getLengths DONE
+
+curve.getPoints(); DONE
+curve.getPointAtArcLength(t); DONE
+curve.transform(params);
+curve.getTangentAt(t)
+*/

+ 269 - 107
src/extras/geometries/ExtrudeGeometry.js

@@ -1,21 +1,24 @@
 /**
 /**
  * @author zz85 / http://www.lab4games.net/zz85/blog
  * @author zz85 / http://www.lab4games.net/zz85/blog
- * Creates extruded geometry form path.
+ * Creates extruded geometry from a path shape.
  **/
  **/
 
 
 THREE.ExtrudeGeometry = function( shape, options ) {
 THREE.ExtrudeGeometry = function( shape, options ) {
 
 
 	var amount = options.amount !== undefined ? options.amount : 100;
 	var amount = options.amount !== undefined ? options.amount : 100;
 
 
-	// todo: bezel
-
-	var bezelThickness = options.bezelThickness !== undefined ? options.bezelThickness : 10;
-	var bezelSize = options.bezelSize !== undefined ? options.bezelSize : 8;
-	var bezelEnabled = options.bezelEnabled !== undefined ? options.bezelEnabled : false;
+	// todo: bevel
+	var bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 8; // 10
+	var bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness; // 8 
+	var bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true; // false
+	var bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;
+	// We should set bevel segments to 0 if bevel is not enabled.
+	if (!bevelEnabled) bevelSegments = 0 ;
+	
 
 
 	var steps = options.steps !== undefined ? options.steps : 1;
 	var steps = options.steps !== undefined ? options.steps : 1;
+	
 	var extrudePath = options.path !== undefined ? options.path : null;
 	var extrudePath = options.path !== undefined ? options.path : null;
-
 	var extrudePts, extrudeByPath = false;
 	var extrudePts, extrudeByPath = false;
 
 
 	if ( extrudePath ) {
 	if ( extrudePath ) {
@@ -25,34 +28,170 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 		extrudeByPath = true;
 		extrudeByPath = true;
 
 
 	}
 	}
+	
 
 
 	// TODO, extrude by path's tangents? also via 3d path?
 	// TODO, extrude by path's tangents? also via 3d path?
 
 
 	THREE.Geometry.call( this );
 	THREE.Geometry.call( this );
 
 
-    var vertices = shape.getPoints();
-    var faces = shape.triangulate();
-    var contour = vertices;
+	
+	// Variables initalization
+	var ahole, h, hl; // looping of holes
+	var scope = this;
+	var bevelPoints = [];
+
+
+	// getPoints
+	var shapePoints = shape.extractAllPoints(false);
+	// false for getPoints | true for getSpacedPoints() for points with equal divisions
+	
+    var vertices = shapePoints.shape; 
+	var holes =  shapePoints.holes;
+	
+	var reverse = !THREE.Shape.Utils.isClockWise( vertices ) ;
+
+	if (reverse) {
+
+		vertices = vertices.reverse();
+		
+		// Maybe we should also check if holes are in the opposite direction, just to be safe...
+		
+		for (h = 0, hl = holes.length;  h < hl; h++ ) {
+			
+			ahole = holes[h];
+			if (THREE.Shape.Utils.isClockWise(ahole)) {
+				
+				holes[h] = ahole.reverse();
+				
+			}
+		}
+		
+		reverse = false; // If vertices are in order now, we shouldn't need to worry about them again (hopefully)!
+	}
+	
+	
+	
+	var faces = THREE.Shape.Utils.triangulateShape(vertices, holes);
+	//var faces = THREE.Shape.Utils.triangulate2(vertices, holes);
+
+	//console.log(faces);
+	
+	////
+	///   Handle Vertices
+	////
+	
+	var contour = vertices; // vertices has all points but contour has only points of circumference
+	
+	for (h = 0, hl = holes.length;  h < hl; h++ ) {
+
+		ahole = holes[h];
+
+		vertices = vertices.concat(ahole);
+
+	}
+	
+	// Find all centroids of shapes and holes
+	
+	var b;	
+	var sum = new THREE.Vector2();
+	var contourCentroid, holesCentroids;
+	
+	for (i=0, il = contour.length; i<il; i++) {
+		sum.addSelf(contour[i]);
+	}
+	
+	contourCentroid = sum.divideScalar( contour.length ) ;
+	
+	holesCentroids = [];
+	
+	
+	for (h=0, hl = holes.length; h<hl; h++) {
+		sum = new THREE.Vector2();
+		ahole = holes[h];
+		
+		for (i=0, il = ahole.length; i<il; i++) {
+			sum.addSelf(ahole[i]);
+		}
+		
+		holesCentroids[h] = sum.divideScalar( ahole.length ) ;
+		
+	}
+	
+	function scalePt (pt, centroid, size, expandOutwards /* Boolean */ ) {
+		vectorFromCentroid = pt.clone().subSelf( centroid );
+		adj = size / vectorFromCentroid.length();
+
+		if ( expandOutwards ) {
 
 
-    var scope = this;
+			adj += 1;
 
 
-	var bezelPoints = [];
+		}  else {
 
 
-	var reverse = THREE.FontUtils.Triangulate.area( vertices ) > 0 ;
+			adj = 1 - adj;
+
+		}
+
+		return vectorFromCentroid.multiplyScalar( adj ).addSelf( centroid );
+	}
+	
 
 
-	//console.log(reverse);
 
 
 	var i,
 	var i,
 		vert, vlen = vertices.length,
 		vert, vlen = vertices.length,
 		face, flen = faces.length,
 		face, flen = faces.length,
-		bezelPt, blen = bezelPoints.length;
-
+		cont, clen = contour.length,
+		hol, hlen;
+		
+
+	var bs;
+	
+	// Loop bevelSegments, 1 for the front, 1 for the back
+	
+	for (b=bevelSegments; b > 0; b--) {
+		t =  b / bevelSegments;
+		z = bevelThickness * t;
+		// Formula could probably be simplified
+		bs = bevelSize * (1-Math.sin ((1-t) * Math.PI/2 )) ; //bevelSize * t ;
+
+		// contract shape
+		for ( i = 0, il = contour.length; i < il; i++ ) {
+			
+			vert = scalePt(contour[i], contourCentroid, bs , false);
+			v( vert.x, vert.y,  -z);
+			
+		}
+		
+		// expand holes
+		for ( h = 0, hl = holes.length; h < hl; h++ ) {
+			
+			ahole = holes[h];
+			for ( i = 0, il = ahole.length; i < il; i++ ) {
+				vert = scalePt(ahole[i], holesCentroids[h] , bs , true);	
+				v( vert.x, vert.y,  -z);
+			}
+			
+		}
+		
+	}
+	
+	
 	// Back facing vertices
 	// Back facing vertices
 
 
 	for ( i = 0; i < vlen; i++ ) {
 	for ( i = 0; i < vlen; i++ ) {
 
 
 		vert = vertices[ i ];
 		vert = vertices[ i ];
-		v( vert.x, vert.y, 0 );
+		//v( vert.x, vert.y, 0 );
+		
+		
+		if ( !extrudeByPath ) {
+
+			v( vert.x, vert.y, 0 );
+
+		} else {
+
+			v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );
+
+		}
 
 
 	}
 	}
 
 
@@ -79,121 +218,151 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 		}
 		}
 
 
 	}
 	}
+	
+	
+	// Add Bevel Segments planes
+
+	for (b=1; b <= bevelSegments; b++) {
+		
+			t =  b / bevelSegments;
+			z = bevelThickness * t;
+			bs = bevelSize * (1-Math.sin ((1-t) * Math.PI/2 )); 
+			
+			// contract shape
+			for ( i = 0, il = contour.length; i < il; i++ ) {
+
+				vert = scalePt(contour[i], contourCentroid, bs , false);
+				v( vert.x, vert.y,  amount + z);
 
 
-	/*
-	// Front facing vertices
-
-	for ( i = 0; i < vlen; i++ ) {
-
-		vert = vertices[ i ];
-		v( vert.x, vert.y, amount );
-
-	}
-	*/
-
-
-	if ( bezelEnabled ) {
-
-		for ( i = 0; i < blen; i++ ) {
-
-			bezelPt = bezelPoints[ i ];
-			v( bezelPt.x, bezelPt.y, bezelThickness );
+			}
 
 
-		}
+			// expand holes
+			for ( h = 0, hl = holes.length; h < hl; h++ ) {
 
 
-		for ( i = 0; i < blen; i++ ) {
+				ahole = holes[h];
+				for ( i = 0, il = ahole.length; i < il; i++ ) {
+					vert = scalePt(ahole[i], holesCentroids[h] , bs , true);
+					
+					if ( !extrudeByPath ) {
 
 
-			bezelPt = bezelPoints[ i ];
-			v( bezelPt.x, bezelPt.y, amount - bezelThickness );
+						v( vert.x, vert.y,  amount + z);
 
 
-		}
+					} else {
 
 
-	}
+						v( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x +z);
 
 
-	// Bottom faces
-
-	for ( i = 0; i < flen; i++ ) {
-
-		face = faces[ i ];
-		f3( face[ 2 ], face[ 1 ], face[ 0 ] );
+					}
+					
+				}
 
 
+			}
+		
 	}
 	}
+	
 
 
-	// Top faces
-
-	for ( i = 0; i < flen; i++ ) {
 
 
-		face = faces[ i ];
-		f3( face[ 0 ] + vlen* steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );
 
 
-	}
+	
+	////
+	///   Handle Faces
+	////
+	
 
 
-	var lastV;
-	var j, k, l, m;
+	// Bottom faces
+	if (bevelEnabled ) {
+		
+		
+		var layer = 0 ; //steps + 1
+		var offset = vlen * layer;
+		
+		for ( i = 0; i < flen; i++ ) {
 
 
-	// Sides faces
+			face = faces[ i ];
+			f3( face[ 2 ]+ offset, face[ 1 ]+ offset, face[ 0 ] + offset);
 
 
-	//contour.push( contour[ 0 ] ); // in order not to check for boundary indices every time
+		}
 
 
-	i = contour.length;
+		layer = steps + bevelSegments* 2;
+		offset = vlen * layer;
+		
+		// Top faces
+		var layers = (steps + bevelSegments * 2)  * vlen; 
+		for ( i = 0; i < flen; i++ ) {
 
 
-	while ( --i >= 0 ) {
+			face = faces[ i ];
+			f3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );
 
 
-		lastV = contour[ i ];
+		}
 
 
-		// TO OPTIMISE. Reduce this step of checking vertices.
+	} else {
 
 
-		/*
-		for ( j = 0; j < vlen; j++ ) {
+		for ( i = 0; i < flen; i++ ) {
 
 
-			if ( vertices[ j ].equals( contour[ i ] ) ) break;
+			face = faces[ i ];
+			f3( face[ 2 ], face[ 1 ], face[ 0 ] );
 
 
 		}
 		}
 
 
-		for ( k = 0; k < vlen; k++ ) {
+		// Top faces
+		var layers = (steps + bevelSegments * 2)  * vlen; 
+		for ( i = 0; i < flen; i++ ) {
 
 
-			if ( vertices[ k ].equals( contour[ i - 1 ] ) ) break;
+			face = faces[ i ];
+			f3( face[ 0 ] + vlen* steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );
 
 
 		}
 		}
-		*/
-
-		//TOREMOVE
-		//console.log('a', i,j, i-1, k);
+	}
 
 
-		j = i;
-		//if (j==vertices.length) j = 0;
+	var tmpPt;
+	var j, k, l, m;
 
 
-		k = i - 1;
+	var layeroffset = 0;
+	
+	// Sides faces
+	
+	sidewalls(contour);
+	layeroffset += contour.length;
+	
+	for (h = 0, hl = holes.length;  h < hl; h++ ) {
+		ahole = holes[h];
+		sidewalls(ahole); 
+		//, true
+		layeroffset += ahole.length;
+	}
 
 
-		if ( k < 0 ) k = vertices.length - 1;
+	// Create faces for the z-sides of the shape	
+	function sidewalls(contour) {
+	
+		i = contour.length;
 
 
-		//console.log('b', i,j, i-1, k,vertices.length);
+		while ( --i >= 0 ) {
 
 
-		// Create faces for the z-sides of the text
+			tmpPt = contour[ i ];
 
 
-		//f4( j, k, k + vlen, j + vlen );
+			j = i;
+		
+			k = i - 1;
 
 
-		// Reverse
-		//f4( k, j, j + vlen, k + vlen);
+			if ( k < 0 ) k = contour.length - 1;
 
 
-		//
+			//console.log('b', i,j, i-1, k,vertices.length);
 
 
-		var s = 0;
+			var s = 0;
 
 
-		for ( ; s < steps; s++ ) {
+			for ( ; s < (steps  + bevelSegments * 2) ; s++ ) {
 
 
-			var slen1 = vlen * s;
-			var slen2 = vlen * ( s + 1 );
+				var slen1 = vlen * s;
+				var slen2 = vlen * ( s + 1 );
+		
+			
+				f4( layeroffset + j + slen1, layeroffset + k + slen1, layeroffset + k + slen2, layeroffset + j + slen2 );
+				
 
 
-			f4( j + slen1, k + slen1, k + slen2, j + slen2 );
+			}
 
 
 		}
 		}
-
-		//
-
 	}
 	}
-
-
+	
 	// UVs to be added
 	// UVs to be added
 
 
 	this.computeCentroids();
 	this.computeCentroids();
@@ -208,29 +377,22 @@ THREE.ExtrudeGeometry = function( shape, options ) {
 
 
 	function f3( a, b, c ) {
 	function f3( a, b, c ) {
 
 
-		if ( reverse ) {
-
-			scope.faces.push( new THREE.Face3( c, b, a ) );
-
-		} else {
-
-			scope.faces.push( new THREE.Face3( a, b, c ) );
-
-		}
+		// if ( reverse ) { // Can now be removed
+		// 
+		// 		scope.faces.push( new THREE.Face3( c, b, a ) );
+		// 
+		// 	} else {
+		// 
+		 		scope.faces.push( new THREE.Face3( a, b, c ) );
+		// 
+		// 	}
 
 
 	}
 	}
 
 
 	function f4( a, b, c, d ) {
 	function f4( a, b, c, d ) {
 
 
-		if ( reverse ) {
-
-			scope.faces.push( new THREE.Face4( d, c, b, a ) );
 
 
-		} else {
-
-			scope.faces.push( new THREE.Face4( a, b, c, d ) );
-
-		}
+ 		scope.faces.push( new THREE.Face4( a, b, c, d ) );
 
 
 	}
 	}
 
 

+ 356 - 56
src/extras/geometries/Path.js

@@ -1,11 +1,13 @@
 /**
 /**
  * @author zz85 / http://www.lab4games.net/zz85/blog
  * @author zz85 / http://www.lab4games.net/zz85/blog
- * Creates free form path.
+ * Creates free form 2d path using series of points, lines or curves.
+ *
  **/
  **/
 
 
 THREE.Path = function ( points ) {
 THREE.Path = function ( points ) {
 
 
 	this.actions = [];
 	this.actions = [];
+	this.curves = [];
 
 
 	if ( points ) {
 	if ( points ) {
 
 
@@ -19,20 +21,24 @@ THREE.PathActions = {
 
 
 	MOVE_TO: 'moveTo',
 	MOVE_TO: 'moveTo',
 	LINE_TO: 'lineTo',
 	LINE_TO: 'lineTo',
-	QUADRATIC_CURVE_TO: 'quadraticCurveTo', // BEZIER quadratic CURVE
-	BEZIER_CURVE_TO: 'bezierCurveTo', 		// BEZIER cubic CURVE
-	CSPLINE_THRU: 'splineThru' 				// TODO cardinal splines
+	QUADRATIC_CURVE_TO: 'quadraticCurveTo', // Bezier quadratic curve
+	BEZIER_CURVE_TO: 'bezierCurveTo', 		// Bezier cubic curve
+	CSPLINE_THRU: 'splineThru',				// Catmull-rom spline
+	ARC: 'arc'								// Circle
 
 
 };
 };
 
 
-/* Create path using straight lines to connect all points */
+// TODO Clean up PATH API
 
 
-THREE.Path.prototype.fromPoints = function( vectors /*Array of Vector*/ ) {
+// Create path using straight lines to connect all points
+// - vectors: array of Vector2
 
 
-	var v = 0, vlen = vectors.length;
+THREE.Path.prototype.fromPoints = function( vectors ) {
 
 
 	this.moveTo( vectors[ 0 ].x, vectors[ 0 ].y );
 	this.moveTo( vectors[ 0 ].x, vectors[ 0 ].y );
 
 
+	var v, vlen = vectors.length;
+
 	for ( v = 1; v < vlen; v++ ) {
 	for ( v = 1; v < vlen; v++ ) {
 
 
 		this.lineTo( vectors[ v ].x, vectors[ v ].y );
 		this.lineTo( vectors[ v ].x, vectors[ v ].y );
@@ -41,6 +47,8 @@ THREE.Path.prototype.fromPoints = function( vectors /*Array of Vector*/ ) {
 
 
 };
 };
 
 
+// startPath() endPath()?
+
 THREE.Path.prototype.moveTo = function( x, y ) {
 THREE.Path.prototype.moveTo = function( x, y ) {
 
 
 	var args = Array.prototype.slice.call( arguments );
 	var args = Array.prototype.slice.call( arguments );
@@ -51,34 +59,126 @@ THREE.Path.prototype.moveTo = function( x, y ) {
 THREE.Path.prototype.lineTo = function( x, y ) {
 THREE.Path.prototype.lineTo = function( x, y ) {
 
 
 	var args = Array.prototype.slice.call( arguments );
 	var args = Array.prototype.slice.call( arguments );
-	this.actions.push( { action: THREE.PathActions.LINE_TO, args: args } );
+
+	var lastargs = this.actions[ this.actions.length - 1 ].args;
+
+	var x0 = lastargs[ lastargs.length - 2 ];
+	var y0 = lastargs[ lastargs.length - 1 ];
+
+	var curve = new THREE.LineCurve( x0, y0, x, y );
+	this.curves.push( curve );
+
+	this.actions.push( { action: THREE.PathActions.LINE_TO, args: args, curve: curve } );
 
 
 };
 };
 
 
 THREE.Path.prototype.quadraticCurveTo = function( aCPx, aCPy, aX, aY ) {
 THREE.Path.prototype.quadraticCurveTo = function( aCPx, aCPy, aX, aY ) {
 
 
 	var args = Array.prototype.slice.call( arguments );
 	var args = Array.prototype.slice.call( arguments );
-	this.actions.push( { action: THREE.PathActions.QUADRATIC_CURVE_TO, args: args });
+
+	var lastargs = this.actions[ this.actions.length - 1 ].args;
+
+	var x0 = lastargs[ lastargs.length - 2 ];
+	var y0 = lastargs[ lastargs.length - 1 ];
+
+	var curve = new THREE.QuadraticBezierCurve( x0, y0, aCPx, aCPy, aX, aY );
+	this.curves.push( curve );
+
+	this.actions.push( { action: THREE.PathActions.QUADRATIC_CURVE_TO, args: args, curve: curve } );
+
+	//console.log(curve, curve.getPoints(), curve.getSpacedPoints());
+	//console.log(curve.getPointAt(0), curve.getPointAt(0),curve.getUtoTmapping(0), curve.getSpacedPoints());
 
 
 };
 };
 
 
 THREE.Path.prototype.bezierCurveTo = function( aCP1x, aCP1y,
 THREE.Path.prototype.bezierCurveTo = function( aCP1x, aCP1y,
                                                aCP2x, aCP2y,
                                                aCP2x, aCP2y,
-                                               aX, aY) {
+                                               aX, aY ) {
 
 
 	var args = Array.prototype.slice.call( arguments );
 	var args = Array.prototype.slice.call( arguments );
-	this.actions.push( { action: THREE.PathActions.BEZIER_CURVE_TO, args: args } );
+
+	var lastargs = this.actions[ this.actions.length - 1 ].args;
+
+	var x0 = lastargs[ lastargs.length - 2 ];
+	var y0 = lastargs[ lastargs.length - 1 ];
+
+	var curve = new THREE.CubicBezierCurve( x0, y0, aCP1x, aCP1y,
+	                                                aCP2x, aCP2y,
+	                                                aX, aY );
+	this.curves.push( curve );
+
+	this.actions.push( { action: THREE.PathActions.BEZIER_CURVE_TO, args: args, curve: curve } );
 
 
 };
 };
 
 
 THREE.Path.prototype.splineThru = function( pts /*Array of Vector*/ ) {
 THREE.Path.prototype.splineThru = function( pts /*Array of Vector*/ ) {
 
 
 	var args = Array.prototype.slice.call( arguments );
 	var args = Array.prototype.slice.call( arguments );
-	this.actions.push( { action: THREE.PathActions.CSPLINE_THRU, args: args } );
+	var lastargs = this.actions[ this.actions.length - 1 ].args;
+
+	var x0 = lastargs[ lastargs.length - 2 ];
+	var y0 = lastargs[ lastargs.length - 1 ];
+
+	var npts = [ new THREE.Vector2( x0, y0 ) ];
+	npts =  npts.concat( pts );
+
+	var curve = new THREE.SplineCurve( npts );
+	this.curves.push( curve );
+
+	this.actions.push( { action: THREE.PathActions.CSPLINE_THRU, args: args, curve: curve } );
+
+	//console.log(curve, curve.getPoints(), curve.getSpacedPoints());
+
+};
+
+// FUTURE: Change the API or follow canvas API?
+// TODO ARC ( x, y, x - radius, y - radius, startAngle, endAngle )
+
+THREE.Path.prototype.arc = function(aX, aY, aRadius,
+									aStartAngle, aEndAngle, aClockwise ) {
+
+	var args = Array.prototype.slice.call( arguments );
+	var curve = new THREE.ArcCurve( aX, aY, aRadius,
+									aStartAngle, aEndAngle, aClockwise );
+	this.curves.push( curve );
+	//console.log('arc', args);
+	this.actions.push( { action: THREE.PathActions.ARC, args: args } );
+
+ };
+
+/*
+// FUTURE ENHANCEMENTS
+
+ example usage?
 
 
-}
+ Path.addExprFunc('sineCurveTo', sineCurveGetPtFunction)
+ Path.sineCurveTo(x,y, amptitude);
+ sineCurve.getPoint(t);
+ return sine(disnt) * ampt
+
+ // Create a new func eg. sin (theta) x
+ THREE.Path.prototype.addExprFunc = function(exprName, func) {
+ };
+*/
+
+
+THREE.Path.prototype.getSpacedPoints = function( divisions ) {
+
+	if ( !divisions ) divisions = 40;
+
+	var pts = [];
+	for ( var i = 0; i < divisions; i++ ) {
+
+		pts.push( this.getPoint( i / divisions ) );
+
+		//if(!this.getPoint(i/divisions)) throw "DIE";
+
+	}
 
 
-// TODO ARC
+	//console.log(pts);
+	return pts;
+
+};
 
 
 /* Return an array of vectors based on contour of the path */
 /* Return an array of vectors based on contour of the path */
 
 
@@ -140,8 +240,6 @@ THREE.Path.prototype.getPoints = function( divisions ) {
 
 
 			for ( j = 1; j <= divisions; j ++ ) {
 			for ( j = 1; j <= divisions; j ++ ) {
 
 
-				// TODO use LOD for divisions
-
 				t = j / divisions;
 				t = j / divisions;
 
 
 				tx = THREE.FontUtils.b2( t, cpx0, cpx1, cpx );
 				tx = THREE.FontUtils.b2( t, cpx0, cpx1, cpx );
@@ -197,71 +295,79 @@ THREE.Path.prototype.getPoints = function( divisions ) {
 		case THREE.PathActions.CSPLINE_THRU:
 		case THREE.PathActions.CSPLINE_THRU:
 
 
 			laste = this.actions[ i - 1 ].args;
 			laste = this.actions[ i - 1 ].args;
+
 			var last = new THREE.Vector2( laste[ laste.length - 2 ], laste[ laste.length - 1 ] );
 			var last = new THREE.Vector2( laste[ laste.length - 2 ], laste[ laste.length - 1 ] );
-			var spts = args[ 0 ];
-			var n = divisions * spts.length;
+			var spts = [ last ];
 
 
-			spts.unshift( last );
+			var n = divisions * args[ 0 ].length;
 
 
-			var spline = new Spline2();
+			spts = spts.concat( args[ 0 ] );
 
 
-			for ( j = 0; j < n; j ++ ) {
+			var spline = new THREE.SplineCurve( spts );
+			for ( j = 1; j <= n; j ++ ) {
 
 
-				points.push( spline.get2DPoint( spts, j / n ) ) ;
+				points.push( spline.getPointAt( j / n ) ) ;
 
 
 			}
 			}
 
 
 			break;
 			break;
 
 
-		}
+		case THREE.PathActions.ARC:
 
 
-	}
+			laste = this.actions[ i - 1 ].args;
 
 
-	return points;
+			var aX = args[ 0 ], aY = args[ 1 ],
+				aRadius = args[ 2 ],
+				aStartAngle = args[ 3 ], aEndAngle = args[ 4 ],
+				aClockwise = !!args[ 5 ];
 
 
-};
+			var lastx = laste[ laste.length - 2 ],
+				lasty = laste[ laste.length - 1 ];
 
 
-var Spline2 = function () {
+			if ( laste.length == 0 ) {
 
 
-	var c = [], v2,
-		point, intPoint, weight;
+				lastx = lasty = 0;
 
 
-	this.get2DPoint = function ( points, k ) {
+			}
 
 
-		v2 = new THREE.Vector2();
-		point = ( points.length - 1 ) * k;
 
 
-		intPoint = Math.floor( point );
-		weight = point - intPoint;
+			var deltaAngle = aEndAngle - aStartAngle;
+			var angle;
+			var tdivisions = divisions * 2;
+			var t;
 
 
-		c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1;
-		c[ 1 ] = intPoint;
-		c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1;
-		c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2;
+			for ( j = 1; j <= tdivisions; j ++ ) {
 
 
-		v2.x = interpolate( points[ c[ 0 ] ].x, points[ c[ 1 ] ].x, points[ c[ 2 ] ].x, points[ c[ 3 ] ].x, weight );
-		v2.y = interpolate( points[ c[ 0 ] ].y, points[ c[ 1 ] ].y, points[ c[ 2 ] ].y, points[ c[ 3 ] ].y, weight );
+				t = j / tdivisions;
 
 
-		//console.log('point',point, v2);
+				if ( !aClockwise ) {
 
 
-		return v2;
+					t = 1 - t;
 
 
-	}
+				}
+
+				angle = aStartAngle + t * deltaAngle;
 
 
-	// Catmull-Rom
+				tx = lastx + aX + aRadius * Math.cos( angle );
+				ty = lasty + aY + aRadius * Math.sin( angle );
 
 
-	function interpolate( p0, p1, p2, p3, t ) {
+				//console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty);
 
 
-		var v0 = ( p2 - p0 ) * 0.5;
-		var v1 = ( p3 - p1 ) * 0.5;
-		var t2 = t * t;
-		var t3 = t * t2;
-		return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;
+				points.push( new THREE.Vector2( tx, ty ) );
+
+			}
+
+			//console.log(points);
+
+		  break;
+
+		} // end switch
 
 
 	}
 	}
 
 
-};
+	return points;
 
 
+};
 
 
 THREE.Path.prototype.getMinAndMax = function() {
 THREE.Path.prototype.getMinAndMax = function() {
 
 
@@ -287,7 +393,7 @@ THREE.Path.prototype.getMinAndMax = function() {
 
 
 	}
 	}
 
 
-	// TODO find mid-pt?
+	// TODO Include CG or find mid-pt?
 
 
 	return {
 	return {
 
 
@@ -300,12 +406,185 @@ THREE.Path.prototype.getMinAndMax = function() {
 
 
 };
 };
 
 
+
+// To get accurate point with reference to
+// entire path distance at time t,
+// following has to be done
+
+// 1. Length of each sub path have to be known
+// 2. Locate and identify type of curve
+// 3. Get t for the curve
+// 4. Return curve.getPointAt(t')
+
+THREE.Path.prototype.getPoint = function( t ) {
+
+	var d = t * this.getLength();
+	var curveLengths = this.sums;
+	var i = 0, diff, curve;
+
+	// To think about boundaries points.
+
+	while ( i < curveLengths.length ) {
+
+		if ( curveLengths[ i ] >= d) {
+
+			diff = curveLengths[ i ] - d;
+			curve = this.curves[ i ];
+
+			var u = 1 - diff / curve.getLength();
+
+			return curve.getPointAt( u );
+
+			break;
+		}
+
+		i++;
+
+	}
+
+	return null;
+
+	// loop where sum != 0, sum > d , sum+1 <d
+
+};
+
+// Compute lengths and cache them
+
+THREE.Path.prototype.getLength = function() {
+
+	// Loop all actions/path
+	// Push sums into cached array
+
+	var lengths = [], sums = 0;
+	var i, il = this.curves.length;
+
+	for ( i = 0; i < il ; i++ ) {
+
+		sums += this.curves[ i ].getLength();
+		lengths.push( sums );
+
+	}
+
+	this.sums = lengths;
+
+	return sums;
+
+};
+
+// TODO: rewrite to use single Line object
+
+// createPathGeometry by SolarCoordinates
+
+/* Returns Object3D with line segments stored as children  */
+
+THREE.Path.prototype.createPathGeometry = function( divisions, lineMaterial ) {
+
+    var pts = this.getPoints( divisions );
+
+    var segment, pathGeometry = new THREE.Object3D;
+    if ( !lineMaterial ) lineMaterial = new THREE.LineBasicMaterial( { color: 0x000000, opacity: 0.7 } );
+
+    for( var i = 1; i < pts.length; i++ ) {
+
+        var pathSegment = new THREE.Geometry();
+        pathSegment.vertices.push( new THREE.Vertex( new THREE.Vector3( pts[i-1].x, pts[i-1].y, 0 ) ) );
+        pathSegment.vertices.push( new THREE.Vertex( new THREE.Vector3( pts[i].x, pts[i].y, 0) ) );
+        segment = new THREE.Line( pathSegment , lineMaterial );
+        pathGeometry.addChild(segment);
+
+    }
+
+    return pathGeometry;
+
+};
+
+
+
+// ALL THINGS BELOW TO BE REFACTORED
+// QN: Transform final pts or transform ACTIONS or add transform filters?
+
+// FUTURE refactor path = an array of lines -> straight, bezier, splines, arc, funcexpr lines
+// Read http://www.planetclegg.com/projects/WarpingTextToSplines.html
+
+THREE.Path.prototype.transform = function( path ) {
+
+	path = new THREE.Path();
+	path.moveTo( 0, 0 );
+	path.quadraticCurveTo( 100, 20, 140, 80 );
+
+	console.log( path.cacheArcLengths() );
+
+	var thisBounds = this.getMinAndMax();
+	var oldPts = this.getPoints();
+
+	var i, il, p, oldX, oldY, xNorm;
+
+	for ( i = 0, il = oldPts.length; i < il; i ++ ) {
+
+		p = oldPts[ i ];
+
+		oldX = p.x;
+		oldY = p.y;
+
+		var xNorm = oldX/ thisBounds.maxX;
+
+		// If using actual distance, for length > path, requires line extrusions
+		//xNorm = path.getUtoTmapping(xNorm, oldX); // 3 styles. 1) wrap stretched. 2) wrap stretch by arc length 3) warp by actual distance
+
+		var pathPt = path.getPoint( xNorm );
+		var normal = path.getNormalVector( xNorm ).multiplyScalar( oldY );
+
+		p.x = pathPt.x + normal.x;
+		p.y = pathPt.y + normal.y;
+
+		//p.x = a * oldX + b * oldY + c;
+		//p.y = d * oldY + e * oldX + f;
+
+	}
+
+	return oldPts;
+
+};
+
+// Read http://www.tinaja.com/glib/nonlingr.pdf
+// nonlinear transforms
+
+THREE.Path.prototype.nltransform = function( a, b, c, d, e, f ) {
+
+	// a - horizontal size
+	// b - lean
+	// c - x offset
+	// d - vertical size
+	// e - climb
+	// f - y offset
+
+	var oldPts = this.getPoints();
+
+	var i, il, p, oldX, oldY;
+
+	for ( i = 0, il = oldPts.length; i < il; i ++ ) {
+
+		p = oldPts[i];
+
+		oldX = p.x;
+		oldY = p.y;
+
+		p.x = a * oldX + b * oldY + c;
+		p.y = d * oldY + e * oldX + f;
+
+	}
+
+	return oldPts;
+
+};
+
+
+// FUTURE Export JSON Format
+
 /* Draws this path onto a 2d canvas easily */
 /* Draws this path onto a 2d canvas easily */
 
 
 THREE.Path.prototype.debug = function( canvas ) {
 THREE.Path.prototype.debug = function( canvas ) {
 
 
-	// JUST A STUB
-
 	var bounds = this.getMinAndMax();
 	var bounds = this.getMinAndMax();
 
 
 	if ( !canvas ) {
 	if ( !canvas ) {
@@ -376,11 +655,32 @@ THREE.Path.prototype.debug = function( canvas ) {
 	ctx.stroke();
 	ctx.stroke();
 	ctx.closePath();
 	ctx.closePath();
 
 
-	// DebugPoints
+	// Debug Points
 
 
 	ctx.strokeStyle = "red";
 	ctx.strokeStyle = "red";
 
 
-	var p, points = this.getPoints();
+	/* TO CLEAN UP */
+
+	//var p, points = this.getPoints();
+
+	var theta = -90 /180 * Math.PI;
+	var p, points = this.transform( 0.866, - 0.866,0, 0.500 , 0.50,-50 );
+
+	//0.866, - 0.866,0, 0.500 , 0.50,-50
+
+	// Math.cos(theta),Math.sin(theta),100,
+	// Math.cos(theta),-Math.sin(theta),-50
+
+	// translate, scale, rotation
+
+	// a - horizontal size
+	// b - lean
+	// c - x offset
+	// d - vertical size
+	// e - climb
+	// f - y offset
+	// 1,0,0,
+	// -1,0,100
 
 
 	for ( i = 0, il = points.length; i < il; i ++ ) {
 	for ( i = 0, il = points.length; i < il; i ++ ) {
 
 

+ 360 - 13
src/extras/geometries/Shape.js

@@ -5,9 +5,9 @@
 
 
 // STEP 1 Create a path.
 // STEP 1 Create a path.
 // STEP 2 Turn path into shape.
 // STEP 2 Turn path into shape.
-// STEP 3 Extrude Geometry takes in Shape/Shapes
+// STEP 3 ExtrudeGeometry takes in Shape/Shapes
 // STEP 3a - Extract points from each shape, turn to vertices
 // STEP 3a - Extract points from each shape, turn to vertices
-// STEP 3b - Triangulate Each Shape
+// STEP 3b - Triangulate each shape
 
 
 THREE.Shape = function ( ) {
 THREE.Shape = function ( ) {
 
 
@@ -19,27 +19,374 @@ THREE.Shape = function ( ) {
 THREE.Shape.prototype = new THREE.Path();
 THREE.Shape.prototype = new THREE.Path();
 THREE.Shape.prototype.constructor = THREE.Path;
 THREE.Shape.prototype.constructor = THREE.Path;
 
 
-/* Returns vertices of triangulated faces | get faces */
+/* Convenience method to return ExtrudeGeometry */
 
 
-THREE.Shape.prototype.triangulate = function() {
+THREE.Shape.prototype.extrude = function( options ) {
 
 
-	var pts = this.getPoints();
+	var extruded = new THREE.ExtrudeGeometry( this, options );
+	return extruded;
 
 
-	if ( THREE.FontUtils.Triangulate.area( pts ) > 0 ) {
+};
 
 
-		pts = pts.reverse();
+/* Return array of holes' getPoints() */
 
 
-	};
+THREE.Shape.prototype.getHoles = function( spaced ) {
+
+	var getPoints = spaced ? 'getSpacedPoints' : 'getPoints';
+
+	var i, il = this.holes.length, holesPts = [];
+
+	for ( i = 0; i < il; i ++ ) {
+
+		holesPts[ i ] = this.holes[ i ][ getPoints ](); // getSpacedPoints getPoints
 
 
-	return THREE.FontUtils.Triangulate( pts, true );
+	}
+
+	return holesPts;
 
 
 };
 };
 
 
-/* Convenience method to return ExtrudeGeometry */
+/* Returns points of shape and holes
+   spaced, when true returns points spaced by regular distances
+   otherwise return keypoints based on segments paramater
+*/
 
 
-THREE.Shape.prototype.extrude = function( options ) {
+THREE.Shape.prototype.extractAllPoints = function( spaced ) {
 
 
-	var extruded =  new THREE.ExtrudeGeometry( this, options );
-	return extruded;
+	var getPoints = spaced ? 'getSpacedPoints' : 'getPoints';
+
+	return {
+
+		shape: this[ getPoints ](),
+		holes: this.getHoles( spaced )
+
+	};
+
+};
+
+
+THREE.Shape.Utils = {
+
+	/*
+		contour - array of vector2 for contour
+		holes   - array of array of vector2
+	*/
+	removeHoles: function( contour, holes ) {
+
+		var shape = contour.concat(); // work on this shape
+		var allpoints = shape.concat();
+
+		/* For each isolated shape, find the closest points and break to the hole to allow triangulation */
+
+
+		var prevShapeVert, nextShapeVert,
+			prevHoleVert, nextHoleVert,
+			holeIndex, shapeIndex,
+			shapeId, shapeGroup,
+			h, h2,
+			hole, shortest, d,
+			p, pts1, pts2,
+			tmpShape1, tmpShape2,
+			tmpHole1, tmpHole2,
+			verts = [];
+
+		for ( h = 0; h < holes.length; h++ ) {
+		//for ( h = holes.length; h-- > 0; ) {
+
+			hole = holes[ h ];
+
+			/*
+			shapeholes[ h ].concat(); // preserves original
+			holes.push( hole );
+			*/
+
+			allpoints = allpoints.concat( hole );
+
+			shortest = Number.POSITIVE_INFINITY;
+
+			// THIS THING NEEDS TO BE DONE CORRECTLY AGAIN :(
+
+			// Find the shortest pair of pts between shape and hole
+
+			// TODO we could optimize with
+			// http://en.wikipedia.org/wiki/Proximity_problems
+			// http://en.wikipedia.org/wiki/Closest_pair_of_points
+			// http://stackoverflow.com/questions/1602164/shortest-distance-between-points-algorithm
+
+			for ( h2 = 0; h2 < hole.length; h2 ++ ) {
+
+				pts1 = hole[ h2 ];
+				var dist = [];
+
+				for ( p = 0; p < shape.length; p++ ) {
+
+					pts2 = shape[ p ];
+					d = pts1.distanceTo( pts2 );
+					dist.push( d );
+
+					if ( d < shortest ) {
+
+						shortest = d;
+						holeIndex = h2;
+						shapeIndex = p;
+
+					}
+
+				}
+
+			}
+
+			//console.log("shortest", shortest, dist);
+
+			prevShapeVert = ( shapeIndex - 1 ) >= 0 ? shapeIndex - 1 : shape.length - 1;
+			prevHoleVert = ( holeIndex - 1 ) >= 0 ? holeIndex - 1 : hole.length - 1;
+
+			var areaapts = [
+
+				hole[ holeIndex ],
+				shape[ shapeIndex ],
+				shape[ prevShapeVert ]
+
+			];
+
+			var areaa = THREE.FontUtils.Triangulate.area( areaapts );
+
+			var areabpts = [
+
+				hole[ holeIndex ],
+				hole[ prevHoleVert ],
+				shape[ shapeIndex ]
+
+			];
+
+			var areab = THREE.FontUtils.Triangulate.area( areabpts );
+
+			var shapeOffset = 1;
+			var holeOffset = -1;
+
+			var oldShapeIndex = shapeIndex, oldHoleIndex = holeIndex;
+			shapeIndex += shapeOffset;
+			holeIndex += holeOffset;
+
+			if ( shapeIndex < 0 ) { shapeIndex += shape.length;  }
+			shapeIndex %= shape.length;
+
+			if ( holeIndex < 0 ) { holeIndex += hole.length;  }
+			holeIndex %= hole.length;
+
+			prevShapeVert = ( shapeIndex - 1 ) >= 0 ? shapeIndex - 1 : shape.length - 1;
+			prevHoleVert = ( holeIndex - 1 ) >= 0 ? holeIndex - 1 : hole.length - 1;
+
+			areaapts = [
+
+				hole[ holeIndex ],
+				shape[ shapeIndex ],
+				shape[ prevShapeVert ]
+
+			];
+
+			var areaa2 = THREE.FontUtils.Triangulate.area( areaapts );
+
+			areabpts = [
+
+				hole[ holeIndex ],
+				hole[ prevHoleVert ],
+				shape[ shapeIndex ]
+
+			];
+
+			var areab2 = THREE.FontUtils.Triangulate.area( areabpts );
+			//console.log(areaa,areab ,areaa2,areab2, ( areaa + areab ),  ( areaa2 + areab2 ));
+
+			if ( ( areaa + areab ) > ( areaa2 + areab2 ) ) {
+
+				// In case areas are not correct.
+				//console.log("USE THIS");
+
+				shapeIndex = oldShapeIndex;
+				holeIndex = oldHoleIndex ;
+
+				if ( shapeIndex < 0 ) { shapeIndex += shape.length;  }
+				shapeIndex %= shape.length;
+
+				if ( holeIndex < 0 ) { holeIndex += hole.length;  }
+				holeIndex %= hole.length;
+
+				prevShapeVert = ( shapeIndex - 1 ) >= 0 ? shapeIndex - 1 : shape.length - 1;
+				prevHoleVert = ( holeIndex - 1 ) >= 0 ? holeIndex - 1 : hole.length - 1;
+
+			} else {
+
+				//console.log("USE THAT ")
+
+			}
+
+			tmpShape1 = shape.slice( 0, shapeIndex );
+			tmpShape2 = shape.slice( shapeIndex );
+			tmpHole1 = hole.slice( holeIndex );
+			tmpHole2 = hole.slice( 0, holeIndex );
+
+			// Should check orders here again?
+
+			var trianglea = [
+
+				hole[ holeIndex ],
+				shape[ shapeIndex ],
+				shape[ prevShapeVert ]
+
+			];
+
+			var triangleb = [
+
+				hole[ holeIndex ] ,
+				hole[ prevHoleVert ],
+				shape[ shapeIndex ]
+
+			];
+
+			verts.push( trianglea );
+			verts.push( triangleb );
+
+			shape = tmpShape1.concat( tmpHole1 ).concat( tmpHole2 ).concat( tmpShape2 );
+			//shape = tmpHole1.concat( tmpHole2 );
+
+		}
+
+		return {
+
+			shape:shape, 		/* shape with no holes */
+			isolatedPts: verts, /* isolated faces */
+			allpoints: allpoints
+
+		}
+
+
+	},
+
+	triangulateShape: function( contour, holes ) {
+
+		var shapeWithoutHoles = THREE.Shape.Utils.removeHoles( contour, holes );
+
+		var shape = shapeWithoutHoles.shape,
+			allpoints = shapeWithoutHoles.allpoints,
+			isolatedPts = shapeWithoutHoles.isolatedPts;
+
+		var triangles = THREE.FontUtils.Triangulate( shape, false ); // True returns indices for points of spooled shape
+
+		// To maintain reference to old shape, one must match coordinates, or offset the indices from original arrays. It's probably easier to do the first.
+
+		//console.log("triangles",triangles, triangles.length);
+		//console.log("allpoints",allpoints, allpoints.length);
+
+		var v, f, i, face;
+
+		for ( v = 0; v < triangles.length; v++ ) {
+
+			face = triangles[ v ];
+
+			for ( f = 0; f < 3; f++ ) { // For 3 pts in faces
+
+				for ( i = 0; i < allpoints.length; i++ ) { // Go through all points
+
+					if ( allpoints[ i ].equals( face[ f ] ) ) { // If matches
+
+						face[ f ] = i; // face now has reference to index
+
+					}
+
+				}
+
+			}
+
+		}
+
+		for ( v = 0; v < isolatedPts.length; v++ ) {
+
+			face = isolatedPts[ v ];
+
+			for ( f = 0; f < 3; f++ ) { // For 3 pts in faces
+
+				for ( i = 0; i < allpoints.length; i++ ) { // Go thru all points
+
+					if ( allpoints[ i ].equals( face[ f ] ) ) { // If matches
+
+						face[ f ] = i; // face now has reference to index
+
+					}
+
+				}
+
+			}
+
+		}
+
+		//console.log("edited?" , triangles);
+		return triangles.concat( isolatedPts );
+
+	}, // end triangulate shapes
+
+	/*
+	triangulate2 : function( pts, holes ) {
+
+		// For use Poly2Tri.js
+
+		//var pts = this.getPoints();
+		var allpts = pts.concat();
+		var shape = [];
+		for (var p in pts) {
+			shape.push(new js.poly2tri.Point(pts[p].x, pts[p].y));
+		}
+
+		var swctx = new js.poly2tri.SweepContext(shape);
+
+		for (var h in holes) {
+			var aHole = holes[h];
+			var newHole = []
+			for (i in aHole) {
+				newHole.push(new js.poly2tri.Point(aHole[i].x, aHole[i].y));
+				allpts.push(aHole[i]);
+			}
+			swctx.AddHole(newHole);
+		}
+
+		var find;
+		var findIndexForPt = function (pt) {
+			find = new THREE.Vector2(pt.x, pt.y);
+			var p;
+			for (p=0, pl = allpts.length; p<pl; p++) {
+				if (allpts[p].equals(find)) return p;
+			}
+			return -1;
+		};
+		// triangulate
+		js.poly2tri.sweep.Triangulate(swctx);
+
+		var triangles =  swctx.GetTriangles();
+		var tr ;
+		var facesPts = [];
+		for (var t in triangles) {
+			tr =  triangles[t];
+			facesPts.push([
+				findIndexForPt(tr.GetPoint(0)),
+				findIndexForPt(tr.GetPoint(1)),
+				findIndexForPt(tr.GetPoint(2))
+					]);
+		}
+
+
+	//	console.log(facesPts);
+	//	console.log("triangles", triangles.length, triangles);
+
+		// Returns array of faces with 3 element each
+	return facesPts;
+	},
+	*/
+
+	isClockWise: function ( pts ) {
+
+		return THREE.FontUtils.Triangulate.area( pts ) < 0;
+
+	}
 
 
 };
 };
+

+ 20 - 10
src/extras/geometries/TextGeometry.js

@@ -666,15 +666,20 @@ THREE.FontUtils = {
 
 
 		var fontPaths = [];
 		var fontPaths = [];
 
 
+		var path = new THREE.Path();
 		for ( i = 0; i < length; i++ ) {
 		for ( i = 0; i < length; i++ ) {
-
-			var ret = this.extractGlyphPoints( chars[ i ], face, scale, offset );
+			
+			var ret = this.extractGlyphPoints( chars[ i ], face, scale, offset, path );
 			offset += ret.offset;
 			offset += ret.offset;
 			characterPts.push( ret.points );
 			characterPts.push( ret.points );
 			allPts = allPts.concat( ret.points );
 			allPts = allPts.concat( ret.points );
-			fontPaths.push( ret.path );
-
+			//fontPaths.push( ret.path );
+			
 		}
 		}
+		
+		//path.debug(document.getElementById("boo"));
+		console.log(path);
+		
 
 
 		// get the width
 		// get the width
 
 
@@ -849,10 +854,10 @@ THREE.FontUtils = {
 	},
 	},
 
 
 
 
-	extractGlyphPoints : function( c, face, scale, offset ) {
+	extractGlyphPoints : function( c, face, scale, offset, path ) {
 
 
 		var pts = [];
 		var pts = [];
-		var path = new THREE.Path();
+		
 
 
 
 
 		var i, i2,
 		var i, i2,
@@ -875,7 +880,7 @@ THREE.FontUtils = {
 			for ( i = 0; i < length; ) {
 			for ( i = 0; i < length; ) {
 
 
 				action = outline[ i++ ];
 				action = outline[ i++ ];
-
+				//console.log(action);
 				switch( action ) {
 				switch( action ) {
 
 
 				case 'm':
 				case 'm':
@@ -941,7 +946,7 @@ THREE.FontUtils = {
 					cpx2 = outline[ i++ ] *  scaleX + offset;
 					cpx2 = outline[ i++ ] *  scaleX + offset;
 					cpy2 = outline[ i++ ] * -scaleY;
 					cpy2 = outline[ i++ ] * -scaleY;
 
 
-					path.quadraticCurveTo( cpx, cpy, cpx1, cpy1, cpx2, cpy2 );
+					path.bezierCurveTo( cpx, cpy, cpx1, cpy1, cpx2, cpy2 );
 
 
 					laste = pts[ pts.length - 1 ];
 					laste = pts[ pts.length - 1 ];
 
 
@@ -968,8 +973,7 @@ THREE.FontUtils = {
 			}
 			}
 		}
 		}
 
 
-		path.debug(document.getElementById("boo"));
-		console.log(path);
+
 
 
 		return { offset: glyph.ha*scale, points:pts, path:path};
 		return { offset: glyph.ha*scale, points:pts, path:path};
 	}
 	}
@@ -1065,9 +1069,15 @@ THREE.FontUtils = {
 
 
 				/* output Triangle */
 				/* output Triangle */
 
 
+				/*
 				result.push( contour[ a ] );
 				result.push( contour[ a ] );
 				result.push( contour[ b ] );
 				result.push( contour[ b ] );
 				result.push( contour[ c ] );
 				result.push( contour[ c ] );
+				*/
+				result.push( [ contour[ a ], 
+					contour[ b ],
+					contour[ c ] ] );
+				
 
 
 				vertIndices.push( [ verts[ u ], verts[ v ], verts[ w ] ] );
 				vertIndices.push( [ verts[ u ], verts[ v ], verts[ w ] ] );
 
 

+ 1 - 0
utils/build.py

@@ -93,6 +93,7 @@ EXTRAS_FILES = [
 'extras/cameras/RollCamera.js',
 'extras/cameras/RollCamera.js',
 'extras/cameras/TrackballCamera.js',
 'extras/cameras/TrackballCamera.js',
 'extras/cameras/QuakeCamera.js',
 'extras/cameras/QuakeCamera.js',
+'extras/geometries/Curve.js',
 'extras/geometries/Path.js',
 'extras/geometries/Path.js',
 'extras/geometries/Shape.js',
 'extras/geometries/Shape.js',
 'extras/geometries/CubeGeometry.js',
 'extras/geometries/CubeGeometry.js',