Browse Source

And some more strict equality checking.

alteredq 14 years ago
parent
commit
965b199de2

+ 30 - 29
build/Three.js

@@ -1,12 +1,12 @@
 // Three.js r46dev - http://github.com/mrdoob/three.js
 // Three.js r46dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
 THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var e,f,h;if(c==0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),f=a*6-e,a=c*(1-b),h=c*(1-
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var e,f,h;if(c===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),f=a*6-e,a=c*(1-b),h=c*(1-
 b*f),b=c*(1-b*(1-f)),e){case 1:this.r=h;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=h;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=h;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 b*f),b=c*(1-b*(1-f)),e){case 1:this.r=h;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=h;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=h;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
-equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
+equals:function(a){return a.x===this.x&&a.y===this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
 addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
 addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
 divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
@@ -16,8 +16,8 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,e){this.x=
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,c){return a.distance-c.distance});return e},intersectObject:function(a){function b(a,c,b){var e;e=b.clone().subSelf(a).dot(c);if(e<=0)return null;a=a.clone().addSelf(c.clone().multiplyScalar(e));return b.distanceTo(a)}function c(a,c,b,e){var e=e.clone().subSelf(c),
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,c){return a.distance-c.distance});return e},intersectObject:function(a){function b(a,c,b){var e;e=b.clone().subSelf(a).dot(c);if(e<=0)return null;a=a.clone().addSelf(c.clone().multiplyScalar(e));return b.distanceTo(a)}function c(a,c,b,e){var e=e.clone().subSelf(c),
-b=b.clone().subSelf(c),f=a.clone().subSelf(c),a=e.dot(e),c=e.dot(b),e=e.dot(f),k=b.dot(b),b=b.dot(f),f=1/(a*k-c*c),k=(k*e-c*b)*f,a=(a*b-c*e)*f;return k>0&&a>0&&k+a<1}for(var e,f=[],h=0,k=a.children.length;h<k;h++)Array.prototype.push.apply(f,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=b(this.origin,this.direction,a.matrixWorld.getPosition());if(h==null||h>a.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=b(this.origin,
-this.direction,a.matrixWorld.getPosition());if(h==null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var l,n,p,u,t,v,o,y,x=a.geometry,w=x.vertices,h=0,k=x.faces.length;h<k;h++)if(e=x.faces[h],o=this.origin.clone(),y=this.direction.clone(),u=a.matrixWorld,l=u.multiplyVector3(e.centroid.clone()).subSelf(o),v=l.dot(y),!(v<=0)&&(l=u.multiplyVector3(w[e.a].position.clone()),n=u.multiplyVector3(w[e.b].position.clone()),p=u.multiplyVector3(w[e.c].position.clone()),
+b=b.clone().subSelf(c),f=a.clone().subSelf(c),a=e.dot(e),c=e.dot(b),e=e.dot(f),k=b.dot(b),b=b.dot(f),f=1/(a*k-c*c),k=(k*e-c*b)*f,a=(a*b-c*e)*f;return k>0&&a>0&&k+a<1}for(var e,f=[],h=0,k=a.children.length;h<k;h++)Array.prototype.push.apply(f,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=b(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var l,n,p,u,t,v,o,y,x=a.geometry,w=x.vertices,h=0,k=x.faces.length;h<k;h++)if(e=x.faces[h],o=this.origin.clone(),y=this.direction.clone(),u=a.matrixWorld,l=u.multiplyVector3(e.centroid.clone()).subSelf(o),v=l.dot(y),!(v<=0)&&(l=u.multiplyVector3(w[e.a].position.clone()),n=u.multiplyVector3(w[e.b].position.clone()),p=u.multiplyVector3(w[e.c].position.clone()),
 u=e instanceof THREE.Face4?u.multiplyVector3(w[e.d].position.clone()):null,t=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),v=y.dot(t),a.doubleSided||(a.flipSided?v>0:v<0)))if(v=t.dot((new THREE.Vector3).sub(l,o))/v,o=o.addSelf(y.multiplyScalar(v)),e instanceof THREE.Face3)c(o,l,n,p)&&(e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(o,l,n,u)||c(o,n,p,u)))e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e)}return f}};
 u=e instanceof THREE.Face4?u.multiplyVector3(w[e.d].position.clone()):null,t=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),v=y.dot(t),a.doubleSided||(a.flipSided?v>0:v<0)))if(v=t.dot((new THREE.Vector3).sub(l,o))/v,o=o.addSelf(y.multiplyScalar(v)),e instanceof THREE.Face3)c(o,l,n,p)&&(e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(o,l,n,u)||c(o,n,p,u)))e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e)}return f}};
 THREE.Rectangle=function(){function a(){h=e-b;k=f-c}var b,c,e,f,h,k,l=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(k,h,u,t){l=!1;b=k;c=h;e=u;f=t;a()};this.addPoint=function(k,h){l?(l=!1,b=k,c=h,e=k,f=h):(b=b<k?b:k,c=c<h?c:h,e=e>k?e:k,f=f>h?f:h);a()};this.add3Points=
 THREE.Rectangle=function(){function a(){h=e-b;k=f-c}var b,c,e,f,h,k,l=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(k,h,u,t){l=!1;b=k;c=h;e=u;f=t;a()};this.addPoint=function(k,h){l?(l=!1,b=k,c=h,e=k,f=h):(b=b<k?b:k,c=c<h?c:h,e=e>k?e:k,f=f>h?f:h);a()};this.add3Points=
 function(k,h,u,t,v,o){l?(l=!1,b=k<u?k<v?k:v:u<v?u:v,c=h<t?h<o?h:o:t<o?t:o,e=k>u?k>v?k:v:u>v?u:v,f=h>t?h>o?h:o:t>o?t:o):(b=k<u?k<v?k<b?k:b:v<b?v:b:u<v?u<b?u:b:v<b?v:b,c=h<t?h<o?h<c?h:c:o<c?o:c:t<o?t<c?t:c:o<c?o:c,e=k>u?k>v?k>e?k:e:v>e?v:e:u>v?u>e?u:e:v>e?v:e,f=h>t?h>o?h>f?h:f:o>f?o:f:t>o?t>f?t:f:o>f?o:f);a()};this.addRectangle=function(k){l?(l=!1,b=k.getLeft(),c=k.getTop(),e=k.getRight(),f=k.getBottom()):(b=b<k.getLeft()?b:k.getLeft(),c=c<k.getTop()?c:k.getTop(),e=e>k.getRight()?e:k.getRight(),f=f>
 function(k,h,u,t,v,o){l?(l=!1,b=k<u?k<v?k:v:u<v?u:v,c=h<t?h<o?h:o:t<o?t:o,e=k>u?k>v?k:v:u>v?u:v,f=h>t?h>o?h:o:t>o?t:o):(b=k<u?k<v?k<b?k:b:v<b?v:b:u<v?u<b?u:b:v<b?v:b,c=h<t?h<o?h<c?h:c:o<c?o:c:t<o?t<c?t:c:o<c?o:c,e=k>u?k>v?k>e?k:e:v>e?v:e:u>v?u>e?u:e:v>e?v:e,f=h>t?h>o?h>f?h:f:o>f?o:f:t>o?t>f?t:f:o>f?o:f);a()};this.addRectangle=function(k){l?(l=!1,b=k.getLeft(),c=k.getTop(),e=k.getRight(),f=k.getBottom()):(b=b<k.getLeft()?b:k.getLeft(),c=c<k.getTop()?c:k.getTop(),e=e>k.getRight()?e:k.getRight(),f=f>
@@ -46,7 +46,7 @@ c.y=f.length();c.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Mat
 a.n23*f;this.n33=a.n33*f}};
 a.n23*f;this.n33=a.n33*f}};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,k=a.n21,l=a.n22,n=a.n23,p=a.n24,u=a.n31,t=a.n32,v=a.n33,o=a.n34,y=a.n41,x=a.n42,w=a.n43,A=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=n*o*x-p*v*x+p*t*w-l*o*w-n*t*A+l*v*A;b.n12=h*v*x-f*o*x-h*t*w+e*o*w+f*t*A-e*v*A;b.n13=f*p*x-h*n*x+h*l*w-e*p*w-f*l*A+e*n*A;b.n14=h*n*t-f*p*t-h*l*v+e*p*v+f*l*o-e*n*o;b.n21=p*v*y-n*o*y-p*u*w+k*o*w+n*u*A-k*v*A;b.n22=f*o*y-h*v*y+h*u*w-c*o*w-f*u*A+c*v*A;b.n23=h*n*y-f*p*y-h*k*w+c*p*w+f*k*A-c*n*A;b.n24=
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,k=a.n21,l=a.n22,n=a.n23,p=a.n24,u=a.n31,t=a.n32,v=a.n33,o=a.n34,y=a.n41,x=a.n42,w=a.n43,A=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=n*o*x-p*v*x+p*t*w-l*o*w-n*t*A+l*v*A;b.n12=h*v*x-f*o*x-h*t*w+e*o*w+f*t*A-e*v*A;b.n13=f*p*x-h*n*x+h*l*w-e*p*w-f*l*A+e*n*A;b.n14=h*n*t-f*p*t-h*l*v+e*p*v+f*l*o-e*n*o;b.n21=p*v*y-n*o*y-p*u*w+k*o*w+n*u*A-k*v*A;b.n22=f*o*y-h*v*y+h*u*w-c*o*w-f*u*A+c*v*A;b.n23=h*n*y-f*p*y-h*k*w+c*p*w+f*k*A-c*n*A;b.n24=
 f*p*u-h*n*u+h*k*v-c*p*v-f*k*o+c*n*o;b.n31=l*o*y-p*t*y+p*u*x-k*o*x-l*u*A+k*t*A;b.n32=h*t*y-e*o*y-h*u*x+c*o*x+e*u*A-c*t*A;b.n33=f*p*y-h*l*y+h*k*x-c*p*x-e*k*A+c*l*A;b.n34=h*l*u-e*p*u-h*k*t+c*p*t+e*k*o-c*l*o;b.n41=n*t*y-l*v*y-n*u*x+k*v*x+l*u*w-k*t*w;b.n42=e*v*y-f*t*y+f*u*x-c*v*x-e*u*w+c*t*w;b.n43=f*l*y-e*n*y-f*k*x+c*n*x+e*k*w-c*l*w;b.n44=e*n*u-f*l*u+f*k*t-c*n*t-e*k*v+c*l*v;b.multiplyScalar(1/a.determinant());return b};
 f*p*u-h*n*u+h*k*v-c*p*v-f*k*o+c*n*o;b.n31=l*o*y-p*t*y+p*u*x-k*o*x-l*u*A+k*t*A;b.n32=h*t*y-e*o*y-h*u*x+c*o*x+e*u*A-c*t*A;b.n33=f*p*y-h*l*y+h*k*x-c*p*x-e*k*A+c*l*A;b.n34=h*l*u-e*p*u-h*k*t+c*p*t+e*k*o-c*l*o;b.n41=n*t*y-l*v*y-n*u*x+k*v*x+l*u*w-k*t*w;b.n42=e*v*y-f*t*y+f*u*x-c*v*x-e*u*w+c*t*w;b.n43=f*l*y-e*n*y-f*k*x+c*n*x+e*k*w-c*l*w;b.n44=e*n*u-f*l*u+f*k*t-c*n*t-e*k*v+c*l*v;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,k=-a.n33*a.n12+a.n32*a.n13,l=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,p=a.n23*a.n12-a.n22*a.n13,u=-a.n23*a.n11+a.n21*a.n13,t=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*k+a.n31*p;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*k;c[4]=a*l;c[5]=a*n;c[6]=a*p;c[7]=a*u;c[8]=a*t;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,k=-a.n33*a.n12+a.n32*a.n13,l=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,p=a.n23*a.n12-a.n22*a.n13,u=-a.n23*a.n11+a.n21*a.n13,t=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*k+a.n31*p;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*k;c[4]=a*l;c[5]=a*n;c[6]=a*p;c[7]=a*u;c[8]=a*t;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){var k;k=new THREE.Matrix4;k.n11=2*f/(b-a);k.n12=0;k.n13=(b+a)/(b-a);k.n14=0;k.n21=0;k.n22=2*f/(e-c);k.n23=(e+c)/(e-c);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+f)/(h-f);k.n34=-2*h*f/(h-f);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){var k;k=new THREE.Matrix4;k.n11=2*f/(b-a);k.n12=0;k.n13=(b+a)/(b-a);k.n14=0;k.n21=0;k.n22=2*f/(e-c);k.n23=(e+c)/(e-c);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+f)/(h-f);k.n34=-2*h*f/(h-f);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
 THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var k,l,n,p;k=new THREE.Matrix4;l=b-a;n=c-e;p=h-f;k.n11=2/l;k.n12=0;k.n13=0;k.n14=-((b+a)/l);k.n21=0;k.n22=2/n;k.n23=0;k.n24=-((c+e)/n);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((h+f)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var k,l,n,p;k=new THREE.Matrix4;l=b-a;n=c-e;p=h-f;k.n11=2/l;k.n12=0;k.n13=0;k.n14=-((b+a)/l);k.n21=0;k.n22=2/n;k.n23=0;k.n24=-((c+e)/n);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((h+f)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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=
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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=
@@ -69,7 +69,7 @@ O.multiplyVector4(ha.positionScreen);ea=1;for(da=ia.length;ea<da;ea++)if(ha=a(),
 Y.matrixWorld.n34,1),E.multiplyVector4(M),M.z/=M.w,M.z>0&&M.z<1))X=C[z]=C[z]||new THREE.RenderableParticle,z++,A=X,A.x=M.x/M.w,A.y=M.y/M.w,A.z=M.z,A.rotation=Y.rotation.z,A.scale.x=Y.scale.x*Math.abs(A.x-(M.x+f.projectionMatrix.n11)/(M.w+f.projectionMatrix.n14)),A.scale.y=Y.scale.y*Math.abs(A.y-(M.y+f.projectionMatrix.n22)/(M.w+f.projectionMatrix.n24)),A.materials=Y.materials,K.push(A);h&&K.sort(b);return K}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
 Y.matrixWorld.n34,1),E.multiplyVector4(M),M.z/=M.w,M.z>0&&M.z<1))X=C[z]=C[z]||new THREE.RenderableParticle,z++,A=X,A.x=M.x/M.w,A.y=M.y/M.w,A.z=M.z,A.rotation=Y.rotation.z,A.scale.x=Y.scale.x*Math.abs(A.x-(M.x+f.projectionMatrix.n11)/(M.w+f.projectionMatrix.n14)),A.scale.y=Y.scale.y*Math.abs(A.y-(M.y+f.projectionMatrix.n22)/(M.w+f.projectionMatrix.n24)),A.materials=Y.materials,K.push(A);h&&K.sort(b);return K}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),k=a*b,l=e*f;this.w=k*h-l*c;this.x=k*c+l*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),k=a*b,l=e*f;this.w=k*h-l*c;this.x=k*c+l*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
-this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
+this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,e=this.z,f=this.w,h=a.x,k=a.y,l=a.z,a=a.w;this.x=b*a+f*h+c*l-e*k;this.y=c*a+f*k+e*h-b*l;this.z=e*a+f*l+b*k-c*h;this.w=f*a-b*h-c*k-e*l;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,k=this.y,l=this.z,n=this.w,p=n*c+k*f-l*e,u=n*e+l*c-h*f,t=n*f+h*e-k*c,c=-h*
 this.x,c=this.y,e=this.z,f=this.w,h=a.x,k=a.y,l=a.z,a=a.w;this.x=b*a+f*h+c*l-e*k;this.y=c*a+f*k+e*h-b*l;this.z=e*a+f*l+b*k-c*h;this.w=f*a-b*h-c*k-e*l;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,k=this.y,l=this.z,n=this.w,p=n*c+k*f-l*e,u=n*e+l*c-h*f,t=n*f+h*e-k*c,c=-h*
 c-k*e-l*f;b.x=p*n+c*-h+u*-l-t*-k;b.y=u*n+c*-k+t*-h-p*-l;b.z=t*n+c*-l+p*-k-u*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),k=Math.sqrt(1-f*f);if(Math.abs(k)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};
 c-k*e-l*f;b.x=p*n+c*-h+u*-l-t*-k;b.y=u*n+c*-k+t*-h-p*-l;b.z=t*n+c*-l+p*-k-u*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),k=Math.sqrt(1-f*f);if(Math.abs(k)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
@@ -78,7 +78,7 @@ THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;ret
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var h=0,k=f.vertexNormals.length;h<k;h++)b.multiplyVector3(f.vertexNormals[h]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var h=0,k=f.vertexNormals.length;h<k;h++)b.multiplyVector3(f.vertexNormals[h]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
-c,e,f,h,k,l=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){l.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)l.addSelf(h.vertexNormals[b]);l.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],k=this.vertices[h.c],l.sub(k.position,c.position),n.sub(b.position,c.position),l.crossSelf(n);l.isZero()||l.normalize();h.normal.copy(l)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=
+c,e,f,h,k,l=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){l.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)l.addSelf(h.vertexNormals[b]);l.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],k=this.vertices[h.c],l.sub(k.position,c.position),n.sub(b.position,c.position),l.crossSelf(n);l.isZero()||l.normalize();h.normal.copy(l)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
 THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
 c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,c,b,e,f,h,m){l=a.vertices[c].position;n=a.vertices[b].position;p=a.vertices[e].position;u=k[f];t=k[h];v=k[m];o=n.x-l.x;y=p.x-l.x;x=n.y-l.y;w=p.y-l.y;A=n.z-l.z;z=p.z-l.z;C=t.u-u.u;B=v.u-u.u;K=t.v-u.v;F=v.v-u.v;M=1/(C*F-B*K);H.set((F*o-K*y)*M,(F*x-K*w)*M,(F*A-K*z)*M);P.set((C*y-B*o)*M,(C*w-B*x)*M,(C*z-B*A)*M);O[c].addSelf(H);O[b].addSelf(H);O[e].addSelf(H);V[c].addSelf(P);
 c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,c,b,e,f,h,m){l=a.vertices[c].position;n=a.vertices[b].position;p=a.vertices[e].position;u=k[f];t=k[h];v=k[m];o=n.x-l.x;y=p.x-l.x;x=n.y-l.y;w=p.y-l.y;A=n.z-l.z;z=p.z-l.z;C=t.u-u.u;B=v.u-u.u;K=t.v-u.v;F=v.v-u.v;M=1/(C*F-B*K);H.set((F*o-K*y)*M,(F*x-K*w)*M,(F*A-K*z)*M);P.set((C*y-B*o)*M,(C*w-B*x)*M,(C*z-B*A)*M);O[c].addSelf(H);O[b].addSelf(H);O[e].addSelf(H);V[c].addSelf(P);
@@ -86,8 +86,8 @@ V[b].addSelf(P);V[e].addSelf(P)}var b,c,e,f,h,k,l,n,p,u,t,v,o,y,x,w,A,z,C,B,K,F,
 "c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)S.copy(h.vertexNormals[e]),f=h[m[e]],E=O[f],L.copy(E),L.subSelf(S.multiplyScalar(S.dot(E))).normalize(),T.cross(h.vertexNormals[e],E),f=T.dot(V[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(L.x,L.y,L.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 "c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)S.copy(h.vertexNormals[e]),f=h[m[e]],E=O[f],L.copy(E),L.subSelf(S.multiplyScalar(S.dot(E))).normalize(),T.cross(h.vertexNormals[e],E),f=T.dot(V[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(L.x,L.y,L.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;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 b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),h,k;h=0;for(k=this.vertices.length;h<k;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),h,k;h=0;for(k=this.vertices.length;h<k;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),
-c[h]=b.length-1):c[h]=c[a[e]];h=0;for(k=this.faces.length;h<k;h++){a=this.faces[h];if(a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d]}this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,c,b,e,f,k,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*k+a*f+c}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,k,l,n,p,u,t,v;this.initFromArray=function(a){this.points=[];for(var c=0;c<a.length;c++)this.points[c]={x:a[c][0],y:a[c][1],z:a[c][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;h=Math.floor(f);k=f-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];u=this.points[c[1]];
+c[h]=b.length-1):c[h]=c[a[e]];h=0;for(k=this.faces.length;h<k;h++)if(a=this.faces[h],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
+THREE.Spline=function(a){function b(a,c,b,e,f,k,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*k+a*f+c}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,k,l,n,p,u,t,v;this.initFromArray=function(a){this.points=[];for(var c=0;c<a.length;c++)this.points[c]={x:a[c][0],y:a[c][1],z:a[c][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;h=Math.floor(f);k=f-h;c[0]=h===0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];u=this.points[c[1]];
 t=this.points[c[2]];v=this.points[c[3]];l=k*k;n=k*l;e.x=b(p.x,u.x,t.x,v.x,k,l,n);e.y=b(p.y,u.y,t.y,v.y,k,l,n);e.z=b(p.z,u.z,t.z,v.z,k,l,n);return e};this.getControlPointsArray=function(){var a,c,b=this.points.length,e=[];for(a=0;a<b;a++)c=this.points[a],e[a]=[c.x,c.y,c.z];return e};this.getLength=function(a){var c,b,e=c=c=0,f=new THREE.Vector3,k=new THREE.Vector3,h=[],l=0;h[0]=0;a||(a=100);b=this.points.length*a;f.copy(this.points[0]);for(a=1;a<b;a++)c=a/b,position=this.getPoint(c),k.copy(position),
 t=this.points[c[2]];v=this.points[c[3]];l=k*k;n=k*l;e.x=b(p.x,u.x,t.x,v.x,k,l,n);e.y=b(p.y,u.y,t.y,v.y,k,l,n);e.z=b(p.z,u.z,t.z,v.z,k,l,n);return e};this.getControlPointsArray=function(){var a,c,b=this.points.length,e=[];for(a=0;a<b;a++)c=this.points[a],e[a]=[c.x,c.y,c.z];return e};this.getLength=function(a){var c,b,e=c=c=0,f=new THREE.Vector3,k=new THREE.Vector3,h=[],l=0;h[0]=0;a||(a=100);b=this.points.length*a;f.copy(this.points[0]);for(a=1;a<b;a++)c=a/b,position=this.getPoint(c),k.copy(position),
 l+=k.distanceTo(f),f.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=e&&(h[c]=l,e=c);h[h.length]=l;return{chunks:h,total:l}};this.reparametrizeByArcLength=function(a){var c,b,e,f,k,h,l=[],n=new THREE.Vector3,p=this.getLength();l.push(n.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){b=p.chunks[c]-p.chunks[c-1];h=Math.ceil(a*b/p.total);f=(c-1)/(this.points.length-1);k=c/(this.points.length-1);for(b=1;b<h-1;b++)e=f+b*(1/h)*(k-f),position=this.getPoint(e),l.push(n.copy(position).clone());
 l+=k.distanceTo(f),f.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=e&&(h[c]=l,e=c);h[h.length]=l;return{chunks:h,total:l}};this.reparametrizeByArcLength=function(a){var c,b,e,f,k,h,l=[],n=new THREE.Vector3,p=this.getLength();l.push(n.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){b=p.chunks[c]-p.chunks[c-1];h=Math.ceil(a*b/p.total);f=(c-1)/(this.points.length-1);k=c/(this.points.length-1);for(b=1;b<h-1;b++)e=f+b*(1/h)*(k-f),position=this.getPoint(e),l.push(n.copy(position).clone());
 l.push(n.copy(this.points[c]).clone())}this.points=l}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};
 l.push(n.copy(this.points[c]).clone())}this.points=l}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};
@@ -350,7 +350,7 @@ THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRen
 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(a,b,c,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,f=a.b,h=Math.max(Math.max(c,e),f),k=Math.min(Math.min(c,e),f);if(k==h)k=c=0;else{var l=h-k,k=l/h,c=c==h?(e-f)/l:e==h?2+(f-c)/l:4+(c-e)/l;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=k;b.v=h;return b}};
+THREE.ColorUtils={adjustHSV:function(a,b,c,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,f=a.b,h=Math.max(Math.max(c,e),f),k=Math.min(Math.min(c,e),f);if(k===h)k=c=0;else{var l=h-k,k=l/h,c=c===h?(e-f)/l:e===h?2+(f-c)/l:4+(c-e)/l;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=k;b.v=h;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
 THREE.GeometryUtils={merge:function(a,b){for(var c,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,k=a.vertices,l=h.vertices,n=a.faces,p=h.faces,u=a.faceVertexUvs[0],t=h.faceVertexUvs[0],v={},o=0;o<a.materials.length;o++)v[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,e=new THREE.Matrix4,e.extractRotation(c,b.scale);for(var o=0,y=l.length;o<y;o++){var x=new THREE.Vertex(l[o].position.clone());c&&c.multiplyVector3(x.position);k.push(x)}o=
 THREE.GeometryUtils={merge:function(a,b){for(var c,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,k=a.vertices,l=h.vertices,n=a.faces,p=h.faces,u=a.faceVertexUvs[0],t=h.faceVertexUvs[0],v={},o=0;o<a.materials.length;o++)v[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,e=new THREE.Matrix4,e.extractRotation(c,b.scale);for(var o=0,y=l.length;o<y;o++){var x=new THREE.Vertex(l[o].position.clone());c&&c.multiplyVector3(x.position);k.push(x)}o=
 0;for(y=p.length;o<y;o++){var k=p[o],w,A,z=k.vertexNormals,C=k.vertexColors;k instanceof THREE.Face3?w=new THREE.Face3(k.a+f,k.b+f,k.c+f):k instanceof THREE.Face4&&(w=new THREE.Face4(k.a+f,k.b+f,k.c+f,k.d+f));w.normal.copy(k.normal);e&&e.multiplyVector3(w.normal);l=0;for(x=z.length;l<x;l++)A=z[l].clone(),e&&e.multiplyVector3(A),w.vertexNormals.push(A);w.color.copy(k.color);l=0;for(x=C.length;l<x;l++)A=C[l],w.vertexColors.push(A.clone());if(k.materialIndex!==void 0){l=h.materials[k.materialIndex];
 0;for(y=p.length;o<y;o++){var k=p[o],w,A,z=k.vertexNormals,C=k.vertexColors;k instanceof THREE.Face3?w=new THREE.Face3(k.a+f,k.b+f,k.c+f):k instanceof THREE.Face4&&(w=new THREE.Face4(k.a+f,k.b+f,k.c+f,k.d+f));w.normal.copy(k.normal);e&&e.multiplyVector3(w.normal);l=0;for(x=z.length;l<x;l++)A=z[l].clone(),e&&e.multiplyVector3(A),w.vertexNormals.push(A);w.color.copy(k.color);l=0;for(x=C.length;l<x;l++)A=C[l],w.vertexColors.push(A.clone());if(k.materialIndex!==void 0){l=h.materials[k.materialIndex];
@@ -361,7 +361,7 @@ h=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else
 k)<c?THREE.GeometryUtils.randomPointInTriangle(e,f,b):THREE.GeometryUtils.randomPointInTriangle(f,h,b)}},randomPointsInGeometry:function(a,b){function c(a){function c(b,e){if(e<b)return b;var f=b+Math.floor((e-b)/2);return p[f]>a?c(b,f-1):p[f]<a?c(f+1,e):f}return c(0,p.length-1)}var e,f,h=a.faces,k=a.vertices,l=h.length,n=0,p=[],u,t,v,o;for(f=0;f<l;f++){e=h[f];if(e instanceof THREE.Face3)u=k[e.a].position,t=k[e.b].position,v=k[e.c].position,e._area=THREE.GeometryUtils.triangleArea(u,t,v);else if(e instanceof
 k)<c?THREE.GeometryUtils.randomPointInTriangle(e,f,b):THREE.GeometryUtils.randomPointInTriangle(f,h,b)}},randomPointsInGeometry:function(a,b){function c(a){function c(b,e){if(e<b)return b;var f=b+Math.floor((e-b)/2);return p[f]>a?c(b,f-1):p[f]<a?c(f+1,e):f}return c(0,p.length-1)}var e,f,h=a.faces,k=a.vertices,l=h.length,n=0,p=[],u,t,v,o;for(f=0;f<l;f++){e=h[f];if(e instanceof THREE.Face3)u=k[e.a].position,t=k[e.b].position,v=k[e.c].position,e._area=THREE.GeometryUtils.triangleArea(u,t,v);else if(e instanceof
 THREE.Face4)u=k[e.a].position,t=k[e.b].position,v=k[e.c].position,o=k[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(u,t,o),e._area2=THREE.GeometryUtils.triangleArea(t,v,o),e._area=e._area1+e._area2;n+=e._area;p[f]=n}e=[];k={};for(f=0;f<b;f++)l=THREE.GeometryUtils.random()*n,l=c(l),e[f]=THREE.GeometryUtils.randomPointInFace(h[l],a,!0),k[l]?k[l]+=1:k[l]=1;return e},triangleArea:function(a,b,c){var e,f=THREE.GeometryUtils.__v1;f.sub(a,b);e=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();
 THREE.Face4)u=k[e.a].position,t=k[e.b].position,v=k[e.c].position,o=k[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(u,t,o),e._area2=THREE.GeometryUtils.triangleArea(t,v,o),e._area=e._area1+e._area2;n+=e._area;p[f]=n}e=[];k={};for(f=0;f<b;f++)l=THREE.GeometryUtils.random()*n,l=c(l),e[f]=THREE.GeometryUtils.randomPointInFace(h[l],a,!0),k[l]?k[l]+=1:k[l]=1;return e},triangleArea:function(a,b,c){var e,f=THREE.GeometryUtils.__v1;f.sub(a,b);e=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();
 b=0.5*(e+a+c);return Math.sqrt(b*(b-e)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 b=0.5*(e+a+c);return Math.sqrt(b*(b-e)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
-THREE.ImageUtils={loadTexture:function(a,b,c){var e=new Image,f=new THREE.Texture(e,b);e.onload=function(){f.needsUpdate=!0;c&&c(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,b,c){var e,f=[],h=new THREE.Texture(f,b),b=f.loadCount=0;for(e=a.length;b<e;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)h.needsUpdate=!0;c&&c(this)},f[b].crossOrigin="",f[b].src=a[b];return h},getNormalMap:function(a,b){var c=function(a){var c=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
+THREE.ImageUtils={loadTexture:function(a,b,c){var e=new Image,f=new THREE.Texture(e,b);e.onload=function(){f.needsUpdate=!0;c&&c(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,b,c){var e,f=[],h=new THREE.Texture(f,b),b=f.loadCount=0;for(e=a.length;b<e;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(f.loadCount===6)h.needsUpdate=!0;c&&c(this)},f[b].crossOrigin="",f[b].src=a[b];return h},getNormalMap:function(a,b){var c=function(a){var c=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
 a[2]*a[2]);return[a[0]/c,a[1]/c,a[2]/c]};b|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var k=h.getContext("2d");k.drawImage(a,0,0);for(var l=k.getImageData(0,0,e,f).data,n=k.createImageData(e,f),p=n.data,u=0;u<e;u++)for(var t=1;t<f;t++){var v=t-1<0?f-1:t-1,o=(t+1)%f,y=u-1<0?e-1:u-1,x=(u+1)%e,w=[],A=[0,0,l[(t*e+u)*4]/255*b];w.push([-1,0,l[(t*e+y)*4]/255*b]);w.push([-1,-1,l[(v*e+y)*4]/255*b]);w.push([0,-1,l[(v*e+u)*4]/255*b]);w.push([1,-1,l[(v*e+x)*4]/255*b]);
 a[2]*a[2]);return[a[0]/c,a[1]/c,a[2]/c]};b|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var k=h.getContext("2d");k.drawImage(a,0,0);for(var l=k.getImageData(0,0,e,f).data,n=k.createImageData(e,f),p=n.data,u=0;u<e;u++)for(var t=1;t<f;t++){var v=t-1<0?f-1:t-1,o=(t+1)%f,y=u-1<0?e-1:u-1,x=(u+1)%e,w=[],A=[0,0,l[(t*e+u)*4]/255*b];w.push([-1,0,l[(t*e+y)*4]/255*b]);w.push([-1,-1,l[(v*e+y)*4]/255*b]);w.push([0,-1,l[(v*e+u)*4]/255*b]);w.push([1,-1,l[(v*e+x)*4]/255*b]);
 w.push([1,0,l[(t*e+x)*4]/255*b]);w.push([1,1,l[(o*e+x)*4]/255*b]);w.push([0,1,l[(o*e+u)*4]/255*b]);w.push([-1,1,l[(o*e+y)*4]/255*b]);v=[];y=w.length;for(o=0;o<y;o++){var x=w[o],z=w[(o+1)%y],x=[x[0]-A[0],x[1]-A[1],x[2]-A[2]],z=[z[0]-A[0],z[1]-A[1],z[2]-A[2]];v.push(c([x[1]*z[2]-x[2]*z[1],x[2]*z[0]-x[0]*z[2],x[0]*z[1]-x[1]*z[0]]))}w=[0,0,0];for(o=0;o<v.length;o++)w[0]+=v[o][0],w[1]+=v[o][1],w[2]+=v[o][2];w[0]/=v.length;w[1]/=v.length;w[2]/=v.length;A=(t*e+u)*4;p[A]=(w[0]+1)/2*255|0;p[A+1]=(w[1]+0.5)*
 w.push([1,0,l[(t*e+x)*4]/255*b]);w.push([1,1,l[(o*e+x)*4]/255*b]);w.push([0,1,l[(o*e+u)*4]/255*b]);w.push([-1,1,l[(o*e+y)*4]/255*b]);v=[];y=w.length;for(o=0;o<y;o++){var x=w[o],z=w[(o+1)%y],x=[x[0]-A[0],x[1]-A[1],x[2]-A[2]],z=[z[0]-A[0],z[1]-A[1],z[2]-A[2]];v.push(c([x[1]*z[2]-x[2]*z[1],x[2]*z[0]-x[0]*z[2],x[0]*z[1]-x[1]*z[0]]))}w=[0,0,0];for(o=0;o<v.length;o++)w[0]+=v[o][0],w[1]+=v[o][1],w[2]+=v[o][2];w[0]/=v.length;w[1]/=v.length;w[2]/=v.length;A=(t*e+u)*4;p[A]=(w[0]+1)/2*255|0;p[A+1]=(w[1]+0.5)*
 255|0;p[A+2]=w[2]*255|0;p[A+3]=255}k.putImageData(n,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,e,f=a.children.length;for(e=0;e<f;e++)c=a.children[e],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,e=b.length,f=new THREE.Object3D;for(c=0;c<e;c++){var h=new THREE.Mesh(a,b[c]);f.add(h)}return f}};
 255|0;p[A+2]=w[2]*255|0;p[A+3]=255}k.putImageData(n,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,e,f=a.children.length;for(e=0;e<f;e++)c=a.children[e],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,e=b.length,f=new THREE.Object3D;for(c=0;c<e;c++){var h=new THREE.Mesh(a,b[c]);f.add(h)}return f}};
@@ -433,7 +433,7 @@ THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","ro
 t)}n.prevKey[c]=k;n.nextKey[c]=l}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(t-k.time)/(l.time-k.time);f=k[c];h=l[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 t)}n.prevKey[c]=k;n.nextKey[c]=l}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(t-k.time)/(l.time-k.time);f=k[c];h=l[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",o,k.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",o,l.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(c===
 this.getPrevKeyWith("pos",o,k.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",o,l.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(c===
 "rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&u[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(o=0;o<this.hierarchy.length;o++)u[o][p]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
 "rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&u[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(o=0;o<this.hierarchy.length;o++)u[o][p]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],f,h,k,l,n,p;f=(a.length-1)*b;h=Math.floor(f);f-=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]];l=a[c[1]];n=a[c[2]];p=a[c[3]];c=f*f;k=f*c;e[0]=this.interpolate(h[0],l[0],n[0],p[0],f,c,k);e[1]=this.interpolate(h[1],l[1],n[1],p[1],f,c,k);e[2]=this.interpolate(h[2],l[2],n[2],p[2],f,c,k);return e};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],f,h,k,l,n,p;f=(a.length-1)*b;h=Math.floor(f);f-=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]];l=a[c[1]];n=a[c[2]];p=a[c[3]];c=f*f;k=f*c;e[0]=this.interpolate(h[0],l[0],n[0],p[0],f,c,k);e[1]=this.interpolate(h[1],l[1],n[1],p[1],f,c,k);e[2]=this.interpolate(h[2],l[2],n[2],p[2],f,c,k);return e};
 THREE.Animation.prototype.interpolate=function(a,b,c,e,f,h,k){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*k+(-3*(b-c)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.interpolate=function(a,b,c,e,f,h,k){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*k+(-3*(b-c)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=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+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=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+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.CubeCamera=function(a,b,c,e){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 THREE.CubeCamera=function(a,b,c,e){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
@@ -486,22 +486,22 @@ this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();
 (f===this.STATE.ROTATE?l=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?p=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(t=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?k=l=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=p=this.getMouseOnScreen(a.clientX,
 (f===this.STATE.ROTATE?l=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?p=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(t=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?k=l=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=p=this.getMouseOnScreen(a.clientX,
 a.clientY):this.noPan||(u=t=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!==
 a.clientY):this.noPan||(u=t=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&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
 this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(a,b,c,e,f,h,k,l){function n(a,c,b,k,l,n,o,t){var u,v,w=e||1,x=f||1,m=l/2,y=n/2,A=p.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")u="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")u="y",x=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")u="x",w=h||1;var z=w+1,C=x+1;l/=w;var ia=n/x;for(v=0;v<C;v++)for(n=0;n<z;n++){var ha=new THREE.Vector3;ha[a]=(n*l-m)*b;ha[c]=(v*ia-y)*k;ha[u]=o;p.vertices.push(new THREE.Vertex(ha))}for(v=0;v<x;v++)for(n=0;n<w;n++)p.faces.push(new THREE.Face4(n+
+THREE.CubeGeometry=function(a,b,c,e,f,h,k,l){function n(a,c,b,k,l,n,o,t){var u,v,w=e||1,x=f||1,m=l/2,y=n/2,A=p.vertices.length;if(a==="x"&&c==="y"||a==="y"&&c==="x")u="z";else if(a==="x"&&c==="z"||a==="z"&&c==="x")u="y",x=h||1;else if(a==="z"&&c==="y"||a==="y"&&c==="z")u="x",w=h||1;var z=w+1,C=x+1;l/=w;var ia=n/x;for(v=0;v<C;v++)for(n=0;n<z;n++){var ha=new THREE.Vector3;ha[a]=(n*l-m)*b;ha[c]=(v*ia-y)*k;ha[u]=o;p.vertices.push(new THREE.Vertex(ha))}for(v=0;v<x;v++)for(n=0;n<w;n++)p.faces.push(new THREE.Face4(n+
 z*v+A,n+z*(v+1)+A,n+1+z*(v+1)+A,n+1+z*v+A,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(n/w,v/x),new THREE.UV(n/w,(v+1)/x),new THREE.UV((n+1)/w,(v+1)/x),new THREE.UV((n+1)/w,v/x)])}THREE.Geometry.call(this);var p=this,u=a/2,t=b/2,v=c/2,o,y,x,w,A,z;if(k!==void 0){if(k instanceof Array)this.materials=k;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(k)}o=0;w=1;y=2;A=3;x=4;z=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var C in l)this.sides[C]!=
 z*v+A,n+z*(v+1)+A,n+1+z*(v+1)+A,n+1+z*v+A,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(n/w,v/x),new THREE.UV(n/w,(v+1)/x),new THREE.UV((n+1)/w,(v+1)/x),new THREE.UV((n+1)/w,v/x)])}THREE.Geometry.call(this);var p=this,u=a/2,t=b/2,v=c/2,o,y,x,w,A,z;if(k!==void 0){if(k instanceof Array)this.materials=k;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(k)}o=0;w=1;y=2;A=3;x=4;z=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var C in l)this.sides[C]!=
 void 0&&(this.sides[C]=l[C]);this.sides.px&&n("z","y",-1,-1,c,b,u,o);this.sides.nx&&n("z","y",1,-1,c,b,-u,w);this.sides.py&&n("x","z",1,1,a,c,t,y);this.sides.ny&&n("x","z",1,-1,a,c,-t,A);this.sides.pz&&n("x","y",1,-1,a,b,v,x);this.sides.nz&&n("x","y",-1,-1,a,b,-v,z);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 void 0&&(this.sides[C]=l[C]);this.sides.px&&n("z","y",-1,-1,c,b,u,o);this.sides.nx&&n("z","y",1,-1,c,b,-u,w);this.sides.py&&n("x","z",1,1,a,c,t,y);this.sides.ny&&n("x","z",1,-1,a,c,-t,A);this.sides.pz&&n("x","y",1,-1,a,b,v,x);this.sides.nz&&n("x","y",-1,-1,a,b,-v,z);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(a,b,c,e,f,h){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,k=c/2,e=e||8,f=f||1,l,n,p=[],u=[];for(n=0;n<=f;n++){var t=[],v=[],o=n/f,y=o*(b-a)+a;for(l=0;l<=e;l++){var x=l/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(x*Math.PI*2),-o*c+k,y*Math.cos(x*Math.PI*2))));t.push(this.vertices.length-1);v.push(new THREE.UV(x,o))}p.push(t);u.push(v)}for(n=0;n<f;n++)for(l=0;l<e;l++){var c=p[n][l],t=p[n+1][l],v=p[n+1][l+1],o=p[n][l+1],y=
 THREE.CylinderGeometry=function(a,b,c,e,f,h){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,k=c/2,e=e||8,f=f||1,l,n,p=[],u=[];for(n=0;n<=f;n++){var t=[],v=[],o=n/f,y=o*(b-a)+a;for(l=0;l<=e;l++){var x=l/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(x*Math.PI*2),-o*c+k,y*Math.cos(x*Math.PI*2))));t.push(this.vertices.length-1);v.push(new THREE.UV(x,o))}p.push(t);u.push(v)}for(n=0;n<f;n++)for(l=0;l<e;l++){var c=p[n][l],t=p[n+1][l],v=p[n+1][l+1],o=p[n][l+1],y=
 this.vertices[c].position.clone().setY(0).normalize(),x=this.vertices[t].position.clone().setY(0).normalize(),w=this.vertices[v].position.clone().setY(0).normalize(),A=this.vertices[o].position.clone().setY(0).normalize(),z=u[n][l].clone(),C=u[n+1][l].clone(),B=u[n+1][l+1].clone(),K=u[n][l+1].clone();this.faces.push(new THREE.Face4(c,t,v,o,[y,x,w,A]));this.faceVertexUvs[0].push([z,C,B,K])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(l=0;l<e;l++)c=p[0][l],t=p[0][l+
 this.vertices[c].position.clone().setY(0).normalize(),x=this.vertices[t].position.clone().setY(0).normalize(),w=this.vertices[v].position.clone().setY(0).normalize(),A=this.vertices[o].position.clone().setY(0).normalize(),z=u[n][l].clone(),C=u[n+1][l].clone(),B=u[n+1][l+1].clone(),K=u[n][l+1].clone();this.faces.push(new THREE.Face4(c,t,v,o,[y,x,w,A]));this.faceVertexUvs[0].push([z,C,B,K])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(l=0;l<e;l++)c=p[0][l],t=p[0][l+
 1],v=this.vertices.length-1,y=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),z=u[0][l].clone(),C=u[0][l+1].clone(),B=new THREE.UV(C.u,0),this.faces.push(new THREE.Face3(c,t,v,[y,x,w])),this.faceVertexUvs[0].push([z,C,B])}if(!h&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(l=0;l<e;l++)c=p[n][l+1],t=p[n][l],v=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),z=u[n][l+1].clone(),C=u[n][l].clone(),
 1],v=this.vertices.length-1,y=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),z=u[0][l].clone(),C=u[0][l+1].clone(),B=new THREE.UV(C.u,0),this.faces.push(new THREE.Face3(c,t,v,[y,x,w])),this.faceVertexUvs[0].push([z,C,B])}if(!h&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(l=0;l<e;l++)c=p[n][l+1],t=p[n][l],v=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),z=u[n][l+1].clone(),C=u[n][l].clone(),
 B=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(c,t,v,[y,x,w])),this.faceVertexUvs[0].push([z,C,B])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 B=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(c,t,v,[y,x,w])),this.faceVertexUvs[0].push([z,C,B])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
-THREE.ExtrudeGeometry=function(a,b){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(c=0;c<e;c++)f=a[c],this.addShape(f,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(c=0;c<e;c++)f=a[c],this.addShape(f,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){c||console.log("die");return c.clone().multiplyScalar(b).addSelf(a)}function e(a,c,b){var e=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;e.set(a.x-c.x,a.y-c.y);k.set(a.x-b.x,a.y-b.y);e=e.normalize();k=k.normalize();h.set(-e.y,e.x);f.set(k.y,-k.x);l.copy(a).addSelf(h);m.copy(a).addSelf(f);if(l.equals(m))return f.clone();
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){c||console.log("die");return c.clone().multiplyScalar(b).addSelf(a)}function e(a,c,b){var e=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;e.set(a.x-c.x,a.y-c.y);k.set(a.x-b.x,a.y-b.y);e=e.normalize();k=k.normalize();h.set(-e.y,e.x);f.set(k.y,-k.x);l.copy(a).addSelf(h);m.copy(a).addSelf(f);if(l.equals(m))return f.clone();
-l.copy(c).addSelf(h);m.copy(b).addSelf(f);h=e.dot(f);f=m.subSelf(l).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(l).subSelf(a).clone()}function f(a){for(H=a.length;--H>=0;){ja=H;ca=H-1;ca<0&&(ca=a.length-
+l.copy(c).addSelf(h);m.copy(b).addSelf(f);h=e.dot(f);f=m.subSelf(l).dot(f);h===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(l).subSelf(a).clone()}function f(a){for(H=a.length;--H>=0;){ja=H;ca=H-1;ca<0&&(ca=a.length-
 1);for(var c=0,b=o+u*2,c=0;c<b;c++){var e=aa*c,k=aa*(c+1),h=Z+ja+e,f=Z+ja+k,m=h,e=Z+ca+e,k=Z+ca+k,p=f;m+=V;e+=V;k+=V;p+=V;O.faces.push(new THREE.Face4(m,e,k,p,null,null,B));B&&(m=c/b,e=(c+1)/b,k=l+n*2,h=(O.vertices[h].position.z+n)/k,f=(O.vertices[f].position.z+n)/k,O.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,c,b){O.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function k(a,c,b){a+=V;c+=V;b+=V;O.faces.push(new THREE.Face3(a,
 1);for(var c=0,b=o+u*2,c=0;c<b;c++){var e=aa*c,k=aa*(c+1),h=Z+ja+e,f=Z+ja+k,m=h,e=Z+ca+e,k=Z+ca+k,p=f;m+=V;e+=V;k+=V;p+=V;O.faces.push(new THREE.Face4(m,e,k,p,null,null,B));B&&(m=c/b,e=(c+1)/b,k=l+n*2,h=(O.vertices[h].position.z+n)/k,f=(O.vertices[f].position.z+n)/k,O.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,c,b){O.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function k(a,c,b){a+=V;c+=V;b+=V;O.faces.push(new THREE.Face3(a,
 c,b,null,null,C));if(C){var e=K.maxY,k=K.maxX,h=O.vertices[c].position.x,c=O.vertices[c].position.y,f=O.vertices[b].position.x,b=O.vertices[b].position.y;O.faceVertexUvs[0].push([new THREE.UV(O.vertices[a].position.x/k,O.vertices[a].position.y/e),new THREE.UV(h/k,c/e),new THREE.UV(f/k,b/e)])}}var l=b.amount!==void 0?b.amount:100,n=b.bevelThickness!==void 0?b.bevelThickness:6,p=b.bevelSize!==void 0?b.bevelSize:n-2,u=b.bevelSegments!==void 0?b.bevelSegments:3,t=b.bevelEnabled!==void 0?b.bevelEnabled:
 c,b,null,null,C));if(C){var e=K.maxY,k=K.maxX,h=O.vertices[c].position.x,c=O.vertices[c].position.y,f=O.vertices[b].position.x,b=O.vertices[b].position.y;O.faceVertexUvs[0].push([new THREE.UV(O.vertices[a].position.x/k,O.vertices[a].position.y/e),new THREE.UV(h/k,c/e),new THREE.UV(f/k,b/e)])}}var l=b.amount!==void 0?b.amount:100,n=b.bevelThickness!==void 0?b.bevelThickness:6,p=b.bevelSize!==void 0?b.bevelSize:n-2,u=b.bevelSegments!==void 0?b.bevelSegments:3,t=b.bevelEnabled!==void 0?b.bevelEnabled:
 !0,v=b.curveSegments!==void 0?b.curveSegments:12,o=b.steps!==void 0?b.steps:1,y=b.bendPath,x=b.extrudePath,w,A=!1,z=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,C=b.material,B=b.extrudeMaterial,K=this.shapebb;if(x)w=x.getPoints(v),o=w.length,A=!0,t=!1;t||(p=n=u=0);var F,M,E,O=this,V=this.vertices.length;y&&a.addWrapPath(y);v=z?a.extractAllSpacedPoints(v):a.extractAllPoints(v);y=v.shape;v=v.holes;if(x=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();M=0;for(E=v.length;M<E;M++)F=v[M],THREE.Shape.Utils.isClockWise(F)&&
 !0,v=b.curveSegments!==void 0?b.curveSegments:12,o=b.steps!==void 0?b.steps:1,y=b.bendPath,x=b.extrudePath,w,A=!1,z=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,C=b.material,B=b.extrudeMaterial,K=this.shapebb;if(x)w=x.getPoints(v),o=w.length,A=!0,t=!1;t||(p=n=u=0);var F,M,E,O=this,V=this.vertices.length;y&&a.addWrapPath(y);v=z?a.extractAllSpacedPoints(v):a.extractAllPoints(v);y=v.shape;v=v.holes;if(x=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();M=0;for(E=v.length;M<E;M++)F=v[M],THREE.Shape.Utils.isClockWise(F)&&
-(v[M]=F.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(y,v);z=y;M=0;for(E=v.length;M<E;M++)F=v[M],y=y.concat(F);var H,P,L,T,S,m,aa=y.length,U=x.length,ea=[];H=0;P=z.length;ja=P-1;for(ca=H+1;H<P;H++,ja++,ca++)ja==P&&(ja=0),ca==P&&(ca=0),ea[H]=e(z[H],z[ja],z[ca]);var da=[],ia,ha=ea.concat();M=0;for(E=v.length;M<E;M++){F=v[M];ia=[];H=0;P=F.length;ja=P-1;for(ca=H+1;H<P;H++,ja++,ca++)ja==P&&(ja=0),ca==P&&(ca=0),ia[H]=e(F[H],F[ja],F[ca]);da.push(ia);ha=ha.concat(ia)}for(L=0;L<u;L++){T=L/u;S=n*(1-
-T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H<P;H++)m=c(z[H],ea[H],T),h(m.x,m.y,-S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];H=0;for(P=F.length;H<P;H++)m=c(F[H],ia[H],T),h(m.x,m.y,-S)}}T=p;for(H=0;H<aa;H++)m=t?c(y[H],ha[H],T):y[H],A?h(m.x,m.y+w[0].y,w[0].x):h(m.x,m.y,0);for(L=1;L<=o;L++)for(H=0;H<aa;H++)m=t?c(y[H],ha[H],T):y[H],A?h(m.x,m.y+w[L-1].y,w[L-1].x):h(m.x,m.y,l/o*L);for(L=u-1;L>=0;L--){T=L/u;S=n*(1-T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H<P;H++)m=c(z[H],ea[H],T),h(m.x,m.y,
-l+S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];H=0;for(P=F.length;H<P;H++)m=c(F[H],ia[H],T),A?h(m.x,m.y+w[o-1].y,w[o-1].x+S):h(m.x,m.y,l+S)}}if(t){t=aa*0;for(H=0;H<U;H++)p=x[H],k(p[2]+t,p[1]+t,p[0]+t);t=aa*(o+u*2);for(H=0;H<U;H++)p=x[H],k(p[0]+t,p[1]+t,p[2]+t)}else{for(H=0;H<U;H++)p=x[H],k(p[2],p[1],p[0]);for(H=0;H<U;H++)p=x[H],k(p[0]+aa*o,p[1]+aa*o,p[2]+aa*o)}var ja,ca,Z=0;f(z);Z+=z.length;M=0;for(E=v.length;M<E;M++)F=v[M],f(F),Z+=F.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+(v[M]=F.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(y,v);z=y;M=0;for(E=v.length;M<E;M++)F=v[M],y=y.concat(F);var H,P,L,T,S,m,aa=y.length,U=x.length,ea=[];H=0;P=z.length;ja=P-1;for(ca=H+1;H<P;H++,ja++,ca++)ja===P&&(ja=0),ca===P&&(ca=0),ea[H]=e(z[H],z[ja],z[ca]);var da=[],ia,ha=ea.concat();M=0;for(E=v.length;M<E;M++){F=v[M];ia=[];H=0;P=F.length;ja=P-1;for(ca=H+1;H<P;H++,ja++,ca++)ja===P&&(ja=0),ca===P&&(ca=0),ia[H]=e(F[H],F[ja],F[ca]);da.push(ia);ha=ha.concat(ia)}for(L=0;L<u;L++){T=L/u;S=n*
+(1-T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H<P;H++)m=c(z[H],ea[H],T),h(m.x,m.y,-S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];H=0;for(P=F.length;H<P;H++)m=c(F[H],ia[H],T),h(m.x,m.y,-S)}}T=p;for(H=0;H<aa;H++)m=t?c(y[H],ha[H],T):y[H],A?h(m.x,m.y+w[0].y,w[0].x):h(m.x,m.y,0);for(L=1;L<=o;L++)for(H=0;H<aa;H++)m=t?c(y[H],ha[H],T):y[H],A?h(m.x,m.y+w[L-1].y,w[L-1].x):h(m.x,m.y,l/o*L);for(L=u-1;L>=0;L--){T=L/u;S=n*(1-T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H<P;H++)m=c(z[H],ea[H],T),h(m.x,
+m.y,l+S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];H=0;for(P=F.length;H<P;H++)m=c(F[H],ia[H],T),A?h(m.x,m.y+w[o-1].y,w[o-1].x+S):h(m.x,m.y,l+S)}}if(t){t=aa*0;for(H=0;H<U;H++)p=x[H],k(p[2]+t,p[1]+t,p[0]+t);t=aa*(o+u*2);for(H=0;H<U;H++)p=x[H],k(p[0]+t,p[1]+t,p[2]+t)}else{for(H=0;H<U;H++)p=x[H],k(p[2],p[1],p[0]);for(H=0;H<U;H++)p=x[H],k(p[0]+aa*o,p[1]+aa*o,p[2]+aa*o)}var ja,ca,Z=0;f(z);Z+=z.length;M=0;for(E=v.length;M<E;M++)F=v[M],f(F),Z+=F.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=f.vertices[a].position,k=f.vertices[c].position;return b((e.x+k.x)/2,(e.y+k.y)/2,(e.z+k.z)/2)}var f=this,h=new THREE.Geometry;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,
 THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=f.vertices[a].position,k=f.vertices[c].position;return b((e.x+k.x)/2,(e.y+k.y)/2,(e.z+k.z)/2)}var f=this,h=new THREE.Geometry;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(var k=0;k<this.subdivisions;k++){var a=new THREE.Geometry,l;for(l in h.faces){var n=e(h.faces[l].a,h.faces[l].b),p=e(h.faces[l].b,h.faces[l].c),u=e(h.faces[l].c,h.faces[l].a);c(h.faces[l].a,n,u,a);c(h.faces[l].b,p,
 -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(var k=0;k<this.subdivisions;k++){var a=new THREE.Geometry,l;for(l in h.faces){var n=e(h.faces[l].a,h.faces[l].b),p=e(h.faces[l].b,h.faces[l].c),u=e(h.faces[l].c,h.faces[l].a);c(h.faces[l].a,n,u,a);c(h.faces[l].b,p,
@@ -653,17 +653,18 @@ THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.verti
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 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=
 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,f){return a+(b-a)*f};this.VIntX=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l+k*this.delta;b[h+1]=n;b[h+2]=p;f[h]=this.lerp(u[a],u[a+3],k);f[h+1]=this.lerp(u[a+1],u[a+4],k);f[h+2]=this.lerp(u[a+2],u[a+5],k)};this.VIntY=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l;b[h+1]=n+k*this.delta;b[h+
 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,f){return a+(b-a)*f};this.VIntX=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l+k*this.delta;b[h+1]=n;b[h+2]=p;f[h]=this.lerp(u[a],u[a+3],k);f[h+1]=this.lerp(u[a+1],u[a+4],k);f[h+2]=this.lerp(u[a+2],u[a+5],k)};this.VIntY=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l;b[h+1]=n+k*this.delta;b[h+
-2]=p;b=a+this.yd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};this.VIntZ=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l;b[h+1]=n;b[h+2]=p+k*this.delta;b=a+this.zd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};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,f,h,k,l){var n=h+1,p=h+this.yd,u=h+this.zd,t=n+this.yd,v=n+this.zd,o=h+this.yd+this.zd,y=n+this.yd+this.zd,x=0,w=this.field[h],A=this.field[n],z=this.field[p],C=this.field[t],B=this.field[u],K=this.field[v],F=this.field[o],M=this.field[y];w<k&&(x|=1);A<k&&(x|=2);z<k&&(x|=8);C<k&&(x|=4);B<k&&(x|=16);K<k&&(x|=32);F<k&&(x|=128);M<k&&(x|=64);var E=THREE.edgeTable[x];if(E==0)return 0;var O=this.delta,
-V=a+O,H=b+O,O=f+O;E&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,a,b,f,w,A));E&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,V,b,f,A,C));E&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,a,H,f,z,C));E&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,k,a,b,f,w,z));E&16&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,12,k,a,b,O,B,K));E&32&&(this.compNorm(v),
-this.compNorm(y),this.VIntY(v*3,this.vlist,this.nlist,15,k,V,b,O,K,M));E&64&&(this.compNorm(o),this.compNorm(y),this.VIntX(o*3,this.vlist,this.nlist,18,k,a,H,O,F,M));E&128&&(this.compNorm(u),this.compNorm(o),this.VIntY(u*3,this.vlist,this.nlist,21,k,a,b,O,B,F));E&256&&(this.compNorm(h),this.compNorm(u),this.VIntZ(h*3,this.vlist,this.nlist,24,k,a,b,f,w,B));E&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,k,V,b,f,A,K));E&1024&&(this.compNorm(t),this.compNorm(y),this.VIntZ(t*
-3,this.vlist,this.nlist,30,k,V,H,f,C,M));E&2048&&(this.compNorm(p),this.compNorm(o),this.VIntZ(p*3,this.vlist,this.nlist,33,k,a,H,f,z,F));x<<=4;for(k=h=0;THREE.triTable[x+k]!=-1;)a=x+k,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],l),k+=3,h++;return h};this.posnormtriv=function(a,b,f,h,k,l){var n=this.count*3;this.positionArray[n]=a[f];this.positionArray[n+1]=a[f+1];this.positionArray[n+2]=a[f+2];this.positionArray[n+3]=a[h];this.positionArray[n+
-4]=a[h+1];this.positionArray[n+5]=a[h+2];this.positionArray[n+6]=a[k];this.positionArray[n+7]=a[k+1];this.positionArray[n+8]=a[k+2];this.normalArray[n]=b[f];this.normalArray[n+1]=b[f+1];this.normalArray[n+2]=b[f+2];this.normalArray[n+3]=b[h];this.normalArray[n+4]=b[h+1];this.normalArray[n+5]=b[h+2];this.normalArray[n+6]=b[k];this.normalArray[n+7]=b[k+1];this.normalArray[n+8]=b[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&l(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,f,h,k){var l=this.size*Math.sqrt(h/k),n=f*this.size,p=b*this.size,u=a*this.size,t=Math.floor(n-l);t<1&&(t=1);n=Math.floor(n+l);n>this.size-1&&(n=this.size-1);var v=Math.floor(p-l);v<1&&(v=1);p=Math.floor(p+l);p>this.size-1&&(p=this.size-1);var o=Math.floor(u-l);o<1&&(o=1);l=Math.floor(u+l);l>this.size-1&&(l=this.size-
-1);for(var y,x,w,A,z,C;t<n;t++){u=this.size2*t;x=t/this.size-f;z=x*x;for(x=v;x<p;x++){w=u+this.size*x;y=x/this.size-b;C=y*y;for(y=o;y<l;y++)A=y/this.size-a,A=h/(1.0E-6+A*A+C+z)-k,A>0&&(this.field[w+y]+=A)}}};this.addPlaneX=function(a,b){var f,h,k,l,n,p=this.size,u=this.yd,t=this.zd,v=this.field,o=p*Math.sqrt(a/b);o>p&&(o=p);for(f=0;f<o;f++)if(h=f/p,h*=h,l=a/(1.0E-4+h)-b,l>0)for(h=0;h<p;h++){n=f+h*u;for(k=0;k<p;k++)v[t*k+n]+=l}};this.addPlaneY=function(a,b){var f,h,k,l,n,p,u=this.size,t=this.yd,v=
-this.zd,o=this.field,y=u*Math.sqrt(a/b);y>u&&(y=u);for(h=0;h<y;h++)if(f=h/u,f*=f,l=a/(1.0E-4+f)-b,l>0){n=h*t;for(f=0;f<u;f++){p=n+f;for(k=0;k<u;k++)o[v*k+p]+=l}}};this.addPlaneZ=function(a,b){var f,h,k,l,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(k=0;k<dist;k++)if(f=k/size,f*=f,l=a/(1.0E-4+f)-b,l>0){n=zd*k;for(h=0;h<size;h++){p=n+h*yd;for(f=0;f<size;f++)field[p+f]+=l}}};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,f,h,k,l,n,p,u,t,v=this.size-2;for(k=1;k<v;k++){t=this.size2*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<v;h++){u=t+this.size*h;n=(h-this.halfsize)/this.halfsize;for(f=1;f<v;f++)l=(f-this.halfsize)/this.halfsize,b=u+f,this.polygonize(l,n,p,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(h){var k,l,n,p,u,t,v,o;for(k=0;k<h.count;k++)v=k*3,u=v+1,o=v+2,l=h.positionArray[v],
-n=h.positionArray[u],p=h.positionArray[o],t=new THREE.Vector3(l,n,p),l=h.normalArray[v],n=h.normalArray[u],p=h.normalArray[o],v=new THREE.Vector3(l,n,p),v.normalize(),u=new THREE.Vertex(t),b.vertices.push(u),f.push(v);nfaces=h.count/3;for(k=0;k<nfaces;k++)v=(a+k)*3,u=v+1,o=v+2,t=f[v],l=f[u],n=f[o],v=new THREE.Face3(v,u,o,[t,l,n]),b.faces.push(v);a+=nfaces;h.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+2]=p;b=a+this.yd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};this.VIntZ=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l;b[h+1]=n;b[h+2]=p+k*this.delta;b=a+this.zd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};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,f,h,k,l){var n=h+1,p=h+this.yd,u=h+this.zd,t=n+this.yd,v=n+this.zd,o=h+this.yd+this.zd,y=n+this.yd+this.zd,x=0,w=this.field[h],A=this.field[n],z=this.field[p],C=this.field[t],B=this.field[u],K=this.field[v],F=this.field[o],M=this.field[y];w<k&&(x|=1);A<k&&(x|=2);z<k&&(x|=8);C<k&&(x|=4);B<k&&(x|=16);K<k&&(x|=32);F<k&&(x|=128);M<k&&(x|=64);var E=THREE.edgeTable[x];if(E===0)return 0;
+var O=this.delta,V=a+O,H=b+O,O=f+O;E&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,a,b,f,w,A));E&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,V,b,f,A,C));E&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,a,H,f,z,C));E&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,k,a,b,f,w,z));E&16&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,12,k,a,b,O,B,K));
+E&32&&(this.compNorm(v),this.compNorm(y),this.VIntY(v*3,this.vlist,this.nlist,15,k,V,b,O,K,M));E&64&&(this.compNorm(o),this.compNorm(y),this.VIntX(o*3,this.vlist,this.nlist,18,k,a,H,O,F,M));E&128&&(this.compNorm(u),this.compNorm(o),this.VIntY(u*3,this.vlist,this.nlist,21,k,a,b,O,B,F));E&256&&(this.compNorm(h),this.compNorm(u),this.VIntZ(h*3,this.vlist,this.nlist,24,k,a,b,f,w,B));E&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,k,V,b,f,A,K));E&1024&&(this.compNorm(t),
+this.compNorm(y),this.VIntZ(t*3,this.vlist,this.nlist,30,k,V,H,f,C,M));E&2048&&(this.compNorm(p),this.compNorm(o),this.VIntZ(p*3,this.vlist,this.nlist,33,k,a,H,f,z,F));x<<=4;for(k=h=0;THREE.triTable[x+k]!=-1;)a=x+k,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],l),k+=3,h++;return h};this.posnormtriv=function(a,b,f,h,k,l){var n=this.count*3;this.positionArray[n]=a[f];this.positionArray[n+1]=a[f+1];this.positionArray[n+2]=a[f+2];this.positionArray[n+
+3]=a[h];this.positionArray[n+4]=a[h+1];this.positionArray[n+5]=a[h+2];this.positionArray[n+6]=a[k];this.positionArray[n+7]=a[k+1];this.positionArray[n+8]=a[k+2];this.normalArray[n]=b[f];this.normalArray[n+1]=b[f+1];this.normalArray[n+2]=b[f+2];this.normalArray[n+3]=b[h];this.normalArray[n+4]=b[h+1];this.normalArray[n+5]=b[h+2];this.normalArray[n+6]=b[k];this.normalArray[n+7]=b[k+1];this.normalArray[n+8]=b[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&l(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,f,h,k){var l=this.size*Math.sqrt(h/k),n=f*this.size,p=b*this.size,u=a*this.size,t=Math.floor(n-l);t<1&&(t=1);n=Math.floor(n+l);n>this.size-1&&(n=this.size-1);var v=Math.floor(p-l);v<1&&(v=1);p=Math.floor(p+l);p>this.size-1&&(p=this.size-1);var o=Math.floor(u-l);o<1&&(o=1);l=Math.floor(u+l);
+l>this.size-1&&(l=this.size-1);for(var y,x,w,A,z,C;t<n;t++){u=this.size2*t;x=t/this.size-f;z=x*x;for(x=v;x<p;x++){w=u+this.size*x;y=x/this.size-b;C=y*y;for(y=o;y<l;y++)A=y/this.size-a,A=h/(1.0E-6+A*A+C+z)-k,A>0&&(this.field[w+y]+=A)}}};this.addPlaneX=function(a,b){var f,h,k,l,n,p=this.size,u=this.yd,t=this.zd,v=this.field,o=p*Math.sqrt(a/b);o>p&&(o=p);for(f=0;f<o;f++)if(h=f/p,h*=h,l=a/(1.0E-4+h)-b,l>0)for(h=0;h<p;h++){n=f+h*u;for(k=0;k<p;k++)v[t*k+n]+=l}};this.addPlaneY=function(a,b){var f,h,k,l,
+n,p,u=this.size,t=this.yd,v=this.zd,o=this.field,y=u*Math.sqrt(a/b);y>u&&(y=u);for(h=0;h<y;h++)if(f=h/u,f*=f,l=a/(1.0E-4+f)-b,l>0){n=h*t;for(f=0;f<u;f++){p=n+f;for(k=0;k<u;k++)o[v*k+p]+=l}}};this.addPlaneZ=function(a,b){var f,h,k,l,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(k=0;k<dist;k++)if(f=k/size,f*=f,l=a/(1.0E-4+f)-b,l>0){n=zd*k;for(h=0;h<size;h++){p=n+h*yd;for(f=0;f<size;f++)field[p+f]+=l}}};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,f,h,k,l,n,p,u,t,v=this.size-2;for(k=1;k<v;k++){t=this.size2*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<v;h++){u=t+this.size*h;n=(h-this.halfsize)/this.halfsize;for(f=1;f<v;f++)l=(f-this.halfsize)/this.halfsize,b=u+f,this.polygonize(l,n,p,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(h){var k,l,n,p,u,t,v,o;for(k=0;k<h.count;k++)v=
+k*3,u=v+1,o=v+2,l=h.positionArray[v],n=h.positionArray[u],p=h.positionArray[o],t=new THREE.Vector3(l,n,p),l=h.normalArray[v],n=h.normalArray[u],p=h.normalArray[o],v=new THREE.Vector3(l,n,p),v.normalize(),u=new THREE.Vertex(t),b.vertices.push(u),f.push(v);nfaces=h.count/3;for(k=0;k<nfaces;k++)v=(a+k)*3,u=v+1,o=v+2,t=f[v],l=f[u],n=f[o],v=new THREE.Face3(v,u,o,[t,l,n]),b.faces.push(v);a+=nfaces;h.count=0});return b};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]);

+ 8 - 8
build/custom/ThreeCanvas.js

@@ -1,11 +1,11 @@
 // ThreeCanvas.js r46dev - http://github.com/mrdoob/three.js
 // ThreeCanvas.js r46dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,e;if(c==0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),f=a*6-d,a=c*(1-b),e=c*(1-
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,e;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),f=a*6-d,a=c*(1-b),e=c*(1-
 b*f),b=c*(1-b*(1-f)),d){case 1:this.r=e;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=e;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=e;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 b*f),b=c*(1-b*(1-f)),d){case 1:this.r=e;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=e;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=e;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
-equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
+equals:function(a){return a.x===this.x&&a.y===this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
 addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
 addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
 divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
@@ -15,8 +15,8 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
-c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}for(var d,f=[],e=0,g=a.children.length;e<g;e++)Array.prototype.push.apply(f,this.intersectObject(a.children[e]));if(a instanceof THREE.Particle){e=b(this.origin,this.direction,a.matrixWorld.getPosition());if(e==null||e>a.scale.x)return[];d={distance:e,point:a.position,face:null,object:a};f.push(d)}else if(a instanceof THREE.Mesh){e=b(this.origin,
-this.direction,a.matrixWorld.getPosition());if(e==null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var h,m,k,l,i,n,j,r,t=a.geometry,w=t.vertices,e=0,g=t.faces.length;e<g;e++)if(d=t.faces[e],j=this.origin.clone(),r=this.direction.clone(),l=a.matrixWorld,h=l.multiplyVector3(d.centroid.clone()).subSelf(j),n=h.dot(r),!(n<=0)&&(h=l.multiplyVector3(w[d.a].position.clone()),m=l.multiplyVector3(w[d.b].position.clone()),k=l.multiplyVector3(w[d.c].position.clone()),
+c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}for(var d,f=[],e=0,g=a.children.length;e<g;e++)Array.prototype.push.apply(f,this.intersectObject(a.children[e]));if(a instanceof THREE.Particle){e=b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.scale.x)return[];d={distance:e,point:a.position,face:null,object:a};f.push(d)}else if(a instanceof THREE.Mesh){e=
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var h,m,k,l,i,n,j,r,t=a.geometry,w=t.vertices,e=0,g=t.faces.length;e<g;e++)if(d=t.faces[e],j=this.origin.clone(),r=this.direction.clone(),l=a.matrixWorld,h=l.multiplyVector3(d.centroid.clone()).subSelf(j),n=h.dot(r),!(n<=0)&&(h=l.multiplyVector3(w[d.a].position.clone()),m=l.multiplyVector3(w[d.b].position.clone()),k=l.multiplyVector3(w[d.c].position.clone()),
 l=d instanceof THREE.Face4?l.multiplyVector3(w[d.d].position.clone()):null,i=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=r.dot(i),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=i.dot((new THREE.Vector3).sub(h,j))/n,j=j.addSelf(r.multiplyScalar(n)),d instanceof THREE.Face3)c(j,h,m,k)&&(d={distance:this.origin.distanceTo(j),point:j,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(j,h,m,l)||c(j,m,k,l)))d={distance:this.origin.distanceTo(j),point:j,face:d,object:a},f.push(d)}return f}};
 l=d instanceof THREE.Face4?l.multiplyVector3(w[d.d].position.clone()):null,i=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=r.dot(i),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=i.dot((new THREE.Vector3).sub(h,j))/n,j=j.addSelf(r.multiplyScalar(n)),d instanceof THREE.Face3)c(j,h,m,k)&&(d={distance:this.origin.distanceTo(j),point:j,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(j,h,m,l)||c(j,m,k,l)))d={distance:this.origin.distanceTo(j),point:j,face:d,object:a},f.push(d)}return f}};
 THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,l,i){h=!1;b=e;c=g;d=l;f=i;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
 THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,l,i){h=!1;b=e;c=g;d=l;f=i;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
 function(e,g,l,i,n,j){h?(h=!1,b=e<l?e<n?e:n:l<n?l:n,c=g<i?g<j?g:j:i<j?i:j,d=e>l?e>n?e:n:l>n?l:n,f=g>i?g>j?g:j:i>j?i:j):(b=e<l?e<n?e<b?e:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b,c=g<i?g<j?g<c?g:c:j<c?j:c:i<j?i<c?i:c:j<c?j:c,d=e>l?e>n?e>d?e:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d,f=g>i?g>j?g>f?g:f:j>f?j:f:i>j?i>f?i:f:j>f?j:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
 function(e,g,l,i,n,j){h?(h=!1,b=e<l?e<n?e:n:l<n?l:n,c=g<i?g<j?g:j:i<j?i:j,d=e>l?e>n?e:n:l>n?l:n,f=g>i?g>j?g:j:i>j?i:j):(b=e<l?e<n?e<b?e:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b,c=g<i?g<j?g<c?g:c:j<c?j:c:i<j?i<c?i:c:j<c?j:c,d=e>l?e>n?e>d?e:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d,f=g>i?g>j?g>f?g:f:j>f?j:f:i>j?i>f?i:f:j>f?j:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
@@ -44,7 +44,7 @@ c.y=f.length();c.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Mat
 a.n23*f;this.n33=a.n33*f}};
 a.n23*f;this.n33=a.n33*f}};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,m=a.n23,k=a.n24,l=a.n31,i=a.n32,n=a.n33,j=a.n34,r=a.n41,t=a.n42,w=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=m*j*t-k*n*t+k*i*w-h*j*w-m*i*u+h*n*u;b.n12=e*n*t-f*j*t-e*i*w+d*j*w+f*i*u-d*n*u;b.n13=f*k*t-e*m*t+e*h*w-d*k*w-f*h*u+d*m*u;b.n14=e*m*i-f*k*i-e*h*n+d*k*n+f*h*j-d*m*j;b.n21=k*n*r-m*j*r-k*l*w+g*j*w+m*l*u-g*n*u;b.n22=f*j*r-e*n*r+e*l*w-c*j*w-f*l*u+c*n*u;b.n23=e*m*r-f*k*r-e*g*w+c*k*w+f*g*u-c*m*u;b.n24=
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,m=a.n23,k=a.n24,l=a.n31,i=a.n32,n=a.n33,j=a.n34,r=a.n41,t=a.n42,w=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=m*j*t-k*n*t+k*i*w-h*j*w-m*i*u+h*n*u;b.n12=e*n*t-f*j*t-e*i*w+d*j*w+f*i*u-d*n*u;b.n13=f*k*t-e*m*t+e*h*w-d*k*w-f*h*u+d*m*u;b.n14=e*m*i-f*k*i-e*h*n+d*k*n+f*h*j-d*m*j;b.n21=k*n*r-m*j*r-k*l*w+g*j*w+m*l*u-g*n*u;b.n22=f*j*r-e*n*r+e*l*w-c*j*w-f*l*u+c*n*u;b.n23=e*m*r-f*k*r-e*g*w+c*k*w+f*g*u-c*m*u;b.n24=
 f*k*l-e*m*l+e*g*n-c*k*n-f*g*j+c*m*j;b.n31=h*j*r-k*i*r+k*l*t-g*j*t-h*l*u+g*i*u;b.n32=e*i*r-d*j*r-e*l*t+c*j*t+d*l*u-c*i*u;b.n33=f*k*r-e*h*r+e*g*t-c*k*t-d*g*u+c*h*u;b.n34=e*h*l-d*k*l-e*g*i+c*k*i+d*g*j-c*h*j;b.n41=m*i*r-h*n*r-m*l*t+g*n*t+h*l*w-g*i*w;b.n42=d*n*r-f*i*r+f*l*t-c*n*t-d*l*w+c*i*w;b.n43=f*h*r-d*m*r-f*g*t+c*m*t+d*g*w-c*h*w;b.n44=d*m*l-f*h*l+f*g*i-c*m*i-d*g*n+c*h*n;b.multiplyScalar(1/a.determinant());return b};
 f*k*l-e*m*l+e*g*n-c*k*n-f*g*j+c*m*j;b.n31=h*j*r-k*i*r+k*l*t-g*j*t-h*l*u+g*i*u;b.n32=e*i*r-d*j*r-e*l*t+c*j*t+d*l*u-c*i*u;b.n33=f*k*r-e*h*r+e*g*t-c*k*t-d*g*u+c*h*u;b.n34=e*h*l-d*k*l-e*g*i+c*k*i+d*g*j-c*h*j;b.n41=m*i*r-h*n*r-m*l*t+g*n*t+h*l*w-g*i*w;b.n42=d*n*r-f*i*r+f*l*t-c*n*t-d*l*w+c*i*w;b.n43=f*h*r-d*m*r-f*g*t+c*m*t+d*g*w-c*h*w;b.n44=d*m*l-f*h*l+f*g*i-c*m*i-d*g*n+c*h*n;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,i=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*k;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*m;c[6]=a*k;c[7]=a*l;c[8]=a*i;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,i=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*k;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*m;c[6]=a*k;c[7]=a*l;c[8]=a*i;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,e){var g;g=new THREE.Matrix4;g.n11=2*f/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*f/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(e+f)/(e-f);g.n34=-2*e*f/(e-f);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,e){var g;g=new THREE.Matrix4;g.n11=2*f/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*f/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(e+f)/(e-f);g.n34=-2*e*f/(e-f);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,h,m,k;g=new THREE.Matrix4;h=b-a;m=c-d;k=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/m;g.n23=0;g.n24=-((c+d)/m);g.n31=0;g.n32=0;g.n33=-2/k;g.n34=-((e+f)/k);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,h,m,k;g=new THREE.Matrix4;h=b-a;m=c-d;k=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/m;g.n23=0;g.n24=-((c+d)/m);g.n31=0;g.n32=0;g.n33=-2/k;g.n34=-((e+f)/k);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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=
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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=
@@ -67,7 +67,7 @@ C.multiplyVector4(y.positionScreen),L=m[h-2],T.copy(y.positionScreen),U.copy(L.p
 v,u.x=s.x/s.w,u.y=s.y/s.w,u.z=s.z,u.rotation=q.rotation.z,u.scale.x=q.scale.x*Math.abs(u.x-(s.x+e.projectionMatrix.n11)/(s.w+e.projectionMatrix.n14)),u.scale.y=q.scale.y*Math.abs(u.y-(s.y+e.projectionMatrix.n22)/(s.w+e.projectionMatrix.n24)),u.materials=q.materials,N.push(u);f&&N.sort(b);return N}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 v,u.x=s.x/s.w,u.y=s.y/s.w,u.z=s.z,u.rotation=q.rotation.z,u.scale.x=q.scale.x*Math.abs(u.x-(s.x+e.projectionMatrix.n11)/(s.w+e.projectionMatrix.n14)),u.scale.y=q.scale.y*Math.abs(u.y-(s.y+e.projectionMatrix.n22)/(s.w+e.projectionMatrix.n24)),u.materials=q.materials,N.push(u);f&&N.sort(b);return N}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,h=d*f;this.w=g*e-h*c;this.x=g*c+h*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,h=d*f;this.w=g*e-h*c;this.x=g*c+h*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
-this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
+this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,m=this.w,k=m*c+g*f-h*d,l=m*d+h*c-e*f,i=m*f+e*d-g*c,c=-e*
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,m=this.w,k=m*c+g*f-h*d,l=m*d+h*c-e*f,i=m*f+e*d-g*c,c=-e*
 c-g*d-h*f;b.x=k*m+c*-e+l*-h-i*-g;b.y=l*m+c*-g+i*-e-k*-h;b.z=i*m+c*-h+k*-g-l*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
 c-g*d-h*f;b.x=k*m+c*-e+l*-h-i*-g;b.y=l*m+c*-g+i*-e-k*-h;b.z=i*m+c*-h+k*-g-l*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
@@ -76,7 +76,7 @@ THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;ret
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
-c,d,f,e,g,h=new THREE.Vector3,m=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),m.sub(b.position,c.position),h.crossSelf(m);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=
+c,d,f,e,g,h=new THREE.Vector3,m=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),m.sub(b.position,c.position),h.crossSelf(m);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),
 THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),
 c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,f,o){h=a.vertices[b].position;m=a.vertices[c].position;k=a.vertices[d].position;l=g[e];i=g[f];n=g[o];j=m.x-h.x;r=k.x-h.x;t=m.y-h.y;w=k.y-h.y;u=m.z-h.z;M=k.z-h.z;R=i.u-l.u;B=n.u-l.u;N=i.v-l.v;O=n.v-l.v;s=1/(R*O-B*N);T.set((O*j-N*r)*s,(O*t-N*w)*s,(O*u-N*M)*s);U.set((R*r-B*j)*s,(R*w-B*t)*s,(R*M-B*u)*s);C[b].addSelf(T);C[c].addSelf(T);C[d].addSelf(T);D[b].addSelf(U);
 c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,f,o){h=a.vertices[b].position;m=a.vertices[c].position;k=a.vertices[d].position;l=g[e];i=g[f];n=g[o];j=m.x-h.x;r=k.x-h.x;t=m.y-h.y;w=k.y-h.y;u=m.z-h.z;M=k.z-h.z;R=i.u-l.u;B=n.u-l.u;N=i.v-l.v;O=n.v-l.v;s=1/(R*O-B*N);T.set((O*j-N*r)*s,(O*t-N*w)*s,(O*u-N*M)*s);U.set((R*r-B*j)*s,(R*w-B*t)*s,(R*M-B*u)*s);C[b].addSelf(T);C[c].addSelf(T);C[d].addSelf(T);D[b].addSelf(U);
@@ -84,7 +84,7 @@ D[c].addSelf(U);D[d].addSelf(U)}var b,c,d,f,e,g,h,m,k,l,i,n,j,r,t,w,u,M,R,B,N,O,
 "c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)I.copy(e.vertexNormals[d]),f=e[J[d]],o=C[f],F.copy(o),F.subSelf(I.multiplyScalar(I.dot(o))).normalize(),K.cross(e.vertexNormals[d],o),f=K.dot(D[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(F.x,F.y,F.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 "c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)I.copy(e.vertexNormals[d]),f=e[J[d]],o=C[f],F.copy(o),F.subSelf(I.multiplyScalar(I.dot(o))).normalize(),K.cross(e.vertexNormals[d],o),f=K.dot(D[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(F.x,F.y,F.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;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 b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),
-c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++){a=this.faces[e];if(a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d]}this.vertices=b}};THREE.GeometryCount=0;
+c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
 THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
 THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
 THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
 THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
 THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
 THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};

+ 6 - 6
build/custom/ThreeDOM.js

@@ -1,11 +1,11 @@
 // ThreeDOM.js r46dev - http://github.com/mrdoob/three.js
 // ThreeDOM.js r46dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,g;if(c==0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),e=a*6-d,a=c*(1-b),g=c*(1-
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,g;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),e=a*6-d,a=c*(1-b),g=c*(1-
 b*e),b=c*(1-b*(1-e)),d){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 b*e),b=c*(1-b*(1-e)),d){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
-equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
+equals:function(a){return a.x===this.x&&a.y===this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
 addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
 addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
 divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
@@ -15,8 +15,8 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
-c=c.clone().subSelf(b),e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a*c-b*d)*e;return f>0&&a>0&&f+a<1}for(var d,e=[],g=0,f=a.children.length;g<f;g++)Array.prototype.push.apply(e,this.intersectObject(a.children[g]));if(a instanceof THREE.Particle){g=b(this.origin,this.direction,a.matrixWorld.getPosition());if(g==null||g>a.scale.x)return[];d={distance:g,point:a.position,face:null,object:a};e.push(d)}else if(a instanceof THREE.Mesh){g=b(this.origin,
-this.direction,a.matrixWorld.getPosition());if(g==null||g>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return e;for(var h,k,i,j,l,n,m,p,q=a.geometry,s=q.vertices,g=0,f=q.faces.length;g<f;g++)if(d=q.faces[g],m=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,h=j.multiplyVector3(d.centroid.clone()).subSelf(m),n=h.dot(p),!(n<=0)&&(h=j.multiplyVector3(s[d.a].position.clone()),k=j.multiplyVector3(s[d.b].position.clone()),i=j.multiplyVector3(s[d.c].position.clone()),
+c=c.clone().subSelf(b),e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a*c-b*d)*e;return f>0&&a>0&&f+a<1}for(var d,e=[],g=0,f=a.children.length;g<f;g++)Array.prototype.push.apply(e,this.intersectObject(a.children[g]));if(a instanceof THREE.Particle){g=b(this.origin,this.direction,a.matrixWorld.getPosition());if(g===null||g>a.scale.x)return[];d={distance:g,point:a.position,face:null,object:a};e.push(d)}else if(a instanceof THREE.Mesh){g=
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(g===null||g>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return e;for(var h,k,i,j,l,n,m,p,q=a.geometry,s=q.vertices,g=0,f=q.faces.length;g<f;g++)if(d=q.faces[g],m=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,h=j.multiplyVector3(d.centroid.clone()).subSelf(m),n=h.dot(p),!(n<=0)&&(h=j.multiplyVector3(s[d.a].position.clone()),k=j.multiplyVector3(s[d.b].position.clone()),i=j.multiplyVector3(s[d.c].position.clone()),
 j=d instanceof THREE.Face4?j.multiplyVector3(s[d.d].position.clone()):null,l=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=p.dot(l),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=l.dot((new THREE.Vector3).sub(h,m))/n,m=m.addSelf(p.multiplyScalar(n)),d instanceof THREE.Face3)c(m,h,k,i)&&(d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d));else if(d instanceof THREE.Face4&&(c(m,h,k,j)||c(m,k,i,j)))d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d)}return e}};
 j=d instanceof THREE.Face4?j.multiplyVector3(s[d.d].position.clone()):null,l=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=p.dot(l),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=l.dot((new THREE.Vector3).sub(h,m))/n,m=m.addSelf(p.multiplyScalar(n)),d instanceof THREE.Face3)c(m,h,k,i)&&(d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d));else if(d instanceof THREE.Face4&&(c(m,h,k,j)||c(m,k,i,j)))d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d)}return e}};
 THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,j,l){h=!1;b=f;c=g;d=j;e=l;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
 THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,j,l){h=!1;b=f;c=g;d=j;e=l;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
 function(f,g,j,l,n,m){h?(h=!1,b=f<j?f<n?f:n:j<n?j:n,c=g<l?g<m?g:m:l<m?l:m,d=f>j?f>n?f:n:j>n?j:n,e=g>l?g>m?g:m:l>m?l:m):(b=f<j?f<n?f<b?f:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<l?g<m?g<c?g:c:m<c?m:c:l<m?l<c?l:c:m<c?m:c,d=f>j?f>n?f>d?f:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,e=g>l?g>m?g>e?g:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
 function(f,g,j,l,n,m){h?(h=!1,b=f<j?f<n?f:n:j<n?j:n,c=g<l?g<m?g:m:l<m?l:m,d=f>j?f>n?f:n:j>n?j:n,e=g>l?g>m?g:m:l>m?l:m):(b=f<j?f<n?f<b?f:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<l?g<m?g<c?g:c:m<c?m:c:l<m?l<c?l:c:m<c?m:c,d=f>j?f>n?f>d?f:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,e=g>l?g>m?g>e?g:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
@@ -44,7 +44,7 @@ c.y=e.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Mat
 a.n23*e;this.n33=a.n33*e}};
 a.n23*e;this.n33=a.n33*e}};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,j=a.n31,l=a.n32,n=a.n33,m=a.n34,p=a.n41,q=a.n42,s=a.n43,r=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*m*q-i*n*q+i*l*s-h*m*s-k*l*r+h*n*r;b.n12=g*n*q-e*m*q-g*l*s+d*m*s+e*l*r-d*n*r;b.n13=e*i*q-g*k*q+g*h*s-d*i*s-e*h*r+d*k*r;b.n14=g*k*l-e*i*l-g*h*n+d*i*n+e*h*m-d*k*m;b.n21=i*n*p-k*m*p-i*j*s+f*m*s+k*j*r-f*n*r;b.n22=e*m*p-g*n*p+g*j*s-c*m*s-e*j*r+c*n*r;b.n23=g*k*p-e*i*p-g*f*s+c*i*s+e*f*r-c*k*r;b.n24=
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,j=a.n31,l=a.n32,n=a.n33,m=a.n34,p=a.n41,q=a.n42,s=a.n43,r=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*m*q-i*n*q+i*l*s-h*m*s-k*l*r+h*n*r;b.n12=g*n*q-e*m*q-g*l*s+d*m*s+e*l*r-d*n*r;b.n13=e*i*q-g*k*q+g*h*s-d*i*s-e*h*r+d*k*r;b.n14=g*k*l-e*i*l-g*h*n+d*i*n+e*h*m-d*k*m;b.n21=i*n*p-k*m*p-i*j*s+f*m*s+k*j*r-f*n*r;b.n22=e*m*p-g*n*p+g*j*s-c*m*s-e*j*r+c*n*r;b.n23=g*k*p-e*i*p-g*f*s+c*i*s+e*f*r-c*k*r;b.n24=
 e*i*j-g*k*j+g*f*n-c*i*n-e*f*m+c*k*m;b.n31=h*m*p-i*l*p+i*j*q-f*m*q-h*j*r+f*l*r;b.n32=g*l*p-d*m*p-g*j*q+c*m*q+d*j*r-c*l*r;b.n33=e*i*p-g*h*p+g*f*q-c*i*q-d*f*r+c*h*r;b.n34=g*h*j-d*i*j-g*f*l+c*i*l+d*f*m-c*h*m;b.n41=k*l*p-h*n*p-k*j*q+f*n*q+h*j*s-f*l*s;b.n42=d*n*p-e*l*p+e*j*q-c*n*q-d*j*s+c*l*s;b.n43=e*h*p-d*k*p-e*f*q+c*k*q+d*f*s-c*h*s;b.n44=d*k*j-e*h*j+e*f*l-c*k*l-d*f*n+c*h*n;b.multiplyScalar(1/a.determinant());return b};
 e*i*j-g*k*j+g*f*n-c*i*n-e*f*m+c*k*m;b.n31=h*m*p-i*l*p+i*j*q-f*m*q-h*j*r+f*l*r;b.n32=g*l*p-d*m*p-g*j*q+c*m*q+d*j*r-c*l*r;b.n33=e*i*p-g*h*p+g*f*q-c*i*q-d*f*r+c*h*r;b.n34=g*h*j-d*i*j-g*f*l+c*i*l+d*f*m-c*h*m;b.n41=k*l*p-h*n*p-k*j*q+f*n*q+h*j*s-f*l*s;b.n42=d*n*p-e*l*p+e*j*q-c*n*q-d*j*s+c*l*s;b.n43=e*h*p-d*k*p-e*f*q+c*k*q+d*f*s-c*h*s;b.n44=d*k*j-e*h*j+e*f*l-c*k*l-d*f*n+c*h*n;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*k;c[6]=a*i;c[7]=a*j;c[8]=a*l;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*k;c[6]=a*i;c[7]=a*j;c[8]=a*l;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,k,i;f=new THREE.Matrix4;h=b-a;k=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/k;f.n23=0;f.n24=-((c+d)/k);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,k,i;f=new THREE.Matrix4;h=b-a;k=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/k;f.n23=0;f.n24=-((c+d)/k);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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=
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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=
@@ -67,7 +67,7 @@ K.multiplyVector4(t.positionScreen),y=k[h-2],E.copy(t.positionScreen),F.copy(y.p
 L,r.x=v.x/v.w,r.y=v.y/v.w,r.z=v.z,r.rotation=u.rotation.z,r.scale.x=u.scale.x*Math.abs(r.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),r.scale.y=u.scale.y*Math.abs(r.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),r.materials=u.materials,D.push(r);g&&D.sort(b);return D}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 L,r.x=v.x/v.w,r.y=v.y/v.w,r.z=v.z,r.rotation=u.rotation.z,r.scale.x=u.scale.x*Math.abs(r.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),r.scale.y=u.scale.y*Math.abs(r.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),r.materials=u.materials,D.push(r);g&&D.sort(b);return D}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
-this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
+this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,k=this.w,i=k*c+f*e-h*d,j=k*d+h*c-g*e,l=k*e+g*d-f*c,c=-g*
 this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,k=this.w,i=k*c+f*e-h*d,j=k*d+h*c-g*e,l=k*e+g*d-f*c,c=-g*
 c-f*d-h*e;b.x=i*k+c*-g+j*-h-l*-f;b.y=j*k+c*-f+l*-g-i*-h;b.z=l*k+c*-h+i*-f-j*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 c-f*d-h*e;b.x=i*k+c*-g+j*-h-l*-f;b.y=j*k+c*-f+l*-g-i*-h;b.z=l*k+c*-h+i*-f-j*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};

+ 22 - 21
build/custom/ThreeExtras.js

@@ -1,5 +1,5 @@
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
-THREE.ColorUtils={adjustHSV:function(a,c,b,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+c,0,1);f.s=THREE.Math.clamp(f.s+b,0,1);f.v=THREE.Math.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,f=a.b,h=Math.max(Math.max(b,e),f),g=Math.min(Math.min(b,e),f);if(g==h)g=b=0;else{var k=h-g,g=k/h,b=b==h?(e-f)/k:e==h?2+(f-b)/k:4+(b-e)/k;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=g;c.v=h;return c}};
+THREE.ColorUtils={adjustHSV:function(a,c,b,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+c,0,1);f.s=THREE.Math.clamp(f.s+b,0,1);f.v=THREE.Math.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,f=a.b,h=Math.max(Math.max(b,e),f),g=Math.min(Math.min(b,e),f);if(g===h)g=b=0;else{var k=h-g,g=k/h,b=b===h?(e-f)/k:e===h?2+(f-b)/k:4+(b-e)/k;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=g;c.v=h;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
 THREE.GeometryUtils={merge:function(a,c){for(var b,e,f=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,g=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],o=h.faceVertexUvs[0],u={},t=0;t<a.materials.length;t++)u[a.materials[t].id]=t;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var t=0,z=k.length;t<z;t++){var v=new THREE.Vertex(k[t].position.clone());b&&b.multiplyVector3(v.position);g.push(v)}t=
 THREE.GeometryUtils={merge:function(a,c){for(var b,e,f=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,g=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],o=h.faceVertexUvs[0],u={},t=0;t<a.materials.length;t++)u[a.materials[t].id]=t;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var t=0,z=k.length;t<z;t++){var v=new THREE.Vertex(k[t].position.clone());b&&b.multiplyVector3(v.position);g.push(v)}t=
 0;for(z=m.length;t<z;t++){var g=m[t],p,y,x=g.vertexNormals,w=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));p.normal.copy(g.normal);e&&e.multiplyVector3(p.normal);k=0;for(v=x.length;k<v;k++)y=x[k].clone(),e&&e.multiplyVector3(y),p.vertexNormals.push(y);p.color.copy(g.color);k=0;for(v=w.length;k<v;k++)y=w[k],p.vertexColors.push(y.clone());if(g.materialIndex!==void 0){k=h.materials[g.materialIndex];
 0;for(z=m.length;t<z;t++){var g=m[t],p,y,x=g.vertexNormals,w=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));p.normal.copy(g.normal);e&&e.multiplyVector3(p.normal);k=0;for(v=x.length;k<v;k++)y=x[k].clone(),e&&e.multiplyVector3(y),p.vertexNormals.push(y);p.color.copy(g.color);k=0;for(v=w.length;k<v;k++)y=w[k],p.vertexColors.push(y.clone());if(g.materialIndex!==void 0){k=h.materials[g.materialIndex];
@@ -10,7 +10,7 @@ h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else
 g)<b?THREE.GeometryUtils.randomPointInTriangle(e,f,c):THREE.GeometryUtils.randomPointInTriangle(f,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(e,c){if(c<e)return e;var g=e+Math.floor((c-e)/2);return m[g]>a?b(e,g-1):m[g]<a?b(g+1,c):g}return b(0,m.length-1)}var e,f,h=a.faces,g=a.vertices,k=h.length,l=0,m=[],n,o,u,t;for(f=0;f<k;f++){e=h[f];if(e instanceof THREE.Face3)n=g[e.a].position,o=g[e.b].position,u=g[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,u);else if(e instanceof
 g)<b?THREE.GeometryUtils.randomPointInTriangle(e,f,c):THREE.GeometryUtils.randomPointInTriangle(f,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(e,c){if(c<e)return e;var g=e+Math.floor((c-e)/2);return m[g]>a?b(e,g-1):m[g]<a?b(g+1,c):g}return b(0,m.length-1)}var e,f,h=a.faces,g=a.vertices,k=h.length,l=0,m=[],n,o,u,t;for(f=0;f<k;f++){e=h[f];if(e instanceof THREE.Face3)n=g[e.a].position,o=g[e.b].position,u=g[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,u);else if(e instanceof
 THREE.Face4)n=g[e.a].position,o=g[e.b].position,u=g[e.c].position,t=g[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,t),e._area2=THREE.GeometryUtils.triangleArea(o,u,t),e._area=e._area1+e._area2;l+=e._area;m[f]=l}e=[];g={};for(f=0;f<c;f++)k=THREE.GeometryUtils.random()*l,k=b(k),e[f]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),g[k]?g[k]+=1:g[k]=1;return e},triangleArea:function(a,c,b){var e,f=THREE.GeometryUtils.__v1;f.sub(a,c);e=f.length();f.sub(a,b);a=f.length();f.sub(c,b);b=f.length();
 THREE.Face4)n=g[e.a].position,o=g[e.b].position,u=g[e.c].position,t=g[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,t),e._area2=THREE.GeometryUtils.triangleArea(o,u,t),e._area=e._area1+e._area2;l+=e._area;m[f]=l}e=[];g={};for(f=0;f<c;f++)k=THREE.GeometryUtils.random()*l,k=b(k),e[f]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),g[k]?g[k]+=1:g[k]=1;return e},triangleArea:function(a,c,b){var e,f=THREE.GeometryUtils.__v1;f.sub(a,c);e=f.length();f.sub(a,b);a=f.length();f.sub(c,b);b=f.length();
 c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
-THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,f=new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],h=new THREE.Texture(f,c),c=f.loadCount=0;for(e=a.length;c<e;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)h.needsUpdate=!0;b&&b(this)},f[c].crossOrigin="",f[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
+THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,f=new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],h=new THREE.Texture(f,c),c=f.loadCount=0;for(e=a.length;c<e;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount===6)h.needsUpdate=!0;b&&b(this)},f[c].crossOrigin="",f[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
 a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var g=h.getContext("2d");g.drawImage(a,0,0);for(var k=g.getImageData(0,0,e,f).data,l=g.createImageData(e,f),m=l.data,n=0;n<e;n++)for(var o=1;o<f;o++){var u=o-1<0?f-1:o-1,t=(o+1)%f,z=n-1<0?e-1:n-1,v=(n+1)%e,p=[],y=[0,0,k[(o*e+n)*4]/255*c];p.push([-1,0,k[(o*e+z)*4]/255*c]);p.push([-1,-1,k[(u*e+z)*4]/255*c]);p.push([0,-1,k[(u*e+n)*4]/255*c]);p.push([1,-1,k[(u*e+v)*4]/255*c]);
 a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var g=h.getContext("2d");g.drawImage(a,0,0);for(var k=g.getImageData(0,0,e,f).data,l=g.createImageData(e,f),m=l.data,n=0;n<e;n++)for(var o=1;o<f;o++){var u=o-1<0?f-1:o-1,t=(o+1)%f,z=n-1<0?e-1:n-1,v=(n+1)%e,p=[],y=[0,0,k[(o*e+n)*4]/255*c];p.push([-1,0,k[(o*e+z)*4]/255*c]);p.push([-1,-1,k[(u*e+z)*4]/255*c]);p.push([0,-1,k[(u*e+n)*4]/255*c]);p.push([1,-1,k[(u*e+v)*4]/255*c]);
 p.push([1,0,k[(o*e+v)*4]/255*c]);p.push([1,1,k[(t*e+v)*4]/255*c]);p.push([0,1,k[(t*e+n)*4]/255*c]);p.push([-1,1,k[(t*e+z)*4]/255*c]);u=[];z=p.length;for(t=0;t<z;t++){var v=p[t],x=p[(t+1)%z],v=[v[0]-y[0],v[1]-y[1],v[2]-y[2]],x=[x[0]-y[0],x[1]-y[1],x[2]-y[2]];u.push(b([v[1]*x[2]-v[2]*x[1],v[2]*x[0]-v[0]*x[2],v[0]*x[1]-v[1]*x[0]]))}p=[0,0,0];for(t=0;t<u.length;t++)p[0]+=u[t][0],p[1]+=u[t][1],p[2]+=u[t][2];p[0]/=u.length;p[1]/=u.length;p[2]/=u.length;y=(o*e+n)*4;m[y]=(p[0]+1)/2*255|0;m[y+1]=(p[1]+0.5)*
 p.push([1,0,k[(o*e+v)*4]/255*c]);p.push([1,1,k[(t*e+v)*4]/255*c]);p.push([0,1,k[(t*e+n)*4]/255*c]);p.push([-1,1,k[(t*e+z)*4]/255*c]);u=[];z=p.length;for(t=0;t<z;t++){var v=p[t],x=p[(t+1)%z],v=[v[0]-y[0],v[1]-y[1],v[2]-y[2]],x=[x[0]-y[0],x[1]-y[1],x[2]-y[2]];u.push(b([v[1]*x[2]-v[2]*x[1],v[2]*x[0]-v[0]*x[2],v[0]*x[1]-v[1]*x[0]]))}p=[0,0,0];for(t=0;t<u.length;t++)p[0]+=u[t][0],p[1]+=u[t][1],p[2]+=u[t][2];p[0]/=u.length;p[1]/=u.length;p[2]/=u.length;y=(o*e+n)*4;m[y]=(p[0]+1)/2*255|0;m[y+1]=(p[1]+0.5)*
 255|0;m[y+2]=p[2]*255|0;m[y+3]=255}g.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,f=a.children.length;for(e=0;e<f;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,f=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);f.add(h)}return f}};
 255|0;m[y+2]=p[2]*255|0;m[y+3]=255}g.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,f=a.children.length;for(e=0;e<f;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,f=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);f.add(h)}return f}};
@@ -82,7 +82,7 @@ THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","ro
 o)}l.prevKey[b]=g;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-g.time)/(k.time-g.time);f=g[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+t),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=f[0]+(h[0]-f[0])*e,b.y=f[1]+(h[1]-f[1])*e,b.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 o)}l.prevKey[b]=g;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-g.time)/(k.time-g.time);f=g[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+t),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=f[0]+(h[0]-f[0])*e,b.y=f[1]+(h[1]-f[1])*e,b.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",t,g.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),b.x=f[0],b.y=f[1],b.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
 this.getPrevKeyWith("pos",t,g.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),b.x=f[0],b.y=f[1],b.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
 "rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=f[0]+(h[0]-f[0])*e,b.y=f[1]+(h[1]-f[1])*e,b.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;t<this.hierarchy.length;t++)n[t][m]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
 "rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=f[0]+(h[0]-f[0])*e,b.y=f[1]+(h[1]-f[1])*e,b.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;t<this.hierarchy.length;t++)n[t][m]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,h,g,k,l,m;f=(a.length-1)*c;h=Math.floor(f);f-=h;b[0]=h==0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];l=a[b[2]];m=a[b[3]];b=f*f;g=f*b;e[0]=this.interpolate(h[0],k[0],l[0],m[0],f,b,g);e[1]=this.interpolate(h[1],k[1],l[1],m[1],f,b,g);e[2]=this.interpolate(h[2],k[2],l[2],m[2],f,b,g);return e};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,h,g,k,l,m;f=(a.length-1)*c;h=Math.floor(f);f-=h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];l=a[b[2]];m=a[b[3]];b=f*f;g=f*b;e[0]=this.interpolate(h[0],k[0],l[0],m[0],f,b,g);e[1]=this.interpolate(h[1],k[1],l[1],m[1],f,b,g);e[2]=this.interpolate(h[2],k[2],l[2],m[2],f,b,g);return e};
 THREE.Animation.prototype.interpolate=function(a,c,b,e,f,h,g){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*g+(-3*(c-b)-2*a-e)*h+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.interpolate=function(a,c,b,e,f,h,g){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*g+(-3*(c-b)-2*a-e)*h+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=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+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=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+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
 THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
@@ -135,22 +135,22 @@ this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();
 (f===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();a.stopPropagation();if(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?g=k=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?l=m=this.getMouseOnScreen(a.clientX,
 (f===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();a.stopPropagation();if(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?g=k=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?l=m=this.getMouseOnScreen(a.clientX,
 a.clientY):this.noPan||(n=o=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",b(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!==
 a.clientY):this.noPan||(n=o=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",b(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&&(e=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
 this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(a,c,b,e,f,h,g,k){function l(a,b,c,g,k,l,o,n){var p,t,u=e||1,v=f||1,z=k/2,x=l/2,w=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",v=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")p="x",u=h||1;var y=u+1,O=v+1;k/=u;var R=l/v;for(t=0;t<O;t++)for(l=0;l<y;l++){var U=new THREE.Vector3;U[a]=(l*k-z)*c;U[b]=(t*R-x)*g;U[p]=o;m.vertices.push(new THREE.Vertex(U))}for(t=0;t<v;t++)for(l=0;l<u;l++)m.faces.push(new THREE.Face4(l+y*t+w,
-l+y*(t+1)+w,l+1+y*(t+1)+w,l+1+y*t+w,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/u,t/v),new THREE.UV(l/u,(t+1)/v),new THREE.UV((l+1)/u,(t+1)/v),new THREE.UV((l+1)/u,t/v)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,u=b/2,t,z,v,p,y,x;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(t=0;t<6;t++)this.materials.push(g)}t=0;p=1;z=2;y=3;v=4;x=5}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]!=
+THREE.CubeGeometry=function(a,c,b,e,f,h,g,k){function l(a,b,c,g,k,l,o,n){var p,t,u=e||1,v=f||1,z=k/2,x=l/2,w=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",v=h||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")p="x",u=h||1;var y=u+1,O=v+1;k/=u;var R=l/v;for(t=0;t<O;t++)for(l=0;l<y;l++){var U=new THREE.Vector3;U[a]=(l*k-z)*c;U[b]=(t*R-x)*g;U[p]=o;m.vertices.push(new THREE.Vertex(U))}for(t=0;t<v;t++)for(l=0;l<u;l++)m.faces.push(new THREE.Face4(l+
+y*t+w,l+y*(t+1)+w,l+1+y*(t+1)+w,l+1+y*t+w,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(l/u,t/v),new THREE.UV(l/u,(t+1)/v),new THREE.UV((l+1)/u,(t+1)/v),new THREE.UV((l+1)/u,t/v)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,u=b/2,t,z,v,p,y,x;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(t=0;t<6;t++)this.materials.push(g)}t=0;p=1;z=2;y=3;v=4;x=5}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,-1,b,c,n,t);this.sides.nx&&l("z","y",1,-1,b,c,-n,p);this.sides.py&&l("x","z",1,1,a,b,o,z);this.sides.ny&&l("x","z",1,-1,a,b,-o,y);this.sides.pz&&l("x","y",1,-1,a,c,u,v);this.sides.nz&&l("x","y",-1,-1,a,c,-u,x);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 void 0&&(this.sides[w]=k[w]);this.sides.px&&l("z","y",-1,-1,b,c,n,t);this.sides.nx&&l("z","y",1,-1,b,c,-n,p);this.sides.py&&l("x","z",1,1,a,b,o,z);this.sides.ny&&l("x","z",1,-1,a,b,-o,y);this.sides.pz&&l("x","y",1,-1,a,c,u,v);this.sides.nz&&l("x","y",-1,-1,a,c,-u,x);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(a,c,b,e,f,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,g=b/2,e=e||8,f=f||1,k,l,m=[],n=[];for(l=0;l<=f;l++){var o=[],u=[],t=l/f,z=t*(c-a)+a;for(k=0;k<=e;k++){var v=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(v*Math.PI*2),-t*b+g,z*Math.cos(v*Math.PI*2))));o.push(this.vertices.length-1);u.push(new THREE.UV(v,t))}m.push(o);n.push(u)}for(l=0;l<f;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],u=m[l+1][k+1],t=m[l][k+1],z=
 THREE.CylinderGeometry=function(a,c,b,e,f,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,g=b/2,e=e||8,f=f||1,k,l,m=[],n=[];for(l=0;l<=f;l++){var o=[],u=[],t=l/f,z=t*(c-a)+a;for(k=0;k<=e;k++){var v=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(v*Math.PI*2),-t*b+g,z*Math.cos(v*Math.PI*2))));o.push(this.vertices.length-1);u.push(new THREE.UV(v,t))}m.push(o);n.push(u)}for(l=0;l<f;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],u=m[l+1][k+1],t=m[l][k+1],z=
 this.vertices[b].position.clone().setY(0).normalize(),v=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[u].position.clone().setY(0).normalize(),y=this.vertices[t].position.clone().setY(0).normalize(),x=n[l][k].clone(),w=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,u,t,[z,v,p,y]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
 this.vertices[b].position.clone().setY(0).normalize(),v=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[u].position.clone().setY(0).normalize(),y=this.vertices[t].position.clone().setY(0).normalize(),x=n[l][k].clone(),w=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,u,t,[z,v,p,y]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
 1],u=this.vertices.length-1,z=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),x=n[0][k].clone(),w=n[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(b,o,u,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(k=0;k<e;k++)b=m[l][k+1],o=m[l][k],u=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),x=n[l][k+1].clone(),w=n[l][k].clone(),
 1],u=this.vertices.length-1,z=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),x=n[0][k].clone(),w=n[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(b,o,u,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(k=0;k<e;k++)b=m[l][k+1],o=m[l][k],u=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),x=n[l][k+1].clone(),w=n[l][k].clone(),
 A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(b,o,u,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(b,o,u,[z,v,p])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
-THREE.ExtrudeGeometry=function(a,c){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)f=a[b],this.addShape(f,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)f=a[b],this.addShape(f,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);g.set(a.x-c.x,a.y-c.y);e=e.normalize();g=g.normalize();h.set(-e.y,e.x);f.set(g.y,-g.x);k.copy(a).addSelf(h);l.copy(a).addSelf(f);if(k.equals(l))return f.clone();
 THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);g.set(a.x-c.x,a.y-c.y);e=e.normalize();g=g.normalize();h.set(-e.y,e.x);f.set(g.y,-g.x);k.copy(a).addSelf(h);l.copy(a).addSelf(f);if(k.equals(l))return f.clone();
-k.copy(b).addSelf(h);l.copy(c).addSelf(f);h=e.dot(f);f=l.subSelf(k).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(k).subSelf(a).clone()}function f(a){for(C=a.length;--C>=0;){S=C;T=C-1;T<0&&(T=a.length-
+k.copy(b).addSelf(h);l.copy(c).addSelf(f);h=e.dot(f);f=l.subSelf(k).dot(f);h===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(k).subSelf(a).clone()}function f(a){for(C=a.length;--C>=0;){S=C;T=C-1;T<0&&(T=a.length-
 1);for(var b=0,c=t+n*2,b=0;b<c;b++){var e=P*b,g=P*(b+1),h=X+S+e,f=X+S+g,m=h,e=X+T+e,g=X+T+g,o=f;m+=L;e+=L;g+=L;o+=L;G.faces.push(new THREE.Face4(m,e,g,o,null,null,A));A&&(m=b/c,e=(b+1)/c,g=k+l*2,h=(G.vertices[h].position.z+l)/g,f=(G.vertices[f].position.z+l)/g,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=L;b+=L;c+=L;G.faces.push(new THREE.Face3(a,
 1);for(var b=0,c=t+n*2,b=0;b<c;b++){var e=P*b,g=P*(b+1),h=X+S+e,f=X+S+g,m=h,e=X+T+e,g=X+T+g,o=f;m+=L;e+=L;g+=L;o+=L;G.faces.push(new THREE.Face4(m,e,g,o,null,null,A));A&&(m=b/c,e=(b+1)/c,g=k+l*2,h=(G.vertices[h].position.z+l)/g,f=(G.vertices[f].position.z+l)/g,G.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=L;b+=L;c+=L;G.faces.push(new THREE.Face3(a,
 b,c,null,null,w));if(w){var e=D.maxY,g=D.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,f=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/g,G.vertices[a].position.y/e),new THREE.UV(h/g,b/e),new THREE.UV(f/g,c/e)])}}var k=c.amount!==void 0?c.amount:100,l=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:l-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
 b,c,null,null,w));if(w){var e=D.maxY,g=D.maxX,h=G.vertices[b].position.x,b=G.vertices[b].position.y,f=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/g,G.vertices[a].position.y/e),new THREE.UV(h/g,b/e),new THREE.UV(f/g,c/e)])}}var k=c.amount!==void 0?c.amount:100,l=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:l-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
 !0,u=c.curveSegments!==void 0?c.curveSegments:12,t=c.steps!==void 0?c.steps:1,z=c.bendPath,v=c.extrudePath,p,y=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,w=c.material,A=c.extrudeMaterial,D=this.shapebb;if(v)p=v.getPoints(u),t=p.length,y=!0,o=!1;o||(m=l=n=0);var B,E,I,G=this,L=this.vertices.length;z&&a.addWrapPath(z);u=x?a.extractAllSpacedPoints(u):a.extractAllPoints(u);z=u.shape;u=u.holes;if(v=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();E=0;for(I=u.length;E<I;E++)B=u[E],THREE.Shape.Utils.isClockWise(B)&&
 !0,u=c.curveSegments!==void 0?c.curveSegments:12,t=c.steps!==void 0?c.steps:1,z=c.bendPath,v=c.extrudePath,p,y=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,w=c.material,A=c.extrudeMaterial,D=this.shapebb;if(v)p=v.getPoints(u),t=p.length,y=!0,o=!1;o||(m=l=n=0);var B,E,I,G=this,L=this.vertices.length;z&&a.addWrapPath(z);u=x?a.extractAllSpacedPoints(u):a.extractAllPoints(u);z=u.shape;u=u.holes;if(v=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();E=0;for(I=u.length;E<I;E++)B=u[E],THREE.Shape.Utils.isClockWise(B)&&
-(u[E]=B.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(z,u);x=z;E=0;for(I=u.length;E<I;E++)B=u[E],z=z.concat(B);var C,F,J,M,N,K,P=z.length,H=v.length,Q=[];C=0;F=x.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S==F&&(S=0),T==F&&(T=0),Q[C]=e(x[C],x[S],x[T]);var O=[],R,U=Q.concat();E=0;for(I=u.length;E<I;E++){B=u[E];R=[];C=0;F=B.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S==F&&(S=0),T==F&&(T=0),R[C]=e(B[C],B[S],B[T]);O.push(R);U=U.concat(R)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=
-x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,-N);E=0;for(I=u.length;E<I;E++){B=u[E];R=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),h(K.x,K.y,-N)}}M=m;for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[0].y,p[0].x):h(K.x,K.y,0);for(J=1;J<=t;J++)for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[J-1].y,p[J-1].x):h(K.x,K.y,k/t*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,k+N);E=0;for(I=u.length;E<I;E++){B=u[E];R=O[E];
-C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),y?h(K.x,K.y+p[t-1].y,p[t-1].x+N):h(K.x,K.y,k+N)}}if(o){o=P*0;for(C=0;C<H;C++)m=v[C],g(m[2]+o,m[1]+o,m[0]+o);o=P*(t+n*2);for(C=0;C<H;C++)m=v[C],g(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<H;C++)m=v[C],g(m[2],m[1],m[0]);for(C=0;C<H;C++)m=v[C],g(m[0]+P*t,m[1]+P*t,m[2]+P*t)}var S,T,X=0;f(x);X+=x.length;E=0;for(I=u.length;E<I;E++)B=u[E],f(B),X+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+(u[E]=B.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(z,u);x=z;E=0;for(I=u.length;E<I;E++)B=u[E],z=z.concat(B);var C,F,J,M,N,K,P=z.length,H=v.length,Q=[];C=0;F=x.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S===F&&(S=0),T===F&&(T=0),Q[C]=e(x[C],x[S],x[T]);var O=[],R,U=Q.concat();E=0;for(I=u.length;E<I;E++){B=u[E];R=[];C=0;F=B.length;S=F-1;for(T=C+1;C<F;C++,S++,T++)S===F&&(S=0),T===F&&(T=0),R[C]=e(B[C],B[S],B[T]);O.push(R);U=U.concat(R)}for(J=0;J<n;J++){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=
+0;for(F=x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,-N);E=0;for(I=u.length;E<I;E++){B=u[E];R=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),h(K.x,K.y,-N)}}M=m;for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[0].y,p[0].x):h(K.x,K.y,0);for(J=1;J<=t;J++)for(C=0;C<P;C++)K=o?b(z[C],U[C],M):z[C],y?h(K.x,K.y+p[J-1].y,p[J-1].x):h(K.x,K.y,k/t*J);for(J=n-1;J>=0;J--){M=J/n;N=l*(1-M);M=m*Math.sin(M*Math.PI/2);C=0;for(F=x.length;C<F;C++)K=b(x[C],Q[C],M),h(K.x,K.y,k+N);E=0;for(I=u.length;E<I;E++){B=u[E];
+R=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],R[C],M),y?h(K.x,K.y+p[t-1].y,p[t-1].x+N):h(K.x,K.y,k+N)}}if(o){o=P*0;for(C=0;C<H;C++)m=v[C],g(m[2]+o,m[1]+o,m[0]+o);o=P*(t+n*2);for(C=0;C<H;C++)m=v[C],g(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<H;C++)m=v[C],g(m[2],m[1],m[0]);for(C=0;C<H;C++)m=v[C],g(m[0]+P*t,m[1]+P*t,m[2]+P*t)}var S,T,X=0;f(x);X+=x.length;E=0;for(I=u.length;E<I;E++)B=u[E],f(B),X+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=f.vertices[a].position,g=f.vertices[b].position;return c((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,h=new THREE.Geometry;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,
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=f.vertices[a].position,g=f.vertices[b].position;return c((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,h=new THREE.Geometry;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,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var g=0;g<this.subdivisions;g++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
 -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,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var g=0;g<this.subdivisions;g++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
@@ -301,17 +301,18 @@ THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.verti
 b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 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=
 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,f){return a+(c-a)*f};this.VIntX=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k+g*this.delta;c[h+1]=l;c[h+2]=m;f[h]=this.lerp(n[a],n[a+3],g);f[h+1]=this.lerp(n[a+1],n[a+4],g);f[h+2]=this.lerp(n[a+2],n[a+5],g)};this.VIntY=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l+g*this.delta;c[h+
 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,f){return a+(c-a)*f};this.VIntX=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k+g*this.delta;c[h+1]=l;c[h+2]=m;f[h]=this.lerp(n[a],n[a+3],g);f[h+1]=this.lerp(n[a+1],n[a+4],g);f[h+2]=this.lerp(n[a+2],n[a+5],g)};this.VIntY=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l+g*this.delta;c[h+
-2]=m;c=a+this.yd*3;f[h]=this.lerp(n[a],n[c],g);f[h+1]=this.lerp(n[a+1],n[c+1],g);f[h+2]=this.lerp(n[a+2],n[c+2],g)};this.VIntZ=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l;c[h+2]=m+g*this.delta;c=a+this.zd*3;f[h]=this.lerp(n[a],n[c],g);f[h+1]=this.lerp(n[a+1],n[c+1],g);f[h+2]=this.lerp(n[a+2],n[c+2],g)};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,f,h,g,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,u=l+this.zd,t=h+this.yd+this.zd,z=l+this.yd+this.zd,v=0,p=this.field[h],y=this.field[l],x=this.field[m],w=this.field[o],A=this.field[n],D=this.field[u],B=this.field[t],E=this.field[z];p<g&&(v|=1);y<g&&(v|=2);x<g&&(v|=8);w<g&&(v|=4);A<g&&(v|=16);D<g&&(v|=32);B<g&&(v|=128);E<g&&(v|=64);var I=THREE.edgeTable[v];if(I==0)return 0;var G=this.delta,
-L=a+G,C=c+G,G=f+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,c,f,p,y));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,g,L,c,f,y,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,g,a,C,f,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,c,f,p,x));I&16&&(this.compNorm(n),this.compNorm(u),this.VIntX(n*3,this.vlist,this.nlist,12,g,a,c,G,A,D));I&32&&(this.compNorm(u),
-this.compNorm(z),this.VIntY(u*3,this.vlist,this.nlist,15,g,L,c,G,D,E));I&64&&(this.compNorm(t),this.compNorm(z),this.VIntX(t*3,this.vlist,this.nlist,18,g,a,C,G,B,E));I&128&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,21,g,a,c,G,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,c,f,p,A));I&512&&(this.compNorm(l),this.compNorm(u),this.VIntZ(l*3,this.vlist,this.nlist,27,g,L,c,f,y,D));I&1024&&(this.compNorm(o),this.compNorm(z),this.VIntZ(o*
-3,this.vlist,this.nlist,30,g,L,C,f,w,E));I&2048&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,33,g,a,C,f,x,B));v<<=4;for(g=h=0;THREE.triTable[v+g]!=-1;)a=v+g,c=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[f],k),g+=3,h++;return h};this.posnormtriv=function(a,c,f,h,g,k){var l=this.count*3;this.positionArray[l]=a[f];this.positionArray[l+1]=a[f+1];this.positionArray[l+2]=a[f+2];this.positionArray[l+3]=a[h];this.positionArray[l+
-4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[g];this.positionArray[l+7]=a[g+1];this.positionArray[l+8]=a[g+2];this.normalArray[l]=c[f];this.normalArray[l+1]=c[f+1];this.normalArray[l+2]=c[f+2];this.normalArray[l+3]=c[h];this.normalArray[l+4]=c[h+1];this.normalArray[l+5]=c[h+2];this.normalArray[l+6]=c[g];this.normalArray[l+7]=c[g+1];this.normalArray[l+8]=c[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(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,f,h,g){var k=this.size*Math.sqrt(h/g),l=f*this.size,m=c*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(n-k);t<1&&(t=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
-1);for(var z,v,p,y,x,w;o<l;o++){n=this.size2*o;v=o/this.size-f;x=v*v;for(v=u;v<m;v++){p=n+this.size*v;z=v/this.size-c;w=z*z;for(z=t;z<k;z++)y=z/this.size-a,y=h/(1.0E-6+y*y+w+x)-g,y>0&&(this.field[p+z]+=y)}}};this.addPlaneX=function(a,c){var f,h,g,k,l,m=this.size,n=this.yd,o=this.zd,u=this.field,t=m*Math.sqrt(a/c);t>m&&(t=m);for(f=0;f<t;f++)if(h=f/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=f+h*n;for(g=0;g<m;g++)u[o*g+l]+=k}};this.addPlaneY=function(a,c){var f,h,g,k,l,m,n=this.size,o=this.yd,u=
-this.zd,t=this.field,z=n*Math.sqrt(a/c);z>n&&(z=n);for(h=0;h<z;h++)if(f=h/n,f*=f,k=a/(1.0E-4+f)-c,k>0){l=h*o;for(f=0;f<n;f++){m=l+f;for(g=0;g<n;g++)t[u*g+m]+=k}}};this.addPlaneZ=function(a,c){var f,h,g,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(g=0;g<dist;g++)if(f=g/size,f*=f,k=a/(1.0E-4+f)-c,k>0){l=zd*g;for(h=0;h<size;h++){m=l+h*yd;for(f=0;f<size;f++)field[m+f]+=k}}};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,f,h,g,k,l,m,n,o,u=this.size-2;for(g=1;g<u;g++){o=this.size2*g;m=(g-this.halfsize)/this.halfsize;for(h=1;h<u;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(f=1;f<u;f++)k=(f-this.halfsize)/this.halfsize,c=n+f,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,f=[];this.render(function(h){var g,k,l,m,n,o,u,t;for(g=0;g<h.count;g++)u=g*3,n=u+1,t=u+2,k=h.positionArray[u],
-l=h.positionArray[n],m=h.positionArray[t],o=new THREE.Vector3(k,l,m),k=h.normalArray[u],l=h.normalArray[n],m=h.normalArray[t],u=new THREE.Vector3(k,l,m),u.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),f.push(u);nfaces=h.count/3;for(g=0;g<nfaces;g++)u=(a+g)*3,n=u+1,t=u+2,o=f[u],k=f[n],l=f[t],u=new THREE.Face3(u,n,t,[o,k,l]),c.faces.push(u);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+2]=m;c=a+this.yd*3;f[h]=this.lerp(n[a],n[c],g);f[h+1]=this.lerp(n[a+1],n[c+1],g);f[h+2]=this.lerp(n[a+2],n[c+2],g)};this.VIntZ=function(a,c,f,h,g,k,l,m,n,o){g=(g-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l;c[h+2]=m+g*this.delta;c=a+this.zd*3;f[h]=this.lerp(n[a],n[c],g);f[h+1]=this.lerp(n[a+1],n[c+1],g);f[h+2]=this.lerp(n[a+2],n[c+2],g)};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,f,h,g,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,u=l+this.zd,t=h+this.yd+this.zd,z=l+this.yd+this.zd,v=0,p=this.field[h],y=this.field[l],x=this.field[m],w=this.field[o],A=this.field[n],D=this.field[u],B=this.field[t],E=this.field[z];p<g&&(v|=1);y<g&&(v|=2);x<g&&(v|=8);w<g&&(v|=4);A<g&&(v|=16);D<g&&(v|=32);B<g&&(v|=128);E<g&&(v|=64);var I=THREE.edgeTable[v];if(I===0)return 0;
+var G=this.delta,L=a+G,C=c+G,G=f+G;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,c,f,p,y));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,g,L,c,f,y,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,g,a,C,f,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,c,f,p,x));I&16&&(this.compNorm(n),this.compNorm(u),this.VIntX(n*3,this.vlist,this.nlist,12,g,a,c,G,A,D));
+I&32&&(this.compNorm(u),this.compNorm(z),this.VIntY(u*3,this.vlist,this.nlist,15,g,L,c,G,D,E));I&64&&(this.compNorm(t),this.compNorm(z),this.VIntX(t*3,this.vlist,this.nlist,18,g,a,C,G,B,E));I&128&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,21,g,a,c,G,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,c,f,p,A));I&512&&(this.compNorm(l),this.compNorm(u),this.VIntZ(l*3,this.vlist,this.nlist,27,g,L,c,f,y,D));I&1024&&(this.compNorm(o),
+this.compNorm(z),this.VIntZ(o*3,this.vlist,this.nlist,30,g,L,C,f,w,E));I&2048&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,33,g,a,C,f,x,B));v<<=4;for(g=h=0;THREE.triTable[v+g]!=-1;)a=v+g,c=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[f],k),g+=3,h++;return h};this.posnormtriv=function(a,c,f,h,g,k){var l=this.count*3;this.positionArray[l]=a[f];this.positionArray[l+1]=a[f+1];this.positionArray[l+2]=a[f+2];this.positionArray[l+
+3]=a[h];this.positionArray[l+4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[g];this.positionArray[l+7]=a[g+1];this.positionArray[l+8]=a[g+2];this.normalArray[l]=c[f];this.normalArray[l+1]=c[f+1];this.normalArray[l+2]=c[f+2];this.normalArray[l+3]=c[h];this.normalArray[l+4]=c[h+1];this.normalArray[l+5]=c[h+2];this.normalArray[l+6]=c[g];this.normalArray[l+7]=c[g+1];this.normalArray[l+8]=c[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(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,f,h,g){var k=this.size*Math.sqrt(h/g),l=f*this.size,m=c*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(n-k);t<1&&(t=1);k=Math.floor(n+k);
+k>this.size-1&&(k=this.size-1);for(var z,v,p,y,x,w;o<l;o++){n=this.size2*o;v=o/this.size-f;x=v*v;for(v=u;v<m;v++){p=n+this.size*v;z=v/this.size-c;w=z*z;for(z=t;z<k;z++)y=z/this.size-a,y=h/(1.0E-6+y*y+w+x)-g,y>0&&(this.field[p+z]+=y)}}};this.addPlaneX=function(a,c){var f,h,g,k,l,m=this.size,n=this.yd,o=this.zd,u=this.field,t=m*Math.sqrt(a/c);t>m&&(t=m);for(f=0;f<t;f++)if(h=f/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=f+h*n;for(g=0;g<m;g++)u[o*g+l]+=k}};this.addPlaneY=function(a,c){var f,h,g,k,
+l,m,n=this.size,o=this.yd,u=this.zd,t=this.field,z=n*Math.sqrt(a/c);z>n&&(z=n);for(h=0;h<z;h++)if(f=h/n,f*=f,k=a/(1.0E-4+f)-c,k>0){l=h*o;for(f=0;f<n;f++){m=l+f;for(g=0;g<n;g++)t[u*g+m]+=k}}};this.addPlaneZ=function(a,c){var f,h,g,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(g=0;g<dist;g++)if(f=g/size,f*=f,k=a/(1.0E-4+f)-c,k>0){l=zd*g;for(h=0;h<size;h++){m=l+h*yd;for(f=0;f<size;f++)field[m+f]+=k}}};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,f,h,g,k,l,m,n,o,u=this.size-2;for(g=1;g<u;g++){o=this.size2*g;m=(g-this.halfsize)/this.halfsize;for(h=1;h<u;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(f=1;f<u;f++)k=(f-this.halfsize)/this.halfsize,c=n+f,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,f=[];this.render(function(h){var g,k,l,m,n,o,u,t;for(g=0;g<h.count;g++)u=
+g*3,n=u+1,t=u+2,k=h.positionArray[u],l=h.positionArray[n],m=h.positionArray[t],o=new THREE.Vector3(k,l,m),k=h.normalArray[u],l=h.normalArray[n],m=h.normalArray[t],u=new THREE.Vector3(k,l,m),u.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),f.push(u);nfaces=h.count/3;for(g=0;g<nfaces;g++)u=(a+g)*3,n=u+1,t=u+2,o=f[u],k=f[n],l=f[t],u=new THREE.Face3(u,n,t,[o,k,l]),c.faces.push(u);a+=nfaces;h.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]);

+ 8 - 8
build/custom/ThreeSVG.js

@@ -1,11 +1,11 @@
 // ThreeSVG.js r46dev - http://github.com/mrdoob/three.js
 // ThreeSVG.js r46dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,e;if(c==0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),f=a*6-d,a=c*(1-b),e=c*(1-
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,e;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),f=a*6-d,a=c*(1-b),e=c*(1-
 b*f),b=c*(1-b*(1-f)),d){case 1:this.r=e;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=e;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=e;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 b*f),b=c*(1-b*(1-f)),d){case 1:this.r=e;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=e;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=e;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
-equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
+equals:function(a){return a.x===this.x&&a.y===this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
 addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
 addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
 divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
@@ -15,8 +15,8 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
-c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}for(var d,f=[],e=0,g=a.children.length;e<g;e++)Array.prototype.push.apply(f,this.intersectObject(a.children[e]));if(a instanceof THREE.Particle){e=b(this.origin,this.direction,a.matrixWorld.getPosition());if(e==null||e>a.scale.x)return[];d={distance:e,point:a.position,face:null,object:a};f.push(d)}else if(a instanceof THREE.Mesh){e=b(this.origin,
-this.direction,a.matrixWorld.getPosition());if(e==null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var i,k,h,j,m,n,l,p,q=a.geometry,v=q.vertices,e=0,g=q.faces.length;e<g;e++)if(d=q.faces[e],l=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,i=j.multiplyVector3(d.centroid.clone()).subSelf(l),n=i.dot(p),!(n<=0)&&(i=j.multiplyVector3(v[d.a].position.clone()),k=j.multiplyVector3(v[d.b].position.clone()),h=j.multiplyVector3(v[d.c].position.clone()),
+c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}for(var d,f=[],e=0,g=a.children.length;e<g;e++)Array.prototype.push.apply(f,this.intersectObject(a.children[e]));if(a instanceof THREE.Particle){e=b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.scale.x)return[];d={distance:e,point:a.position,face:null,object:a};f.push(d)}else if(a instanceof THREE.Mesh){e=
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var i,k,h,j,m,n,l,p,q=a.geometry,v=q.vertices,e=0,g=q.faces.length;e<g;e++)if(d=q.faces[e],l=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,i=j.multiplyVector3(d.centroid.clone()).subSelf(l),n=i.dot(p),!(n<=0)&&(i=j.multiplyVector3(v[d.a].position.clone()),k=j.multiplyVector3(v[d.b].position.clone()),h=j.multiplyVector3(v[d.c].position.clone()),
 j=d instanceof THREE.Face4?j.multiplyVector3(v[d.d].position.clone()):null,m=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=p.dot(m),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=m.dot((new THREE.Vector3).sub(i,l))/n,l=l.addSelf(p.multiplyScalar(n)),d instanceof THREE.Face3)c(l,i,k,h)&&(d={distance:this.origin.distanceTo(l),point:l,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(l,i,k,j)||c(l,k,h,j)))d={distance:this.origin.distanceTo(l),point:l,face:d,object:a},f.push(d)}return f}};
 j=d instanceof THREE.Face4?j.multiplyVector3(v[d.d].position.clone()):null,m=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=p.dot(m),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=m.dot((new THREE.Vector3).sub(i,l))/n,l=l.addSelf(p.multiplyScalar(n)),d instanceof THREE.Face3)c(l,i,k,h)&&(d={distance:this.origin.distanceTo(l),point:l,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(l,i,k,j)||c(l,k,h,j)))d={distance:this.origin.distanceTo(l),point:l,face:d,object:a},f.push(d)}return f}};
 THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,j,m){i=!1;b=e;c=g;d=j;f=m;a()};this.addPoint=function(e,g){i?(i=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
 THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,j,m){i=!1;b=e;c=g;d=j;f=m;a()};this.addPoint=function(e,g){i?(i=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
 function(e,g,j,m,n,l){i?(i=!1,b=e<j?e<n?e:n:j<n?j:n,c=g<m?g<l?g:l:m<l?m:l,d=e>j?e>n?e:n:j>n?j:n,f=g>m?g>l?g:l:m>l?m:l):(b=e<j?e<n?e<b?e:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<m?g<l?g<c?g:c:l<c?l:c:m<l?m<c?m:c:l<c?l:c,d=e>j?e>n?e>d?e:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,f=g>m?g>l?g>f?g:f:l>f?l:f:m>l?m>f?m:f:l>f?l:f);a()};this.addRectangle=function(e){i?(i=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
 function(e,g,j,m,n,l){i?(i=!1,b=e<j?e<n?e:n:j<n?j:n,c=g<m?g<l?g:l:m<l?m:l,d=e>j?e>n?e:n:j>n?j:n,f=g>m?g>l?g:l:m>l?m:l):(b=e<j?e<n?e<b?e:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<m?g<l?g<c?g:c:l<c?l:c:m<l?m<c?m:c:l<c?l:c,d=e>j?e>n?e>d?e:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,f=g>m?g>l?g>f?g:f:l>f?l:f:m>l?m>f?m:f:l>f?l:f);a()};this.addRectangle=function(e){i?(i=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
@@ -44,7 +44,7 @@ c.y=f.length();c.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Mat
 a.n23*f;this.n33=a.n33*f}};
 a.n23*f;this.n33=a.n33*f}};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,i=a.n22,k=a.n23,h=a.n24,j=a.n31,m=a.n32,n=a.n33,l=a.n34,p=a.n41,q=a.n42,v=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*l*q-h*n*q+h*m*v-i*l*v-k*m*u+i*n*u;b.n12=e*n*q-f*l*q-e*m*v+d*l*v+f*m*u-d*n*u;b.n13=f*h*q-e*k*q+e*i*v-d*h*v-f*i*u+d*k*u;b.n14=e*k*m-f*h*m-e*i*n+d*h*n+f*i*l-d*k*l;b.n21=h*n*p-k*l*p-h*j*v+g*l*v+k*j*u-g*n*u;b.n22=f*l*p-e*n*p+e*j*v-c*l*v-f*j*u+c*n*u;b.n23=e*k*p-f*h*p-e*g*v+c*h*v+f*g*u-c*k*u;b.n24=
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,i=a.n22,k=a.n23,h=a.n24,j=a.n31,m=a.n32,n=a.n33,l=a.n34,p=a.n41,q=a.n42,v=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*l*q-h*n*q+h*m*v-i*l*v-k*m*u+i*n*u;b.n12=e*n*q-f*l*q-e*m*v+d*l*v+f*m*u-d*n*u;b.n13=f*h*q-e*k*q+e*i*v-d*h*v-f*i*u+d*k*u;b.n14=e*k*m-f*h*m-e*i*n+d*h*n+f*i*l-d*k*l;b.n21=h*n*p-k*l*p-h*j*v+g*l*v+k*j*u-g*n*u;b.n22=f*l*p-e*n*p+e*j*v-c*l*v-f*j*u+c*n*u;b.n23=e*k*p-f*h*p-e*g*v+c*h*v+f*g*u-c*k*u;b.n24=
 f*h*j-e*k*j+e*g*n-c*h*n-f*g*l+c*k*l;b.n31=i*l*p-h*m*p+h*j*q-g*l*q-i*j*u+g*m*u;b.n32=e*m*p-d*l*p-e*j*q+c*l*q+d*j*u-c*m*u;b.n33=f*h*p-e*i*p+e*g*q-c*h*q-d*g*u+c*i*u;b.n34=e*i*j-d*h*j-e*g*m+c*h*m+d*g*l-c*i*l;b.n41=k*m*p-i*n*p-k*j*q+g*n*q+i*j*v-g*m*v;b.n42=d*n*p-f*m*p+f*j*q-c*n*q-d*j*v+c*m*v;b.n43=f*i*p-d*k*p-f*g*q+c*k*q+d*g*v-c*i*v;b.n44=d*k*j-f*i*j+f*g*m-c*k*m-d*g*n+c*i*n;b.multiplyScalar(1/a.determinant());return b};
 f*h*j-e*k*j+e*g*n-c*h*n-f*g*l+c*k*l;b.n31=i*l*p-h*m*p+h*j*q-g*l*q-i*j*u+g*m*u;b.n32=e*m*p-d*l*p-e*j*q+c*l*q+d*j*u-c*m*u;b.n33=f*h*p-e*i*p+e*g*q-c*h*q-d*g*u+c*i*u;b.n34=e*i*j-d*h*j-e*g*m+c*h*m+d*g*l-c*i*l;b.n41=k*m*p-i*n*p-k*j*q+g*n*q+i*j*v-g*m*v;b.n42=d*n*p-f*m*p+f*j*q-c*n*q-d*j*v+c*m*v;b.n43=f*i*p-d*k*p-f*g*q+c*k*q+d*g*v-c*i*v;b.n44=d*k*j-f*i*j+f*g*m-c*k*m-d*g*n+c*i*n;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,h=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*h;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*i;c[5]=a*k;c[6]=a*h;c[7]=a*j;c[8]=a*m;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,h=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*h;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*i;c[5]=a*k;c[6]=a*h;c[7]=a*j;c[8]=a*m;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,e){var g;g=new THREE.Matrix4;g.n11=2*f/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*f/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(e+f)/(e-f);g.n34=-2*e*f/(e-f);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,e){var g;g=new THREE.Matrix4;g.n11=2*f/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*f/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(e+f)/(e-f);g.n34=-2*e*f/(e-f);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,i,k,h;g=new THREE.Matrix4;i=b-a;k=c-d;h=e-f;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((c+d)/k);g.n31=0;g.n32=0;g.n33=-2/h;g.n34=-((e+f)/h);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,i,k,h;g=new THREE.Matrix4;i=b-a;k=c-d;h=e-f;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((c+d)/k);g.n31=0;g.n32=0;g.n33=-2/h;g.n34=-((e+f)/h);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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=
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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=
@@ -67,7 +67,7 @@ E.multiplyVector4(r.positionScreen),J=k[i-2],F.copy(r.positionScreen),G.copy(J.p
 Q,u.x=y.x/y.w,u.y=y.y/y.w,u.z=y.z,u.rotation=B.rotation.z,u.scale.x=B.scale.x*Math.abs(u.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),u.scale.y=B.scale.y*Math.abs(u.y-(y.y+e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),u.materials=B.materials,w.push(u);f&&w.sort(b);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 Q,u.x=y.x/y.w,u.y=y.y/y.w,u.z=y.z,u.rotation=B.rotation.z,u.scale.x=B.scale.x*Math.abs(u.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),u.scale.y=B.scale.y*Math.abs(u.y-(y.y+e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),u.materials=B.materials,w.push(u);f&&w.sort(b);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,i=d*f;this.w=g*e-i*c;this.x=g*c+i*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,i=d*f;this.w=g*e-i*c;this.x=g*c+i*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
-this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
+this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+f*e+c*i-d*g;this.y=c*a+f*g+d*e-b*i;this.z=d*a+f*i+b*g-c*e;this.w=f*a-b*e-c*g-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,i=this.z,k=this.w,h=k*c+g*f-i*d,j=k*d+i*c-e*f,m=k*f+e*d-g*c,c=-e*
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+f*e+c*i-d*g;this.y=c*a+f*g+d*e-b*i;this.z=d*a+f*i+b*g-c*e;this.w=f*a-b*e-c*g-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,i=this.z,k=this.w,h=k*c+g*f-i*d,j=k*d+i*c-e*f,m=k*f+e*d-g*c,c=-e*
 c-g*d-i*f;b.x=h*k+c*-e+j*-i-m*-g;b.y=j*k+c*-g+m*-e-h*-i;b.z=m*k+c*-i+h*-g-j*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
 c-g*d-i*f;b.x=h*k+c*-e+j*-i-m*-g;b.y=j*k+c*-g+m*-e-h*-i;b.z=m*k+c*-i+h*-g-j*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
@@ -76,7 +76,7 @@ THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;ret
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
-c,d,f,e,g,i=new THREE.Vector3,k=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){i.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)i.addSelf(e.vertexNormals[b]);i.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],i.sub(g.position,c.position),k.sub(b.position,c.position),i.crossSelf(k);i.isZero()||i.normalize();e.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=
+c,d,f,e,g,i=new THREE.Vector3,k=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){i.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)i.addSelf(e.vertexNormals[b]);i.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],i.sub(g.position,c.position),k.sub(b.position,c.position),i.crossSelf(k);i.isZero()||i.normalize();e.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),
 THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),
 c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,f,o){i=a.vertices[b].position;k=a.vertices[c].position;h=a.vertices[d].position;j=g[e];m=g[f];n=g[o];l=k.x-i.x;p=h.x-i.x;q=k.y-i.y;v=h.y-i.y;u=k.z-i.z;C=h.z-i.z;K=m.u-j.u;t=n.u-j.u;w=m.v-j.v;z=n.v-j.v;y=1/(K*z-t*w);F.set((z*l-w*p)*y,(z*q-w*v)*y,(z*u-w*C)*y);G.set((K*p-t*l)*y,(K*v-t*q)*y,(K*C-t*u)*y);E[b].addSelf(F);E[c].addSelf(F);E[d].addSelf(F);D[b].addSelf(G);
 c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,f,o){i=a.vertices[b].position;k=a.vertices[c].position;h=a.vertices[d].position;j=g[e];m=g[f];n=g[o];l=k.x-i.x;p=h.x-i.x;q=k.y-i.y;v=h.y-i.y;u=k.z-i.z;C=h.z-i.z;K=m.u-j.u;t=n.u-j.u;w=m.v-j.v;z=n.v-j.v;y=1/(K*z-t*w);F.set((z*l-w*p)*y,(z*q-w*v)*y,(z*u-w*C)*y);G.set((K*p-t*l)*y,(K*v-t*q)*y,(K*C-t*u)*y);E[b].addSelf(F);E[c].addSelf(F);E[d].addSelf(F);D[b].addSelf(G);
@@ -84,7 +84,7 @@ D[c].addSelf(G);D[d].addSelf(G)}var b,c,d,f,e,g,i,k,h,j,m,n,l,p,q,v,u,C,K,t,w,z,
 "c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)N.copy(e.vertexNormals[d]),f=e[O[d]],o=E[f],A.copy(o),A.subSelf(N.multiplyScalar(N.dot(o))).normalize(),M.cross(e.vertexNormals[d],o),f=M.dot(D[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(A.x,A.y,A.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 "c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)N.copy(e.vertexNormals[d]),f=e[O[d]],o=E[f],A.copy(o),A.subSelf(N.multiplyScalar(N.dot(o))).normalize(),M.cross(e.vertexNormals[d],o),f=M.dot(D[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(A.x,A.y,A.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;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 b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),
-c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++){a=this.faces[e];if(a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d]}this.vertices=b}};THREE.GeometryCount=0;
+c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
 THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
 THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
 THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
 THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
 THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
 THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};

+ 9 - 9
build/custom/ThreeWebGL.js

@@ -1,11 +1,11 @@
 // ThreeWebGL.js r46dev - http://github.com/mrdoob/three.js
 // ThreeWebGL.js r46dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var e,f,h;if(c==0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),f=a*6-e,a=c*(1-b),h=c*(1-
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var e,f,h;if(c===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),f=a*6-e,a=c*(1-b),h=c*(1-
 b*f),b=c*(1-b*(1-f)),e){case 1:this.r=h;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=h;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=h;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 b*f),b=c*(1-b*(1-f)),e){case 1:this.r=h;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=h;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=h;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
-equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
+equals:function(a){return a.x===this.x&&a.y===this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
 addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
 addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
 divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
@@ -15,8 +15,8 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,e){this.x=
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function b(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function c(a,b,c,e){var e=e.clone().subSelf(b),
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function b(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function c(a,b,c,e){var e=e.clone().subSelf(b),
-c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=e.dot(e),b=e.dot(c),e=e.dot(f),h=c.dot(c),c=c.dot(f),f=1/(a*h-b*b),h=(h*e-b*c)*f,a=(a*c-b*e)*f;return h>0&&a>0&&h+a<1}for(var e,f=[],h=0,i=a.children.length;h<i;h++)Array.prototype.push.apply(f,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=b(this.origin,this.direction,a.matrixWorld.getPosition());if(h==null||h>a.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=b(this.origin,
-this.direction,a.matrixWorld.getPosition());if(h==null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var j,m,k,o,p,l,t,A,C=a.geometry,E=C.vertices,h=0,i=C.faces.length;h<i;h++)if(e=C.faces[h],t=this.origin.clone(),A=this.direction.clone(),o=a.matrixWorld,j=o.multiplyVector3(e.centroid.clone()).subSelf(t),l=j.dot(A),!(l<=0)&&(j=o.multiplyVector3(E[e.a].position.clone()),m=o.multiplyVector3(E[e.b].position.clone()),k=o.multiplyVector3(E[e.c].position.clone()),
+c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=e.dot(e),b=e.dot(c),e=e.dot(f),h=c.dot(c),c=c.dot(f),f=1/(a*h-b*b),h=(h*e-b*c)*f,a=(a*c-b*e)*f;return h>0&&a>0&&h+a<1}for(var e,f=[],h=0,i=a.children.length;h<i;h++)Array.prototype.push.apply(f,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=b(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var j,m,k,o,p,l,t,A,C=a.geometry,E=C.vertices,h=0,i=C.faces.length;h<i;h++)if(e=C.faces[h],t=this.origin.clone(),A=this.direction.clone(),o=a.matrixWorld,j=o.multiplyVector3(e.centroid.clone()).subSelf(t),l=j.dot(A),!(l<=0)&&(j=o.multiplyVector3(E[e.a].position.clone()),m=o.multiplyVector3(E[e.b].position.clone()),k=o.multiplyVector3(E[e.c].position.clone()),
 o=e instanceof THREE.Face4?o.multiplyVector3(E[e.d].position.clone()):null,p=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),l=A.dot(p),a.doubleSided||(a.flipSided?l>0:l<0)))if(l=p.dot((new THREE.Vector3).sub(j,t))/l,t=t.addSelf(A.multiplyScalar(l)),e instanceof THREE.Face3)c(t,j,m,k)&&(e={distance:this.origin.distanceTo(t),point:t,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(t,j,m,o)||c(t,m,k,o)))e={distance:this.origin.distanceTo(t),point:t,face:e,object:a},f.push(e)}return f}};
 o=e instanceof THREE.Face4?o.multiplyVector3(E[e.d].position.clone()):null,p=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),l=A.dot(p),a.doubleSided||(a.flipSided?l>0:l<0)))if(l=p.dot((new THREE.Vector3).sub(j,t))/l,t=t.addSelf(A.multiplyScalar(l)),e instanceof THREE.Face3)c(t,j,m,k)&&(e={distance:this.origin.distanceTo(t),point:t,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(t,j,m,o)||c(t,m,k,o)))e={distance:this.origin.distanceTo(t),point:t,face:e,object:a},f.push(e)}return f}};
 THREE.Rectangle=function(){function a(){h=e-b;i=f-c}var b,c,e,f,h,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(h,i,o,p){j=!1;b=h;c=i;e=o;f=p;a()};this.addPoint=function(h,i){j?(j=!1,b=h,c=i,e=h,f=i):(b=b<h?b:h,c=c<i?c:i,e=e>h?e:h,f=f>i?f:i);a()};this.add3Points=
 THREE.Rectangle=function(){function a(){h=e-b;i=f-c}var b,c,e,f,h,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(h,i,o,p){j=!1;b=h;c=i;e=o;f=p;a()};this.addPoint=function(h,i){j?(j=!1,b=h,c=i,e=h,f=i):(b=b<h?b:h,c=c<i?c:i,e=e>h?e:h,f=f>i?f:i);a()};this.add3Points=
 function(h,i,o,p,l,t){j?(j=!1,b=h<o?h<l?h:l:o<l?o:l,c=i<p?i<t?i:t:p<t?p:t,e=h>o?h>l?h:l:o>l?o:l,f=i>p?i>t?i:t:p>t?p:t):(b=h<o?h<l?h<b?h:b:l<b?l:b:o<l?o<b?o:b:l<b?l:b,c=i<p?i<t?i<c?i:c:t<c?t:c:p<t?p<c?p:c:t<c?t:c,e=h>o?h>l?h>e?h:e:l>e?l:e:o>l?o>e?o:e:l>e?l:e,f=i>p?i>t?i>f?i:f:t>f?t:f:p>t?p>f?p:f:t>f?t:f);a()};this.addRectangle=function(h){j?(j=!1,b=h.getLeft(),c=h.getTop(),e=h.getRight(),f=h.getBottom()):(b=b<h.getLeft()?b:h.getLeft(),c=c<h.getTop()?c:h.getTop(),e=e>h.getRight()?e:h.getRight(),f=f>
 function(h,i,o,p,l,t){j?(j=!1,b=h<o?h<l?h:l:o<l?o:l,c=i<p?i<t?i:t:p<t?p:t,e=h>o?h>l?h:l:o>l?o:l,f=i>p?i>t?i:t:p>t?p:t):(b=h<o?h<l?h<b?h:b:l<b?l:b:o<l?o<b?o:b:l<b?l:b,c=i<p?i<t?i<c?i:c:t<c?t:c:p<t?p<c?p:c:t<c?t:c,e=h>o?h>l?h>e?h:e:l>e?l:e:o>l?o>e?o:e:l>e?l:e,f=i>p?i>t?i>f?i:f:t>f?t:f:p>t?p>f?p:f:t>f?t:f);a()};this.addRectangle=function(h){j?(j=!1,b=h.getLeft(),c=h.getTop(),e=h.getRight(),f=h.getBottom()):(b=b<h.getLeft()?b:h.getLeft(),c=c<h.getTop()?c:h.getTop(),e=e>h.getRight()?e:h.getRight(),f=f>
@@ -44,7 +44,7 @@ c.y=f.length();c.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Mat
 a.n23*f;this.n33=a.n33*f}};
 a.n23*f;this.n33=a.n33*f}};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,m=a.n23,k=a.n24,o=a.n31,p=a.n32,l=a.n33,t=a.n34,A=a.n41,C=a.n42,E=a.n43,B=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=m*t*C-k*l*C+k*p*E-j*t*E-m*p*B+j*l*B;b.n12=h*l*C-f*t*C-h*p*E+e*t*E+f*p*B-e*l*B;b.n13=f*k*C-h*m*C+h*j*E-e*k*E-f*j*B+e*m*B;b.n14=h*m*p-f*k*p-h*j*l+e*k*l+f*j*t-e*m*t;b.n21=k*l*A-m*t*A-k*o*E+i*t*E+m*o*B-i*l*B;b.n22=f*t*A-h*l*A+h*o*E-c*t*E-f*o*B+c*l*B;b.n23=h*m*A-f*k*A-h*i*E+c*k*E+f*i*B-c*m*B;b.n24=
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,m=a.n23,k=a.n24,o=a.n31,p=a.n32,l=a.n33,t=a.n34,A=a.n41,C=a.n42,E=a.n43,B=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=m*t*C-k*l*C+k*p*E-j*t*E-m*p*B+j*l*B;b.n12=h*l*C-f*t*C-h*p*E+e*t*E+f*p*B-e*l*B;b.n13=f*k*C-h*m*C+h*j*E-e*k*E-f*j*B+e*m*B;b.n14=h*m*p-f*k*p-h*j*l+e*k*l+f*j*t-e*m*t;b.n21=k*l*A-m*t*A-k*o*E+i*t*E+m*o*B-i*l*B;b.n22=f*t*A-h*l*A+h*o*E-c*t*E-f*o*B+c*l*B;b.n23=h*m*A-f*k*A-h*i*E+c*k*E+f*i*B-c*m*B;b.n24=
 f*k*o-h*m*o+h*i*l-c*k*l-f*i*t+c*m*t;b.n31=j*t*A-k*p*A+k*o*C-i*t*C-j*o*B+i*p*B;b.n32=h*p*A-e*t*A-h*o*C+c*t*C+e*o*B-c*p*B;b.n33=f*k*A-h*j*A+h*i*C-c*k*C-e*i*B+c*j*B;b.n34=h*j*o-e*k*o-h*i*p+c*k*p+e*i*t-c*j*t;b.n41=m*p*A-j*l*A-m*o*C+i*l*C+j*o*E-i*p*E;b.n42=e*l*A-f*p*A+f*o*C-c*l*C-e*o*E+c*p*E;b.n43=f*j*A-e*m*A-f*i*C+c*m*C+e*i*E-c*j*E;b.n44=e*m*o-f*j*o+f*i*p-c*m*p-e*i*l+c*j*l;b.multiplyScalar(1/a.determinant());return b};
 f*k*o-h*m*o+h*i*l-c*k*l-f*i*t+c*m*t;b.n31=j*t*A-k*p*A+k*o*C-i*t*C-j*o*B+i*p*B;b.n32=h*p*A-e*t*A-h*o*C+c*t*C+e*o*B-c*p*B;b.n33=f*k*A-h*j*A+h*i*C-c*k*C-e*i*B+c*j*B;b.n34=h*j*o-e*k*o-h*i*p+c*k*p+e*i*t-c*j*t;b.n41=m*p*A-j*l*A-m*o*C+i*l*C+j*o*E-i*p*E;b.n42=e*l*A-f*p*A+f*o*C-c*l*C-e*o*E+c*p*E;b.n43=f*j*A-e*m*A-f*i*C+c*m*C+e*i*E-c*j*E;b.n44=e*m*o-f*j*o+f*i*p-c*m*p-e*i*l+c*j*l;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*k;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*i;c[4]=a*j;c[5]=a*m;c[6]=a*k;c[7]=a*o;c[8]=a*p;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*k;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*i;c[4]=a*j;c[5]=a*m;c[6]=a*k;c[7]=a*o;c[8]=a*p;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*f/(e-c);i.n23=(e+c)/(e-c);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*f/(e-c);i.n23=(e+c)/(e-c);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
 THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var i,j,m,k;i=new THREE.Matrix4;j=b-a;m=c-e;k=h-f;i.n11=2/j;i.n12=0;i.n13=0;i.n14=-((b+a)/j);i.n21=0;i.n22=2/m;i.n23=0;i.n24=-((c+e)/m);i.n31=0;i.n32=0;i.n33=-2/k;i.n34=-((h+f)/k);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var i,j,m,k;i=new THREE.Matrix4;j=b-a;m=c-e;k=h-f;i.n11=2/j;i.n12=0;i.n13=0;i.n14=-((b+a)/j);i.n21=0;i.n22=2/m;i.n23=0;i.n24=-((c+e)/m);i.n31=0;i.n32=0;i.n33=-2/k;i.n34=-((h+f)/k);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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=
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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=
@@ -67,7 +67,7 @@ W.multiplyVector4(S.positionScreen);ua=1;for(J=R.length;ua<J;ua++)if(S=a(),S.pos
 O.matrixWorld.n34,1),z.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))za=wa[va]=wa[va]||new THREE.RenderableParticle,va++,B=za,B.x=F.x/F.w,B.y=F.y/F.w,B.z=F.z,B.rotation=O.rotation.z,B.scale.x=O.scale.x*Math.abs(B.x-(F.x+h.projectionMatrix.n11)/(F.w+h.projectionMatrix.n14)),B.scale.y=O.scale.y*Math.abs(B.y-(F.y+h.projectionMatrix.n22)/(F.w+h.projectionMatrix.n24)),B.materials=O.materials,qa.push(B);f&&qa.sort(b);return qa}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
 O.matrixWorld.n34,1),z.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))za=wa[va]=wa[va]||new THREE.RenderableParticle,va++,B=za,B.x=F.x/F.w,B.y=F.y/F.w,B.z=F.z,B.rotation=O.rotation.z,B.scale.x=O.scale.x*Math.abs(B.x-(F.x+h.projectionMatrix.n11)/(F.w+h.projectionMatrix.n14)),B.scale.y=O.scale.y*Math.abs(B.y-(F.y+h.projectionMatrix.n22)/(F.w+h.projectionMatrix.n24)),B.materials=O.materials,qa.push(B);f&&qa.sort(b);return qa}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),i=a*b,j=e*f;this.w=i*h-j*c;this.x=i*c+j*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),i=a*b,j=e*f;this.w=i*h-j*c;this.x=i*c+j*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
-this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
+this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,e=this.z,f=this.w,h=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+f*h+c*j-e*i;this.y=c*a+f*i+e*h-b*j;this.z=e*a+f*j+b*i-c*h;this.w=f*a-b*h-c*i-e*j;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,i=this.y,j=this.z,m=this.w,k=m*c+i*f-j*e,o=m*e+j*c-h*f,p=m*f+h*e-i*c,c=-h*
 this.x,c=this.y,e=this.z,f=this.w,h=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+f*h+c*j-e*i;this.y=c*a+f*i+e*h-b*j;this.z=e*a+f*j+b*i-c*h;this.w=f*a-b*h-c*i-e*j;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,i=this.y,j=this.z,m=this.w,k=m*c+i*f-j*e,o=m*e+j*c-h*f,p=m*f+h*e-i*c,c=-h*
 c-i*e-j*f;b.x=k*m+c*-h+o*-j-p*-i;b.y=o*m+c*-i+p*-h-k*-j;b.z=p*m+c*-j+k*-i-o*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-e)*h)/i;e=Math.sin(e*h)/i;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};
 c-i*e-j*f;b.x=k*m+c*-h+o*-j-p*-i;b.y=o*m+c*-i+p*-h-k*-j;b.z=p*m+c*-j+k*-i-o*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-e)*h)/i;e=Math.sin(e*h)/i;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
@@ -76,7 +76,7 @@ THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;ret
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var h=0,i=f.vertexNormals.length;h<i;h++)b.multiplyVector3(f.vertexNormals[h]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var h=0,i=f.vertexNormals.length;h<i;h++)b.multiplyVector3(f.vertexNormals[h]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
-c,e,f,h,i,j=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){j.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)j.addSelf(h.vertexNormals[b]);j.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],i=this.vertices[h.c],j.sub(i.position,c.position),m.sub(b.position,c.position),j.crossSelf(m);j.isZero()||j.normalize();h.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=
+c,e,f,h,i,j=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){j.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)j.addSelf(h.vertexNormals[b]);j.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],i=this.vertices[h.c],j.sub(i.position,c.position),m.sub(b.position,c.position),j.crossSelf(m);j.isZero()||j.normalize();h.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
 THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
 c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,d,b,c,e,h,f){j=a.vertices[d].position;m=a.vertices[b].position;k=a.vertices[c].position;o=i[e];p=i[h];l=i[f];t=m.x-j.x;A=k.x-j.x;C=m.y-j.y;E=k.y-j.y;B=m.z-j.z;va=k.z-j.z;wa=p.u-o.u;pa=l.u-o.u;qa=p.v-o.v;N=l.v-o.v;F=1/(wa*N-pa*qa);ja.set((N*t-qa*A)*F,(N*C-qa*E)*F,(N*B-qa*va)*F);$.set((wa*A-pa*t)*F,(wa*E-pa*C)*F,(wa*va-pa*B)*F);W[d].addSelf(ja);W[b].addSelf(ja);W[c].addSelf(ja);
 c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,d,b,c,e,h,f){j=a.vertices[d].position;m=a.vertices[b].position;k=a.vertices[c].position;o=i[e];p=i[h];l=i[f];t=m.x-j.x;A=k.x-j.x;C=m.y-j.y;E=k.y-j.y;B=m.z-j.z;va=k.z-j.z;wa=p.u-o.u;pa=l.u-o.u;qa=p.v-o.v;N=l.v-o.v;F=1/(wa*N-pa*qa);ja.set((N*t-qa*A)*F,(N*C-qa*E)*F,(N*B-qa*va)*F);$.set((wa*A-pa*t)*F,(wa*E-pa*C)*F,(wa*va-pa*B)*F);W[d].addSelf(ja);W[b].addSelf(ja);W[c].addSelf(ja);
@@ -84,8 +84,8 @@ U[d].addSelf($);U[b].addSelf($);U[c].addSelf($)}var b,c,e,f,h,i,j,m,k,o,p,l,t,A,
 0,1,3));var d=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)G.copy(h.vertexNormals[e]),f=h[d[e]],z=W[f],xa.copy(z),xa.subSelf(G.multiplyScalar(G.dot(z))).normalize(),Q.cross(h.vertexNormals[e],z),f=Q.dot(U[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(xa.x,xa.y,xa.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
 0,1,3));var d=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)G.copy(h.vertexNormals[e]),f=h[d[e]],z=W[f],xa.copy(z),xa.subSelf(G.multiplyScalar(G.dot(z))).normalize(),Q.cross(h.vertexNormals[e],z),f=Q.dot(U[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(xa.x,xa.y,xa.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;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 b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<
 y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<
 this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),h,i;h=0;for(i=this.vertices.length;h<i;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),
 this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),h,i;h=0;for(i=this.vertices.length;h<i;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),
-a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),c[h]=b.length-1):c[h]=c[a[e]];h=0;for(i=this.faces.length;h<i;h++){a=this.faces[h];if(a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d]}this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,e,h,f,i){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*i+(-3*(b-c)-2*a-e)*f+a*h+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,i,j,m,k,o,p,l;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;h=Math.floor(f);i=f-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;k=this.points[c[0]];o=this.points[c[1]];
+a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),c[h]=b.length-1):c[h]=c[a[e]];h=0;for(i=this.faces.length;h<i;h++)if(a=this.faces[h],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
+THREE.Spline=function(a){function b(a,b,c,e,h,f,i){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*i+(-3*(b-c)-2*a-e)*f+a*h+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,i,j,m,k,o,p,l;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;h=Math.floor(f);i=f-h;c[0]=h===0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;k=this.points[c[0]];o=this.points[c[1]];
 p=this.points[c[2]];l=this.points[c[3]];j=i*i;m=i*j;e.x=b(k.x,o.x,p.x,l.x,i,j,m);e.y=b(k.y,o.y,p.y,l.y,i,j,m);e.z=b(k.z,o.z,p.z,l.z,i,j,m);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,h=new THREE.Vector3,f=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),f.copy(position),
 p=this.points[c[2]];l=this.points[c[3]];j=i*i;m=i*j;e.x=b(k.x,o.x,p.x,l.x,i,j,m);e.y=b(k.y,o.y,p.y,l.y,i,j,m);e.z=b(k.z,o.z,p.z,l.z,i,j,m);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,h=new THREE.Vector3,f=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),f.copy(position),
 j+=f.distanceTo(h),h.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,e,h,f,i,j=[],k=new THREE.Vector3,m=this.getLength();j.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=m.chunks[b]-m.chunks[b-1];i=Math.ceil(a*c/m.total);h=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<i-1;c++)e=h+c*(1/i)*(f-h),position=this.getPoint(e),j.push(k.copy(position).clone());
 j+=f.distanceTo(h),h.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,e,h,f,i,j=[],k=new THREE.Vector3,m=this.getLength();j.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=m.chunks[b]-m.chunks[b-1];i=Math.ceil(a*c/m.total);h=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<i-1;c++)e=h+c*(1/i)*(f-h),position=this.getPoint(e),j.push(k.copy(position).clone());
 j.push(k.copy(this.points[b]).clone())}this.points=j}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};
 j.push(k.copy(this.points[b]).clone())}this.points=j}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};

+ 1 - 1
examples/js/Car.js

@@ -364,6 +364,6 @@ THREE.Car = function () {
 	function cubicEaseOut( k ) { return --k * k * k + 1; }
 	function cubicEaseOut( k ) { return --k * k * k + 1; }
 	function circularEaseOut( k ) { return Math.sqrt( 1 - --k * k ); }
 	function circularEaseOut( k ) { return Math.sqrt( 1 - --k * k ); }
 	function sinusoidalEaseOut( k ) { return Math.sin( k * Math.PI / 2 ); }
 	function sinusoidalEaseOut( k ) { return Math.sin( k * Math.PI / 2 ); }
-	function exponentialEaseOut( k ) { return k == 1 ? 1 : - Math.pow( 2, - 10 * k ) + 1; }
+	function exponentialEaseOut( k ) { return k === 1 ? 1 : - Math.pow( 2, - 10 * k ) + 1; }
 
 
 };
 };

+ 1 - 1
src/core/Color.js

@@ -62,7 +62,7 @@ THREE.Color.prototype = {
 
 
 		var i, f, p, q, t;
 		var i, f, p, q, t;
 
 
-		if ( v == 0 ) {
+		if ( v === 0 ) {
 
 
 			this.r = this.g = this.b = 0;
 			this.r = this.g = this.b = 0;
 
 

+ 28 - 19
src/core/Geometry.js

@@ -169,7 +169,7 @@ THREE.Geometry.prototype = {
 		// create internal buffers for reuse when calling this method repeatedly
 		// create internal buffers for reuse when calling this method repeatedly
 		// (otherwise memory allocation / deallocation every frame is big resource hog)
 		// (otherwise memory allocation / deallocation every frame is big resource hog)
 
 
-		if ( this.__tmpVertices == undefined ) {
+		if ( this.__tmpVertices === undefined ) {
 
 
 			this.__tmpVertices = new Array( this.vertices.length );
 			this.__tmpVertices = new Array( this.vertices.length );
 			vertices = this.__tmpVertices;
 			vertices = this.__tmpVertices;
@@ -443,6 +443,7 @@ THREE.Geometry.prototype = {
 	 * Duplicated vertices are removed
 	 * Duplicated vertices are removed
 	 * and faces' vertices are updated.
 	 * and faces' vertices are updated.
 	 */
 	 */
+
 	mergeVertices: function() {
 	mergeVertices: function() {
 
 
 		var verticesMap = {}; // Hashmap for looking up vertice by position coordinates (and making sure they are unique)
 		var verticesMap = {}; // Hashmap for looking up vertice by position coordinates (and making sure they are unique)
@@ -450,47 +451,55 @@ THREE.Geometry.prototype = {
 
 
 		var v, key;
 		var v, key;
 		var precisionPoints = 4; // number of decimal points, eg. 4 for epsilon of 0.0001
 		var precisionPoints = 4; // number of decimal points, eg. 4 for epsilon of 0.0001
-		var precision = Math.pow(10, precisionPoints)
+		var precision = Math.pow( 10, precisionPoints );
 		var i,il, face;
 		var i,il, face;
 
 
-		for (i=0,il=this.vertices.length;i<il;i++) {
+		for ( i = 0, il = this.vertices.length; i < il; i ++ ) {
+
+			v = this.vertices[ i ].position;
+			key = [ Math.round( v.x * precision ), Math.round( v.y * precision ), Math.round( v.z * precision ) ].join( '_' );
+
+			if ( verticesMap[ key ] === undefined ) {
 
 
-			v = this.vertices[i].position;
-			key = [Math.round(v.x * precision), Math.round(v.y* precision), Math.round(v.z* precision)].join('_');
+				verticesMap[ key ] = i;
+				unique.push( this.vertices[ i ] );
+				changes[ i ] = unique.length - 1;
 
 
-			if (verticesMap[key]===undefined) {
-				verticesMap[key] = i;
-				unique.push(this.vertices[i]);
-				changes[i] = unique.length - 1;
 			} else {
 			} else {
+
 				//console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);
 				//console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);
-				changes[i] = changes[verticesMap[key]];
+				changes[ i ] = changes[ verticesMap[ key ] ];
+
 			}
 			}
 
 
 		};
 		};
 
 
 
 
-		// Start to patch face indices.
+		// Start to patch face indices
+
 		for( i = 0, il = this.faces.length; i < il; i ++ ) {
 		for( i = 0, il = this.faces.length; i < il; i ++ ) {
 
 
 			face = this.faces[ i ];
 			face = this.faces[ i ];
 
 
 			if ( face instanceof THREE.Face3 ) {
 			if ( face instanceof THREE.Face3 ) {
-				face.a = changes[face.a];
-				face.b = changes[face.b];
-				face.c = changes[face.c];
 
 
-			} if ( face instanceof THREE.Face4 ) {
+				face.a = changes[ face.a ];
+				face.b = changes[ face.b ];
+				face.c = changes[ face.c ];
+
+			} else if ( face instanceof THREE.Face4 ) {
 
 
-				face.a = changes[face.a];
-				face.b = changes[face.b];
-				face.c = changes[face.c];
-				face.d = changes[face.d];
+				face.a = changes[ face.a ];
+				face.b = changes[ face.b ];
+				face.c = changes[ face.c ];
+				face.d = changes[ face.d ];
 
 
 			}
 			}
+
 		}
 		}
 
 
 		// Use unique set of vertices
 		// Use unique set of vertices
+
 		this.vertices = unique;
 		this.vertices = unique;
 
 
 	}
 	}

+ 2 - 1
src/core/Matrix4.js

@@ -818,7 +818,8 @@ THREE.Matrix4.makeInvert3x3 = function ( m1 ) {
 	idet;
 	idet;
 
 
 	// no inverse
 	// no inverse
-	if ( det == 0 ) {
+
+	if ( det === 0 ) {
 
 
 		console.error( 'THREE.Matrix4.makeInvert3x3: Matrix not invertible.' );
 		console.error( 'THREE.Matrix4.makeInvert3x3: Matrix not invertible.' );
 
 

+ 10 - 10
src/core/Quaternion.js

@@ -84,24 +84,24 @@ THREE.Quaternion.prototype = {
 		return this;
 		return this;
 
 
 	},
 	},
-	
+
 	setFromRotationMatrix: function ( m ) {
 	setFromRotationMatrix: function ( m ) {
 		// Adapted from: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
 		// Adapted from: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
 		function copySign(a, b) {
 		function copySign(a, b) {
 			return b < 0 ? -Math.abs(a) : Math.abs(a);
 			return b < 0 ? -Math.abs(a) : Math.abs(a);
 		}
 		}
 		var absQ = Math.pow(m.determinant(), 1.0 / 3.0);
 		var absQ = Math.pow(m.determinant(), 1.0 / 3.0);
-		this.w = Math.sqrt( Math.max( 0, absQ + m.n11 + m.n22 + m.n33 ) ) / 2; 
-		this.x = Math.sqrt( Math.max( 0, absQ + m.n11 - m.n22 - m.n33 ) ) / 2; 
-		this.y = Math.sqrt( Math.max( 0, absQ - m.n11 + m.n22 - m.n33 ) ) / 2; 
-		this.z = Math.sqrt( Math.max( 0, absQ - m.n11 - m.n22 + m.n33 ) ) / 2; 
+		this.w = Math.sqrt( Math.max( 0, absQ + m.n11 + m.n22 + m.n33 ) ) / 2;
+		this.x = Math.sqrt( Math.max( 0, absQ + m.n11 - m.n22 - m.n33 ) ) / 2;
+		this.y = Math.sqrt( Math.max( 0, absQ - m.n11 + m.n22 - m.n33 ) ) / 2;
+		this.z = Math.sqrt( Math.max( 0, absQ - m.n11 - m.n22 + m.n33 ) ) / 2;
 		this.x = copySign( this.x, ( m.n32 - m.n23 ) );
 		this.x = copySign( this.x, ( m.n32 - m.n23 ) );
 		this.y = copySign( this.y, ( m.n13 - m.n31 ) );
 		this.y = copySign( this.y, ( m.n13 - m.n31 ) );
 		this.z = copySign( this.z, ( m.n21 - m.n12 ) );
 		this.z = copySign( this.z, ( m.n21 - m.n12 ) );
 		this.normalize();
 		this.normalize();
 		return this;
 		return this;
 	},
 	},
-	
+
 	calculateW : function () {
 	calculateW : function () {
 
 
 		this.w = - Math.sqrt( Math.abs( 1.0 - this.x * this.x - this.y * this.y - this.z * this.z ) );
 		this.w = - Math.sqrt( Math.abs( 1.0 - this.x * this.x - this.y * this.y - this.z * this.z ) );
@@ -130,7 +130,7 @@ THREE.Quaternion.prototype = {
 
 
 		var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );
 		var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );
 
 
-		if ( l == 0 ) {
+		if ( l === 0 ) {
 
 
 			this.x = 0;
 			this.x = 0;
 			this.y = 0;
 			this.y = 0;
@@ -174,7 +174,7 @@ THREE.Quaternion.prototype = {
 		this.y = -q1.x * q2.z + q1.y * q2.w + q1.z * q2.x + q1.w * q2.y;
 		this.y = -q1.x * q2.z + q1.y * q2.w + q1.z * q2.x + q1.w * q2.y;
 		this.z =  q1.x * q2.y - q1.y * q2.x + q1.z * q2.w + q1.w * q2.z;
 		this.z =  q1.x * q2.y - q1.y * q2.x + q1.z * q2.w + q1.w * q2.z;
 		this.w = -q1.x * q2.x - q1.y * q2.y - q1.z * q2.z + q1.w * q2.w;
 		this.w = -q1.x * q2.x - q1.y * q2.y - q1.z * q2.z + q1.w * q2.w;
-		
+
 		return this;
 		return this;
 
 
 	},
 	},
@@ -219,7 +219,7 @@ THREE.Quaternion.slerp = function ( qa, qb, qm, t ) {
 	var halfTheta = Math.acos( cosHalfTheta ),
 	var halfTheta = Math.acos( cosHalfTheta ),
 	sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );
 	sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );
 
 
-	if ( Math.abs( sinHalfTheta ) < 0.001 ) { 
+	if ( Math.abs( sinHalfTheta ) < 0.001 ) {
 
 
 		qm.w = 0.5 * ( qa.w + qb.w );
 		qm.w = 0.5 * ( qa.w + qb.w );
 		qm.x = 0.5 * ( qa.x + qb.x );
 		qm.x = 0.5 * ( qa.x + qb.x );
@@ -231,7 +231,7 @@ THREE.Quaternion.slerp = function ( qa, qb, qm, t ) {
 	}
 	}
 
 
 	var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,
 	var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,
-	ratioB = Math.sin( t * halfTheta ) / sinHalfTheta; 
+	ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;
 
 
 	qm.w = ( qa.w * ratioA + qb.w * ratioB );
 	qm.w = ( qa.w * ratioA + qb.w * ratioB );
 	qm.x = ( qa.x * ratioA + qb.x * ratioB );
 	qm.x = ( qa.x * ratioA + qb.x * ratioB );

+ 2 - 2
src/core/Ray.js

@@ -50,7 +50,7 @@ THREE.Ray.prototype = {
 
 
 			var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
 			var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
 
 
-			if ( distance == null || distance > object.scale.x ) {
+			if ( distance === null || distance > object.scale.x ) {
 
 
 				return [];
 				return [];
 
 
@@ -73,7 +73,7 @@ THREE.Ray.prototype = {
 
 
 			var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
 			var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
 
 
-			if ( distance == null || distance > object.geometry.boundingSphere.radius * Math.max( object.scale.x, Math.max( object.scale.y, object.scale.z ) ) ) {
+			if ( distance === null || distance > object.geometry.boundingSphere.radius * Math.max( object.scale.x, Math.max( object.scale.y, object.scale.z ) ) ) {
 
 
 				return intersects;
 				return intersects;
 
 

+ 1 - 1
src/core/Spline.js

@@ -32,7 +32,7 @@ THREE.Spline = function ( points ) {
 		intPoint = Math.floor( point );
 		intPoint = Math.floor( point );
 		weight = point - intPoint;
 		weight = point - intPoint;
 
 
-		c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1;
+		c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;
 		c[ 1 ] = intPoint;
 		c[ 1 ] = intPoint;
 		c[ 2 ] = intPoint > this.points.length - 2 ? intPoint : intPoint + 1;
 		c[ 2 ] = intPoint > this.points.length - 2 ? intPoint : intPoint + 1;
 		c[ 3 ] = intPoint > this.points.length - 3 ? intPoint : intPoint + 2;
 		c[ 3 ] = intPoint > this.points.length - 3 ? intPoint : intPoint + 2;

+ 1 - 1
src/core/Vector2.js

@@ -156,7 +156,7 @@ THREE.Vector2.prototype = {
 
 
 	equals: function( v ) {
 	equals: function( v ) {
 
 
-		return ( ( v.x == this.x ) && ( v.y == this.y ) );
+		return ( ( v.x === this.x ) && ( v.y === this.y ) );
 
 
 	}
 	}
 
 

+ 3 - 3
src/extras/ColorUtils.js

@@ -33,7 +33,7 @@ THREE.ColorUtils = {
 		var saturation;
 		var saturation;
 		var value = max;
 		var value = max;
 
 
-		if ( min == max )	{
+		if ( min === max )	{
 
 
 			hue = 0;
 			hue = 0;
 			saturation = 0;
 			saturation = 0;
@@ -43,11 +43,11 @@ THREE.ColorUtils = {
 			var delta = ( max - min );
 			var delta = ( max - min );
 			saturation = delta / max;
 			saturation = delta / max;
 
 
-			if ( r == max )	{
+			if ( r === max ) {
 
 
 				hue = ( g - b ) / delta;
 				hue = ( g - b ) / delta;
 
 
-			} else if ( g == max ) {
+			} else if ( g === max ) {
 
 
 				hue = 2 + ( ( b - r ) / delta );
 				hue = 2 + ( ( b - r ) / delta );
 
 

+ 2 - 2
src/extras/ImageUtils.js

@@ -28,8 +28,8 @@ THREE.ImageUtils = {
 			images[ i ] = new Image();
 			images[ i ] = new Image();
 			images[ i ].onload = function () {
 			images[ i ].onload = function () {
 
 
-				images.loadCount += 1; 
-				if ( images.loadCount == 6 ) texture.needsUpdate = true; 
+				images.loadCount += 1;
+				if ( images.loadCount === 6 ) texture.needsUpdate = true;
 				if ( callback ) callback( this );
 				if ( callback ) callback( this );
 
 
 			};
 			};

+ 72 - 72
src/extras/animation/Animation.js

@@ -37,17 +37,17 @@ THREE.Animation.prototype.play = function( loop, startTimeMS ) {
 
 
 		var h, hl = this.hierarchy.length,
 		var h, hl = this.hierarchy.length,
 			object;
 			object;
-		
+
 		for ( h = 0; h < hl; h++ ) {
 		for ( h = 0; h < hl; h++ ) {
 
 
 			object = this.hierarchy[ h ];
 			object = this.hierarchy[ h ];
-			
+
 			if ( this.interpolationType !== THREE.AnimationHandler.CATMULLROM_FORWARD ) {
 			if ( this.interpolationType !== THREE.AnimationHandler.CATMULLROM_FORWARD ) {
 
 
 				object.useQuaternion = true;
 				object.useQuaternion = true;
 
 
 			}
 			}
-			
+
 			object.matrixAutoUpdate = true;
 			object.matrixAutoUpdate = true;
 
 
 			if ( object.animationCache === undefined ) {
 			if ( object.animationCache === undefined ) {
@@ -89,15 +89,15 @@ THREE.Animation.prototype.play = function( loop, startTimeMS ) {
 THREE.Animation.prototype.pause = function() {
 THREE.Animation.prototype.pause = function() {
 
 
 	if( this.isPaused ) {
 	if( this.isPaused ) {
-		
+
 		THREE.AnimationHandler.addToUpdate( this );
 		THREE.AnimationHandler.addToUpdate( this );
-		
+
 	} else {
 	} else {
-		
+
 		THREE.AnimationHandler.removeFromUpdate( this );
 		THREE.AnimationHandler.removeFromUpdate( this );
-		
+
 	}
 	}
-	
+
 	this.isPaused = !this.isPaused;
 	this.isPaused = !this.isPaused;
 
 
 };
 };
@@ -110,31 +110,31 @@ THREE.Animation.prototype.stop = function() {
 	this.isPlaying = false;
 	this.isPlaying = false;
 	this.isPaused  = false;
 	this.isPaused  = false;
 	THREE.AnimationHandler.removeFromUpdate( this );
 	THREE.AnimationHandler.removeFromUpdate( this );
-	
-	
+
+
 	// reset JIT matrix and remove cache
 	// reset JIT matrix and remove cache
-	
+
 	for ( var h = 0; h < this.hierarchy.length; h++ ) {
 	for ( var h = 0; h < this.hierarchy.length; h++ ) {
-		
+
 		if ( this.hierarchy[ h ].animationCache !== undefined ) {
 		if ( this.hierarchy[ h ].animationCache !== undefined ) {
-			
+
 			if( this.hierarchy[ h ] instanceof THREE.Bone ) {
 			if( this.hierarchy[ h ] instanceof THREE.Bone ) {
-			
+
 				this.hierarchy[ h ].skinMatrix = this.hierarchy[ h ].animationCache.originalMatrix;
 				this.hierarchy[ h ].skinMatrix = this.hierarchy[ h ].animationCache.originalMatrix;
-				
+
 			} else {
 			} else {
-				
+
 				this.hierarchy[ h ].matrix = this.hierarchy[ h ].animationCache.originalMatrix;
 				this.hierarchy[ h ].matrix = this.hierarchy[ h ].animationCache.originalMatrix;
 
 
 			}
 			}
-			
-			
+
+
 			delete this.hierarchy[ h ].animationCache;
 			delete this.hierarchy[ h ].animationCache;
 
 
 		}
 		}
 
 
 	}
 	}
- 	
+
 };
 };
 
 
 
 
@@ -161,10 +161,10 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 	var JIThierarchy = this.data.JIT.hierarchy;
 	var JIThierarchy = this.data.JIT.hierarchy;
 	var currentTime, unloopedCurrentTime;
 	var currentTime, unloopedCurrentTime;
 	var currentPoint, forwardPoint, angle;
 	var currentPoint, forwardPoint, angle;
-	
+
 
 
 	// update
 	// update
-	
+
 	this.currentTime += deltaTimeMS * this.timeScale;
 	this.currentTime += deltaTimeMS * this.timeScale;
 
 
 	unloopedCurrentTime = this.currentTime;
 	unloopedCurrentTime = this.currentTime;
@@ -178,43 +178,43 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 
 
 		object = this.hierarchy[ h ];
 		object = this.hierarchy[ h ];
 		animationCache = object.animationCache;
 		animationCache = object.animationCache;
-	
+
 		// use JIT?
 		// use JIT?
-	
+
 		if ( this.JITCompile && JIThierarchy[ h ][ frame ] !== undefined ) {
 		if ( this.JITCompile && JIThierarchy[ h ][ frame ] !== undefined ) {
 
 
 			if( object instanceof THREE.Bone ) {
 			if( object instanceof THREE.Bone ) {
-				
+
 				object.skinMatrix = JIThierarchy[ h ][ frame ];
 				object.skinMatrix = JIThierarchy[ h ][ frame ];
-				
+
 				object.matrixAutoUpdate = false;
 				object.matrixAutoUpdate = false;
 				object.matrixWorldNeedsUpdate = false;
 				object.matrixWorldNeedsUpdate = false;
 
 
 			} else {
 			} else {
-			
+
 				object.matrix = JIThierarchy[ h ][ frame ];
 				object.matrix = JIThierarchy[ h ][ frame ];
-				
+
 				object.matrixAutoUpdate = false;
 				object.matrixAutoUpdate = false;
 				object.matrixWorldNeedsUpdate = true;
 				object.matrixWorldNeedsUpdate = true;
 
 
 			}
 			}
-			
+
 		// use interpolation
 		// use interpolation
-	
+
 		} else {
 		} else {
 
 
 			// make sure so original matrix and not JIT matrix is set
 			// make sure so original matrix and not JIT matrix is set
 
 
 			if ( this.JITCompile ) {
 			if ( this.JITCompile ) {
-				
+
 				if( object instanceof THREE.Bone ) {
 				if( object instanceof THREE.Bone ) {
-					
+
 					object.skinMatrix = object.animationCache.originalMatrix;
 					object.skinMatrix = object.animationCache.originalMatrix;
-					
+
 				} else {
 				} else {
-					
+
 					object.matrix = object.animationCache.originalMatrix;
 					object.matrix = object.animationCache.originalMatrix;
-					
+
 				}
 				}
 
 
 			}
 			}
@@ -244,10 +244,10 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 							nextKey = this.getNextKeyWith( type, h, 1 );
 							nextKey = this.getNextKeyWith( type, h, 1 );
 
 
 							while( nextKey.time < currentTime ) {
 							while( nextKey.time < currentTime ) {
-	
+
 								prevKey = nextKey;
 								prevKey = nextKey;
 								nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );
 								nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );
-	
+
 							}
 							}
 
 
 						} else {
 						} else {
@@ -286,7 +286,7 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 
 
 				if ( scale < 0 || scale > 1 ) {
 				if ( scale < 0 || scale > 1 ) {
 
 
-					console.log( "THREE.Animation.update: Warning! Scale out of bounds:" + scale + " on bone " + h ); 
+					console.log( "THREE.Animation.update: Warning! Scale out of bounds:" + scale + " on bone " + h );
 					scale = scale < 0 ? 0 : 1;
 					scale = scale < 0 ? 0 : 1;
 
 
 				}
 				}
@@ -295,17 +295,17 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 
 
 				if ( type === "pos" ) {
 				if ( type === "pos" ) {
 
 
-					vector = object.position; 
+					vector = object.position;
 
 
 					if( this.interpolationType === THREE.AnimationHandler.LINEAR ) {
 					if( this.interpolationType === THREE.AnimationHandler.LINEAR ) {
-						
+
 						vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;
 						vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;
 						vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
 						vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
 						vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
 						vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
 
 
 					} else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
 					} else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
-							    this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {						
-		
+							    this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
+
 						this.points[ 0 ] = this.getPrevKeyWith( "pos", h, prevKey.index - 1 )[ "pos" ];
 						this.points[ 0 ] = this.getPrevKeyWith( "pos", h, prevKey.index - 1 )[ "pos" ];
 						this.points[ 1 ] = prevXYZ;
 						this.points[ 1 ] = prevXYZ;
 						this.points[ 2 ] = nextXYZ;
 						this.points[ 2 ] = nextXYZ;
@@ -314,23 +314,23 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 						scale = scale * 0.33 + 0.33;
 						scale = scale * 0.33 + 0.33;
 
 
 						currentPoint = this.interpolateCatmullRom( this.points, scale );
 						currentPoint = this.interpolateCatmullRom( this.points, scale );
-						
+
 						vector.x = currentPoint[ 0 ];
 						vector.x = currentPoint[ 0 ];
 						vector.y = currentPoint[ 1 ];
 						vector.y = currentPoint[ 1 ];
 						vector.z = currentPoint[ 2 ];
 						vector.z = currentPoint[ 2 ];
-						
+
 						if( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
 						if( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
-							
-							forwardPoint = this.interpolateCatmullRom( this.points, scale * 1.01 );							
-							
+
+							forwardPoint = this.interpolateCatmullRom( this.points, scale * 1.01 );
+
 							this.target.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] );
 							this.target.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] );
 							this.target.subSelf( vector );
 							this.target.subSelf( vector );
 							this.target.y = 0;
 							this.target.y = 0;
 							this.target.normalize();
 							this.target.normalize();
-							
+
 							angle = Math.atan2( this.target.x, this.target.z );
 							angle = Math.atan2( this.target.x, this.target.z );
 							object.rotation.set( 0, angle, 0 );
 							object.rotation.set( 0, angle, 0 );
-							
+
 						}
 						}
 
 
 					}
 					}
@@ -342,7 +342,7 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 				} else if( type === "scl" ) {
 				} else if( type === "scl" ) {
 
 
 					vector = object.scale;
 					vector = object.scale;
-					
+
 					vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;
 					vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;
 					vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
 					vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
 					vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
 					vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
@@ -358,25 +358,25 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 	// update JIT?
 	// update JIT?
 
 
 	if ( this.JITCompile ) {
 	if ( this.JITCompile ) {
-		
+
 		if ( JIThierarchy[ 0 ][ frame ] === undefined ) {
 		if ( JIThierarchy[ 0 ][ frame ] === undefined ) {
-	
+
 			this.hierarchy[ 0 ].update( undefined, true );
 			this.hierarchy[ 0 ].update( undefined, true );
-	
+
 			for ( var h = 0; h < this.hierarchy.length; h++ ) {
 			for ( var h = 0; h < this.hierarchy.length; h++ ) {
-	
+
 				if( this.hierarchy[ h ] instanceof THREE.Bone ) {
 				if( this.hierarchy[ h ] instanceof THREE.Bone ) {
-	
+
 					JIThierarchy[ h ][ frame ] = this.hierarchy[ h ].skinMatrix.clone();
 					JIThierarchy[ h ][ frame ] = this.hierarchy[ h ].skinMatrix.clone();
-					
+
 				} else {
 				} else {
-	
+
 					JIThierarchy[ h ][ frame ] = this.hierarchy[ h ].matrix.clone();
 					JIThierarchy[ h ][ frame ] = this.hierarchy[ h ].matrix.clone();
-				
+
 				}
 				}
-	
+
 			}
 			}
-	
+
 		}
 		}
 
 
 	}
 	}
@@ -384,18 +384,18 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 };
 };
 
 
 // Catmull-Rom spline
 // Catmull-Rom spline
- 
+
 THREE.Animation.prototype.interpolateCatmullRom = function ( points, scale ) {
 THREE.Animation.prototype.interpolateCatmullRom = function ( points, scale ) {
 
 
 	var c = [], v3 = [],
 	var c = [], v3 = [],
 	point, intPoint, weight, w2, w3,
 	point, intPoint, weight, w2, w3,
 	pa, pb, pc, pd;
 	pa, pb, pc, pd;
-	
+
 	point = ( points.length - 1 ) * scale;
 	point = ( points.length - 1 ) * scale;
 	intPoint = Math.floor( point );
 	intPoint = Math.floor( point );
 	weight = point - intPoint;
 	weight = point - intPoint;
 
 
-	c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1;
+	c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;
 	c[ 1 ] = intPoint;
 	c[ 1 ] = intPoint;
 	c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1;
 	c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1;
 	c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2;
 	c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2;
@@ -407,11 +407,11 @@ THREE.Animation.prototype.interpolateCatmullRom = function ( points, scale ) {
 
 
 	w2 = weight * weight;
 	w2 = weight * weight;
 	w3 = weight * w2;
 	w3 = weight * w2;
-	
+
 	v3[ 0 ] = this.interpolate( pa[ 0 ], pb[ 0 ], pc[ 0 ], pd[ 0 ], weight, w2, w3 );
 	v3[ 0 ] = this.interpolate( pa[ 0 ], pb[ 0 ], pc[ 0 ], pd[ 0 ], weight, w2, w3 );
 	v3[ 1 ] = this.interpolate( pa[ 1 ], pb[ 1 ], pc[ 1 ], pd[ 1 ], weight, w2, w3 );
 	v3[ 1 ] = this.interpolate( pa[ 1 ], pb[ 1 ], pc[ 1 ], pd[ 1 ], weight, w2, w3 );
 	v3[ 2 ] = this.interpolate( pa[ 2 ], pb[ 2 ], pc[ 2 ], pd[ 2 ], weight, w2, w3 );
 	v3[ 2 ] = this.interpolate( pa[ 2 ], pb[ 2 ], pc[ 2 ], pd[ 2 ], weight, w2, w3 );
-	
+
 	return v3;
 	return v3;
 
 
 };
 };
@@ -430,16 +430,16 @@ THREE.Animation.prototype.interpolate = function( p0, p1, p2, p3, t, t2, t3 ) {
 // Get next key with
 // Get next key with
 
 
 THREE.Animation.prototype.getNextKeyWith = function( type, h, key ) {
 THREE.Animation.prototype.getNextKeyWith = function( type, h, key ) {
-	
+
 	var keys = this.data.hierarchy[ h ].keys;
 	var keys = this.data.hierarchy[ h ].keys;
-	
+
 	if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
 	if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
 		 this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
 		 this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
-			 
+
 		key = key < keys.length - 1 ? key : keys.length - 1;
 		key = key < keys.length - 1 ? key : keys.length - 1;
 
 
 	} else {
 	} else {
-		
+
 		key = key % keys.length;
 		key = key % keys.length;
 
 
 	}
 	}
@@ -461,16 +461,16 @@ THREE.Animation.prototype.getNextKeyWith = function( type, h, key ) {
 // Get previous key with
 // Get previous key with
 
 
 THREE.Animation.prototype.getPrevKeyWith = function( type, h, key ) {
 THREE.Animation.prototype.getPrevKeyWith = function( type, h, key ) {
-	
+
 	var keys = this.data.hierarchy[ h ].keys;
 	var keys = this.data.hierarchy[ h ].keys;
-	
+
 	if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
 	if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
 		 this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
 		 this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
-			 
+
 		key = key > 0 ? key : 0;
 		key = key > 0 ? key : 0;
 
 
 	} else {
 	} else {
-		
+
 		key = key >= 0 ? key : key + keys.length;
 		key = key >= 0 ? key : key + keys.length;
 
 
 	}
 	}

+ 3 - 3
src/extras/geometries/CubeGeometry.js

@@ -74,16 +74,16 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 		height_half = height / 2,
 		height_half = height / 2,
 		offset = scope.vertices.length;
 		offset = scope.vertices.length;
 
 
-		if ( ( u == 'x' && v == 'y' ) || ( u == 'y' && v == 'x' ) ) {
+		if ( ( u === 'x' && v === 'y' ) || ( u === 'y' && v === 'x' ) ) {
 
 
 			w = 'z';
 			w = 'z';
 
 
-		} else if ( ( u == 'x' && v == 'z' ) || ( u == 'z' && v == 'x' ) ) {
+		} else if ( ( u === 'x' && v === 'z' ) || ( u === 'z' && v === 'x' ) ) {
 
 
 			w = 'y';
 			w = 'y';
 			gridY = segmentsDepth || 1;
 			gridY = segmentsDepth || 1;
 
 
-		} else if ( ( u == 'z' && v == 'y' ) || ( u == 'y' && v == 'z' ) ) {
+		} else if ( ( u === 'z' && v === 'y' ) || ( u === 'y' && v === 'z' ) ) {
 
 
 			w = 'x';
 			w = 'x';
 			gridX = segmentsDepth || 1;
 			gridX = segmentsDepth || 1;

+ 7 - 7
src/extras/geometries/ExtrudeGeometry.js

@@ -30,7 +30,7 @@
 
 
 THREE.ExtrudeGeometry = function( shapes, options ) {
 THREE.ExtrudeGeometry = function( shapes, options ) {
 
 
-	if( typeof( shapes ) == "undefined" ) {
+	if( typeof( shapes ) === "undefined" ) {
 
 
 		shapes = [];
 		shapes = [];
 		return;
 		return;
@@ -312,11 +312,11 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
 
 		// We should not reach these conditions
 		// We should not reach these conditions
 
 
-		if ( v_dot_w_hat == 0 ) {
+		if ( v_dot_w_hat === 0 ) {
 
 
 			console.log( "Either infinite or no solutions!" );
 			console.log( "Either infinite or no solutions!" );
 
 
-			if ( q_sub_p_dot_w_hat == 0 ) {
+			if ( q_sub_p_dot_w_hat === 0 ) {
 
 
 				console.log( "Its finite solutions." );
 				console.log( "Its finite solutions." );
 
 
@@ -348,8 +348,8 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
 
 	for ( i = 0, il = contour.length, j = il-1, k = i + 1; i < il; i++, j++, k++ ) {
 	for ( i = 0, il = contour.length, j = il-1, k = i + 1; i < il; i++, j++, k++ ) {
 
 
-		if ( j == il ) j = 0;
-		if ( k == il ) k = 0;
+		if ( j === il ) j = 0;
+		if ( k === il ) k = 0;
 
 
 		//  (j)---(i)---(k)
 		//  (j)---(i)---(k)
 		// console.log('i,j,k', i, j , k)
 		// console.log('i,j,k', i, j , k)
@@ -372,8 +372,8 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
 
 		for ( i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i++, j++, k++ ) {
 		for ( i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i++, j++, k++ ) {
 
 
-			if ( j == il ) j = 0;
-			if ( k == il ) k = 0;
+			if ( j === il ) j = 0;
+			if ( k === il ) k = 0;
 
 
 			//  (j)---(i)---(k)
 			//  (j)---(i)---(k)
 			oneHoleMovements[ i ]= getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );
 			oneHoleMovements[ i ]= getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );

+ 31 - 31
src/extras/objects/MarchingCubes.js

@@ -54,7 +54,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 		this.hasNormal = false;
 		this.hasNormal = false;
 
 
 		this.positionArray = new Float32Array( this.maxCount * 3 );
 		this.positionArray = new Float32Array( this.maxCount * 3 );
-		this.normalArray   = new Float32Array( this.maxCount * 3 );		
+		this.normalArray   = new Float32Array( this.maxCount * 3 );
 
 
 	};
 	};
 
 
@@ -117,7 +117,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 
 
 		var q3 = q * 3;
 		var q3 = q * 3;
 
 
-		if ( this.normal_cache [ q3 ] == 0.0 ) {
+		if ( this.normal_cache [ q3 ] === 0.0 ) {
 
 
 			this.normal_cache[ q3     ] = this.field[ q - 1  ] 	    - this.field[ q + 1 ];
 			this.normal_cache[ q3     ] = this.field[ q - 1  ] 	    - this.field[ q + 1 ];
 			this.normal_cache[ q3 + 1 ] = this.field[ q - this.yd ] - this.field[ q + this.yd ];
 			this.normal_cache[ q3 + 1 ] = this.field[ q - this.yd ] - this.field[ q + this.yd ];
@@ -163,16 +163,16 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 		// if cube is entirely in/out of the surface - bail, nothing to draw
 		// if cube is entirely in/out of the surface - bail, nothing to draw
 
 
 		var bits = THREE.edgeTable[ cubeindex ];
 		var bits = THREE.edgeTable[ cubeindex ];
-		if ( bits == 0 ) return 0;
+		if ( bits === 0 ) return 0;
 
 
 		var d = this.delta,
 		var d = this.delta,
-			fx2 = fx + d, 
-			fy2 = fy + d, 
+			fx2 = fx + d,
+			fy2 = fy + d,
 			fz2 = fz + d;
 			fz2 = fz + d;
 
 
 		// top of the cube
 		// top of the cube
 
 
-		if ( bits & 1 ) { 
+		if ( bits & 1 ) {
 
 
 			this.compNorm( q );
 			this.compNorm( q );
 			this.compNorm( q1 );
 			this.compNorm( q1 );
@@ -180,23 +180,23 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 
 
 		};
 		};
 
 
-		if ( bits & 2 ) { 
+		if ( bits & 2 ) {
 
 
-			this.compNorm( q1 );  
-			this.compNorm( q1y );  
+			this.compNorm( q1 );
+			this.compNorm( q1y );
 			this.VIntY( q1 * 3, this.vlist, this.nlist, 3, isol, fx2, fy, fz, field1, field3 );
 			this.VIntY( q1 * 3, this.vlist, this.nlist, 3, isol, fx2, fy, fz, field1, field3 );
 
 
 		};
 		};
 
 
-		if ( bits & 4 ) { 
+		if ( bits & 4 ) {
 
 
-			this.compNorm( qy ); 
-			this.compNorm( q1y );  
-			this.VIntX( qy * 3, this.vlist, this.nlist, 6, isol, fx, fy2, fz, field2, field3 ); 
+			this.compNorm( qy );
+			this.compNorm( q1y );
+			this.VIntX( qy * 3, this.vlist, this.nlist, 6, isol, fx, fy2, fz, field2, field3 );
 
 
 		};
 		};
 
 
-		if ( bits & 8 ) { 
+		if ( bits & 8 ) {
 
 
 			this.compNorm( q );
 			this.compNorm( q );
 			this.compNorm( qy );
 			this.compNorm( qy );
@@ -206,19 +206,19 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 
 
 		// bottom of the cube
 		// bottom of the cube
 
 
-		if ( bits & 16 )  { 
+		if ( bits & 16 )  {
 
 
 			this.compNorm( qz );
 			this.compNorm( qz );
 			this.compNorm( q1z );
 			this.compNorm( q1z );
-			this.VIntX( qz * 3, this.vlist, this.nlist, 12, isol, fx, fy, fz2, field4, field5 ); 
+			this.VIntX( qz * 3, this.vlist, this.nlist, 12, isol, fx, fy, fz2, field4, field5 );
 
 
 		};
 		};
 
 
-		if ( bits & 32 )  { 
+		if ( bits & 32 )  {
 
 
-			this.compNorm( q1z );  
-			this.compNorm( q1yz ); 
-			this.VIntY( q1z * 3,  this.vlist, this.nlist, 15, isol, fx2, fy, fz2, field5, field7 ); 
+			this.compNorm( q1z );
+			this.compNorm( q1yz );
+			this.VIntY( q1z * 3,  this.vlist, this.nlist, 15, isol, fx2, fy, fz2, field5, field7 );
 
 
 		};
 		};
 
 
@@ -226,7 +226,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 
 
 			this.compNorm( qyz );
 			this.compNorm( qyz );
 			this.compNorm( q1yz );
 			this.compNorm( q1yz );
-			this.VIntX( qyz * 3, this.vlist, this.nlist, 18, isol, fx, fy2, fz2, field6, field7 ); 
+			this.VIntX( qyz * 3, this.vlist, this.nlist, 18, isol, fx, fy2, fz2, field6, field7 );
 
 
 		};
 		};
 
 
@@ -234,7 +234,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 
 
 			this.compNorm( qz );
 			this.compNorm( qz );
 			this.compNorm( qyz );
 			this.compNorm( qyz );
-			this.VIntY( qz * 3,  this.vlist, this.nlist, 21, isol, fx, fy, fz2, field4, field6 ); 
+			this.VIntY( qz * 3,  this.vlist, this.nlist, 21, isol, fx, fy, fz2, field4, field6 );
 
 
 		};
 		};
 
 
@@ -252,7 +252,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 
 
 			this.compNorm( q1 );
 			this.compNorm( q1 );
 			this.compNorm( q1z );
 			this.compNorm( q1z );
-			this.VIntZ( q1 * 3,  this.vlist, this.nlist, 27, isol, fx2, fy,  fz, field1, field5 ); 
+			this.VIntZ( q1 * 3,  this.vlist, this.nlist, 27, isol, fx2, fy,  fz, field1, field5 );
 
 
 		};
 		};
 
 
@@ -260,15 +260,15 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 
 
 			this.compNorm( q1y );
 			this.compNorm( q1y );
 			this.compNorm( q1yz );
 			this.compNorm( q1yz );
-			this.VIntZ( q1y * 3, this.vlist, this.nlist, 30, isol, fx2, fy2, fz, field3, field7 ); 
+			this.VIntZ( q1y * 3, this.vlist, this.nlist, 30, isol, fx2, fy2, fz, field3, field7 );
 
 
 		};
 		};
 
 
-		if ( bits & 2048 ) { 
+		if ( bits & 2048 ) {
 
 
 			this.compNorm( qy );
 			this.compNorm( qy );
 			this.compNorm( qyz );
 			this.compNorm( qyz );
-			this.VIntZ( qy * 3, this.vlist, this.nlist, 33, isol, fx,  fy2, fz, field2, field6 ); 
+			this.VIntZ( qy * 3, this.vlist, this.nlist, 33, isol, fx,  fy2, fz, field2, field6 );
 
 
 		};
 		};
 
 
@@ -319,15 +319,15 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 		this.positionArray[ c + 7 ] = pos[ o3 + 1 ];
 		this.positionArray[ c + 7 ] = pos[ o3 + 1 ];
 		this.positionArray[ c + 8 ] = pos[ o3 + 2 ];
 		this.positionArray[ c + 8 ] = pos[ o3 + 2 ];
 
 
-		this.normalArray[ c ] = norm[ o1 ]; 
+		this.normalArray[ c ] = norm[ o1 ];
 		this.normalArray[ c + 1 ] = norm[ o1 + 1 ];
 		this.normalArray[ c + 1 ] = norm[ o1 + 1 ];
 		this.normalArray[ c + 2 ] = norm[ o1 + 2 ];
 		this.normalArray[ c + 2 ] = norm[ o1 + 2 ];
 
 
-		this.normalArray[ c + 3 ] = norm[ o2 ]; 
+		this.normalArray[ c + 3 ] = norm[ o2 ];
 		this.normalArray[ c + 4 ] = norm[ o2 + 1 ];
 		this.normalArray[ c + 4 ] = norm[ o2 + 1 ];
 		this.normalArray[ c + 5 ] = norm[ o2 + 2 ];
 		this.normalArray[ c + 5 ] = norm[ o2 + 2 ];
 
 
-		this.normalArray[ c + 6 ] = norm[ o3 ]; 
+		this.normalArray[ c + 6 ] = norm[ o3 ];
 		this.normalArray[ c + 7 ] = norm[ o3 + 1 ];
 		this.normalArray[ c + 7 ] = norm[ o3 + 1 ];
 		this.normalArray[ c + 8 ] = norm[ o3 + 2 ];
 		this.normalArray[ c + 8 ] = norm[ o3 + 2 ];
 
 
@@ -354,7 +354,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 
 
 	this.end = function( render_callback ) {
 	this.end = function( render_callback ) {
 
 
-		if ( this.count == 0 )
+		if ( this.count === 0 )
 			return;
 			return;
 
 
 		for ( var i = this.count * 3; i < this.positionArray.length; i++ )
 		for ( var i = this.count * 3; i < this.positionArray.length; i++ )
@@ -602,7 +602,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
 
 
 		var geo_callback = function( object ) {
 		var geo_callback = function( object ) {
 
 
-			var i, x, y, z, vertex, position, normal, 
+			var i, x, y, z, vertex, position, normal,
 				face, a, b, c, na, nb, nc;
 				face, a, b, c, na, nb, nc;